Merge master into sync-script
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void))
|
||||
return 1;
|
||||
|
||||
sTimerNum = timerNum;
|
||||
sTimerReg = ®_TMCNT(sTimerNum);
|
||||
sTimerReg = ®_TMCNT_L(sTimerNum);
|
||||
*intrFunc = FlashTimerIntr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -687,8 +687,8 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, u8 notTransform)
|
||||
gSprites[gBattlerSpriteIds[battlerAtk]].pos1.y = GetBattlerSpriteDefault_Y(battlerAtk);
|
||||
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleMonForms[battlerAtk]);
|
||||
SetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_NICKNAME, gSpeciesNames[targetSpecies]);
|
||||
sub_80496C0(gHealthboxSpriteIds[battlerAtk], &gEnemyParty[gBattlerPartyIndexes[battlerAtk]]);
|
||||
sub_804981C(gHealthboxSpriteIds[battlerAtk], 1);
|
||||
UpdateNickInHealthbox(gHealthboxSpriteIds[battlerAtk], &gEnemyParty[gBattlerPartyIndexes[battlerAtk]]);
|
||||
TryAddPokeballIconToHealthbox(gHealthboxSpriteIds[battlerAtk], 1);
|
||||
}
|
||||
else if (notTransform)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1254,7 +1254,7 @@ const u8 *const gUnknown_83FE7F4[] = {
|
||||
sText_Speed
|
||||
};
|
||||
|
||||
const u8 gUnknown_83FE80C[] = _("{HIGHLIGHT 2}SAFARI BALLS"); //
|
||||
const u8 gText_SafariBalls[] = _("{HIGHLIGHT 2}SAFARI BALLS"); //
|
||||
const u8 gText_HighlightRed_Left[] = _("{HIGHLIGHT 2}Left: ");
|
||||
const u8 gText_HighlightRed[] = _("{HIGHLIGHT 2}");
|
||||
const u8 gText_Sleep[] = _("sleep");
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include "safari_zone.h"
|
||||
#include "quest_log.h"
|
||||
#include "script.h"
|
||||
#include "script_pokemon_util_80A0058.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "event_data.h"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
#include "new_game.h"
|
||||
#include "save.h"
|
||||
#include "item.h"
|
||||
#include "script_pokemon_util_80A0058.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
const u8 gMapSecName_PalletTown[] = _("PALLET TOWN");
|
||||
const u8 gMapSecName_ViridianCity[] = _("VIRIDIAN CITY");
|
||||
const u8 gMapSecName_PewterCity[] = _("PEWTER CITY");
|
||||
const u8 gMapSecName_CeruleanCity[] = _("CERULEAN CITY");
|
||||
const u8 gMapSecName_LavenderTown[] = _("LAVENDER TOWN");
|
||||
const u8 gMapSecName_VermilionCity[] = _("VERMILION CITY");
|
||||
const u8 gMapSecName_CeladonCity[] = _("CELADON CITY");
|
||||
const u8 gMapSecName_FuchsiaCity[] = _("FUCHSIA CITY");
|
||||
const u8 gMapSecName_CinnabarIsland[] = _("CINNABAR ISLAND");
|
||||
const u8 gMapSecName_IndigoPlateau[] = _("INDIGO PLATEAU");
|
||||
const u8 gMapSecName_SaffronCity[] = _("SAFFRON CITY");
|
||||
const u8 gMapSecName_Route4[] = _("ROUTE 4");
|
||||
const u8 gMapSecName_Route10[] = _("ROUTE 10");
|
||||
const u8 gMapSecName_Route1[] = _("ROUTE 1");
|
||||
const u8 gMapSecName_Route2[] = _("ROUTE 2");
|
||||
const u8 gMapSecName_Route3[] = _("ROUTE 3");
|
||||
const u8 gMapSecName_Route4_2[] = _("ROUTE 4");
|
||||
const u8 gMapSecName_Route5[] = _("ROUTE 5");
|
||||
const u8 gMapSecName_Route6[] = _("ROUTE 6");
|
||||
const u8 gMapSecName_Route7[] = _("ROUTE 7");
|
||||
const u8 gMapSecName_Route8[] = _("ROUTE 8");
|
||||
const u8 gMapSecName_Route9[] = _("ROUTE 9");
|
||||
const u8 gMapSecName_Route10_2[] = _("ROUTE 10");
|
||||
const u8 gMapSecName_Route11[] = _("ROUTE 11");
|
||||
const u8 gMapSecName_Route12[] = _("ROUTE 12");
|
||||
const u8 gMapSecName_Route13[] = _("ROUTE 13");
|
||||
const u8 gMapSecName_Route14[] = _("ROUTE 14");
|
||||
const u8 gMapSecName_Route15[] = _("ROUTE 15");
|
||||
const u8 gMapSecName_Route16[] = _("ROUTE 16");
|
||||
const u8 gMapSecName_Route17[] = _("ROUTE 17");
|
||||
const u8 gMapSecName_Route18[] = _("ROUTE 18");
|
||||
const u8 gMapSecName_Route19[] = _("ROUTE 19");
|
||||
const u8 gMapSecName_Route20[] = _("ROUTE 20");
|
||||
const u8 gMapSecName_Route21[] = _("ROUTE 21");
|
||||
const u8 gMapSecName_Route22[] = _("ROUTE 22");
|
||||
const u8 gMapSecName_Route23[] = _("ROUTE 23");
|
||||
const u8 gMapSecName_Route24[] = _("ROUTE 24");
|
||||
const u8 gMapSecName_Route25[] = _("ROUTE 25");
|
||||
const u8 gMapSecName_ViridianForest[] = _("VIRIDIAN FOREST");
|
||||
const u8 gMapSecName_MtMoon[] = _("MT. MOON");
|
||||
const u8 gMapSecName_SSAnne[] = _("S.S. ANNE");
|
||||
const u8 gMapSecName_UndergroundPath[] = _("UNDERGROUND PATH");
|
||||
const u8 gMapSecName_UndergroundPath_2[] = _("UNDERGROUND PATH");
|
||||
const u8 gMapSecName_DiglettsCave[] = _("DIGLETT'S CAVE");
|
||||
const u8 gMapSecName_VictoryRoad[] = _("VICTORY ROAD");
|
||||
const u8 gMapSecName_RocketHideout[] = _("ROCKET HIDEOUT");
|
||||
const u8 gMapSecName_SilphCo[] = _("SILPH CO.");
|
||||
const u8 gMapSecName_PokemonMansion[] = _("POKéMON MANSION");
|
||||
const u8 gMapSecName_SafariZone[] = _("SAFARI ZONE");
|
||||
const u8 gMapSecName_PokemonLeague[] = _("POKéMON LEAGUE");
|
||||
const u8 gMapSecName_RockTunnel[] = _("ROCK TUNNEL");
|
||||
const u8 gMapSecName_SeafoamIslands[] = _("SEAFOAM ISLANDS");
|
||||
const u8 gMapSecName_PokemonTower[] = _("POKéMON TOWER");
|
||||
const u8 gMapSecName_CeruleanCave[] = _("CERULEAN CAVE");
|
||||
const u8 gMapSecName_PowerPlant[] = _("POWER PLANT");
|
||||
const u8 gMapSecName_OneIsland[] = _("ONE ISLAND");
|
||||
const u8 gMapSecName_TwoIsland[] = _("TWO ISLAND");
|
||||
const u8 gMapSecName_ThreeIsland[] = _("THREE ISLAND");
|
||||
const u8 gMapSecName_FourIsland[] = _("FOUR ISLAND");
|
||||
const u8 gMapSecName_FiveIsland[] = _("FIVE ISLAND");
|
||||
const u8 gMapSecName_SevenIsland[] = _("SEVEN ISLAND");
|
||||
const u8 gMapSecName_SixIsland[] = _("SIX ISLAND");
|
||||
const u8 gMapSecName_KindleRoad[] = _("KINDLE ROAD");
|
||||
const u8 gMapSecName_TreasureBeach[] = _("TREASURE BEACH");
|
||||
const u8 gMapSecName_CapeBrink[] = _("CAPE BRINK");
|
||||
const u8 gMapSecName_BondBridge[] = _("BOND BRIDGE");
|
||||
const u8 gMapSecName_ThreeIslePort[] = _("THREE ISLE PORT");
|
||||
const u8 gMapSecName_SeviiIsle6[] = _("SEVII ISLE 6");
|
||||
const u8 gMapSecName_SeviiIsle7[] = _("SEVII ISLE 7");
|
||||
const u8 gMapSecName_SeviiIsle8[] = _("SEVII ISLE 8");
|
||||
const u8 gMapSecName_SeviiIsle9[] = _("SEVII ISLE 9");
|
||||
const u8 gMapSecName_ResortGorgeous[] = _("RESORT GORGEOUS");
|
||||
const u8 gMapSecName_WaterLabyrinth[] = _("WATER LABYRINTH");
|
||||
const u8 gMapSecName_FiveIsleMeadow[] = _("FIVE ISLE MEADOW");
|
||||
const u8 gMapSecName_MemorialPillar[] = _("MEMORIAL PILLAR");
|
||||
const u8 gMapSecName_OutcastIsland[] = _("OUTCAST ISLAND");
|
||||
const u8 gMapSecName_GreenPath[] = _("GREEN PATH");
|
||||
const u8 gMapSecName_WaterPath[] = _("WATER PATH");
|
||||
const u8 gMapSecName_RuinValley[] = _("RUIN VALLEY");
|
||||
const u8 gMapSecName_TrainerTower[] = _("TRAINER TOWER");
|
||||
const u8 gMapSecName_CanyonEntrance[] = _("CANYON ENTRANCE");
|
||||
const u8 gMapSecName_SevaultCanyon[] = _("SEVAULT CANYON");
|
||||
const u8 gMapSecName_TanobyRuins[] = _("TANOBY RUINS");
|
||||
const u8 gMapSecName_SeviiIsle22[] = _("SEVII ISLE 22");
|
||||
const u8 gMapSecName_SeviiIsle23[] = _("SEVII ISLE 23");
|
||||
const u8 gMapSecName_SeviiIsle24[] = _("SEVII ISLE 24");
|
||||
const u8 gMapSecName_NavelRock[] = _("NAVEL ROCK");
|
||||
const u8 gMapSecName_MtEmber[] = _("MT. EMBER");
|
||||
const u8 gMapSecName_BerryForest[] = _("BERRY FOREST");
|
||||
const u8 gMapSecName_IcefallCave[] = _("ICEFALL CAVE");
|
||||
const u8 gMapSecName_RocketWarehouse[] = _("ROCKET WAREHOUSE");
|
||||
const u8 gMapSecName_TrainerTower_2[] = _("TRAINER TOWER");
|
||||
const u8 gMapSecName_DottedHole[] = _("DOTTED HOLE");
|
||||
const u8 gMapSecName_LostCave[] = _("LOST CAVE");
|
||||
const u8 gMapSecName_PatternBush[] = _("PATTERN BUSH");
|
||||
const u8 gMapSecName_AlteringCave[] = _("ALTERING CAVE");
|
||||
const u8 gMapSecName_TanobyChambers[] = _("TANOBY CHAMBERS");
|
||||
const u8 gMapSecName_ThreeIslePath[] = _("THREE ISLE PATH");
|
||||
const u8 gMapSecName_TanobyKey[] = _("TANOBY KEY");
|
||||
const u8 gMapSecName_BirthIsland[] = _("BIRTH ISLAND");
|
||||
const u8 gMapSecName_MoneanChamber[] = _("MONEAN CHAMBER");
|
||||
const u8 gMapSecName_LiptooChamber[] = _("LIPTOO CHAMBER");
|
||||
const u8 gMapSecName_WeepthChamber[] = _("WEEPTH CHAMBER");
|
||||
const u8 gMapSecName_DilfordChamber[] = _("DILFORD CHAMBER");
|
||||
const u8 gMapSecName_ScufibChamber[] = _("SCUFIB CHAMBER");
|
||||
const u8 gMapSecName_RixyChamber[] = _("RIXY CHAMBER");
|
||||
const u8 gMapSecName_ViapoisChamber[] = _("VIAPOIS CHAMBER");
|
||||
const u8 gMapSecName_EmberSpa[] = _("EMBER SPA");
|
||||
const u8 gMapSecName_CeladonDept[] = _("CELADON DEPT.");
|
||||
File diff suppressed because it is too large
Load Diff
+2222
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
||||
#include "librfu.h"
|
||||
|
||||
static void Sio32IDIntr(void);
|
||||
static void Sio32IDInit(void);
|
||||
static s32 Sio32IDMain(void);
|
||||
|
||||
struct RfuSIO32Id gRfuSIO32Id;
|
||||
|
||||
static const u16 Sio32ConnectionData[] = { 0x494e, 0x544e, 0x4e45, 0x4f44 }; // NINTENDO
|
||||
static const char Sio32IDLib_Var[] = "Sio32ID_030820";
|
||||
|
||||
s32 AgbRFU_checkID(u8 r5)
|
||||
{
|
||||
u16 r8;
|
||||
vu16 *r4;
|
||||
s32 r6;
|
||||
|
||||
if (REG_IME == 0)
|
||||
return -1;
|
||||
r8 = REG_IE;
|
||||
gSTWIStatus->state = 10;
|
||||
STWI_set_Callback_ID(Sio32IDIntr);
|
||||
Sio32IDInit();
|
||||
r4 = ®_TMCNT_L(gSTWIStatus->timerSelect);
|
||||
r5 *= 8;
|
||||
while (--r5 != 0xFF)
|
||||
{
|
||||
r6 = Sio32IDMain();
|
||||
if (r6 != 0)
|
||||
break;
|
||||
r4[1] = 0;
|
||||
r4[0] = 0;
|
||||
r4[1] = TIMER_1024CLK | TIMER_ENABLE;
|
||||
while (r4[0] < 32)
|
||||
;
|
||||
r4[1] = 0;
|
||||
r4[0] = 0;
|
||||
}
|
||||
REG_IME = 0;
|
||||
REG_IE = r8;
|
||||
REG_IME = 1;
|
||||
gSTWIStatus->state = 0;
|
||||
STWI_set_Callback_ID(NULL);
|
||||
return r6;
|
||||
}
|
||||
|
||||
static void Sio32IDInit(void)
|
||||
{
|
||||
REG_IME = 0;
|
||||
REG_IE &= ~((8 << gSTWIStatus->timerSelect) | INTR_FLAG_SERIAL);
|
||||
REG_IME = 1;
|
||||
REG_RCNT = 0;
|
||||
REG_SIOCNT = SIO_32BIT_MODE;
|
||||
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
|
||||
CpuFill32(0, &gRfuSIO32Id, sizeof(struct RfuSIO32Id));
|
||||
REG_IF = INTR_FLAG_SERIAL;
|
||||
}
|
||||
|
||||
static s32 Sio32IDMain(void)
|
||||
{
|
||||
u8 r12;
|
||||
|
||||
switch (r12 = gRfuSIO32Id.unk1)
|
||||
{
|
||||
case 0:
|
||||
gRfuSIO32Id.unk0 = 1;
|
||||
REG_SIOCNT |= SIO_38400_BPS;
|
||||
REG_IME = r12;
|
||||
REG_IE |= INTR_FLAG_SERIAL;
|
||||
REG_IME = 1;
|
||||
gRfuSIO32Id.unk1 = 1;
|
||||
*(vu8 *)®_SIOCNT |= SIO_ENABLE;
|
||||
break;
|
||||
case 1:
|
||||
if (gRfuSIO32Id.unkA == 0)
|
||||
{
|
||||
if (gRfuSIO32Id.unk0 == 1)
|
||||
{
|
||||
if (gRfuSIO32Id.unk2 == 0)
|
||||
{
|
||||
REG_IME = gRfuSIO32Id.unk2;
|
||||
REG_SIOCNT |= SIO_ENABLE;
|
||||
REG_IME = r12;
|
||||
}
|
||||
}
|
||||
else if (gRfuSIO32Id.unk4 != 0x8001 && !gRfuSIO32Id.unk2)
|
||||
{
|
||||
REG_IME = gRfuSIO32Id.unk2;
|
||||
REG_IE &= ~INTR_FLAG_SERIAL;
|
||||
REG_IME = r12;
|
||||
REG_SIOCNT = gRfuSIO32Id.unk2;
|
||||
REG_SIOCNT = SIO_32BIT_MODE;
|
||||
REG_IF = INTR_FLAG_SERIAL;
|
||||
REG_SIOCNT |= SIO_INTR_ENABLE | SIO_ENABLE;
|
||||
REG_IME = gRfuSIO32Id.unk2;
|
||||
REG_IE |= INTR_FLAG_SERIAL;
|
||||
REG_IME = r12;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
gRfuSIO32Id.unk1 = 2;
|
||||
// fallthrough
|
||||
}
|
||||
default:
|
||||
return gRfuSIO32Id.unkA;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void Sio32IDIntr(void)
|
||||
{
|
||||
u32 r5;
|
||||
u16 r0;
|
||||
#ifndef NONMATCHING
|
||||
register u32 r1 asm("r1");
|
||||
register u16 r0_ asm("r0");
|
||||
#else
|
||||
u32 r1;
|
||||
u16 r0_;
|
||||
#endif
|
||||
|
||||
r5 = REG_SIODATA32;
|
||||
if (gRfuSIO32Id.unk0 != 1)
|
||||
REG_SIOCNT |= SIO_ENABLE;
|
||||
r1 = 16 * gRfuSIO32Id.unk0; // to handle side effect of inline asm
|
||||
r1 = (r5 << r1) >> 16;
|
||||
r5 = (r5 << 16 * (1 - gRfuSIO32Id.unk0)) >> 16;
|
||||
if (gRfuSIO32Id.unkA == 0)
|
||||
{
|
||||
if (r1 == gRfuSIO32Id.unk6)
|
||||
{
|
||||
if (gRfuSIO32Id.unk2 > 3)
|
||||
{
|
||||
gRfuSIO32Id.unkA = r5;
|
||||
}
|
||||
else if (r1 == (u16)~gRfuSIO32Id.unk4)
|
||||
{
|
||||
r0_ = ~gRfuSIO32Id.unk6;
|
||||
if (r5 == r0_)
|
||||
++gRfuSIO32Id.unk2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gRfuSIO32Id.unk2 = gRfuSIO32Id.unkA;
|
||||
}
|
||||
}
|
||||
if (gRfuSIO32Id.unk2 < 4)
|
||||
gRfuSIO32Id.unk4 = *(gRfuSIO32Id.unk2 + Sio32ConnectionData);
|
||||
else
|
||||
gRfuSIO32Id.unk4 = 0x8001;
|
||||
gRfuSIO32Id.unk6 = ~r5;
|
||||
REG_SIODATA32 = (gRfuSIO32Id.unk4 << 16 * (1 - gRfuSIO32Id.unk0))
|
||||
+ (gRfuSIO32Id.unk6 << 16 * gRfuSIO32Id.unk0);
|
||||
if (gRfuSIO32Id.unk0 == 1 && (gRfuSIO32Id.unk2 || r5 == 0x494E))
|
||||
{
|
||||
for (r0 = 0; r0 < 600; ++r0)
|
||||
;
|
||||
if (gRfuSIO32Id.unkA == 0)
|
||||
REG_SIOCNT |= SIO_ENABLE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,647 @@
|
||||
#include "librfu.h"
|
||||
|
||||
static void STWI_intr_timer(void);
|
||||
static u16 STWI_init(u8 request);
|
||||
static s32 STWI_start_Command(void);
|
||||
static void STWI_set_timer(u8 unk);
|
||||
static void STWI_stop_timer(void);
|
||||
static s32 STWI_restart_Command(void);
|
||||
static s32 STWI_reset_ClockCounter(void);
|
||||
|
||||
struct STWIStatus *gSTWIStatus;
|
||||
|
||||
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam)
|
||||
{
|
||||
// If we're copying our interrupt into RAM, DMA it to block1 and use
|
||||
// block2 for our STWIStatus, otherwise block1 holds the STWIStatus.
|
||||
// interrupt usually is a pointer to gIntrTable[1]
|
||||
if (copyInterruptToRam == TRUE)
|
||||
{
|
||||
*interrupt = (IntrFunc)interruptStruct->block1;
|
||||
DmaCopy16(3, &IntrSIO32, interruptStruct->block1, sizeof(interruptStruct->block1));
|
||||
gSTWIStatus = &interruptStruct->block2;
|
||||
}
|
||||
else
|
||||
{
|
||||
*interrupt = IntrSIO32;
|
||||
gSTWIStatus = (struct STWIStatus *)interruptStruct->block1;
|
||||
}
|
||||
gSTWIStatus->rxPacket = &interruptStruct->rxPacketAlloc;
|
||||
gSTWIStatus->txPacket = &interruptStruct->txPacketAlloc;
|
||||
gSTWIStatus->msMode = 1;
|
||||
gSTWIStatus->state = 0;
|
||||
gSTWIStatus->reqLength = 0;
|
||||
gSTWIStatus->reqNext = 0;
|
||||
gSTWIStatus->ackLength = 0;
|
||||
gSTWIStatus->ackNext = 0;
|
||||
gSTWIStatus->ackActiveCommand = 0;
|
||||
gSTWIStatus->timerState = 0;
|
||||
gSTWIStatus->timerActive = 0;
|
||||
gSTWIStatus->error = 0;
|
||||
gSTWIStatus->recoveryCount = 0;
|
||||
gSTWIStatus->unk_2c = 0;
|
||||
REG_RCNT = 0x100; // TODO: mystery bit?
|
||||
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
|
||||
STWI_init_Callback_M();
|
||||
STWI_init_Callback_S();
|
||||
IntrEnable(INTR_FLAG_SERIAL);
|
||||
}
|
||||
|
||||
void STWI_init_timer(IntrFunc *interrupt, s32 timerSelect)
|
||||
{
|
||||
*interrupt = STWI_intr_timer;
|
||||
gSTWIStatus->timerSelect = timerSelect;
|
||||
IntrEnable(INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect);
|
||||
}
|
||||
|
||||
void AgbRFU_SoftReset(void)
|
||||
{
|
||||
vu16 *timerL;
|
||||
vu16 *timerH;
|
||||
|
||||
REG_RCNT = 0x8000;
|
||||
REG_RCNT = 0x80A0; // all these bits are undocumented
|
||||
timerL = ®_TMCNT_L(gSTWIStatus->timerSelect);
|
||||
timerH = ®_TMCNT_H(gSTWIStatus->timerSelect);
|
||||
*timerH = 0;
|
||||
*timerL = 0;
|
||||
*timerH = TIMER_ENABLE | TIMER_1024CLK;
|
||||
while (*timerL <= 0x11)
|
||||
REG_RCNT = 0x80A2;
|
||||
*timerH = 3;
|
||||
REG_RCNT = 0x80A0;
|
||||
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
|
||||
gSTWIStatus->state = 0;
|
||||
gSTWIStatus->reqLength = 0;
|
||||
gSTWIStatus->reqNext = 0;
|
||||
gSTWIStatus->reqActiveCommand = 0;
|
||||
gSTWIStatus->ackLength = 0;
|
||||
gSTWIStatus->ackNext = 0;
|
||||
gSTWIStatus->ackActiveCommand = 0;
|
||||
gSTWIStatus->timerState = 0;
|
||||
gSTWIStatus->timerActive = 0;
|
||||
gSTWIStatus->error = 0;
|
||||
gSTWIStatus->msMode = 1;
|
||||
gSTWIStatus->recoveryCount = 0;
|
||||
gSTWIStatus->unk_2c = 0;
|
||||
}
|
||||
|
||||
void STWI_set_MS_mode(u8 mode)
|
||||
{
|
||||
gSTWIStatus->msMode = mode;
|
||||
}
|
||||
|
||||
u16 STWI_read_status(u8 index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return gSTWIStatus->error;
|
||||
case 1:
|
||||
return gSTWIStatus->msMode;
|
||||
case 2:
|
||||
return gSTWIStatus->state;
|
||||
case 3:
|
||||
return gSTWIStatus->reqActiveCommand;
|
||||
default:
|
||||
return 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_init_Callback_M(void)
|
||||
{
|
||||
STWI_set_Callback_M(NULL);
|
||||
}
|
||||
|
||||
void STWI_init_Callback_S(void)
|
||||
{
|
||||
STWI_set_Callback_S(NULL);
|
||||
}
|
||||
|
||||
// The callback can take 2 or 3 arguments.
|
||||
void STWI_set_Callback_M(void *callbackM)
|
||||
{
|
||||
gSTWIStatus->callbackM = callbackM;
|
||||
}
|
||||
|
||||
void STWI_set_Callback_S(void (*callbackS)(u16))
|
||||
{
|
||||
gSTWIStatus->callbackS = callbackS;
|
||||
}
|
||||
|
||||
void STWI_set_Callback_ID(void (*func)(void)) // name in SDK, but is actually setting a function pointer
|
||||
{
|
||||
gSTWIStatus->unk_20 = func;
|
||||
}
|
||||
|
||||
u16 STWI_poll_CommandEnd(void)
|
||||
{
|
||||
while (gSTWIStatus->unk_2c == TRUE)
|
||||
;
|
||||
return gSTWIStatus->error;
|
||||
}
|
||||
|
||||
void STWI_send_ResetREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_RESET_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_LinkStatusREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_LINK_STATUS_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_VersionStatusREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_VERSION_STATUS_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SystemStatusREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SYSTEM_STATUS_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SlotStatusREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SLOT_STATUS_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_ConfigStatusREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_CONFIG_STATUS_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_GameConfigREQ(const u8 *unk1, const u8 *data)
|
||||
{
|
||||
u8 *packetBytes;
|
||||
s32 i;
|
||||
|
||||
if (!STWI_init(ID_GAME_CONFIG_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 6;
|
||||
// TODO: what is unk1
|
||||
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
|
||||
packetBytes += sizeof(u32);
|
||||
*(u16 *)packetBytes = *(u16 *)unk1;
|
||||
packetBytes += sizeof(u16);
|
||||
unk1 += sizeof(u16);
|
||||
for (i = 0; i < 14; ++i)
|
||||
{
|
||||
*packetBytes = *unk1;
|
||||
++packetBytes;
|
||||
++unk1;
|
||||
}
|
||||
for (i = 0; i < 8; ++i)
|
||||
{
|
||||
*packetBytes = *data;
|
||||
++packetBytes;
|
||||
++data;
|
||||
}
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SystemConfigREQ(u16 unk1, u8 unk2, u8 unk3)
|
||||
{
|
||||
if (!STWI_init(ID_SYSTEM_CONFIG_REQ))
|
||||
{
|
||||
u8 *packetBytes;
|
||||
|
||||
gSTWIStatus->reqLength = 1;
|
||||
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
|
||||
packetBytes += sizeof(u32);
|
||||
*packetBytes++ = unk3;
|
||||
*packetBytes++ = unk2;
|
||||
*(u16*)packetBytes = unk1;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SC_StartREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SC_START_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SC_PollingREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SC_POLL_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SC_EndREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SC_END_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SP_StartREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SP_START_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SP_PollingREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SP_POLL_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_SP_EndREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_SP_END_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CP_StartREQ(u16 unk1)
|
||||
{
|
||||
if (!STWI_init(ID_CP_START_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 1;
|
||||
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk1;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CP_PollingREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_CP_POLL_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CP_EndREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_CP_END_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DataTxREQ(const void *in, u8 size)
|
||||
{
|
||||
if (!STWI_init(ID_DATA_TX_REQ))
|
||||
{
|
||||
u8 reqLength = (size / sizeof(u32));
|
||||
if (size & (sizeof(u32) - 1))
|
||||
reqLength += 1;
|
||||
gSTWIStatus->reqLength = reqLength;
|
||||
CpuCopy32(in, gSTWIStatus->txPacket->rfuPacket32.data, gSTWIStatus->reqLength * sizeof(u32));
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DataTxAndChangeREQ(const void *in, u8 size)
|
||||
{
|
||||
if (!STWI_init(ID_DATA_TX_AND_CHANGE_REQ))
|
||||
{
|
||||
u8 reqLength = (size / sizeof(u32));
|
||||
if (size & (sizeof(u32) - 1))
|
||||
reqLength += 1;
|
||||
gSTWIStatus->reqLength = reqLength;
|
||||
CpuCopy32(in, gSTWIStatus->txPacket->rfuPacket32.data, gSTWIStatus->reqLength * sizeof(u32));
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DataRxREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_DATA_RX_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_MS_ChangeREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_MS_CHANGE_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DataReadyAndChangeREQ(u8 unk)
|
||||
{
|
||||
if (!STWI_init(ID_DATA_READY_AND_CHANGE_REQ))
|
||||
{
|
||||
if (!unk)
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 *packetBytes;
|
||||
|
||||
gSTWIStatus->reqLength = 1;
|
||||
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
|
||||
packetBytes += sizeof(u32);
|
||||
*packetBytes++ = unk;
|
||||
*packetBytes++ = 0;
|
||||
*packetBytes++ = 0;
|
||||
*packetBytes = 0;
|
||||
}
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DisconnectedAndChangeREQ(u8 unk0, u8 unk1)
|
||||
{
|
||||
if (!STWI_init(ID_DISCONNECTED_AND_CHANGE_REQ))
|
||||
{
|
||||
u8 *packetBytes;
|
||||
|
||||
gSTWIStatus->reqLength = 1;
|
||||
packetBytes = gSTWIStatus->txPacket->rfuPacket8.data;
|
||||
packetBytes += sizeof(u32);
|
||||
*packetBytes++ = unk0;
|
||||
*packetBytes++ = unk1;
|
||||
*packetBytes++ = 0;
|
||||
*packetBytes = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_ResumeRetransmitAndChangeREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_RESUME_RETRANSMIT_AND_CHANGE_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_DisconnectREQ(u8 unk)
|
||||
{
|
||||
if (!STWI_init(ID_DISCONNECT_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 1;
|
||||
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_TestModeREQ(u8 unk0, u8 unk1)
|
||||
{
|
||||
if (!STWI_init(ID_TEST_MODE_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 1;
|
||||
gSTWIStatus->txPacket->rfuPacket32.data[0] = unk0 | (unk1 << 8);
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CPR_StartREQ(u16 unk0, u16 unk1, u8 unk2)
|
||||
{
|
||||
u32 *packetData;
|
||||
u32 arg1;
|
||||
|
||||
if (!STWI_init(ID_CPR_START_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 2;
|
||||
arg1 = unk1 | (unk0 << 16);
|
||||
packetData = gSTWIStatus->txPacket->rfuPacket32.data;
|
||||
packetData[0] = arg1;
|
||||
packetData[1] = unk2;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CPR_PollingREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_CPR_POLL_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_CPR_EndREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_CPR_END_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
void STWI_send_StopModeREQ(void)
|
||||
{
|
||||
if (!STWI_init(ID_STOP_MODE_REQ))
|
||||
{
|
||||
gSTWIStatus->reqLength = 0;
|
||||
STWI_start_Command();
|
||||
}
|
||||
}
|
||||
|
||||
static void STWI_intr_timer(void)
|
||||
{
|
||||
switch (gSTWIStatus->timerState)
|
||||
{
|
||||
// TODO: Make an enum for these
|
||||
case 2:
|
||||
gSTWIStatus->timerActive = 1;
|
||||
STWI_set_timer(50);
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
STWI_stop_timer();
|
||||
STWI_restart_Command();
|
||||
break;
|
||||
case 3:
|
||||
gSTWIStatus->timerActive = 1;
|
||||
STWI_stop_timer();
|
||||
STWI_reset_ClockCounter();
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(255, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void STWI_set_timer(u8 unk)
|
||||
{
|
||||
vu16 *timerL;
|
||||
vu16 *timerH;
|
||||
|
||||
timerL = ®_TMCNT_L(gSTWIStatus->timerSelect);
|
||||
timerH = ®_TMCNT_H(gSTWIStatus->timerSelect);
|
||||
REG_IME = 0;
|
||||
switch (unk)
|
||||
{
|
||||
case 50:
|
||||
*timerL = 0xFCCB;
|
||||
gSTWIStatus->timerState = 1;
|
||||
break;
|
||||
case 80:
|
||||
*timerL = 0xFAE0;
|
||||
gSTWIStatus->timerState = 2;
|
||||
break;
|
||||
case 100:
|
||||
*timerL = 0xF996;
|
||||
gSTWIStatus->timerState = 3;
|
||||
break;
|
||||
case 130:
|
||||
*timerL = 0xF7AD;
|
||||
gSTWIStatus->timerState = 4;
|
||||
break;
|
||||
}
|
||||
*timerH = TIMER_ENABLE | TIMER_INTR_ENABLE | TIMER_1024CLK;
|
||||
REG_IF = INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect;
|
||||
REG_IME = 1;
|
||||
}
|
||||
|
||||
static void STWI_stop_timer(void)
|
||||
{
|
||||
gSTWIStatus->timerState = 0;
|
||||
REG_TMCNT_L(gSTWIStatus->timerSelect) = 0;
|
||||
REG_TMCNT_H(gSTWIStatus->timerSelect) = 0;
|
||||
}
|
||||
|
||||
static u16 STWI_init(u8 request)
|
||||
{
|
||||
if (!REG_IME)
|
||||
{
|
||||
gSTWIStatus->error = ERR_REQ_CMD_IME_DISABLE;
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(request, gSTWIStatus->error);
|
||||
return TRUE;
|
||||
}
|
||||
else if (gSTWIStatus->unk_2c == TRUE)
|
||||
{
|
||||
gSTWIStatus->error = ERR_REQ_CMD_SENDING;
|
||||
gSTWIStatus->unk_2c = FALSE;
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(request, gSTWIStatus->error);
|
||||
return TRUE;
|
||||
}
|
||||
else if(!gSTWIStatus->msMode)
|
||||
{
|
||||
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_SLAVE;
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(request, gSTWIStatus->error, gSTWIStatus);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSTWIStatus->unk_2c = TRUE;
|
||||
gSTWIStatus->reqActiveCommand = request;
|
||||
gSTWIStatus->state = 0;
|
||||
gSTWIStatus->reqLength = 0;
|
||||
gSTWIStatus->reqNext = 0;
|
||||
gSTWIStatus->ackLength = 0;
|
||||
gSTWIStatus->ackNext = 0;
|
||||
gSTWIStatus->ackActiveCommand = 0;
|
||||
gSTWIStatus->timerState = 0;
|
||||
gSTWIStatus->timerActive = 0;
|
||||
gSTWIStatus->error = 0;
|
||||
gSTWIStatus->recoveryCount = 0;
|
||||
REG_RCNT = 0x100;
|
||||
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static s32 STWI_start_Command(void)
|
||||
{
|
||||
u16 imeTemp;
|
||||
|
||||
// equivalent to gSTWIStatus->txPacket->rfuPacket32.command,
|
||||
// but the cast here is required to avoid register issue
|
||||
*(u32 *)gSTWIStatus->txPacket->rfuPacket8.data = 0x99660000 | (gSTWIStatus->reqLength << 8) | gSTWIStatus->reqActiveCommand;
|
||||
REG_SIODATA32 = gSTWIStatus->txPacket->rfuPacket32.command;
|
||||
gSTWIStatus->state = 0;
|
||||
gSTWIStatus->reqNext = 1;
|
||||
imeTemp = REG_IME;
|
||||
REG_IME = 0;
|
||||
REG_IE |= (INTR_FLAG_TIMER0 << gSTWIStatus->timerSelect);
|
||||
REG_IE |= INTR_FLAG_SERIAL;
|
||||
REG_IME = imeTemp;
|
||||
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_MULTI_BUSY | SIO_115200_BPS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 STWI_restart_Command(void)
|
||||
{
|
||||
if (gSTWIStatus->recoveryCount <= 1)
|
||||
{
|
||||
++gSTWIStatus->recoveryCount;
|
||||
STWI_start_Command();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gSTWIStatus->reqActiveCommand == ID_MS_CHANGE_REQ || gSTWIStatus->reqActiveCommand == ID_DATA_TX_AND_CHANGE_REQ || gSTWIStatus->reqActiveCommand == ID_UNK35_REQ || gSTWIStatus->reqActiveCommand == ID_RESUME_RETRANSMIT_AND_CHANGE_REQ)
|
||||
{
|
||||
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_DRIFT;
|
||||
gSTWIStatus->unk_2c = 0;
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(gSTWIStatus->reqActiveCommand, gSTWIStatus->error);
|
||||
}
|
||||
else
|
||||
{
|
||||
gSTWIStatus->error = ERR_REQ_CMD_CLOCK_DRIFT;
|
||||
gSTWIStatus->unk_2c = 0;
|
||||
if (gSTWIStatus->callbackM != NULL)
|
||||
gSTWIStatus->callbackM(gSTWIStatus->reqActiveCommand, gSTWIStatus->error);
|
||||
gSTWIStatus->state = 4; // TODO: what's 4
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 STWI_reset_ClockCounter(void)
|
||||
{
|
||||
gSTWIStatus->state = 5; // TODO: what is 5
|
||||
gSTWIStatus->reqLength = 0;
|
||||
gSTWIStatus->reqNext = 0;
|
||||
REG_SIODATA32 = (1 << 31);
|
||||
REG_SIOCNT = 0;
|
||||
REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
|
||||
REG_SIOCNT = (SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS) + 0x7F;
|
||||
return 0;
|
||||
}
|
||||
+19
-42
@@ -1,4 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "bg.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "link.h"
|
||||
#include "link_rfu.h"
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
#include "m4a.h"
|
||||
#include "random.h"
|
||||
@@ -6,48 +11,20 @@
|
||||
#include "gba/flash_internal.h"
|
||||
#include "battle.h"
|
||||
#include "help_system.h"
|
||||
#include "sound.h"
|
||||
#include "new_menu_helpers.h"
|
||||
#include "malloc.h"
|
||||
#include "overworld.h"
|
||||
#include "sprite.h"
|
||||
#include "play_time.h"
|
||||
#include "pokemon.h"
|
||||
#include "intro.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "save_failed_screen.h"
|
||||
#include "battle.h"
|
||||
|
||||
extern u16 GetGpuReg(u8);
|
||||
extern void SetGpuReg(u8, u16);
|
||||
extern void RFUVSync(void);
|
||||
extern void LinkVSync(void);
|
||||
extern void sub_80FCF34(void);
|
||||
extern void LinkVSync(void);
|
||||
extern void InitGpuRegManager(void);
|
||||
extern void InitRFU(void);
|
||||
extern void CheckForFlashMemory(void);
|
||||
extern void InitMapMusic(void);
|
||||
extern void ResetBgs(void);
|
||||
extern void SetDefaultFontsPointer(void);
|
||||
extern void InitHeap(void *heapStart, u32 heapSize); // malloc.h
|
||||
extern void rfu_REQ_stopMode(void);
|
||||
extern void rfu_waitREQComplete(void);
|
||||
extern bool32 sub_80582E0(void);
|
||||
extern bool32 sub_8058274(void);
|
||||
extern void ClearSpriteCopyRequests(void);
|
||||
extern void PlayTimeCounter_Update(void);
|
||||
extern void MapMusicMain(void);
|
||||
extern void EnableInterrupts(u16);
|
||||
extern void sub_800DD28(void);
|
||||
extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void));
|
||||
extern void ScanlineEffect_Stop(void);
|
||||
extern void sub_80F50F4(void);
|
||||
extern bool32 sub_80F5118(void);
|
||||
|
||||
extern struct SoundInfo gSoundInfo;
|
||||
extern u32 gFlashMemoryPresent;
|
||||
extern u32 IntrMain[];
|
||||
extern u8 gHeap[];
|
||||
extern struct SaveBlock1 gSaveBlock1;
|
||||
extern struct SaveBlock2 gSaveBlock2;
|
||||
extern struct PokemonStorage gPokemonStorage;
|
||||
extern u32 gBattleTypeFlags;
|
||||
extern u8 gUnknown_03002748;
|
||||
extern u32 *gUnknown_0203CF5C;
|
||||
|
||||
void Timer3Intr(void);
|
||||
bool8 HandleLinkConnection(void);
|
||||
void c2_copyright_1(void);
|
||||
extern u32 intr_main[];
|
||||
|
||||
static void VBlankIntr(void);
|
||||
static void HBlankIntr(void);
|
||||
@@ -313,7 +290,7 @@ void InitIntrHandlers(void)
|
||||
for (i = 0; i < INTR_COUNT; i++)
|
||||
gIntrTable[i] = gIntrTableTemplate[i];
|
||||
|
||||
DmaCopy32(3, IntrMain, IntrMain_Buffer, sizeof(IntrMain_Buffer));
|
||||
DmaCopy32(3, intr_main, IntrMain_Buffer, sizeof(IntrMain_Buffer));
|
||||
|
||||
INTR_VECTOR = IntrMain_Buffer;
|
||||
|
||||
|
||||
@@ -552,7 +552,7 @@ static void sub_80F83D0(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
const struct MapPreviewScreen * sub_80F8544(u8 mapsec)
|
||||
const struct MapPreviewScreen * GetDungeonMapPreviewScreenInfo(u8 mapsec)
|
||||
{
|
||||
u8 idx;
|
||||
|
||||
|
||||
+1
-1
@@ -4201,7 +4201,7 @@ static void sub_8124BB0(struct Pokemon *mon, u8 fieldMove)
|
||||
Free(ptr);
|
||||
}
|
||||
|
||||
void sub_8124C1C(const u8 *healLocCtrlData) // TODO: confirm the type of data chunk at 0x83F2EE0
|
||||
void sub_8124C1C(const u8 *healLocCtrlData)
|
||||
{
|
||||
const struct MapHeader *mapHeader;
|
||||
struct FieldMoveWarpParams *ptr2;
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "global.h"
|
||||
#include "data.h"
|
||||
#include "script.h"
|
||||
#include "overworld.h"
|
||||
#include "battle.h"
|
||||
#include "palette.h"
|
||||
#include "pokemon.h"
|
||||
#include "party_menu.h"
|
||||
#include "field_fadetransition.h"
|
||||
#include "pokemon_summary_screen.h"
|
||||
#include "event_data.h"
|
||||
#include "string_util.h"
|
||||
#include "constants/moves.h"
|
||||
|
||||
static void sub_80BF97C(u8 taskId);
|
||||
|
||||
void Special_ChooseMonFromParty(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
taskId = CreateTask(sub_80BF97C, 10);
|
||||
gTasks[taskId].data[0] = PARTY_MENU_TYPE_CHOOSE_MON;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||
}
|
||||
|
||||
void Special_SelectMoveTutorMon(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
taskId = CreateTask(sub_80BF97C, 10);
|
||||
gTasks[taskId].data[0] = PARTY_MENU_TYPE_MOVE_RELEARNER;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
|
||||
}
|
||||
|
||||
static void sub_80BF97C(u8 taskId)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gPaletteFade.bufferTransferDisabled = TRUE;
|
||||
ChoosePartyMonByMenuType((u8)gTasks[taskId].data[0]);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void Special_SelectMove(void)
|
||||
{
|
||||
ShowSelectMovePokemonSummaryScreen(gPlayerParty, gSpecialVar_0x8004, gPlayerPartyCount - 1, CB2_ReturnToField, 0);
|
||||
sub_8138B38(3);
|
||||
gFieldCallback = FieldCallback_ReturnToEventScript2;
|
||||
}
|
||||
|
||||
void Special_GetNumMovesSelectedMonHas(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gSpecialVar_Result = 0;
|
||||
for (i = 0; i < MAX_MON_MOVES; ++i)
|
||||
if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_MOVE1 + i) != MOVE_NONE)
|
||||
++gSpecialVar_Result;
|
||||
}
|
||||
|
||||
void Special_BufferMoveDeleterNicknameAndMove(void)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[gSpecialVar_0x8004];
|
||||
u16 move = GetMonData(mon, MON_DATA_MOVE1 + gSpecialVar_0x8005);
|
||||
|
||||
GetMonNickname(mon, gStringVar1);
|
||||
StringCopy(gStringVar2, gMoveNames[move]);
|
||||
}
|
||||
|
||||
static void ShiftMoveSlot(struct Pokemon *mon, u8 slotTo, u8 slotFrom)
|
||||
{
|
||||
u16 move1 = GetMonData(mon, MON_DATA_MOVE1 + slotTo);
|
||||
u16 move0 = GetMonData(mon, MON_DATA_MOVE1 + slotFrom);
|
||||
u8 pp1 = GetMonData(mon, MON_DATA_PP1 + slotTo);
|
||||
u8 pp0 = GetMonData(mon, MON_DATA_PP1 + slotFrom);
|
||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||
u8 ppBonusMask1 = gPPUpGetMask[slotTo];
|
||||
u8 ppBonusMove1 = (ppBonuses & ppBonusMask1) >> (slotTo * 2);
|
||||
u8 ppBonusMask2 = gPPUpGetMask[slotFrom];
|
||||
u8 ppBonusMove2 = (ppBonuses & ppBonusMask2) >> (slotFrom * 2);
|
||||
|
||||
ppBonuses &= ~ppBonusMask1;
|
||||
ppBonuses &= ~ppBonusMask2;
|
||||
ppBonuses |= (ppBonusMove1 << (slotFrom * 2)) + (ppBonusMove2 << (slotTo * 2));
|
||||
SetMonData(mon, MON_DATA_MOVE1 + slotTo, &move0);
|
||||
SetMonData(mon, MON_DATA_MOVE1 + slotFrom, &move1);
|
||||
SetMonData(mon, MON_DATA_PP1 + slotTo, &pp0);
|
||||
SetMonData(mon, MON_DATA_PP1 + slotFrom, &pp1);
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
|
||||
}
|
||||
|
||||
void Special_MoveDeleterForgetMove(void)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
SetMonMoveSlot(&gPlayerParty[gSpecialVar_0x8004], MOVE_NONE, gSpecialVar_0x8005);
|
||||
RemoveMonPPBonus(&gPlayerParty[gSpecialVar_0x8004], gSpecialVar_0x8005);
|
||||
for (i = gSpecialVar_0x8005; i < MAX_MON_MOVES - 1; ++i)
|
||||
ShiftMoveSlot(&gPlayerParty[gSpecialVar_0x8004], i, i + 1);
|
||||
}
|
||||
|
||||
void Special_IsSelectedMonEgg(void)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_IS_EGG))
|
||||
gSpecialVar_Result = TRUE;
|
||||
else
|
||||
gSpecialVar_Result = FALSE;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
#include "global.h"
|
||||
#include "task.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "palette.h"
|
||||
|
||||
static void sub_80A0AC0(TaskFunc func, u16 a2, UNUSED u16 a3, u8 priority);
|
||||
static void sub_80A0B0C(u8 taskId);
|
||||
static void sub_80A0C78(u8 taskId);
|
||||
|
||||
void sub_80A0A48(u16 a1, u16 a2, u8 a3)
|
||||
{
|
||||
sub_80A0AC0(sub_80A0B0C, a1, a2, a3);
|
||||
}
|
||||
|
||||
void sub_80A0A70(u16 a1, u16 a2, u8 a3)
|
||||
{
|
||||
sub_80A0AC0(sub_80A0C78, a1, a2, a3);
|
||||
}
|
||||
|
||||
bool8 sub_80A0A98(void)
|
||||
{
|
||||
return FuncIsActiveTask(sub_80A0B0C);
|
||||
}
|
||||
|
||||
bool8 sub_80A0AAC(void)
|
||||
{
|
||||
return FuncIsActiveTask(sub_80A0C78);
|
||||
}
|
||||
|
||||
static void sub_80A0AC0(TaskFunc func, u16 a2, UNUSED u16 a3, u8 priority)
|
||||
{
|
||||
u8 taskId = CreateTask(func, priority);
|
||||
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = a2 == 0 ? 16 : a2;
|
||||
gTasks[taskId].data[2] = a2 == 0 ? 20 : a2;
|
||||
gTasks[taskId].func(taskId);
|
||||
}
|
||||
|
||||
static void sub_80A0B0C(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
task->data[3] = 120;
|
||||
task->data[4] = 120;
|
||||
task->data[5] = 80;
|
||||
task->data[6] = 81;
|
||||
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4]));
|
||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6]));
|
||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, 0);
|
||||
break;
|
||||
case 1:
|
||||
task->data[7] = GetGpuReg(REG_OFFSET_BLDCNT);
|
||||
task->data[8] = GetGpuReg(REG_OFFSET_BLDY);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD | BLDCNT_EFFECT_LIGHTEN);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 16);
|
||||
break;
|
||||
case 2:
|
||||
task->data[3] -= task->data[1];
|
||||
task->data[4] += task->data[1];
|
||||
if (task->data[3] <= 0 || task->data[4] >= DISPLAY_WIDTH)
|
||||
{
|
||||
task->data[3] = 0;
|
||||
task->data[4] = DISPLAY_WIDTH;
|
||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]);
|
||||
BlendPalettes(0xFFFFFFFF, 0, RGB_BLACK);
|
||||
gPlttBufferFaded[0] = 0;
|
||||
}
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4]));
|
||||
if (task->data[3])
|
||||
return;
|
||||
break;
|
||||
case 3:
|
||||
task->data[5] -= task->data[2];
|
||||
task->data[6] += task->data[2];
|
||||
if (task->data[5] <= 0 || task->data[6] >= DISPLAY_HEIGHT)
|
||||
{
|
||||
task->data[5] = 0;
|
||||
task->data[6] = DISPLAY_HEIGHT;
|
||||
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
|
||||
}
|
||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6]));
|
||||
if (task->data[5])
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, task->data[7]);
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
++task->data[0];
|
||||
}
|
||||
|
||||
static void sub_80A0C78(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
gPlttBufferFaded[0] = 0;
|
||||
break;
|
||||
case 1:
|
||||
task->data[3] = 0;
|
||||
task->data[4] = DISPLAY_WIDTH;
|
||||
task->data[5] = 0;
|
||||
task->data[6] = DISPLAY_HEIGHT;
|
||||
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4]));
|
||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6]));
|
||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, 0);
|
||||
break;
|
||||
case 2:
|
||||
task->data[5] += task->data[2];
|
||||
task->data[6] -= task->data[2];
|
||||
if (task->data[5] >= 80 || task->data[6] <= 81)
|
||||
{
|
||||
task->data[5] = 80;
|
||||
task->data[6] = 81;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD | BLDCNT_EFFECT_LIGHTEN);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 16);
|
||||
}
|
||||
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(task->data[5], task->data[6]));
|
||||
if (task->data[5] != 80)
|
||||
return;
|
||||
break;
|
||||
case 3:
|
||||
task->data[3] += task->data[1];
|
||||
task->data[4] -= task->data[1];
|
||||
if (task->data[3] >= 120 || task->data[4] <= 120)
|
||||
{
|
||||
task->data[3] = 120;
|
||||
task->data[4] = 120;
|
||||
BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK);
|
||||
gPlttBufferFaded[0] = 0;
|
||||
}
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(task->data[3], task->data[4]));
|
||||
if (task->data[3] != 120)
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
|
||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
++task->data[0];
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "script_pokemon_util_80A0058.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "event_data.h"
|
||||
#include "credits.h"
|
||||
#include "overworld.h"
|
||||
|
||||
+2
-2
@@ -3119,7 +3119,7 @@ static const u16 *sub_8113FBC(const u16 *a0)
|
||||
StringCopy(gStringVar1, ItemId_GetName(r5[0]));
|
||||
if (r5[0] == ITEM_ESCAPE_ROPE)
|
||||
{
|
||||
GetMapNameGeneric(gStringVar2, r5[2]);
|
||||
GetMapNameGeneric(gStringVar2, (u8)r5[2]);
|
||||
StringExpandPlaceholders(gStringVar4, gUnknown_841AFA6);
|
||||
}
|
||||
else if (r5[1] != 0xFFFF)
|
||||
@@ -4373,7 +4373,7 @@ static u16 *sub_81157DC(u16 *a0, const u16 *a1)
|
||||
static const u16 *sub_8115800(const u16 *a0)
|
||||
{
|
||||
const u16 *r4 = sub_8113E88(42, a0);
|
||||
GetMapNameGeneric(gStringVar1, r4[0]);
|
||||
GetMapNameGeneric(gStringVar1, (u8)r4[0]);
|
||||
StringExpandPlaceholders(gStringVar4, gUnknown_841B064);
|
||||
return r4 + 1;
|
||||
}
|
||||
|
||||
+4399
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -27,14 +27,13 @@
|
||||
#include "data.h"
|
||||
#include "field_specials.h"
|
||||
#include "constants/items.h"
|
||||
#include "script_pokemon_util_80A0058.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "party_menu.h"
|
||||
#include "money.h"
|
||||
#include "coins.h"
|
||||
#include "battle_setup.h"
|
||||
#include "shop.h"
|
||||
#include "script_pokemon_80F8.h"
|
||||
#include "slot_machine.h"
|
||||
#include "field_effect.h"
|
||||
#include "fieldmap.h"
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "berry.h"
|
||||
#include "daycare.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
#include "load_save.h"
|
||||
#include "malloc.h"
|
||||
#include "overworld.h"
|
||||
#include "party_menu.h"
|
||||
#include "pokedex.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/pokemon.h"
|
||||
|
||||
static void CB2_ReturnFromChooseHalfParty(void);
|
||||
static void CB2_ReturnFromChooseBattleTowerParty(void);
|
||||
|
||||
void HealPlayerParty(void)
|
||||
{
|
||||
u8 i, j;
|
||||
u8 ppBonuses;
|
||||
u8 arg[4];
|
||||
|
||||
// restore HP.
|
||||
for(i = 0; i < gPlayerPartyCount; i++)
|
||||
{
|
||||
u16 maxHP = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP);
|
||||
arg[0] = maxHP;
|
||||
arg[1] = maxHP >> 8;
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_HP, arg);
|
||||
ppBonuses = GetMonData(&gPlayerParty[i], MON_DATA_PP_BONUSES);
|
||||
|
||||
// restore PP.
|
||||
for(j = 0; j < MAX_MON_MOVES; j++)
|
||||
{
|
||||
arg[0] = CalculatePPWithBonus(GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j), ppBonuses, j);
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_PP1 + j, arg);
|
||||
}
|
||||
|
||||
// since status is u32, the four 0 assignments here are probably for safety to prevent undefined data from reaching SetMonData.
|
||||
arg[0] = 0;
|
||||
arg[1] = 0;
|
||||
arg[2] = 0;
|
||||
arg[3] = 0;
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_STATUS, arg);
|
||||
}
|
||||
}
|
||||
|
||||
u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 unused3)
|
||||
{
|
||||
u16 nationalDexNum;
|
||||
int sentToPc;
|
||||
u8 heldItem[2];
|
||||
struct Pokemon *mon = AllocZeroed(sizeof(struct Pokemon));
|
||||
|
||||
CreateMon(mon, species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
heldItem[0] = item;
|
||||
heldItem[1] = item >> 8;
|
||||
SetMonData(mon, MON_DATA_HELD_ITEM, heldItem);
|
||||
sentToPc = GiveMonToPlayer(mon);
|
||||
nationalDexNum = SpeciesToNationalPokedexNum(species);
|
||||
|
||||
switch(sentToPc)
|
||||
{
|
||||
case MON_GIVEN_TO_PARTY:
|
||||
case MON_GIVEN_TO_PC:
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT);
|
||||
break;
|
||||
}
|
||||
|
||||
Free(mon);
|
||||
return sentToPc;
|
||||
}
|
||||
|
||||
u8 ScriptGiveEgg(u16 species)
|
||||
{
|
||||
struct Pokemon *mon = AllocZeroed(sizeof(struct Pokemon));
|
||||
bool8 isEgg;
|
||||
bool8 sentToPc;
|
||||
|
||||
CreateEgg(mon, species, TRUE);
|
||||
isEgg = TRUE;
|
||||
SetMonData(mon, MON_DATA_IS_EGG, &isEgg);
|
||||
|
||||
sentToPc = GiveMonToPlayer(mon);
|
||||
Free(mon);
|
||||
return sentToPc;
|
||||
}
|
||||
|
||||
void HasEnoughMonsForDoubleBattle(void)
|
||||
{
|
||||
switch (GetMonsStateToDoubles())
|
||||
{
|
||||
case PLAYER_HAS_TWO_USABLE_MONS:
|
||||
gSpecialVar_Result = PLAYER_HAS_TWO_USABLE_MONS;
|
||||
break;
|
||||
case PLAYER_HAS_ONE_MON:
|
||||
gSpecialVar_Result = PLAYER_HAS_ONE_MON;
|
||||
break;
|
||||
case PLAYER_HAS_ONE_USABLE_MON:
|
||||
gSpecialVar_Result = PLAYER_HAS_ONE_USABLE_MON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool8 CheckPartyMonHasHeldItem(u16 item)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
|
||||
if (species != SPECIES_NONE && species != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == item)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 GetNameOfEnigmaBerryInPlayerParty(void)
|
||||
{
|
||||
bool8 hasItem = CheckPartyMonHasHeldItem(ITEM_ENIGMA_BERRY);
|
||||
if (hasItem == TRUE)
|
||||
GetBerryNameByBerryType(ItemIdToBerryType(ITEM_ENIGMA_BERRY), gStringVar1);
|
||||
|
||||
return hasItem;
|
||||
}
|
||||
|
||||
void CreateScriptedWildMon(u16 species, u8 level, u16 item)
|
||||
{
|
||||
u8 heldItem[2];
|
||||
|
||||
ZeroEnemyPartyMons();
|
||||
CreateMon(&gEnemyParty[0], species, level, 32, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
if (item)
|
||||
{
|
||||
heldItem[0] = item;
|
||||
heldItem[1] = item >> 8;
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, heldItem);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
|
||||
{
|
||||
if (monIndex > PARTY_SIZE)
|
||||
monIndex = gPlayerPartyCount - 1;
|
||||
|
||||
SetMonMoveSlot(&gPlayerParty[monIndex], move, slot);
|
||||
}
|
||||
|
||||
// Note: When control returns to the event script, gSpecialVar_Result will be
|
||||
// TRUE if the party selection was successful.
|
||||
void ChooseHalfPartyForBattle(void)
|
||||
{
|
||||
gMain.savedCallback = CB2_ReturnFromChooseHalfParty;
|
||||
// VarSet(VAR_FRONTIER_FACILITY, FACILITY_MULTI_OR_EREADER);
|
||||
InitChooseHalfPartyForBattle(0);
|
||||
}
|
||||
|
||||
static void CB2_ReturnFromChooseHalfParty(void)
|
||||
{
|
||||
switch (gSelectedOrderFromParty[0])
|
||||
{
|
||||
case 0:
|
||||
gSpecialVar_Result = FALSE;
|
||||
break;
|
||||
default:
|
||||
gSpecialVar_Result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
|
||||
void ChooseBattleTowerPlayerParty(void)
|
||||
{
|
||||
gMain.savedCallback = CB2_ReturnFromChooseBattleTowerParty;
|
||||
InitChooseHalfPartyForBattle(1);
|
||||
}
|
||||
|
||||
static void CB2_ReturnFromChooseBattleTowerParty(void)
|
||||
{
|
||||
switch (gSelectedOrderFromParty[0])
|
||||
{
|
||||
case 0:
|
||||
LoadPlayerParty();
|
||||
gSpecialVar_Result = FALSE;
|
||||
break;
|
||||
default:
|
||||
ReducePlayerPartyToThree();
|
||||
gSpecialVar_Result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
|
||||
void ReducePlayerPartyToThree(void)
|
||||
{
|
||||
struct Pokemon * party = AllocZeroed(3 * sizeof(struct Pokemon));
|
||||
int i;
|
||||
|
||||
// copy the selected pokemon according to the order.
|
||||
for (i = 0; i < 3; i++)
|
||||
if (gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
|
||||
party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal
|
||||
|
||||
CpuFill32(0, gPlayerParty, sizeof gPlayerParty);
|
||||
|
||||
// overwrite the first 3 with the order copied to.
|
||||
for (i = 0; i < 3; i++)
|
||||
gPlayerParty[i] = party[i];
|
||||
|
||||
CalculatePlayerPartyCount();
|
||||
Free(party);
|
||||
}
|
||||
+1
-1
@@ -1180,7 +1180,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing)
|
||||
return width;
|
||||
}
|
||||
|
||||
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
|
||||
u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str, int a3, int a4, int a5, int a6, int a7)
|
||||
{
|
||||
u8 shadowColor;
|
||||
u8 *strLocal;
|
||||
|
||||
+5
-5
@@ -2765,10 +2765,10 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
|
||||
|
||||
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
|
||||
{
|
||||
u8 r9 = a0.unk_01_0;
|
||||
u8 r4 = a0.unk_00_7;
|
||||
u8 r10 = a1.unk_01_0;
|
||||
u8 r0 = a1.unk_00_7;
|
||||
u8 r9 = a0.hasNationalDex;
|
||||
u8 r4 = a0.isChampion;
|
||||
u8 r10 = a1.hasNationalDex;
|
||||
u8 r0 = a1.isChampion;
|
||||
u8 r1 = a1.unk_01_2;
|
||||
u8 r2;
|
||||
|
||||
@@ -2845,7 +2845,7 @@ int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, str
|
||||
|
||||
int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species, u16 a2, u8 a3)
|
||||
{
|
||||
u8 canTradeEggAndNational = a0.unk_01_0;
|
||||
u8 canTradeEggAndNational = a0.hasNationalDex;
|
||||
|
||||
if (IsDeoxysOrMewUntradable(a2, a3))
|
||||
{
|
||||
|
||||
+31
-321
@@ -637,7 +637,6 @@ void sub_810C444(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
bool8 sub_810C4EC(void)
|
||||
{
|
||||
if (CheckBagHasItem(ITEM_VS_SEEKER, 1) == TRUE)
|
||||
@@ -648,18 +647,18 @@ bool8 sub_810C4EC(void)
|
||||
|
||||
if (FlagGet(FLAG_SYS_VS_SEEKER_CHARGING) == TRUE)
|
||||
{
|
||||
u16 x;
|
||||
do {
|
||||
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & 0xFF;
|
||||
} while (0);
|
||||
u8 x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & 0xFF;
|
||||
u32 r4 = 0xFF;
|
||||
|
||||
if (x < 100)
|
||||
{
|
||||
x++;
|
||||
gSaveBlock1Ptr->trainerRematchStepCounter = ((u16)(x << 8)) | (gSaveBlock1Ptr->trainerRematchStepCounter & 0xFF);
|
||||
#ifndef NONMATCHING // fool the compiler that r4 has been changed
|
||||
asm("":"=r"(r4));
|
||||
#endif
|
||||
gSaveBlock1Ptr->trainerRematchStepCounter = (gSaveBlock1Ptr->trainerRematchStepCounter & 0xFF) | (x << 8);
|
||||
}
|
||||
do {
|
||||
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & 0xFF;
|
||||
} while (0);
|
||||
x = (gSaveBlock1Ptr->trainerRematchStepCounter >> 8) & r4;
|
||||
if (x == 100)
|
||||
{
|
||||
FlagClear(FLAG_SYS_VS_SEEKER_CHARGING);
|
||||
@@ -671,80 +670,6 @@ bool8 sub_810C4EC(void)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
bool8 sub_810C4EC(void)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmovs r0, 0xB5\n"
|
||||
"\tlsls r0, 1\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tbl CheckBagHasItem\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbne _0810C516\n"
|
||||
"\tldr r0, _0810C568 @ =gSaveBlock1Ptr\n"
|
||||
"\tldr r0, [r0]\n"
|
||||
"\tmovs r2, 0xC7\n"
|
||||
"\tlsls r2, 3\n"
|
||||
"\tadds r1, r0, r2\n"
|
||||
"\tldrh r2, [r1]\n"
|
||||
"\tldrb r0, [r1]\n"
|
||||
"\tcmp r0, 0x63\n"
|
||||
"\tbhi _0810C516\n"
|
||||
"\tadds r0, r2, 0x1\n"
|
||||
"\tstrh r0, [r1]\n"
|
||||
"_0810C516:\n"
|
||||
"\tldr r7, _0810C56C @ =0x00000801\n"
|
||||
"\tadds r0, r7, 0\n"
|
||||
"\tbl FlagGet\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbne _0810C570\n"
|
||||
"\tldr r6, _0810C568 @ =gSaveBlock1Ptr\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tmovs r5, 0xC7\n"
|
||||
"\tlsls r5, 3\n"
|
||||
"\tadds r3, r0, r5\n"
|
||||
"\tldrh r2, [r3]\n"
|
||||
"\tlsrs r1, r2, 8\n"
|
||||
"\tmovs r4, 0xFF\n"
|
||||
"\tcmp r1, 0x63\n"
|
||||
"\tbhi _0810C548\n"
|
||||
"\tadds r1, 0x1\n"
|
||||
"\tlsls r1, 24\n"
|
||||
"\tmovs r0, 0xFF\n"
|
||||
"\tands r0, r2\n"
|
||||
"\tlsrs r1, 16\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrh r0, [r3]\n"
|
||||
"_0810C548:\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldrh r0, [r0]\n"
|
||||
"\tlsrs r0, 8\n"
|
||||
"\tands r0, r4\n"
|
||||
"\tcmp r0, 0x64\n"
|
||||
"\tbne _0810C570\n"
|
||||
"\tadds r0, r7, 0\n"
|
||||
"\tbl FlagClear\n"
|
||||
"\tbl sub_810C640\n"
|
||||
"\tbl sub_810D0D0\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tb _0810C572\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0810C568: .4byte gSaveBlock1Ptr\n"
|
||||
"_0810C56C: .4byte 0x00000801\n"
|
||||
"_0810C570:\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"_0810C572:\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r1}\n"
|
||||
"\tbx r1");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_810C578(void)
|
||||
{
|
||||
@@ -920,13 +845,17 @@ u8 CanUseVsSeeker(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Nonmatching due to register roulette
|
||||
#ifdef NONMATCHING
|
||||
static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
{
|
||||
u16 r8 = 0;
|
||||
u8 sp0 = 0;
|
||||
s32 vsSeekerIdx;
|
||||
u8 *r2;
|
||||
#ifndef NONMATCHING
|
||||
register u32 r3 asm("r3");
|
||||
register s32 r0_ asm("r0");
|
||||
asm("":::"r10", "r8", "r6", "r4");
|
||||
#endif
|
||||
|
||||
for (vsSeekerIdx = 0; sVsSeeker->trainerInfo[vsSeekerIdx].localId != 0xFF; vsSeekerIdx++)
|
||||
{
|
||||
@@ -936,6 +865,7 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
if (!HasTrainerBeenFought(r8))
|
||||
{
|
||||
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], gUnknown_8453F60);
|
||||
sVsSeeker->trainerInfo[vsSeekerIdx].trainerIdx += 0;
|
||||
sVsSeeker->trainerHasNotYetBeenFought = 1;
|
||||
}
|
||||
else
|
||||
@@ -944,7 +874,15 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
if (r7 == 0)
|
||||
{
|
||||
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], sMovementScript_TrainerNoRematch);
|
||||
#ifdef NONMATCHING
|
||||
sVsSeeker->trainerDoesNotWantRematch = 1;
|
||||
#else
|
||||
r2 = (u8 *)sVsSeeker;
|
||||
r3 = 0x431;
|
||||
asm("":::"r1");
|
||||
r2 = &r2[r3];
|
||||
*(r2) |= 2;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -957,7 +895,15 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
if (rval < 30)
|
||||
{
|
||||
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], sMovementScript_TrainerNoRematch);
|
||||
#ifdef NONMATCHING
|
||||
sVsSeeker->trainerDoesNotWantRematch = 1;
|
||||
#else
|
||||
r2 = (u8 *)sVsSeeker;
|
||||
r0_ = 0x431;
|
||||
asm("":::"r1");
|
||||
r2 = &r2[r0_];
|
||||
*(r2) |= 2;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -985,242 +931,6 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
{
|
||||
asm_unified("\tpush {r4-r7,lr}\n"
|
||||
"\tmov r7, r10\n"
|
||||
"\tmov r6, r9\n"
|
||||
"\tmov r5, r8\n"
|
||||
"\tpush {r5-r7}\n"
|
||||
"\tsub sp, 0x8\n"
|
||||
"\tstr r0, [sp, 0x4]\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tmov r8, r0\n"
|
||||
"\tmov r0, sp\n"
|
||||
"\tmov r1, r8\n"
|
||||
"\tstrb r1, [r0]\n"
|
||||
"\tmovs r2, 0\n"
|
||||
"\tmov r9, r2\n"
|
||||
"\tldr r4, _0810CA14 @ =sVsSeeker\n"
|
||||
"\tldr r0, [r4]\n"
|
||||
"\tldrb r0, [r0, 0x6]\n"
|
||||
"\tcmp r0, 0xFF\n"
|
||||
"\tbne _0810C9D0\n"
|
||||
"\tb _0810CB2C\n"
|
||||
"_0810C9D0:\n"
|
||||
"\tadds r6, r4, 0\n"
|
||||
"\tmovs r3, 0x86\n"
|
||||
"\tlsls r3, 3\n"
|
||||
"\tmov r10, r3\n"
|
||||
"\tmovs r5, 0\n"
|
||||
"_0810C9DA:\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tbl IsTrainerVisibleOnScreen\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbeq _0810C9EC\n"
|
||||
"\tb _0810CB18\n"
|
||||
"_0810C9EC:\n"
|
||||
"\tldr r0, [r4]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldrh r0, [r0, 0x4]\n"
|
||||
"\tmov r8, r0\n"
|
||||
"\tbl HasTrainerBeenFought\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _0810CA20\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldr r1, _0810CA18 @ =gUnknown_8453F60\n"
|
||||
"\tbl StartTrainerObjectMovementScript\n"
|
||||
"\tldr r2, [r6]\n"
|
||||
"\tldr r0, _0810CA1C @ =0x00000431\n"
|
||||
"\tadds r2, r0\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tb _0810CB14\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0810CA14: .4byte sVsSeeker\n"
|
||||
"_0810CA18: .4byte gUnknown_8453F60\n"
|
||||
"_0810CA1C: .4byte 0x00000431\n"
|
||||
"_0810CA20:\n"
|
||||
"\tldr r0, [sp, 0x4]\n"
|
||||
"\tmov r1, r8\n"
|
||||
"\tmov r2, sp\n"
|
||||
"\tbl GetNextAvailableRematchTrainer\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r7, r0, 24\n"
|
||||
"\tcmp r7, 0\n"
|
||||
"\tbne _0810CA50\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldr r1, _0810CA48 @ =sMovementScript_TrainerNoRematch\n"
|
||||
"\tbl StartTrainerObjectMovementScript\n"
|
||||
"\tldr r2, [r6]\n"
|
||||
"\tldr r3, _0810CA4C @ =0x00000431\n"
|
||||
"\tadds r2, r3\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tb _0810CB14\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0810CA48: .4byte sMovementScript_TrainerNoRematch\n"
|
||||
"_0810CA4C: .4byte 0x00000431\n"
|
||||
"_0810CA50:\n"
|
||||
"\tbl Random\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r0, 16\n"
|
||||
"\tmovs r1, 0x64\n"
|
||||
"\tbl __umodsi3\n"
|
||||
"\tlsls r0, 16\n"
|
||||
"\tlsrs r4, r0, 16\n"
|
||||
"\tmov r0, r9\n"
|
||||
"\tmov r1, r8\n"
|
||||
"\tbl GetCurVsSeekerResponse\n"
|
||||
"\tlsls r0, 24\n"
|
||||
"\tlsrs r0, 24\n"
|
||||
"\tcmp r0, 0x2\n"
|
||||
"\tbne _0810CA76\n"
|
||||
"\tmovs r4, 0x64\n"
|
||||
"\tb _0810CA7C\n"
|
||||
"_0810CA76:\n"
|
||||
"\tcmp r0, 0x1\n"
|
||||
"\tbne _0810CA7C\n"
|
||||
"\tmovs r4, 0\n"
|
||||
"_0810CA7C:\n"
|
||||
"\tcmp r4, 0x1D\n"
|
||||
"\tbhi _0810CAA0\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldr r1, _0810CA98 @ =sMovementScript_TrainerNoRematch\n"
|
||||
"\tbl StartTrainerObjectMovementScript\n"
|
||||
"\tldr r2, [r6]\n"
|
||||
"\tldr r0, _0810CA9C @ =0x00000431\n"
|
||||
"\tadds r2, r0\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\tmovs r1, 0x2\n"
|
||||
"\tb _0810CB14\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0810CA98: .4byte sMovementScript_TrainerNoRematch\n"
|
||||
"_0810CA9C: .4byte 0x00000431\n"
|
||||
"_0810CAA0:\n"
|
||||
"\tldr r0, _0810CB54 @ =gSaveBlock1Ptr\n"
|
||||
"\tldr r1, [r0]\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldr r2, _0810CB58 @ =0x0000063a\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tldrb r0, [r0, 0x6]\n"
|
||||
"\tadds r1, r0\n"
|
||||
"\tstrb r7, [r1]\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldrb r1, [r0, 0x7]\n"
|
||||
"\tlsls r0, r1, 3\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tlsls r0, 2\n"
|
||||
"\tldr r1, _0810CB5C @ =gObjectEvents\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tbl npc_coords_shift_still\n"
|
||||
"\tldr r0, [r6]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldr r1, _0810CB60 @ =sMovementScript_TrainerRematch\n"
|
||||
"\tbl StartTrainerObjectMovementScript\n"
|
||||
"\tldr r2, [r6]\n"
|
||||
"\tmov r3, r10\n"
|
||||
"\tadds r0, r2, r3\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tlsls r1, 1\n"
|
||||
"\tmovs r3, 0x80\n"
|
||||
"\tlsls r3, 3\n"
|
||||
"\tadds r0, r2, r3\n"
|
||||
"\tadds r0, r1\n"
|
||||
"\tmov r1, r8\n"
|
||||
"\tstrh r1, [r0]\n"
|
||||
"\tadds r2, r5\n"
|
||||
"\tldrb r0, [r2, 0xC]\n"
|
||||
"\tbl GetRunningBehaviorFromGraphicsId\n"
|
||||
"\tldr r1, [r6]\n"
|
||||
"\tmov r3, r10\n"
|
||||
"\tadds r2, r1, r3\n"
|
||||
"\tmovs r3, 0x84\n"
|
||||
"\tlsls r3, 3\n"
|
||||
"\tadds r1, r3\n"
|
||||
"\tldrb r2, [r2]\n"
|
||||
"\tadds r1, r2\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tldr r1, [r6]\n"
|
||||
"\tadd r1, r10\n"
|
||||
"\tldrb r0, [r1]\n"
|
||||
"\tadds r0, 0x1\n"
|
||||
"\tstrb r0, [r1]\n"
|
||||
"\tldr r2, [r6]\n"
|
||||
"\tldr r0, _0810CB64 @ =0x00000431\n"
|
||||
"\tadds r2, r0\n"
|
||||
"\tldrb r0, [r2]\n"
|
||||
"\tmovs r1, 0x4\n"
|
||||
"_0810CB14:\n"
|
||||
"\torrs r0, r1\n"
|
||||
"\tstrb r0, [r2]\n"
|
||||
"_0810CB18:\n"
|
||||
"\tadds r5, 0x10\n"
|
||||
"\tmovs r1, 0x1\n"
|
||||
"\tadd r9, r1\n"
|
||||
"\tldr r4, _0810CB68 @ =sVsSeeker\n"
|
||||
"\tldr r0, [r4]\n"
|
||||
"\tadds r0, r5\n"
|
||||
"\tldrb r0, [r0, 0x6]\n"
|
||||
"\tcmp r0, 0xFF\n"
|
||||
"\tbeq _0810CB2C\n"
|
||||
"\tb _0810C9DA\n"
|
||||
"_0810CB2C:\n"
|
||||
"\tldr r2, _0810CB68 @ =sVsSeeker\n"
|
||||
"\tldr r0, [r2]\n"
|
||||
"\tldr r3, _0810CB64 @ =0x00000431\n"
|
||||
"\tadds r0, r3\n"
|
||||
"\tldrb r1, [r0]\n"
|
||||
"\tmovs r0, 0x4\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbeq _0810CB70\n"
|
||||
"\tmovs r0, 0x15\n"
|
||||
"\tbl PlaySE\n"
|
||||
"\tldr r0, _0810CB6C @ =0x00000801\n"
|
||||
"\tbl FlagSet\n"
|
||||
"\tbl sub_810C640\n"
|
||||
"\tmovs r0, 0x2\n"
|
||||
"\tb _0810CB7E\n"
|
||||
"\t.align 2, 0\n"
|
||||
"_0810CB54: .4byte gSaveBlock1Ptr\n"
|
||||
"_0810CB58: .4byte 0x0000063a\n"
|
||||
"_0810CB5C: .4byte gObjectEvents\n"
|
||||
"_0810CB60: .4byte sMovementScript_TrainerRematch\n"
|
||||
"_0810CB64: .4byte 0x00000431\n"
|
||||
"_0810CB68: .4byte sVsSeeker\n"
|
||||
"_0810CB6C: .4byte 0x00000801\n"
|
||||
"_0810CB70:\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"\tands r0, r1\n"
|
||||
"\tcmp r0, 0\n"
|
||||
"\tbne _0810CB7C\n"
|
||||
"\tmovs r0, 0\n"
|
||||
"\tb _0810CB7E\n"
|
||||
"_0810CB7C:\n"
|
||||
"\tmovs r0, 0x1\n"
|
||||
"_0810CB7E:\n"
|
||||
"\tadd sp, 0x8\n"
|
||||
"\tpop {r3-r5}\n"
|
||||
"\tmov r8, r3\n"
|
||||
"\tmov r9, r4\n"
|
||||
"\tmov r10, r5\n"
|
||||
"\tpop {r4-r7}\n"
|
||||
"\tpop {r1}\n"
|
||||
"\tbx r1");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_810CB90(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user