label some asm functions

This commit is contained in:
theo3
2023-12-29 00:56:36 -08:00
parent d07c416641
commit 72509b18a0
14 changed files with 75 additions and 67 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ void AcroBandit_Type0Action5(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
if (gEntCount < MAX_ENTITIES - 4) {
if (gEntCount < MAX_ENTITIES - 5) {
u32 tmp = Random();
tmp &= 3;
+1 -1
View File
@@ -81,7 +81,7 @@ void FireballGuy_Action2(Entity* this) {
/* Can we create enough new entities? */
count = typeEntityCount[this->type];
if (MAX_ENTITIES + 1 - count <= gEntCount)
if (MAX_ENTITIES - count <= gEntCount)
return;
/* Create 2-5 new MiniFireballGuy */
+1 -1
View File
@@ -105,7 +105,7 @@ void sub_080450A8(Entity* this) {
/* Can we create enough new entities? */
count = typeEntityCount[this->type];
if (MAX_ENTITIES + 1 - count <= gEntCount)
if (MAX_ENTITIES - count <= gEntCount)
return;
/* Create 2-4 new MiniSlime */
+18 -18
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);
@@ -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;
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -96,7 +96,7 @@ void sub_080921BC(GentariCurtainEntity* this) {
GenericEntity* pEVar1;
GenericEntity* end;
pEVar1 = (GenericEntity*)gItemGetEntities;
pEVar1 = (GenericEntity*)gAuxPlayerEntities;
end = pEVar1 + 0x4f;
do {
+1 -1
View File
@@ -31,7 +31,7 @@ const s8 gUnk_08126EEC[] = {
};
Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) {
Entity* e = CreateItemGetEntity();
Entity* e = CreateAuxPlayerEntity();
if (e != NULL) {
LinkAnimationEntity* this = (LinkAnimationEntity*)e;
e->id = LINK_ANIMATION;
+1 -1
View File
@@ -36,7 +36,7 @@ static Entity* GiveItemWithCutscene(u32 item, u32 type2, u32 delay) {
item = ITEM_RUPEE50;
type2 = 0;
}
e = CreateItemGetEntity();
e = CreateAuxPlayerEntity();
if (e != NULL) {
e->type = item;
e->type2 = type2;
+2 -2
View File
@@ -462,7 +462,7 @@ Entity* CreatePlayerItemWithParent(ItemBehavior* this, u32 id) {
}
void* CreateItemGetPlayerItemWithParent(ItemBehavior* this) {
GenericEntity* playerItem = (GenericEntity*)CreateItemGetEntity();
GenericEntity* playerItem = (GenericEntity*)CreateAuxPlayerEntity();
if (playerItem != NULL) {
playerItem->base.id = gItemDefinitions[this->behaviorId].playerItemId;
playerItem->base.kind = PLAYER_ITEM;
@@ -501,7 +501,7 @@ Entity* CreatePlayerItem(u32 id, u32 type, u32 type2, u32 unk) {
Entity* sub_08077CF8(u32 id, u32 type, u32 type2, u32 unk) {
GenericEntity* ent;
ent = (GenericEntity*)CreateItemGetEntity();
ent = (GenericEntity*)CreateAuxPlayerEntity();
if (ent != NULL) {
ent->base.flags = ENT_COLLIDE;
ent->base.kind = PLAYER_ITEM;
+2 -1
View File
@@ -626,7 +626,8 @@ void ButtonUIElement_Action1(UIElement* element) {
MAX_MOVEMENT = (!element->type2) ? 4 : 8;
if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) {
if (element->type2 == 0 &&
(((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) {
y = (s16)gUnk_0200AF00.buttonY[element->type] - 0x28;
} else {
y = (s16)gUnk_0200AF00.buttonY[element->type];