mirror of
https://github.com/zeldaret/tmc
synced 2026-08-20 06:06:54 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
+192
-1
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "player.h"
|
||||
#include "readKeyInput.h"
|
||||
#include "screen.h"
|
||||
|
||||
@@ -38,7 +39,9 @@ typedef struct {
|
||||
extern struct_020227E8 gUnk_020227E8;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x800];
|
||||
u8 filler0[0x29C];
|
||||
u16 unk29C;
|
||||
u8 filler29E[0x562];
|
||||
} struct_02034CB0;
|
||||
|
||||
extern struct_02034CB0 gUnk_02034CB0;
|
||||
@@ -46,6 +49,7 @@ extern struct_02034CB0 gUnk_02021F30;
|
||||
extern SaveFile gSaveFiles[];
|
||||
extern u32 gUsedPalettes;
|
||||
extern u8 gUnk_02000D00[];
|
||||
extern u16 gUnk_03001010[5];
|
||||
|
||||
static void sub_08050624(u32);
|
||||
static void sub_0805066C(void);
|
||||
@@ -374,3 +378,190 @@ void sub_08050910(void) {
|
||||
gChooseFileState.subState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050940(void) {
|
||||
int saveFileId;
|
||||
u32 newKeys;
|
||||
int var1;
|
||||
u32 var2;
|
||||
|
||||
if (gUnk_02019EE0.unk0) {
|
||||
return;
|
||||
}
|
||||
|
||||
saveFileId = gUnk_02019EE0.unk6;
|
||||
newKeys = gUnk_03000FF0.newKeys;
|
||||
if ((gUnk_03000FF0.heldKeys & L_BUTTON) && gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
newKeys &= ~(DPAD_UP | DPAD_DOWN);
|
||||
}
|
||||
|
||||
var1 = ((struct_02000000 *)0x2000000)->gameLanguage > 1 ? 4 : 3;
|
||||
var2 = gUnk_02032EC0.transitionType;
|
||||
switch (newKeys) {
|
||||
case DPAD_UP:
|
||||
if (saveFileId > 0) {
|
||||
saveFileId--;
|
||||
}
|
||||
break;
|
||||
case DPAD_DOWN:
|
||||
if (var1 - 1 > saveFileId) {
|
||||
saveFileId++;
|
||||
}
|
||||
break;
|
||||
case R_BUTTON:
|
||||
if (gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
var2 = 3;
|
||||
}
|
||||
break;
|
||||
case A_BUTTON:
|
||||
case START_BUTTON:
|
||||
sub_0805041C(saveFileId);
|
||||
if (saveFileId == 3) {
|
||||
var2 = 2;
|
||||
} else {
|
||||
switch (gUnk_02019EE0.unk8[saveFileId]) {
|
||||
case 0:
|
||||
var2 = 1;
|
||||
break;
|
||||
case 1:
|
||||
var2 = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gUnk_02032EC0.transitionType != var2) {
|
||||
sub_080503BC(var2);
|
||||
PlaySFX(0x6A);
|
||||
}
|
||||
|
||||
saveFileId = (saveFileId + var1) % var1;
|
||||
if (gUnk_02019EE0.unk6 != saveFileId) {
|
||||
gUnk_02019EE0.unk6 = saveFileId;
|
||||
sub_08050AFC(saveFileId);
|
||||
PlaySFX(0x69);
|
||||
}
|
||||
|
||||
if (gUnk_02019EE0.unk8[gUnk_02019EE0.unk6] == 1) {
|
||||
sub_08050810();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050A64(u32 saveFileId) {
|
||||
if (gUnk_02019EE0.unk8[saveFileId] != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
gUnk_03001010[2] = 0;
|
||||
gUnk_03001010[3] = 0;
|
||||
gUnk_03001010[4] = 0x400;
|
||||
|
||||
// Draw the save file's obtained elements.
|
||||
if (GetInventoryValue(0x40)) {
|
||||
gUnk_03001010[0] = 0xA2;
|
||||
gUnk_03001010[1] = 0x36;
|
||||
sub_080ADA14(0x145, 0x24);
|
||||
}
|
||||
if (GetInventoryValue(0x41)) {
|
||||
gUnk_03001010[0] = 0x96;
|
||||
gUnk_03001010[1] = 0x3D;
|
||||
sub_080ADA14(0x145, 0x22);
|
||||
}
|
||||
if (GetInventoryValue(0x42)) {
|
||||
gUnk_03001010[0] = 0xAE;
|
||||
gUnk_03001010[1] = 0x3D;
|
||||
sub_080ADA14(0x145, 0x23);
|
||||
}
|
||||
if (GetInventoryValue(0x43)) {
|
||||
gUnk_03001010[0] = 0xA2;
|
||||
gUnk_03001010[1] = 0x44;
|
||||
sub_080ADA14(0x145, 0x21);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050B3C(u16*);
|
||||
|
||||
void sub_08050AFC(u32 saveFileId) {
|
||||
sub_0805041C(saveFileId);
|
||||
_DmaZero(&gUnk_02021F30, sizeof(gUnk_02021F30));
|
||||
if (gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
sub_08050B3C(&gUnk_02021F30.unk29C);
|
||||
}
|
||||
gScreen.bg.bg2yOffset = 1;
|
||||
}
|
||||
|
||||
// typedef struct {
|
||||
// u16* unk0;
|
||||
// u32 unk4;
|
||||
// } unk_08050B3C;
|
||||
|
||||
// extern const u16 gUnk_080FC914[];
|
||||
|
||||
// void sub_08050B3C(u16* arg0) {
|
||||
// unk_08050B3C sp;
|
||||
// int var0;
|
||||
// int var1;
|
||||
// int var2;
|
||||
// int var3;
|
||||
// int var4;
|
||||
// int var5;
|
||||
// int var6;
|
||||
// int var7;
|
||||
// u16* var8;
|
||||
|
||||
// sp.unk0 = arg0;
|
||||
// var0 = gUnk_02002A40.stats.health * 2;
|
||||
// if (var0 == 0) {
|
||||
// var0 = 1;
|
||||
// }
|
||||
|
||||
// var1 = gUnk_02002A40.stats.maxHealth * 2;
|
||||
// if (var1 == 0) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (var0 > var1) {
|
||||
// var0 = var1;
|
||||
// }
|
||||
|
||||
// sp.unk4 = var0 & 0x3;
|
||||
// var2 = var0 >> 2;
|
||||
// var5 = var2;
|
||||
// if (var2 > 10) {
|
||||
// var5 = 10;
|
||||
// }
|
||||
|
||||
// var6 = var2;
|
||||
// var6 -= 10;
|
||||
// var7 = var6;
|
||||
// if (var6 < 0) {
|
||||
// var7 = 0;
|
||||
// }
|
||||
|
||||
// var1 = var1 >> 2;
|
||||
// var4 = var1;
|
||||
// if (var1 > 10) {
|
||||
// var1 = 10;
|
||||
// }
|
||||
|
||||
// var4 -= 10;
|
||||
// sp.unk0[0] = 0xF24C;
|
||||
// DmaCopy16(3, &gUnk_080FC914[10 - var5], &sp.unk0[1], var1 * 2);
|
||||
// if (var4 > 0) {
|
||||
// sp.unk0[0x20] = 0xF24C;
|
||||
// DmaCopy16(3, &gUnk_080FC914[10 - var7], &sp.unk0[1], var4 * 2);
|
||||
// }
|
||||
|
||||
// if (!sp.unk4) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var8 = sp.unk0;
|
||||
// if (var2 >= 10) {
|
||||
// var2 = var6;
|
||||
// var8 += 0x20;
|
||||
// }
|
||||
|
||||
// var8[var2 + 1] = sp.unk4 - 0xDB3;
|
||||
// }
|
||||
|
||||
+10
-11
@@ -545,25 +545,24 @@ u32 sub_080322A4(Entity* this) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
void sub_080322E8(Entity* this) {
|
||||
u8 tmp;
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
if (--this->field_0x78.HALF.LO == 0) {
|
||||
this->spriteSettings.b.flipX = this->spriteOrientation.flipX;
|
||||
u32 flipX = this->spriteSettings.b.flipX;
|
||||
this->spriteSettings.b.flipX = flipX ^ 1;
|
||||
}
|
||||
} else {
|
||||
if ((this->direction & 0xf) &&
|
||||
((this->direction >> 4 ^ 1) != -((int)((u32)this->spriteSettings.raw << 0x19) >> 0x1f))) {
|
||||
this->field_0x78.HALF.LO = 6;
|
||||
tmp = this->direction;
|
||||
if (tmp & 0xF) {
|
||||
tmp >>= 4;
|
||||
tmp ^= 1;
|
||||
if (tmp != this->spriteSettings.b.flipX) {
|
||||
this->field_0x78.HALF.LO = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_080322E8(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_080322E8.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08032338(Entity *this) {
|
||||
if ((((Entity*)this->field_0x7c.WORD)->actionDelay += 15) != 80)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_08121EA4[])(Entity*);
|
||||
extern const u8 gUnk_08121EB0[];
|
||||
extern const u8 gUnk_08121EB3[];
|
||||
|
||||
void BackgroundCloud(Entity* this) {
|
||||
gUnk_08121EA4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808F658(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = this->entityType.form;
|
||||
this->frameIndex = this->entityType.form;
|
||||
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->animationState = 0;
|
||||
this->x.HALF.HI += (Random() & 0xf) << 4;
|
||||
this->actionDelay = 0;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
|
||||
void sub_0808F6E0(Entity* this) {
|
||||
sub_0806F69C(this);
|
||||
|
||||
if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD ||
|
||||
(s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
|
||||
this->action = 2;
|
||||
}
|
||||
|
||||
void sub_0808F70C(Entity* this) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
this->previousActionFlag = 1;
|
||||
this->actionDelay = ((Random() & 7) << 3) + 31;
|
||||
|
||||
if ((this->direction & 0x10)) {
|
||||
this->x.HALF.HI = this->field_0x7a.HWORD;
|
||||
} else {
|
||||
this->x.HALF.HI = this->field_0x78.HWORD;
|
||||
}
|
||||
|
||||
if (this->entityType.form == 2)
|
||||
this->y.HALF.HI = gUnk_08121EB3[this->entityType.parameter * 2 + (Random() & 1)];
|
||||
}
|
||||
|
||||
if (this->previousActionFlag == 1) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0800449C(Entity*, u32);
|
||||
extern u32 sub_0806FC80(Entity*, Entity*, s32);
|
||||
extern void sub_0809CDF0(Entity*);
|
||||
|
||||
extern void (*const gUnk_08123E20[])(Entity*);
|
||||
|
||||
void BakerOven(Entity* this) {
|
||||
gUnk_08123E20[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0809CC74(Entity* this) {
|
||||
u32 i;
|
||||
Entity* ent;
|
||||
|
||||
this->action = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
|
||||
if (this->entityType.form == 0) {
|
||||
this->spritePriority.b0 = 5;
|
||||
/* Create steam clouds */
|
||||
for (i = 0; i < 3; i++) {
|
||||
ent = CreateObject(0x92, 1, i);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000);
|
||||
}
|
||||
}
|
||||
sub_0809CDF0(this);
|
||||
} else {
|
||||
if (this->entityType.parameter & 1) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->actionDelay = 20;
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->actionDelay = (this->entityType.parameter & 2) ? 20 : 18;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CD0C(Entity* this) {
|
||||
u8* frames;
|
||||
|
||||
if (this->entityType.form) {
|
||||
GetNextFrame(this);
|
||||
frames = &this->frames.all;
|
||||
if (*frames & 1) {
|
||||
*frames &= 0xfe;
|
||||
this->y.HALF.HI++;
|
||||
}
|
||||
|
||||
if ((*frames & 0x80) && this->frameDuration == 1) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
|
||||
/* Damage minish link if he touches a steam cloud */
|
||||
if (this->field_0xf == 0 && gPlayerEntity.hurtBlinkTime == 0 && this->frameIndex &&
|
||||
sub_0806FC80(this, &gPlayerEntity, 4)) {
|
||||
this->field_0xf++;
|
||||
ModHealth(-2);
|
||||
sub_0800449C(&gPlayerEntity, 0x7a);
|
||||
gPlayerEntity.hurtBlinkTime = 16;
|
||||
gPlayerEntity.field_0x3e = 16;
|
||||
gPlayerEntity.field_0x42 = 12;
|
||||
gPlayerEntity.field_0x46 = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CDB4(Entity* this) {
|
||||
/* Reset cloud position and start animation. */
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 30;
|
||||
this->field_0xf = 0;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI - 0xe;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0809CDF0(Entity* this) {
|
||||
u32 y;
|
||||
|
||||
this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3f) |
|
||||
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4 & 0x3f) << 6);
|
||||
|
||||
y = this->field_0x80.HWORD;
|
||||
SetTile(0x402e, y - 0x01, this->collisionLayer);
|
||||
SetTile(0x4022, y - 0x00, this->collisionLayer);
|
||||
SetTile(0x4022, y + 0x01, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x41, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x40, this->collisionLayer);
|
||||
SetTile(0x4024, y - 0x3f, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x81, this->collisionLayer);
|
||||
SetTile(0x4026, y - 0x80, this->collisionLayer);
|
||||
}
|
||||
Reference in New Issue
Block a user