mirror of
https://github.com/zeldaret/tmc
synced 2026-07-11 15:28:41 -04:00
Merge branch 'master' of github.com:zeldaret/tmc
This commit is contained in:
+1
-18
@@ -1,26 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "area.h"
|
||||
#include "main.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
u8 interruptFlag;
|
||||
u8 field_0x1;
|
||||
u8 loadType;
|
||||
u8 funcIndex;
|
||||
u8 transition;
|
||||
u16 field_0x5;
|
||||
u8 muteAudio;
|
||||
u8 field_0x8;
|
||||
u8 countdown;
|
||||
u8 field_0xa;
|
||||
u8 field_0xb;
|
||||
u8 ticks;
|
||||
u8 field_0xe;
|
||||
u8 field_0xf;
|
||||
} Main;
|
||||
|
||||
typedef struct {
|
||||
u8 filler [18];
|
||||
u32 unk;
|
||||
@@ -32,7 +16,6 @@ extern void (*const gUnk_080D4120[])();
|
||||
extern void (*const gUnk_080D412C[])();
|
||||
|
||||
|
||||
extern Main gUnk_03001000;
|
||||
extern struct_02018EB0 gUnk_02018EB0;
|
||||
extern u8 gUnk_03000FD0;
|
||||
|
||||
|
||||
+23
-2
@@ -7,6 +7,9 @@
|
||||
extern void (*const gUnk_0811E478[])(u32);
|
||||
|
||||
extern s16 gUnk_02021EE0[6];
|
||||
extern char gUnk_0811E484[];
|
||||
extern char gUnk_0811E4AC[];
|
||||
extern char gUnk_0811E4A4[];
|
||||
|
||||
void sub_0807CD9C() {
|
||||
sub_080530C8();
|
||||
@@ -69,8 +72,6 @@ s32 sub_0807CE54(void) {
|
||||
return uVar1;
|
||||
}
|
||||
|
||||
extern char gUnk_0811E484[];
|
||||
|
||||
u32 sub_0807CE90(void)
|
||||
{
|
||||
struct_0807D1C4 *puVar1;
|
||||
@@ -123,3 +124,23 @@ u32 sub_0807CF30(void* arg0) {
|
||||
u32 sub_0807CF3C(void* arg0) {
|
||||
return sub_0807D008(5, arg0);
|
||||
}
|
||||
|
||||
void sub_0807CF48(u32 arg0)
|
||||
{
|
||||
struct_0807D1C4 *temp;
|
||||
|
||||
temp = sub_0807D1C4(arg0);
|
||||
sub_0807D184(temp->field_0x4, gUnk_0811E4AC);
|
||||
sub_0807D184(temp->field_0x2, gUnk_0811E4AC);
|
||||
}
|
||||
|
||||
void sub_0807CF68(u32 arg0)
|
||||
{
|
||||
struct_0807D1C4 *temp;
|
||||
char* str;
|
||||
|
||||
temp = sub_0807D1C4(arg0);
|
||||
str = gUnk_0811E4A4;
|
||||
sub_0807D184(temp->field_0x4, str);
|
||||
sub_0807D184(temp->field_0x2, str);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_080808D8(void) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
}
|
||||
|
||||
void sub_080808E4(void) {
|
||||
|
||||
if (sub_08052638(gScreenTransition.areaID)) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
} else {
|
||||
gScreenTransition.transitionType = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080904(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
|
||||
void sub_08080910(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
+26
-4
@@ -1,4 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
|
||||
extern void sub_0805E5A8();
|
||||
@@ -6,16 +9,35 @@ extern void sub_0805E5A8();
|
||||
extern RoomControls gRoomControls;
|
||||
extern u32 gUnk_0200B650;
|
||||
extern u32 gUnk_02025EB0;
|
||||
extern u8 gScreenTransition[10];
|
||||
|
||||
extern void DoExitTransition(Entity*);
|
||||
extern void DoExitTransition(ScreenTransitionData*);
|
||||
extern void sub_080809D4();
|
||||
|
||||
void sub_0808091C(Entity* param_1, u32 param_2)
|
||||
void sub_080808D8(void) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
}
|
||||
|
||||
void sub_080808E4(void) {
|
||||
|
||||
if (sub_08052638(gScreenTransition.areaID)) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
} else {
|
||||
gScreenTransition.transitionType = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080904(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
|
||||
void sub_08080910(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
|
||||
void sub_0808091C(ScreenTransitionData* param_1, u32 param_2)
|
||||
{
|
||||
DoExitTransition(param_1);
|
||||
gScreenTransition[9] = param_2;
|
||||
gScreenTransition.transitionType = param_2;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ extern u32 GetNextFunction(Entity*);
|
||||
extern void sub_0802AD54(Entity*);
|
||||
extern void sub_0802B048(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
extern void sub_0806F3E4(Entity*);
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CD0F0[])(Entity*);
|
||||
|
||||
+1
-7
@@ -1,12 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "trig.h"
|
||||
#include "random.h"
|
||||
#include "link.h"
|
||||
|
||||
// Lakitu
|
||||
extern void EnemyFunctionHandler(Entity *, void (*const funcs[])(Entity*));
|
||||
extern void SetChildOffset(Entity *, u32, u32, u32);
|
||||
|
||||
// sub_0803C758
|
||||
extern void sub_0803CAD0(Entity *);
|
||||
@@ -41,7 +41,6 @@ extern void sub_0803CB64(Entity *);
|
||||
extern void sub_0803CB34(Entity *);
|
||||
|
||||
// sub_0803CA0C
|
||||
extern u32 sub_08003FC4(Entity *, u32);
|
||||
extern void sub_0803CC08(Entity *this);
|
||||
|
||||
// sub_0803CA4C
|
||||
@@ -51,12 +50,7 @@ extern u32 sub_080041A0(Entity *, Entity *, u32, u32);
|
||||
// sub_0803CA84
|
||||
extern u32 GetFacingDirection(Entity *, Entity *);
|
||||
|
||||
// sub_0803CAD0
|
||||
extern u8 sub_080045D4(s16, s16, u16, u16);
|
||||
extern void sub_080AEFE0(Entity *);
|
||||
|
||||
// sub_0803CB64
|
||||
extern void PositionRelative(Entity *, Entity *, u32, u32);
|
||||
extern void sub_08004488(u32);
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
|
||||
extern void sub_0804AA30(Entity*, void (*const func[][])(Entity*));
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void sub_08045678(Entity*);
|
||||
extern void sub_080AEFE0(void);
|
||||
extern u32 sub_08003FC4(Entity*, u32);
|
||||
extern void sub_08045678(Entity*);
|
||||
|
||||
extern void (*const gUnk_080D1868[])(Entity*);
|
||||
@@ -25,7 +23,7 @@ void sub_080455BC(Entity *this)
|
||||
|
||||
void sub_080455D4(Entity *this)
|
||||
{
|
||||
sub_0804AA30(this, &gUnk_080D1868);
|
||||
sub_0804AA30(this, gUnk_080D1868);
|
||||
}
|
||||
|
||||
void sub_080455E4(Entity *this)
|
||||
@@ -53,7 +51,7 @@ void sub_08045618(Entity *this)
|
||||
|
||||
void sub_08045654(Entity *this)
|
||||
{
|
||||
sub_080AEFE0();
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
sub_08045678(this);
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "structures.h"
|
||||
#include "link.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CEB74[])(Entity*);
|
||||
extern void (*const gUnk_080CEB8C[])(Entity*);
|
||||
extern void (*const gUnk_080CEB98[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CEBA4[];
|
||||
|
||||
void Wisp(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CEB74);
|
||||
}
|
||||
|
||||
void sub_0803354C(Entity* this) {
|
||||
gUnk_080CEB8C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08033564(Entity* this) {
|
||||
u32 bits;
|
||||
Entity* ent;
|
||||
|
||||
bits = this->bitfield;
|
||||
if ((bits & 0x80) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((s32)bits & 0x3f) {
|
||||
case 0:
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
this->flags &= 0x7f;
|
||||
this->field_0x7c.HALF.LO = 0x27c;
|
||||
gLinkState.flags.all |= 0x4000;
|
||||
gUnk_02002A40.stats.filler2[4] = this->entityType.form + 1;
|
||||
gUnk_02002A40.stats.field_0x20 = 600;
|
||||
if (this->entityType.form == 0) {
|
||||
break;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
case 0xe:
|
||||
case 0x15:
|
||||
this->currentHealth = 0;
|
||||
break;
|
||||
case 0x14:
|
||||
this->flags &= 0x7f;
|
||||
this->hurtBlinkTime = 0;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
ent = CreateFx(this, 2, 0);
|
||||
if (ent != NULL) {
|
||||
this->attachedEntity = ent;
|
||||
this->actionDelay = 0xe;
|
||||
CopyPosition(this, ent);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803362C(Entity* this) {
|
||||
if (sub_0806F520() != 0) {
|
||||
gUnk_080CEB98[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033650(Entity* this) {
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void sub_08033658(Entity* this) {
|
||||
sub_0806F4E8();
|
||||
}
|
||||
|
||||
void sub_08033660(Entity* this) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033674(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->actionDelay = 0;
|
||||
this->action = 1;
|
||||
this->filler[0] = 1;
|
||||
this->field_0x80.HWORD = this->x.HALF.HI;
|
||||
this->field_0x82.HWORD = this->y.HALF.HI;
|
||||
sub_08033744(this);
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
}
|
||||
|
||||
void sub_080336A8(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08033744(this);
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_080336DC(Entity* this) {
|
||||
switch ((u16)-- this->field_0x7c.HALF.LO) {
|
||||
case 0x24:
|
||||
this->x.HALF.HI = this->field_0x80.HWORD;
|
||||
this->y.HALF.HI = this->field_0x82.HWORD;
|
||||
break;
|
||||
case 0x18:
|
||||
sub_080A29BC(this);
|
||||
break;
|
||||
case 0xc:
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
break;
|
||||
case 0x0:
|
||||
this->action = 1;
|
||||
this->flags |= 0x80;
|
||||
sub_08033744(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033744(Entity* this) {
|
||||
u32 temp;
|
||||
u32 rand = (u32)Random() % 256;
|
||||
|
||||
// 8 potential options
|
||||
this->actionDelay = gUnk_080CEBA4[(rand & 0x70) >> 4];
|
||||
|
||||
// 4 potential options
|
||||
temp = ((rand & 0xc) * 2);
|
||||
|
||||
// 75% chance to pass
|
||||
if ((sub_08049FA0(this) == 0) && ((rand % 4) != 0)) {
|
||||
temp = sub_08049EE4(this);
|
||||
|
||||
// 50% chance to pass
|
||||
if ((rand & 0x80) != 0) {
|
||||
temp += 0x4;
|
||||
temp &= 0x18;
|
||||
} else {
|
||||
temp += 0x1c;
|
||||
temp &= 0x18;
|
||||
}
|
||||
}
|
||||
this->direction = temp;
|
||||
}
|
||||
+9
-12
@@ -2,26 +2,23 @@
|
||||
#include "entity.h"
|
||||
#include "readKeyInput.h"
|
||||
|
||||
void StoreKeyInput(Input *pkeyInput, u32 ioKeyInput);
|
||||
static void StoreKeyInput(Input*, u32);
|
||||
|
||||
void ReadKeyInput(void)
|
||||
{
|
||||
u32 reg = ~*(u16*)0x04000130 & 0x3FF;
|
||||
Input* input = &gUnk_03000FF0;
|
||||
StoreKeyInput(input, reg);
|
||||
u32 keyInput = ~REG_KEYINPUT & KEYS_MASK;
|
||||
StoreKeyInput(&gUnk_03000FF0, keyInput);
|
||||
}
|
||||
|
||||
void StoreKeyInput(Input *input, u32 ioKeyInput)
|
||||
static void StoreKeyInput(Input *input, u32 keyInput)
|
||||
{
|
||||
u32 difference;
|
||||
u32 temp = input->heldKeys;
|
||||
|
||||
difference = ioKeyInput & ~temp;
|
||||
u32 heldKeys = input->heldKeys;
|
||||
u32 difference = keyInput & ~heldKeys;
|
||||
input->newKeys = difference;
|
||||
if (ioKeyInput == temp) {
|
||||
if (keyInput == heldKeys) {
|
||||
if (--input->unk7 == 0) {
|
||||
input->unk7 = 4;
|
||||
input->unk4 = ioKeyInput;
|
||||
input->unk4 = keyInput;
|
||||
}
|
||||
else {
|
||||
input->unk4 = 0;
|
||||
@@ -31,5 +28,5 @@ void StoreKeyInput(Input *input, u32 ioKeyInput)
|
||||
input->unk7 = 0x14;
|
||||
input->unk4 = difference;
|
||||
}
|
||||
input->heldKeys = ioKeyInput;
|
||||
input->heldKeys = keyInput;
|
||||
}
|
||||
@@ -18,17 +18,10 @@ typedef struct {
|
||||
|
||||
extern struct_03000FD0 gUnk_03000FD0;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[5];
|
||||
u8 field_0x5;
|
||||
} struct_02000010;
|
||||
|
||||
extern struct_02000010 gUnk_02000010;
|
||||
|
||||
u32 IntroSetTransition(u32 transition)
|
||||
{
|
||||
gUnk_02032EC0.transitionType = transition;
|
||||
gUnk_03001000.field_0x3 = 2;
|
||||
gUnk_03001000.funcIndex = 2;
|
||||
_DmaZero((u32 *)&gMenu, 48);
|
||||
DoFade(7, 8);
|
||||
}
|
||||
@@ -36,7 +29,7 @@ u32 IntroSetTransition(u32 transition)
|
||||
void sub_080AD380()
|
||||
{
|
||||
sub_080AD90C();
|
||||
switch (gUnk_03001000.field_0x3) {
|
||||
switch (gUnk_03001000.funcIndex) {
|
||||
case 0:
|
||||
sub_08056418();
|
||||
_DmaZero(&gUnk_02032EC0, 0x3b4);
|
||||
@@ -50,7 +43,7 @@ void sub_080AD380()
|
||||
return;
|
||||
}
|
||||
sub_0801DA90(1);
|
||||
gUnk_03001000.field_0x3 = 1;
|
||||
gUnk_03001000.funcIndex = 1;
|
||||
break;
|
||||
}
|
||||
sub_080AD918();
|
||||
@@ -112,7 +105,8 @@ void sub_080AD474(void)
|
||||
gMenu.transitionTimer = 0x1e;
|
||||
gMenu.field_0x4 = 7;
|
||||
EraseAllEntities();
|
||||
sub_080ADD30(sub_0801CFA8(0));
|
||||
sub_0801CFA8(0);
|
||||
sub_080ADD30();
|
||||
gUnk_02024490 = 1;
|
||||
sub_0801D7EC(2);
|
||||
if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
|
||||
|
||||
+102
-76
@@ -1,58 +1,22 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "random.h"
|
||||
#include "readKeyInput.h"
|
||||
|
||||
#if 0
|
||||
|
||||
typedef struct {
|
||||
u8 interruptFlag;
|
||||
u8 field_0x1;
|
||||
u8 loadType;
|
||||
u8 funcIndex;
|
||||
u8 transition;
|
||||
u16 field_0x5;
|
||||
u8 muteAudio;
|
||||
u8 field_0x8;
|
||||
u8 countdown;
|
||||
u8 field_0xa;
|
||||
u8 field_0xb;
|
||||
u16 ticks;
|
||||
u8 field_0xe;
|
||||
u8 field_0xf;
|
||||
} MainStruct;
|
||||
|
||||
extern void sub_08055F70(void);
|
||||
extern void sub_080A3204(void);
|
||||
extern void sub_0805616C(void);
|
||||
extern void sub_0807CE90(void);
|
||||
extern void sub_080560B8(void);
|
||||
extern void sub_08056208(void);
|
||||
extern void sub_0804FFE4(void);
|
||||
extern void sub_0804FF84(u32);
|
||||
extern void sub_08056418(void);
|
||||
extern void sub_080ADD30(void);
|
||||
extern void _DmaZero(void*, u32);
|
||||
extern void sub_08056010(u32);
|
||||
extern void ReadKeyInput();
|
||||
extern u32 sub_08055FF4();
|
||||
extern void sub_080560A8(void);
|
||||
extern void sub_08056458(void);
|
||||
extern void sub_08050154(void);
|
||||
extern void sub_080A3480(void);
|
||||
extern void sub_08016E78(void);
|
||||
extern void sub_08056260(void);
|
||||
|
||||
extern u8 gUnk_02000014;
|
||||
extern u32 gUnk_020176A0;
|
||||
extern u32 gRand;
|
||||
extern MainStruct gUnk_03001000;
|
||||
extern void (*gUnk_08100CBC[])();
|
||||
extern const void (*gUnk_08100CBC[])();
|
||||
extern void VBlankInterruptWait(void);
|
||||
extern void DisableInterruptsAndDMA(void);
|
||||
extern void sub_0801D66C(void*, u8*, int);
|
||||
extern void sub_08016B34(void);
|
||||
|
||||
static void sub_08055F70(void);
|
||||
static bool32 SoftResetKeysPressed(void);
|
||||
|
||||
void MainLoop(void) {
|
||||
bool32 codeInputted;
|
||||
u8 cVar1;
|
||||
u32 uVar2;
|
||||
MainStruct *s;
|
||||
int var0;
|
||||
|
||||
sub_08055F70();
|
||||
sub_080A3204();
|
||||
@@ -60,49 +24,111 @@ void MainLoop(void) {
|
||||
sub_0807CE90();
|
||||
sub_080560B8();
|
||||
sub_08056208();
|
||||
gUnk_02000014 = 193;
|
||||
gUnk_02000010.field_0x4 = 193;
|
||||
sub_0804FFE4();
|
||||
DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U);
|
||||
sub_0804FF84(1);
|
||||
sub_08056418();
|
||||
sub_080ADD30();
|
||||
gRand = 0x1234567;
|
||||
s = &gUnk_03001000;
|
||||
_DmaZero(s, 16);
|
||||
sub_08056010(0);
|
||||
_DmaZero(&gUnk_03001000, 16);
|
||||
InitScreen(SCREEN_INTRO);
|
||||
while (1) {
|
||||
ReadKeyInput();
|
||||
codeInputted = sub_08055FF4();
|
||||
if (codeInputted) {
|
||||
sub_080560A8();
|
||||
if (SoftResetKeysPressed()) {
|
||||
DoSoftReset();
|
||||
}
|
||||
if ((s->field_0x1 != 0) || (s->field_0x1 == 1)) {
|
||||
sub_08056260();
|
||||
} else if (s->field_0x8 != 0) {
|
||||
while (--s->field_0x8) {
|
||||
VBlankInterruptWait();
|
||||
|
||||
switch (gUnk_03001000.field_0x1) {
|
||||
case 1:
|
||||
sub_08056260();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if (gUnk_03001000.countdown != 0) {
|
||||
do {
|
||||
VBlankIntrWait();
|
||||
} while (--gUnk_03001000.countdown);
|
||||
}
|
||||
}
|
||||
if (s->countdown != 0) {
|
||||
s->countdown--;
|
||||
uVar2 = s->field_0xa;
|
||||
while (uVar2 > 0) {
|
||||
VBlankIntrWait();
|
||||
uVar2--;
|
||||
|
||||
if (gUnk_03001000.field_0x9 != 0) {
|
||||
gUnk_03001000.field_0x9--;
|
||||
var0 = gUnk_03001000.field_0xa;
|
||||
while (var0-- > 0) {
|
||||
VBlankIntrWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
s->ticks++;
|
||||
gUnk_08100CBC[s->loadType]();
|
||||
sub_08056458();
|
||||
sub_08050154();
|
||||
sub_080A3480();
|
||||
|
||||
gUnk_03001000.ticks++;
|
||||
gUnk_08100CBC[gUnk_03001000.screen]();
|
||||
sub_08056458();
|
||||
sub_08050154();
|
||||
sub_080A3480();
|
||||
break;
|
||||
}
|
||||
|
||||
sub_08016E78();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
// Interrupt handlers that are loaded into RAM.
|
||||
extern u8 sub_080B197C[];
|
||||
extern u8 gUnk_030056F0[];
|
||||
extern u8 gUnk_02038560[];
|
||||
extern u8 gUnk_080B2CD8[];
|
||||
extern u8 gUnk_080B2CD8_2[];
|
||||
extern u8 gUnk_080B2CD8_3[];
|
||||
extern u8 gUnk_02000030[];
|
||||
|
||||
NAKED
|
||||
void MainLoop(void) {
|
||||
asm(".include \"asm/non_matching/mainLoop.inc\"");
|
||||
static void sub_08055F70(void) {
|
||||
u32 size;
|
||||
|
||||
DisableInterruptsAndDMA();
|
||||
RegisterRamReset(RESET_ALL & ~RESET_EWRAM);
|
||||
*(vu16 *)BG_PLTT = 0x7FFF;
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
|
||||
size = 0x3FFD0;
|
||||
_DmaZero(gUnk_02000030, size);
|
||||
size = (u32)gUnk_080B2CD8 - (u32)sub_080B197C;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(sub_080B197C, gUnk_030056F0, size);
|
||||
}
|
||||
|
||||
size = (u32)gUnk_080B2CD8_2 - (u32)gUnk_080B2CD8_3;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(gUnk_080B2CD8_3, gUnk_02038560, size);
|
||||
}
|
||||
|
||||
sub_0801DA90(0);
|
||||
sub_08016B34();
|
||||
}
|
||||
|
||||
#define SOFT_RESET_KEYS (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON)
|
||||
|
||||
static bool32 SoftResetKeysPressed(void) {
|
||||
return (gUnk_03000FF0.heldKeys & SOFT_RESET_KEYS) == SOFT_RESET_KEYS;
|
||||
}
|
||||
|
||||
void InitScreen(u32 screen) {
|
||||
gUnk_03001000.screen = screen;
|
||||
gUnk_03001000.funcIndex = 0;
|
||||
gUnk_03001000.transition = 0;
|
||||
}
|
||||
|
||||
void DisableInterruptsAndDMA(void) {
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_DISPSTAT = 0;
|
||||
REG_IF = 0;
|
||||
REG_IME = 0;
|
||||
|
||||
DmaStop(0);
|
||||
DmaStop(1);
|
||||
DmaStop(2);
|
||||
DmaStop(3);
|
||||
}
|
||||
|
||||
void DoSoftReset(void) {
|
||||
DisableInterruptsAndDMA();
|
||||
SoftReset(RESET_ALL & ~(RESET_EWRAM | RESET_SIO_REGS));
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "textbox.h"
|
||||
#include "link.h"
|
||||
@@ -28,7 +29,6 @@ extern void sub_080606D8(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern void sub_080788E0(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_08003FC4(Entity*, u32);
|
||||
extern void sub_080606C0(Entity*);
|
||||
extern void sub_0800451C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
|
||||
+1
-2
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
@@ -16,10 +17,8 @@ void DeleteThisEntity(void);
|
||||
extern Entity* GetEntityByType(u32, u32);
|
||||
extern void sub_080686C4(Entity*, Entity*);
|
||||
extern void sub_0806F62C(Entity*, u32, u32);
|
||||
extern u32 sub_08003FC4(Entity*, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern void SetTileType(u32, u32, u32);
|
||||
extern void sub_0807BA8C(u16, u32);
|
||||
|
||||
extern Entity gLinkEntity;
|
||||
extern RoomControls gRoomControls;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08068318(Entity*);
|
||||
extern void sub_0806854C(Entity*, u32);
|
||||
|
||||
void ZeldaFollower(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->animationState = 4;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0805E3A0(this, 2);
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
sub_0806854C(this, 0);
|
||||
}
|
||||
if ((s8)this->field_0x68.HALF.LO != 0) {
|
||||
sub_08068318(this);
|
||||
} else {
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
}
|
||||
}
|
||||
+155
-12
@@ -1,19 +1,22 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "position.h"
|
||||
#include "random.h"
|
||||
#include "structures.h"
|
||||
|
||||
static void sub_0808F2B0(Entity*);
|
||||
static void sub_0808F14C(Entity*);
|
||||
static void sub_0808F244(Entity*);
|
||||
|
||||
extern u32 Random(void);
|
||||
extern void sub_0808F2B0(Entity*);
|
||||
extern u32 sub_08003FC4(Entity*, u32);
|
||||
void sub_0808F14C(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0806FCF4(Entity*, u32, u32, u32);
|
||||
extern void sub_0808F244(Entity*);
|
||||
extern void sub_0805EC9C(Entity*, u32, u32, u32);
|
||||
extern void sub_0808F5EC(Entity*);
|
||||
extern bool32 sub_0806F3E4(Entity *);
|
||||
|
||||
extern void (*const gUnk_08121E5C[])(Entity*);
|
||||
extern void (*const gUnk_08121E88[])(Entity*);
|
||||
extern void (*const gUnk_08121E98[])(Entity*);
|
||||
|
||||
extern const u16 gUnk_08121EA0[];
|
||||
|
||||
void Object49(Entity* this) {
|
||||
gUnk_08121E5C[this->entityType.form](this);
|
||||
@@ -52,7 +55,7 @@ void sub_0808F0D0(Entity* this) {
|
||||
sub_0808F14C(this);
|
||||
}
|
||||
|
||||
void sub_0808F14C(Entity* this) {
|
||||
static void sub_0808F14C(Entity* this) {
|
||||
sub_0808F2B0(this);
|
||||
if (sub_08003FC4(this, 0x2000) == 0) {
|
||||
this->action++;
|
||||
@@ -103,7 +106,7 @@ void sub_0808F1F8(Entity *this)
|
||||
sub_0808F244(this);
|
||||
}
|
||||
|
||||
void sub_0808F244(Entity *this)
|
||||
static void sub_0808F244(Entity *this)
|
||||
{
|
||||
|
||||
this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw;
|
||||
@@ -119,7 +122,7 @@ void sub_0808F244(Entity *this)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F2B0(Entity *this)
|
||||
static void sub_0808F2B0(Entity *this)
|
||||
{
|
||||
sub_0805EC9C(this, *(u32 *)&this->field_0x74, *(u32 *)&this->field_0x78, this->field_0x70.WORD);
|
||||
}
|
||||
@@ -152,4 +155,144 @@ void sub_0808F2C0(Entity *this)
|
||||
if (this->action == 0xff) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F370(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (this->parent->previousActionFlag == 1) {
|
||||
this->action = 1;
|
||||
this->field_0x70.WORD = 0;
|
||||
sub_0808F5EC(this);
|
||||
}
|
||||
} else {
|
||||
u8 flag = this->parent->previousActionFlag - 1;
|
||||
if (flag < 5) {
|
||||
if (this->field_0x70.WORD == 0) {
|
||||
if (--(*(u32 *)&this->field_0x74) == -1) {
|
||||
this->field_0x70.WORD = gUnk_08121EA0[Random() & 1];
|
||||
}
|
||||
} else {
|
||||
if (--this->field_0x70.WORD == 0) {
|
||||
sub_0808F5EC(this);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this->action = 0;
|
||||
*(u32 *)&this->field_0x74 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F3DC(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->action = 1;
|
||||
this->actionDelay = 120;
|
||||
InitializeAnimation(this, this->entityType.form + 1);
|
||||
// TODO: This block of code might supposed to be a switch statement.
|
||||
if (this->entityType.form != 8) {
|
||||
if (this->entityType.form == 7) {
|
||||
sub_0806FAD8(this->attachedEntity, this);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this->damageType = this->attachedEntity->damageType;
|
||||
this->attachedEntity->damageType = 0x7E;
|
||||
}
|
||||
ResolveEntityOnTop(this->attachedEntity, this);
|
||||
} else {
|
||||
if (*(u32 *)&this->parent->field_0x74 == 0) {
|
||||
if (this->entityType.form == 8) {
|
||||
this->attachedEntity->damageType = this->damageType;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (this->entityType.form == 5 && this->frames.b.f0) {
|
||||
Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 8, 0);
|
||||
if (entity) {
|
||||
entity->parent = this->parent;
|
||||
entity->attachedEntity = this->parent->parent;
|
||||
}
|
||||
}
|
||||
|
||||
GetNextFrame(this);
|
||||
CopyPositionAndSpriteOffset(this->attachedEntity, this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F498(Entity* this) {
|
||||
u32 var0;
|
||||
|
||||
if (this->action != 0) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
if (gScreenTransition.frameCount % 16 == 0) {
|
||||
PlaySFX(0xEF);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0xFF) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if (gLinkState.field_0x1c != 1) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->actionDelay = 64;
|
||||
var0 = this->entityType.parameter != 0 ? 44 : 43;
|
||||
this->x.HALF.HI -= this->parent->boundingBox->field_0x6;
|
||||
this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x6 * 2);
|
||||
this->y.HALF.HI -= this->parent->boundingBox->field_0x7;
|
||||
this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x7 * 2);
|
||||
sub_0801D2B4(this, var0);
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F554(Entity* this) {
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->spriteOffsetY -= 24;
|
||||
if ((s8)this->parent->spriteOffsetX != 0) {
|
||||
this->spriteOffsetX += (s8)this->parent->spriteOffsetX / 2;
|
||||
}
|
||||
|
||||
if (this->action != 0) {
|
||||
if (*(u32 *)&this->cutsceneBeh) {
|
||||
if (--(*(u32 *)&this->cutsceneBeh) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
this->spritePriority.b0 = 0;
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808F5EC(Entity* this) {
|
||||
Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 5, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->attachedEntity, 0x49, 6, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
entity = CreateObjectWithParent(this->attachedEntity, 0x49, 7, 0);
|
||||
if (entity) {
|
||||
entity->parent = this;
|
||||
entity->attachedEntity = this->attachedEntity;
|
||||
}
|
||||
|
||||
*(u32 *)&this->field_0x74 = 600;
|
||||
}
|
||||
|
||||
+1
-1
@@ -665,7 +665,7 @@ void sub_0804BC70(void) {
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 gUnk_0813AB80;
|
||||
extern ScreenTransitionData gUnk_0813AB80;
|
||||
|
||||
void sub_0804BCDC() {
|
||||
sub_0808091C(&gUnk_0813AB80, 4);
|
||||
|
||||
+18
-1
@@ -1,12 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern void sub_0807C960();
|
||||
extern u32 gUnk_0202CEB4;
|
||||
extern u32 gUnk_02012654;
|
||||
extern u8 gUnk_08324AE4;
|
||||
|
||||
void sub_0807C960(void* dest, u32 offset)
|
||||
{
|
||||
void* temp;
|
||||
|
||||
if (offset != -1) {
|
||||
temp = &gUnk_08324AE4 + (offset & 0x7fffffff);
|
||||
if ((u32)dest >> 0x18 == 6) {
|
||||
LZ77UnCompVram(temp, (void *)dest);
|
||||
}
|
||||
else {
|
||||
LZ77UnCompWram(temp, (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]);
|
||||
}
|
||||
}
|
||||
+4
-7
@@ -1,13 +1,10 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
|
||||
extern void sub_08056010(u32);
|
||||
extern u8 gUnk_03000FD0;
|
||||
|
||||
void sub_080AD834(void)
|
||||
|
||||
{
|
||||
if (gUnk_03000FD0 == '\0') {
|
||||
sub_08056010(1);
|
||||
void sub_080AD834(void) {
|
||||
if (gUnk_03000FD0 == 0) {
|
||||
InitScreen(SCREEN_CHOOSE_FILE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user