This commit is contained in:
theo3 2022-03-28 21:01:02 -07:00
parent 6000b4f2d3
commit 65b80571b2
41 changed files with 117 additions and 118 deletions

View File

@ -33,7 +33,7 @@ _080549BC:
ldrb r0, [r6, #2]
ldrb r1, [r6, #3]
bl sub_08052FF4
bl sub_0807C740
bl InitializeCamera
ldr r1, _08054A00 @ =gUpdateVisibleTiles
movs r0, #1
strb r0, [r1]

View File

@ -61,7 +61,7 @@ _08004458: .4byte sub_080043B0
sub_0800445C: @ 0x0800445C
push {r4, r5, lr}
adds r4, r0, #0
bl sub_08079F8C
bl PlayerCanBeMoved
cmp r0, #0
beq _08004482
ldr r5, _080044D8 @ =gPlayerEntity

View File

@ -14,7 +14,7 @@ script_0800E550:
PlaySound SFX_105
Wait 0x001e
EzloMessage 0x1622
Call sub_08053494
Call StartDarkNutTimer
SetLocalFlag 0x007e
script_0800E582:
EnablePlayerControl

View File

@ -28,7 +28,7 @@ typedef struct {
u16 localFlagOffset;
u8 filler[4];
u16 lightLevel;
u8 unk_0b;
u8 lightType;
u8 unk_0c_0 : 1;
u8 unk_0c_1 : 3;
u8 unk_0c_4 : 4;

View File

@ -211,7 +211,7 @@ extern u32 sub_0807953C(void);
extern void sub_08079BD8(Entity*);
extern u32 sub_08079D48();
extern void sub_08079D84(void);
extern bool32 sub_08079F8C(void);
extern bool32 PlayerCanBeMoved(void);
extern u32 sub_08079FC4(u32);
extern void sub_0807A050(void);
extern void sub_0807A5B8(u32);
@ -243,7 +243,7 @@ extern void sub_080A1ED0(u32, u32, u32);
extern Entity* sub_080A2A3C(Entity*, u32, u32, u32);
extern Entity* sub_080A2AD4(Entity*);
extern void sub_080A2AF4(Entity*, s32, s32);
extern void sub_080A2CC0(Entity*, u16**, u16*);
extern void UpdateRailMovement(Entity*, u16**, u16*);
extern void sub_080A57F4(void);
extern void sub_080A71C4(u32, u32, u32, u32);
extern void InitItemGetSequence(u32, u32, u32);

View File

@ -261,7 +261,7 @@ void sub_08052EA0(void);
void sub_08053250(void);
void sub_080533CC(void);
void sub_08053494(void);
void StartDarkNutTimer(void);
void sub_080534AC(void);
void InitBiggoronTimer(void);

View File

@ -36,7 +36,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter);
u32 UpdateFuseInteraction(Entity*);
void NPCInit(Entity* ent);
void sub_0806F0A4(void);
void CollideFollowers(void);
// TODO move?
void sub_08078784(Entity* ent, u32 arg1);

View File

@ -19,7 +19,7 @@ extern void sub_080787B4(Entity*);
extern void sub_0808C650(Entity*, u32);
extern u32 sub_0808C67C(void);
extern void sub_0808C688(void);
extern void sub_080A2BE4(Entity*, bool32);
extern void SyncPlayerToPlatform(Entity*, bool32);
void CreateDust(Entity* parent);
void CreateDustAt(s32, s32, u32);

View File

@ -20,7 +20,7 @@ enum PlayerActions {
PLAYER_EMPTYBOTTLE,
PLAYER_FROZEN,
PLAYER_0807204C,
PLAYER_080720DC,
PLAYER_ROOM_EXIT,
PLAYER_PULL,
PLAYER_LAVA,
PLAYER_WARP,
@ -33,7 +33,7 @@ enum PlayerActions {
PLAYER_080728AC,
PLAYER_INHOLE,
PLAYER_08072C9C,
PLAYER_08074C44,
PLAYER_SLEEP,
PLAYER_CLIMB,
PLAYER_USEENTRANCE,
PLAYER_PARACHUTE,
@ -77,7 +77,7 @@ enum PlayerSpawnType {
PL_SPAWN_DROP,
PL_SPAWN_WALKING,
PL_SPAWN_STEP_IN,
PL_SPAWN_SPECIAL,
PL_SPAWN_SLEEPING,
PL_SPAWN_DROP_MINISH,
PL_SPAWN_STAIRS_ASCEND,
PL_SPAWN_STAIRS_DESCEND,

View File

@ -207,7 +207,7 @@ bool32 IsColliding(Entity* this, Entity* that) {
}
bool32 IsCollidingPlayer(Entity* this) {
if (sub_08079F8C())
if (PlayerCanBeMoved())
return IsColliding(this, &gPlayerEntity);
return FALSE;
}
@ -528,7 +528,7 @@ s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (sub_08079F8C() &&
if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
#else
@ -568,7 +568,7 @@ s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
kind = org->kind;
if (kind == 1) {
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
if (((((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F)) > 0xA) {
x = 0x11aa;
return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
@ -622,7 +622,7 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (sub_08079F8C() &&
if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
#else
@ -651,7 +651,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity && sub_08079F8C())
if (org == &gPlayerEntity && PlayerCanBeMoved())
sub_08004484(tgt, org);
return 0;
}

View File

@ -14,7 +14,7 @@ void BladeTrap(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->child = GetCurrentRoomProperty(this->type);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
if (!(this->direction & 0x80)) {
LinearMoveUpdate(this);
@ -24,6 +24,6 @@ void BladeTrap(Entity* this) {
if (!(this->direction & 0x80)) {
EnqueueSFX(SFX_METAL_CLINK);
}
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
}

View File

@ -27,7 +27,7 @@ void Bombarossa_OnTick(BombarossaEntity* this) {
InitializeAnimation(super, 0);
if (super->type != 0) {
super->child = GetCurrentRoomProperty(super->type);
sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76);
}
}
@ -68,7 +68,7 @@ void sub_0803350C(BombarossaEntity* this) {
}
if (--this->unk_0x76 == 0) {
sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76);
}
}

View File

@ -309,7 +309,7 @@ void Enemy64_Action4(Enemy64Entity* this) {
void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
SoundReq(SFX_BOSS_DIE);
if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 0x1e;
@ -320,7 +320,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
}
void Enemy64_Action4_SubAction1(Enemy64Entity* this) {
if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 1;
@ -438,7 +438,7 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) {
tmpX = super->x.HALF.HI;
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (((this->unk_7c & 1) != 0) && sub_08079F8C()) {
if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
}
@ -447,7 +447,7 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) {
void sub_080499F0(Enemy64Entity* this) {
u32 tmp;
if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (sub_08079F8C())) && ((this->unk_7c & 1) == 0)) {
if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && ((this->unk_7c & 1) == 0)) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
((this->unk_7c & 2) == 0)) {
tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
@ -491,7 +491,7 @@ void sub_08049B20(Enemy64Entity* this) {
tmpX = super->x.HALF.HI;
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (((this->unk_7c & 1) != 0) && sub_08079F8C()) {
if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
}

View File

@ -1035,7 +1035,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
oldY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
}
@ -1053,7 +1053,7 @@ void sub_08047E58(GyorgMaleEntity* this) {
oldY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
}
@ -1126,7 +1126,7 @@ void sub_08048004(GyorgMaleEntity* this) {
COLLISION_OFF(super);
if (gPlayerEntity.z.HALF.HI != 0)
return;
if (!sub_08079F8C())
if (!PlayerCanBeMoved())
return;
if (this->unk_7c & 1) {
u32 b = super->spriteRendering.b3;

View File

@ -118,7 +118,7 @@ void sub_0803CDD8(Entity* this) {
void sub_0803CE14(Entity* this) {
u8 direction;
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
direction = this->direction;
if (direction & 0x80) {

View File

@ -144,7 +144,7 @@ void sub_08034E68(Entity* this) {
sub_08035120(this);
}
if (gRoomTransition.field_0x39 == 0) {
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
this->action = 3;
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
*(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext;

View File

@ -561,7 +561,7 @@ void VaatiWrathType0ActionD(Entity* this) {
void sub_08041BE8(Entity* this) {
Entity* entity;
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
this->subAction = 1;
this->timer = 120;
this->updatePriority = PRIO_NO_BLOCK;

View File

@ -203,7 +203,7 @@ void UpdateEntities(void) {
UpdatePlayerInput();
UpdatePriority();
ClearHitboxList();
sub_0806F0A4();
CollideFollowers();
f = ram_UpdateEntities;
f(0);
ClearAllDeletedEntities();

View File

@ -123,7 +123,7 @@ extern void sub_080186D4(void);
extern void sub_0806F364(void);
extern void sub_08052FF4(u32 area, u32 room);
extern void CloneMapData(void);
extern void sub_0807C740(void);
extern void InitializeCamera(void);
extern void SetBGDefaults(void);
extern void LoadItemGfx(void);
@ -137,7 +137,7 @@ static void UpdateWindcrests(void);
static void UpdateFakeScroll(void);
static void UpdatePlayerMapCoords(void);
static void sub_08052C3C(void);
static void sub_0805340C(void);
static void UpdateTimerCallbacks(void);
static void sub_08051D98(void);
static void sub_08051DCC(void);
static bool32 CheckGameOver(void);
@ -155,7 +155,7 @@ static void sub_080534E4(u32* a1);
static void InitAllRoomResInfo(void);
static void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room);
static void sub_080532E4(void);
static void sub_08053460(void);
static void ResetTimerFlags(void);
typedef struct {
u8 _0;
@ -406,7 +406,7 @@ static void GameMain_Update(void) {
if (CheckInitPauseMenu() || CheckInitPortal()) {
return;
}
sub_0805340C();
UpdateTimerCallbacks();
// leave early if player is now entering a portal
if (gMain.substate != GAMEMAIN_UPDATE) {
@ -499,7 +499,7 @@ static void InitializeEntities(void) {
CallRoomProp6();
InitializePlayer();
gUnk_03004030.unk_00 = NULL;
sub_0807C740();
InitializeCamera();
gUpdateVisibleTiles = 1;
LoadRoomBgm();
SetColor(0, 0);
@ -648,7 +648,7 @@ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
sub_08052FF4(a1, a2);
gRoomControls.scroll_x = gRoomControls.origin_x + a3;
gRoomControls.scroll_y = gRoomControls.origin_y + a4;
sub_0807C740();
InitializeCamera();
gUpdateVisibleTiles = 1;
gUsedPalettes = 0;
gScreen.lcd.displayControl |= tmp;
@ -950,8 +950,8 @@ static void InitializePlayer(void) {
[PL_SPAWN_MINISH] = PLAYER_MINISH,
[PL_SPAWN_DROP] = PLAYER_INIT,
[PL_SPAWN_WALKING] = PLAYER_ROOMTRANSITION,
[PL_SPAWN_STEP_IN] = PLAYER_080720DC,
[PL_SPAWN_SPECIAL] = PLAYER_08074C44,
[PL_SPAWN_STEP_IN] = PLAYER_ROOM_EXIT,
[PL_SPAWN_SLEEPING] = PLAYER_SLEEP,
[PL_SPAWN_DROP_MINISH] = PLAYER_MINISH,
[PL_SPAWN_STAIRS_ASCEND] = PLAYER_USEENTRANCE,
[PL_SPAWN_STAIRS_DESCEND] = PLAYER_USEENTRANCE,
@ -1503,7 +1503,7 @@ void LoadAuxiliaryRoom(u32 area, u32 room) {
sub_08052FF4(area, room);
gRoomControls.camera_target = NULL;
CloneMapData();
sub_0807C740();
InitializeCamera();
}
void sub_08052FF4(u32 area, u32 room) {
@ -1637,7 +1637,7 @@ static void sub_0805329C(void) {
sub_080532E4();
break;
default:
sub_08053460();
ResetTimerFlags();
break;
}
}
@ -1690,7 +1690,7 @@ void sub_080533CC(void) {
gUsedPalettes |= 8;
}
static void sub_0805340C(void) {
static void UpdateTimerCallbacks(void) {
static void (*const sHandlers[])(u32*) = {
sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler,
};
@ -1710,13 +1710,13 @@ static void DummyHandler(u32* a1) {
static void sub_08053434(u32* a1) {
if (gArea.locationIndex == 29 && *a1) {
if (!--*a1) {
sub_08053460();
ResetTimerFlags();
MenuFadeIn(5, 6);
}
}
}
static void sub_08053460(void) {
static void ResetTimerFlags(void) {
static const u16 sClearFlags[] = { FLAG_BANK_10, LV6_GUFUU1_GISHIKI, FLAG_BANK_10, LV6_GUFUU1_DEMO,
FLAG_BANK_10, LV6_ZELDA_DISCURSE, FLAG_BANK_10, LV6_00_ESCAPE,
FLAG_BANK_10, LV6_GUFUU2_DEAD, FLAG_BANK_G, ENDING,
@ -1730,7 +1730,7 @@ static void sub_08053460(void) {
ClearFlagArray(sClearFlags);
}
void sub_08053494(void) {
void StartDarkNutTimer(void) {
gSave.timers[0] = 10800;
}
@ -1762,7 +1762,7 @@ static void ResetTmpFlags(void) {
FLAG_BANK_2, SHOP00_ITEM_01, FLAG_BANK_2, SHOP01_CAFE_01,
0xFFFF };
sub_08053460();
ResetTimerFlags();
ClearFlagArray(sClearFlags);
if (!CheckGlobalFlag(WATERBEAN_PUT))
@ -2084,7 +2084,7 @@ void sub_08053DB4(void) {
if (gFadeControl.active == 0) {
u8* ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[4], gMenu.field_0xc[5]);
sub_0807C740();
InitializeCamera();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[6] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[7] + gRoomControls.scroll_y;
@ -2143,7 +2143,7 @@ void sub_08053F20(void) {
DeleteAllEntities();
ptr = gMenu.field_0xc;
sub_08052FF4(gMenu.field_0xc[8], gMenu.field_0xc[9]);
sub_0807C740();
InitializeCamera();
gUpdateVisibleTiles = 1;
gRoomControls.scroll_x = (s8)ptr[10] + gRoomControls.scroll_x;
gRoomControls.scroll_y = (s8)ptr[0xb] + gRoomControls.scroll_y;

View File

@ -27,7 +27,7 @@ void Manager22_Main(Manager22* this) {
s32 sVar1;
u32 uVar3;
if (gArea.unk_0b == 0) {
if (gArea.lightType == 0) {
sub_0801E104();
gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON);
DeleteThisEntity();
@ -46,7 +46,7 @@ void Manager22_Main(Manager22* this) {
sub_0805BA78();
sub_0805BAD4();
}
if (gArea.unk_0b == 2) {
if (gArea.lightType == 2) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
} else {
if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
@ -56,7 +56,7 @@ void Manager22_Main(Manager22* this) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
}
uVar3 = this->manager.unk_0e;
if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.unk_0b)) {
if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.lightType)) {
if (uVar3 < 0x48) {
uVar3 += 4;
sub_0801E154(uVar3);
@ -127,13 +127,13 @@ extern u16 gUnk_08108CA8[];
void sub_0805BAD4() {
static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808,
0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 };
if (gArea.unk_0b) {
if (gArea.lightType != 0) {
gScreen.controls.alphaBlend = gUnk_08108CA8[(gArea.lightLevel << 0x10) >> 0x14];
}
}
void sub_0805BB00(s32 lightLevel, s32 param_2) {
if (gArea.unk_0b == 0) {
if (gArea.lightType == 0) {
Manager* pManager = GetEmptyManager();
if (pManager != 0) {
pManager->type = 9;
@ -146,9 +146,9 @@ void sub_0805BB00(s32 lightLevel, s32 param_2) {
gScreen.controls.layerFXControl = 0x3e48;
gRoomVars.lightLevel = lightLevel;
if (param_2) {
gArea.unk_0b = 1;
gArea.lightType = 1;
} else {
gArea.unk_0b = 2;
gArea.lightType = 2;
}
}
@ -173,7 +173,7 @@ s32 UpdateLightLevel() {
s32 iVar1;
iVar1 = 0;
if (gArea.unk_0b && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
if (iVar1) {
@ -187,7 +187,7 @@ s32 sub_0805BC04(void) {
s32 iVar1;
iVar1 = 0;
if (gArea.unk_0b && gRoomVars.lightLevel > (short)gArea.lightLevel) {
if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
if (iVar1) {
@ -198,8 +198,8 @@ s32 sub_0805BC04(void) {
}
void sub_0805BC4C() {
if (gArea.unk_0b != 0) {
gArea.unk_0b = 0;
if (gArea.lightType != 0) {
gArea.lightType = 0;
gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON);
}
}

View File

@ -63,7 +63,7 @@ void nullsub_110(void) {
void sub_080663D4(Entity* this) {
if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) {
if (gPlayerEntity.action != PLAYER_080720DC) {
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
this->action = 4;
this->direction = 0;
this->speed = 0;
@ -94,7 +94,7 @@ void sub_0806643C(Entity* this) {
}
void sub_08066474(void) {
if (gPlayerEntity.action != PLAYER_080720DC) {
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
gPauseMenuOptions.disabled = 0;
}
}

View File

@ -274,7 +274,7 @@ s32 sub_0806F078(Entity* ent, s32 a2) {
return 0;
}
void sub_0806F0A4(void) {
void CollideFollowers(void) {
LinkedList* entityList = gEntityLists + 7;
Entity* currentEntity;
u32 val;

View File

@ -57,7 +57,7 @@ void BigPushableLever_Idle(BigPushableLeverEntity* this) {
SetTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer);
EnqueueSFX(SFX_132);
RequestPriorityDuration(super, 0x1e);
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
gPlayerState.pushedObject = 0x98;
gPlayerState.queued_action = 5;
gPlayerState.flags |= PL_BUSY;

View File

@ -211,9 +211,9 @@ void Bird_Type8(Entity* this) {
this->speed = 0x300;
}
if ((gPlayerEntity.flags & 0x80) != 0 && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != 28 &&
gPlayerEntity.action != 6 && gPlayerEntity.action != 9 && gPlayerState.framestate != 24 &&
gPlayerState.framestate != 11 && gPlayerState.framestate != 8 && sub_08079F8C() &&
if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != PLAYER_SLEEP &&
gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB &&
gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && PlayerCanBeMoved() &&
(EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) {
s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8;
if ((u16)z < 0x20 && gPlayerEntity.health != 0) {

View File

@ -58,7 +58,7 @@ void sub_08098BE0(BoardEntity* this) {
}
void sub_08098BE8(BoardEntity* this) {
if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && sub_08079F8C() &&
if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && PlayerCanBeMoved() &&
gPlayerEntity.z.HALF.HI == 0) {
gPlayerState.field_0x14 = 1;
sub_0807AAF8(&gPlayerEntity, this->tile);

View File

@ -165,7 +165,7 @@ Entity* sub_08081D74(Entity* this) {
u32 sub_08081E0C(Entity* this) {
Entity* tmp = &gPlayerEntity;
if (tmp->z.HALF.HI != 0 || !sub_08079F8C()) {
if (tmp->z.HALF.HI != 0 || !PlayerCanBeMoved()) {
return 0;
} else {
return EntityInRectRadius(this, tmp, 5, 6);

View File

@ -113,7 +113,7 @@ void sub_0809EE44(FanEntity* this) {
if (uVar4 != 0) {
pEVar1 = &gPlayerEntity;
if (sub_0809EF78(this, pEVar1)) {
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
sub_08079E58(super->speed, super->direction);
}
}

View File

@ -29,7 +29,7 @@ void sub_080860D8(FloatingPlatformEntity* this) {
super->frameIndex = super->type;
super->spritePriority.b0 = 7;
super->child = (Entity*)GetCurrentRoomProperty(super->type2);
sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
UpdateRailMovement(super, (u16**)&super->child, &this->unk70);
}
void sub_0808611C(FloatingPlatformEntity* this) {
@ -41,15 +41,15 @@ void sub_0808611C(FloatingPlatformEntity* this) {
super->parent->timer++;
}
sub_080A2BE4(super, iVar2);
SyncPlayerToPlatform(super, iVar2);
} else if (super->timer == 0) {
sub_080A2BE4(super, iVar2);
SyncPlayerToPlatform(super, iVar2);
} else {
sub_080A2BE4(super, FALSE);
SyncPlayerToPlatform(super, FALSE);
}
if (--this->unk70 == 0) {
sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
UpdateRailMovement(super, (u16**)&super->child, &this->unk70);
}
}
@ -58,7 +58,7 @@ bool32 sub_08086168(FloatingPlatformEntity* this) {
const u8* ptr;
ptr = gUnk_08120658 + super->type * 2;
if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && sub_08079F8C())) {
if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && PlayerCanBeMoved())) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
return TRUE;

View File

@ -225,7 +225,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) {
}
this->unk_6c = 0;
gRoomTransition.field_0x39 = 0;
if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
super->action = 9;
super->timer = 0;
super->subtimer = 0xF0;
@ -479,7 +479,7 @@ u32 sub_080A20B8(GyorgBossObjectEntity* this, GyorgMaleEntity* other) {
if (other == NULL) {
return 1;
}
if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
return other->unk_7c == 0 && gPlayerState.field_0x14 != 0;
}
return 0;

View File

@ -18,11 +18,11 @@ typedef struct {
/*0x72*/ u16 wobbleTime; /**< Time the player can stand on the platform. */
/*0x74*/ u16 respawnTime; /**< Time until the platform respawns after it has sunk. */
/*0x76*/ u16 unk_76;
/*0x78*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0
/*0x78*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement
} LavaPlatformEntity;
typedef struct {
/*0x00*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0
/*0x00*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement
/*0x04*/ s16 x;
/*0x06*/ s16 y;
/*0x08*/ u8 collisionLayer;
@ -246,7 +246,7 @@ void LavaPlatform_SpawnPlatforms(LavaPlatformEntity* this) {
platform->respawnTime = entry->respawnTime;
platform->unk_78 = entry->unk_78;
UpdateSpriteForCollisionLayer((Entity*)platform);
sub_080A2CC0(&platform->base, (u16**)&platform->unk_78, &platform->unk_76);
UpdateRailMovement(&platform->base, (u16**)&platform->unk_78, &platform->unk_76);
}
entry++;
}
@ -282,7 +282,7 @@ void sub_0809264C(LavaPlatformEntity* this) {
bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) {
if ((gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) &&
sub_08079F8C()) {
PlayerCanBeMoved()) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
super->subtimer = 1;
@ -294,12 +294,12 @@ bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) {
}
void sub_080926E4(LavaPlatformEntity* this) {
sub_080A2BE4(super, super->subtimer);
SyncPlayerToPlatform(super, super->subtimer);
if (super->action == 1) {
(super->parent)->x.HALF.HI = super->x.HALF.HI;
(super->parent)->y.HALF.HI = super->y.HALF.HI;
}
if (--this->unk_76 == 0) {
sub_080A2CC0(super, (u16**)&this->unk_78, &this->unk_76);
UpdateRailMovement(super, (u16**)&this->unk_78, &this->unk_76);
}
}

View File

@ -65,7 +65,7 @@ void sub_0809EAD8(Entity* this) {
if (this->type2 != 0) {
this->child = GetCurrentRoomProperty(this->type2);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
} else {
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
@ -82,7 +82,7 @@ void sub_0809EB30(Entity* this) {
}
puVar2 = &this->field_0x74.HWORD;
if (!--*puVar2) {
sub_080A2CC0(this, (u16**)&this->child, puVar2);
UpdateRailMovement(this, (u16**)&this->child, puVar2);
}
}
}

View File

@ -4,7 +4,7 @@
extern u16 gUnk_08123318[];
static void sub_08097B24(Entity* this);
static bool32 sub_08097ADC(Entity* this);
static bool32 CheckMovePlayer(Entity* this);
void LilypadSmall(Entity* this) {
u32 rand;
@ -19,22 +19,22 @@ void LilypadSmall(Entity* this) {
this->spriteSettings.draw = TRUE;
this->spritePriority.b0 = 7;
this->child = GetCurrentRoomProperty(this->type2);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
}
sub_080A2BE4(this, sub_08097ADC(this));
SyncPlayerToPlatform(this, CheckMovePlayer(this));
sub_08097B24(this);
psVar4 = (u16*)&this->field_0x70;
if (--*psVar4 == 0) {
sub_080A2CC0(this, (u16**)&this->child, psVar4);
UpdateRailMovement(this, (u16**)&this->child, psVar4);
}
}
static bool32 sub_08097ADC(Entity* this) {
static bool32 CheckMovePlayer(Entity* this) {
if (!(gPlayerState.flags & PL_MINISH)) {
return FALSE;
} else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) {
return FALSE;
} else if (!sub_08079F8C()) {
} else if (!PlayerCanBeMoved()) {
return FALSE;
} else {
gPlayerState.field_0x14 = 1;

View File

@ -48,7 +48,7 @@ void sub_0809E360(Object98Entity* this) {
SetDefaultPriority(super, 0);
if (super->type != 0) {
super->child = (Entity*)GetCurrentRoomProperty(super->type);
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
UpdateRailMovement(super, (u16**)&super->child, &this->unk74);
}
}
}
@ -62,7 +62,7 @@ void sub_0809E3E4(Object98Entity* this) {
}
if (--this->unk74 == 0) {
sub_080A2CC0(super, (u16**)&super->child, &this->unk74);
UpdateRailMovement(super, (u16**)&super->child, &this->unk74);
}
}
}

View File

@ -56,7 +56,7 @@ void PushableLever_Idle(PushableLeverEntity* this) {
SetTile(this->tileIndex, this->tilePosition, super->collisionLayer);
EnqueueSFX(SFX_16A);
RequestPriorityDuration(super, 0x1e);
if (sub_08079F8C()) {
if (PlayerCanBeMoved()) {
gPlayerState.pushedObject = 0x90;
gPlayerState.queued_action = 5;
gPlayerState.flags |= PL_BUSY;

View File

@ -205,7 +205,7 @@ void sub_0808B73C(Entity* this) {
u32 sub_0808B7C8(Entity* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && gPlayerEntity.health != 0 &&
sub_08079F8C() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) {
PlayerCanBeMoved() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) {
if (this->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) {
ResetPlayerAnimationAndAction();
}

View File

@ -261,7 +261,7 @@ void CreateSparkle(Entity* entity) {
}
}
NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Entity* this, bool32 param_2)) {
NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void SyncPlayerToPlatform(Entity* this, bool32 param_2)) {
s16 oldValue;
s32 diff;
u16 newValue;
@ -307,7 +307,7 @@ NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Enti
}
END_NONMATCH
void sub_080A2CC0(Entity* this, u16** param_2, u16* param_3) {
void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) {
u16* ptr = *param_2;
if (ptr != NULL) {
if (*ptr == 0xfe) {

View File

@ -63,7 +63,7 @@ static EntityAction sub_08071DB8;
static EntityAction PlayerEmptyBottle;
static EntityAction PlayerFrozen;
static EntityAction sub_0807204C;
static EntityAction sub_080720DC;
static EntityAction PlayerRoomExit;
static EntityAction PlayerPull;
static EntityAction PlayerLava;
EntityAction PlayerWarp; // why is this defined in playerUtils.c? We may never know : (
@ -76,7 +76,7 @@ static EntityAction PlayerRoll;
static EntityAction PlayerWaitForScroll;
static EntityAction PlayerInHole;
static EntityAction sub_08072C9C;
static EntityAction sub_08074C44;
static EntityAction PlayerSleep;
static EntityAction PlayerClimb;
static EntityAction PlayerUseEntrance;
static EntityAction PlayerParachute;
@ -152,7 +152,7 @@ static EntityAction PlayerFrozenUpdate;
static EntityAction sub_08072064;
static EntityAction sub_08072098;
// PLAYER_080720DC
// PLAYER_ROOM_EXIT
static EntityAction sub_08072100;
static EntityAction sub_08072168;
@ -229,7 +229,7 @@ static EntityAction sub_08074018;
static EntityAction sub_08074060;
static EntityAction sub_080740D8;
// PLAYER_08074C44
// PLAYER_SLEEP
static EntityAction sub_08074C68;
static EntityAction sub_08074CF8;
static EntityAction sub_08074F00;
@ -317,7 +317,7 @@ void DoPlayerAction(Entity* this) {
[PLAYER_EMPTYBOTTLE] = PlayerEmptyBottle,
[PLAYER_FROZEN] = PlayerFrozen,
[PLAYER_0807204C] = sub_0807204C,
[PLAYER_080720DC] = sub_080720DC,
[PLAYER_ROOM_EXIT] = PlayerRoomExit,
[PLAYER_PULL] = PlayerPull,
[PLAYER_LAVA] = PlayerLava,
[PLAYER_WARP] = PlayerWarp,
@ -330,7 +330,7 @@ void DoPlayerAction(Entity* this) {
[PLAYER_080728AC] = PlayerWaitForScroll,
[PLAYER_INHOLE] = PlayerInHole,
[PLAYER_08072C9C] = sub_08072C9C,
[PLAYER_08074C44] = sub_08074C44,
[PLAYER_SLEEP] = PlayerSleep,
[PLAYER_CLIMB] = PlayerClimb,
[PLAYER_USEENTRANCE] = PlayerUseEntrance,
[PLAYER_PARACHUTE] = PlayerParachute,
@ -1773,7 +1773,7 @@ static void sub_08072098(Entity* this) {
SetPlayerActionNormal();
}
static void sub_080720DC(Entity* this) {
static void PlayerRoomExit(Entity* this) {
static EntityAction* const gUnk_0811BB60[] = {
sub_08072100,
sub_08072168,
@ -3787,7 +3787,7 @@ static void conveyer_push(Entity* this) {
LinearMoveUpdate(this);
}
static void sub_08074C44(Entity* this) {
static void PlayerSleep(Entity* this) {
static EntityAction* const gUnk_0811BC88[] = {
sub_08074C68,
sub_08074CF8,
@ -4068,7 +4068,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) {
MemClear(&gPlayerScriptExecutionContext, sizeof(ScriptExecutionContext));
gPlayerScriptExecutionContext.scriptInstructionPointer = script;
((fixme*)&gPlayerEntity)->ctx = &gPlayerScriptExecutionContext;
gPlayerState.queued_action = PLAYER_08074C44;
gPlayerState.queued_action = PLAYER_SLEEP;
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = 0;
gPlayerState.field_0x3a = a2;

View File

@ -861,7 +861,7 @@ void CreateEzloHint(u32 hintId, u32 hintHeight) {
}
void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) {
gPlayerState.queued_action = PLAYER_080720DC;
gPlayerState.queued_action = PLAYER_ROOM_EXIT;
gPlayerState.field_0x38 = param_1;
gPlayerState.field_0x39 = param_2 != 0;
gPlayerState.field_0x3a = param_3 != 0;
@ -1272,11 +1272,11 @@ bool32 sub_08079F48(u32 param_1, u32 param_2) {
return TRUE;
}
bool32 sub_08079F8C(void) {
bool32 PlayerCanBeMoved(void) {
if ((gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS |
PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 ||
gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || gPlayerEntity.action == 0xb) {
gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL || gPlayerEntity.action == PLAYER_08071DB8) {
return FALSE;
} else {
return TRUE;
@ -1309,7 +1309,7 @@ void DeleteClones(void) {
gPlayerClones[2] = NULL;
gPlayerState.flags &= ~PL_CLONING;
if (((gPlayerEntity.action != 0x17) || (gPlayerState.chargeState.action != 4)) &&
((u8)(gPlayerState.chargeState.action - 4) < 2)) {
(gPlayerState.chargeState.action == 4 || gPlayerState.chargeState.action == 5)) {
gPlayerState.chargeState.action = 1;
}
}
@ -2010,7 +2010,7 @@ ASM_FUNC("asm/non_matching/playerUtils/sub_0807C5F4.inc", void sub_0807C5F4())
ASM_FUNC("asm/non_matching/playerUtils/sub_0807C69C.inc", void sub_0807C69C())
ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void sub_0807C740())
ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera())
void sub_0807C810(void) {
struct_03004030* ptr;

View File

@ -667,7 +667,7 @@ void sub_StateChange_HyruleCastle_3(void) {
u32 sub_unk3_HyruleCastle_4(void) {
if (!CheckLocalFlag(CASTLE_04_MEZAME)) {
gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL;
gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING;
ClearGlobalFlag(ZELDA_CHASE);
}
return 1;
@ -5472,7 +5472,7 @@ void sub_StateChange_HouseInteriors3_Bakery(void) {
u32 sub_unk3_HouseInteriors3_Simon(void) {
if (CheckGlobalFlag(MAROYA_WAKEUP)) {
gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL;
gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING;
}
return 1;
}

View File

@ -218,7 +218,7 @@ void StartPlayerScript(u16* script) {
gPlayerScriptExecutionContext.scriptInstructionPointer = script;
player = &gPlayerEntity;
*(ScriptExecutionContext**)&player->cutsceneBeh = &gPlayerScriptExecutionContext;
gPlayerState.queued_action = PLAYER_08074C44;
gPlayerState.queued_action = PLAYER_SLEEP;
gPlayerState.field_0x3a = 0;
gPlayerState.field_0x39 = 0;
gPlayerState.field_0x38 = 0;

View File

@ -97,8 +97,7 @@ void StaffrollTask_State1(void) {
}
void StaffrollTask_State1MenuType0(void) {
gMenu.transitionTimer -= 1;
if (gMenu.transitionTimer == 0) {
if (--gMenu.transitionTimer == 0) {
sub_080A3954();
}
}