Merge remote-tracking branch 'upstream/master'

This commit is contained in:
theo3
2020-08-24 21:11:39 -07:00
63 changed files with 13138 additions and 13071 deletions
+2 -2
View File
@@ -29,9 +29,9 @@ void UpdateItemAnim(Entity *ent)
sub_08077E54(ent);
}
void sub_08077E3C(Entity *ent)
void sub_08077E3C(Entity *ent, u32 idx)
{
sub_080042BA(&gPlayerEntity);
sub_080042BA(&gPlayerEntity, idx);
sub_08077E54(ent);
}
-3
View File
@@ -1,9 +1,6 @@
#include "global.h"
#include "entity.h"
extern Entity* CreateObject();
extern void CopyPosition();
Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 param1, u32 param2) {
Entity* ent;
+121
View File
@@ -0,0 +1,121 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
typedef struct {
s8 h, v;
} PACKED PosOffset;
extern void sub_08045524(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void (*const gUnk_080D17E8[])(Entity*);
extern void (*const gUnk_080D1800[])(Entity*);
extern u8 gUnk_080D180C[4]; // Entity count per form
extern PosOffset gUnk_080D1810[4];
extern u8 gEntCount;
void FireballGuy(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D17E8);
}
void sub_080453A4(Entity* this) {
gUnk_080D1800[this->action](this);
}
void sub_080453BC(Entity* this) {
if (this->currentHealth && this->cutsceneBeh.HALF.LO != this->currentHealth) {
this->action = 2;
} else {
sub_0804AA30(this, gUnk_080D17E8);
}
}
void nullsub_172(void) {
}
void sub_080453E8(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->spriteSettings.b.draw = 1;
this->nonPlanarMovement = 0x80;
this->cutsceneBeh.HALF.LO = this->currentHealth;
this->field_0x3c |= 0x10;
sub_0804A720(this);
InitializeAnimation(this, 0);
sub_08045524(this);
}
void sub_08045430(Entity* this) {
sub_080AEFE0(this);
GetNextFrame(this);
if (sub_08003FC4(this, 0x1800) == 0)
sub_08045524(this);
}
/* Split FireballGuy into new ones */
void sub_08045454(Entity* this) {
Entity* entities[4];
Entity* ent;
s32 count, i;
PosOffset* off;
u32 tmp;
/* Can we create enough new entities? */
count = gUnk_080D180C[this->entityType.form];
if (72 - count <= gEntCount)
return;
/* Create 2-5 new MiniFireballGuy */
for (i = 0; i < count; i++)
entities[i] = CreateEnemy(0x59, this->entityType.form);
off = gUnk_080D1810;
for (i = 0; i < count; i++) {
ent = entities[i];
ent->attachedEntity = entities[(i + 1) % count];
ent->parent = entities[(i + count - 1) % count];
tmp = 0;
ent->entityType.parameter = 1;
ent->height.HALF.HI = tmp;
ent->hurtBlinkTime = -0x10;
/* Set MiniFireballGuy offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
off++;
}
ent = CreateFx(this, 2, 0);
if (ent)
CopyPosition(this, ent);
DeleteEntity(this);
}
u32 sub_0804A024(Entity*, u32, u32);
void sub_08045524(Entity *this) {
u32 tmp, tmp1, tmp2;
this->field_0x20 = 0x1c000;
tmp = sub_0804A024(this,1,8);
if (tmp != 0xff && (Random() & 3) == 0) {
this->actionDelay = Random() & 3;
this->direction = tmp & 0x18;
} else {
if (this->actionDelay) {
this->actionDelay--;
return;
}
this->actionDelay = Random() & 3;
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
tmp1 = sub_08049EE4(this);
tmp2 = Random() & 8;
tmp2 += 0xfc;
this->direction = (tmp1 + tmp2) & 0x18;
} else {
this->direction = Random() & 0x18;
}
}
}
+95
View File
@@ -0,0 +1,95 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
void sub_08045374(Entity*);
extern u32 sub_0806FA04(u32, u32);
extern void sub_0804A720();
extern void sub_080452E4();
extern void sub_0804A9FC();
extern void sub_0804AA30();
extern void ReplaceMonitoredEntity(Entity*, Entity*);
extern void sub_0804A7D4(Entity*);
extern void (*const gUnk_080D17C0[])(Entity*);
extern void (*const gUnk_080D17D8[])(Entity*);
void MiniSlime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D17C0);
SetChildOffset(this, 0, 1, -8);
}
void sub_08045220(Entity* this) {
gUnk_080D17D8[this->action](this);
}
void sub_08045238(Entity* this) {
if (this->field_0x43)
sub_0804A9FC(this, 0x1c);
sub_0804AA30(this, gUnk_080D17C0);
}
void sub_0804525C(Entity* this) {
Entity* parent = this->parent;
if (this != parent && parent) {
this->field_0x6c.HALF.LO &= 0x7f;
this->parent->attachedEntity = this->attachedEntity;
this->attachedEntity->parent = this->parent;
if (this->field_0x6c.HALF.HI & 0x40)
ReplaceMonitoredEntity(this, parent);
}
sub_0804A7D4(this);
}
void nullsub_22(void) {
}
void sub_080452A4(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->nonPlanarMovement = 0x100;
sub_0804A720(this);
InitializeAnimation(this, 6);
if (this->entityType.parameter) {
this->action = 2;
this->actionDelay = 1;
} else {
sub_080452E4(this);
}
}
void sub_080452E4(Entity* this) {
this->action = 2;
this->actionDelay = (Random() & 0x1f) + 1;
}
void sub_080452FC(Entity *this) {
u32 cVar2, bVar3;
GetNextFrame(this);
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 1;
if (0 < this->nonPlanarMovement)
this->actionDelay = sub_0806FA04(0x1000, this->nonPlanarMovement) >> 0x8;
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
cVar2 = sub_08049EE4(this);
bVar3 = Random() & 8;
bVar3 += 0xfc;
this->direction = (cVar2 + bVar3) & 0x18;
} else {
this->direction = Random() & 0x18;
sub_08045374(this);
}
}
}
void sub_08045374(Entity* this) {
sub_080AEF88(this);
GetNextFrame(this);
if (--this->actionDelay == 0)
this->action = 1;
}
+78 -93
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
typedef struct {
void* field_0x0;
@@ -7,28 +9,31 @@ typedef struct {
u8 freezeTime;
} EntityHandler;
extern void EnemyFunctionHandler(Entity*, void*);
extern void SetChildOffset(Entity*, u32, u32, u32);
extern void sub_0804AA30(Entity*, void*);
typedef struct {
s8 h, v;
} PACKED PosOffset;
void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A9FC(Entity*, u32);
extern void sub_0804A720(Entity*);
extern void sub_08044FF8(Entity*);
extern u32 Random(void);
extern u32 sub_0806FA04(u32, u32);
extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049EE4(Entity*);
extern u32 sub_080AEF88(void);
extern void sub_0804A4E4(Entity*, Entity*);
extern u32 sub_080002CC(Entity*, s32, s32);
extern void (*gUnk_080D16BC[])(Entity*);
extern void (*gUnk_080D16A4[])(Entity*);
extern void (*const gUnk_080D16BC[])(Entity*);
extern void (*const gUnk_080D16A4[])(Entity*);
extern u8 gUnk_080D16D0[4]; // Entity count per form
extern PosOffset gUnk_080D16D4[4];
extern u8 gUnk_080D16D0;
extern u8 gEntCount;
extern EntityHandler gUnk_03003DB8;
void Slime(Entity* this)
{
EnemyFunctionHandler(this, &gUnk_080D16A4);
void Slime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D16A4);
SetChildOffset(this, 0, 1, -12);
}
@@ -40,7 +45,7 @@ void sub_08044F88(Entity* this) {
if ((this->currentHealth != 0) && (this->cutsceneBeh.HALF.LO != this->currentHealth)) {
this->action = 4;
} else {
sub_0804AA30(this, &gUnk_080D16A4);
sub_0804AA30(this, gUnk_080D16A4);
}
if (this->field_0x43 != 0) {
@@ -61,32 +66,21 @@ void sub_08044FC8(Entity* this) {
}
void sub_08044FF8(Entity* this) {
u32 bVar1;
this->action = 2;
bVar1 = Random();
this->actionDelay = (bVar1 & 31) + 30;
this->actionDelay = (Random() & 31) + 30;
this->cutsceneBeh.HALF.LO = this->currentHealth;
}
void sub_08045018(Entity* this) {
u32 cVar1;
u32 param3;
u32 iVar3;
u32 randValue;
GetNextFrame(this);
param3 = this->actionDelay -= 1;
if (param3 == 0) {
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 1;
if (0 < this->nonPlanarMovement) {
this->actionDelay = sub_0806FA04(4096, this->nonPlanarMovement) >> 8;
}
iVar3 = sub_08049FA0(this);
if ((iVar3 == 0) && (randValue = Random(), (randValue & 3) != 0)) {
cVar1 = sub_08049EE4(this);
this->direction = (cVar1 + 0xfc + (Random() & 8)) & 24;
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
this->direction = (sub_08049EE4(this) + 0xfc + (Random() & 8)) & 24;
return;
}
this->direction = Random() & 24;
@@ -94,74 +88,65 @@ void sub_08045018(Entity* this) {
}
void sub_08045088(Entity* this) {
u8 bVar1;
sub_080AEF88();
sub_080AEF88(this);
GetNextFrame(this);
bVar1 = this->actionDelay -= 1;
if (bVar1 == 0) {
if (--this->actionDelay == 0) {
this->action = 1;
}
}
#ifdef NON_MATCHING
void sub_080450A8(Entity* this)
{
u8 bVar1;
u32 uVar2;
s32 iVar3;
s32 iVar4;
Entity* pEVar5;
Entity** ppEVar6;
s32 dividend;
u32 uVar7;
Entity* local_r6_72;
u32 divisor;
u8* pcVar8;
Entity* local_2c[4];
ppEVar6 = local_2c;
bVar1 = (&gUnk_080D16D0)[(this->entityType).form];
divisor = (u32)bVar1;
if ((int)gUnk_03003DB8.entityCount < (int)(72 - divisor)) {
uVar7 = divisor;
if (bVar1 != 0) {
do {
uVar2 = CreateEnemy(87, this->entityType.form);
*ppEVar6 = uVar2;
ppEVar6 = ppEVar6 + 1;
uVar7 = uVar7 - 1;
} while (uVar7 != 0);
}
pcVar8 = "\x06";
iVar4 = 0;
if (bVar1 != 0) {
do {
local_r6_72 = local_2c[iVar4];
dividend = iVar4 + 1;
iVar3 = Div(dividend, divisor);
local_r6_72->attachedEntity = local_2c[iVar3];
iVar4 = Div(iVar4 + divisor + -1, divisor);
local_r6_72->parent = local_2c[iVar4];
(local_r6_72->entityType).parameter = 1;
local_r6_72->height.WORD = 0;
local_r6_72->hurtBlinkTime = 240;
sub_08045178(this, local_r6_72, *pcVar8, pcVar8[1]);
pcVar8 = pcVar8 + 2;
iVar4 = dividend;
} while (dividend < divisor);
}
pEVar5 = CreateFx(this, 2, 0);
if (pEVar5 != NULL) {
CopyPosition(this, pEVar5);
}
DeleteEnemy(this);
}
}
#else
NAKED
/* Split slime into new ones */
void sub_080450A8(Entity* this) {
asm(".include \"asm/non_matching/slime/sub_080450A8.inc\"");
Entity* entities[4];
Entity* ent;
s32 count, i;
PosOffset* off;
/* Can we create enough new entities? */
count = gUnk_080D16D0[this->entityType.form];
if (72 - count <= gEntCount)
return;
/* Create 2-4 new MiniSlime */
for (i = 0; i < count; i++)
entities[i] = CreateEnemy(0x57, this->entityType.form);
off = gUnk_080D16D4;
for (i = 0; i < count; i++) {
ent = entities[i];
ent->attachedEntity = entities[(i + 1) % count];
ent->parent = entities[(i + count - 1) % count];
ent->entityType.parameter = 1;
ent->height.HALF.HI = 0;
ent->hurtBlinkTime = -0x10;
/* Set MiniSlime offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
off++;
}
ent = CreateFx(this, 2, 0);
if (ent)
CopyPosition(this, ent);
DeleteEntity(this);
}
void sub_08045178(Entity* this, Entity* child, int h, int v) {
int x, y;
if (child == NULL)
return;
sub_0804A4E4(this, child);
if (sub_080002CC(child, h, v))
return;
x = child->x.HALF.HI + h;
if (0 <= x && x < (gRoomControls.roomOriginX + gRoomControls.width))
child->x.HALF.HI = x;
y = child->y.HALF.HI + v;
if (0 <= y && y < (gRoomControls.roomOriginY + gRoomControls.height))
child->y.HALF.HI = y;
}
#endif
+80 -39
View File
@@ -6,25 +6,42 @@
#include "area.h"
#include "functions.h"
extern void (*(gUnk_08108208[]))(Manager*);
/*
* Manager B is used to create fights:
* It possibly waits for an inhibitor flag to be set, then spawns a bunch of entities (based on room data).
* Once all enemies created this way are dead, it sets a flag.
* (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a fight theme) by default but can be overridden through room data)
*/
void (*const ManagerB_ActionFuncs[])(Manager*);
void sub_080585F0(Manager* this) {
gUnk_08108208[this->unk_0a](this);
//make a distincion if this is a controller (unk_0a = 0) or a helper (unk_0a = 1)
ManagerB_ActionFuncs[this->unk_0a](this);
}
extern void (*(gUnk_08108210[]))(Manager*);
enum ManagerB_State {
Init,
WaitForFlag,
WaitForDone
};
void sub_08058608(Manager* this) {
gUnk_08108210[this->action](this);
void (*const ManagerB_StateFuncs[])(ManagerB*);
void ManagerB_Main(ManagerB* this) {
//make a distinction based on the state of this controller
ManagerB_StateFuncs[this->manager.action](this);
}
void sub_080586EC(Manager*);
void ManagerB_LoadFight(Manager*);
void sub_08058620(ManagerB* this) {
void ManagerB_Init(ManagerB* this) {
//check if the fight was already completed previously (checks the flag that gets set after the fight is done)
if (!CheckFlags(this->unk_3e)) {
this->manager.action = 1;
this->manager.action = WaitForFlag;
//if there is no flag that needs to be set before the fight is started, start it immediately
if (!this->unk_3c) {
sub_080586EC(&this->manager);
ManagerB_LoadFight(&this->manager);
}
sub_0805E3A0(this, 3);
} else {
@@ -33,10 +50,10 @@ void sub_08058620(ManagerB* this) {
}
extern void sub_080186C0(u32);
void sub_08058650(ManagerB* this) {
void ManagerB_WaitForFlag(ManagerB* this) {
int tmp;
if (CheckFlags(this->unk_3c)) {
sub_080586EC(&this->manager);
ManagerB_LoadFight(&this->manager);
if (!this->unk_35) {
tmp = gRoomVars.field_0x9 ? gRoomVars.field_0x9 : 0x33;
this->unk_20 = gArea.musicIndex;
@@ -49,9 +66,12 @@ void sub_08058650(ManagerB* this) {
extern void sub_0801855C(void);
void sub_080586A8(ManagerB* this) {
void ManagerB_WaitForDone(ManagerB* this) {
//check if all helpers are done
if (this->manager.unk_0e) return;
//set the completion flag for the fight
SetFlag(this->unk_3e);
//restore music (if it was set, which apparently is only possible if there's a flag the fight waited for)
if (this->unk_3c) {
if (!this->unk_35) {
gArea.musicIndex = this->unk_20;
@@ -62,40 +82,45 @@ void sub_080586A8(ManagerB* this) {
DeleteThisEntity();
}
ManagerBHelper* sub_08058760(Manager*);
void sub_08058798(ManagerBHelper*, Entity*, u32);
ManagerBHelper* CreateHelper(Manager*);
void ManagerBHelper_Monitor(ManagerBHelper*, Entity*, u32);
extern EntityData* GetCurrentRoomProperty(u8);
extern Entity* LoadRoomEntity(EntityData*);
void sub_080586EC(Manager* this) {
ManagerBHelper* tmp;
void ManagerB_LoadFight(Manager* this) {
ManagerBHelper* monitor;
EntityData* prop;
Entity* ent;
u32 counter;
this->action = 2;
this->unk_0e = 0;
counter = 0;
tmp = sub_08058760(this);
if (!tmp) DeleteThisEntity();
//Create a helper to keep track of the created entities.
monitor = CreateHelper(this);
if (!monitor) DeleteThisEntity();
prop = (EntityData*) GetCurrentRoomProperty(this->unk_0b);
if (prop) {
while (*((u8*)prop) != 0xFF) {
ent = LoadRoomEntity(prop++);
if (ent && (ent->entityType.type == 3)) {
ent->field_0x6c.HALF.HI |= 0x40;
sub_08058798(tmp, ent, counter++);
ManagerBHelper_Monitor(monitor, ent, counter++);
}
if (counter >= 7) {
counter = 0;
tmp = sub_08058760(this);
if (!tmp) return;
monitor = CreateHelper(this);
if (!monitor) return;
}
}
}
}
ManagerBHelper* sub_08058760(Manager* this) {
/*
* Create a helper and increment the counter for the number of helpers (unk_0e).
* The helper will decrease said counter when it deletes itself (when none of the enemies it monitors remain).
*/
ManagerBHelper* CreateHelper(Manager* this) {
ManagerBHelper* extra;
extra = (ManagerBHelper*) GetEmptyManager();
if (extra) {
@@ -110,51 +135,67 @@ ManagerBHelper* sub_08058760(Manager* this) {
return extra;
}
void sub_08058798(ManagerBHelper* this, Entity* value, u32 index) {
this->enemies[index]=value;
void ManagerBHelper_Monitor(ManagerBHelper* this, Entity* ent, u32 index) {
this->enemies[index]=ent;
this->manager.unk_0e++;
}
void sub_080587AC(ManagerBHelper* this) {
u8 i, tmp;
//case unk_0a is 1: The manager is a helper
void ManagerBHelper_Main(Manager* this) {
u8 i, anyRemaining;
Entity* current;
if (this->manager.action == 0) {
this->manager.action = 1;
if (this->action == 0) {
this->action = 1;
sub_0805E3A0(this,3);
}
tmp = 0;
//go through and check all monitored enemies.
anyRemaining = 0;
for (i = 0; i < 8; i++) {
if ((current = this->enemies[i])) {
if ((current = ((ManagerBHelper*)this)->enemies[i])) {
if (!current->next) {
this->enemies[i] = 0;
((ManagerBHelper*) this)->enemies[i] = 0;
} else {
tmp = 1;
anyRemaining = 1;
}
}
}
if (!tmp) {
if (((ManagerB*) this->manager.parent)->manager.unk_0e) {
((ManagerB*) this->manager.parent)->manager.unk_0e--;
if (!anyRemaining) {
//inform the parent that we're done
if (((ManagerB*) this->parent)->manager.unk_0e) {
((ManagerB*) this->parent)->manager.unk_0e--;
}
DeleteThisEntity();
DeleteThisEntity();
}
}
extern Manager gUnk_03003DB0;
void sub_08058800(Entity* this, Entity* unk1) {
/*
* Replace an entity that is currently being monitored with a new one
*/
void ReplaceMonitoredEntity(Entity* old, Entity* new) {
ManagerBHelper* current;
Manager* end = &gUnk_03003DB0;
u32 i;
for (current = (ManagerBHelper*) end->next; (Manager*)current != end; current=(ManagerBHelper*)current->manager.next) {
if (current->manager.type != 0x9 || current->manager.subtype != 0xB) continue;
for (i = 0; i < 8; i++) {
if (this == current->enemies[i]) {
current->enemies[i] = unk1;
if (old == current->enemies[i]) {
current->enemies[i] = new;
return;
}
}
}
}
void (*const ManagerB_ActionFuncs[])(Manager*) = {
(void (*)(Manager*)) ManagerB_Main,
(void (*)(Manager*)) ManagerBHelper_Main
};
void (*const ManagerB_StateFuncs[])(ManagerB*) = {
ManagerB_Init,
ManagerB_WaitForFlag,
ManagerB_WaitForDone
};
+3 -7
View File
@@ -1,21 +1,19 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
extern void sub_0806ED78(Entity*);
extern void sub_0806920C(Entity*);
extern u32 sub_0805ACC0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_0806924C(Entity*);
extern void sub_080AEF88(Entity*);
extern void ShowNPCDialogue(Entity*, u32*);
extern void sub_08078778(Entity*);
extern void sub_080787A8(Entity*, u32);
extern void sub_0806F118(Entity*);
extern void sub_080791D0();
extern void (*gUnk_08111914[])(Entity*);
extern void (*gUnk_08111928[])(Entity*);
extern u32 gUnk_08111938[];
extern Dialog gUnk_08111938[];
extern void PlaySFX(u32);
extern u32 Random();
extern u32 UpdateFuseInteraction(Entity*);
@@ -184,9 +182,7 @@ void sub_080691E0(Entity* ent) {
// Show dialogue
void Cow_ShowDialogue(Entity* ent) {
u32 var0 = ent->entityType.form;
u32* var1 = gUnk_08111938 + (var0 * 2);
ShowNPCDialogue(ent, var1);
ShowNPCDialogue(ent, &gUnk_08111938[ent->entityType.form]);
}
void sub_0806920C(Entity* ent) {
+2 -2
View File
@@ -8,7 +8,7 @@ void sub_08065A64(Entity* this);
void sub_08065AA4(Entity*);
extern void (*gUnk_0811006C[])(Entity*);
extern u32 gUnk_08110080[];
extern Dialog gUnk_08110080[];
void Epona(Entity* this) {
gUnk_0811006C[this->action](this);
@@ -50,7 +50,7 @@ void sub_08065A34(Entity* this) {
}
void sub_08065A50(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.form * 2]);
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.form]);
}
void sub_08065A64(Entity* this) {
-1
View File
@@ -10,7 +10,6 @@ extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*);
extern void ExecuteScriptCommandSet(Entity*, void *);
extern void sub_0805FF2C(Entity*, void*);
extern void sub_0806ED78(Entity*);
extern void (*const gUnk_08109BBC[])(Entity*);
+100 -118
View File
@@ -5,9 +5,8 @@
#include "textbox.h"
#include "player.h"
#include "structures.h"
#include "functions.h"
extern void sub_0805E3A0(Entity*, u32);
extern void StartCutscene(Entity*, void*);
extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*);
extern void sub_0807DDAC(Entity*, u32);
@@ -16,7 +15,6 @@ extern void sub_080600F0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807000C(Entity*);
extern void sub_080042BA(Entity*, u32);
extern void sub_08060158(Entity*);
extern u32 CheckKinstoneFused(u32);
extern Entity* FindEntityInListBySubtype(u32, u32, u32);
@@ -26,10 +24,10 @@ extern u32 Random(void);
extern void ModBombs(s32);
extern SpriteLoadData gUnk_0810A348;
extern void* gUnk_08109D18[];
extern u8* gUnk_08109D18[];
extern u8 gUnk_08109C98[];
extern u16 gUnk_0810A354[];
extern u32 gUnk_08109DC8[];
extern Dialog gUnk_08109DC8[];
extern u16 gUnk_0810A35A[];
extern u16 gUnk_0810A362[];
@@ -165,141 +163,125 @@ void sub_080601D4(Entity* this) {
TextboxNoOverlap(gUnk_0810A354[uVar2], this);
}
void sub_08060208(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
void sub_08060208(Entity* this) {
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x4]);
}
void sub_0806021C(Entity *this)
{
u32 uVar1;
u32 uVar2;
void sub_0806021C(Entity* this) {
u32 uVar1;
u32 uVar2;
//jabber nut
uVar1 = GetInventoryValue(0x5B);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
// jabber nut
uVar1 = GetInventoryValue(0x5B);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
//earth element
if (GetInventoryValue(0x40)) {
uVar2 = 2;
}
//mole mitts
if (GetInventoryValue(0x13)) {
uVar2 = 3;
}
ShowNPCDialogue(this, gUnk_08109DC8 + this->entityType.parameter * 0x8 + uVar2 * 2);
}
void sub_0806025C(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
}
void sub_08060270(Entity *this)
{
u32 index;
//flippers
if (GetInventoryValue(0x46) == 0) {
index = 1;
if (CheckGlobalFlag(MIZUKAKI_START) == 0) {
index = 0;
SetGlobalFlag(MIZUKAKI_START);
// earth element
if (GetInventoryValue(0x40)) {
uVar2 = 2;
}
}
else {
index = 3;
if (CheckLocalFlag(0x76) == 0) {
index = 2;
SetLocalFlag(0x76);
// mole mitts
if (GetInventoryValue(0x13)) {
uVar2 = 3;
}
}
TextboxNoOverlap(gUnk_0810A35A[index], this);
ShowNPCDialogue(this, gUnk_08109DC8 + this->entityType.parameter * 0x4 + uVar2);
}
void sub_080602BC(Entity *this)
{
u32 index;
//spin attack
void sub_0806025C(Entity* this) {
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x4]);
}
void sub_08060270(Entity* this) {
u32 index;
// flippers
if (GetInventoryValue(0x46) == 0) {
index = 1;
if (CheckGlobalFlag(MIZUKAKI_START) == 0) {
index = 0;
SetGlobalFlag(MIZUKAKI_START);
}
} else {
index = 3;
if (CheckLocalFlag(0x76) == 0) {
index = 2;
SetLocalFlag(0x76);
}
}
TextboxNoOverlap(gUnk_0810A35A[index], this);
}
void sub_080602BC(Entity* this) {
u32 index;
// spin attack
if (GetInventoryValue(0x48) != 0) {
index = (Random() & 1) + 2;
index = (Random() & 1) + 2;
} else {
if (gUnk_02002A40.stats.bombCount < gBombBagSizes[gUnk_02002A40.stats.bombBagType]) {
index = 1;
} else {
index = 0;
}
}
else {
if (gUnk_02002A40.stats.bombCount < gBombBagSizes[gUnk_02002A40.stats.bombBagType]) {
index = 1;
}
else {
index = 0;
}
}
TextboxNoOverlap(gUnk_0810A362[index], this);
TextboxNoOverlap(gUnk_0810A362[index], this);
}
void sub_0806030C(Entity* this, u32 *arg1)
{
void sub_0806030C(Entity* this, u32* arg1) {
ModBombs(*(arg1 + 1));
}
void sub_08060318(void)
{
Entity *ent;
int i;
for (i = 2; i >= 0; i--) {
ent = FindEntityInListBySubtype(8, 2, 2);
if (ent != NULL) {
sub_080A29BC(ent);
DeleteEntity(ent);
void sub_08060318(void) {
Entity* ent;
int i;
for (i = 2; i >= 0; i--) {
ent = FindEntityInListBySubtype(8, 2, 2);
if (ent != NULL) {
sub_080A29BC(ent);
DeleteEntity(ent);
}
}
}
}
void sub_08060340(void)
{
gUnk_02002A40.unk490 = gUnk_02002A40.unk50;
void sub_08060340(void) {
gUnk_02002A40.unk490 = gUnk_02002A40.unk50;
}
u32 sub_08060354(void)
{
u32 iVar1;
s32 iVar2;
iVar2 = gUnk_02002A40.unk50 - gUnk_02002A40.unk490;
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;
u32 sub_08060354(void) {
u32 iVar1;
s32 iVar2;
iVar2 = gUnk_02002A40.unk50 - gUnk_02002A40.unk490;
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;
}
} else {
if (CheckGlobalFlag(DRUG_2) == 0) {
if (iVar2 > 9) {
return 0x8444;
}
} else {
if (CheckGlobalFlag(DRUG_3) == 0) {
if (iVar2 > 14) {
return 0x8444;
}
}
}
}
}
else {
if (CheckGlobalFlag(DRUG_2) == 0) {
if (iVar2 > 9) {
return 0x8444;
}
}
else {
if (CheckGlobalFlag(DRUG_3) == 0) {
if (iVar2 > 14) {
return 0x8444;
}
}
}
}
return 0;
return 0;
}
void ForestMinish_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
this->action++;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 6);
void ForestMinish_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
this->action++;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
else {
GetNextFrame(this);
}
}
+6 -5
View File
@@ -3,9 +3,10 @@
#include "functions.h"
#include "textbox.h"
extern u8 gUnk_02033280[];
extern void (*gUnk_08111A80[])(Entity*);
extern void (*gUnk_08111A8C[])(Entity*);
extern u8 gUnk_02033280[];
extern Dialog gUnk_08111A94[];
void Goron(Entity* this) {
if (this->flags & 2) {
@@ -72,7 +73,7 @@ void sub_080693D0(Entity* this) {
}
if (this->frames.all == 2) {
this->frames.all = 0;
sub_08069428(this, 0x80<<12, createFx65);
sub_08069428(this, 0x80 << 12, createFx65);
}
}
}
@@ -110,16 +111,16 @@ void sub_080694B0(Entity* this) {
}
}
extern u64 gUnk_08111A94[]; //array of unknown 64 bit structure type
void sub_080694D8(Entity* this) {
ShowNPCDialogue(this, (u32*)&gUnk_08111A94[this->entityType.form]);
ShowNPCDialogue(this, &gUnk_08111A94[this->entityType.form]);
}
void sub_080694EC(Entity* this) {
u32 anim;
this->animationState = 4;
anim = 2;
if (!CheckKinstoneFused(47)) anim = 8;
if (!CheckKinstoneFused(47))
anim = 8;
InitAnimationForceUpdate(this, anim);
this->field_0x80.HWORD = anim;
}
+8 -20
View File
@@ -84,24 +84,12 @@ void sub_0806b2b4(Entity* this) {
TextboxNoOverlap(gUnk_08112D50[index], this);
}
void Librari_Fusion(Entity *this)
{
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitAnimationForceUpdate(this, 9);
}
else {
UpdateAnimationSingleFrame(this);
}
void Librari_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitAnimationForceUpdate(this, 9);
} else {
UpdateAnimationSingleFrame(this);
}
}
void Percy_Head(Entity *this) // ???
{
SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13);
SetExtraSpriteFrame(this, 1, (this->frames.all & 0x7f) + 0xb);
SetExtraSpriteFrame(this, 2, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 2, 1);
SetSpriteSubEntryOffsetData2(this, 2, 0);
sub_0807000C(this);
}
+39 -48
View File
@@ -7,33 +7,30 @@
#include "textbox.h"
#include "npc.h"
#include "structures.h"
#include "functions.h"
extern void sub_0807DD50(Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern u32 sub_0801E99C();
extern void sub_08078784(Entity*,u32);
extern void sub_0807DDAC(Entity*,u32);
extern void sub_0805E3A0(Entity*,u32);
extern void sub_08078784(Entity*, u32);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_08078850();
extern u32 gUnk_08113F44;
extern u32 gUnk_08113F48;
extern Dialog gUnk_08113F48[];
extern u32 GetInventoryValue(u32);
extern u32 CheckLocalFlag(u32);
extern void SetLocalFlag();
extern void ShowNPCDialogue();
void MayorHagen(Entity *this)
{
void MayorHagen(Entity* this) {
u32 v;
switch (this->action) {
case 0:
this->action = 1;
this->field_0x68.HALF.HI = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0805E3A0(this, 2);
sub_0807DD50(this);
this->action = 1;
this->field_0x68.HALF.HI = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0805E3A0(this, 2);
sub_0807DD50(this);
break;
case 1:
v = this->interactType;
@@ -41,11 +38,11 @@ void MayorHagen(Entity *this)
this->action = v;
this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex;
InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
InitAnimationForceUpdate(this, 4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this);
break;
}
sub_0807DDAC(this,0);
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
break;
@@ -57,49 +54,43 @@ void MayorHagen(Entity *this)
}
}
void sub_0806CE5C(Entity *this)
{
sub_08078784(this,sub_0801E99C());
sub_08078850(this,1,0,&gUnk_08113F44);
void sub_0806CE5C(Entity* this) {
sub_08078784(this, sub_0801E99C(this));
sub_08078850(this, 1, 0, &gUnk_08113F44);
}
void sub_0806CE80(Entity *this)
{
void sub_0806CE80(Entity* this) {
u32 v;
u32 v2;
v = gUnk_02002A40.unk8;
if (v == 5) {
//flippers
if (GetInventoryValue(0x46) == 0) {
if (CheckLocalFlag(0x70) != 0) {
v2 = CheckLocalFlag(0x71);
if (v2 == 0) {
v = 0xb;
SetLocalFlag(0x71);
}
else {
v = 0xc;
}
}
else {
if (v == 5) {
// flippers
if (GetInventoryValue(0x46) == 0) {
if (CheckLocalFlag(0x70) != 0) {
v2 = CheckLocalFlag(0x71);
if (v2 == 0) {
v = 0xb;
SetLocalFlag(0x71);
} else {
v = 0xc;
}
} else {
v = 0xa;
}
}
else {
v2 = CheckLocalFlag(0x89);
if (v2 == 0) {
v = 0xd;
SetLocalFlag(0x89);
}
else {
v = 0xe;
}
} else {
v2 = CheckLocalFlag(0x89);
if (v2 == 0) {
v = 0xd;
SetLocalFlag(0x89);
} else {
v = 0xe;
}
}
}
}
ShowNPCDialogue(this,&gUnk_08113F48 + 2*v);
ShowNPCDialogue(this, &gUnk_08113F48[v]);
}
void MayorHagen_Fusion(Entity *this) {
void MayorHagen_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = 1;
-1
View File
@@ -4,7 +4,6 @@
#include "textbox.h"
#include "functions.h"
extern void sub_0806ED78(Entity*);
extern void sub_08068780(Entity*);
extern void sub_08078778(Entity*);
extern u32 Random(void);
+42 -49
View File
@@ -5,8 +5,8 @@
#include "textbox.h"
#include "npc.h"
#include "structures.h"
#include "functions.h"
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
@@ -19,10 +19,9 @@ extern void sub_08078784(Entity*, u32);
extern SpriteLoadData gUnk_08110C00;
extern u16 gUnk_08110C0C[];
extern u32 gUnk_08110C10[];
extern Dialog gUnk_08110C10[];
void Mutoh(Entity* this)
{
void Mutoh(Entity* this) {
if (*(u32*)&this->cutsceneBeh == 0) {
DeleteThisEntity();
}
@@ -30,11 +29,11 @@ void Mutoh(Entity* this)
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08110C00)) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
@@ -53,48 +52,42 @@ void Mutoh(Entity* this)
}
}
void Mutoh_Head(Entity *this)
{
SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81));
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this,1,0);
sub_0807000C(this);
void Mutoh_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81));
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_080670B4(Entity *this)
{
u32 uVar1;
u32 uVar2;
uVar2 = 0;
if (GetInventoryValue(0x11) == 0) {
uVar1 = CheckGlobalFlag(TABIDACHI);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
}
TextboxNoOverlap(gUnk_08110C0C[uVar2],this);
}
void sub_080670B4(Entity* this) {
u32 uVar1;
u32 uVar2;
void sub_080670E4(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk8 * 2]);
}
void sub_08067100(Entity *this)
{
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Mutoh_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
uVar2 = 0;
if (GetInventoryValue(0x11) == 0) {
uVar1 = CheckGlobalFlag(TABIDACHI);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
}
TextboxNoOverlap(gUnk_08110C0C[uVar2], this);
}
void sub_080670E4(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk8]);
}
void sub_08067100(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Mutoh_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
}
} else {
GetNextFrame(this);
}
}
else {
GetNextFrame(this);
}
}
+87 -16
View File
@@ -3,12 +3,28 @@
#include "npc.h"
#include "textbox.h"
#include "functions.h"
#include "flags.h"
extern void sub_0806B41C(Entity*);
void sub_0806B3CC(Entity*);
extern void sub_0806B3CC(Entity*);
extern u32 sub_08002632(Entity*);
extern void sub_0801DFB4(Entity*, u32, u32, u32);
extern u16* gUnk_08001A7C[40];
extern u16 gUnk_08112E54[4];
extern Dialog gUnk_08112E2C[5];
extern SpriteLoadData gUnk_08112E1C;
void Percy_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13);
SetExtraSpriteFrame(this, 1, (this->frames.all & 0x7f) + 0xb);
SetExtraSpriteFrame(this, 2, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 2, 1);
SetSpriteSubEntryOffsetData2(this, 2, 0);
sub_0807000C(this);
}
void Percy(Entity* this) {
if ((this->flags & 2) != 0) {
sub_0806B41C(this);
@@ -17,20 +33,75 @@ void Percy(Entity* this) {
}
}
void sub_0806B3CC(Entity *this)
{
if (this->action == 0) {
if (!LoadExtraSpriteData(this, &gUnk_08112E1C)) {
return;
void sub_0806B3CC(Entity* this) {
if (this->action == 0) {
if (!LoadExtraSpriteData(this, &gUnk_08112E1C)) {
return;
}
this->action = 1;
InitializeAnimation(this, 0);
sub_08078778(this);
}
this->action = 1;
InitializeAnimation(this, 0);
sub_08078778(this);
}
GetNextFrame(this);
if (this->interactType != 0) {
this->interactType = 0;
TextboxNoOverlapFollow(0);
}
sub_0806ED78(this);
GetNextFrame(this);
if (this->interactType != 0) {
this->interactType = 0;
TextboxNoOverlapFollow(0);
}
sub_0806ED78(this);
}
void sub_0806B41C(Entity* this) {
u16* tmp;
u32 idx;
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08112E1C)) {
this->action = 1;
this->spriteSettings.b.draw = 1;
if (this->entityType.parameter == 2) {
CreateFx(this, 0x25, 0);
}
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
idx = sub_08002632(this);
tmp = gUnk_08001A7C[idx];
if (this->field_0x68.HALF.LO == 33)
tmp += 3;
sub_0801DFB4(this, tmp[0], tmp[1], tmp[2]);
gPlayerState.field_0x8b = 3;
} else {
sub_0807DD94(this, 0);
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
break;
}
}
void sub_0806B4F0(Entity* this) {
ShowNPCDialogue(this, &gUnk_08112E2C[this->entityType.parameter]);
}
void sub_0806B504(Entity* this) {
int idx;
idx = 1;
if (CheckKinstoneFused(0x21)) {
idx = 3;
} else if (!CheckLocalFlag(0x86)) {
idx = 0;
SetLocalFlag(0x86);
}
TextboxNoOverlap(gUnk_08112E54[idx], this);
}
+6 -7
View File
@@ -18,7 +18,6 @@ extern void sub_0806EE04(Entity*, void*, u32);
extern void sub_080604DC(Entity*);
extern s32 sub_0806ED9C(Entity*, u32, u32);
extern void sub_0806EE20(Entity*);
extern void sub_0806ED78(Entity*);
extern u32 sub_080040A8(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_0807DD50(Entity*);
@@ -43,7 +42,7 @@ extern Coords16 gUnk_0810A66C[];
extern s8* gUnk_0810A918[];
extern void (*const gUnk_0810AA24[])(Entity*);
extern u32 gUnk_0810AA30[];
extern Dialog gUnk_0810AA30[];
extern struct_02033280 gUnk_02033280;
void Postman(Entity* this) {
@@ -205,13 +204,13 @@ void sub_080606C0(Entity *this)
void sub_080606D8(Entity* this)
{
s32 iVar1;
s32 index;
iVar1 = gUnk_02002A40.unk8 - 2;
if (iVar1 < 0) {
iVar1 = 0;
index = gUnk_02002A40.unk8 - 2;
if (index < 0) {
index = 0;
}
ShowNPCDialogue(this, &gUnk_0810AA30[iVar1 * 2]);
ShowNPCDialogue(this, &gUnk_0810AA30[index]);
}
void sub_08060700(Entity *entity, u32 arg1)
-1
View File
@@ -4,7 +4,6 @@
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_0806ED78(Entity*);
extern void PlaySFX(u32);
extern void sub_0806A8C8(Entity*);
extern void sub_0807DD94(Entity*, u32);
+137 -168
View File
@@ -1,30 +1,22 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
typedef struct {
u8 filler[8];
u8 unk;
} SaveFile;
#include "functions.h"
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0806ED78(Entity*);
extern Entity* CreateFx(Entity*, u32, u32);
extern void PlaySFX(u32);
extern u32 Random(void);
extern void sub_0807000C(Entity*);
extern u32 sub_0801E99C(Entity*);
extern u32 sub_0806ED9C(Entity*, u32, u32);
extern u32 sub_0806F078(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern u32 GetAnimationState(Entity*);
extern void ShowNPCDialogue(Entity*, u32*);
extern void sub_08078850(u32, u32, u32, u32*);
extern void sub_08078784(Entity*, u32);
@@ -33,193 +25,170 @@ extern void (*const gUnk_0811036C[])(Entity*);
extern u16 gUnk_08110380[];
extern SpriteLoadData gUnk_08110354;
extern SaveFile gUnk_02002A40;
extern u32 gUnk_08110390[];
extern Dialog gUnk_08110390[];
extern u16 gUnk_081103D0[];
extern u32 gUnk_081103E0;
#if NON_MATCHING //reg-alloc
void Smith(Entity *this)
{
u32 iVar2;
u32 iVar4;
if ((this->flags & 2) != 0) {
if (this->interactType == 2) {
this->action = 4;
this->interactType = 0;
iVar4 = (this->animIndex == 0xc) ? 8 : 0;
iVar2 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
InitAnimationForceUpdate(this, iVar2 + iVar4);
sub_0806F118(this);
#if NON_MATCHING // reg-alloc
void Smith(Entity* this) {
u32 iVar2;
u32 iVar4;
if ((this->flags & 2) != 0) {
if (this->interactType == 2) {
this->action = 4;
this->interactType = 0;
iVar4 = (this->animIndex == 0xc) ? 8 : 0;
iVar2 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
InitAnimationForceUpdate(this, iVar2 + iVar4);
sub_0806F118(this);
}
gUnk_0811036C[this->action](this);
} else {
gUnk_08110360[this->action](this);
sub_0806ED78(this);
}
if (this->animIndex == 0xc) {
this->spritePriority.b1 = 0;
} else {
this->spritePriority.b1 = 1;
}
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
CreateFx(this, 0x3d, 0x20);
PlaySFX(gUnk_08110380[(Random() & 7)]);
}
gUnk_0811036C[this->action](this);
}
else {
gUnk_08110360[this->action](this);
sub_0806ED78(this);
}
if (this->animIndex == 0xc) {
this->spritePriority.b1 = 0;
}
else {
this->spritePriority.b1 = 1;
}
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
CreateFx(this, 0x3d, 0x20);
PlaySFX(gUnk_08110380[(Random() & 7)]);
}
}
#else
NAKED
void Smith(Entity *this) {
void Smith(Entity* this) {
asm(".include \"asm/non_matching/smith/smith.inc\"");
}
#endif
void Smith_Head(Entity *this)
{
u8 bVar1;
bVar1 = this->frames.all;
SetExtraSpriteFrame(this, 0, this->frameIndex);
if ((bVar1 & 0x40) != 0) {
SetExtraSpriteFrame(this, 1, 0x16);
}
else {
SetExtraSpriteFrame(this, 1, 0xff);
}
SetSpriteSubEntryOffsetData1(this,0,1);
sub_0807000C(this);
void Smith_Head(Entity* this) {
u8 bVar1;
bVar1 = this->frames.all;
SetExtraSpriteFrame(this, 0, this->frameIndex);
if ((bVar1 & 0x40) != 0) {
SetExtraSpriteFrame(this, 1, 0x16);
} else {
SetExtraSpriteFrame(this, 1, 0xff);
}
SetSpriteSubEntryOffsetData1(this, 0, 1);
sub_0807000C(this);
}
void sub_080660EC(Entity *this)
{
void sub_080660EC(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
InitAnimationForceUpdate(this, 2);
}
}
void sub_08066118(Entity *this)
{
s32 uVar1;
u32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
}
else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
this->action = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
InitAnimationForceUpdate(this, 2);
}
else {
--this->field_0xf;
uVar1 = this->animIndex;
}
void sub_08066118(Entity* this) {
s32 uVar1;
u32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
--this->field_0xf;
uVar1 = this->animIndex;
}
}
if (sub_0806F078(this, uVar1) == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
TextboxNoOverlapFollow(0);
}
}
if (sub_0806F078(this, uVar1) == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
TextboxNoOverlapFollow(0);
}
}
void sub_08066170(Entity *this)
{
void sub_08066170(Entity* this) {
this->action = 1;
}
void sub_08066178(Entity *this)
{
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
}
void sub_08066178(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
}
}
void sub_080661B0(Entity *this)
{
void sub_080661B0(Entity* this) {
sub_0807DD94(this, 0);
}
void sub_080661BC(Entity *this)
{
u32 sVar1;
if (this->animIndex == 0xc) {
UpdateAnimationSingleFrame(this);
if ((this->frames.b.f3) != 0) {
this->field_0x80.HWORD = GetAnimationState(this) + 8;
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
void sub_080661BC(Entity* this) {
u32 sVar1;
if (this->animIndex == 0xc) {
UpdateAnimationSingleFrame(this);
if ((this->frames.b.f3) != 0) {
this->field_0x80.HWORD = GetAnimationState(this) + 8;
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
}
} else {
sub_0807DD94(this, 0);
}
}
else {
sub_0807DD94(this,0);
}
}
void sub_08066200(Entity *this)
{
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
}
void sub_08066218(Entity *this)
{
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806622C(Entity *this)
{
u32 iVar1;
if (gUnk_02002A40.unk - 2 < 0) {
iVar1 = 0;
}
else {
iVar1 = gUnk_02002A40.unk - 2;
}
ShowNPCDialogue(this, &gUnk_08110390[iVar1 * 2]);
}
void nullsub_501(Entity* this) {}
void sub_08066258(void)
{
PlaySFX(gUnk_081103D0[Random() & 7]);
}
void sub_08066274(u32 arg0)
{
sub_08078850(arg0, 1, 0, &gUnk_081103E0);
}
void sub_08066288(Entity *arg0)
{
sub_08078784(arg0, arg0->field_0x68.HALF.LO);
}
void Smith_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
}
}
else {
void sub_08066200(Entity* this) {
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
}
}
void sub_08066218(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806622C(Entity* this) {
u32 index;
if (gUnk_02002A40.unk8 - 2 < 0) {
index = 0;
} else {
index = gUnk_02002A40.unk8 - 2;
}
ShowNPCDialogue(this, &gUnk_08110390[index]);
}
void nullsub_501(Entity* this) {
}
void sub_08066258(void) {
PlaySFX(gUnk_081103D0[Random() & 7]);
}
void sub_08066274(u32 arg0) {
sub_08078850(arg0, 1, 0, &gUnk_081103E0);
}
void sub_08066288(Entity* arg0) {
sub_08078784(arg0, arg0->field_0x68.HALF.LO);
}
void Smith_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
}
} else {
UpdateAnimationSingleFrame(this);
}
}
+3 -6
View File
@@ -1,24 +1,21 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
#include "functions.h"
extern void sub_08078778(Entity*);
extern void sub_0805E47C(Entity*);
extern void sub_0806ED78(Entity*);
extern void sub_0805E584();
extern void sub_0807DD64();
extern void sub_08062CA4();
extern void sub_0807DDAC();
extern void sub_0807DDE4();
extern u32 CheckKinstoneFused();
extern void ShowNPCDialogue();
extern void (*gStampBehaviors1[4])(Entity*);
extern void (*gStampBehaviors2[2])(Entity*);
extern u32 gUnk_0810C2E4;
extern Dialog gUnk_0810C2E4[2];
void Stamp(Entity* ent) {
if ((ent->flags & 2) != 0) {
@@ -80,7 +77,7 @@ void sub_08062CBC(Entity* ent) {
u32 uVar1;
uVar1 = CheckKinstoneFused(44);
ShowNPCDialogue(ent, &gUnk_0810C2E4 + ((-uVar1 | uVar1) >> 31) * 2);
ShowNPCDialogue(ent, &gUnk_0810C2E4[(-uVar1 | uVar1) >> 31]);
}
void sub_08062CE0(Entity* ent) {
+45 -60
View File
@@ -1,27 +1,19 @@
#include "global.h"
#include "entity.h"
#include "player.h"
typedef struct {
u8 filler[8];
u8 unk;
} SaveFile;
#include "functions.h"
extern SpriteLoadData gUnk_08113910[];
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 sub_0801E99C();
extern void sub_08078784(Entity*, u32);
extern u32 UpdateFuseInteraction(Entity*);
extern void sub_0807000C(Entity*);
extern void ShowNPCDialogue(Entity*, u16*);
extern SaveFile gUnk_02002A40;
extern u16 gUnk_08113930[];
extern Dialog gUnk_08113930[];
void Teachers(Entity* this) {
switch (this->action) {
@@ -55,59 +47,52 @@ void Teachers(Entity* this) {
}
}
void sub_0806C674(Entity *this)
{
this->field_0x68.HALF.LO = sub_0801E99C();
void sub_0806C674(Entity* this) {
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Teachers_Head(Entity *this)
{
u8 bVar1;
u8 bVar2;
u32 uVar3;
void Teachers_Head(Entity* this) {
u8 bVar1;
u8 bVar2;
u32 uVar3;
uVar3 = this->frames.all & -0x81;
bVar1 = this->frameIndex;
bVar2 = this->frameSpriteSettings & 0x3f;
if ((this->entityType).form == 0) {
SetExtraSpriteFrame(this,0, (uVar3 + 3));
SetExtraSpriteFrame(this,1, bVar1);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
else {
SetExtraSpriteFrame(this, 0, (uVar3 + 6));
SetExtraSpriteFrame(this, 1, ((bVar2) + 3));
SetExtraSpriteFrame(this, 2, bVar1);
SetSpriteSubEntryOffsetData1(this, 2, 1);
SetSpriteSubEntryOffsetData2(this, 2, 0);
sub_0807000C(this);
}
}
void sub_0806C70C(Entity *this)
{
int offset;
offset = gUnk_02002A40.unk - 2;
if (offset < 0) {
offset = 0;
}
ShowNPCDialogue(this, gUnk_08113930 + this->entityType.form * 0x20 + offset * 4);
}
void Teachers_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
uVar3 = this->frames.all & -0x81;
bVar1 = this->frameIndex;
bVar2 = this->frameSpriteSettings & 0x3f;
if ((this->entityType).form == 0) {
SetExtraSpriteFrame(this, 0, (uVar3 + 3));
SetExtraSpriteFrame(this, 1, bVar1);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
} else {
SetExtraSpriteFrame(this, 0, (uVar3 + 6));
SetExtraSpriteFrame(this, 1, ((bVar2) + 3));
SetExtraSpriteFrame(this, 2, bVar1);
SetSpriteSubEntryOffsetData1(this, 2, 1);
SetSpriteSubEntryOffsetData2(this, 2, 0);
sub_0807000C(this);
}
}
void sub_0806C70C(Entity* this) {
int offset;
offset = gUnk_02002A40.unk8 - 2;
if (offset < 0)
offset = 0;
ShowNPCDialogue(this, gUnk_08113930 + this->entityType.form * 8 + offset);
}
void Teachers_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
}
} else {
GetNextFrame(this);
}
}
else {
GetNextFrame(this);
}
}
+308 -43
View File
@@ -1,35 +1,49 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "functions.h"
#include "textbox.h"
#include "flags.h"
extern void InitializeAnimation(Entity *, u32);
extern void InitializeAnimation(Entity*, u32);
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void sub_0806ED78(Entity *);
extern u32 sub_080002C0();
extern void sub_0806ACC4(Entity*);
extern void sub_0806AEA8();
extern void sub_0806AEE4(Entity*);
extern void sub_0806AFE8(Entity*, s32*);
extern s32 sub_0806EDD8(Entity*, u32, u32);
extern u32 sub_0806F5B0(u32);
extern void sub_0806F62C(Entity*, s32, s32);
extern void sub_08078784(Entity*, u32);
extern void sub_08078850(Entity*, u32, u32, u32*);
extern void (*gUnk_081126E8[])();
extern void sub_0806ACC4(Entity *);
extern u32 LoadExtraSpriteData(Entity *, SpriteLoadData *);
extern u8 gUnk_081125F4[12];
extern SpriteLoadData gUnk_08112674[];
extern u32 gUnk_081126D4[4];
extern u8 gUnk_081126E4[4];
extern void (*gUnk_081126E8[])();
extern Dialog gUnk_081126F0[0x10];
extern void (*gUnk_08112BF0[])(Entity*, s32*);
extern u16 gUnk_08112C40[5];
extern u16 gUnk_08112C4A[3];
extern u16 gUnk_08112C50[6];
extern u16 gUnk_08112C5C[2];
extern u16 gUnk_08112C60[4];
void TownMinish(Entity *this)
{
void TownMinish(Entity* this) {
if ((this->flags & 2) == 0) {
(*gUnk_081126E8[this->action])(this);
gUnk_081126E8[this->action](this);
sub_0806ED78(this);
}
else {
} else {
sub_0806ACC4(this);
}
}
void sub_0806ABFC(Entity *this)
{
u8 animationState;
SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.form << 2];
if (!LoadExtraSpriteData(this, SpriteLoadData))
{
void sub_0806ABFC(Entity* this) {
SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.form * 4];
if (!LoadExtraSpriteData(this, SpriteLoadData)) {
return;
}
@@ -38,47 +52,298 @@ void sub_0806ABFC(Entity *this)
this->field_0x6a.HALF.LO = this->actionDelay;
this->animationState = this->field_0x6a.HALF.LO << 1;
animationState = this->animationState;
this->field_0x68.HALF.HI = animationState << 2;
this->field_0x68.HALF.HI = this->animationState * 4;
this->actionDelay = 0;
}
// Not matching yet, not 100% sure it's functionally identical
/*void sub_0806AC3C(Entity *this) {
if (this->field_0x58 <= 3) {
void sub_0806AC3C(Entity* this) {
if (this->animIndex <= 3) {
s32 unk;
u8 field_0x68;
Entity *link = &gPlayerEntity;
Entity* link = &gPlayerEntity;
if (sub_080041A0(this, link, 0x18, 0x18)) {
unk = GetFacingDirection(this, link) & (u8)0x1e;
}
else {
unk = this->animationState << 2;
unk = GetFacingDirection(this, link) & 0x1e;
} else {
unk = this->animationState * 4;
}
field_0x68.HALF.HI = this->field_0x68.HALF.HI;
if (unk != field_0x68.HALF.HI) {
if (unk != this->field_0x68.HALF.HI) {
s32 temp;
if (((unk - field_0x68.HALF.HI) & 0x1f) <= 0xf) {
field_0x68.HALF.HI--;
}
else {
field_0x68.HALF.HI++;
if (((unk - this->field_0x68.HALF.HI) & 0x1f) <= 0xf) {
this->field_0x68.HALF.HI--;
} else {
this->field_0x68.HALF.HI++;
}
temp = field_0x68.HALF.HI;
this->field_0x68.HALF.HI = temp & 0x1f;
this->field_0x68.HALF.HI &= 0x1f;
}
if (!(this->field_0x68.HALF.HI & 7)) {
this->animationState = sub_0806F5B0(this->field_0x68.HALF.HI);
UpdateSprite(this, (this->animationState >> 1) ^ 2);
InitializeAnimation(this, (this->animationState / 2) ^ 2);
}
}
sub_080042B8(this);
}*/
UpdateAnimationSingleFrame(this);
}
void sub_0806ACC4(Entity* this) {
u8 delay;
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08112674[this->entityType.form * 4]) == 0)
return;
this->action = 1;
delay = this->actionDelay;
this->field_0x6a.HALF.LO = delay;
this->animationState = delay * 2;
this->actionDelay = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
InitializeAnimation(this, (this->animationState / 2) + 8);
break;
case 1:
if (this->interactType == 2) {
this->action = 3;
this->interactType = 0;
sub_0806F118(this);
} else {
sub_0807DDAC(this, 0);
sub_0806AEA8(this);
if (this->entityType.parameter == 10 && this->interactType) {
this->action = 2;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8);
sub_0806AFE8(this, *(s32**)&this->cutsceneBeh);
}
if (this->entityType.form == 1) {
u8 idx = gPlayerEntity.animationState >> 1;
sub_08078850(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]);
}
}
break;
case 2:
if (gTextBox.doTextBox & 0x7f)
break;
this->action = 1;
InitializeAnimation(this, this->animationState / 2 + 4);
break;
case 3:
if (UpdateFuseInteraction(this))
this->action = 1;
break;
}
if (this->frameDuration != 0xff) {
GetNextFrame(this);
}
}
void sub_0806ADFC(Entity* this) {
sub_08078784(this, this->field_0x68.HALF.LO);
}
void TownMinish_Head(Entity* this) {
u32 frames;
if ((this->flags & 2) == 0) {
frames = this->field_0x68.HALF.HI / 2;
if ((this->frameSpriteSettings & 1)) {
SetExtraSpriteFrame(this, 0, frames + 0x1c);
} else {
SetExtraSpriteFrame(this, 0, 0xff);
}
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
} else {
frames = this->frames.all;
if (frames != 0xff) {
frames &= ~0x80;
}
if ((this->frameSpriteSettings & 1) == 0) {
frames = 0xff;
}
SetExtraSpriteFrame(this, 0, frames);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
}
void sub_0806AEA8(Entity* this) {
int old = this->field_0x82.HWORD;
this->field_0x82.HWORD &= ~0x20;
if (old & 0x20) {
sub_08003FC4(this, 0x4000);
}
sub_0807DDE4(this);
this->field_0x82.HWORD = old;
}
void sub_0806AED8(Entity* this) {
this->actionDelay = 0;
sub_0806AEE4(this);
}
void sub_0806AEE4(Entity* this) {
int index;
u8* idx3;
u8 tmp1, tmp2;
if (this->actionDelay) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x6a.HALF.LO;
this->animationState = state * 2;
index = state * 8;
}
idx3 = gUnk_081125F4 + (this->animationState / 2) * 0x20 + (index >> 1) * 2;
tmp1 = idx3[0];
tmp2 = idx3[1];
if (tmp2 & 0x80) {
this->animationState = sub_0806F5B0(index);
}
tmp2 &= 0x7f;
this->frames.all = tmp1;
this->frameIndex = tmp2;
this->frameSpriteSettings = 1;
this->animIndex = 0;
this->frameDuration = 0xff;
}
}
void sub_0806AF60(Entity* this, int* idx) {
InitializeAnimation(this, idx[1] + (this->animationState / 2));
}
void sub_0806AF70(Entity* this, u32 arg1) {
this->field_0x20 = 0x24000;
}
void sub_0806AF78(Entity* this, u32 arg1) {
sub_08003FC4(this, 0x1800);
if (0 <= this->height.WORD && this->field_0x20 < 1) {
this->height.WORD = 0;
sub_0806AF70(this, arg1);
}
}
void sub_0806AFA0(Entity* this) {
if (sub_0806ED78(this)) {
sub_0806F62C(this, -this->nonPlanarMovement, this->direction);
}
}
void sub_0806AFBC(Entity* this) {
int idx = gUnk_02002A40.unk8 - 2;
if (idx < 0)
idx = 0;
ShowNPCDialogue(this, gUnk_081126F0 + this->entityType.parameter * 8 + idx);
}
void sub_0806AFE8(Entity* this, s32* unk) {
unk[5] = 0;
gUnk_08112BF0[this->entityType.parameter](this, unk);
}
void sub_0806B004(Entity* this, int* unk) {
int idx = 0;
if (CheckGlobalFlag(0x29)) {
if (CheckLocalFlag(0x73)) {
if (GetInventoryValue(0x46) == 0) {
idx = 3;
if (CheckLocalFlag(0x78) == 0) {
idx = 2;
unk[5] = 1;
SetLocalFlag(0x78);
}
} else {
idx = 4;
}
} else {
idx = 1;
SetLocalFlag(0x6a);
}
}
TextboxNoOverlap(gUnk_08112C40[idx], this);
}
void sub_0806B064(Entity* this) {
int idx = 0;
if (CheckGlobalFlag(0x29)) {
idx = 1;
if (CheckLocalFlag(0x73)) {
idx = 2;
}
}
TextboxNoOverlap(gUnk_08112C4A[idx], this);
}
void sub_0806B098(Entity* this) {
u32 f;
int idx = 2;
if (GetInventoryValue(0x46) == 0) {
idx = 1;
if (CheckGlobalFlag(0x29)) {
f = CheckGlobalFlag(0x2a);
idx = (-f | f) >> 0x1f;
}
}
TextboxNoOverlap(gUnk_08112C50[(this->entityType.parameter - 7) * 3 + idx], this);
}
void sub_0806B0E0(Entity* this) {
int idx = 0;
if (sub_080002C0(0x38, 0xb8, 1) == 0x57 && sub_080002C0(0x48, 0xb8, 1) == 0x57 &&
sub_080002C0(0x38, 200, 1) == 0x57 && sub_080002C0(0x48, 200, 1) == 0x57) {
idx = 1;
}
TextboxNoOverlap(gUnk_08112C5C[idx], this);
}
void sub_0806B134(Entity* this) {
int idx;
if (GetInventoryValue(0x45)) {
idx = 2;
if (CheckLocalFlag(0x7b) == 0) {
idx = 1;
SetLocalFlag(0x7b);
}
} else {
idx = 0;
SetGlobalFlag(0x4a);
}
if (5 < gUnk_02002A40.unk8) {
idx = 3;
}
TextboxNoOverlap(gUnk_08112C60[idx], this);
}
void TownMinish_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08112674[this->entityType.form * 4])) {
this->action++;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
+21 -26
View File
@@ -5,6 +5,7 @@
#include "textbox.h"
#include "flags.h"
#include "structures.h"
#include "functions.h"
typedef struct {
u8 frame1;
@@ -21,8 +22,6 @@ typedef struct {
extern void (*const gUnk_0810B774[])(Entity*);
extern void (*const gUnk_0810B77C[])(Entity*);
extern void sub_08061CB4(Entity*, u32);
extern u32 sub_0806ED9C(Entity*, u32, u32);
extern void sub_0806ED78(Entity*);
extern u32 sub_0805ACC0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_0807DD64(Entity*);
@@ -36,7 +35,6 @@ extern void sub_08062048(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_08078778(Entity*);
extern u32 sub_0806F5B0(u32);
extern void sub_080AEF88(Entity*);
extern u32 Random(void);
extern void ResolveEntityOnTop(Entity*, Entity*);
extern void sub_08078850(Entity*, u32, u8, u32*);
@@ -50,7 +48,7 @@ extern u8 gUnk_0810B748[];
extern u32 gUnk_0810B740[];
extern u16 gUnk_0810B790[];
extern u16 gUnk_0810B7BA[];
extern u32 gUnk_0810B7C0[];
extern Dialog gUnk_0810B7C0[];
void Townsperson(Entity* this) {
if ((this->flags & 2) != 0) {
@@ -296,30 +294,27 @@ void sub_0806200C(Entity* this) {
TextboxNoOverlap(gUnk_0810B7BA[index], this);
}
void sub_08062048(Entity *this)
{
int iVar1;
if ((this->entityType).subtype == 6) {
iVar1 = gUnk_02002A40.unk8 - 2;
if (iVar1 < 0) {
iVar1 = 0;
void sub_08062048(Entity* this) {
int iVar1;
if ((this->entityType).subtype == 6) {
iVar1 = gUnk_02002A40.unk8 - 2;
if (iVar1 < 0) {
iVar1 = 0;
}
ShowNPCDialogue(this, gUnk_0810B7C0 + this->entityType.form * 0x8 + iVar1);
} else {
TextboxNoOverlap(0, this);
}
ShowNPCDialogue(this, gUnk_0810B7C0 + this->entityType.form * 0x10 + iVar1 * 2);
}
else {
TextboxNoOverlap(0, this);
}
}
void Townsperson_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form]) == 0) {
return;
void Townsperson_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form]) == 0) {
return;
}
this->action++;
this->spriteSettings.b.draw = TRUE;
}
this->action++;
this->spriteSettings.b.draw = TRUE;
}
sub_08061CB4(this, 6);
sub_08061CB4(this, 6);
}
+59 -66
View File
@@ -4,6 +4,7 @@
#include "textbox.h"
#include "flags.h"
#include "structures.h"
#include "functions.h"
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void sub_0807DD50(Entity*);
@@ -23,7 +24,7 @@ extern void (*const gUnk_08113A8C[])(Entity*, Entity*);
extern SpriteLoadData gUnk_08113A1C[];
extern u32 gUnk_08014A80;
extern u32 gUnk_08113ABC[];
extern Dialog gUnk_08113ABC[];
extern u16 gUnk_08113B0C[];
void WindTribespeople(Entity* this) {
@@ -74,73 +75,65 @@ void sub_0806C85C(Entity* this) {
}
}
void sub_0806C870(Entity *this)
{
u8 bVar1;
bVar1 = sub_0801E99C();
this->field_0x68.HALF.LO = bVar1;
sub_08078784(this, this->field_0x68.HALF.LO);
void sub_0806C870(Entity* this) {
u8 bVar1;
bVar1 = sub_0801E99C(this);
this->field_0x68.HALF.LO = bVar1;
sub_08078784(this, this->field_0x68.HALF.LO);
}
void WindTribespeople_Head(Entity *this)
{
u32 uVar1;
u32 uVar2;
u8 pbVar3;
pbVar3 = (this->frames.all & 0x3F);
if (this->entityType.form == 4) {
SetExtraSpriteFrame(this, 0, 9);
SetExtraSpriteFrame(this, 1, pbVar3);
SetExtraSpriteFrame(this, 2, this->frameIndex);
SetSpriteSubEntryOffsetData2(this, 2, 0);
SetSpriteSubEntryOffsetData1(this, 2, 1);
sub_0807000C(this);
}
else {
if (this->frames.b.f2 != 0) {
uVar2 = 1;
uVar1 = 0;
void WindTribespeople_Head(Entity* this) {
u32 uVar1;
u32 uVar2;
u8 pbVar3;
pbVar3 = (this->frames.all & 0x3F);
if (this->entityType.form == 4) {
SetExtraSpriteFrame(this, 0, 9);
SetExtraSpriteFrame(this, 1, pbVar3);
SetExtraSpriteFrame(this, 2, this->frameIndex);
SetSpriteSubEntryOffsetData2(this, 2, 0);
SetSpriteSubEntryOffsetData1(this, 2, 1);
sub_0807000C(this);
} else {
if (this->frames.b.f2 != 0) {
uVar2 = 1;
uVar1 = 0;
} else {
uVar2 = 0;
uVar1 = 1;
}
SetExtraSpriteFrame(this, uVar2, pbVar3);
SetExtraSpriteFrame(this, uVar1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, uVar1, uVar2);
sub_0807000C(this);
}
else {
uVar2 = 0;
uVar1 = 1;
}
// body and head entities?
void sub_0806C90C(Entity* param_1, Entity* param_2) {
*(u32*)&param_2->animationState = 0;
gUnk_08113A8C[param_1->entityType.parameter](param_1, param_2);
}
void sub_0806C928(Entity* this) {
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk8]);
}
void sub_0806C944(Entity* this) {
int iVar1;
int iVar2;
iVar1 = CheckGlobalFlag(WARP_EVENT_END);
if (iVar1 == 0) {
iVar2 = 0;
} else {
iVar1 = CheckLocalFlag(0x63);
iVar2 = 2;
if (iVar1 != 0) {
iVar2 = 1;
}
}
SetExtraSpriteFrame(this, uVar2, pbVar3);
SetExtraSpriteFrame(this, uVar1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, uVar1, uVar2);
sub_0807000C(this);
}
}
//body and head entities?
void sub_0806C90C(Entity *param_1,Entity *param_2)
{
*(u32 *)&param_2->animationState = 0;
gUnk_08113A8C[param_1->entityType.parameter](param_1, param_2);
}
void sub_0806C928(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk8 * 2]);
}
void sub_0806C944(Entity *this)
{
int iVar1;
int iVar2;
iVar1 = CheckGlobalFlag(WARP_EVENT_END);
if (iVar1 == 0) {
iVar2 = 0;
}
else {
iVar1 = CheckLocalFlag(0x63);
iVar2 = 2;
if (iVar1 != 0) {
iVar2 = 1;
}
}
TextboxNoOverlap(gUnk_08113B0C[iVar2], this);
TextboxNoOverlap(gUnk_08113B0C[iVar2], this);
}
+1 -1
View File
@@ -20,7 +20,7 @@ void sub_0808F658(Entity* this) {
this->direction = 8;
this->nonPlanarMovement = gUnk_08121EB0[(this->entityType).form];
this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60;
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.filler2[3] + 0x60;
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.width + 0x60;
this->animationState = 0;
this->x.HALF.HI += (Random() & 0xf) << 4;
this->actionDelay = 0;
-2
View File
@@ -1,11 +1,9 @@
#include "global.h"
#include "entity.h"
extern void CopyPosition();
extern void sub_08086A6C();
extern s32 sub_080044EC();
extern void sub_080AEF88();
extern void DeleteThisEntity();
extern u32 Random(void);
extern void (*gUnk_081206C4[99])(Entity*);
-1
View File
@@ -7,7 +7,6 @@ extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
void sub_08099ECC(Entity*);
extern void sub_0805E4E0(Entity*, u32);
extern void sub_0805B390(u32);
extern void CopyPosition(Entity*, Entity*);
extern void (*const gUnk_081237F8[])(Entity*);
-1
View File
@@ -5,7 +5,6 @@
extern BoundingBox gUnk_080FD168;
extern void SetTile(u32, u32, u32);
extern void CopyPosition(Entity*, Entity*);
void Object9E(Entity *this)
{
-2
View File
@@ -2,8 +2,6 @@
#include "entity.h"
extern void sub_080A0640(Entity*);
extern void PositionRelative(Entity*, Entity*, s32, s32);
extern void CopyPosition(Entity*, Entity*);
extern void (*const gUnk_081248C4[])(Entity*);
-2
View File
@@ -2,9 +2,7 @@
#include "entity.h"
extern u32 Random(void);
extern void CopyPosition(Entity*, Entity*);
extern void sub_0806F69C(Entity*);
extern void DeleteEntity(Entity*);
extern void (*const gUnk_08121060[])(Entity*);
extern void (*const gUnk_08121070[])(Entity*);
+1 -1
View File
@@ -2057,7 +2057,7 @@ extern EntityData gUnk_080DE4C8;
void sub_0804CBB0(void) {
if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < (gRoomControls.filler2[4] >> 1)) {
if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < (gRoomControls.height >> 1)) {
if (!CheckLocalFlag(0x17)) {
LoadRoomEntityList(&gUnk_080DE4C8);
}
+10 -10
View File
@@ -2,28 +2,28 @@
#include "entity.h"
extern void sub_0807C960();
extern u32 gUnk_0202CEB4;
extern u32 gUnk_02012654;
extern u16 gMetatilesBottom[];
extern u16 gMetatilesTop[];
extern u8 gUnk_08324AE4;
void sub_0807C960(void* dest, u32 offset)
{
void* temp;
void* src;
if (offset != -1) {
temp = &gUnk_08324AE4 + (offset & 0x7fffffff);
src = &gUnk_08324AE4 + (offset & 0x7fffffff);
if ((u32)dest >> 0x18 == 6) {
LZ77UnCompVram(temp, (void *)dest);
LZ77UnCompVram(src, (void *)dest);
}
else {
LZ77UnCompWram(temp, (void *)dest);
LZ77UnCompWram(src, (void *)dest);
}
}
}
void sub_0807C998(u32* a1) {
sub_0807C960(&gUnk_0202CEB4, a1[0]);
sub_0807C960(&gUnk_0202CEB4 - 0x800, a1[1]);
sub_0807C960(&gUnk_02012654, a1[2]);
sub_0807C960(&gUnk_02012654 - 0x800, a1[3]);
sub_0807C960(gMetatilesBottom, a1[0]);
sub_0807C960(gMetatilesBottom - 0x1000, a1[1]);
sub_0807C960(gMetatilesTop, a1[2]);
sub_0807C960(gMetatilesTop - 0x1000, a1[3]);
}