Merge branch 'master' into enemies

This commit is contained in:
octorock 2023-12-29 23:07:22 +01:00
commit 242336c385
165 changed files with 624 additions and 603 deletions

View File

@ -10,41 +10,43 @@ CheckBits: @ 0x08000F10
ldr r3, _08000F50 @ =ram_CheckBits
bx r3
thumb_func_start sub_08000F14
sub_08000F14: @ 0x08000F14
// sum 3 drop probability vectors
thumb_func_start SumDropProbabilities
SumDropProbabilities: @ 0x08000F14
push {r4, r5, r6}
movs r4, #0x1e
movs r4, #30 // vector addition for 16 shorts in reverse
_08000F18:
ldrsh r5, [r1, r4]
ldrsh r6, [r2, r4]
adds r5, r5, r6
ldrsh r6, [r3, r4]
adds r5, r5, r6
strh r5, [r0, r4]
ldrsh r5, [r1, r4] // row 1
ldrsh r6, [r2, r4] // + row 2
adds r5, r6
ldrsh r6, [r3, r4] // + row 3
adds r5, r6
strh r5, [r0, r4] // store in output
subs r4, #2
bpl _08000F18
pop {r4, r5, r6}
bx lr
thumb_func_start sub_08000F2C
sub_08000F2C: @ 0x08000F2C
// sum 3 drop probabilities, clamp to 0, return scalar sum
thumb_func_start SumDropProbabilities2
SumDropProbabilities2: @ 0x08000F2C
push {r4, r5, r6, r7}
movs r4, #0x1e
movs r7, #0
movs r4, #30
movs r7, #0 // sum
_08000F32:
ldrsh r5, [r1, r4]
ldrsh r6, [r2, r4]
adds r5, r5, r6
ldrsh r6, [r3, r4]
adds r5, r5, r6
bpl _08000F40
ldrsh r5, [r1, r4] // row 1
ldrsh r6, [r2, r4] // + row 2
adds r5, r6
ldrsh r6, [r3, r4] // + row 3
adds r5, r6
bpl positive_drop_chance // clamp to 0
movs r5, #0
_08000F40:
strh r5, [r0, r4]
adds r7, r7, r5
positive_drop_chance:
strh r5, [r0, r4] // store in output
adds r7, r5
subs r4, #2
bpl _08000F32
adds r0, r7, #0
adds r0, r7, #0 // return sum
pop {r4, r5, r6, r7}
bx lr
.align 2, 0

View File

@ -18,7 +18,7 @@ EnemyUpdate: @ 0x080011C4
bne _080011EA
bl DeleteThisEntity
_080011DC:
bl EntityIsDeleted
bl EntityDisabled
cmp r0, #0
bne _0800120A
adds r0, r4, #0

View File

@ -18,7 +18,7 @@ ProjectileUpdate: @ 0x08016AE4
bne _08016B0A
bl DeleteThisEntity
_08016AFC:
bl EntityIsDeleted
bl EntityDisabled
cmp r0, #0
bne _08016B22
adds r0, r4, #0

View File

@ -6,7 +6,9 @@
#include "color.h"
#include "sprite.h"
#define MAX_ENTITIES 71
#define MAX_ENTITIES 72
#define MAX_MANAGERS 32
#define MAX_AUX_PLAYER_ENTITIES 7
/** Kinds of Entity's supported by the game. */
typedef enum {
@ -38,6 +40,8 @@ typedef enum {
typedef enum {
ENT_DID_INIT = 0x1, /**< Graphics and other data loaded. */
ENT_SCRIPTED = 0x2, /**< Execute in a scripted environment. */
ENT_UNUSED1 = 0x4, /**< Unused delete flag. */
ENT_UNUSED2 = 0x8, /**< Unused delete flag. */
ENT_DELETED = 0x10, /**< Queue deletion next frame. */
ENT_PERSIST = 0x20, /**< Persist between rooms. */
ENT_COLLIDE = 0x80, /**< Collide with other Entity's. */
@ -238,6 +242,15 @@ typedef struct LinkedList {
Entity* first;
} LinkedList;
/**
* LinkedList's which point to allocate Entities.
* These work together with Entity.prev and Entity.next fields
* to allow the iteration of all Entity's.
*/
extern LinkedList gEntityLists[9];
extern Entity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES];
extern Entity gEntities[MAX_ENTITIES];
typedef void(EntityAction)(Entity*);
typedef void (*EntityActionPtr)(Entity*);
typedef void (*const* EntityActionArray)(Entity*);
@ -283,7 +296,7 @@ Entity* CreateEnemy(u32 id, u32 type);
Entity* CreateNPC(u32 id, u32 type, u32 type2);
Entity* CreateObject(u32 id, u32 type, u32 type2);
Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2);
Entity* CreateItemGetEntity(void);
Entity* CreateAuxPlayerEntity(void);
Entity* CreateFx(Entity* parent, u32 type, u32 type2);
/// @}
@ -386,12 +399,15 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2);
* @param entity Entity to set the priority of.
* @param prio #Priority level.
*/
void SetDefaultPriority(Entity* entity, u32 prio);
void SetEntityPriority(Entity* entity, u32 prio);
/**
* Check if entity will be deleted next frame.
* Check if entity is disabled. Entities are disabled if:
* - They are deleted.
* - There is an event and the entity doesn't have priority
* (n/a if entity is in action 0).
*/
bool32 EntityIsDeleted(Entity* entity);
bool32 EntityDisabled(Entity* entity);
/**
* Check if system or entity is blocking updates.
@ -477,18 +493,10 @@ void SetInitializationPriority(void);
/**
* Reset the system update priority.
*/
void ResetSystemPriority(void);
void ClearEventPriority(void);
void sub_0805E958(void);
/**
* LinkedList's which point to allocate Entities.
* These work together with Entity.prev and Entity.next fields
* to allow the iteration of all Entity's.
*/
extern LinkedList gEntityLists[9];
extern Entity gItemGetEntities[7];
typedef struct {
u8 unk_0;
u8 unk_1;

View File

@ -83,7 +83,7 @@ extern void sub_08030118(u32);
extern void sub_0803C0AC(Entity*);
extern void sub_08049CF4(Entity*);
extern u32 sub_0804A024(Entity*, u32, u32);
extern u32 sub_080542AC(u32);
extern u32 IsMinishItem(u32);
extern void DisableRandomDrops();
extern void EnableRandomDrops(void);
extern s32 sub_08056338(void);

View File

@ -5,8 +5,10 @@
#include "entity.h"
#include "structures.h"
#define MESSAGE_ACTIVE 0x7f
typedef struct {
u8 doTextBox;
u8 state;
u8 unk;
u8 textSpeed;
u8 unk3; // HI?

View File

@ -0,0 +1,23 @@
#ifndef LINKANIMATION_H
#define LINKANIMATION_H
#ifndef NENT_DEPRECATED
#error "linkAnimtion.h requires new entities"
#endif
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 storeDrawFlags;
/*0x69*/ u8 storeFlags;
/*0x6a*/ u8 storeIFrames;
/*0x6b*/ u8 storeField7;
/*0x6c*/ u8 storeKeepFacing;
/*0x6d*/ u8 storeFieldA;
/*0x6e*/ u8 storeField27;
/*0x6f*/ u8 storeMobility;
/*0x70*/ u32 storeStateFlags;
/*0x74*/ u8 store8A;
} LinkAnimationEntity;
#endif // LINKANIMATION_H

View File

@ -243,29 +243,27 @@ typedef struct {
} PlayerMacroEntry;
typedef enum {
PLAYER_INPUT_1 = 0x1, // A
PLAYER_INPUT_2 = 0x2, // B
PLAYER_INPUT_8 = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
PLAYER_INPUT_10 = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
PLAYER_INPUT_20 = 0x20, // R sub_0807953C
PLAYER_INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
PLAYER_INPUT_80 =
INPUT_USE_ITEM1 = 0x1, // A
INPUT_USE_ITEM2 = 0x2, // B
INPUT_INTERACT = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2
INPUT_CANCEL = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2
INPUT_CONTEXT = 0x20, // R sub_0807953C
INPUT_40 = 0x40, // A CrenelBeanSprout_Action1
INPUT_ACTION =
0x80, // R sub_08073584, IsPreventedFromUsingItem, sub_080782C0, CrenelBeanSprout_Action1, ItemForSale_Action2
PLAYER_INPUT_RIGHT = 0x100,
PLAYER_INPUT_LEFT = 0x200,
PLAYER_INPUT_UP = 0x400,
PLAYER_INPUT_DOWN = 0x800,
PLAYER_INPUT_ANY_DIRECTION = 0xf00,
PLAYER_INPUT_1000 = 0x1000, // L, where is it set? sub_080782C0
PLAYER_INPUT_8000 = 0x8000, // R, IsTryingToPickupObject, sub_08076518
// TODO What is the result of u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000;?
INPUT_RIGHT = 0x100,
INPUT_LEFT = 0x200,
INPUT_UP = 0x400,
INPUT_DOWN = 0x800,
INPUT_ANY_DIRECTION = 0xf00,
INPUT_FUSE = 0x1000, // L, where is it set? sub_080782C0
INPUT_LIFT_THROW = 0x8000, // R, IsTryingToPickupObject, sub_08076518
} PlayerInputState;
typedef struct {
/*0x0*/ u16 heldInput; /**< Input currently held @see PlayerInputState */
/*0x2*/ u16 newInput; /**< New input this frame @see PlayerInputState */
/*0x4*/ u32 field_0x94;
/*0x4*/ u32 unused;
/*0x8*/ u16 playerMacroWaiting;
/*0xa*/ u16 playerMacroHeldKeys;
/*0xc*/ PlayerMacroEntry* playerMacro;
@ -535,7 +533,7 @@ typedef struct {
/*0x09*/ u8 _hasAllFigurines;
/*0x0a*/ u8 charm;
/*0x0b*/ u8 picolyteType;
/*0x0c*/ u8 itemButtons[2];
/*0x0c*/ u8 equipped[2];
/*0x0e*/ u8 bottles[4];
/*0x12*/ u8 effect;
/*0x13*/ u8 hasAllFigurines;
@ -722,7 +720,7 @@ s32 AddInteractableObject(Entity*, u32, u32);
void RemoveInteractableObject(Entity*);
s32 GetInteractableObjectIndex();
void sub_08078AC0(u32, u32, u32);
void sub_08078B48(void);
void PausePlayer(void);
void sub_08078E84(Entity*, Entity*);
void sub_08078FB0(Entity*);
void sub_080792BC(s32, u32, u32);

View File

@ -191,8 +191,8 @@ extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS];
static_assert(sizeof(gActiveItems) == 0x70);
typedef struct {
u8 sys_priority; // system requested priority
u8 ent_priority; // entity requested priority
u8 event_priority; // system requested priority
u8 ent_priority; // entity requested priority
u8 queued_priority;
u8 queued_priority_reset;
Entity* requester;

View File

@ -132,8 +132,8 @@ SECTIONS {
. = 0x000010A0; gRoomTransition = .;
. = 0x00001150; gRand = .;
. = 0x00001160; gPlayerEntity = .;
. = 0x000011E8; gItemGetEntities = .;
. = 0x000015A0; gUnk_030015A0 = .;
. = 0x000011E8; gAuxPlayerEntities = .;
. = 0x000015A0; gEntities = .;
. = 0x00003BE0; gCarriedEntity = .;
. = 0x00003C70; gUnk_03003C70 = .;
. = 0x00003D70; gEntityLists = .;

View File

@ -313,7 +313,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_READ;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_40)) == 0) {
return 0;
}
gPlayerState.mobility = 1;
@ -327,7 +327,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) {
return 0;
}
gPlayerState.mobility = 1;
@ -338,7 +338,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN;
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) {
return 0;
}
gPlayerState.mobility = 1;

View File

@ -138,40 +138,40 @@ void UpdatePlayerInput(void) {
gPlayerState.playerInput.heldInput = state;
gPlayerState.playerInput.newInput = state & prevState;
// Calculate the direction from the currently held input.
gPlayerState.direction = gUnk_08109202[(state & PLAYER_INPUT_ANY_DIRECTION) >> 8];
gPlayerState.direction = gUnk_08109202[(state & INPUT_ANY_DIRECTION) >> 8];
}
u32 ConvInputToState(u32 keys) {
u32 result;
if (keys & L_BUTTON) {
result = 0x1000;
result = INPUT_FUSE;
} else {
result = 0;
}
if (keys & R_BUTTON) {
result |= PLAYER_INPUT_20;
result |= PLAYER_INPUT_8000;
result |= PLAYER_INPUT_80;
result |= INPUT_CONTEXT;
result |= INPUT_LIFT_THROW;
result |= INPUT_ACTION;
}
if (keys & A_BUTTON) {
result |= PLAYER_INPUT_8;
result |= PLAYER_INPUT_40 | PLAYER_INPUT_1;
result |= INPUT_INTERACT;
result |= INPUT_40 | INPUT_USE_ITEM1;
}
if (keys & B_BUTTON) {
result |= PLAYER_INPUT_10;
result |= PLAYER_INPUT_2;
result |= INPUT_CANCEL;
result |= INPUT_USE_ITEM2;
}
if (keys & DPAD_RIGHT) {
result |= PLAYER_INPUT_RIGHT;
result |= INPUT_RIGHT;
}
if (keys & DPAD_LEFT) {
result |= PLAYER_INPUT_LEFT;
result |= INPUT_LEFT;
}
if (keys & DPAD_UP) {
result |= PLAYER_INPUT_UP;
result |= INPUT_UP;
}
if (keys & DPAD_DOWN) {
result |= PLAYER_INPUT_DOWN;
result |= INPUT_DOWN;
}
return result;
}

View File

@ -63,8 +63,8 @@ void CollisionMain(void) {
u32 prio;
// pick highest priority
prio = gPriorityHandler.sys_priority;
if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority)
prio = gPriorityHandler.event_priority;
if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority)
prio = gPriorityHandler.ent_priority;
// if any priority is set, dont do collision

View File

@ -747,7 +747,7 @@ void Fuse_Action0(void) {
}
void Fuse_Action1(void) {
if ((gMessage.doTextBox & 0x7F) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
MenuFadeIn(4, 0);
gFuseInfo.fusionState = FUSION_STATE_4;
gFuseInfo.action = 2;
@ -773,7 +773,7 @@ void Fuse_Action2(void) {
}
void Fuse_Action3(void) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
if (gFuseInfo.entity != NULL) {
gFuseInfo.entity->updatePriority = gFuseInfo.prevUpdatePriority;
}

View File

@ -52,7 +52,7 @@ void sub_080535AC(void) {
void sub_080535F4(void) {
if (gFadeControl.active == 0) {
ResetSystemPriority();
ClearEventPriority();
gMenu.overlayType = 2;
}
}
@ -234,7 +234,7 @@ void sub_08053758(void) {
gScreen.bg1.control = 0x1c4e;
gScreen.bg2.control = 0x1dc1;
SoundReq(BGM_STORY);
ResetSystemPriority();
ClearEventPriority();
SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100);
}
@ -344,7 +344,7 @@ void sub_08053A1C(void) {
}
void sub_08053A5C(void) {
if (((gMessage.doTextBox & 0x7f) == 0) && --gMenu.transitionTimer == 0) {
if (((gMessage.state & MESSAGE_ACTIVE) == 0) && --gMenu.transitionTimer == 0) {
gMenu.overlayType++;
SetFade(FADE_IN_OUT | FADE_INSTANT, 8);
}
@ -451,7 +451,7 @@ void sub_08053B74(void) {
gMenu.overlayType++;
gUpdateVisibleTiles = 1;
LoadRoomEntityList(gUnk_080FCDE0);
ResetSystemPriority();
ClearEventPriority();
ResetEntityPriority();
SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100);
}

View File

@ -256,7 +256,7 @@ void AcroBandit_Type0Action5(AcroBanditEntity* this) {
GetNextFrame(super);
if (super->frame & ANIM_DONE) {
if (gEntCount < MAX_ENTITIES - 4) {
if (gEntCount < MAX_ENTITIES - 5) {
u32 tmp = Random();
tmp &= 3;

View File

@ -226,7 +226,7 @@ void BusinessScrub_Action3(BusinessScrubEntity* this) {
if (iVar1 != NULL) {
iVar1->spritePriority.b0 = 3;
iVar1->z.HALF.HI -= 12;
SetDefaultPriority(iVar1, PRIO_MESSAGE);
SetEntityPriority(iVar1, PRIO_MESSAGE);
}
SetFlag(this->unk_86);
sub_0802925C(this);
@ -262,7 +262,7 @@ void BusinessScrub_Action5(BusinessScrubEntity* this) {
struct SalesOffering* offer = (struct SalesOffering*)this->unk_7c;
u32 subtype;
if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0 && sub_0802915C(this) && !sub_08056338()) {
if (offer->price <= gSave.stats.rupees) {
if (BusinessScrub_CheckRefillFitsBag(this)) {
/* Bag full. */
@ -331,11 +331,11 @@ void BusinessScrub_Action6(BusinessScrubEntity* this) {
}
void BusinessScrub_Action7(BusinessScrubEntity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
struct SalesOffering* offer = (struct SalesOffering*)this->unk_7c;
super->action = 4;
super->subAction = gMessage.doTextBox & 0x7f;
super->subAction = gMessage.state & MESSAGE_ACTIVE;
super->timer = 1;
if (!CheckLocalFlag(offer->local_flag)) {
SetLocalFlag(offer->local_flag);

View File

@ -60,7 +60,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) {
gPlayerState.field_0x27[0] = 0xff;
EnqueueSFX(SFX_EM_DEKUSCRUB_HIT);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
}
}
}
@ -195,7 +195,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) {
if (entity != NULL) {
entity->spritePriority.b0 = 3;
entity->z.HALF.HI -= 0xc;
SetDefaultPriority(entity, PRIO_MESSAGE);
SetEntityPriority(entity, PRIO_MESSAGE);
}
}
break;

View File

@ -269,7 +269,7 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) {
Entity* child;
Entity* parent;
sub_08078B48();
PausePlayer();
if (super->type == 0) {
if (super->subAction != 12) {
super->subAction = 12;
@ -463,7 +463,7 @@ void sub_08026090(ChuchuBossEntity* this) {
}
CopyPosition(super->child, super);
} else {
sub_08078B48();
PausePlayer();
if (super->timer-- == 0) {
gRoomControls.camera_target = &gPlayerEntity;
DeleteThisEntity();
@ -542,7 +542,7 @@ void sub_0802626C(ChuchuBossEntity* this) {
gPauseMenuOptions.disabled = 1;
gUnk_080CC20C[this->unk_84->unk_03](this);
if (gPlayerEntity.action != PLAYER_ROOMTRANSITION && gPlayerEntity.action != PLAYER_ROOM_EXIT) {
sub_08078B48();
PausePlayer();
}
}
@ -1126,7 +1126,7 @@ void sub_08026E1C(ChuchuBossEntity* this) {
}
if ((sub_08027C54(this)) && this->unk_84->unk_04 == 2) {
sub_08027C7C(this, 0x3f);
sub_08078B48();
PausePlayer();
}
}
@ -1155,7 +1155,7 @@ void sub_08026FA4(ChuchuBossEntity* this) {
ChuchuBossEntity* pEVar3;
ChuchuBossEntity* pEVar4;
sub_08078B48();
PausePlayer();
COLLISION_OFF(super);
pEVar4 = (ChuchuBossEntity*)super->child;
pEVar3 = (ChuchuBossEntity*)super->parent;
@ -1361,7 +1361,7 @@ void sub_080272D4(ChuchuBossEntity* this) {
if (sub_08027C54(super->child) == 0 || ((ChuchuBossEntity*)super->child)->unk_84->unk_04 != 2) {
SoundReq(SFX_BOSS_HIT);
} else {
sub_08078B48();
PausePlayer();
gRoomControls.camera_target = super->child;
gPauseMenuOptions.disabled = 1;
gRoomControls.camera_target->subAction = 9;

View File

@ -87,7 +87,7 @@ void FireballGuy_Action2(FireballGuyEntity* this) {
/* Can we create enough new entities? */
count = typeEntityCount[super->type];
if (MAX_ENTITIES + 1 - count <= gEntCount)
if (MAX_ENTITIES - count <= gEntCount)
return;
/* Create 2-5 new MiniFireballGuy */

View File

@ -151,7 +151,7 @@ void Gleerok(GleerokEntity* this) {
}
void Gleerok_OnDeath(GleerokEntity* this) {
sub_08078B48();
PausePlayer();
switch (super->type) {
case 2:
@ -426,7 +426,7 @@ void sub_0802D3B8(GleerokEntity* this) {
void sub_0802D650(GleerokEntity* this) {
#ifdef EU
sub_08078B48();
PausePlayer();
#endif
gUnk_080CD7E4[super->subAction](this);
@ -1020,7 +1020,7 @@ void sub_0802E0B8(GleerokEntity* this) {
if (this->unk_79 > 1) {
super->health = 0;
super->action = 0;
sub_08078B48();
PausePlayer();
SoundReq(SFX_BOSS_DIE);
return;
} else {

View File

@ -72,7 +72,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) {
void LikeLike_OnDeath(LikeLikeEntity* this) {
if (super->timer == 2 && this->stolenItem != 0xff) {
SetDefaultPriority(super, PRIO_NO_BLOCK);
SetEntityPriority(super, PRIO_NO_BLOCK);
LikeLike_ReturnStolenItem(this->stolenItem);
}
GenericDeath(super);
@ -259,12 +259,12 @@ void sub_080281A0(LikeLikeEntity* this) {
bool32 LikeLike_StealItem(u32 item) {
bool32 ret = FALSE;
if (GetInventoryValue(item) == 1) {
if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
gSave.stats.itemButtons[SLOT_A] = ITEM_NONE;
if (ItemIsShield(gSave.stats.equipped[SLOT_A])) {
gSave.stats.equipped[SLOT_A] = ITEM_NONE;
}
if (ItemIsShield(gSave.stats.itemButtons[SLOT_B])) {
gSave.stats.itemButtons[SLOT_B] = ITEM_NONE;
if (ItemIsShield(gSave.stats.equipped[SLOT_B])) {
gSave.stats.equipped[SLOT_B] = ITEM_NONE;
}
SetInventoryValue(item, 0);

View File

@ -113,17 +113,17 @@ void OctorokBoss_Hit(OctorokBossEntity* this) {
if (super->subAction != 3) {
gRoomControls.camera_target = &this->heap->tailObjects[0]->base;
this->heap->field_0x7 = 0x5a;
sub_08078B48();
PausePlayer();
}
} else {
if (this->heap->field_0x7 != 0) {
this->heap->field_0x7--;
sub_08078B48();
PausePlayer();
}
}
OctorokBoss_Hit_SubActions[super->subAction](this);
if (super->subAction > 3) {
sub_08078B48();
PausePlayer();
}
sub_0800445C(super);
SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD);
@ -136,7 +136,7 @@ void OctorokBoss_Hit_SubAction0(OctorokBossEntity* this) {
if (this->bossPhase == 4) {
super->subAction = 4;
gPauseMenuOptions.disabled = 1;
sub_08078B48();
PausePlayer();
SoundReq(SFX_BOSS_DIE);
} else {
if (IS_FROZEN(this) == FALSE) {
@ -442,7 +442,7 @@ void OctorokBoss_Intro(OctorokBossEntity* this) {
OctorokBoss_Intro_SubAction0, OctorokBoss_Intro_SubAction1, OctorokBoss_Intro_SubAction2,
OctorokBoss_Intro_SubAction3, OctorokBoss_Intro_SubAction4, OctorokBoss_Intro_SubAction5,
};
sub_08078B48();
PausePlayer();
gPauseMenuOptions.disabled = 1;
sub_08036F60(this);
OctorokBoss_Intro_SubActions[super->subAction](this);
@ -796,7 +796,7 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) {
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 2;
sub_08078B48();
PausePlayer();
PutAwayItems();
gPlayerEntity.parent = super;
sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800);

View File

@ -111,7 +111,7 @@ void sub_080450A8(SlimeEntity* this) {
/* Can we create enough new entities? */
count = typeEntityCount[super->type];
if (MAX_ENTITIES + 1 - count <= gEntCount)
if (MAX_ENTITIES - count <= gEntCount)
return;
/* Create 2-4 new MiniSlime */

View File

@ -547,7 +547,7 @@ void VaatiTransfiguredType0Action7(Entity* this) {
Entity* pEVar3;
u32 uVar4;
sub_08078B48();
PausePlayer();
if (this->timer) {
if (--this->timer == 0) {
SetRoomFlag(2);

View File

@ -99,8 +99,8 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) {
Entity* child;
u8 bVar2;
bVar2 = gMessage.doTextBox & 0x7f;
if ((gMessage.doTextBox & 0x7f) == 0) {
bVar2 = gMessage.state & MESSAGE_ACTIVE;
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
this->action = 1;
this->spriteSettings.draw = 0;
this->field_0x80.HALF.LO = bVar2;

View File

@ -634,7 +634,7 @@ void sub_08041D14(Entity* this) {
Entity* pEVar1;
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2);
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
if (this->timer != 0) {
this->timer--;
} else {

View File

@ -195,7 +195,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) {
gSave.enemies_killed++;
parent->base.gustJarState |= 2;
parent->base.timer = 255;
SetDefaultPriority(&(parent->base), 3);
SetEntityPriority(&(parent->base), 3);
deathFx2 = (DeathFxObject*)CreateObject(DEATH_FX, parent->base.id, 0);
if (deathFx2 != NULL) {
deathFx2->unk6c = tmp;
@ -232,7 +232,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) {
} else {
if (--parent->base.timer == 0) {
parent->base.spriteSettings.draw = 0;
SetDefaultPriority(&(parent->base), 0);
SetEntityPriority(&(parent->base), 0);
} else {
if (parent->base.timer < 9) {
if (parent->base.spriteSettings.draw) {

View File

@ -189,7 +189,7 @@ void Subtask_PortalCutscene_0(void) {
gUsedPalettes |= 0x200000;
EraseAllEntities();
LoadRoomEntityList(gUnk_080D4110[portalId]);
ResetSystemPriority();
ClearEventPriority();
gArea.filler3[0]++;
SetFade(FADE_INSTANT, 8);
}

View File

@ -6,6 +6,12 @@
#include "npc.h"
#include "manager/diggingCaveEntranceManager.h"
typedef struct Temp {
void* prev;
void* next;
u8 _0[0x38];
} Temp;
extern u8 gUpdateVisibleTiles;
extern Manager gUnk_02033290;
void UpdatePlayerInput(void);
@ -74,22 +80,22 @@ const u8 gUnk_081091F8[] = {
0, 3, 0, 3, 3, 0, 3, 3, 3, 3,
};
void SetDefaultPriorityForKind(Entity* e) {
void SetEntityPriorityForKind(Entity* e) {
u8 r3 = gRoomTransition.entity_update_type;
const u8* array = gUnk_081091F8;
if (r3 != 2) {
array = gUnk_081091EE;
}
SetDefaultPriority(e, array[e->kind]);
SetEntityPriority(e, array[e->kind]);
}
void SetDefaultPriority(Entity* ent, u32 prio) {
void SetEntityPriority(Entity* ent, u32 prio) {
ent->updatePriorityPrev = prio;
ent->updatePriority = prio;
}
bool32 EntityIsDeleted(Entity* this) {
bool32 EntityDisabled(Entity* this) {
u32 value;
if (this->flags & ENT_DELETED)
@ -98,19 +104,19 @@ bool32 EntityIsDeleted(Entity* this) {
return FALSE;
// pick highest
if (gPriorityHandler.sys_priority > gPriorityHandler.ent_priority)
value = gPriorityHandler.sys_priority;
if (gPriorityHandler.event_priority > gPriorityHandler.ent_priority)
value = gPriorityHandler.event_priority;
else
value = gPriorityHandler.ent_priority;
if (gMessage.doTextBox & 0x7F)
if (gMessage.state & MESSAGE_ACTIVE)
value = max(value, PRIO_MESSAGE);
return value > this->updatePriority;
}
bool32 AnyPrioritySet(void) {
u32 prio = gPriorityHandler.sys_priority;
if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority)
u32 prio = gPriorityHandler.event_priority;
if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority)
prio = gPriorityHandler.ent_priority;
return prio != PRIO_MIN;
}
@ -180,12 +186,12 @@ static void UpdatePriorityTimer(void) {
}
void SetPlayerEventPriority(void) {
gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT;
gPriorityHandler.event_priority = PRIO_PLAYER_EVENT;
gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT;
}
void ResetPlayerEventPriority(void) {
gPriorityHandler.sys_priority = PRIO_MIN;
gPriorityHandler.event_priority = PRIO_MIN;
gPlayerEntity.updatePriority = PRIO_PLAYER;
}
@ -195,15 +201,15 @@ void RevokePriority(Entity* e) {
}
void SetRoomReloadPriority(void) {
gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT;
gPriorityHandler.event_priority = PRIO_PLAYER_EVENT;
}
void SetInitializationPriority(void) {
gPriorityHandler.sys_priority = PRIO_HIGHEST;
gPriorityHandler.event_priority = PRIO_HIGHEST;
}
void ResetSystemPriority(void) {
gPriorityHandler.sys_priority = PRIO_MIN;
void ClearEventPriority(void) {
gPriorityHandler.event_priority = PRIO_MIN;
}
void UpdateEntities(void) {
@ -241,8 +247,6 @@ void EraseAllEntities(void) {
gOAMControls.unk[1].unk6 = 1;
}
extern Entity gUnk_030015A0[0x48];
Entity* GetEmptyEntity() {
u8 flags_ip;
Entity* end;
@ -253,9 +257,9 @@ Entity* GetEmptyEntity() {
LinkedList* listPtr;
LinkedList* endListPtr;
if (gEntCount <= 0x46) {
currentEnt = gUnk_030015A0;
end = currentEnt + ARRAY_COUNT(gUnk_030015A0);
if (gEntCount < MAX_ENTITIES - 1) {
currentEnt = gEntities;
end = currentEnt + ARRAY_COUNT(gEntities);
do {
if (currentEnt->prev == 0) {
@ -267,7 +271,8 @@ Entity* GetEmptyEntity() {
currentEnt = &gPlayerEntity;
do {
if ((s32)currentEnt->prev < 0 && (currentEnt->flags & 0xc) && currentEnt != gUpdateContext.current_entity) {
if ((s32)currentEnt->prev < 0 && (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2)) &&
currentEnt != gUpdateContext.current_entity) {
ClearDeletedEntity(currentEnt);
return currentEnt;
}
@ -282,9 +287,10 @@ Entity* GetEmptyEntity() {
currentEnt = listPtr->first;
nextList = listPtr + 1;
while ((u32)currentEnt != (u32)listPtr) {
if (currentEnt->kind != MANAGER && flags_ip < (currentEnt->flags & 0x1c) &&
if (currentEnt->kind != MANAGER &&
flags_ip < (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) &&
gUpdateContext.current_entity != currentEnt) {
flags_ip = currentEnt->flags & 0x1c;
flags_ip = currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED);
rv = currentEnt;
}
currentEnt = currentEnt->next;
@ -301,16 +307,16 @@ Entity* GetEmptyEntity() {
return rv;
}
extern Entity gItemGetEntities[7];
extern Entity gAuxPlayerEntities[7];
Entity* CreateItemGetEntity(void) {
Entity* ent = gItemGetEntities;
Entity* CreateAuxPlayerEntity(void) {
Entity* ent = gAuxPlayerEntities;
do {
if (ent->prev == NULL) {
return ent;
}
} while (++ent < &gItemGetEntities[7]);
} while (++ent < &gAuxPlayerEntities[7]);
return NULL;
}
@ -407,12 +413,6 @@ void DeleteAllEntities(void) {
}
}
typedef struct Temp {
void* prev;
void* next;
u8 _0[0x38];
} Temp;
// fix this
Manager* GetEmptyManager(void) {
Temp* it;
@ -508,7 +508,7 @@ void AppendEntityToList(Entity* entity, u32 listIndex) {
} else {
gManagerCount++;
}
SetDefaultPriorityForKind(entity);
SetEntityPriorityForKind(entity);
}
void PrependEntityToList(Entity* entity, u32 listIndex) {

View File

@ -208,7 +208,7 @@ static void GameMain_ChangeRoom(void) {
return;
UpdatePlayerMapCoords();
ResetSystemPriority();
ClearEventPriority();
UpdateWindcrests();
sub_080300C4();
gMain.substate = GAMEMAIN_UPDATE;
@ -252,8 +252,8 @@ static void GameMain_Update(void) {
return;
}
if ((gMessage.doTextBox & 0x7f) || gPriorityHandler.priority_timer != 0)
sub_08078B48();
if ((gMessage.state & MESSAGE_ACTIVE) || gPriorityHandler.priority_timer != 0)
PausePlayer();
FlushSprites();
UpdateEntities();
@ -305,7 +305,7 @@ static void GameMain_BarrelUpdate(void) {
CheckGameOver();
CopyOAM();
if (!gFadeControl.active)
ResetSystemPriority();
ClearEventPriority();
}
static void GameMain_ChangeArea(void) {

View File

@ -204,7 +204,7 @@ void PlayerUpdate(Entity* this) {
else
gPlayerState.flags &= ~PL_DRUGGED;
if (!EntityIsDeleted(this)) {
if (!EntityDisabled(this)) {
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
PutAwayItems();
if (gPlayerState.flags & PL_MOLDWORM_RELEASED) {
@ -258,7 +258,7 @@ static void HandlePlayerLife(Entity* this) {
return;
}
if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.doTextBox & 0x7f))
if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.state & 0x7f))
return;
#ifdef EU
@ -274,7 +274,7 @@ static void HandlePlayerLife(Entity* this) {
}
}
#else
gRoomVars.unk2 = gMessage.doTextBox & 0x7f;
gRoomVars.unk2 = gMessage.state & MESSAGE_ACTIVE;
temp = gSave.stats.maxHealth / 4;
if (temp > 24)
temp = 24;

View File

@ -107,10 +107,10 @@ void sub_08076964(ItemBehavior* this, u32 index) {
SetItemAnim(this, ANIM_DASH);
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD);
if (entity != NULL) {
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
uVar3 = gSave.stats.itemButtons[SLOT_A];
if (ItemIsSword(gSave.stats.equipped[SLOT_A]) != 0) {
uVar3 = gSave.stats.equipped[SLOT_A];
} else {
uVar3 = gSave.stats.itemButtons[SLOT_B];
uVar3 = gSave.stats.equipped[SLOT_B];
}
entity->field_0x68.HALF.LO = uVar3;
return;

View File

@ -145,7 +145,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) {
if (this->field_0x18 != NULL) {
if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) {
if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R
if (!(gPlayerState.playerInput.heldInput & INPUT_ACTION)) { // Pressing R
this->field_0x18->subAction = 6;
PlayerCancelHoldItem(this, index);
return;
@ -263,7 +263,7 @@ void sub_08076518(ItemBehavior* this, u32 index) {
if (gPlayerEntity.knockbackDuration != 0) {
PlayerCancelHoldItem(this, index);
} else {
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0) {
if ((gPlayerState.playerInput.newInput & (INPUT_LIFT_THROW | INPUT_CANCEL | INPUT_INTERACT)) != 0) {
sub_0806F948(&gPlayerEntity);
gPlayerState.heldObject = 5;
this->field_0x18->subAction = 2;

View File

@ -200,7 +200,7 @@ u32 getItemMetaDataGetTextIndex(s32 itemIndex) {
return ptr[2];
}
u32 sub_080542AC(u32 param_1) {
u32 IsMinishItem(u32 param_1) {
const ItemMetaData* ptr1 = gItemMetaData;
u8* ptr = (u8*)&((ptr1)[param_1]);
return ptr[3] & 1;
@ -255,9 +255,9 @@ void ModArrows(s32 arrows) {
EquipSlot IsItemEquipped(u32 itemId) {
EquipSlot equipSlot;
if (itemId == gSave.stats.itemButtons[SLOT_A]) {
if (itemId == gSave.stats.equipped[SLOT_A]) {
equipSlot = EQUIP_SLOT_A;
} else if (itemId == gSave.stats.itemButtons[SLOT_B]) {
} else if (itemId == gSave.stats.equipped[SLOT_B]) {
equipSlot = EQUIP_SLOT_B;
} else {
equipSlot = EQUIP_SLOT_NONE;
@ -273,17 +273,17 @@ void PutItemOnSlot(u32 itemId) {
}
if (itemId2 - 1 < 0x1f) {
equipSlot = EQUIP_SLOT_NONE;
if (gSave.stats.itemButtons[SLOT_A] == ITEM_NONE) {
if (gSave.stats.equipped[SLOT_A] == ITEM_NONE) {
equipSlot = EQUIP_SLOT_A;
} else if (gSave.stats.itemButtons[SLOT_B] == ITEM_NONE) {
} else if (gSave.stats.equipped[SLOT_B] == ITEM_NONE) {
equipSlot = EQUIP_SLOT_B;
}
if (equipSlot == EQUIP_SLOT_NONE) {
u32 temp = gItemMetaData[itemId2].menuSlot;
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) {
if (temp == gItemMetaData[gSave.stats.equipped[SLOT_A]].menuSlot) {
equipSlot = EQUIP_SLOT_A;
} else {
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) {
if (temp == gItemMetaData[gSave.stats.equipped[SLOT_B]].menuSlot) {
equipSlot = EQUIP_SLOT_B;
}
}
@ -302,13 +302,13 @@ void ForceEquipItem(u32 itemId, u32 equipSlot) {
if ((itemId - 1 < 0x1f) && (equipSlot < EQUIP_SLOT_NONE)) {
otherItemSlot = equipSlot == EQUIP_SLOT_A;
replacedItem = gSave.stats.itemButtons[equipSlot];
otherItem = gSave.stats.itemButtons[otherItemSlot];
replacedItem = gSave.stats.equipped[equipSlot];
otherItem = gSave.stats.equipped[otherItemSlot];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemId].menuSlot) {
otherItem = replacedItem;
}
gSave.stats.itemButtons[equipSlot] = itemId;
gSave.stats.itemButtons[otherItemSlot] = otherItem;
gSave.stats.equipped[equipSlot] = itemId;
gSave.stats.equipped[otherItemSlot] = otherItem;
gUnk_0200AF00.unk_13 = 0x7f;
gUnk_0200AF00.unk_14 = 0x7f;
}
@ -403,8 +403,8 @@ void EnableRandomDrops(void) {
gRoomVars.randomDropsDisabled = FALSE;
}
extern void sub_08000F14(s16*, const s16*, const s16*, const s16*);
extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
extern void SumDropProbabilities(s16*, const s16*, const s16*, const s16*);
extern u32 SumDropProbabilities2(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = {
@ -459,7 +459,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
#endif
}
// vector addition, s0 = ptr4 + ptr2 + ptr3
sub_08000F14(droptable.a, ptr4->a, ptr2->a, ptr3->a);
SumDropProbabilities(droptable.a, ptr4->a, ptr2->a, ptr3->a);
if (gSave.stats.health <= 8) {
droptable.s.hearts += 5;
}
@ -486,7 +486,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
// vector addition, s0 = s0 + ptr2 + ptr3
// resulting values are clamped to be >= 0
// returns sum over s0
summOdds = sub_08000F2C(droptable.a, droptable.a, ptr2->a, ptr3->a);
summOdds = SumDropProbabilities2(droptable.a, droptable.a, ptr2->a, ptr3->a);
rand = Random();
item = (rand >> 0x18);
item &= 0xF;

View File

@ -61,6 +61,6 @@ void (*const gMiscManagerunctions[])() = { NULL,
EnterRoomTextboxManager_Main };
void ManagerUpdate(Entity* this) {
if (!EntityIsDeleted(this))
if (!EntityDisabled(this))
gMiscManagerunctions[this->id](this);
}

View File

@ -27,7 +27,7 @@ void CloudOverlayManager_Main(CloudOverlayManager* this) {
super->timer = 0;
super->subtimer = 8;
this->field_0x20 = gUnk_0810865C[0];
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gArea.onEnter == NULL) {
RegisterTransitionManager(this, sub_0805AEDC, sub_0805AF3C);
} else {

View File

@ -37,7 +37,7 @@ void DelayedEntityLoadManager_Main(DelayedEntityLoadManager* this) {
if (super->action == 0) {
super->action++;
this->unk_20 = gArea.filler[1];
SetDefaultPriority((Entity*)this, 6);
SetEntityPriority((Entity*)this, 6);
npcPtr = gNPCData;
npcPtr += (super->type2 + this->unk_20);
index1 = 0;

View File

@ -34,7 +34,7 @@ void sub_0805E1F8(u32, bool32);
void EnterRoomTextboxManager_Main(EnterRoomTextboxManager* this) {
EnterRoomTextboxManager_Actions[super->action](this);
if ((gRoomControls.room != this->unk_20) || (gMessage.doTextBox & 0x7F)) {
if ((gRoomControls.room != this->unk_20) || (gMessage.state & MESSAGE_ACTIVE)) {
sub_0805E1D8(this);
}
}
@ -45,7 +45,7 @@ void sub_0805E140(EnterRoomTextboxManager* this) {
this->unk_20 = gRoomControls.room;
super->timer = 120;
super->subtimer = 60;
SetDefaultPriority((Entity*)this, PRIO_HIGHEST);
SetEntityPriority((Entity*)this, PRIO_HIGHEST);
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], AreaIsDungeon());
}
@ -56,7 +56,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) {
if (--super->subtimer == 0) {
super->type2 = 0;
gPlayerState.controlMode = CONTROL_1;
ResetSystemPriority();
ClearEventPriority();
}
}
if (--super->timer == 0) {

View File

@ -26,7 +26,7 @@ void EntitySpawnManager_Main(EntitySpawnManager* this) {
if (super->type2 != 0) {
super->type2 = 0;
SetPlayerControl(0xff);
sub_08078B48();
PausePlayer();
}
if (this->spawnTimer == 0) {
if (this->sound != 0) {

View File

@ -35,7 +35,7 @@ static void EzloHintManager_Init(EzloHintManager* this) {
this->ry = this->ry_raw << 3;
this->x = this->rx + (this->x_raw << 4);
this->y = this->ry + (this->y_raw << 4);
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (this->flag2 == 0) {
super->action = 2;
} else {
@ -69,7 +69,7 @@ static void EzloHintManager_Action2(EzloHintManager* this) {
if (!PlayerStateValid(this))
return;
SetPlayerControl(3);
sub_08078B48();
PausePlayer();
SetPlayerEventPriority();
super->action = 3;
super->subAction = 0;

View File

@ -55,7 +55,7 @@ void FightManager_Init(FightManager* this) {
if (!this->fightStartFlag) {
FightManager_LoadFight(this);
}
SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK);
SetEntityPriority((Entity*)this, PRIO_NO_BLOCK);
} else {
DeleteThisEntity();
}
@ -157,7 +157,7 @@ void FightManagerHelper_Main(FightManagerHelper* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK);
SetEntityPriority((Entity*)this, PRIO_NO_BLOCK);
}
// go through and check all monitored enemies.
anyRemaining = FALSE;

View File

@ -57,7 +57,7 @@ void sub_0805B328(HoleManager*);
void sub_0805B048(HoleManager* this) {
struct_08108764* tmp;
Entity* obj;
SetDefaultPriority((Entity*)super, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)super, PRIO_PLAYER_EVENT);
MemClear(&this->unk_20, 0x20);
super->action = 1;
this->unk_3f = gRoomControls.room;

View File

@ -66,7 +66,7 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) {
this->field_0x21 = 0xff;
this->field_0x20 = 0xff;
RegisterTransitionManager(this, sub_08059A2C, NULL);
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
}
sub_08059A58(this);
}

View File

@ -20,8 +20,8 @@ extern void sub_0801E120(void);
extern void sub_0801E154(u32);
extern void sub_0801E160(u32, u32, u32);
bool32 sub_0805BA78();
void sub_0805BAD4();
bool32 LerpLightLevel();
void UpdateLightAlpha();
void LightManager_Main(LightManager* this) {
s32 sVar1;
@ -37,14 +37,14 @@ void LightManager_Main(LightManager* this) {
super->flags |= ENT_PERSIST;
super->timer = 17;
this->unk20 = 0;
SetDefaultPriority((Entity*)this, 6);
SetEntityPriority((Entity*)this, 6);
sub_0801E120();
sub_0801E154(super->timer);
}
if (gMain.substate == GAMEMAIN_UPDATE) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
sub_0805BA78();
sub_0805BAD4();
LerpLightLevel();
UpdateLightAlpha();
}
if (gArea.lightType == 2) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
@ -87,44 +87,33 @@ void LightManager_Main(LightManager* this) {
#define ABS(x) ((unsigned)(x < 0 ? -(x) : x))
bool32 sub_0805BA78() {
u32 uVar1;
s32 iVar1;
s32 iVar2;
bool32 LerpLightLevel() {
s32 tgt;
s32 cur;
iVar2 = (short)gArea.lightLevel;
iVar1 = gRoomVars.lightLevel;
cur = (short)gArea.lightLevel;
tgt = gRoomVars.lightLevel;
if (iVar1 < 0) {
iVar1 = 0;
}
tgt = max(tgt, 0);
tgt = min(tgt, 0x100);
if (0x100 < iVar1) {
iVar1 = 0x100;
}
if (iVar2 != iVar1) {
if (ABS(iVar1 - iVar2) <= 4) {
iVar2 = iVar1;
} else {
if (iVar1 < iVar2) {
iVar2 = iVar2 - 4;
} else {
if (iVar1 > iVar2) {
iVar2 = iVar2 + 4;
}
}
if (cur != tgt) {
if (ABS(tgt - cur) <= 4) {
cur = tgt;
} else if (tgt < cur) {
cur -= 4;
} else if (tgt > cur) {
cur += 4;
}
gArea.lightLevel = iVar2;
} else {
return FALSE;
gArea.lightLevel = cur;
return TRUE;
}
return TRUE;
return FALSE;
}
extern u16 gUnk_08108CA8[];
void sub_0805BAD4() {
void UpdateLightAlpha() {
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.lightType != 0) {
@ -164,8 +153,8 @@ void sub_0805BB74(s32 lightLevel) {
if (manager) {
LightManager_Main(manager);
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
sub_0805BA78();
sub_0805BAD4();
LerpLightLevel();
UpdateLightAlpha();
}
}
@ -175,9 +164,9 @@ bool32 UpdateLightLevel() {
iVar1 = FALSE;
if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
iVar1 = LerpLightLevel();
if (iVar1) {
sub_0805BAD4();
UpdateLightAlpha();
}
}
return iVar1;
@ -189,9 +178,9 @@ s32 sub_0805BC04(void) {
iVar1 = 0;
if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) {
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
iVar1 = sub_0805BA78();
iVar1 = LerpLightLevel();
if (iVar1) {
sub_0805BAD4();
UpdateLightAlpha();
}
}
return iVar1;

View File

@ -111,7 +111,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) {
super->timer = 8;
this->unk_20 = 0xFF;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
RegisterTransitionManager(this, sub_08057E30, 0);
}
if (sub_08057E40(this)) {

View File

@ -212,7 +212,7 @@ void MiscManager_Type3(MiscManager* this) {
void MiscManager_Type4(MiscManager* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
}
if (CheckLocalFlag(0x6c)) {
if (CheckLocalFlag(0x4b)) {
@ -364,7 +364,7 @@ void MiscManager_TypeB(MiscManager* this) {
bool32 sub_080593CC(MiscManager* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
(gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) {
(gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) {
return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}
return FALSE;
@ -430,7 +430,7 @@ void MiscManager_TypeE(MiscManager* this) {
#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP)
void MiscManager_TypeF(MiscManager* this) {
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gPlayerEntity.action == PLAYER_TALKEZLO) {
DeleteThisEntity();
}

View File

@ -20,7 +20,7 @@ void PowBackgroundManager_Main(PowBackgroundManager* this) {
if (super->action == 0) {
super->action = 1;
super->flags |= ENT_PERSIST;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gArea.onEnter == NULL) {
RegisterTransitionManager(this, sub_0805AFFC, NULL);
} else {

View File

@ -37,7 +37,7 @@ void CreateRepeatedSoundManager(Entity* entity, ScriptExecutionContext* context)
manager->id = REPEATED_SOUND_MANAGER;
manager->type = context->intVariable;
AppendEntityToList((Entity*)manager, 6);
SetDefaultPriority((Entity*)manager, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)manager, PRIO_PLAYER_EVENT);
}
}

View File

@ -51,7 +51,7 @@ void SecretManager_Type0_Init(SecretManager* this) {
if (super->timer == 0) {
super->timer = 30;
}
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
}
void SecretManager_Type0_Action1(SecretManager* this) {
@ -94,7 +94,7 @@ void SecretManager_Type1_Init(SecretManager* this) {
super->timer = 30;
}
super->subtimer = super->timer;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
}
void SecretManager_Type1_Action1(SecretManager* this) {

View File

@ -35,7 +35,7 @@ void StaticBackgroundManager_Main(StaticBackgroundManager* this) {
if (super->action == 0) {
super->action = 1;
super->flags |= ENT_PERSIST;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (super->type != 0) {
RegisterTransitionManager(this, sub_0805B4B4, NULL);
}

View File

@ -370,7 +370,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) {
}
super->subAction = 1;
super->flags |= ENT_PERSIST;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
break;
case 1:
if (CheckLocalFlag(this->unk_3e))
@ -402,7 +402,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) {
void sub_0805AAC8(TempleOfDropletsManager*);
void sub_0805A89C(TempleOfDropletsManager* this) {
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
super->action = 1;
super->flags |= ENT_PERSIST;
super->timer = 8;

View File

@ -22,7 +22,7 @@ void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) {
if (super->action == 0) {
super->action = 1;
super->flags |= ENT_PERSIST;
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gArea.onEnter == NULL) {
RegisterTransitionManager(this, sub_0805D470, NULL);
} else {

View File

@ -70,7 +70,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
super->subAction = 0;
super->timer = 120;
SetPlayerControl(2);
sub_08078B48();
PausePlayer();
object = CreateObject(THUNDERBOLT, 0, 0);
if (object != NULL) {
object->x.HALF.HI = gRoomControls.origin_x + 0x88;
@ -100,7 +100,7 @@ void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) {
}
void Vaati3StartManager_Type0_Action3(Vaati3StartManager* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
if (super->timer != 0) {
super->timer--;
} else {

View File

@ -331,7 +331,7 @@ void KinstoneMenu_Type5_Overlay0(void) {
}
void KinstoneMenu_Type5_Overlay1(void) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
gMenu.overlayType = 2;
SoundReq(SFX_147);
}

View File

@ -529,14 +529,14 @@ void PauseMenu_ItemMenu_Draw(void) {
gOamCmd._8 = 0x800;
DrawDirect(sub_080A5384_draw_constant0, 0x22);
}
i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_A]);
i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_A]);
if (i < MENU_SLOT_COUNT) {
entry = &gItemMenuTable[i];
gOamCmd.x = entry->x;
gOamCmd.y = entry->y;
DrawDirect(sub_080A5384_draw_constant0, 3);
}
i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_B]);
i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_B]);
if (i < MENU_SLOT_COUNT) {
entry = &gItemMenuTable[i];
gOamCmd.x = entry->x;

View File

@ -49,7 +49,7 @@ static void StatusUpdate(u32 status);
static void SwitchChoice(u32 to, u32 from);
static void MsgChangeLine(u32 lineNo);
static void SetDoTextBox(u32 doTextbox);
static void SetState(u32 status);
static void DeleteWindow(void);
static u32 ChangeWindowSize(u32 delta);
@ -122,14 +122,14 @@ s32 sub_08056338(void) {
s32 result;
result = -1;
if (((gMessage.doTextBox & 0x7f) == 0) && (gUnk_02000040.unk_00 == 3))
if (((gMessage.state & MESSAGE_ACTIVE) == 0) && (gUnk_02000040.unk_00 == 3))
result = gUnk_02000040.unk_01;
return result;
}
void MessageClose(void) {
if ((gMessage.doTextBox & 0x7f) != 0) {
gMessage.doTextBox = 0x88;
if (gMessage.state & MESSAGE_ACTIVE) {
gMessage.state = 0x88;
}
}
@ -173,7 +173,7 @@ void MessageRequest(u32 index) {
gMessage.textWindowHeight = 4;
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 12;
gMessage.doTextBox = 1;
gMessage.state = 1;
}
void MessageInitialize(void) {
@ -190,7 +190,7 @@ void MessageMain(void) {
[MSG_OPEN] = MsgOpen, [MSG_CLOSE] = MsgClose, [MSG_DIE] = MsgDie,
};
if (gMessage.doTextBox == 1) {
if (gMessage.state == 1) {
MemClear((u32*)&gTextRender, sizeof(gTextRender));
StatusUpdate(MSG_INIT);
}
@ -258,7 +258,7 @@ u32 MsgInit(void) {
gTextRender.curToken._c = &gUnk_08107BE0;
gTextRender._50.unk8 = gTextGfxBuffer;
gTextRender._50.unk4 = 0xd0;
SetDoTextBox(2);
SetState(2);
MsgChangeLine(0);
StatusUpdate(MSG_UPDATE);
return 1;
@ -295,7 +295,7 @@ static u32 MsgClose(void) {
}
static u32 MsgDie(void) {
SetDoTextBox(0);
SetState(0);
StatusUpdate(MSG_IDLE);
return 0;
}
@ -306,7 +306,7 @@ static u32 MsgUpdate(void) {
[RENDER_WAIT] = TextDispWait, [RENDER_ROLL] = TextDispRoll, [RENDER_ENQUIRY] = TextDispEnquiry,
};
SetDoTextBox(4);
SetState(4);
gTextDispFunctions[gTextRender.renderStatus](&gTextRender);
ChangeWindowSize(0);
return 0;
@ -604,7 +604,7 @@ static void TextDispRoll(TextRender* this) {
static void TextDispDie(TextRender* this) {
gMessage.unk = 0;
SetDoTextBox(7);
SetState(7);
if ((this->_8e != 1) && (this->_8e == 2 || MESSAGE_PRESS_ANY_ADVANCE_KEYS)) {
StatusUpdate(MSG_CLOSE);
}
@ -628,8 +628,8 @@ static void MsgChangeLine(u32 lineNo) {
PaletteChange(&gTextRender, gTextRender._8f | 0x40);
}
static void SetDoTextBox(u32 doTextbox) {
gMessage.doTextBox = gTextRender.message.doTextBox = doTextbox;
static void SetState(u32 status) {
gMessage.state = gTextRender.message.state = status;
}
static void DeleteWindow(void) {

View File

@ -14,7 +14,7 @@ void NPCUpdate(Entity* this) {
DeleteThisEntity();
if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0)
NPCInit(this);
if (!EntityIsDeleted(this))
if (!EntityDisabled(this))
gNPCFunctions[this->id][0](this);
if (this->next != NULL) {
if (gNPCFunctions[this->id][1] != NULL)

View File

@ -94,7 +94,7 @@ void Beedle_Action1(Entity* this) {
}
void Beedle_Action2(Entity* this) {
if ((gMessage.doTextBox & 0x7F) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
this->action++;
InitializeAnimation(this, 8);
}

View File

@ -81,7 +81,7 @@ void sub_0806CF30(BigGoronEntity* this) {
super->action = 1;
super->subAction = 1;
this->originalX = super->x.HALF.HI;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
sub_0806D0B0(super);
sub_0807DD64(super);
} else {
@ -215,7 +215,7 @@ void sub_0806D1D0(BigGoronEntity* this) {
super->spriteSettings.draw = 3;
super->frameIndex = 0;
super->timer = 30;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
}
switch (super->subAction) {
@ -256,7 +256,7 @@ void sub_0806D274(BigGoronEntity* this) {
super->spritePriority.b0 = 7;
super->frameIndex = 2;
super->timer = 8;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
npc = CreateNPC(BIG_GORON, 3, 0);
if (npc != NULL) {
npc->child = super;
@ -266,7 +266,7 @@ void sub_0806D274(BigGoronEntity* this) {
case 0:
case 1:
default:
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->frameIndex = 2;
break;
}
@ -303,7 +303,7 @@ void sub_0806D348(BigGoronEntity* this) {
super->spritePriority.b0 = 6;
super->spriteSettings.draw = 0;
super->frameIndex = 5;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
}
if (super->child->frameIndex == 4) {
super->spriteSettings.draw = 3;
@ -321,7 +321,7 @@ void sub_0806D3C0(BigGoronEntity* this) {
}
super->action = 1;
super->hitbox = (Hitbox*)&gHitbox_3;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
sub_0807DD64(super);
} else {
super->x.HALF.HI = super->parent->x.HALF.HI;
@ -344,7 +344,7 @@ void sub_0806D41C(BigGoronEntity* this) {
sub_0806D4C0(this, 1);
sub_0806D4C0(this, 2);
sub_0806D4C0(this, 3);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
} else {
ExecuteScriptForEntity(super, NULL);
HandleEntity0x82Actions(super);
@ -368,7 +368,7 @@ void sub_0806D4C0(BigGoronEntity* this, u32 type) {
npc->parent = super;
CopyPosition(super, npc);
SortEntityAbove(super, npc);
SetDefaultPriority(npc, PRIO_MESSAGE);
SetEntityPriority(npc, PRIO_MESSAGE);
}
}
@ -434,7 +434,7 @@ void sub_0806D5D4(void) {
InitBiggoronTimer();
equipSlot = IsItemEquipped(ITEM_SHIELD);
if (equipSlot != EQUIP_SLOT_NONE) {
gSave.stats.itemButtons[equipSlot] = ITEM_NONE;
gSave.stats.equipped[equipSlot] = ITEM_NONE;
}
SetInventoryValue(ITEM_SHIELD, 0);
}

View File

@ -339,10 +339,10 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext
}
void sub_08068BB4(BladeBrothersEntity* this) {
u32 item = gSave.stats.itemButtons[SLOT_A];
u32 item = gSave.stats.equipped[SLOT_A];
this->itemSlotA = item;
item = gSave.stats.itemButtons[SLOT_B];
item = gSave.stats.equipped[SLOT_B];
this->itemSlotB = item;
}

View File

@ -72,7 +72,7 @@ void sub_08063584(Entity* this) {
}
void sub_08063608(Entity* this) {
u8 tmp = gMessage.doTextBox & 0x7f;
u8 tmp = gMessage.state & MESSAGE_ACTIVE;
if (tmp == 0) {
this->action = 1;
this->subtimer = tmp;

View File

@ -35,7 +35,7 @@ void Carpenter(CarpenterEntity* this) {
break;
super->action = 1;
this->animIndex = 0;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
sub_0807DD64(super);
case 1:
@ -115,7 +115,7 @@ void Carpenter_Fusion(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4])) {
this->action++;
this->spriteSettings.draw = 1;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitializeAnimation(this, (u32)this->type * 8 + 2);
}
} else {

View File

@ -99,7 +99,7 @@ void sub_08064570(CastleMaidEntity* this) {
}
break;
case 2:
if ((gMessage.doTextBox & 0x7f) != 0) {
if ((gMessage.state & MESSAGE_ACTIVE) != 0) {
return;
}
super->action = 1;

View File

@ -219,9 +219,9 @@ void sub_0806797C(CatEntity* this) {
void sub_0806799C(CatEntity* this) {
UpdateAnimationSingleFrame(super);
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
sub_08067B08(this);
SetDefaultPriority(super, PRIO_PLAYER);
SetEntityPriority(super, PRIO_PLAYER);
}
}
@ -409,7 +409,7 @@ void sub_08067C44(CatEntity* this) {
} else {
super->action = 4;
sub_08067790(super);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
}
super->interactType = INTERACTION_NONE;
SoundReq(SFX_VO_CAT);

View File

@ -30,7 +30,7 @@ void Cucco_Init(CuccoEntity* this) {
super->action++;
this->fusionOffer = GetFusionToOffer(super);
AddInteractableAsMinishFuser(super, this->fusionOffer);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
super->subAction = 0;
sub_0806E4EC(this);
}

View File

@ -37,7 +37,7 @@ void CuccoChick_Init(CuccoChickEntity* this) {
super->action++;
this->fusionOffer = GetFusionToOffer(super);
AddInteractableAsMinishFuser(super, this->fusionOffer);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
super->subAction = 0;
sub_0806E764(this);
}

View File

@ -23,7 +23,7 @@ void Dampe(Entity* this) {
case 0:
this->action = 1;
this->spriteSettings.draw = 1;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
return;
case 1:

View File

@ -226,7 +226,7 @@ void sub_08069B44(DogEntity* this) {
super->animationState = 2;
this->unk_6a = 0xff;
this->unk_74 = GetFusionToOffer(super);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitAnimationForceUpdate(super, 10);
if ((super->flags & ENT_SCRIPTED) != 0) {
InitScriptForNPC(super);
@ -525,7 +525,7 @@ void Dog_Fusion(DogEntity* this) {
if (sub_08069EF0(this)) {
super->action++;
super->spriteSettings.draw = 1;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitializeAnimation(super, 0x23);
}
} else {

View File

@ -15,7 +15,7 @@ void DrLeft(Entity* this) {
if (this->type == 0) {
if (this->action == 0) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
}
ExecuteScriptForEntity(this, NULL);

View File

@ -13,7 +13,7 @@
void Emma(Entity* this) {
if (this->action == 0) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
} else {
ExecuteScriptAndHandleAnimation(this, NULL);

View File

@ -54,7 +54,7 @@ void sub_08065A00(EponaEntity* this) {
}
void sub_08065A10(EponaEntity* this) {
if ((gMessage.doTextBox & 0x7F) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->action = 1;
InitAnimationForceUpdate(super, super->animationState / 2);
}
@ -101,7 +101,7 @@ void sub_08065AA4(EponaEntity* this) {
InitializeNPCFusion(super);
} else {
super->action = 3;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
sub_08065A50(this);
}
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));

View File

@ -14,7 +14,7 @@ const u8 gUnk_08114144[];
void Ezlo(Entity* this) {
if (this->action == 0) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
}
ExecuteScriptForEntity(this, NULL);

View File

@ -38,7 +38,7 @@ void Farmers(Entity* this) {
}
void sub_0806BC58(Entity* this) {
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
}
void Farmers_Head(Entity* this) {

View File

@ -35,7 +35,7 @@ void Festari(FestariEntity* this) {
void sub_0805FE10(FestariEntity* this) {
super->action = 1;
super->spriteSettings.draw = TRUE;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
this->fusionOffer = GetFusionToOffer(super);
AddInteractableWhenBigFuser(super, this->fusionOffer);
InitScriptForNPC(super);
@ -127,7 +127,7 @@ void Festari_Fusion(FestariEntity* this) {
if (super->action == 0) {
super->action++;
super->spriteSettings.draw = 1;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitAnimationForceUpdate(super, 8);
} else {
UpdateAnimationSingleFrame(super);

View File

@ -526,7 +526,7 @@ void ForestMinish(ForestMinishEntity* this) {
super->spriteSettings.draw = TRUE;
this->animIndex = super->animationState = super->timer << 1;
super->timer = 0;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
StartCutscene(super, (u16*)gUnk_08109D18[super->type2]);
InitScriptForNPC(super);
}
@ -755,7 +755,7 @@ void ForestMinish_Fusion(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_0810A348)) {
this->action++;
this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitializeAnimation(this, 6);
}
} else {

View File

@ -18,7 +18,7 @@ void Gentari(GentariEntity* this) {
case 0:
super->action = 1;
super->spriteSettings.draw = TRUE;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
this->fusionOffer = GetFusionToOffer(super);
AddInteractableWhenBigFuser(super, this->fusionOffer);
InitScriptForNPC(super);
@ -45,7 +45,7 @@ void Gentari_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.draw = TRUE;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitAnimationForceUpdate(this, 10);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -136,7 +136,7 @@ void sub_08065D18(GhostBrothersEntity* this) {
super->spriteSettings.draw = 1;
super->spriteRendering.alphaBlend = 1;
this->unk_6c = gUnk_08110188;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitAnimationForceUpdate(super, 2);
gScreen.controls.layerFXControl = 0x3f40;
gScreen.controls.alphaBlend = 0x1000;
@ -162,7 +162,7 @@ void sub_08065D74(GhostBrothersEntity* this) {
void sub_08065DB8(GhostBrothersEntity* this) {
switch (super->subAction) {
case 0: {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->subAction++;
super->timer = 60;
InitAnimationForceUpdate(super, 4);
@ -188,7 +188,7 @@ void sub_08065DB8(GhostBrothersEntity* this) {
break;
}
case 4: {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->subAction++;
super->timer = 30;
this->unk_6c = gUnk_0811022E;

View File

@ -72,7 +72,7 @@ void sub_08069328(Entity* this) {
void sub_08069390(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((gMessage.doTextBox & 0x7F) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
this->action = 1;
this->interactType = INTERACTION_NONE;
RevokePriority(this);

View File

@ -57,9 +57,9 @@ void sub_080695AC(Entity* this) {
void sub_080695E8(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
this->action = 1;
this->interactType = gMessage.doTextBox & 0x7f;
this->interactType = gMessage.state & MESSAGE_ACTIVE;
RevokePriority(this);
InitAnimationForceUpdate(this, this->animationState);
}

View File

@ -41,7 +41,7 @@ void sub_0806CAF4(GregalEntity* this) {
if (super->action == 0) {
super->action++;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
npc = CreateNPC(GREGAL, 1, 0);
if (npc != NULL) {
npc->parent = super;
@ -68,7 +68,7 @@ void sub_0806CB80(GregalEntity* this) {
super->action++;
super->animationState = 2;
super->frameIndex = 0;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
}
if (super->parent != NULL) {
super->frameIndex = (super->parent->frame & 3) + 0x21;
@ -79,7 +79,7 @@ void sub_0806CBB4(GregalEntity* this) {
if (super->action == 0) {
super->action++;
super->animationState = 2;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitializeAnimation(super, 0x11);
}
GetNextFrame(super);
@ -96,7 +96,7 @@ void sub_0806CC08(GregalEntity* this) {
case 0:
super->action = 1;
super->spriteSettings.draw = 1;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
sub_0807DD64(super);
case 1:
if (super->interactType == INTERACTION_FUSE) {
@ -177,7 +177,7 @@ void Gregal_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.draw = 1;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -346,7 +346,7 @@ void sub_08063E54(Entity* this) {
}
void sub_08063E6C(Entity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
this->action = 1;
InitializeAnimation(this, this->animationState + 4);
}
@ -397,7 +397,7 @@ void sub_08063F20(GuardEntity* this) {
}
void sub_08063F78(GuardEntity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->action = super->action - 1;
InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70);
}

View File

@ -29,7 +29,7 @@ void HurdyGurdyMan(HurdyGurdyManEntity* this) {
if (LoadExtraSpriteData(super, gUnk_081144F0)) {
super->action = 1;
this->unk_69 = 0;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitScriptForNPC(super);
}
break;
@ -123,7 +123,7 @@ void HurdyGurdyMan_Fusion(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_081144F0)) {
this->action++;
this->spriteSettings.draw = 1;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitializeAnimation(this, 10);
}
} else {

View File

@ -319,7 +319,7 @@ void sub_080621AC(KidEntity* this) {
break;
case 2:
GetNextFrame(super);
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
super->action = 1;
}
break;

View File

@ -16,7 +16,7 @@ void KingGustaf(Entity* this) {
this->action++;
this->spriteRendering.alphaBlend = 1;
this->collisionLayer = 2;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
gScreen.controls.layerFXControl = 0x3f40;
gScreen.controls.alphaBlend = 0x1000;

View File

@ -22,7 +22,7 @@ void Librari(LibrariEntity* this) {
super->animationState = super->timer;
this->fusionOffer = GetFusionToOffer(super);
AddInteractableWhenBigFuser(super, this->fusionOffer);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitScriptForNPC(super);
break;
case 1:

View File

@ -62,7 +62,7 @@ bool32 sub_0806C454(Entity* this) {
if (!LoadExtraSpriteData(this, gUnk_08113754)) {
return FALSE;
} else {
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
return TRUE;
}
}

View File

@ -14,7 +14,7 @@
void Marcy(Entity* this) {
if (this->action == 0) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
sub_0807DD64(this);
}
ExecuteScriptAndHandleAnimation(this, NULL);

View File

@ -24,7 +24,7 @@ void MayorHagen(MayorHagenEntity* this) {
super->action = 1;
this->animIndex = 0;
this->fusionOffer = GetFusionToOffer(super);
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitScriptForNPC(super);
break;
case 1:

View File

@ -78,7 +78,7 @@ void sub_08068780(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
this->animationState = this->type;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
break;
case 1:

View File

@ -33,7 +33,7 @@ void MinishEzlo(Entity* this) {
}
this->action++;
this->animationState = this->timer * 2;
SetDefaultPriority(this, PRIO_MESSAGE);
SetEntityPriority(this, PRIO_MESSAGE);
InitScriptForNPC(this);
}
ExecuteScriptForEntity(this, NULL);

View File

@ -126,7 +126,7 @@ void sub_08067EF0(MountainMinishEntity* this) {
super->spriteSettings.draw = 1;
super->animationState = super->type;
this->animIndex = 0;
SetDefaultPriority(super, 2);
SetEntityPriority(super, 2);
InitScriptForNPC(super);
InitializeAnimation(super, gUnk_08111304[super->type2]);
break;
@ -150,7 +150,7 @@ void sub_08067EF0(MountainMinishEntity* this) {
}
break;
case 2:
if ((gMessage.doTextBox & 0x7f) != 0)
if ((gMessage.state & MESSAGE_ACTIVE) != 0)
break;
super->action = 1;
InitializeAnimation(super, (super->animationState >> 1) + 4);

View File

@ -36,7 +36,7 @@ void Mutoh(MutohEntity* this) {
if (LoadExtraSpriteData(super, gUnk_08110C00)) {
super->action = 1;
super->spriteSettings.draw = TRUE;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
InitScriptForNPC(super);
}
break;

View File

@ -101,7 +101,7 @@ void sub_080663D4(NPC23Entity* this) {
}
ProcessMovement0(super);
}
sub_08078B48();
PausePlayer();
GetNextFrame(super);
}

View File

@ -186,8 +186,8 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) {
}
void NPC4E_SaveEquippedItems(NPC4EEntity* this) {
this->unk_68 = gSave.stats.itemButtons[SLOT_A];
this->unk_69 = gSave.stats.itemButtons[SLOT_B];
this->unk_68 = gSave.stats.equipped[SLOT_A];
this->unk_69 = gSave.stats.equipped[SLOT_B];
}
void NPC4E_RestoreEquippedItems(NPC4EEntity* this) {

View File

@ -51,7 +51,7 @@ void sub_08062B48(Entity* this) {
}
void sub_08062B70(Entity* this) {
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
InitializeAnimation(this, 2);
this->action = 1;
RevokePriority(this);

View File

@ -149,13 +149,13 @@ void sub_0806B540(Entity* this) {
SetLocalFlag(0x3f);
break;
case 1:
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
context->unk_18 = 2;
MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x15), this);
}
break;
case 2:
if ((gMessage.doTextBox & 0x7f) == 0) {
if ((gMessage.state & MESSAGE_ACTIVE) == 0) {
context->unk_18 = 3;
if (gSave.stats.hasAllFigurines != 0) {
InitItemGetSequence(ITEM_RUPEE100, 0, 0);

View File

@ -74,7 +74,7 @@ void sub_08063AC0(Entity* this) {
}
void sub_08063B44(Entity* this) {
u8 tmp = gMessage.doTextBox & 0x7f;
u8 tmp = gMessage.state & MESSAGE_ACTIVE;
if (tmp == 0) {
this->action = 1;
this->subtimer = tmp;

View File

@ -28,7 +28,7 @@ void Pita(PitaEntity* this) {
};
if (super->action == 0) {
super->action++;
SetDefaultPriority(super, PRIO_MESSAGE);
SetEntityPriority(super, PRIO_MESSAGE);
SortEntityAbove(super, super);
super->hitbox = (Hitbox*)&gUnk_0810C428;
sub_0807DD64(super);

View File

@ -234,7 +234,7 @@ void sub_080604DC(Entity* this) {
ent = CreateFx(this, FX_DASH, 0x40);
if (ent != NULL) {
ent->y.HALF.HI++;
SetDefaultPriority(ent, 3);
SetEntityPriority(ent, 3);
}
}
}
@ -273,7 +273,7 @@ void sub_08060528(PostmanEntity* this) {
break;
case 2:
UpdateAnimationSingleFrame(super);
if ((gMessage.doTextBox & 0x7f) != 0) {
if ((gMessage.state & MESSAGE_ACTIVE) != 0) {
break;
}
super->action = 1;

Some files were not shown because too many files have changed in this diff Show More