Merge pull request #416 from hatal175/giantrock

Decompile GiantRock and GiantRock2
This commit is contained in:
notyourav 2022-03-02 13:04:09 -08:00 committed by GitHub
commit 00c79925f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 149 deletions

View File

@ -1,42 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start GiantRock
GiantRock: @ 0x08090FB8
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #0
bne _08090FF6
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
adds r1, r4, #0
adds r1, #0x38
movs r0, #2
strb r0, [r1]
adds r0, r4, #0
bl UpdateSpriteForCollisionLayer
adds r2, r4, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #8
rsbs r0, r0, #0
ands r0, r1
strb r0, [r2]
ldrb r1, [r4, #0xa]
adds r0, r4, #0
bl InitializeAnimation
_08090FF6:
pop {r4, pc}

View File

@ -1,95 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start GiantRock2
GiantRock2: @ 0x08090FF8
push {lr}
ldr r2, _0809100C @ =gUnk_08122278
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_0809100C: .4byte gUnk_08122278
thumb_func_start sub_08091010
sub_08091010: @ 0x08091010
push {r4, r5, r6, r7, lr}
adds r4, r0, #0
movs r0, #1
strb r0, [r4, #0xc]
movs r0, #0x2e
ldrsh r1, [r4, r0]
ldr r2, _08091094 @ =gRoomControls
ldrh r0, [r2, #6]
subs r1, r1, r0
asrs r1, r1, #4
movs r3, #0x3f
ands r1, r3
movs r5, #0x32
ldrsh r0, [r4, r5]
ldrh r2, [r2, #8]
subs r0, r0, r2
asrs r0, r0, #4
ands r0, r3
lsls r0, r0, #6
orrs r1, r0
adds r3, r4, #0
adds r3, #0x74
strh r1, [r3]
adds r0, r4, #0
adds r0, #0x38
ldrb r5, [r0]
adds r2, r4, #0
adds r2, #0x29
ldrb r0, [r2]
movs r1, #7
orrs r0, r1
strb r0, [r2]
ldrh r0, [r3]
subs r0, #0x80
lsls r0, r0, #0x10
lsrs r4, r0, #0x10
ldr r6, _08091098 @ =0x00004022
movs r7, #4
_0809105C:
subs r1, r4, #2
adds r0, r6, #0
adds r2, r5, #0
bl SetTile
subs r1, r4, #1
adds r0, r6, #0
adds r2, r5, #0
bl SetTile
adds r0, r6, #0
adds r1, r4, #0
adds r2, r5, #0
bl SetTile
adds r1, r4, #1
adds r0, r6, #0
adds r2, r5, #0
bl SetTile
adds r0, r4, #0
adds r0, #0x40
lsls r0, r0, #0x10
lsrs r4, r0, #0x10
subs r7, #1
cmp r7, #0
bge _0809105C
pop {r4, r5, r6, r7, pc}
.align 2, 0
_08091094: .4byte gRoomControls
_08091098: .4byte 0x00004022
thumb_func_start nullsub_523
nullsub_523: @ 0x0809109C
bx lr
.align 2, 0

View File

@ -1,9 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08122278:: @ 08122278
.4byte sub_08091010
.4byte nullsub_523

View File

@ -725,8 +725,8 @@ SECTIONS {
src/object/furniture.o(.text); src/object/furniture.o(.text);
src/object/minishSizedEntrance.o(.text); src/object/minishSizedEntrance.o(.text);
src/object/archway.o(.text); src/object/archway.o(.text);
asm/object/giantRock.o(.text); src/object/giantRock.o(.text);
asm/object/giantRock2.o(.text); src/object/giantRock2.o(.text);
asm/object/object52.o(.text); asm/object/object52.o(.text);
asm/object/object53.o(.text); asm/object/object53.o(.text);
src/object/pullableLever.o(.text); src/object/pullableLever.o(.text);
@ -1466,7 +1466,7 @@ SECTIONS {
src/object/furniture.o(.rodata); src/object/furniture.o(.rodata);
data/const/object/minishSizedEntrance.o(.rodata); data/const/object/minishSizedEntrance.o(.rodata);
data/animations/object/minishSizedEntrance.o(.rodata); data/animations/object/minishSizedEntrance.o(.rodata);
data/const/object/giantRock2.o(.rodata); src/object/giantRock2.o(.rodata);
data/const/object/object53.o(.rodata); data/const/object/object53.o(.rodata);
src/object/pullableLever.o(.rodata); src/object/pullableLever.o(.rodata);
data/animations/object/pullableLever.o(.rodata); data/animations/object/pullableLever.o(.rodata);

12
src/object/giantRock.c Normal file
View File

@ -0,0 +1,12 @@
#include "entity.h"
void GiantRock(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
this->spritePriority.b0 = 0;
InitializeAnimation(this, this->type);
}
}

45
src/object/giantRock2.c Normal file
View File

@ -0,0 +1,45 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "room.h"
#include "asm.h"
typedef struct {
Entity base;
u8 filler[0xC];
u16 tile;
} GiantRock2Entity;
void GiantRock2_Init(GiantRock2Entity*);
void GiantRock2_Idle(GiantRock2Entity*);
void GiantRock2(Entity* this) {
static void (*const actionFuncs[])(GiantRock2Entity*) = {
GiantRock2_Init,
GiantRock2_Idle,
};
actionFuncs[this->action]((GiantRock2Entity*)this);
}
void GiantRock2_Init(GiantRock2Entity* this) {
u32 collisionLayer;
u16 position;
int index;
u32 tileIndex;
super->action = 1;
this->tile = COORD_TO_TILE(super);
collisionLayer = super->collisionLayer;
super->spritePriority.b0 = 7;
position = (this->tile - 0x80);
tileIndex = 0x4022;
for (index = 4; index > -1; index--) {
SetTile(tileIndex, position - 2, collisionLayer);
SetTile(tileIndex, position - 1, collisionLayer);
SetTile(tileIndex, position, collisionLayer);
SetTile(tileIndex, position + 1, collisionLayer);
position += 0x40;
}
}
void GiantRock2_Idle(GiantRock2Entity* this) {
}