Merge pull request #95 from Macrepeh:master

Pinwheel.Floating block
This commit is contained in:
notyourav
2020-10-19 16:08:19 -07:00
committed by GitHub
5 changed files with 58 additions and 136 deletions
-39
View File
@@ -1,39 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start FloatingBlock
FloatingBlock: @ 0x080A0554
push {lr}
adds r3, r0, #0
ldrb r0, [r3, #0xc]
cmp r0, #0
bne _080A0588
movs r2, #1
strb r2, [r3, #0xc]
ldrb r0, [r3, #0xa]
strb r0, [r3, #0x1e]
movs r0, #0x29
adds r0, r0, r3
mov ip, r0
ldrb r1, [r0]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
movs r1, #6
orrs r0, r1
mov r1, ip
strb r0, [r1]
adds r0, r3, #0
adds r0, #0x38
strb r2, [r0]
adds r0, r3, #0
bl UpdateSpriteForCollisionLayer
_080A0588:
pop {pc}
.align 2, 0
-95
View File
@@ -1,95 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Pinwheel
Pinwheel: @ 0x080A23A0
push {r4, lr}
adds r4, r0, #0
adds r0, #0x45
ldrb r1, [r0]
movs r0, #0x7f
ands r0, r1
cmp r0, #0
beq _080A23C0
ldr r0, _080A23D4 @ =gUnk_020342F8
subs r1, #1
bl ReadBit
cmp r0, #0
bne _080A23C0
bl DeleteThisEntity
_080A23C0:
ldr r0, _080A23D8 @ =gUnk_0812505C
ldrb r1, [r4, #0xc]
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r4, #0
bl _call_via_r1
pop {r4, pc}
.align 2, 0
_080A23D4: .4byte gUnk_020342F8
_080A23D8: .4byte gUnk_0812505C
thumb_func_start sub_080A23DC
sub_080A23DC: @ 0x080A23DC
push {r4, lr}
adds r4, r0, #0
ldr r1, _080A240C @ =gUnk_08125050
ldrb r0, [r4, #0xb]
lsls r0, r0, #1
adds r0, r0, r1
ldrh r0, [r0]
adds r2, r4, #0
adds r2, #0x68
strh r0, [r2]
adds r3, r4, #0
adds r3, #0x29
ldrb r0, [r3]
movs r1, #7
orrs r0, r1
strb r0, [r3]
ldrh r0, [r2]
bl CheckLocalFlag
cmp r0, #0
beq _080A2410
movs r0, #2
b _080A2412
.align 2, 0
_080A240C: .4byte gUnk_08125050
_080A2410:
movs r0, #1
_080A2412:
strb r0, [r4, #0xc]
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
pop {r4, pc}
.align 2, 0
thumb_func_start sub_080A2420
sub_080A2420: @ 0x080A2420
push {r4, lr}
adds r4, r0, #0
adds r0, #0x68
ldrh r0, [r0]
bl CheckLocalFlag
cmp r0, #0
beq _080A243A
movs r0, #2
strb r0, [r4, #0xc]
adds r0, r4, #0
bl CreateDust
_080A243A:
pop {r4, pc}
thumb_func_start sub_080A243C
sub_080A243C: @ 0x080A243C
push {lr}
bl GetNextFrame
pop {pc}
+2 -2
View File
@@ -853,7 +853,7 @@ SECTIONS {
asm/objectAB.o(.text);
asm/fourElements.o(.text);
asm/objectAD.o(.text);
asm/floatingBlock.o(.text);
src/object/floatingBlock.o(.text);
src/object/objectAF.o(.text);
src/object/metalDoor.o(.text);
src/object/jailBars.o(.text);
@@ -869,7 +869,7 @@ SECTIONS {
src/object/windcrest.o(.text);
asm/litArea.o(.text);
asm/objectBD.o(.text);
asm/pinwheel.o(.text);
src/object/pinwheel.o(.text);
asm/objectBF.o(.text);
asm/enemyItem.o(.text);
asm/objectC1.o(.text);
+13
View File
@@ -0,0 +1,13 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
void FloatingBlock(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->frameIndex=this->entityType.form;
this->spritePriority.b0 = 0xe;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
}
}
+43
View File
@@ -0,0 +1,43 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
extern u32 ReadBit(u32*, u32);
extern void DeleteThisEntity();
extern u32 CheckLocalFlag(u32);
extern u32 gUnk_020342F8;
extern u16 gUnk_08125050[];
extern void (*gUnk_0812505C[])(Entity*);
void Pinwheel(Entity* this) {
u16 x = this->currentHealth;
if ((x & 0x7f) != 0) {
if (ReadBit(&gUnk_020342F8,x-1) == 0) {
DeleteThisEntity();
}
}
gUnk_0812505C[this->action](this);
}
void sub_080A23DC(Entity *this) {
this->field_0x68.HWORD = gUnk_08125050[this->entityType.parameter];
this->spritePriority.b0 = 7;
if (CheckLocalFlag(this->field_0x68.HWORD) !=0) {
this->action = 2;
}
else {
this->action = 1;
}
InitializeAnimation(this,0);
}
void sub_080A2420(Entity *this) {
if (CheckLocalFlag(this->field_0x68.HWORD) != 0) {
this->action = 2;
CreateDust(this);
}
}
void sub_080A243C(Entity *this) {
GetNextFrame(this);
}