mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
GameClear nonsense
This commit is contained in:
parent
2a3ba78831
commit
97bbb326b8
@ -5,154 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GameClear
|
||||
GameClear: @ 8137734
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x1C
|
||||
bl HealPlayerParty
|
||||
ldr r4, =0x00000864
|
||||
adds r0, r4, 0
|
||||
bl FlagGet
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0x1
|
||||
bne _08137760
|
||||
ldr r0, =gHasHallOfFameRecords
|
||||
strb r1, [r0]
|
||||
b _0813776C
|
||||
.pool
|
||||
_08137760:
|
||||
ldr r1, =gHasHallOfFameRecords
|
||||
movs r0, 0
|
||||
strb r0, [r1]
|
||||
adds r0, r4, 0
|
||||
bl FlagSet
|
||||
_0813776C:
|
||||
movs r0, 0x1
|
||||
bl GetGameStat
|
||||
cmp r0, 0
|
||||
bne _0813778E
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r2, [r0]
|
||||
ldrh r1, [r2, 0xE]
|
||||
lsls r1, 16
|
||||
ldrb r0, [r2, 0x10]
|
||||
lsls r0, 8
|
||||
orrs r1, r0
|
||||
ldrb r0, [r2, 0x11]
|
||||
orrs r1, r0
|
||||
movs r0, 0x1
|
||||
bl SetGameStat
|
||||
_0813778E:
|
||||
bl sub_8076D48
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
ldrb r0, [r0, 0x8]
|
||||
cmp r0, 0
|
||||
bne _081377AC
|
||||
movs r0, 0x1
|
||||
bl sub_8084F6C
|
||||
b _081377B2
|
||||
.pool
|
||||
_081377AC:
|
||||
movs r0, 0x2
|
||||
bl sub_8084F6C
|
||||
_081377B2:
|
||||
movs r7, 0
|
||||
movs r6, 0
|
||||
add r0, sp, 0x18
|
||||
mov r8, r0
|
||||
mov r5, sp
|
||||
_081377BC:
|
||||
movs r0, 0x64
|
||||
adds r1, r6, 0
|
||||
muls r1, r0
|
||||
ldr r0, =gPlayerParty
|
||||
adds r4, r1, r0
|
||||
movs r0, 0
|
||||
strb r6, [r5]
|
||||
strb r0, [r5, 0x1]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x5
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
beq _0813780A
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x6
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
bne _0813780A
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x43
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
bne _0813780A
|
||||
movs r0, 0x1
|
||||
mov r1, r8
|
||||
strb r0, [r1]
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x43
|
||||
add r2, sp, 0x18
|
||||
bl SetMonData
|
||||
adds r0, r4, 0
|
||||
bl GetRibbonCount
|
||||
strb r0, [r5, 0x1]
|
||||
movs r7, 0x1
|
||||
_0813780A:
|
||||
adds r5, 0x4
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x5
|
||||
ble _081377BC
|
||||
cmp r7, 0x1
|
||||
bne _0813785A
|
||||
movs r0, 0x2A
|
||||
bl IncrementGameStat
|
||||
ldr r0, =0x0000089b
|
||||
bl FlagSet
|
||||
mov r3, sp
|
||||
add r2, sp, 0x4
|
||||
movs r6, 0x4
|
||||
_08137828:
|
||||
ldrb r1, [r3, 0x1]
|
||||
ldrb r0, [r2, 0x1]
|
||||
cmp r0, r1
|
||||
bls _08137838
|
||||
ldr r1, [sp]
|
||||
ldr r0, [r2]
|
||||
str r0, [sp]
|
||||
str r1, [r2]
|
||||
_08137838:
|
||||
adds r2, 0x4
|
||||
subs r6, 0x1
|
||||
cmp r6, 0
|
||||
bge _08137828
|
||||
mov r0, sp
|
||||
ldrb r0, [r0, 0x1]
|
||||
cmp r0, 0x4
|
||||
bls _0813785A
|
||||
mov r0, sp
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x64
|
||||
muls r0, r1
|
||||
ldr r1, =gPlayerParty
|
||||
adds r0, r1
|
||||
movs r1, 0x43
|
||||
bl sub_80EE4DC
|
||||
_0813785A:
|
||||
ldr r0, =CB2_DoHallOfFameScreen
|
||||
bl SetMainCallback2
|
||||
movs r0, 0
|
||||
add sp, 0x1C
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end GameClear
|
||||
|
||||
thumb_func_start sp0C8_whiteout_maybe
|
||||
sp0C8_whiteout_maybe: @ 813787C
|
||||
push {lr}
|
||||
|
@ -17,7 +17,7 @@ void SetSaveBlocksPointers(u16 offset);
|
||||
void MoveSaveBlocks_ResetHeap(void);
|
||||
u32 GetSecretBase2Field_9(void);
|
||||
void ClearSecretBase2Field_9(void);
|
||||
void sub_8076D48(void);
|
||||
void SetSecretBase2Field_9(void);
|
||||
void sub_8076D5C(void);
|
||||
void sav2_gender2_inplace_and_xFE(void);
|
||||
void SavePlayerParty(void);
|
||||
|
@ -4,5 +4,6 @@
|
||||
|
||||
u16 sub_80F903C(void);
|
||||
void ReducePlayerPartyToThree(void);
|
||||
void HealPlayerParty(void);
|
||||
|
||||
#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
|
||||
|
@ -178,6 +178,7 @@ SECTIONS {
|
||||
src/rom6.o(.text);
|
||||
src/pokeblock.o(.text);
|
||||
src/fldeff_flash.o(.text);
|
||||
src/post_battle_event_funcs.o(.text);
|
||||
asm/post_battle_event_funcs.o(.text);
|
||||
src/time_events.o(.text);
|
||||
src/birch_pc.o(.text);
|
||||
|
@ -144,7 +144,7 @@ void ClearSecretBase2Field_9(void)
|
||||
gSaveBlock2Ptr->specialSaveWarp &= ~1;
|
||||
}
|
||||
|
||||
void sub_8076D48(void)
|
||||
void SetSecretBase2Field_9(void)
|
||||
{
|
||||
gSaveBlock2Ptr->specialSaveWarp |= 1;
|
||||
}
|
||||
|
88
src/post_battle_event_funcs.c
Normal file
88
src/post_battle_event_funcs.c
Normal file
@ -0,0 +1,88 @@
|
||||
#include "global.h"
|
||||
#include "main.h"
|
||||
#include "credits.h"
|
||||
#include "event_data.h"
|
||||
#include "hall_of_fame.h"
|
||||
#include "load_save.h"
|
||||
#include "overworld.h"
|
||||
#include "script_pokemon_util_80F87D8.h"
|
||||
#include "tv.h"
|
||||
#include "constants/heal_locations.h"
|
||||
#include "constants/flags.h"
|
||||
|
||||
int GameClear(void)
|
||||
{
|
||||
int i;
|
||||
bool32 ribbonGet;
|
||||
struct RibbonCounter {
|
||||
u8 partyIndex;
|
||||
u8 count;
|
||||
} ribbonCounts[6];
|
||||
s8 val;
|
||||
|
||||
HealPlayerParty();
|
||||
|
||||
if (FlagGet(FLAG_SYS_GAME_CLEAR) == TRUE)
|
||||
{
|
||||
gHasHallOfFameRecords = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gHasHallOfFameRecords = FALSE;
|
||||
FlagSet(FLAG_SYS_GAME_CLEAR);
|
||||
}
|
||||
|
||||
if (GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME) == 0)
|
||||
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
|
||||
|
||||
SetSecretBase2Field_9();
|
||||
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F);
|
||||
else
|
||||
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F);
|
||||
|
||||
ribbonGet = FALSE;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[i];
|
||||
|
||||
ribbonCounts[i].partyIndex = i;
|
||||
ribbonCounts[i].count = 0;
|
||||
|
||||
if (GetMonData(mon, MON_DATA_SANITY_BIT2)
|
||||
&& !GetMonData(mon, MON_DATA_SANITY_BIT3)
|
||||
&& !GetMonData(mon, MON_DATA_CHAMPION_RIBBON))
|
||||
{
|
||||
val = TRUE;
|
||||
SetMonData(mon, MON_DATA_CHAMPION_RIBBON, &val);
|
||||
ribbonCounts[i].count = GetRibbonCount(mon);
|
||||
ribbonGet = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ribbonGet == TRUE)
|
||||
{
|
||||
IncrementGameStat(GAME_STAT_RECEIVED_RIBBONS);
|
||||
FlagSet(FLAG_SYS_RIBBON_GET);
|
||||
|
||||
for (i = 1; i < 6; i++)
|
||||
{
|
||||
if (ribbonCounts[0].count > ribbonCounts[i].count)
|
||||
{
|
||||
struct RibbonCounter prevBest = ribbonCounts[0];
|
||||
ribbonCounts[0] = ribbonCounts[i];
|
||||
ribbonCounts[i] = prevBest;
|
||||
}
|
||||
}
|
||||
|
||||
if (ribbonCounts[0].count > 4)
|
||||
{
|
||||
sub_80EE4DC(&gPlayerParty[ribbonCounts[0].partyIndex], MON_DATA_CHAMPION_RIBBON);
|
||||
}
|
||||
}
|
||||
|
||||
SetMainCallback2(CB2_DoHallOfFameScreen);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user