Decompile rest of objectUtils

This commit is contained in:
octorock 2022-02-22 09:17:17 +01:00
parent 6206ff831a
commit abb0272963
12 changed files with 333 additions and 364 deletions

View File

@ -0,0 +1,65 @@
.syntax unified
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r5, r1, #0
adds r4, r2, #0
bl CreateLargeWaterTrace
adds r6, r0, #0
cmp r6, #0
beq _080A2B74
bl Random
adds r7, r0, #0
subs r1, r4, r5
adds r1, #1
bl __modsi3
adds r4, r0, #0
adds r4, r4, r5
asrs r7, r7, #0x10
movs r0, #0xff
ands r7, r0
ldr r0, _080A2B7C @ =gSineTable
mov r8, r0
lsls r0, r7, #1
add r0, r8
movs r1, #0
ldrsh r0, [r0, r1]
lsls r4, r4, #0x18
asrs r4, r4, #0x10
adds r1, r4, #0
bl FixedMul
lsls r0, r0, #0x10
asrs r0, r0, #0x10
movs r5, #0x80
lsls r5, r5, #1
adds r1, r5, #0
bl FixedDiv
lsls r0, r0, #0x10
asrs r0, r0, #8
ldr r1, [r6, #0x2c]
adds r1, r1, r0
str r1, [r6, #0x2c]
adds r0, r7, #0
adds r0, #0x40
lsls r0, r0, #1
add r0, r8
movs r1, #0
ldrsh r0, [r0, r1]
adds r1, r4, #0
bl FixedMul
lsls r0, r0, #0x10
asrs r0, r0, #0x10
adds r1, r5, #0
bl FixedDiv
lsls r0, r0, #0x10
asrs r0, r0, #8
ldr r1, [r6, #0x30]
subs r1, r1, r0
str r1, [r6, #0x30]
_080A2B74:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
_080A2B7C: .4byte gSineTable
.syntax divided

View File

@ -0,0 +1,109 @@
.syntax unified
push {r4, r5, r6, lr}
adds r4, r0, #0
adds r6, r1, #0
ldrb r1, [r4, #0x15]
movs r0, #0x80
ands r0, r1
cmp r0, #0
bne _080A2CBA
lsrs r0, r1, #3
cmp r0, #1
beq _080A2C3C
cmp r0, #1
bgt _080A2C04
cmp r0, #0
beq _080A2C0E
b _080A2CBA
_080A2C04:
cmp r0, #2
beq _080A2C68
cmp r0, #3
beq _080A2C94
b _080A2CBA
_080A2C0E:
ldrh r5, [r4, #0x32]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x32]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r0, r0, r1
lsls r0, r0, #0x10
asrs r1, r0, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C38 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C38: .4byte gPlayerEntity
_080A2C3C:
ldrh r5, [r4, #0x2e]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x2e]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r1, r1, r0
lsls r1, r1, #0x10
asrs r1, r1, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C64 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #8
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C64: .4byte gPlayerEntity
_080A2C68:
ldrh r5, [r4, #0x32]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x32]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r1, r1, r0
lsls r1, r1, #0x10
asrs r1, r1, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C90 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0x10
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C90: .4byte gPlayerEntity
_080A2C94:
ldrh r5, [r4, #0x2e]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x2e]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r0, r0, r1
lsls r0, r0, #0x10
asrs r1, r0, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2CBC @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0x18
bl sub_080044AE
_080A2CBA:
pop {r4, r5, r6, pc}
.align 2, 0
_080A2CBC: .4byte gPlayerEntity
.syntax divided

View File

@ -1,340 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_080A2AF4
sub_080A2AF4: @ 0x080A2AF4
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r5, r1, #0
adds r4, r2, #0
bl CreateLargeWaterTrace
adds r6, r0, #0
cmp r6, #0
beq _080A2B74
bl Random
adds r7, r0, #0
subs r1, r4, r5
adds r1, #1
bl __modsi3
adds r4, r0, #0
adds r4, r4, r5
asrs r7, r7, #0x10
movs r0, #0xff
ands r7, r0
ldr r0, _080A2B7C @ =gSineTable
mov r8, r0
lsls r0, r7, #1
add r0, r8
movs r1, #0
ldrsh r0, [r0, r1]
lsls r4, r4, #0x18
asrs r4, r4, #0x10
adds r1, r4, #0
bl FixedMul
lsls r0, r0, #0x10
asrs r0, r0, #0x10
movs r5, #0x80
lsls r5, r5, #1
adds r1, r5, #0
bl FixedDiv
lsls r0, r0, #0x10
asrs r0, r0, #8
ldr r1, [r6, #0x2c]
adds r1, r1, r0
str r1, [r6, #0x2c]
adds r0, r7, #0
adds r0, #0x40
lsls r0, r0, #1
add r0, r8
movs r1, #0
ldrsh r0, [r0, r1]
adds r1, r4, #0
bl FixedMul
lsls r0, r0, #0x10
asrs r0, r0, #0x10
adds r1, r5, #0
bl FixedDiv
lsls r0, r0, #0x10
asrs r0, r0, #8
ldr r1, [r6, #0x30]
subs r1, r1, r0
str r1, [r6, #0x30]
_080A2B74:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
_080A2B7C: .4byte gSineTable
thumb_func_start CreateSparkle
CreateSparkle: @ 0x080A2B80
push {r4, r5, lr}
adds r5, r0, #0
movs r0, #0xf
movs r1, #0x26
movs r2, #0
bl CreateObject
adds r4, r0, #0
cmp r4, #0
beq _080A2BE0
bl Random
adds r3, r0, #0
movs r1, #0xf
adds r2, r3, #0
ands r2, r1
movs r0, #0x80
ands r0, r3
cmp r0, #0
beq _080A2BAA
rsbs r2, r2, #0
_080A2BAA:
lsrs r0, r3, #8
ands r0, r1
cmp r0, #4
ble _080A2BB4
rsbs r0, r0, #0
_080A2BB4:
lsls r2, r2, #0x10
lsls r3, r0, #0x10
adds r0, r5, #0
adds r1, r4, #0
bl PositionRelative
adds r0, r5, #0
adds r1, r4, #0
bl SortEntityAbove
adds r0, r5, #0
adds r0, #0x62
ldrb r0, [r0]
adds r1, r4, #0
adds r1, #0x62
strb r0, [r1]
adds r0, r5, #0
adds r0, #0x63
ldrb r1, [r0]
adds r0, r4, #0
adds r0, #0x63
strb r1, [r0]
_080A2BE0:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_080A2BE4
sub_080A2BE4: @ 0x080A2BE4
push {r4, r5, r6, lr}
adds r4, r0, #0
adds r6, r1, #0
ldrb r1, [r4, #0x15]
movs r0, #0x80
ands r0, r1
cmp r0, #0
bne _080A2CBA
lsrs r0, r1, #3
cmp r0, #1
beq _080A2C3C
cmp r0, #1
bgt _080A2C04
cmp r0, #0
beq _080A2C0E
b _080A2CBA
_080A2C04:
cmp r0, #2
beq _080A2C68
cmp r0, #3
beq _080A2C94
b _080A2CBA
_080A2C0E:
ldrh r5, [r4, #0x32]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x32]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r0, r0, r1
lsls r0, r0, #0x10
asrs r1, r0, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C38 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C38: .4byte gPlayerEntity
_080A2C3C:
ldrh r5, [r4, #0x2e]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x2e]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r1, r1, r0
lsls r1, r1, #0x10
asrs r1, r1, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C64 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #8
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C64: .4byte gPlayerEntity
_080A2C68:
ldrh r5, [r4, #0x32]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x32]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r1, r1, r0
lsls r1, r1, #0x10
asrs r1, r1, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2C90 @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0x10
bl sub_080044AE
b _080A2CBA
.align 2, 0
_080A2C90: .4byte gPlayerEntity
_080A2C94:
ldrh r5, [r4, #0x2e]
adds r0, r4, #0
bl LinearMoveUpdate
ldrh r1, [r4, #0x2e]
lsls r0, r5, #0x10
asrs r0, r0, #0x10
subs r0, r0, r1
lsls r0, r0, #0x10
asrs r1, r0, #0x10
cmp r1, #0
beq _080A2CBA
cmp r6, #0
beq _080A2CBA
ldr r0, _080A2CBC @ =gPlayerEntity
lsls r1, r1, #8
movs r2, #0x18
bl sub_080044AE
_080A2CBA:
pop {r4, r5, r6, pc}
.align 2, 0
_080A2CBC: .4byte gPlayerEntity
thumb_func_start sub_080A2CC0
sub_080A2CC0: @ 0x080A2CC0
push {r4, r5, lr}
adds r4, r0, #0
adds r5, r1, #0
ldr r3, [r5]
cmp r3, #0
beq _080A2CF8
ldrh r0, [r3]
cmp r0, #0xfe
bne _080A2CDC
ldrh r1, [r3, #2]
lsls r0, r1, #1
adds r0, r0, r1
lsls r0, r0, #1
subs r3, r3, r0
_080A2CDC:
ldrh r0, [r3]
cmp r0, #0xff
bne _080A2CEA
movs r0, #0xff
strb r0, [r4, #0x15]
movs r0, #0
b _080A2CEE
_080A2CEA:
strb r0, [r4, #0x15]
ldrh r0, [r3, #4]
_080A2CEE:
strh r0, [r4, #0x24]
ldrh r0, [r3, #2]
strh r0, [r2]
adds r0, r3, #6
str r0, [r5]
_080A2CF8:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start CreateSpeechBubbleExclamationMark
CreateSpeechBubbleExclamationMark: @ 0x080A2CFC
push {r4, lr}
adds r4, r1, #0
adds r3, r2, #0
movs r1, #0
adds r2, r4, #0
bl CreateSpeechBubble
pop {r4, pc}
thumb_func_start CreateSpeechBubbleQuestionMark
CreateSpeechBubbleQuestionMark: @ 0x080A2D0C
push {r4, lr}
adds r4, r1, #0
adds r3, r2, #0
movs r1, #1
adds r2, r4, #0
bl CreateSpeechBubble
pop {r4, pc}
thumb_func_start CreateSpeechBubbleSleep
CreateSpeechBubbleSleep: @ 0x080A2D1C
push {r4, lr}
adds r4, r1, #0
adds r3, r2, #0
movs r1, #2
adds r2, r4, #0
bl CreateSpeechBubble
pop {r4, pc}
thumb_func_start CreateSpeechBubble
CreateSpeechBubble: @ 0x080A2D2C
push {r4, r5, r6, r7, lr}
adds r5, r0, #0
adds r4, r1, #0
adds r6, r2, #0
adds r7, r3, #0
movs r0, #0x56
movs r1, #0
adds r2, r4, #0
bl CreateObject
adds r4, r0, #0
cmp r4, #0
beq _080A2D6E
adds r0, r5, #0
adds r1, r4, #0
bl CopyPosition
adds r0, r5, #0
adds r1, r4, #0
bl SortEntityAbove
str r5, [r4, #0x50]
adds r0, r4, #0
adds r0, #0x62
strb r6, [r0]
adds r0, #1
strb r7, [r0]
ldrb r1, [r5, #0x11]
lsls r1, r1, #0x1c
lsrs r1, r1, #0x1c
adds r0, r4, #0
bl SetDefaultPriority
_080A2D6E:
adds r0, r4, #0
pop {r4, r5, r6, r7, pc}
.align 2, 0

View File

@ -18,7 +18,10 @@ extern u32 CheckOnScreen(Entity*);
extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
extern void CopyOAM(void);
extern void CreateChestSpawner(Entity*);
extern Entity* CreateGroundItem(Entity*, u32, u32);
extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32);
extern void CreateItemOnGround(Entity*);
extern Entity* CreateLargeWaterTrace(Entity*);
extern void CreateMagicSparkles(u32, u32, u32);
extern void CreateMinishEntrance(u32 tile);
extern Entity* CreatePlayerBomb(ItemBehavior*, u32);
@ -232,11 +235,10 @@ extern void sub_0809EABC(Entity*);
extern void sub_0809EAD8(Entity*);
extern void sub_0809EB30(Entity*);
extern void sub_080A1ED0(u32, u32, u32);
extern Entity* CreateGroundItem(Entity*, u32, u32);
extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32);
extern Entity* CreateLargeWaterTrace(Entity*);
extern void sub_080A2AF4(Entity*, u32, u32);
extern void sub_080A2CC0(Entity*, Entity**, u16*);
extern Entity* sub_080A2A3C(Entity*, u32, u32, u32);
extern Entity* sub_080A2AD4(Entity*);
extern void sub_080A2AF4(Entity*, s32, s32);
extern void sub_080A2CC0(Entity*, u16**, u16*);
extern void sub_080A57F4(void);
extern void sub_080A71C4(u32, u32, u32, u32);
extern void sub_080A7C18(u32, u32, u32);

View File

@ -822,7 +822,6 @@ SECTIONS {
src/object/objectC1.o(.text);
/* END objects */
src/objectUtils.o(.text);
asm/objectUtils.o(.text);
src/playerItem/playerItemShield.o(.text);
src/playerItem/playerItem15.o(.text);
#ifdef DEMO_USA

View File

@ -14,7 +14,7 @@ void BladeTrap(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->child = GetCurrentRoomProperty(this->type);
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
if (!(this->direction & 0x80)) {
LinearMoveUpdate(this);
@ -24,6 +24,6 @@ void BladeTrap(Entity* this) {
if (!(this->direction & 0x80)) {
EnqueueSFX(SFX_METAL_CLINK);
}
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
}

View File

@ -27,7 +27,7 @@ void Bombarossa_OnTick(BombarossaEntity* this) {
InitializeAnimation(super, 0);
if (super->type != 0) {
super->child = GetCurrentRoomProperty(super->type);
sub_080A2CC0(super, &super->child, &this->unk_0x76);
sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
}
}
@ -68,7 +68,7 @@ void sub_0803350C(BombarossaEntity* this) {
}
if (--this->unk_0x76 == 0) {
sub_080A2CC0(super, &super->child, &this->unk_0x76);
sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76);
}
}

View File

@ -118,7 +118,7 @@ void sub_0803CDD8(Entity* this) {
void sub_0803CE14(Entity* this) {
u8 direction;
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
direction = this->direction;
if (direction & 0x80) {

View File

@ -32,8 +32,6 @@ typedef struct {
/*0x0e*/ u8 unk_e[2];
} LavaPlatformEntry;
extern void sub_080A2CC0(Entity*, Entity**, u16*);
void sub_08092278(LavaPlatformEntity*);
void sub_08092344(LavaPlatformEntity*);
void LavaPlatform_SpawnPlatforms(LavaPlatformEntity*);
@ -248,7 +246,7 @@ void LavaPlatform_SpawnPlatforms(LavaPlatformEntity* this) {
platform->respawnTime = entry->respawnTime;
platform->unk_78 = entry->unk_78;
UpdateSpriteForCollisionLayer((Entity*)platform);
sub_080A2CC0(&platform->base, &platform->unk_78, &platform->unk_76);
sub_080A2CC0(&platform->base, (u16**)&platform->unk_78, &platform->unk_76);
}
entry++;
}
@ -302,6 +300,6 @@ void sub_080926E4(LavaPlatformEntity* this) {
(super->parent)->y.HALF.HI = super->y.HALF.HI;
}
if (--this->unk_76 == 0) {
sub_080A2CC0(super, &this->unk_78, &this->unk_76);
sub_080A2CC0(super, (u16**)&this->unk_78, &this->unk_76);
}
}

View File

@ -65,7 +65,7 @@ void sub_0809EAD8(Entity* this) {
if (this->type2 != 0) {
this->child = GetCurrentRoomProperty(this->type2);
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD);
} else {
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
@ -82,7 +82,7 @@ void sub_0809EB30(Entity* this) {
}
puVar2 = &this->field_0x74.HWORD;
if (!--*puVar2) {
sub_080A2CC0(this, &this->child, puVar2);
sub_080A2CC0(this, (u16**)&this->child, puVar2);
}
}
}

View File

@ -1,8 +1,6 @@
#include "object.h"
#include "functions.h"
extern void sub_080A2CC0(Entity*, Entity**, u16*);
extern u16 gUnk_08123318[];
static void sub_08097B24(Entity* this);
@ -21,13 +19,13 @@ void LilypadSmall(Entity* this) {
this->spriteSettings.draw = TRUE;
this->spritePriority.b0 = 7;
this->child = GetCurrentRoomProperty(this->type2);
sub_080A2CC0(this, &this->child, &this->field_0x70.HALF.LO);
sub_080A2CC0(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
}
sub_080A2BE4(this, sub_08097ADC(this));
sub_08097B24(this);
psVar4 = (u16*)&this->field_0x70;
if (--*psVar4 == 0) {
sub_080A2CC0(this, &this->child, psVar4);
sub_080A2CC0(this, (u16**)&this->child, psVar4);
}
}

View File

@ -12,6 +12,10 @@ u32 LoadObjectSprite(Entity* this, s32 type, const ObjectDefinition* definition)
extern const ObjectDefinition gObjectDefinitions[];
extern Entity* sub_0805E744(void);
Entity* CreateWaterTrace(Entity*);
Entity* CreateSpeechBubble(Entity*, u32, s32, s32);
Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) {
Entity* e = sub_0805E744();
if (e != NULL) {
@ -206,11 +210,145 @@ void CreateRandomWaterTrace(Entity* parent, int range) {
}
Entity* CreateLargeWaterTrace(Entity* parent) {
Entity* ent;
ent = CreateFx(parent, FX_RIPPLE_LARGE, 0);
Entity* ent = CreateFx(parent, FX_RIPPLE_LARGE, 0);
if (ent != NULL) {
ent->spritePriority.b0 = 7;
}
return ent;
}
NONMATCH("asm/non_matching/objectUtils/sub_080A2AF4.inc", void sub_080A2AF4(Entity* parent, s32 param_2, s32 param_3)) {
Entity* entity;
s32 rand;
s32 radius;
u32 angle;
s32 tmp;
entity = CreateLargeWaterTrace(parent);
if (entity != NULL) {
rand = Random();
radius = (rand % (param_3 - param_2 + 1)) + param_2;
angle = rand >> 0x10 & 0xff;
radius *= 0x100;
tmp = FixedMul(gSineTable[angle], radius);
tmp = FixedDiv(tmp, 0x100);
entity->x.WORD += ((tmp << 0x10) >> 8);
tmp = FixedMul(gSineTable[angle + 0x40], radius);
tmp = FixedDiv(tmp, 0x100);
entity->y.WORD -= ((tmp << 0x10) >> 8);
}
}
END_NONMATCH
void CreateSparkle(Entity* entity) {
Entity* sparkle;
u32 rand;
s32 y;
s32 x;
sparkle = CreateObject(SPECIAL_FX, 0x26, 0);
if (sparkle != NULL) {
rand = Random();
x = rand & 0xf;
if ((rand & 0x80) != 0) {
x = -x;
}
y = rand >> 8 & 0xf;
if (4 < y) {
y = -y;
}
PositionRelative(entity, sparkle, x << 0x10, y << 0x10);
SortEntityAbove(entity, sparkle);
sparkle->spriteOffsetX = entity->spriteOffsetX;
sparkle->spriteOffsetY = entity->spriteOffsetY;
}
}
NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Entity* this, u32 param_2)) {
s16 oldValue;
s32 diff;
u16 newValue;
if ((this->direction & 0x80) == 0) {
switch (this->direction >> 3) {
case 0:
oldValue = this->y.HALF_U.HI;
LinearMoveUpdate(this);
newValue = this->y.HALF_U.HI;
diff = ((oldValue - newValue) << 0x10) >> 0x10;
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0);
}
break;
case 1:
oldValue = this->x.HALF_U.HI;
LinearMoveUpdate(this);
diff = ((this->x.HALF_U.HI - oldValue) * 0x10000) >> 0x10;
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 8);
}
break;
case 2:
oldValue = this->y.HALF_U.HI;
LinearMoveUpdate(this);
diff = ((this->y.HALF_U.HI - oldValue) * 0x10000) >> 0x10;
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x10);
}
break;
case 3:
oldValue = this->x.HALF_U.HI;
LinearMoveUpdate(this);
newValue = this->x.HALF_U.HI;
diff = ((oldValue - newValue) << 0x10) >> 0x10;
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x18);
}
break;
}
}
}
END_NONMATCH
void sub_080A2CC0(Entity* this, u16** param_2, u16* param_3) {
u16* ptr = *param_2;
if (ptr != NULL) {
if (*ptr == 0xfe) {
ptr = ptr + (u32)ptr[1] * -3;
}
if (*ptr == 0xff) {
this->direction = 0xff;
this->speed = 0;
} else {
this->direction = (u8)*ptr;
this->speed = ptr[2];
}
*param_3 = ptr[1];
*param_2 = ptr + 3;
}
}
Entity* CreateSpeechBubbleExclamationMark(Entity* parent, s32 offsetX, s32 offsetY) {
return CreateSpeechBubble(parent, 0, offsetX, offsetY);
}
Entity* CreateSpeechBubbleQuestionMark(Entity* parent, s32 offsetX, s32 offsetY) {
return CreateSpeechBubble(parent, 1, offsetX, offsetY);
}
Entity* CreateSpeechBubbleSleep(Entity* parent, s32 offsetX, s32 offsetY) {
return CreateSpeechBubble(parent, 2, offsetX, offsetY);
}
Entity* CreateSpeechBubble(Entity* parent, u32 type2, s32 xOffset, s32 yOffset) {
Entity* obj = CreateObject(THOUGHT_BUBBLE, 0, type2);
if (obj != NULL) {
CopyPosition(parent, obj);
SortEntityAbove(parent, obj);
obj->parent = parent;
obj->spriteOffsetX = xOffset;
obj->spriteOffsetY = yOffset;
SetDefaultPriority(obj, parent->updatePriority);
}
return obj;
}