Decompile Battle Palace

This commit is contained in:
DizzyEggg 2018-11-12 15:41:19 +01:00
parent d5abd7b696
commit 69683f9572
13 changed files with 209 additions and 337 deletions

View File

@ -7,180 +7,6 @@
thumb_func_start sub_8195C7C
sub_8195C7C: @ 8195C7C
push {r4-r7,lr}
ldr r4, =gSaveBlock2Ptr
ldr r0, [r4]
ldr r1, =0x00000ca9
adds r0, r1
ldrb r0, [r0]
lsls r0, 30
lsrs r7, r0, 30
ldr r0, =0x000040ce
bl VarGet
lsls r0, 24
ldr r4, [r4]
lsls r1, r7, 1
lsrs r5, r0, 22
adds r1, r5
ldr r3, =0x00000dc8
adds r6, r4, r3
adds r3, r6, r1
ldrh r2, [r3]
ldr r0, =0x0000270e
cmp r2, r0
bhi _08195CCA
adds r2, 0x1
strh r2, [r3]
movs r3, 0xDD
lsls r3, 4
adds r0, r4, r3
adds r1, r0, r1
adds r0, r5, 0
ldrh r3, [r1]
cmp r7, r3
bls _08195CC0
adds r0, 0x2
_08195CC0:
adds r0, r6, r0
ldrh r0, [r0]
cmp r0, 0
beq _08195CCA
strh r2, [r1]
_08195CCA:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8195C7C
thumb_func_start sub_8195CE4
sub_8195CE4: @ 8195CE4
push {r4,lr}
ldr r4, =gSaveBlock2Ptr
ldr r0, [r4]
ldr r1, =gSpecialVar_0x8005
ldrh r1, [r1]
ldr r2, =0x00000ca8
adds r0, r2
strb r1, [r0]
movs r0, 0x80
lsls r0, 7
movs r1, 0
bl VarSet
ldr r1, [r4]
ldr r0, =0x00000ca9
adds r1, r0
ldrb r0, [r1]
movs r2, 0x4
orrs r0, r2
strb r0, [r1]
bl sub_81A4C30
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8195CE4
thumb_func_start sub_8195D28
sub_8195D28: @ 8195D28
push {r4,r5,lr}
ldr r0, =0x000040ce
bl VarGet
lsls r0, 16
ldr r4, =gSaveBlock2Ptr
ldr r2, [r4]
ldr r3, =0x00000ca9
adds r1, r2, r3
ldrb r1, [r1]
lsls r1, 30
lsrs r1, 29
lsrs r0, 14
adds r1, r0
ldr r0, =0x00000dc8
adds r2, r0
adds r2, r1
ldrh r0, [r2]
cmp r0, 0x29
bls _08195D88
bl Random
ldr r4, [r4]
ldr r5, =gUnknown_0860DE84
lsls r0, 16
lsrs r0, 16
movs r1, 0x9
bl __umodsi3
lsls r0, 16
lsrs r0, 15
adds r0, r5
ldrh r0, [r0]
ldr r1, =0x00000dc6
adds r4, r1
b _08195DA6
.pool
_08195D88:
bl Random
ldr r4, [r4]
ldr r5, =gUnknown_0860DE78
lsls r0, 16
lsrs r0, 16
movs r1, 0x6
bl __umodsi3
lsls r0, 16
lsrs r0, 15
adds r0, r5
ldrh r0, [r0]
ldr r3, =0x00000dc6
adds r4, r3
_08195DA6:
strh r0, [r4]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8195D28
thumb_func_start sub_8195DB8
sub_8195DB8: @ 8195DB8
push {r4,r5,lr}
ldr r4, =gSaveBlock2Ptr
ldr r0, [r4]
ldr r1, =0x00000dc6
adds r0, r1
ldrh r0, [r0]
movs r1, 0x1
bl AddBagItem
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x1
bne _08195E00
ldr r0, [r4]
ldr r1, =0x00000dc6
adds r0, r1
ldrh r0, [r0]
ldr r1, =gStringVar1
bl CopyItemName
ldr r0, [r4]
ldr r1, =0x00000dc6
adds r0, r1
movs r1, 0
strh r1, [r0]
ldr r0, =gSpecialVar_Result
strh r5, [r0]
b _08195E06
.pool
_08195E00:
ldr r1, =gSpecialVar_Result
movs r0, 0
strh r0, [r1]
_08195E06:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8195DB8
thumb_func_start sub_8195E10
sub_8195E10: @ 8195E10
push {lr}

View File

@ -5,31 +5,6 @@
.section .rodata
.align 2
gUnknown_0860DE50:: @ 860DE50
.4byte sub_8195980
.4byte sub_8195A38
.4byte sub_8195AE4
.4byte sub_8195BB0
.4byte sub_8195C20
.4byte sub_8195C50
.4byte sub_8195C7C
.4byte sub_8195CE4
.4byte sub_8195D28
.4byte sub_8195DB8
gUnknown_0860DE78:: @ 860DE78
.2byte 0x003f, 0x0040, 0x0041, 0x0043, 0x0042, 0x0046
gUnknown_0860DE84:: @ 860DE84
.2byte 0x00b3, 0x00b4, 0x00b7, 0x00c8, 0x00b9, 0x00bb, 0x00c4, 0x00c6, 0x00ba, 0x0000
gUnknown_0860DE98:: @ 860DE98
.4byte 0x00000010, 0x00000020, 0x00400000, 0x00800000
gUnknown_0860DEA8:: @ 860DEA8
.4byte 0xffffffef, 0xffffffdf, 0xffbfffff, 0xff7fffff
.align 2
gUnknown_0860DEB8:: @ 860DEB8 //struct
.2byte 0x0025, 0x0000, 0x0108, 0x0208, 0x0308, 0x0103, 0x0008, 0x0108, 0x0208, 0x0000

View File

@ -88,7 +88,7 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_25752E:: @ 825752E
applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_257BF2
waitmovement 0
setvar VAR_0x8004, 5
special sub_8195960
special CallBattlePalaceFunction
msgbox gStringVar4, 4
waitmessage
call BattleFrontier_BattleArenaBattleRoom_EventScript_257B6C

View File

@ -80,7 +80,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25AEA7:: @ 825AEA7
compare VAR_TEMP_F, 0
goto_if 5, BattleFrontier_BattleFactoryBattleRoom_EventScript_25AF9C
setvar VAR_0x8004, 5
special sub_8195960
special CallBattlePalaceFunction
lockall
msgbox gStringVar4, 4
waitmessage

View File

@ -60,7 +60,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24F8BF:: @ 824F8BF
applymovement 2, BattleFrontier_BattlePalaceBattleRoom_Movement_24FEA1
waitmovement 0
setvar VAR_0x8004, 5
special sub_8195960
special CallBattlePalaceFunction
msgbox gStringVar4, 4
waitmessage
call BattleFrontier_BattlePalaceBattleRoom_EventScript_24FDF7
@ -189,7 +189,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24FB3F:: @ 824FB3F
waitmessage
setvar VAR_0x8004, 7
setvar VAR_0x8005, 2
special sub_8195960
special CallBattlePalaceFunction
playse SE_SAVE
waitse
fadescreen 1
@ -263,7 +263,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24FCAA:: @ 824FCAA
BattleFrontier_BattlePalaceBattleRoom_EventScript_24FCC7:: @ 824FCC7
setvar VAR_0x8004, 6
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 12
special CallFrontierUtilFunc
compare VAR_RESULT, 0
@ -306,7 +306,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24FD67:: @ 824FD67
BattleFrontier_BattlePalaceBattleRoom_EventScript_24FD84:: @ 824FD84
setvar VAR_0x8004, 6
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 12
special CallFrontierUtilFunc
compare VAR_RESULT, 2

View File

@ -13,7 +13,7 @@ BattleFrontier_BattlePalaceCorridor_EventScript_24F4B3:: @ 824F4B3
waitmovement 0
lockall
setvar VAR_0x8004, 3
special sub_8195960
special CallBattlePalaceFunction
compare VAR_RESULT, 0
call_if 1, BattleFrontier_BattlePalaceCorridor_EventScript_24F58B
compare VAR_RESULT, 1

View File

@ -32,11 +32,11 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D7D0:: @ 824D7D0
setvar VAR_0x8004, 2
setvar VAR_0x8005, 1
setvar VAR_0x8006, 0
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 2
setvar VAR_0x8005, 2
setvar VAR_0x8006, 0
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 2
setvar VAR_0x8005, 0
setvar VAR_0x8006, 0
@ -78,7 +78,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D873:: @ 824D873
setvar VAR_0x8004, 2
setvar VAR_0x8005, 2
setvar VAR_0x8006, 0
special sub_8195960
special CallBattlePalaceFunction
call BattleFrontier_BattlePalaceLobby_EventScript_24D8A1
msgbox BattleFrontier_BattlePalaceLobby_Text_24E0D8, 4
closemessage
@ -93,7 +93,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D8A1:: @ 824D8A1
special HealPlayerParty
setvar VAR_0x8004, 7
setvar VAR_0x8005, 0
special sub_8195960
special CallBattlePalaceFunction
playse SE_SAVE
waitse
call BattleFrontier_BattlePalaceLobby_EventScript_23E8E0
@ -120,7 +120,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D908:: @ 824D908
waitmessage
setvar VAR_0x8004, 7
setvar VAR_0x8005, 1
special sub_8195960
special CallBattlePalaceFunction
playse SE_SAVE
waitse
setvar VAR_0x8004, 2
@ -149,7 +149,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D956:: @ 824D956
BattleFrontier_BattlePalaceLobby_EventScript_24D968:: @ 824D968
setvar VAR_0x8004, 1
setvar VAR_0x8005, 0
special sub_8195960
special CallBattlePalaceFunction
compare VAR_RESULT, 0
goto_if 5, BattleFrontier_BattlePalaceLobby_EventScript_24D817
special SavePlayerParty
@ -207,11 +207,11 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DA87:: @ 824DA87
setvar VAR_0x8005, 4
special CallFrontierUtilFunc
setvar VAR_0x8004, 0
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 2
setvar VAR_0x8005, 2
setvar VAR_0x8006, 1
special sub_8195960
special CallBattlePalaceFunction
setvar VAR_0x8004, 2
setvar VAR_0x8005, 0
setvar VAR_0x8006, 1

View File

@ -245,7 +245,7 @@ gSpecials:: @ 81DBA64
def_special CallFrontierUtilFunc
def_special sub_8161F74
def_special CallBattleDomeFunction
def_special sub_8195960
def_special CallBattlePalaceFunction
def_special CopyEReaderTrainerGreeting
def_special DoSpecialTrainerBattle
def_special CallBattleArenaFunction

View File

@ -424,7 +424,8 @@ struct BattleFrontier
/*0xD1C*/ u16 domeTotalChampionships[2][2];
/*0xD24*/ struct BattleDomeTrainer domeTrainers[DOME_TOURNAMENT_TRAINERS_COUNT];
/*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][3];
/*0xD64*/ u16 field_DC4[2];
/*0xDC4*/ u16 field_DC4;
/*0xDC6*/ u16 field_DC6;
/*0xDC8*/ u16 palaceWinStreaks[2][2];
/*0xDD0*/ u16 palaceRecordWinStreaks[2][2];
/*0xDD8*/ u16 field_DD8;

View File

@ -259,7 +259,7 @@ SECTIONS {
src/trainer_pokemon_sprites.o(.text);
src/lilycove_lady.o(.text);
src/battle_dome.o(.text);
src/battle_frontier_1.o(.text);
src/battle_palace.o(.text);
asm/battle_frontier_1.o(.text);
src/menu.o(.text);
src/battle_factory_screen.o(.text);
@ -567,6 +567,7 @@ SECTIONS {
src/trainer_pokemon_sprites.o(.rodata);
src/lilycove_lady.o(.rodata);
src/battle_dome.o(.rodata);
src/battle_palace.o(.rodata);
data/battle_frontier_1.o(.rodata);
src/menu.o(.rodata);
src/battle_factory_screen.o(.rodata);

View File

@ -1,118 +0,0 @@
#include "global.h"
#include "event_data.h"
#include "battle_setup.h"
#include "overworld.h"
#include "random.h"
#include "battle_tower.h"
extern void SetBattleFacilityTrainerGfxId(u16, u8);
extern void (* const gUnknown_0860DE50[])(void);
extern const u32 gUnknown_0860DE98[][2];
extern const u32 gUnknown_0860DEA8[][2];
// code
void sub_8195960(void)
{
gUnknown_0860DE50[gSpecialVar_0x8004]();
}
void sub_8195980(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.field_CA9_b = 0;
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]))
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
gTrainerBattleOpponent_A = 0;
}
void sub_8195A38(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
switch (gSpecialVar_0x8005)
{
case 0:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_DC4[1];
break;
case 1:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
break;
case 2:
gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]) != 0);
break;
}
}
void sub_8195AE4(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
switch (gSpecialVar_0x8005)
{
case 0:
gSaveBlock2Ptr->frontier.field_DC4[1] = gSpecialVar_0x8006;
break;
case 1:
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006;
break;
case 2:
if (gSpecialVar_0x8006)
gSaveBlock2Ptr->frontier.field_CDC |= gUnknown_0860DE98[battleMode][lvlMode];
else
gSaveBlock2Ptr->frontier.field_CDC &= gUnknown_0860DEA8[battleMode][lvlMode];
break;
}
}
void sub_8195BB0(void)
{
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 50)
gSpecialVar_Result = Random() % 3;
else if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 99)
gSpecialVar_Result = 3;
else
gSpecialVar_Result = 4;
}
void sub_8195C20(void)
{
gTrainerBattleOpponent_A = 5 *(Random() % 255) / 64u;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
}
void sub_8195C50(void)
{
if (gTrainerBattleOpponent_A < 300)
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
}
/*
void sub_8195C7C(void)
{
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 9999)
{
u16 wat = 0;
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode]++;
if (lvlMode < gSaveBlock2Ptr->frontier.field_DD0[battleMode][lvlMode])
wat = 1;
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][wat] != 0)
gSaveBlock2Ptr->frontier.field_DD0[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
}
}
*/

187
src/battle_palace.c Normal file
View File

@ -0,0 +1,187 @@
#include "global.h"
#include "event_data.h"
#include "battle_setup.h"
#include "overworld.h"
#include "random.h"
#include "battle_tower.h"
#include "frontier_util.h"
#include "item.h"
#include "constants/items.h"
// This file's functions.
static void sub_8195980(void);
static void sub_8195A38(void);
static void sub_8195AE4(void);
static void sub_8195BB0(void);
static void sub_8195C20(void);
static void sub_8195C50(void);
static void sub_8195C7C(void);
static void sub_8195CE4(void);
static void sub_8195D28(void);
static void sub_8195DB8(void);
// Const rom data.
static void (* const sBattlePalaceFunctions[])(void) =
{
sub_8195980,
sub_8195A38,
sub_8195AE4,
sub_8195BB0,
sub_8195C20,
sub_8195C50,
sub_8195C7C,
sub_8195CE4,
sub_8195D28,
sub_8195DB8,
};
static const u16 gUnknown_0860DE78[] = {ITEM_HP_UP, ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_CARBOS, ITEM_ZINC};
static const u16 gUnknown_0860DE84[] = {ITEM_BRIGHT_POWDER, ITEM_WHITE_HERB, ITEM_QUICK_CLAW, ITEM_LEFTOVERS, ITEM_MENTAL_HERB, ITEM_KINGS_ROCK, ITEM_FOCUS_BAND, ITEM_SCOPE_LENS, ITEM_CHOICE_BAND};
static const u32 gUnknown_0860DE98[][2] =
{
{0x10, 0x20},
{0x400000, 0x800000},
};
static const u32 gUnknown_0860DEA8[][2] =
{
{~0x10, ~0x20},
{~0x400000, ~0x800000},
};
// code
void CallBattlePalaceFunction(void)
{
sBattlePalaceFunctions[gSpecialVar_0x8004]();
}
static void sub_8195980(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
gSaveBlock2Ptr->frontier.field_CA8 = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.field_CA9_b = 0;
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]))
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
gTrainerBattleOpponent_A = 0;
}
static void sub_8195A38(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
switch (gSpecialVar_0x8005)
{
case 0:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_DC6;
break;
case 1:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
break;
case 2:
gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]) != 0);
break;
}
}
static void sub_8195AE4(void)
{
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
switch (gSpecialVar_0x8005)
{
case 0:
gSaveBlock2Ptr->frontier.field_DC6 = gSpecialVar_0x8006;
break;
case 1:
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006;
break;
case 2:
if (gSpecialVar_0x8006)
gSaveBlock2Ptr->frontier.field_CDC |= gUnknown_0860DE98[battleMode][lvlMode];
else
gSaveBlock2Ptr->frontier.field_CDC &= gUnknown_0860DEA8[battleMode][lvlMode];
break;
}
}
static void sub_8195BB0(void)
{
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 50)
gSpecialVar_Result = Random() % 3;
else if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 99)
gSpecialVar_Result = 3;
else
gSpecialVar_Result = 4;
}
static void sub_8195C20(void)
{
gTrainerBattleOpponent_A = 5 *(Random() % 255) / 64u;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
}
static void sub_8195C50(void)
{
if (gTrainerBattleOpponent_A < 300)
FrontierSpeechToString(gFacilityTrainers[gTrainerBattleOpponent_A].speechBefore);
}
static void sub_8195C7C(void)
{
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] < 9999)
{
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode]++;
// Whatever GF planned to do here, they messed up big time.
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][(lvlMode > gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode]) ? 1 : 0])
gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
}
}
static void sub_8195CE4(void)
{
gSaveBlock2Ptr->frontier.field_CA8 = gSpecialVar_0x8005;
VarSet(VAR_TEMP_0, 0);
gSaveBlock2Ptr->frontier.field_CA9_a = 1;
sub_81A4C30();
}
static void sub_8195D28(void)
{
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] > 41)
gSaveBlock2Ptr->frontier.field_DC6 = gUnknown_0860DE84[Random() % ARRAY_COUNT(gUnknown_0860DE84)];
else
gSaveBlock2Ptr->frontier.field_DC6 = gUnknown_0860DE78[Random() % ARRAY_COUNT(gUnknown_0860DE78)];
}
static void sub_8195DB8(void)
{
if (AddBagItem(gSaveBlock2Ptr->frontier.field_DC6, 1) == TRUE)
{
CopyItemName(gSaveBlock2Ptr->frontier.field_DC6, gStringVar1);
gSaveBlock2Ptr->frontier.field_DC6 = 0;
gSpecialVar_Result = TRUE;
}
else
{
gSpecialVar_Result = FALSE;
}
}

View File

@ -117,7 +117,7 @@ static const u8 gUnknown_086125DC[][4] =
{0x15, 0x46, 0x23, 0x00},
};
static void (* const gUnknown_086125F8[])(void) =
static void (* const sBattlePikeFunctions[])(void) =
{
sub_81A705C,
sub_81A7140,
@ -172,7 +172,7 @@ static const u32 gUnknown_08612690[] = {0x400, 0x800};
// code
void CallBattlePikeFunction(void)
{
gUnknown_086125F8[gSpecialVar_0x8004]();
sBattlePikeFunctions[gSpecialVar_0x8004]();
}
static void sub_81A705C(void)