Decompile more functions

This commit is contained in:
KDSKardabox 2018-02-18 04:30:20 +05:30
parent e518a40508
commit 52b631a092
3 changed files with 414 additions and 352 deletions

View File

@ -5,363 +5,284 @@
.text .text
thumb_func_start sub_81BE7F4 // thumb_func_start sp136_strengh_sound
sub_81BE7F4: @ 81BE7F4 //sp136_strengh_sound: @ 81BE89C
push {lr} // push {r4-r6,lr}
ldr r0, =sub_81BE808 // mov r6, r8
movs r1, 0x8 // push {r6}
bl CreateTask // mov r8, r0
pop {r0} // adds r4, r1, 0
bx r0 // adds r5, r2, 0
.pool // adds r6, r3, 0
thumb_func_end sub_81BE7F4 // lsls r0, 24
// lsrs r0, 24
// mov r8, r0
// lsls r4, 24
// lsrs r4, 24
// lsls r5, 24
// lsrs r5, 24
// lsls r6, 24
// lsrs r6, 24
// ldr r0, =sub_81BE900
// movs r1, 0x9
// bl CreateTask
// lsls r0, 24
// lsrs r0, 24
// ldr r2, =gTasks
// lsls r1, r0, 2
// adds r1, r0
// lsls r1, 3
// adds r1, r2
// movs r0, 0
// strh r4, [r1, 0x8]
// strh r0, [r1, 0xA]
// strh r5, [r1, 0xC]
// strh r6, [r1, 0xE]
// mov r0, r8
// strh r0, [r1, 0x10]
// movs r0, 0
// bl SetCameraPanningCallback
// movs r0, 0xD6
// bl PlaySE
// pop {r3}
// mov r8, r3
// pop {r4-r6}
// pop {r0}
// bx r0
// .pool
// thumb_func_end sp136_strengh_sound
thumb_func_start sub_81BE808 // thumb_func_start sub_81BE900
sub_81BE808: @ 81BE808 //sub_81BE900: @ 81BE900
push {r4,r5,lr} // push {r4,r5,lr}
sub sp, 0x4 // lsls r0, 24
lsls r0, 24 // lsrs r5, r0, 24
lsrs r5, r0, 24 // lsls r0, r5, 2
ldr r0, =gSaveBlock1Ptr // adds r0, r5
ldr r0, [r0] // lsls r0, 3
ldrb r1, [r0, 0x5] // ldr r1, =gTasks + 0x8
ldrb r2, [r0, 0x4] // adds r4, r0, r1
movs r0, 0x2D // ldrh r0, [r4, 0x2]
mov r3, sp // adds r0, 0x1
bl TryGetFieldObjectIdByLocalIdAndMap // strh r0, [r4, 0x2]
mov r0, sp // movs r1, 0x2
ldrb r0, [r0] // ldrsh r0, [r4, r1]
lsls r2, r0, 3 // movs r2, 0x6
adds r2, r0 // ldrsh r1, [r4, r2]
lsls r2, 2 // bl __modsi3
ldr r4, =gMapObjects // cmp r0, 0
adds r2, r4 // bne _081BE95C
ldr r3, =gSprites // strh r0, [r4, 0x2]
ldrb r1, [r2, 0x4] // ldrh r0, [r4, 0x4]
lsls r0, r1, 4 // subs r0, 0x1
adds r0, r1 // strh r0, [r4, 0x4]
lsls r0, 2 // ldrh r0, [r4]
adds r0, r3 // negs r0, r0
ldrh r1, [r0, 0x26] // strh r0, [r4]
adds r1, 0x4 // ldrh r0, [r4, 0x8]
strh r1, [r0, 0x26] // negs r0, r0
ldr r0, =gPlayerAvatar // strh r0, [r4, 0x8]
ldrb r0, [r0, 0x5] // movs r1, 0
lsls r1, r0, 3 // ldrsh r0, [r4, r1]
adds r1, r0 // movs r2, 0x8
lsls r1, 2 // ldrsh r1, [r4, r2]
adds r1, r4 // bl SetCameraPanning
ldrb r2, [r2, 0x4] // movs r1, 0x4
lsls r0, r2, 4 // ldrsh r0, [r4, r1]
adds r0, r2 // cmp r0, 0
lsls r0, 2 // bne _081BE95C
adds r0, r3 // bl sub_81BE968
movs r4, 0x22 // adds r0, r5, 0
ldrsh r2, [r0, r4] // bl DestroyTask
movs r4, 0x26 // bl InstallCameraPanAheadCallback
ldrsh r0, [r0, r4] //_081BE95C:
adds r2, r0 // pop {r4,r5}
ldrb r1, [r1, 0x4] // pop {r0}
lsls r0, r1, 4 // bx r0
adds r0, r1 // .pool
lsls r0, 2 // thumb_func_end sub_81BE900
adds r0, r3
movs r3, 0x22
ldrsh r1, [r0, r3]
movs r4, 0x26
ldrsh r0, [r0, r4]
adds r1, r0
cmp r2, r1
blt _081BE882
adds r0, r5, 0
bl DestroyTask
bl EnableBothScriptContexts
_081BE882:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE808
thumb_func_start sp136_strengh_sound // thumb_func_start sub_81BE968
sp136_strengh_sound: @ 81BE89C //sub_81BE968: @ 81BE968
push {r4-r6,lr} // push {lr}
mov r6, r8 // ldr r0, =sub_81BE9C0
push {r6} // bl FindTaskIdByFunc
mov r8, r0 // lsls r0, 24
adds r4, r1, 0 // lsrs r2, r0, 24
adds r5, r2, 0 // cmp r2, 0xFF
adds r6, r3, 0 // beq _081BE988
lsls r0, 24 // ldr r0, =gTasks
lsrs r0, 24 // lsls r1, r2, 2
mov r8, r0 // adds r1, r2
lsls r4, 24 // lsls r1, 3
lsrs r4, 24 // adds r1, r0
lsls r5, 24 // ldrh r0, [r1, 0x8]
lsrs r5, 24 // adds r0, 0x1
lsls r6, 24 // strh r0, [r1, 0x8]
lsrs r6, 24 //_081BE988:
ldr r0, =sub_81BE900 // pop {r0}
movs r1, 0x9 // bx r0
bl CreateTask // .pool
lsls r0, 24 // thumb_func_end sub_81BE968
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
movs r0, 0
strh r4, [r1, 0x8]
strh r0, [r1, 0xA]
strh r5, [r1, 0xC]
strh r6, [r1, 0xE]
mov r0, r8
strh r0, [r1, 0x10]
movs r0, 0
bl SetCameraPanningCallback
movs r0, 0xD6
bl PlaySE
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sp136_strengh_sound
thumb_func_start sub_81BE900 // thumb_func_start sub_81BE994
sub_81BE900: @ 81BE900 //sub_81BE994: @ 81BE994
push {r4,r5,lr} // push {lr}
lsls r0, 24 // ldr r0, =gUnknown_08617D94
lsrs r5, r0, 24 // bl LoadSpriteSheets
lsls r0, r5, 2 // bl sub_81BEA20
adds r0, r5 // ldr r0, =sub_81BE9C0
lsls r0, 3 // movs r1, 0x8
ldr r1, =gTasks + 0x8 // bl CreateTask
adds r4, r0, r1 // movs r0, 0x2
ldrh r0, [r4, 0x2] // movs r1, 0x1
adds r0, 0x1 // movs r2, 0x10
strh r0, [r4, 0x2] // movs r3, 0x3
movs r1, 0x2 // bl sp136_strengh_sound
ldrsh r0, [r4, r1] // pop {r0}
movs r2, 0x6 // bx r0
ldrsh r1, [r4, r2] // .pool
bl __modsi3 // thumb_func_end sub_81BE994
cmp r0, 0
bne _081BE95C
strh r0, [r4, 0x2]
ldrh r0, [r4, 0x4]
subs r0, 0x1
strh r0, [r4, 0x4]
ldrh r0, [r4]
negs r0, r0
strh r0, [r4]
ldrh r0, [r4, 0x8]
negs r0, r0
strh r0, [r4, 0x8]
movs r1, 0
ldrsh r0, [r4, r1]
movs r2, 0x8
ldrsh r1, [r4, r2]
bl SetCameraPanning
movs r1, 0x4
ldrsh r0, [r4, r1]
cmp r0, 0
bne _081BE95C
bl sub_81BE968
adds r0, r5, 0
bl DestroyTask
bl InstallCameraPanAheadCallback
_081BE95C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE900
thumb_func_start sub_81BE968 // thumb_func_start sub_81BE9C0
sub_81BE968: @ 81BE968 //sub_81BE9C0: @ 81BE9C0
push {lr} // push {r4,lr}
ldr r0, =sub_81BE9C0 // lsls r0, 24
bl FindTaskIdByFunc // lsrs r0, 24
lsls r0, 24 // lsls r1, r0, 2
lsrs r2, r0, 24 // adds r1, r0
cmp r2, 0xFF // lsls r3, r1, 3
beq _081BE988 // ldr r4, =gTasks + 0x8
ldr r0, =gTasks // adds r2, r3, r4
lsls r1, r2, 2 // ldrh r0, [r2, 0x2]
adds r1, r2 // adds r0, 0x1
lsls r1, 3 // strh r0, [r2, 0x2]
adds r1, r0 // lsls r0, 16
ldrh r0, [r1, 0x8] // movs r1, 0xFA
adds r0, 0x1 // lsls r1, 18
strh r0, [r1, 0x8] // cmp r0, r1
_081BE988: // beq _081BE9E6
pop {r0} // ldrh r0, [r2]
bx r0 // cmp r0, 0x11
.pool // bne _081BE9F0
thumb_func_end sub_81BE968 //_081BE9E6:
// adds r0, r4, 0
// subs r0, 0x8
// adds r0, r3, r0
// ldr r1, =sub_81BEA00
// str r1, [r0]
//_081BE9F0:
// pop {r4}
// pop {r0}
// bx r0
// .pool
// thumb_func_end sub_81BE9C0
thumb_func_start sub_81BE994 // thumb_func_start sub_81BEA00
sub_81BE994: @ 81BE994 //sub_81BEA00: @ 81BEA00
push {lr} // push {r4,lr}
ldr r0, =gUnknown_08617D94 // adds r4, r0, 0
bl LoadSpriteSheets // lsls r4, 24
bl sub_81BEA20 // lsrs r4, 24
ldr r0, =sub_81BE9C0 // movs r0, 0xFA
movs r1, 0x8 // lsls r0, 4
bl CreateTask // bl FreeSpriteTilesByTag
movs r0, 0x2 // adds r0, r4, 0
movs r1, 0x1 // bl DestroyTask
movs r2, 0x10 // bl EnableBothScriptContexts
movs r3, 0x3 // pop {r4}
bl sp136_strengh_sound // pop {r0}
pop {r0} // bx r0
bx r0 // thumb_func_end sub_81BEA00
.pool
thumb_func_end sub_81BE994
thumb_func_start sub_81BE9C0 // thumb_func_start sub_81BEA20
sub_81BE9C0: @ 81BE9C0 //sub_81BEA20: @ 81BEA20
push {r4,lr} // push {r4-r7,lr}
lsls r0, 24 // movs r4, 0
lsrs r0, 24 // ldr r5, =gUnknown_08617D64
lsls r1, r0, 2 // adds r7, r5, 0x2
adds r1, r0 // ldr r6, =gSprites
lsls r3, r1, 3 //_081BEA2A:
ldr r4, =gTasks + 0x8 // lsls r0, r4, 1
adds r2, r3, r4 // adds r0, r4
ldrh r0, [r2, 0x2] // lsls r0, 1
adds r0, 0x1 // adds r1, r0, r5
strh r0, [r2, 0x2] // ldrh r1, [r1]
lsls r0, 16 // adds r1, 0x78
movs r1, 0xFA // lsls r1, 16
lsls r1, 18 // asrs r1, 16
cmp r0, r1 // adds r0, r7
beq _081BE9E6 // movs r3, 0
ldrh r0, [r2] // ldrsh r2, [r0, r3]
cmp r0, 0x11 // ldr r0, =gUnknown_08617E60
bne _081BE9F0 // movs r3, 0x8
_081BE9E6: // bl CreateSprite
adds r0, r4, 0 // lsls r0, 24
subs r0, 0x8 // lsrs r1, r0, 24
adds r0, r3, r0 // lsls r0, r1, 4
ldr r1, =sub_81BEA00 // adds r0, r1
str r1, [r0] // lsls r0, 2
_081BE9F0: // adds r0, r6
pop {r4} // ldrb r2, [r0, 0x5]
pop {r0} // movs r3, 0xD
bx r0 // negs r3, r3
.pool // adds r1, r3, 0
thumb_func_end sub_81BE9C0 // ands r2, r1
// movs r1, 0xF
thumb_func_start sub_81BEA00 // ands r2, r1
sub_81BEA00: @ 81BEA00 // strb r2, [r0, 0x5]
push {r4,lr} // strh r4, [r0, 0x2E]
adds r4, r0, 0 // adds r0, r4, 0x1
lsls r4, 24 // lsls r0, 24
lsrs r4, 24 // lsrs r4, r0, 24
movs r0, 0xFA // cmp r4, 0x7
lsls r0, 4 // bls _081BEA2A
bl FreeSpriteTilesByTag // movs r4, 0
adds r0, r4, 0 // ldr r5, =gUnknown_08617D64
bl DestroyTask // adds r7, r5, 0x2
bl EnableBothScriptContexts // ldr r6, =gSprites
pop {r4} //_081BEA78:
pop {r0} // lsls r0, r4, 1
bx r0 // adds r0, r4
thumb_func_end sub_81BEA00 // lsls r0, 1
// adds r1, r0, r5
thumb_func_start sub_81BEA20 // ldrh r1, [r1]
sub_81BEA20: @ 81BEA20 // adds r1, 0x73
push {r4-r7,lr} // lsls r1, 16
movs r4, 0 // asrs r1, 16
ldr r5, =gUnknown_08617D64 // adds r0, r7
adds r7, r5, 0x2 // ldrh r2, [r0]
ldr r6, =gSprites // subs r2, 0x3
_081BEA2A: // lsls r2, 16
lsls r0, r4, 1 // asrs r2, 16
adds r0, r4 // ldr r0, =gUnknown_08617E34
lsls r0, 1 // movs r3, 0x8
adds r1, r0, r5 // bl CreateSprite
ldrh r1, [r1] // lsls r0, 24
adds r1, 0x78 // lsrs r1, r0, 24
lsls r1, 16 // lsls r0, r1, 4
asrs r1, 16 // adds r0, r1
adds r0, r7 // lsls r0, 2
movs r3, 0 // adds r0, r6
ldrsh r2, [r0, r3] // ldrb r2, [r0, 0x5]
ldr r0, =gUnknown_08617E60 // movs r3, 0xD
movs r3, 0x8 // negs r3, r3
bl CreateSprite // adds r1, r3, 0
lsls r0, 24 // ands r2, r1
lsrs r1, r0, 24 // movs r1, 0xF
lsls r0, r1, 4 // ands r2, r1
adds r0, r1 // strb r2, [r0, 0x5]
lsls r0, 2 // strh r4, [r0, 0x2E]
adds r0, r6 // adds r0, r4, 0x1
ldrb r2, [r0, 0x5] // lsls r0, 24
movs r3, 0xD // lsrs r4, r0, 24
negs r3, r3 // cmp r4, 0x7
adds r1, r3, 0 // bls _081BEA78
ands r2, r1 // pop {r4-r7}
movs r1, 0xF // pop {r0}
ands r2, r1 // bx r0
strb r2, [r0, 0x5] // .pool
strh r4, [r0, 0x2E] // thumb_func_end sub_81BEA20
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA2A
movs r4, 0
ldr r5, =gUnknown_08617D64
adds r7, r5, 0x2
ldr r6, =gSprites
_081BEA78:
lsls r0, r4, 1
adds r0, r4
lsls r0, 1
adds r1, r0, r5
ldrh r1, [r1]
adds r1, 0x73
lsls r1, 16
asrs r1, 16
adds r0, r7
ldrh r2, [r0]
subs r2, 0x3
lsls r2, 16
asrs r2, 16
ldr r0, =gUnknown_08617E34
movs r3, 0x8
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r2, [r0, 0x5]
movs r3, 0xD
negs r3, r3
adds r1, r3, 0
ands r2, r1
movs r1, 0xF
ands r2, r1
strb r2, [r0, 0x5]
strh r4, [r0, 0x2E]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA78
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEA20
thumb_func_start sub_81BEAD8 thumb_func_start sub_81BEAD8
sub_81BEAD8: @ 81BEAD8 sub_81BEAD8: @ 81BEAD8

View File

@ -22,9 +22,16 @@ void sub_8151E50(struct InnerStruct203CF18 *);
void sub_81BE6B8(void); void sub_81BE6B8(void);
void sub_81BE72C(void); void sub_81BE72C(void);
void sub_81BE808(u8 taskId);
void sub_81BE900(u8 taskId);
void sub_81BE968(void);
void sub_81BE9C0(u8 taskId);
void sub_81BEA00(u8 taskId);
void sub_81BEA20(void);
extern struct Struct203CF18 *gUnknown_0203CF18; extern struct Struct203CF18 *gUnknown_0203CF18;
extern const u16 gUnknown_08617D64[];
extern const u8 gUnknown_08617E18[]; extern const u8 gUnknown_08617E18[];
#endif // GUARD_FLDEFF_GROUNDSHAKE_H #endif // GUARD_FLDEFF_GROUNDSHAKE_H

View File

@ -1,13 +1,17 @@
#include "global.h" #include "global.h"
#include "global.fieldmap.h"
#include "constants/flags.h" #include "constants/flags.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "event_data.h" #include "event_data.h"
#include "field_camera.h"
#include "field_map_obj.h"
#include "fldeff_groundshake.h" #include "fldeff_groundshake.h"
#include "malloc.h" #include "malloc.h"
#include "menu.h" #include "menu.h"
#include "party_menu.h" #include "party_menu.h"
#include "pokemon.h" #include "pokemon.h"
#include "random.h" #include "random.h"
#include "script.h"
#include "sound.h" #include "sound.h"
#include "sprite.h" #include "sprite.h"
#include "string_util.h" #include "string_util.h"
@ -83,3 +87,133 @@ void sub_81BE79C(void)
FlagClear(FLAG_0x14E); FlagClear(FLAG_0x14E);
} }
void sub_81BE7F4(void)
{
CreateTask(sub_81BE808, 0x8);
}
void sub_81BE808(u8 taskId)
{
u8 mapObjectIdBuffer;
struct MapObject *fieldMapObject;
struct MapObject *playerAvatarMapObject;
TryGetFieldObjectIdByLocalIdAndMap(0x2D, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjectIdBuffer);
fieldMapObject = &(gMapObjects[mapObjectIdBuffer]);
gSprites[fieldMapObject->spriteId].pos2.y += 4;
playerAvatarMapObject = &(gMapObjects[gPlayerAvatar.mapObjectId]);
if((gSprites[fieldMapObject->spriteId].pos1.y + gSprites[fieldMapObject->spriteId].pos2.y) >=
(gSprites[playerAvatarMapObject->spriteId].pos1.y + gSprites[playerAvatarMapObject->spriteId].pos2.y))
{
DestroyTask(taskId);
EnableBothScriptContexts();
}
}
void sp136_strengh_sound(u8 a, u8 b, u8 c, u8 d)
{
u8 taskId;
taskId = CreateTask(sub_81BE900, 0x9);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = c;
gTasks[taskId].data[3] = d;
gTasks[taskId].data[4] = a;
SetCameraPanningCallback(NULL);
PlaySE(SE_W070);
}
void sub_81BE900(u8 taskId)
{
s16 *data;
data = gTasks[taskId].data;
data[1]++;
if((data[1] % data[3]) == 0)
{
data[1] = 0;
data[2]--;
data[0] = -data[0];
data[4] = -data[4];
SetCameraPanning(data[0], data[4]);
if(!data[2])
{
sub_81BE968();
DestroyTask(taskId);
InstallCameraPanAheadCallback();
}
}
}
void sub_81BE968(void)
{
u8 taskId;
taskId = FindTaskIdByFunc(sub_81BE9C0);
if(taskId != 0xFF)
gTasks[taskId].data[0]++;
}
extern const struct SpriteSheet gUnknown_08617D94[];
void sub_81BE994(void)
{
LoadSpriteSheets(gUnknown_08617D94);
sub_81BEA20();
CreateTask(sub_81BE9C0, 0x8);
sp136_strengh_sound(2, 1, 16, 3);
}
void sub_81BE9C0(u8 taskId)
{
u16 *data;
data = gTasks[taskId].data;
data[1]++;
if(data[1] == 1000 || data[0] == 17)
gTasks[taskId].func = sub_81BEA00;
}
void sub_81BEA00(u8 taskId)
{
FreeSpriteTilesByTag(4000);
DestroyTask(taskId);
EnableBothScriptContexts();
}
extern const struct SpriteTemplate gUnknown_08617E34;
extern const struct SpriteTemplate gUnknown_08617E60;
void sub_81BEA20(void)
{
u8 count;
u8 spriteId;
const s16 *x;
const s16 *y;
for(count = 0; count <=7; count++)
{
x = &(gUnknown_08617D64[0]);
y = &(gUnknown_08617D64[1]);
spriteId = CreateSprite(&gUnknown_08617E60, x[count*3] + 120, y[count*3], 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = count;
}
for(count = 0; count <=7; count++)
{
x = &(gUnknown_08617D64[0]);
y = &(gUnknown_08617D64[1]);
spriteId = CreateSprite(&gUnknown_08617E34, x[count*3] + 115, y[count*3] - 3, 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = count;
}
}