Decompile mossdeep hym

This commit is contained in:
DizzyEggg 2018-11-19 17:16:01 +01:00
parent 6a5b20ee8a
commit d22c2110de
19 changed files with 363 additions and 916 deletions

View File

@ -1,111 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81BF2B8
sub_81BF2B8: @ 81BF2B8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
str r0, [sp]
mov r10, r1
adds r6, r2, 0
mov r8, r3
ldr r0, [sp, 0x28]
mov r9, r0
lsls r1, 16
lsrs r1, 16
mov r10, r1
lsls r6, 24
lsrs r6, 24
mov r0, r8
lsls r0, 24
mov r8, r0
lsrs r7, r0, 24
mov r1, r9
lsls r1, 24
lsrs r1, 24
mov r9, r1
mov r0, r10
adds r1, r7, 0
bl __divsi3
adds r5, r0, 0
lsls r5, 24
lsrs r4, r5, 24
ldr r3, =gUnknown_030012A8
strh r4, [r3]
mov r0, r10
adds r1, r7, 0
str r3, [sp, 0x4]
bl __modsi3
lsls r0, 24
lsrs r2, r0, 24
ldr r3, [sp, 0x4]
strh r2, [r3, 0x2]
movs r1, 0x7
ands r4, r1
ands r2, r1
strh r4, [r3, 0x4]
strh r2, [r3, 0x6]
lsrs r0, 27
lsrs r5, 27
strh r0, [r3, 0x8]
strh r5, [r3, 0xA]
mov r1, r8
lsrs r1, 27
lsls r1, 6
mov r8, r1
mov r1, r8
muls r1, r5
lsls r0, 6
adds r1, r0
lsls r1, 16
lsrs r1, 16
strh r1, [r3, 0xC]
lsls r4, 3
adds r4, r2
adds r1, r4
lsls r4, r1, 16
lsrs r4, 17
strh r1, [r3, 0xE]
movs r1, 0x1
mov r0, r10
ands r1, r0
movs r2, 0x1
eors r1, r2
lsls r0, r1, 2
lsls r6, r0
eors r1, r2
lsls r1, 2
movs r0, 0xF
lsls r0, r1
orrs r6, r0
lsls r6, 24
lsrs r6, 24
mov r1, r9
lsls r1, 5
mov r9, r1
add r9, r4
ldr r1, [sp]
add r1, r9
ldrb r0, [r1]
ands r6, r0
strb r6, [r1]
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BF2B8
.align 2, 0 @ Don't pad with nop.

View File

@ -1,701 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81A8934
@ void sub_81A8934(u8)
sub_81A8934: @ 81A8934
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r4, =gUnknown_0203CE50
ldr r0, [r4]
cmp r0, 0
bne _081A894A
movs r0, 0x44
bl AllocZeroed
str r0, [r4]
_081A894A:
ldr r0, [r4]
adds r0, 0x41
strb r5, [r0]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A8934
thumb_func_start sub_81A895C
sub_81A895C: @ 81A895C
push {r4,lr}
ldr r4, =gUnknown_0203CE50
ldr r0, [r4]
cmp r0, 0
beq _081A896E
bl Free
movs r0, 0
str r0, [r4]
_081A896E:
movs r0, 0xFF
movs r1, 0
movs r2, 0
bl GetEventObjectIdByLocalIdAndMap
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gEventObjects
adds r0, r1
bl EventObjectClearHeldMovementIfFinished
bl sub_80D338C
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A895C
thumb_func_start sub_81A89A0
sub_81A89A0: @ 81A89A0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
str r0, [sp]
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
movs r1, 0xC7
lsls r1, 4
adds r1, r0
mov r9, r1
movs r3, 0
mov r10, r3
mov r8, r3
_081A89C4:
mov r0, r8
lsls r4, r0, 1
adds r1, r4, r0
lsls r1, 3
add r1, r9
ldrh r0, [r1, 0x4]
adds r0, 0x7
ldrh r1, [r1, 0x6]
adds r1, 0x7
lsls r0, 16
asrs r0, 16
lsls r1, 16
asrs r1, 16
bl MapGridGetMetatileIdAt
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =gUnknown_0203CE50
ldr r0, [r0]
adds r0, 0x41
ldrb r0, [r0]
movs r2, 0xA6
lsls r2, 2
cmp r0, 0
bne _081A89F8
subs r2, 0x48
_081A89F8:
ldr r0, =0x0000024f
cmp r1, r0
bls _081A8AD4
subs r1, r2
adds r0, r1, 0
cmp r1, 0
bge _081A8A08
adds r0, r1, 0x7
_081A8A08:
asrs r2, r0, 3
lsls r0, r2, 24
lsrs r0, 24
cmp r0, 0x4
bhi _081A8AD4
ldr r3, [sp]
cmp r0, r3
bne _081A8AD4
lsls r0, r2, 3
subs r0, r1, r0
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x3
bhi _081A8AD4
movs r1, 0
movs r2, 0
cmp r5, 0x1
beq _081A8A58
cmp r5, 0x1
bgt _081A8A44
cmp r5, 0
beq _081A8A4E
b _081A8AD4
.pool
_081A8A44:
cmp r5, 0x2
beq _081A8A64
cmp r5, 0x3
beq _081A8A70
b _081A8AD4
_081A8A4E:
ldr r7, =gUnknown_08612698
movs r1, 0x1
b _081A8A74
.pool
_081A8A58:
ldr r7, =gUnknown_0861269C
movs r2, 0x1
b _081A8A74
.pool
_081A8A64:
ldr r7, =gUnknown_086126A0
movs r1, 0xFF
b _081A8A74
.pool
_081A8A70:
ldr r7, =gUnknown_086126A4
movs r2, 0xFF
_081A8A74:
mov r3, r8
adds r0, r4, r3
lsls r0, 3
mov r3, r9
adds r4, r0, r3
lsls r0, r1, 24
asrs r0, 24
ldrh r1, [r4, 0x4]
adds r0, r1
strh r0, [r4, 0x4]
lsls r0, r2, 24
asrs r0, 24
ldrh r3, [r4, 0x6]
adds r0, r3
strh r0, [r4, 0x6]
ldrb r0, [r4]
ldr r6, =gSaveBlock1Ptr
ldr r2, [r6]
ldrb r1, [r2, 0x5]
ldrb r2, [r2, 0x4]
bl GetEventObjectIdByLocalIdAndMap
lsls r0, 24
lsrs r0, 24
cmp r0, 0x10
beq _081A8ACC
mov r0, r8
adds r1, r5, 0
bl sub_81A8D60
ldrb r4, [r4]
mov r10, r4
mov r0, r10
ldr r2, [r6]
ldrb r1, [r2, 0x5]
ldrb r2, [r2, 0x4]
adds r3, r7, 0
bl ScriptMovement_StartObjectMovementScript
b _081A8AD4
.pool
_081A8ACC:
mov r0, r8
adds r1, r5, 0
bl sub_81A8D94
_081A8AD4:
mov r0, r8
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
mov r8, r0
cmp r0, 0x3F
bhi _081A8AE4
b _081A89C4
_081A8AE4:
mov r0, r10
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_81A89A0
thumb_func_start sub_81A8AF8
sub_81A8AF8: @ 81A8AF8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r1, =gUnknown_0203CE50
ldr r2, [r1]
cmp r2, 0
bne _081A8B0C
b _081A8D4A
_081A8B0C:
adds r0, r2, 0
adds r0, 0x41
ldrb r0, [r0]
movs r3, 0xA6
lsls r3, 2
mov r10, r3
cmp r0, 0
bne _081A8B22
movs r0, 0x94
lsls r0, 2
mov r10, r0
_081A8B22:
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
movs r3, 0xC7
lsls r3, 4
adds r7, r0, r3
movs r0, 0
mov r9, r0
adds r0, r2, 0
adds r0, 0x40
ldrb r0, [r0]
cmp r9, r0
bcc _081A8B3C
b _081A8D4A
_081A8B3C:
mov r8, r1
_081A8B3E:
mov r1, r8
ldr r0, [r1]
mov r2, r9
lsls r4, r2, 2
adds r0, r4
ldrb r0, [r0, 0x1]
lsls r1, r0, 1
adds r1, r0
lsls r1, 3
adds r1, r7
ldrh r0, [r1, 0x4]
adds r0, 0x7
ldrh r1, [r1, 0x6]
adds r1, 0x7
lsls r0, 16
asrs r0, 16
lsls r1, 16
asrs r1, 16
bl MapGridGetMetatileIdAt
lsls r0, 16
lsrs r0, 16
mov r3, r10
subs r1, r0, r3
adds r0, r1, 0
cmp r1, 0
bge _081A8B76
adds r0, r1, 0x7
_081A8B76:
asrs r0, 3
lsls r0, 3
subs r0, r1, r0
lsls r0, 24
lsrs r0, 24
mov r2, r8
ldr r1, [r2]
adds r1, r4
ldrb r1, [r1]
subs r0, r1
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
blt _081A8B96
cmp r1, 0x3
bne _081A8BAC
_081A8B96:
movs r0, 0x3
negs r0, r0
movs r6, 0
cmp r1, r0
bne _081A8BB4
b _081A8BB2
.pool
_081A8BAC:
movs r6, 0x2
cmp r1, 0
ble _081A8BB4
_081A8BB2:
movs r6, 0x1
_081A8BB4:
ldr r5, =gUnknown_0203CE50
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
ldrb r0, [r0]
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
ldrb r1, [r2, 0x5]
ldrb r2, [r2, 0x4]
bl GetEventObjectIdByLocalIdAndMap
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x10
bne _081A8BDC
b _081A8D32
_081A8BDC:
ldr r0, =gEventObjects
lsls r1, r2, 3
adds r1, r2
lsls r1, 2
adds r1, r0
ldrb r0, [r1, 0x18]
lsls r0, 28
lsrs r0, 28
adds r1, r0, 0
cmp r6, 0
bne _081A8C9C
cmp r0, 0x2
beq _081A8C60
cmp r0, 0x2
bgt _081A8C0C
cmp r0, 0x1
beq _081A8C30
b _081A8D32
.pool
_081A8C0C:
cmp r0, 0x3
beq _081A8C48
cmp r0, 0x4
beq _081A8C16
b _081A8D32
_081A8C16:
ldr r3, =gUnknown_086126AE
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x7
b _081A8C72
.pool
_081A8C30:
ldr r3, =gUnknown_086126A8
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0xA
b _081A8C72
.pool
_081A8C48:
ldr r3, =gUnknown_086126AA
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x8
b _081A8C72
.pool
_081A8C60:
ldr r3, =gUnknown_086126AC
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x9
_081A8C72:
strb r1, [r0, 0x9]
mov r1, r8
ldr r0, [r1]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
ldrb r0, [r0]
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
ldrb r1, [r2, 0x5]
ldrb r2, [r2, 0x4]
bl ScriptMovement_StartObjectMovementScript
b _081A8D32
.pool
_081A8C9C:
cmp r6, 0x1
bne _081A8D32
cmp r0, 0x2
beq _081A8D00
cmp r0, 0x2
bgt _081A8CAE
cmp r0, 0x1
beq _081A8CD0
b _081A8D32
_081A8CAE:
cmp r1, 0x3
beq _081A8CE8
cmp r1, 0x4
bne _081A8D32
ldr r3, =gUnknown_086126AA
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x8
b _081A8D12
.pool
_081A8CD0:
ldr r3, =gUnknown_086126AC
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x9
b _081A8D12
.pool
_081A8CE8:
ldr r3, =gUnknown_086126AE
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0x7
b _081A8D12
.pool
_081A8D00:
ldr r3, =gUnknown_086126A8
ldr r0, [r5]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
movs r1, 0xA
_081A8D12:
strb r1, [r0, 0x9]
mov r2, r8
ldr r0, [r2]
adds r0, r4
ldrb r1, [r0, 0x1]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r7
ldrb r0, [r0]
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
ldrb r1, [r2, 0x5]
ldrb r2, [r2, 0x4]
bl ScriptMovement_StartObjectMovementScript
_081A8D32:
mov r0, r9
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
mov r9, r0
mov r3, r8
ldr r0, [r3]
adds r0, 0x40
ldrb r0, [r0]
cmp r9, r0
bcs _081A8D4A
b _081A8B3E
_081A8D4A:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A8AF8
thumb_func_start sub_81A8D60
sub_81A8D60: @ 81A8D60
push {r4,lr}
ldr r4, =gUnknown_0203CE50
ldr r3, [r4]
adds r2, r3, 0
adds r2, 0x40
ldrb r2, [r2]
lsls r2, 2
adds r3, r2
strb r0, [r3, 0x1]
ldr r2, [r4]
adds r0, r2, 0
adds r0, 0x40
ldrb r0, [r0]
lsls r0, 2
adds r2, r0
strb r1, [r2]
ldr r1, [r4]
adds r1, 0x40
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81A8D60
thumb_func_start sub_81A8D94
sub_81A8D94: @ 81A8D94
push {r4-r6,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 24
lsrs r6, r1, 24
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
movs r1, 0xC7
lsls r1, 4
adds r5, r0, r1
lsls r1, r4, 1
adds r1, r4
lsls r1, 3
adds r1, r5
ldrh r0, [r1, 0x4]
adds r0, 0x7
ldrh r1, [r1, 0x6]
adds r1, 0x7
lsls r0, 16
asrs r0, 16
lsls r1, 16
asrs r1, 16
bl MapGridGetMetatileIdAt
lsls r0, 16
lsrs r2, r0, 16
ldr r0, =gUnknown_0203CE50
ldr r0, [r0]
adds r0, 0x41
ldrb r0, [r0]
movs r1, 0xA6
lsls r1, 2
cmp r0, 0
bne _081A8DDA
subs r1, 0x48
_081A8DDA:
subs r1, r2, r1
adds r0, r1, 0
cmp r1, 0
bge _081A8DE4
adds r0, r1, 0x7
_081A8DE4:
asrs r0, 3
lsls r0, 3
subs r0, r1, r0
lsls r0, 24
lsrs r0, 24
subs r0, r6
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
blt _081A8DFC
cmp r1, 0x3
bne _081A8E08
_081A8DFC:
movs r2, 0
b _081A8E1A
.pool
_081A8E08:
cmp r1, 0
bgt _081A8E14
movs r0, 0x3
negs r0, r0
cmp r1, r0
bne _081A8E18
_081A8E14:
movs r2, 0x1
b _081A8E1A
_081A8E18:
movs r2, 0x2
_081A8E1A:
lsls r0, r4, 1
adds r0, r4
lsls r0, 3
adds r1, r0, r5
ldrb r0, [r1, 0x9]
adds r3, r0, 0
cmp r2, 0
bne _081A8E4C
cmp r0, 0x8
beq _081A8E72
cmp r0, 0x8
bgt _081A8E38
cmp r0, 0x7
beq _081A8E48
b _081A8E76
_081A8E38:
cmp r0, 0x9
beq _081A8E44
cmp r0, 0xA
bne _081A8E76
movs r0, 0x7
b _081A8E74
_081A8E44:
movs r0, 0x8
b _081A8E74
_081A8E48:
movs r0, 0x9
b _081A8E74
_081A8E4C:
cmp r2, 0x1
bne _081A8E76
cmp r0, 0x8
beq _081A8E6A
cmp r0, 0x8
bgt _081A8E5E
cmp r0, 0x7
beq _081A8E72
b _081A8E76
_081A8E5E:
cmp r3, 0x9
beq _081A8E6E
cmp r3, 0xA
bne _081A8E76
movs r0, 0x8
b _081A8E74
_081A8E6A:
movs r0, 0x9
b _081A8E74
_081A8E6E:
movs r0, 0x7
b _081A8E74
_081A8E72:
movs r0, 0xA
_081A8E74:
strb r0, [r1, 0x9]
_081A8E76:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_81A8D94
.align 2, 0 @ Don't pad with nop.

View File

@ -38,6 +38,8 @@ extern const u8 gTowerMaleTrainerGfxIds[30];
extern const u8 gTowerFemaleFacilityClasses[20];
extern const u8 gTowerFemaleTrainerGfxIds[20];
extern u16 gUnknown_03006298[];
extern const struct BattleFrontierTrainer *gFacilityTrainers;
extern const struct FacilityMon *gFacilityTrainerMons;

View File

@ -1,6 +1,8 @@
#ifndef GUARD_BERRY_BLENDER_H
#define GUARD_BERRY_BLENDER_H
extern u8 gInGameOpponentsNo;
void DoBerryBlending(void);
u16 GetBlenderArrowPosition(void);
void ShowBerryBlenderRecordWindow(void);

View File

@ -61,11 +61,6 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
extern u8 gStringVar1[];
extern u8 gStringVar2[];
extern u8 gStringVar3[];
extern u8 gStringVar4[];
// There are many quirks in the source code which have overarching behavioral differences from
// a number of other files. For example, diploma.c seems to declare rodata before each use while
// other files declare out of order and must be at the beginning. There are also a number of

9
include/mossdeep_gym.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef GUARD_MOSSDEEP_GYM_H
#define GUARD_MOSSDEEP_GYM_H
void sub_81A8934(u8 arg0);
void sub_81A895C(void);
u16 sub_81A89A0(u8 arg0);
void sub_81A8AF8(void);
#endif // GUARD_MOSSDEEP_GYM_H

View File

@ -1,6 +1,9 @@
#ifndef GUARD_NEW_GAME_H
#define GUARD_NEW_GAME_H
extern bool8 gDifferentSaveFile;
extern bool8 gUnknown_020322D5; // The purpose of this variable is unknown as it's read only 3 times(2 times in contest.c and 1 time in berry_blender.c), never written to.
void SetTrainerId(u32 trainerId, u8 *dst);
u32 GetTrainerId(u8 *trainerId);
void CopyTrainerId(u8 *dst, u8 *src);

View File

@ -22,9 +22,9 @@ extern struct LinkPlayerEventObject gLinkPlayerEventObjects[4];
extern u16 *gBGTilemapBuffers1;
extern u16 *gBGTilemapBuffers2;
extern u16 *gBGTilemapBuffers3;
extern u16 gUnknown_03005DA8;
extern void (*gFieldCallback)(void);
extern bool8 (*gFieldCallback2)(void);
extern u8 gUnknown_03005DB4;
extern u8 gFieldLinkPlayerCount;

View File

@ -1,6 +1,9 @@
#ifndef GUARD_POKEDEX_H
#define GUARD_POKEDEX_H
extern u8 gUnknown_030060B0;
extern void (*gUnknown_030060B4)(void);
void ResetPokedex(void);
void CopyMonCategoryText(u32 species, u8 *dst);
u16 GetPokedexHeightWeight(u16 dexNum, u8 data);

View File

@ -1,7 +1,7 @@
#ifndef GUARD_START_MENU_H
#define GUARD_START_MENU_H
extern bool8 (*gMenuCallback)(void); // Defined in sym_common.txt
extern bool8 (*gMenuCallback)(void);
void sub_809FA18(void);
void sub_809FA34(u8 taskId);

View File

@ -1,6 +1,11 @@
#ifndef GUARD_STRING_UTIL_H
#define GUARD_STRING_UTIL_H
extern u8 gStringVar1[];
extern u8 gStringVar2[];
extern u8 gStringVar3[];
extern u8 gStringVar4[];
enum StringConvertMode
{
STR_CONV_MODE_LEFT_ALIGN,

View File

@ -188,6 +188,7 @@ SECTIONS {
asm/cute_sketch.o(.text);
src/decoration.o(.text);
src/slot_machine.o(.text);
src/contest_painting.o(.text);
asm/contest_painting.o(.text);
src/battle_ai_script_commands.o(.text);
src/trader.o(.text);
@ -268,7 +269,7 @@ SECTIONS {
src/battle_arena.o(.text);
src/battle_factory.o(.text);
src/battle_pike.o(.text);
asm/mossdeep_gym.o(.text);
src/mossdeep_gym.o(.text);
src/battle_pyramid.o(.text);
src/item_menu.o(.text);
src/list_menu.o(.text);
@ -283,7 +284,6 @@ SECTIONS {
src/battle_controller_player_partner.o(.text);
src/fldeff_groundshake.o(.text);
src/fossil_specials.o(.text);
asm/fossil_specials.o(.text);
src/berry_fix_program.o(.text);
src/pokemon_summary_screen.o(.text);
src/unk_pokedex_area_screen_helper.o(.text);

8
src/contest_painting.c Normal file
View File

@ -0,0 +1,8 @@
#include "global.h"
// IWRAM bss
IWRAM_DATA u8 gUnknown_030011F0;
IWRAM_DATA u16 gUnknown_030011F2;
IWRAM_DATA u16 gUnknown_030011F4;
IWRAM_DATA u8 gUnknown_030011F6;
IWRAM_DATA u8 gUnknown_030011F7;

313
src/mossdeep_gym.c Normal file
View File

@ -0,0 +1,313 @@
#include "global.h"
#include "event_object_movement.h"
#include "fieldmap.h"
#include "malloc.h"
#include "mossdeep_gym.h"
#include "script_movement.h"
#include "constants/event_object_movement_constants.h"
// Movement scripts.
extern const u8 gUnknown_08612698[];
extern const u8 gUnknown_0861269C[];
extern const u8 gUnknown_086126A0[];
extern const u8 gUnknown_086126A4[];
extern const u8 gUnknown_086126A8[];
extern const u8 gUnknown_086126AA[];
extern const u8 gUnknown_086126AC[];
extern const u8 gUnknown_086126AE[];
struct MossdeepSubStruct
{
u8 unk0;
u8 eventTemplateId;
};
struct MossdeepStruct
{
struct MossdeepSubStruct unk0[0x10];
u8 count;
u8 unk41;
};
// This file's functions.
static void sub_81A8D60(u8 eventTemplateId, u8 arg1);
static void sub_81A8D94(u8 eventTemplateId, u8 arg1);
// EWRAM vars
EWRAM_DATA static struct MossdeepStruct *gUnknown_0203CE50 = NULL;
// code
void sub_81A8934(u8 arg0)
{
if (gUnknown_0203CE50 == NULL)
gUnknown_0203CE50 = AllocZeroed(sizeof(*gUnknown_0203CE50));
gUnknown_0203CE50->unk41 = arg0;
}
void sub_81A895C(void)
{
u8 id;
if (gUnknown_0203CE50 != NULL)
FREE_AND_SET_NULL(gUnknown_0203CE50);
id = GetEventObjectIdByLocalIdAndMap(0xFF, 0, 0);
EventObjectClearHeldMovementIfFinished(&gEventObjects[id]);
sub_80D338C();
}
u16 sub_81A89A0(u8 arg0)
{
u8 i;
struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
u16 localId = 0;
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
s32 var;
u8 r5;
s16 x = events[i].x + 7;
s16 y = events[i].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
if (gUnknown_0203CE50->unk41 == 0)
var = 0x250;
else
var = 0x298;
if (metatile < 0x250)
continue;
if ((u8)((metatile - var) / 8) >= 5)
continue;
if ((u8)((metatile - var) / 8) != arg0)
continue;
r5 = (u8)((metatile - var) % 8);
if (r5 < 4)
{
s8 x = 0;
s8 y = 0;
const u8 *movementScript;
switch (r5)
{
case 0:
movementScript = gUnknown_08612698;
x = 1;
break;
case 1:
movementScript = gUnknown_0861269C;
y = 1;
break;
case 2:
movementScript = gUnknown_086126A0;
x = -1;
break;
case 3:
movementScript = gUnknown_086126A4;
y = -1;
break;
default:
continue;
}
events[i].x += x;
events[i].y += y;
if (GetEventObjectIdByLocalIdAndMap(events[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup) != EVENT_OBJECTS_COUNT)
{
sub_81A8D60(i, r5);
localId = events[i].localId;
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
}
else
{
sub_81A8D94(i, r5);
}
}
}
return localId;
}
void sub_81A8AF8(void)
{
u8 i;
s32 var;
struct EventObjectTemplate *events;
if (gUnknown_0203CE50 == NULL)
return;
if (gUnknown_0203CE50->unk41 == 0)
var = 0x250;
else
var = 0x298;
events = gSaveBlock1Ptr->eventObjectTemplates;
for (i = 0; i < gUnknown_0203CE50->count; i++)
{
s32 r6;
s8 r0;
u8 eventObjectId;
s16 x = events[gUnknown_0203CE50->unk0[i].eventTemplateId].x + 7;
s16 y = events[gUnknown_0203CE50->unk0[i].eventTemplateId].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
r0 = (u8)((metatile - var) % 8);
r0 -= (gUnknown_0203CE50->unk0[i].unk0);
if (r0 < 0 || r0 == 3)
{
if (r0 == -3)
r6 = 1;
else
r6 = 0;
}
else
{
if (r0 > 0)
r6 = 1;
else
r6 = 2;
}
eventObjectId = GetEventObjectIdByLocalIdAndMap(events[gUnknown_0203CE50->unk0[i].eventTemplateId].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
if (eventObjectId != EVENT_OBJECTS_COUNT)
{
const u8 *movementScript;
u8 direction = gEventObjects[eventObjectId].facingDirection;
if (r6 == 0)
{
switch (direction)
{
case DIR_EAST:
movementScript = gUnknown_086126AE;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_SOUTH:
movementScript = gUnknown_086126A8;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
case DIR_WEST:
movementScript = gUnknown_086126AA;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_NORTH:
movementScript = gUnknown_086126AC;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->unk0[i].eventTemplateId].localId,
gSaveBlock1Ptr->location.mapNum,
gSaveBlock1Ptr->location.mapGroup,
movementScript);
}
else if (r6 == 1)
{
switch (direction)
{
case DIR_EAST:
movementScript = gUnknown_086126AA;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_SOUTH:
movementScript = gUnknown_086126AC;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
case DIR_WEST:
movementScript = gUnknown_086126AE;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_NORTH:
movementScript = gUnknown_086126A8;
events[gUnknown_0203CE50->unk0[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->unk0[i].eventTemplateId].localId,
gSaveBlock1Ptr->location.mapNum,
gSaveBlock1Ptr->location.mapGroup,
movementScript);
}
}
}
}
static void sub_81A8D60(u8 eventTemplateId, u8 arg1)
{
gUnknown_0203CE50->unk0[gUnknown_0203CE50->count].eventTemplateId = eventTemplateId;
gUnknown_0203CE50->unk0[gUnknown_0203CE50->count].unk0 = arg1;
gUnknown_0203CE50->count++;
}
static void sub_81A8D94(u8 eventTemplateId, u8 arg1)
{
s8 r0;
s32 r6;
s32 var;
u16 movementType;
struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
s16 x = events[eventTemplateId].x + 7;
s16 y = events[eventTemplateId].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
if (gUnknown_0203CE50->unk41 == 0)
var = 0x250;
else
var = 0x298;
r0 = (u8)((metatile - var) % 8);
r0 -= arg1;
if (r0 < 0 || r0 == 3)
r6 = 0;
else if (r0 > 0 || r0 == -3)
r6 = 1;
else
r6 = 2;
movementType = events[eventTemplateId].movementType;
if (r6 == 0)
{
switch (movementType)
{
case MOVEMENT_TYPE_FACE_RIGHT:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case MOVEMENT_TYPE_FACE_DOWN:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
case MOVEMENT_TYPE_FACE_LEFT:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case MOVEMENT_TYPE_FACE_UP:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
default:
break;
}
}
else if (r6 == 1)
{
switch (movementType)
{
case MOVEMENT_TYPE_FACE_RIGHT:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case MOVEMENT_TYPE_FACE_DOWN:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
case MOVEMENT_TYPE_FACE_LEFT:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case MOVEMENT_TYPE_FACE_UP:
events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
default:
break;
}
}
}

View File

@ -1,7 +1,7 @@
#include "gba/gba.h"
#include "multiboot.h"
static u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
IWRAM_DATA static u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
static int MultiBootSend(struct MultiBootParam *mp, u16 data);
static int MultiBootHandShake(struct MultiBootParam *mp);

View File

@ -4,6 +4,7 @@
#include "berry.h"
#include "clock.h"
#include "coins.h"
#include "contest.h"
#include "contest_link_80F57C4.h"
#include "contest_painting.h"
#include "data2.h"
@ -27,6 +28,7 @@
#include "event_obj_lock.h"
#include "menu.h"
#include "money.h"
#include "mossdeep_gym.h"
#include "mystery_event_script.h"
#include "palette.h"
#include "party_menu.h"
@ -49,11 +51,6 @@
#include "tv.h"
#include "window.h"
extern u16 sub_81A89A0(u8);
extern void sub_81A8AF8(void);
extern void sub_81A895C(void);
extern void sub_81A8934(u8);
typedef u16 (*SpecialFunc)(void);
typedef void (*NativeFunc)(void);
@ -66,8 +63,6 @@ static EWRAM_DATA u16 sMovingNpcMapBank = 0;
static EWRAM_DATA u16 sMovingNpcMapId = 0;
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
extern u16 gSpecialVar_ContestCategory;
IWRAM_DATA u8 gUnknown_03000F30;
extern const SpecialFunc gSpecials[];
@ -2204,7 +2199,7 @@ bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
}
}
// This command will force the Pokémon to be obedient, you don't get to make it disobedient
// This command will force the Pokémon to be obedient, you don't get to make it disobedient.
bool8 ScrCmd_setmonobedient(struct ScriptContext *ctx)
{
bool8 obedient = TRUE;

View File

@ -32,22 +32,7 @@
.include "src/menu_helpers.o"
.include "src/region_map.o"
.include "src/slot_machine.o"
gUnknown_030011F0: @ 30011F0
.space 0x2
gUnknown_030011F2: @ 30011F2
.space 0x2
gUnknown_030011F4: @ 30011F4
.space 0x2
gUnknown_030011F6: @ 30011F6
.space 0x1
gUnknown_030011F7: @ 30011F7
.space 0x1
.include "src/contest_painting.o"
.include "src/starter_choose.o"
.align 0x2
@ -75,13 +60,7 @@ gUnknown_03001204: @ 3001204
.include "src/battle_pike.o"
.include "src/battle_tent.o"
.include "src/multiboot.o"
.space 0x4 @ XXX: why is this needed?
.align 2
gUnknown_030012A8: @ 30012A8
.space 0x10
.include "src/fossil_specials.o"
.include "src/berry_fix_program.o"
gUnknown_030012BC: @ 30012BC

View File

@ -10,37 +10,16 @@
.include "battle_main.o"
.include "random.o"
.include "load_save.o"
gInGameOpponentsNo: @ 3005D98
.space 0x4
gBGTilemapBuffers1: @ 3005D9C
.space 0x4
gBGTilemapBuffers2: @ 3005DA0
.space 0x4
gBGTilemapBuffers3: @ 3005DA4
.space 0x4
.include "berry_blender.o"
.include "overworld.o"
.include "fieldmap.o"
.include "field_camera.o"
.include "field_control_avatar.o"
gMenuCallback: @ 3005DF4
.space 0x4
.include "start_menu.o"
.include "sound.o"
.include "task.o"
.include "trainer_see.o"
gUnknown_030060B0: @ 30060B0
.space 0x4
gUnknown_030060B4: @ 30060B4
.space 0x4
.include "pokedex.o"
.include "contest.o"
.include "tv.o"
.include "mauville_old_man.o"
@ -96,10 +75,7 @@ gUnknown_030061EC: @ 30061EC
.space 0x4
.include "save.o"
gUnknown_03006298: @ 3006298
.space 0x8
.include "battle_tower.o"
.include "intro.o"
gUnknown_030062DC: @ 30062DC
@ -132,7 +108,6 @@ gUnknown_03006370: @ 3006370
.space 0x10
.include "m4a_2.o"
.include "agb_flash.o"
gRfuState: @ 3007868

View File

@ -3,20 +3,6 @@
.include "src/window.o"
.include "src/text.o"
.include "src/sprite.o"
.align 2
gStringVar1: @ 2021CC4
.space 0x100
gStringVar2: @ 2021DC4
.space 0x100
gStringVar3: @ 2021EC4
.space 0x100
gStringVar4: @ 2021FC4
.space 0x3E8
.include "src/string_util.o"
.include "src/link.o"
.include "src/link_rfu.o"
@ -117,8 +103,6 @@ gUnknown_02022CFC: @ 2022CFC
gUnknown_02022D00: @ 2022D00
.space 0x4
@ src/main_menu.c
gUnknown_02022D04: @ 2022D04
.include "src/main_menu.o"
gUnknown_02022D08: @ 2022D08
@ -199,13 +183,7 @@ gUnknown_020322A0: @ 20322A0
.space 0x4
.include "src/berry_blender.o"
gDifferentSaveFile: @ 20322D4
.space 0x1
gUnknown_020322D5: @ 20322D5
.space 0x3
.include "src/new_game.o"
.include "src/overworld.o"
.include "src/fieldmap.o"
.include "src/field_camera.o"
@ -395,6 +373,7 @@ gUnknown_0203A11C: @ 203A11C
gUnknown_0203A120: @ 203A120
.space 0x4
.include "src/mon_markings.o"
.include "src/mauville_old_man.o"
.include "src/mail.o"
@ -459,9 +438,6 @@ gUnknown_0203ABB5: @ 203ABB5
.include "src/rom_81520A8.o"
.include "src/save.o"
.space 0x4 /*unused var?*/
.include "src/mystery_event_script.o"
.include "src/learn_move.o"
.include "src/decoration_inventory.o"
@ -494,13 +470,7 @@ gUnknown_0203CD88: @ 203CD88
.include "src/menu.o"
.include "src/battle_factory_screen.o"
gUnknown_0203CE50: @ 203CE50
.space 0x4
gUnknown_0203CE54: @ 203CE54
.align 2
.include "src/mossdeep_gym.o"
.include "src/item_menu.o"
.include "src/list_menu.o"
.include "src/dynamic_placeholder_text_util.o"