Decompile the rest of playerItemBottle (renamed from sword spin)

This commit is contained in:
Tal Hayon
2022-02-13 06:58:56 +02:00
parent d1a2586001
commit 65ab0fb1cb
20 changed files with 303 additions and 650 deletions
@@ -1,122 +0,0 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
adds r1, r4, #0
adds r1, #0x68
ldrb r0, [r1]
cmp r0, #0x36
bne _0801BA2A
movs r0, #0x36
b _0801BA34
_0801BA2A:
ldrb r1, [r1]
ldr r0, _0801BA4C @ =gSave
adds r0, r0, r1
adds r0, #0x9a
ldrb r0, [r0]
_0801BA34:
adds r1, r4, #0
adds r1, #0x6f
strb r0, [r1]
subs r0, #0x20
cmp r0, #0x11
bhi _0801BB02
lsls r0, r0, #2
ldr r1, _0801BA50 @ =_0801BA54
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801BA4C: .4byte gSave
_0801BA50: .4byte _0801BA54
_0801BA54: @ jump table
.4byte _0801BA9C @ case 0
.4byte _0801BAF8 @ case 1
.4byte _0801BAF8 @ case 2
.4byte _0801BAF8 @ case 3
.4byte _0801BAF8 @ case 4
.4byte _0801BAF8 @ case 5
.4byte _0801BB02 @ case 6
.4byte _0801BB02 @ case 7
.4byte _0801BB02 @ case 8
.4byte _0801BAF8 @ case 9
.4byte _0801BAF8 @ case 10
.4byte _0801BAF8 @ case 11
.4byte _0801BAF8 @ case 12
.4byte _0801BAF8 @ case 13
.4byte _0801BAF8 @ case 14
.4byte _0801BB02 @ case 15
.4byte _0801BB02 @ case 16
.4byte _0801BB02 @ case 17
_0801BA9C:
adds r0, r4, #0
bl AllocMutableHitbox
cmp r0, #0
beq _0801BB26
ldrb r1, [r4, #0x10]
movs r0, #0x80
orrs r0, r1
strb r0, [r4, #0x10]
ldr r1, _0801BAF4 @ =gPlayerEntity
adds r0, r1, #0
adds r0, #0x3c
ldrb r0, [r0]
adds r0, #1
movs r2, #0x20
adds r3, r4, #0
adds r3, #0x3c
orrs r0, r2
strb r0, [r3]
adds r1, #0x3b
ldrb r0, [r1]
adds r1, r4, #0
adds r1, #0x3b
strb r0, [r1]
adds r1, #5
movs r0, #0x1f
strb r0, [r1]
movs r0, #1
strb r0, [r4, #0xa]
movs r0, #0x20
strb r0, [r4, #0xb]
movs r0, #0x52
strb r0, [r4, #0xe]
movs r0, #0x1b
strb r0, [r4, #0xf]
adds r0, r4, #0
bl sub_0801766C
movs r0, #0xee
lsls r0, r0, #1
bl SoundReq
b _0801BB0A
.align 2, 0
_0801BAF4: .4byte gPlayerEntity
_0801BAF8:
movs r0, #0xd5
strb r0, [r4, #0xe]
movs r0, #0x3c
strb r0, [r4, #0xf]
b _0801BB0A
_0801BB02:
movs r1, #0
movs r0, #0x37
strb r0, [r4, #0xe]
strb r1, [r4, #0xf]
_0801BB0A:
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0xff
strb r0, [r4, #0x1e]
ldr r0, _0801BB28 @ =gPlayerState
str r4, [r0, #0x2c]
adds r0, r4, #0
movs r1, #1
movs r2, #3
bl LoadSwapGFX
adds r0, r4, #0
bl sub_0801BB2C
_0801BB26:
pop {r4, pc}
.align 2, 0
_0801BB28: .4byte gPlayerState
.syntax divided
@@ -1,103 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r5, r0, #0
ldr r0, _0801BB88 @ =gPlayerState
ldr r0, [r0, #0x2c]
cmp r0, r5
beq _0801BB68
ldrb r0, [r5, #0xa]
cmp r0, #1
bne _0801BB64
ldrb r0, [r5, #0xb]
cmp r0, #0x20
beq _0801BB64
adds r0, r5, #0
adds r0, #0x68
ldrb r4, [r0]
subs r4, #0x1c
ldrb r0, [r5, #0xb]
adds r1, r4, #0
bl SetBottleContents
ldrb r0, [r5, #0xb]
adds r1, r4, #0
movs r2, #5
.ifdef JP
bl CreateItemEntity
.else
.ifdef EU
bl CreateItemEntity
.else
.ifdef DEMO_JP
bl CreateItemEntity @ TODO deduplicate
.else
bl sub_080A7C18
.endif
.endif
.endif
ldr r0, _0801BB8C @ =0x00000109
bl SoundReq
_0801BB64:
bl DeleteThisEntity
_0801BB68:
ldr r1, _0801BB90 @ =gPlayerEntity
adds r0, r5, #0
bl sub_0801BDE8
adds r0, r5, #0
adds r0, #0x6f
ldrb r0, [r0]
subs r0, #0x20
cmp r0, #0x11
bhi _0801BC04
lsls r0, r0, #2
ldr r1, _0801BB94 @ =_0801BB98
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801BB88: .4byte gPlayerState
_0801BB8C: .4byte 0x00000109
_0801BB90: .4byte gPlayerEntity
_0801BB94: .4byte _0801BB98
_0801BB98: @ jump table
.4byte _0801BBE0 @ case 0
.4byte _0801BBE8 @ case 1
.4byte _0801BBE8 @ case 2
.4byte _0801BBE8 @ case 3
.4byte _0801BBE8 @ case 4
.4byte _0801BBE8 @ case 5
.4byte _0801BC04 @ case 6
.4byte _0801BC04 @ case 7
.4byte _0801BC04 @ case 8
.4byte _0801BBE8 @ case 9
.4byte _0801BBE8 @ case 10
.4byte _0801BBE8 @ case 11
.4byte _0801BBE8 @ case 12
.4byte _0801BBE8 @ case 13
.4byte _0801BBE8 @ case 14
.4byte _0801BC04 @ case 15
.4byte _0801BC04 @ case 16
.4byte _0801BC04 @ case 17
_0801BBE0:
adds r0, r5, #0
bl sub_0801BC0C
b _0801BC0A
_0801BBE8:
ldr r0, _0801BC00 @ =gPlayerEntity
adds r1, r0, #0
adds r1, #0x5a
ldrb r0, [r1]
cmp r0, #1
bne _0801BC0A
movs r0, #0
strb r0, [r1]
adds r0, r5, #0
bl sub_0801BC14
b _0801BC0A
.align 2, 0
_0801BC00: .4byte gPlayerEntity
_0801BC04:
adds r0, r5, #0
bl sub_0801BCB4
_0801BC0A:
pop {r4, r5, pc}
.syntax divided
@@ -1,71 +0,0 @@
.syntax unified
push {r4, r5, r6, lr}
adds r4, r0, #0
movs r6, #0x20
movs r5, #0
adds r0, #0x6f
ldrb r0, [r0]
subs r0, #0x21
cmp r0, #0xd
bhi _0801BC98
lsls r0, r0, #2
ldr r1, _0801BC30 @ =_0801BC34
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801BC30: .4byte _0801BC34
_0801BC34: @ jump table
.4byte _0801BC76 @ case 0
.4byte _0801BC6C @ case 1
.4byte _0801BC6E @ case 2
.4byte _0801BC76 @ case 3
.4byte _0801BC72 @ case 4
.4byte _0801BC98 @ case 5
.4byte _0801BC98 @ case 6
.4byte _0801BC98 @ case 7
.4byte _0801BC7A @ case 8
.4byte _0801BC7A @ case 9
.4byte _0801BC7A @ case 10
.4byte _0801BC7A @ case 11
.4byte _0801BC7A @ case 12
.4byte _0801BC7A @ case 13
_0801BC6C:
movs r6, #0x23
_0801BC6E:
movs r5, #0x28
b _0801BC98
_0801BC72:
movs r5, #0x50
b _0801BC98
_0801BC76:
movs r5, #0xa0
b _0801BC98
_0801BC7A:
ldr r1, _0801BCB0 @ =gSave
adds r0, r4, #0
adds r0, #0x6f
ldrb r0, [r0]
adds r2, r1, #0
adds r2, #0xb3
strb r0, [r2]
adds r1, #0xc6
movs r0, #0xe1
lsls r0, r0, #2
strh r0, [r1]
movs r0, #0x88
lsls r0, r0, #2
bl SoundReq
_0801BC98:
adds r0, r5, #0
bl ModHealth
adds r0, r4, #0
adds r0, #0x68
ldrb r1, [r0]
subs r1, #0x1c
adds r0, r6, #0
bl SetBottleContents
pop {r4, r5, r6, pc}
.align 2, 0
_0801BCB0: .4byte gSave
.syntax divided
@@ -1,143 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
ldr r0, _0801BCEC @ =gPlayerEntity
adds r0, #0x5a
ldrb r0, [r0]
cmp r0, #1
bne _0801BD6C
adds r0, r4, #0
adds r0, #0x6f
ldrb r1, [r0]
adds r5, r0, #0
cmp r1, #0x36
beq _0801BCDA
subs r0, #7
ldrb r1, [r0]
subs r1, #0x1c
movs r0, #0x20
bl SetBottleContents
_0801BCDA:
ldrb r0, [r5]
subs r0, #0x26
cmp r0, #0xb
bhi _0801BD6C
lsls r0, r0, #2
ldr r1, _0801BCF0 @ =_0801BCF4
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0801BCEC: .4byte gPlayerEntity
_0801BCF0: .4byte _0801BCF4
_0801BCF4: @ jump table
.4byte _0801BD24 @ case 0
.4byte _0801BD32 @ case 1
.4byte _0801BD40 @ case 2
.4byte _0801BD6C @ case 3
.4byte _0801BD6C @ case 4
.4byte _0801BD6C @ case 5
.4byte _0801BD6C @ case 6
.4byte _0801BD6C @ case 7
.4byte _0801BD6C @ case 8
.4byte _0801BD54 @ case 9
.4byte _0801BD54 @ case 10
.4byte _0801BD54 @ case 11
_0801BD24:
adds r0, r4, #0
movs r1, #0x68
movs r2, #0
movs r3, #0
bl CreateObjectWithParent
b _0801BD6C
_0801BD32:
adds r0, r4, #0
movs r1, #0x68
movs r2, #1
movs r3, #1
bl CreateObjectWithParent
b _0801BD6C
_0801BD40:
adds r0, r4, #0
movs r1, #0x68
movs r2, #2
movs r3, #2
bl CreateObjectWithParent
movs r0, #0x20
bl ModHealth
b _0801BD6C
_0801BD54:
ldr r1, _0801BD88 @ =gSave
ldrb r0, [r5]
adds r2, r1, #0
adds r2, #0xb2
strb r0, [r2]
adds r1, #0xc4
movs r0, #0xe1
lsls r0, r0, #4
strh r0, [r1]
ldr r0, _0801BD8C @ =0x000001CF
bl SoundReq
_0801BD6C:
ldr r0, _0801BD90 @ =gPlayerEntity
adds r0, #0x5a
ldrb r0, [r0]
cmp r0, #2
bne _0801BDAE
adds r0, r4, #0
adds r0, #0x6f
ldrb r0, [r0]
cmp r0, #0x26
beq _0801BD94
cmp r0, #0x27
beq _0801BDA2
b _0801BDAE
.align 2, 0
_0801BD88: .4byte gSave
_0801BD8C: .4byte 0x000001CF
_0801BD90: .4byte gPlayerEntity
_0801BD94:
adds r0, r4, #0
movs r1, #0x68
movs r2, #0
movs r3, #0
bl CreateObjectWithParent
b _0801BDAE
_0801BDA2:
adds r0, r4, #0
movs r1, #0x68
movs r2, #1
movs r3, #1
bl CreateObjectWithParent
_0801BDAE:
ldr r0, _0801BDC8 @ =gPlayerEntity
adds r0, #0x5a
ldrb r0, [r0]
cmp r0, #3
bne _0801BDE6
adds r0, r4, #0
adds r0, #0x6f
ldrb r0, [r0]
cmp r0, #0x26
beq _0801BDCC
cmp r0, #0x27
beq _0801BDDA
b _0801BDE6
.align 2, 0
_0801BDC8: .4byte gPlayerEntity
_0801BDCC:
adds r0, r4, #0
movs r1, #0x68
movs r2, #0
movs r3, #0
bl CreateObjectWithParent
b _0801BDE6
_0801BDDA:
adds r0, r4, #0
movs r1, #0x68
movs r2, #1
movs r3, #0
bl CreateObjectWithParent
_0801BDE6:
pop {r4, r5, pc}
.syntax divided
@@ -1,40 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r1, #0
ldrb r0, [r5, #0x1e]
ldrb r1, [r4, #0xe]
subs r0, r0, r1
ldrb r1, [r4, #0xf]
adds r0, r0, r1
ldrb r1, [r4, #0x1e]
cmp r0, r1
beq _0801BE0A
strb r0, [r4, #0x1e]
ldrb r1, [r4, #0x1e]
ldrh r2, [r4, #0x12]
adds r0, r4, #0
bl sub_080042D0
_0801BE0A:
ldrb r1, [r5, #0x18]
lsls r1, r1, #0x19
lsrs r1, r1, #0x1f
ldrb r0, [r5, #0x14]
lsrs r0, r0, #1
movs r2, #1
ands r0, r2
eors r1, r0
lsls r1, r1, #6
ldrb r2, [r4, #0x18]
movs r0, #0x41
rsbs r0, r0, #0
ands r0, r2
orrs r0, r1
strb r0, [r4, #0x18]
ldr r1, _0801BE34 @ =gPlayerEntity
adds r0, r4, #0
bl sub_08078E84
pop {r4, r5, pc}
.align 2, 0
_0801BE34: .4byte gPlayerEntity
.syntax divided
@@ -1,103 +0,0 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
adds r2, r4, #0
adds r2, #0x41
ldrb r0, [r2]
movs r1, #0x7f
ands r1, r0
cmp r1, #0x49
beq _0801BE54
cmp r1, #0x4d
beq _0801BE60
movs r0, #0
strb r0, [r2]
b _0801BE6A
_0801BE54:
movs r0, #0x28
strb r0, [r4, #0xb]
adds r0, r4, #0
bl sub_0801B9F0
b _0801BE6A
_0801BE60:
movs r0, #0x27
strb r0, [r4, #0xb]
adds r0, r4, #0
bl sub_0801B9F0
_0801BE6A:
ldrb r0, [r4, #0x1e]
subs r0, #0x1b
lsls r0, r0, #2
ldr r1, _0801BE84 @ =gUnk_080B788A
adds r2, r0, r1
ldrb r0, [r4, #0x18]
lsls r0, r0, #0x19
cmp r0, #0
bge _0801BE88
ldr r1, [r4, #0x48]
ldrb r0, [r2]
rsbs r0, r0, #0
b _0801BE8C
.align 2, 0
_0801BE84: .4byte gUnk_080B788A
_0801BE88:
ldr r1, [r4, #0x48]
ldrb r0, [r2]
_0801BE8C:
strb r0, [r1]
ldr r1, [r4, #0x48]
ldrb r0, [r2, #1]
strb r0, [r1, #1]
ldr r1, [r4, #0x48]
ldrb r0, [r2, #2]
strb r0, [r1, #6]
ldr r1, [r4, #0x48]
ldrb r0, [r2, #3]
strb r0, [r1, #7]
ldr r0, _0801BEF0 @ =gPlayerEntity
adds r0, #0x5a
ldrb r0, [r0]
movs r1, #0xf
ands r1, r0
cmp r1, #0
beq _0801BEDE
ldrb r0, [r4, #0xb]
cmp r0, #0x20
bne _0801BEE4
subs r0, r1, #1
lsls r0, r0, #1
ldr r1, _0801BEF4 @ =gUnk_080B7878
adds r2, r0, r1
movs r1, #0
ldrsb r1, [r2, r1]
ldrb r0, [r4, #0x18]
lsls r0, r0, #0x19
cmp r0, #0
bge _0801BECA
rsbs r1, r1, #0
_0801BECA:
ldrb r2, [r2, #1]
lsls r2, r2, #0x18
asrs r2, r2, #0x18
adds r0, r4, #0
bl sub_080002B4
cmp r0, #0x10
bne _0801BEDE
movs r0, #0x26
strb r0, [r4, #0xb]
_0801BEDE:
ldrb r0, [r4, #0xb]
cmp r0, #0x20
beq _0801BEEE
_0801BEE4:
ldr r2, _0801BEF0 @ =gPlayerEntity
ldrb r1, [r2, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r2, #0x10]
_0801BEEE:
pop {r4, pc}
.align 2, 0
_0801BEF0: .4byte gPlayerEntity
_0801BEF4: .4byte gUnk_080B7878
.syntax divided
-10
View File
@@ -20860,16 +20860,6 @@
"start": 751604,
"size": 8
},
{
"path": "playerItemSwordSpin/gUnk_080B7878.bin",
"start": 751736,
"size": 18
},
{
"path": "playerItemSwordSpin/gUnk_080B788A.bin",
"start": 751754,
"size": 134
},
{
"path": "data_080B7910/gUnk_080B7910.bin",
"start": 751888,
+1 -1
View File
@@ -542,7 +542,7 @@
.equiv SFX_21D, 0x21d
.equiv SFX_21E, 0x21e
.equiv SFX_21F, 0x21f
.equiv SFX_220, 0x220
.equiv SFX_PICOLYTE, 0x220
.equiv SFX_221, 0x221
.equiv SONG_STOP_ALL, 0x80010000
.equiv SONG_MUTE, 0x80020000
@@ -1,15 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080B7870:: @ 080B7870
.4byte sub_0801BA18
.4byte sub_0801BB2C
gUnk_080B7878:: @ 080B7878
.incbin "playerItemSwordSpin/gUnk_080B7878.bin"
gUnk_080B788A:: @ 080B788A
.incbin "playerItemSwordSpin/gUnk_080B788A.bin"
+2 -2
View File
@@ -251,7 +251,7 @@ typedef struct {
/*0x07*/ u8 quiverType;
/*0x08*/ u8 filler[2];
/*0x0a*/ u8 charm;
/*0x0b*/ u8 unkB;
/*0x0b*/ u8 picolyteType;
/*0x0c*/ u8 itemButtons[2];
/*0x0e*/ u8 bottles[4];
/*0x12*/ u8 effect;
@@ -260,7 +260,7 @@ typedef struct {
/*0x18*/ u16 rupees;
/*0x1a*/ u16 field_0x1a;
/*0x1c*/ u16 charmTimer;
/*0x1e*/ u16 unkTimer;
/*0x1e*/ u16 picolyteTimer;
/*0x20*/ u16 effectTimer;
/*0x22*/ u8 filler4[4];
} Stats;
+1 -1
View File
@@ -576,7 +576,7 @@ typedef enum {
SFX_21D,
SFX_21E,
SFX_21F,
SFX_220,
SFX_PICOLYTE,
SFX_221,
// special functions
SONG_STOP_ALL = 0x80010000,
+2 -2
View File
@@ -313,7 +313,7 @@ SECTIONS {
src/playerItem/playerItemBomb.o(.text);
src/playerItem/playerItem3.o(.text);
src/playerItem/playerItemC.o(.text);
src/playerItem/playerItemSwordSpin.o(.text);
src/playerItem/playerItemBottle.o(.text);
src/playerItem/playerItemCellOverwriteSet.o(.text);
asm/ui.o(.text);
src/ui.o(.text);
@@ -931,7 +931,7 @@ SECTIONS {
data/const/playerItem/playerItemBomb.o(.rodata);
src/playerItem/playerItem3.o(.rodata);
src/playerItem/playerItemC.o(.rodata);
data/const/playerItem/playerItemSwordSpin.o(.rodata);
src/playerItem/playerItemBottle.o(.rodata);
data/data_080B7910.o(.rodata);
data/const/playerItem/playerItemCellOverwriteSet.o(.rodata);
data/data_080B7B74.o(.rodata);
+1 -1
View File
@@ -234,7 +234,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
break;
}
if (ptr4 != 0) {
if ((r1 = gSave.stats.unkB) == 0) {
if ((r1 = gSave.stats.picolyteType) == 0) {
// nop
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
} else {
+5 -5
View File
@@ -312,12 +312,12 @@ void HandlePlayerLife(Entity* this) {
SoundReq(SFX_ICE_BLOCK_MELT);
}
if (gSave.stats.unkB == 0) {
gSave.stats.unkTimer = 0;
} else if ((gSave.stats.unkTimer == 0) || (--gSave.stats.unkTimer == 0)) {
gSave.stats.unkB = 0;
if (gSave.stats.picolyteType == 0) {
gSave.stats.picolyteTimer = 0;
} else if ((gSave.stats.picolyteTimer == 0) || (--gSave.stats.picolyteTimer == 0)) {
gSave.stats.picolyteType = 0;
SoundReq(SFX_140);
} else if ((gSave.stats.unkTimer & 0xf) == 0) {
} else if ((gSave.stats.picolyteTimer & 0xf) == 0) {
CreateSparkle(this);
}
+1 -1
View File
@@ -23,7 +23,7 @@ void MinishEzlo(Entity* this) {
}
if ((this->frameSpriteSettings & 0x20) != 0) {
this->frameSpriteSettings &= 0xdf;
EnqueueSFX(SFX_220);
EnqueueSFX(SFX_PICOLYTE);
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ PlayerItemFunc PlayerItemGustJar;
PlayerItemFunc PlayerItemPacciCane;
PlayerItemFunc PlayerItemC;
PlayerItemFunc PlayerItemCellOverwriteSet;
PlayerItemFunc PlayerItemSwordSpin;
PlayerItemFunc PlayerItemBottle;
PlayerItemFunc PlayerItemSwordBeam;
PlayerItemFunc PlayerItem10;
PlayerItemFunc PlayerItem11;
@@ -52,7 +52,7 @@ PlayerItemFunc* const gPlayerItemFunctions[] = {
DeleteEntity,
PlayerItemC,
PlayerItemCellOverwriteSet,
PlayerItemSwordSpin,
PlayerItemBottle,
PlayerItemSwordBeam,
PlayerItem10,
PlayerItem11,
+285
View File
@@ -0,0 +1,285 @@
#include "entity.h"
#include "save.h"
#include "sound.h"
#include "functions.h"
#include "object.h"
#include "item.h"
void PlayerItemBottle_UseEmptyBottle(Entity*);
void PlayerItemBottle_Action1(Entity*);
void sub_0801BDE8(Entity*, Entity*);
void PlayerItemBottle_UseEmptyBottle2(Entity*);
void PlayerItemBottle_UsePotionOrPicolyte(Entity*);
void PlayerItemBottle_UseOther(Entity*);
void PlayerItemBottle_Init(Entity*);
extern u32 SetBottleContents(u32 itemID, u32 bottleIndex);
extern bool32 AllocMutableHitbox(Entity*);
extern void sub_0801B9F0(Entity* this);
void PlayerItemBottle(Entity* this) {
static void (*const PlayerItemBottle_Actions[])(Entity*) = {
PlayerItemBottle_Init,
PlayerItemBottle_Action1,
};
PlayerItemBottle_Actions[this->action](this);
}
void PlayerItemBottle_Init(Entity* this) {
u32 bottleType;
if (this->field_0x68.HALF.LO == ITEM_QST_DOGFOOD) {
bottleType = ITEM_QST_DOGFOOD;
} else {
u32 tmp = this->field_0x68.HALF.LO;
bottleType = gSave.saved_status.field_0x24[tmp - 6];
}
this->field_0x6e.HALF.HI = bottleType;
switch (bottleType) {
case ITEM_BOTTLE_EMPTY:
if (AllocMutableHitbox(this) == 0) {
return;
}
COLLISION_ON(this);
this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20;
this->flags2 = gPlayerEntity.flags2;
this->hurtType = 0x1f;
this->type = 1;
this->type2 = ITEM_BOTTLE_EMPTY;
this->actionDelay = 0x52;
this->field_0xf = 0x1b;
sub_0801766C(this);
SoundReq(SFX_1DC);
break;
case ITEM_BOTTLE_BUTTER:
case ITEM_BOTTLE_MILK:
case ITEM_BOTTLE_HALF_MILK:
case ITEM_BOTTLE_RED_POTION:
case ITEM_BOTTLE_BLUE_POTION:
case ITEM_BOTTLE_PICOLYTE_RED:
case ITEM_BOTTLE_PICOLYTE_ORANGE:
case ITEM_BOTTLE_PICOLYTE_YELLOW:
case ITEM_BOTTLE_PICOLYTE_GREEN:
case ITEM_BOTTLE_PICOLYTE_BLUE:
case ITEM_BOTTLE_PICOLYTE_WHITE:
this->actionDelay = 0xd5;
this->field_0xf = 0x3c;
break;
case BOTTLE_CHARM_NAYRU:
case BOTTLE_CHARM_FARORE:
case BOTTLE_CHARM_DIN:
default:
this->actionDelay = 0x37;
this->field_0xf = 0;
}
this->action = 1;
this->frameIndex = 0xff;
gPlayerState.item = this;
LoadSwapGFX(this, 1, 3);
PlayerItemBottle_Action1(this);
}
void PlayerItemBottle_Action1(Entity* this) {
int iVar1;
if (gPlayerState.item != this) {
if ((this->type == 1) && (this->type2 != ITEM_BOTTLE_EMPTY)) {
iVar1 = this->field_0x68.HALF.LO - 0x1c;
SetBottleContents(this->type2, iVar1);
#if defined(EU) || defined(JP) || defined(DEMO_JP)
CreateItemEntity(this->type2, iVar1, 5);
#else
sub_080A7C18(this->type2, iVar1, 5);
#endif
SoundReq(SFX_109);
}
DeleteThisEntity();
}
sub_0801BDE8(this, &gPlayerEntity);
switch (this->field_0x6e.HALF.HI) {
case ITEM_BOTTLE_EMPTY:
PlayerItemBottle_UseEmptyBottle2(this);
break;
case ITEM_BOTTLE_BUTTER:
case ITEM_BOTTLE_MILK:
case ITEM_BOTTLE_HALF_MILK:
case ITEM_BOTTLE_RED_POTION:
case ITEM_BOTTLE_BLUE_POTION:
case ITEM_BOTTLE_PICOLYTE_RED:
case ITEM_BOTTLE_PICOLYTE_ORANGE:
case ITEM_BOTTLE_PICOLYTE_YELLOW:
case ITEM_BOTTLE_PICOLYTE_GREEN:
case ITEM_BOTTLE_PICOLYTE_BLUE:
case ITEM_BOTTLE_PICOLYTE_WHITE:
if (gPlayerEntity.frame == 1) {
gPlayerEntity.frame = 0;
PlayerItemBottle_UsePotionOrPicolyte(this);
}
break;
case BOTTLE_CHARM_NAYRU:
case BOTTLE_CHARM_FARORE:
case BOTTLE_CHARM_DIN:
default:
PlayerItemBottle_UseOther(this);
}
}
void PlayerItemBottle_UseEmptyBottle2(Entity* this) {
PlayerItemBottle_UseEmptyBottle(this);
}
void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) {
u32 health;
u32 bottleType;
bottleType = ITEM_BOTTLE_EMPTY;
health = 0;
switch (this->field_0x6e.HALF.HI) {
case ITEM_BOTTLE_MILK:
bottleType = ITEM_BOTTLE_HALF_MILK;
case ITEM_BOTTLE_HALF_MILK:
health = 40;
break;
case ITEM_BOTTLE_BLUE_POTION:
health = 80;
break;
case ITEM_BOTTLE_BUTTER:
case ITEM_BOTTLE_RED_POTION:
health = 160;
break;
case ITEM_BOTTLE_PICOLYTE_RED:
case ITEM_BOTTLE_PICOLYTE_ORANGE:
case ITEM_BOTTLE_PICOLYTE_YELLOW:
case ITEM_BOTTLE_PICOLYTE_GREEN:
case ITEM_BOTTLE_PICOLYTE_BLUE:
case ITEM_BOTTLE_PICOLYTE_WHITE:
gSave.stats.picolyteType = this->field_0x6e.HALF.HI;
gSave.stats.picolyteTimer = 900;
SoundReq(SFX_PICOLYTE);
break;
}
ModHealth(health);
SetBottleContents(bottleType, this->field_0x68.HALF.LO - 0x1c);
}
void PlayerItemBottle_UseOther(Entity* this) {
if (gPlayerEntity.frame == 1) {
if (this->field_0x6e.HALF.HI != 0x36) {
SetBottleContents(ITEM_BOTTLE_EMPTY, this->field_0x68.HALF.LO - 0x1c);
}
switch (this->field_0x6e.HALF.HI) {
case ITEM_BOTTLE_WATER:
CreateObjectWithParent(this, OBJECT_68, 0, 0);
break;
case ITEM_BOTTLE_MINERAL_WATER:
CreateObjectWithParent(this, OBJECT_68, 1, 1);
break;
case ITEM_BOTTLE_FAIRY:
CreateObjectWithParent(this, OBJECT_68, 2, 2);
ModHealth(0x20);
break;
case BOTTLE_CHARM_NAYRU:
case BOTTLE_CHARM_FARORE:
case BOTTLE_CHARM_DIN:
gSave.stats.charm = this->field_0x6e.HALF.HI;
gSave.stats.charmTimer = 3600;
SoundReq(SFX_ELEMENT_CHARGE);
}
}
if (gPlayerEntity.frame == 2) {
switch (this->field_0x6e.HALF.HI) {
case ITEM_BOTTLE_WATER:
CreateObjectWithParent(this, OBJECT_68, 0, 0);
break;
case ITEM_BOTTLE_MINERAL_WATER:
CreateObjectWithParent(this, OBJECT_68, 1, 1);
break;
}
}
if (gPlayerEntity.frame == 3) {
switch (this->field_0x6e.HALF.HI) {
case ITEM_BOTTLE_WATER:
CreateObjectWithParent(this, OBJECT_68, 0, 0);
break;
case ITEM_BOTTLE_MINERAL_WATER:
CreateObjectWithParent(this, OBJECT_68, 1, 0);
break;
}
}
}
void sub_0801BDE8(Entity* this, Entity* ent2) {
u32 uVar1;
u32 flipX;
u32 animationState;
uVar1 = (ent2->frameIndex - this->actionDelay) + this->field_0xf;
if (uVar1 != this->frameIndex) {
this->frameIndex = uVar1;
sub_080042D0(this, this->frameIndex, (u16)this->spriteIndex);
}
flipX = ent2->spriteSettings.flipX;
animationState = (ent2->animationState >> 1);
this->spriteSettings.flipX = flipX ^ (animationState & 1);
sub_08078E84(this, &gPlayerEntity);
}
void PlayerItemBottle_UseEmptyBottle(Entity* this) {
static const s8 gUnk_080B7878[] = {
0, -16, 16, -16, 16, 0, 16, 16, 0, 16, -16, 16, -16, 0, -16, -16, 0, 0,
};
static const u8 bottleHitboxParameters[] = {
16, -4, 5, 5, 12, 0, 9, 9, 8, 0, 9, 9, 4, 8, 9, 9, -6, 12, 9, 9, -12, 2, 9, 9, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 5, 5, -4, -8, 9, 9, -8, -8,
9, 9, -12, -4, 9, 9, -16, 0, 9, 9, -6, 2, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -12, -6, 5, 5, -8, -12, 9, 9, -4, -16, 9, 9, 4, -16, 9, 9, 8, -16, 9, 9,
16, -12, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
int iVar2;
Hitbox* pHVar5;
const u8* ptr;
const s8* ptr2;
switch (this->bitfield & 0x7f) {
default:
this->bitfield = 0;
break;
case 0x49:
this->type2 = ITEM_BOTTLE_FAIRY;
sub_0801B9F0(this);
break;
case 0x4d:
this->type2 = ITEM_BOTTLE_MINERAL_WATER;
sub_0801B9F0(this);
break;
}
ptr = &bottleHitboxParameters[(this->frameIndex - 0x1b) * 4];
if (this->spriteSettings.flipX != 0) {
pHVar5 = this->hitbox;
pHVar5->offset_x = -ptr[0];
} else {
pHVar5 = this->hitbox;
pHVar5->offset_x = ptr[0];
}
this->hitbox->offset_y = ptr[1];
this->hitbox->width = ptr[2];
this->hitbox->height = ptr[3];
if ((gPlayerEntity.frame & 0xf) != 0) {
if (this->type2 == ITEM_BOTTLE_EMPTY) {
ptr2 = &gUnk_080B7878[((gPlayerEntity.frame & 0xf) - 1) * 2];
iVar2 = ptr2[0];
if (this->spriteSettings.flipX != 0) {
iVar2 = -iVar2;
}
if (sub_080002B4(this, iVar2, (s8)ptr2[1]) == 0x10) {
this->type2 = ITEM_BOTTLE_WATER;
}
}
}
if (this->type2 != ITEM_BOTTLE_EMPTY) {
COLLISION_OFF(&gPlayerEntity);
}
}
-25
View File
@@ -1,25 +0,0 @@
#include "entity.h"
extern void (*const gUnk_080B7870[])(Entity*);
void sub_0801BE38(Entity*);
void PlayerItemSwordSpin(Entity* this) {
gUnk_080B7870[this->action](this);
}
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BA18.inc", void sub_0801BA18(Entity* this))
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BB2C.inc", void sub_0801BB2C(Entity* this))
void sub_0801BC0C(Entity* this) {
sub_0801BE38(this);
}
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BC14.inc", void sub_0801BC14(Entity* this))
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BCB4.inc", void sub_0801BCB4(Entity* this))
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BDE8.inc", void sub_0801BDE8(Entity* this))
ASM_FUNC("asm/non_matching/playerItemSwordSpin/sub_0801BE38.inc", void sub_0801BE38(Entity* this))
+2 -2
View File
@@ -2130,8 +2130,8 @@ void sub_0807FBD4(Entity* entity, ScriptExecutionContext* context) {
void sub_0807FBFC(Entity* entity, ScriptExecutionContext* context) {
gSave.stats.charm = 0;
gSave.stats.charmTimer = 0;
gSave.stats.unkB = 0;
gSave.stats.unkTimer = 0;
gSave.stats.picolyteType = 0;
gSave.stats.picolyteTimer = 0;
gSave.stats.effect = 0;
gSave.stats.effectTimer = 0;
}
+1 -1
View File
@@ -1370,6 +1370,6 @@ const Song gSongTable[] = {
[SFX_21D] = { &sfx21D, MUSIC_PLAYER_1B, MUSIC_PLAYER_1B },
[SFX_21E] = { &sfx21E, MUSIC_PLAYER_1A, MUSIC_PLAYER_1A },
[SFX_21F] = { &sfx21F, MUSIC_PLAYER_19, MUSIC_PLAYER_19 },
[SFX_220] = { &sfx220, MUSIC_PLAYER_18, MUSIC_PLAYER_18 },
[SFX_PICOLYTE] = { &sfx220, MUSIC_PLAYER_18, MUSIC_PLAYER_18 },
[SFX_221] = { &sfx221, MUSIC_PLAYER_17, MUSIC_PLAYER_17 },
};