Decompile the rest of picolyteBottle

This commit is contained in:
Tal Hayon 2022-02-05 18:36:34 +02:00
parent 67d369c53b
commit dab4810fbf
7 changed files with 148 additions and 291 deletions

View File

@ -1,34 +0,0 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
movs r1, #0
bl sub_0807DD94
ldrb r0, [r4, #0xe]
cmp r0, #0xff
beq _0806DFB0
adds r0, r4, #0
adds r0, #0x44
ldrb r0, [r0]
cmp r0, #0
beq _0806DF96
ldr r1, [r4, #0x70]
ldrb r0, [r1, #0xe]
adds r0, #1
strb r0, [r1, #0xe]
_0806DF96:
ldr r1, [r4, #0x68]
ldrb r0, [r1, #0xe]
adds r0, #1
strb r0, [r1, #0xe]
ldr r1, [r4, #0x6c]
ldrb r0, [r1, #0xe]
adds r0, #1
strb r0, [r1, #0xe]
movs r0, #0xff
strb r0, [r4, #0xe]
movs r0, #0
bl SetRoomFlag
_0806DFB0:
pop {r4, pc}
.align 2, 0
.syntax divided

View File

@ -1,95 +0,0 @@
.syntax unified
push {r4, r5, r6, r7, lr}
adds r5, r0, #0
bl Random
movs r1, #0x70
ands r1, r0
lsrs r4, r1, #4
movs r0, #0xff
strb r0, [r5, #0xb]
movs r0, #1
rsbs r0, r0, #0
adds r7, r0, #0
strb r0, [r5, #0xe]
movs r0, #0x93
bl CheckLocalFlag
adds r1, r0, #0
cmp r1, #0
bne _0806E088
adds r0, r5, #0
adds r0, #0x44
strb r1, [r0]
lsls r1, r4, #1
ldr r0, _0806E084 @ =gUnk_081142CC
adds r6, r1, r0
ldr r1, [r5, #0x68]
ldrb r0, [r6]
strb r0, [r1, #0xf]
ldr r1, [r5, #0x68]
movs r4, #0x90
lsls r4, r4, #0xf
adds r0, r5, #0
adds r2, r4, #0
adds r3, r4, #0
bl PositionRelative
ldr r1, [r5, #0x6c]
ldrb r0, [r6, #1]
strb r0, [r1, #0xf]
ldr r1, [r5, #0x6c]
movs r2, #0xd0
lsls r2, r2, #0xf
adds r0, r5, #0
adds r3, r4, #0
bl PositionRelative
ldr r1, [r5, #0x70]
ldrb r0, [r1, #0xf]
orrs r0, r7
strb r0, [r1, #0xf]
ldr r1, [r5, #0x70]
adds r0, r5, #0
bl CopyPosition
b _0806E0D6
.align 2, 0
_0806E084: .4byte gUnk_081142CC
_0806E088:
adds r1, r5, #0
adds r1, #0x44
movs r0, #1
strb r0, [r1]
lsls r1, r4, #2
ldr r0, _0806E0D8 @ =gUnk_081142DC
adds r6, r1, r0
ldr r1, [r5, #0x68]
ldrb r0, [r6]
strb r0, [r1, #0xf]
ldr r1, [r5, #0x68]
movs r2, #0xe0
lsls r2, r2, #0xe
movs r4, #0x90
lsls r4, r4, #0xf
adds r0, r5, #0
adds r3, r4, #0
bl PositionRelative
ldr r1, [r5, #0x6c]
ldrb r0, [r6, #1]
strb r0, [r1, #0xf]
ldr r1, [r5, #0x6c]
movs r2, #0xb0
lsls r2, r2, #0xf
adds r0, r5, #0
adds r3, r4, #0
bl PositionRelative
ldr r1, [r5, #0x70]
ldrb r0, [r6, #2]
strb r0, [r1, #0xf]
ldr r1, [r5, #0x70]
movs r2, #0xf0
lsls r2, r2, #0xf
adds r0, r5, #0
adds r3, r4, #0
bl PositionRelative
_0806E0D6:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0806E0D8: .4byte gUnk_081142DC
.syntax divided

View File

@ -1,78 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r3, r0, #0
adds r5, r1, #0
ldrb r1, [r3, #0xb]
cmp r1, #0
beq _0806E1AC
movs r0, #1
str r0, [r5, #0x14]
adds r1, r3, #0
adds r1, #0x74
ldrh r0, [r1]
adds r0, #1
strh r0, [r1]
adds r1, #2
ldrh r2, [r1]
adds r0, r3, #0
adds r0, #0x44
ldrb r0, [r0]
adds r4, r1, #0
cmp r0, #0
bne _0806E16E
lsls r0, r2, #1
b _0806E172
_0806E16E:
lsls r0, r2, #1
adds r0, r0, r2
_0806E172:
strh r0, [r4]
lsls r0, r0, #0x10
lsrs r0, r0, #0x10
ldr r1, _0806E18C @ =0x000003E7
cmp r0, r1
bls _0806E194
strh r1, [r4]
movs r0, #0
str r0, [r5, #0x14]
ldr r0, _0806E190 @ =0x0000421B
bl MessageFromTarget
b _0806E1C0
.align 2, 0
_0806E18C: .4byte 0x000003E7
_0806E190: .4byte 0x0000421B
_0806E194:
ldr r0, _0806E1A4 @ =0x00004218
bl MessageFromTarget
ldr r1, _0806E1A8 @ =gMessage
ldrh r0, [r4]
str r0, [r1, #0x10]
b _0806E1C0
.align 2, 0
_0806E1A4: .4byte 0x00004218
_0806E1A8: .4byte gMessage
_0806E1AC:
str r1, [r5, #0x14]
adds r0, r3, #0
adds r0, #0x74
strh r1, [r0]
adds r4, r3, #0
adds r4, #0x76
strh r1, [r4]
ldr r0, _0806E1D4 @ =0x0000421C
bl MessageFromTarget
_0806E1C0:
ldr r1, _0806E1D8 @ =gRoomTransition
ldrh r0, [r4]
strh r0, [r1, #6]
ldr r2, _0806E1DC @ =gActiveScriptInfo
ldrb r1, [r2, #7]
movs r0, #1
orrs r0, r1
strb r0, [r2, #7]
pop {r4, r5, pc}
.align 2, 0
_0806E1D4: .4byte 0x0000421C
_0806E1D8: .4byte gRoomTransition
_0806E1DC: .4byte gActiveScriptInfo
.syntax divided

View File

@ -40905,16 +40905,6 @@
"size": 25,
"type": "animation"
},
{
"path": "picolyteBottle/gUnk_081142CC.bin",
"start": 1131212,
"size": 16
},
{
"path": "picolyteBottle/gUnk_081142DC.bin",
"start": 1131228,
"size": 32
},
{
"path": "animations/gSpriteAnimations_SmallTownMinish_0.bin",
"start": 1131720,

View File

@ -1,17 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_081142BC:: @ 081142BC
.4byte sub_0806DF00
.4byte sub_0806DF74
.4byte sub_0806DFB4
.4byte nullsub_111
gUnk_081142CC:: @ 081142CC
.incbin "picolyteBottle/gUnk_081142CC.bin"
gUnk_081142DC:: @ 081142DC
.incbin "picolyteBottle/gUnk_081142DC.bin"

View File

@ -1318,7 +1318,7 @@ SECTIONS {
data/animations/npc/npc4F.o(.rodata);
data/const/npc/clothesRack.o(.rodata);
data/animations/npc/clothesRack.o(.rodata);
data/const/npc/picolyteBottle.o(.rodata);
src/npc/picolyteBottle.o(.rodata);
data/const/npc/smallTownMinish.o(.rodata);
data/animations/npc/smallTownMinish.o(.rodata);
data/const/npc/hurdyGurdyMan.o(.rodata);

View File

@ -1,3 +1,4 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "script.h"
#include "structures.h"
@ -6,106 +7,185 @@
#include "object.h"
#include "npc.h"
typedef struct {
Entity base;
Entity* ent1;
Entity* ent2;
Entity* ent3;
u16 unk74;
u16 unk76;
} PicolyteBottleEntity;
extern ScreenTransitionData gUnk_0813AD4C;
void sub_0806E014(Entity* this);
void sub_0806E0DC(Entity* this);
void sub_0806E014(PicolyteBottleEntity* this);
void sub_0806E0DC(PicolyteBottleEntity* this);
extern void (*const gUnk_081142BC[])(Entity*);
void (*const PicolyteBottle_Actions[])(PicolyteBottleEntity*);
const u8 gUnk_081142CC[];
const u8 gUnk_081142DC[];
extern void sub_08078828(Entity*);
extern Hitbox gHitbox_0;
void PicolyteBottle(Entity* this) {
gUnk_081142BC[this->action](this);
PicolyteBottle_Actions[this->action]((PicolyteBottleEntity*)this);
if (this->type == 0) {
gPlayerState.mobility |= 0x80;
}
}
void sub_0806DF00(Entity* this) {
void PicolyteBottle_Init(PicolyteBottleEntity* this) {
Entity* npc;
if (this->type == 0) {
this->action = 1;
if (super->type == 0) {
super->action = 1;
npc = CreateNPC(PICOLYTE_BOTTLE, 1, 0);
*(Entity**)&this->field_0x68 = npc;
npc->parent = this;
this->ent1 = npc;
npc->parent = super;
npc = CreateNPC(PICOLYTE_BOTTLE, 1, 1);
*(Entity**)&this->field_0x6c = npc;
npc->parent = this;
this->ent2 = npc;
npc->parent = super;
npc = CreateNPC(PICOLYTE_BOTTLE, 1, 2);
*(Entity**)&this->field_0x70 = npc;
npc->parent = this;
this->field_0x74.HWORD = 0;
this->field_0x76.HWORD = 10;
this->ent3 = npc;
npc->parent = super;
this->unk74 = 0;
this->unk76 = 10;
gRoomTransition.field_0x6 = 10;
sub_0806E014(this);
sub_0807DD50(this);
sub_0807DD50(super);
} else {
this->hitbox = &gHitbox_0;
this->collisionLayer = 1;
super->hitbox = &gHitbox_0;
super->collisionLayer = 1;
sub_0806E0DC(this);
}
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806DF74.inc", void sub_0806DF74(Entity* this))
void PicolyteBottle_Action1(PicolyteBottleEntity* this) {
sub_0807DD94(super, 0);
if (super->actionDelay != 0xff) {
if (super->damage != 0) {
this->ent3->actionDelay++;
}
this->ent1->actionDelay++;
this->ent2->actionDelay++;
super->actionDelay = 0xff;
SetRoomFlag(0);
}
}
void sub_0806DFB4(Entity* this) {
void PicolyteBottle_Action2(PicolyteBottleEntity* this) {
Entity* obj;
if (this->interactType != 0) {
this->interactType = 0;
this->parent->actionDelay = this->type2;
this->parent->type2 = this->field_0xf;
if (super->interactType != 0) {
super->interactType = 0;
super->parent->actionDelay = super->type2;
super->parent->type2 = super->field_0xf;
} else {
if (this->actionDelay != 0) {
this->actionDelay = 0;
obj = CreateObject(OBJECT_35, 2, this->field_0xf);
if (super->actionDelay != 0) {
super->actionDelay = 0;
obj = CreateObject(OBJECT_35, 2, super->field_0xf);
if (obj != NULL) {
obj->parent = this;
this->child = obj;
CopyPosition(this, obj);
obj->parent = super;
super->child = obj;
CopyPosition(super, obj);
}
sub_080788E0(this);
sub_0807B7D8(0x74, this->field_0x76.HWORD, 2);
sub_080788E0(super);
sub_0807B7D8(0x74, this->unk76, 2);
}
}
}
void nullsub_111(void) {
void nullsub_111(PicolyteBottleEntity* this) {
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806E014.inc", void sub_0806E014(Entity* this))
void sub_0806E014(PicolyteBottleEntity* this) {
u32 uVar1;
int iVar2;
const u8* ptr;
void sub_0806E0DC(Entity* this) {
this->actionDelay = 0;
if (this->field_0xf != 0xff) {
this->action = 2;
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
if (this->child != NULL) {
DeleteEntity(this->child);
this->child = NULL;
}
sub_08078828(this);
sub_0807B7D8(0x73, this->field_0x76.HWORD, 2);
uVar1 = (Random() & 0x70) >> 4;
super->type2 = 0xff;
super->actionDelay = 0xff;
if (CheckLocalFlag(0x93) == 0) {
super->damage = 0;
iVar2 = uVar1 * 2;
ptr = &gUnk_081142CC[iVar2];
this->ent1->field_0xf = ptr[0];
PositionRelative(super, this->ent1, 0x480000, 0x480000);
this->ent2->field_0xf = ptr[1];
PositionRelative(super, this->ent2, 0x680000, 0x480000);
this->ent3->field_0xf = 0xff;
CopyPosition(super, this->ent3);
} else {
this->action = 3;
super->damage = 1;
iVar2 = uVar1 * 4;
ptr = &gUnk_081142DC[iVar2];
this->ent1->field_0xf = ptr[0];
PositionRelative(super, this->ent1, 0x380000, 0x480000);
this->ent2->field_0xf = ptr[1];
PositionRelative(super, this->ent2, 0x580000, 0x480000);
this->ent3->field_0xf = ptr[2];
PositionRelative(super, this->ent3, 0x780000, 0x480000);
}
}
ASM_FUNC("asm/non_matching/picolyteBottles/sub_0806E140.inc",
void sub_0806E140(Entity* this, ScriptExecutionContext* context))
void sub_0806E1E0(Entity* this) {
sub_0806E014(this);
sub_0806E0DC(*(Entity**)&this->field_0x68);
sub_0806E0DC(*(Entity**)&this->field_0x6c);
sub_0806E0DC(*(Entity**)&this->field_0x70);
void sub_0806E0DC(PicolyteBottleEntity* this) {
super->actionDelay = 0;
if (super->field_0xf != 0xff) {
super->action = 2;
this->unk76 = TILE(super->x.HALF.HI, super->y.HALF.HI);
if (super->child != NULL) {
DeleteEntity(super->child);
super->child = NULL;
}
sub_08078828(super);
sub_0807B7D8(0x73, this->unk76, 2);
} else {
super->action = 3;
}
}
void sub_0806E1FC(Entity* this) {
void sub_0806E140(PicolyteBottleEntity* this, ScriptExecutionContext* context) {
u32 uVar1, uVar2;
if (super->type2) {
context->condition = 1;
this->unk74++;
uVar1 = this->unk76;
if (super->damage == 0) {
uVar2 = uVar1 << 1;
} else {
uVar2 = uVar1 * 3;
}
this->unk76 = uVar2;
if ((this->unk76) >= 1000) {
this->unk76 = 999;
context->condition = 0;
MessageFromTarget(0x421b);
} else {
MessageFromTarget(0x4218);
gMessage.field_0x10 = this->unk76;
}
} else {
context->condition = 0;
this->unk74 = 0;
this->unk76 = 0;
MessageFromTarget(0x421c);
}
gRoomTransition.field_0x6 = this->unk76;
gActiveScriptInfo.flags |= 1;
}
void sub_0806E1E0(PicolyteBottleEntity* this) {
sub_0806E014(this);
sub_0806E0DC((PicolyteBottleEntity*)this->ent1);
sub_0806E0DC((PicolyteBottleEntity*)this->ent2);
sub_0806E0DC((PicolyteBottleEntity*)this->ent3);
}
void sub_0806E1FC(PicolyteBottleEntity* this) {
DoExitTransition(&gUnk_0813AD4C);
}
@ -124,10 +204,21 @@ void sub_0806E23C(void) {
}
}
void sub_0806E250(Entity* this, ScriptExecutionContext* context) {
void sub_0806E250(PicolyteBottleEntity* this, ScriptExecutionContext* context) {
context->condition = 0;
if (CheckKinstoneFused(0x31) != 0) {
context->condition = 1;
}
gActiveScriptInfo.flags |= 1;
}
void (*const PicolyteBottle_Actions[])(PicolyteBottleEntity*) = {
PicolyteBottle_Init,
PicolyteBottle_Action1,
PicolyteBottle_Action2,
nullsub_111,
};
const u8 gUnk_081142CC[] = { 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0 };
const u8 gUnk_081142DC[] = { 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0,
1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0 };