mirror of https://github.com/zeldaret/tmc.git
Decompile bollard
This commit is contained in:
parent
597f3d9721
commit
0aa031f250
|
@ -1,236 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
thumb_func_start Bollard
|
||||
Bollard: @ 0x0808B294
|
||||
push {lr}
|
||||
ldr r2, _0808B2A8 @ =gUnk_08121300
|
||||
ldrb r1, [r0, #0xc]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r2
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
_0808B2A8: .4byte gUnk_08121300
|
||||
|
||||
thumb_func_start sub_0808B2AC
|
||||
sub_0808B2AC: @ 0x0808B2AC
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xb]
|
||||
cmp r0, #0
|
||||
bne _0808B2C4
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B41C
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B3AC
|
||||
b _0808B2CA
|
||||
_0808B2C4:
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B42C
|
||||
_0808B2CA:
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_0808B2CC
|
||||
sub_0808B2CC: @ 0x0808B2CC
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xb]
|
||||
cmp r0, #0
|
||||
bne _0808B2E6
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x86
|
||||
ldrh r0, [r0]
|
||||
bl CheckFlags
|
||||
cmp r0, #0
|
||||
beq _0808B31C
|
||||
b _0808B2F4
|
||||
_0808B2E6:
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x86
|
||||
ldrh r0, [r0]
|
||||
bl CheckFlags
|
||||
cmp r0, #0
|
||||
bne _0808B31C
|
||||
_0808B2F4:
|
||||
movs r0, #2
|
||||
strb r0, [r4, #0xc]
|
||||
adds r0, r4, #0
|
||||
movs r1, #3
|
||||
bl InitializeAnimation
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x72
|
||||
ldrh r0, [r0]
|
||||
adds r1, r4, #0
|
||||
adds r1, #0x70
|
||||
ldrh r1, [r1]
|
||||
adds r2, r4, #0
|
||||
adds r2, #0x38
|
||||
ldrb r2, [r2]
|
||||
bl SetTile
|
||||
ldr r0, _0808B320 @ =0x000001A5
|
||||
bl EnqueueSFX
|
||||
_0808B31C:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_0808B320: .4byte 0x000001A5
|
||||
|
||||
thumb_func_start sub_0808B324
|
||||
sub_0808B324: @ 0x0808B324
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
bl GetNextFrame
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x5a
|
||||
ldrb r1, [r0]
|
||||
movs r0, #0x80
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _0808B340
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B42C
|
||||
_0808B340:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_0808B344
|
||||
sub_0808B344: @ 0x0808B344
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
ldrb r0, [r4, #0xb]
|
||||
cmp r0, #0
|
||||
bne _0808B35E
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x86
|
||||
ldrh r0, [r0]
|
||||
bl CheckFlags
|
||||
cmp r0, #0
|
||||
bne _0808B384
|
||||
b _0808B36C
|
||||
_0808B35E:
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x86
|
||||
ldrh r0, [r0]
|
||||
bl CheckFlags
|
||||
cmp r0, #0
|
||||
beq _0808B384
|
||||
_0808B36C:
|
||||
movs r0, #4
|
||||
strb r0, [r4, #0xc]
|
||||
adds r0, r4, #0
|
||||
movs r1, #2
|
||||
bl InitializeAnimation
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B3AC
|
||||
ldr r0, _0808B388 @ =0x000001A5
|
||||
bl EnqueueSFX
|
||||
_0808B384:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
_0808B388: .4byte 0x000001A5
|
||||
|
||||
thumb_func_start sub_0808B38C
|
||||
sub_0808B38C: @ 0x0808B38C
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
bl GetNextFrame
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x5a
|
||||
ldrb r1, [r0]
|
||||
movs r0, #0x80
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _0808B3A8
|
||||
adds r0, r4, #0
|
||||
bl sub_0808B41C
|
||||
_0808B3A8:
|
||||
pop {r4, pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_0808B3AC
|
||||
sub_0808B3AC: @ 0x0808B3AC
|
||||
push {r4, r5, r6, lr}
|
||||
adds r6, r0, #0
|
||||
adds r2, r6, #0
|
||||
adds r2, #0x29
|
||||
ldrb r1, [r2]
|
||||
movs r0, #8
|
||||
rsbs r0, r0, #0
|
||||
ands r0, r1
|
||||
movs r1, #4
|
||||
orrs r0, r1
|
||||
strb r0, [r2]
|
||||
movs r0, #0x2e
|
||||
ldrsh r1, [r6, r0]
|
||||
ldr r2, _0808B414 @ =gRoomControls
|
||||
ldrh r0, [r2, #6]
|
||||
subs r1, r1, r0
|
||||
asrs r1, r1, #4
|
||||
movs r3, #0x3f
|
||||
ands r1, r3
|
||||
movs r4, #0x32
|
||||
ldrsh r0, [r6, r4]
|
||||
ldrh r2, [r2, #8]
|
||||
subs r0, r0, r2
|
||||
asrs r0, r0, #4
|
||||
ands r0, r3
|
||||
lsls r0, r0, #6
|
||||
orrs r1, r0
|
||||
adds r4, r6, #0
|
||||
adds r4, #0x70
|
||||
strh r1, [r4]
|
||||
ldrh r0, [r4]
|
||||
adds r5, r6, #0
|
||||
adds r5, #0x38
|
||||
ldrb r1, [r5]
|
||||
bl GetTileIndex
|
||||
adds r1, r6, #0
|
||||
adds r1, #0x72
|
||||
strh r0, [r1]
|
||||
ldrh r0, [r4]
|
||||
ldrb r1, [r5]
|
||||
bl sub_080002E0
|
||||
adds r1, r6, #0
|
||||
adds r1, #0x74
|
||||
strb r0, [r1]
|
||||
ldr r0, _0808B418 @ =0x0000400B
|
||||
ldrh r1, [r4]
|
||||
ldrb r2, [r5]
|
||||
bl SetTile
|
||||
pop {r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_0808B414: .4byte gRoomControls
|
||||
_0808B418: .4byte 0x0000400B
|
||||
|
||||
thumb_func_start sub_0808B41C
|
||||
sub_0808B41C: @ 0x0808B41C
|
||||
push {lr}
|
||||
movs r1, #1
|
||||
strb r1, [r0, #0xc]
|
||||
movs r1, #0
|
||||
bl InitializeAnimation
|
||||
pop {pc}
|
||||
.align 2, 0
|
||||
|
||||
thumb_func_start sub_0808B42C
|
||||
sub_0808B42C: @ 0x0808B42C
|
||||
push {lr}
|
||||
movs r1, #3
|
||||
strb r1, [r0, #0xc]
|
||||
adds r3, r0, #0
|
||||
adds r3, #0x29
|
||||
ldrb r1, [r3]
|
||||
movs r2, #7
|
||||
orrs r1, r2
|
||||
strb r1, [r3]
|
||||
movs r1, #1
|
||||
bl InitializeAnimation
|
||||
pop {pc}
|
||||
.align 2, 0
|
|
@ -1,12 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnk_08121300:: @ 08121300
|
||||
.4byte sub_0808B2AC
|
||||
.4byte sub_0808B2CC
|
||||
.4byte sub_0808B324
|
||||
.4byte sub_0808B344
|
||||
.4byte sub_0808B38C
|
|
@ -693,7 +693,7 @@ SECTIONS {
|
|||
asm/object/object30.o(.text);
|
||||
src/object/frozenFlower.o(.text);
|
||||
src/object/pullableMushroom.o(.text);
|
||||
asm/object/bollard.o(.text);
|
||||
src/object/bollard.o(.text);
|
||||
src/object/warpPoint.o(.text);
|
||||
asm/object/object35.o(.text);
|
||||
asm/object/object36.o(.text);
|
||||
|
@ -1424,7 +1424,7 @@ SECTIONS {
|
|||
data/const/object/object31.o(.rodata);
|
||||
src/object/pullableMushroom.o(.rodata);
|
||||
data/animations/object/pullableMushroom.o(.rodata);
|
||||
data/const/object/bollard.o(.rodata);
|
||||
src/object/bollard.o(.rodata);
|
||||
data/animations/object/bollard.o(.rodata);
|
||||
src/object/warpPoint.o(.rodata);
|
||||
data/animations/object/warpPoint.o(.rodata);
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "asm.h"
|
||||
#include "sound.h"
|
||||
#include "room.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 filler[0x8];
|
||||
u16 tile;
|
||||
u16 tileIndex;
|
||||
u8 unk74;
|
||||
u8 unk75;
|
||||
u8 filler2[0x10];
|
||||
u16 flags;
|
||||
} BollardEntity;
|
||||
|
||||
void sub_0808B2AC(BollardEntity*);
|
||||
void sub_0808B2CC(BollardEntity*);
|
||||
void sub_0808B324(BollardEntity*);
|
||||
void sub_0808B344(BollardEntity*);
|
||||
void sub_0808B38C(BollardEntity*);
|
||||
void sub_0808B41C(BollardEntity*);
|
||||
void sub_0808B3AC(BollardEntity*);
|
||||
void sub_0808B42C(BollardEntity*);
|
||||
|
||||
void Bollard(Entity* this) {
|
||||
static void (*const actionFuncs[])(BollardEntity*) = {
|
||||
sub_0808B2AC, sub_0808B2CC, sub_0808B324, sub_0808B344, sub_0808B38C,
|
||||
};
|
||||
|
||||
actionFuncs[this->action]((BollardEntity*)this);
|
||||
}
|
||||
|
||||
void sub_0808B2AC(BollardEntity* this) {
|
||||
if (super->type2 == 0) {
|
||||
sub_0808B41C(this);
|
||||
sub_0808B3AC(this);
|
||||
} else {
|
||||
sub_0808B42C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B2CC(BollardEntity* this) {
|
||||
if (super->type2 == 0) {
|
||||
if (CheckFlags(this->flags) == 0) {
|
||||
return;
|
||||
}
|
||||
} else if (CheckFlags(this->flags) != 0) {
|
||||
return;
|
||||
}
|
||||
super->action = 2;
|
||||
InitializeAnimation(super, 3);
|
||||
SetTile(this->tileIndex, this->tile, super->collisionLayer);
|
||||
EnqueueSFX(SFX_1A5);
|
||||
}
|
||||
|
||||
void sub_0808B324(BollardEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if (super->frame & 0x80) {
|
||||
sub_0808B42C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B344(BollardEntity* this) {
|
||||
if (super->type2 == 0) {
|
||||
if (CheckFlags(this->flags) != 0) {
|
||||
return;
|
||||
}
|
||||
} else if (CheckFlags(this->flags) == 0) {
|
||||
return;
|
||||
}
|
||||
super->action = 4;
|
||||
InitializeAnimation(super, 2);
|
||||
sub_0808B3AC(this);
|
||||
EnqueueSFX(SFX_1A5);
|
||||
}
|
||||
|
||||
void sub_0808B38C(BollardEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if (super->frame & 0x80) {
|
||||
sub_0808B41C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B3AC(BollardEntity* this) {
|
||||
super->spritePriority.b0 = 4;
|
||||
this->tile = COORD_TO_TILE(super);
|
||||
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
|
||||
this->unk74 = sub_080002E0(this->tile, super->collisionLayer);
|
||||
SetTile(0x400b, this->tile, super->collisionLayer);
|
||||
}
|
||||
|
||||
void sub_0808B41C(BollardEntity* this) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 0);
|
||||
}
|
||||
|
||||
void sub_0808B42C(BollardEntity* this) {
|
||||
super->action = 3;
|
||||
super->spritePriority.b0 = 7;
|
||||
InitializeAnimation(super, 1);
|
||||
}
|
Loading…
Reference in New Issue