Merge branch 'master' into doc-partymenu

This commit is contained in:
GriffinR authored and GitHub committed 2019-10-31 14:22:51 -04:00
commit b1ea2592c3
219 files changed
+7959 -7663

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+9 -9
View File
@@ -24,7 +24,7 @@
#include "constants/species.h"
#include "constants/weather.h"
extern const struct SpriteTemplate gUnknown_08593114;
extern const struct SpriteTemplate gThoughtBubbleSpriteTemplate;
void sub_815A0D4(struct Sprite *);
void sub_815A1B0(struct Sprite *);
@@ -63,7 +63,7 @@ void AnimForesightMagnifyingGlass(struct Sprite *);
void AnimMeteorMashStar(struct Sprite *);
void AnimBlockX(struct Sprite *);
void sub_815FE80(struct Sprite *);
void sub_81061C4(struct Sprite *);
void AnimParticuleBurst(struct Sprite *);
void AnimKnockOffStrike(struct Sprite *);
void AnimRecycle(struct Sprite *);
static void sub_815A114(struct Sprite *);
@@ -144,7 +144,7 @@ const struct SpriteTemplate gUnknown_085CE020 =
.anims = gUnknown_085CE01C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const struct SpriteTemplate gUnknown_085CE038 =
@@ -166,7 +166,7 @@ const struct SpriteTemplate gUnknown_085CE050 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A78AC,
.callback = AnimThrowProjectile,
};
const union AnimCmd gUnknown_085CE068[] =
@@ -190,7 +190,7 @@ const struct SpriteTemplate gUnknown_085CE07C =
.anims = gUnknown_085CE078,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const struct SpriteTemplate gUnknown_085CE094 =
@@ -502,7 +502,7 @@ const struct SpriteTemplate gUnknown_085CE338 =
.anims = gUnknown_085CE334,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const union AffineAnimCmd gUnknown_085CE350[] =
@@ -1079,7 +1079,7 @@ const struct SpriteTemplate gUnknown_085CE8F4 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81061C4,
.callback = AnimParticuleBurst,
};
const struct SpriteTemplate gBlockXSpriteTemplate =
@@ -1929,7 +1929,7 @@ static void sub_815B054(u8 taskId)
}
y = task->data[3] + task->data[5];
spriteId = CreateSprite(&gUnknown_08593114, x, y, 6 - task->data[1]);
spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]);
PlaySE12WithPanning(SE_W118, BattleAnimAdjustPanning(-64));
if (spriteId != MAX_SPRITES)
@@ -1982,7 +1982,7 @@ static void sub_815B054(u8 taskId)
case 4:
for (i = 0, j = 0; i < MAX_SPRITES; i++)
{
if (gSprites[i].template == &gUnknown_08593114)
if (gSprites[i].template == &gThoughtBubbleSpriteTemplate)
{
gSprites[i].data[0] = taskId;
gSprites[i].data[1] = 6;
+6 -6
View File
@@ -30,7 +30,7 @@ extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64;
static void sub_80A6FB4(struct Sprite *sprite);
static void sub_80A7144(struct Sprite *sprite);
static void sub_80A791C(struct Sprite *sprite);
static void AnimThrowProjectile_Step(struct Sprite *sprite);
static void sub_80A8DFC(struct Sprite *sprite);
static void sub_80A8E88(struct Sprite *sprite);
static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId);
@@ -1456,7 +1456,7 @@ static u8 GetBattlerAtPosition_(u8 position)
return GetBattlerAtPosition(position);
}
void sub_80A77C8(struct Sprite *sprite)
void AnimSpriteOnMonPos(struct Sprite *sprite)
{
bool8 var;
@@ -1513,7 +1513,7 @@ void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
void sub_80A78AC(struct Sprite *sprite)
void AnimThrowProjectile(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, 1);
if (GetBattlerSide(gBattleAnimAttacker))
@@ -1523,16 +1523,16 @@ void sub_80A78AC(struct Sprite *sprite)
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
sprite->data[5] = gBattleAnimArgs[5];
InitAnimArcTranslation(sprite);
sprite->callback = sub_80A791C;
sprite->callback = AnimThrowProjectile_Step;
}
static void sub_80A791C(struct Sprite *sprite)
static void AnimThrowProjectile_Step(struct Sprite *sprite)
{
if (TranslateAnimHorizontalArc(sprite))
DestroyAnimSprite(sprite);
}
void sub_80A7938(struct Sprite *sprite)
void AnimSnoreZ(struct Sprite *sprite)
{
bool8 r4;
u8 battlerId, coordType;
+4 -4
View File
@@ -36,7 +36,7 @@ static void sub_8117500(u8);
static void sub_81175C4(u32, u16);
static void sub_81176D8(u8);
static void sub_8117A60(u8);
static void sub_8117FD0(u8);
static void ExtremSpeedMoveTarget_Step(u8);
const u16 gUnknown_08597418 = RGB(31, 31, 31);
@@ -1036,7 +1036,7 @@ void sub_8117F30(u8 taskId)
DestroyAnimVisualTask(taskId);
}
void sub_8117F60(u8 taskId)
void AnimTask_ExtremeSpeedMoveTarget(u8 taskId)
{
if (IsContest())
{
@@ -1046,12 +1046,12 @@ void sub_8117F60(u8 taskId)
{
gTasks[taskId].data[0] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible;
gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible = 1;
gTasks[taskId].func = sub_8117FD0;
gTasks[taskId].func = ExtremSpeedMoveTarget_Step;
gAnimVisualTaskCount--;
}
}
static void sub_8117FD0(u8 taskId)
static void ExtremSpeedMoveTarget_Step(u8 taskId)
{
if (gBattleAnimArgs[7] == 0x1000)
{
+2 -2
View File
@@ -874,8 +874,8 @@ const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] =
[STRINGID_FORFEITEDMATCH - 12] = sText_ForfeitedMatch,
[STRINGID_PKMNTRANSFERREDSOMEONESPC - 12] = gText_PkmnTransferredSomeonesPC,
[STRINGID_PKMNTRANSFERREDLANETTESPC - 12] = gText_PkmnTransferredLanettesPC,
[STRINGID_PKMNBOXSOMEONESPCFULL - 12] = gText_PkmnBoxSomeonesPCFull,
[STRINGID_PKMNBOXLANETTESPCFULL - 12] = gText_PkmnBoxLanettesPCFull,
[STRINGID_PKMNBOXSOMEONESPCFULL - 12] = gText_PkmnTransferredSomeonesPCBoxFull,
[STRINGID_PKMNBOXLANETTESPCFULL - 12] = gText_PkmnTransferredLanettesPCBoxFull,
[STRINGID_TRAINER1WINTEXT - 12] = sText_Trainer1WinText,
[STRINGID_TRAINER2WINTEXT - 12] = sText_Trainer2WinText,
};
+24 -24
View File
@@ -72,8 +72,8 @@ static void CB2_EndWildBattle(void);
static void CB2_EndScriptedWildBattle(void);
static u8 GetWildBattleTransition(void);
static u8 GetTrainerBattleTransition(void);
static void sub_80B1218(void);
static void sub_80B1234(void);
static void TryUpdateGymLeaderRematchFromWild(void);
static void TryUpdateGymLeaderRematchFromTrainer(void);
static void CB2_GiveStarter(void);
static void CB2_StartFirstBattle(void);
static void CB2_EndFirstBattle(void);
@@ -395,8 +395,8 @@ static void DoStandardWildBattle(void)
CreateBattleStartTask(GetWildBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
void BattleSetup_StartRoamerBattle(void)
@@ -409,8 +409,8 @@ void BattleSetup_StartRoamerBattle(void)
CreateBattleStartTask(GetWildBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
static void DoSafariBattle(void)
@@ -433,8 +433,8 @@ static void DoBattlePikeWildBattle(void)
CreateBattleStartTask(GetWildBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
static void DoTrainerBattle(void)
@@ -442,7 +442,7 @@ static void DoTrainerBattle(void)
CreateBattleStartTask(GetTrainerBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_TRAINER_BATTLES);
sub_80B1234();
TryUpdateGymLeaderRematchFromTrainer();
}
static void sub_80B0828(void)
@@ -454,7 +454,7 @@ static void sub_80B0828(void)
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_TRAINER_BATTLES);
sub_80B1234();
TryUpdateGymLeaderRematchFromTrainer();
}
// Initiates battle where Wally catches Ralts
@@ -475,8 +475,8 @@ void BattleSetup_StartScriptedWildBattle(void)
CreateBattleStartTask(GetWildBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
void BattleSetup_StartLatiBattle(void)
@@ -487,8 +487,8 @@ void BattleSetup_StartLatiBattle(void)
CreateBattleStartTask(GetWildBattleTransition(), 0);
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
void BattleSetup_StartLegendaryBattle(void)
@@ -526,8 +526,8 @@ void BattleSetup_StartLegendaryBattle(void)
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
void StartGroudonKyogreBattle(void)
@@ -543,8 +543,8 @@ void StartGroudonKyogreBattle(void)
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
void StartRegiBattle(void)
@@ -576,8 +576,8 @@ void StartRegiBattle(void)
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
static void CB2_EndWildBattle(void)
@@ -919,8 +919,8 @@ static void CB2_StartFirstBattle(void)
ClearPoisonStepCounter();
IncrementGameStat(GAME_STAT_TOTAL_BATTLES);
IncrementGameStat(GAME_STAT_WILD_BATTLES);
sub_80EECC8();
sub_80B1218();
IncrementDailyWildBattles();
TryUpdateGymLeaderRematchFromWild();
}
}
@@ -930,13 +930,13 @@ static void CB2_EndFirstBattle(void)
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
static void sub_80B1218(void)
static void TryUpdateGymLeaderRematchFromWild(void)
{
if (GetGameStat(GAME_STAT_WILD_BATTLES) % 60 == 0)
UpdateGymLeaderRematch();
}
static void sub_80B1234(void)
static void TryUpdateGymLeaderRematchFromTrainer(void)
{
if (GetGameStat(GAME_STAT_TRAINER_BATTLES) % 20 == 0)
UpdateGymLeaderRematch();
+1 -1
View File
@@ -3339,7 +3339,7 @@ static bool8 Blender_PrintBlendingResults(void)
TryAddContestLinkTvShow(&pokeblock, &sBerryBlenderData->tvBlender);
CreateTask(sub_8083F3C, 6);
sub_80EECEC();
IncrementDailyBerryBlender();
RemoveBagItem(gSpecialVar_ItemId, 1);
AddPokeblock(&pokeblock);
@@ -489,11 +489,11 @@ const struct EventObjectGraphicsInfo *const gEventObjectGraphicsInfoPointers[] =
};
const struct EventObjectGraphicsInfo *const gMauvilleOldManGraphicsInfoPointers[] = {
&gEventObjectGraphicsInfo_Bard,
&gEventObjectGraphicsInfo_Hipster,
&gEventObjectGraphicsInfo_Trader,
&gEventObjectGraphicsInfo_Storyteller,
&gEventObjectGraphicsInfo_Giddy,
&gEventObjectGraphicsInfo_UnusedMauvilleOldMan1,
&gEventObjectGraphicsInfo_UnusedMauvilleOldMan2,
[MAUVILLE_MAN_BARD] = &gEventObjectGraphicsInfo_Bard,
[MAUVILLE_MAN_HIPSTER] = &gEventObjectGraphicsInfo_Hipster,
[MAUVILLE_MAN_TRADER] = &gEventObjectGraphicsInfo_Trader,
[MAUVILLE_MAN_STORYTELLER] = &gEventObjectGraphicsInfo_Storyteller,
[MAUVILLE_MAN_GIDDY] = &gEventObjectGraphicsInfo_Giddy,
[MAUVILLE_MAN_UNUSED1] = &gEventObjectGraphicsInfo_UnusedMauvilleOldMan1,
[MAUVILLE_MAN_UNUSED2] = &gEventObjectGraphicsInfo_UnusedMauvilleOldMan2,
};
+28 -26
View File
@@ -31,6 +31,7 @@
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/lilycove_lady.h"
#include "constants/mauville_old_man.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/rgb.h"
@@ -220,7 +221,7 @@ static void sub_811E0EC(s8, s8);
static void sub_811E1A4(s8, s8);
static void sub_811E2DC(struct Sprite *);
static void sub_811E34C(u8, u8);
static bool8 sub_811F0F8(void);
static bool8 EasyChatIsNationalPokedexEnabled(void);
static u16 sub_811F108(void);
static void sub_811F2D4(void);
static void sub_811F46C(void);
@@ -1263,7 +1264,7 @@ void ShowEasyChatScreen(void)
break;
case EASY_CHAT_TYPE_BARD_SONG:
bard = &gSaveBlock1Ptr->oldMan.bard;
for (i = 0; i < 6; i ++)
for (i = 0; i < BARD_SONG_LENGTH; i ++)
bard->temporaryLyrics[i] = bard->songLyrics[i];
words = bard->temporaryLyrics;
@@ -4809,7 +4810,7 @@ static void sub_811E948(void)
PutWindowTilemap(windowId);
}
static bool8 sub_811EA28(u8 groupId)
static bool8 IsEasyChatGroupUnlocked(u8 groupId)
{
switch (groupId)
{
@@ -4820,7 +4821,7 @@ static bool8 sub_811EA28(u8 groupId)
case EC_GROUP_MOVE_2:
return FlagGet(FLAG_SYS_GAME_CLEAR);
case EC_GROUP_POKEMON_2:
return sub_811F0F8();
return EasyChatIsNationalPokedexEnabled();
default:
return TRUE;
}
@@ -4831,7 +4832,7 @@ u16 EasyChat_GetNumWordsInGroup(u8 groupId)
if (groupId == EC_GROUP_POKEMON)
return GetNationalPokedexCount(FLAG_GET_SEEN);
if (sub_811EA28(groupId))
if (IsEasyChatGroupUnlocked(groupId))
return gEasyChatGroups[groupId].numEnabledWords;
return 0;
@@ -5071,7 +5072,7 @@ u16 sub_811EE38(u16 groupId)
u16 sub_811EE90(u16 groupId)
{
if (!sub_811EA28(groupId))
if (!IsEasyChatGroupUnlocked(groupId))
return 0xFFFF;
if (groupId == EC_GROUP_POKEMON)
@@ -5129,16 +5130,16 @@ void sub_811EF6C(void)
CopyEasyChatWord(gStringVar2, easyChatWord);
}
static bool8 sub_811EF98(u8 additionalPhraseId)
static bool8 IsAdditionalPhraseUnlocked(u8 additionalPhraseId)
{
int byteOffset = additionalPhraseId / 8;
int shift = additionalPhraseId % 8;
return (gSaveBlock1Ptr->additionalPhrases[byteOffset] >> shift) & 1;
}
void sub_811EFC0(u8 additionalPhraseId)
void UnlockAdditionalPhrase(u8 additionalPhraseId)
{
if (additionalPhraseId < 33)
if (additionalPhraseId < NUM_ADDITIONAL_PHRASES)
{
int byteOffset = additionalPhraseId / 8;
int shift = additionalPhraseId % 8;
@@ -5146,32 +5147,32 @@ void sub_811EFC0(u8 additionalPhraseId)
}
}
u8 sub_811EFF0(void)
static u8 GetNumAdditionalPhrasesUnlocked(void)
{
u8 i;
u8 numAdditionalPhrasesUnlocked;
for (i = 0, numAdditionalPhrasesUnlocked = 0; i < 33; i++)
for (i = 0, numAdditionalPhrasesUnlocked = 0; i < NUM_ADDITIONAL_PHRASES; i++)
{
if (sub_811EF98(i))
if (IsAdditionalPhraseUnlocked(i))
numAdditionalPhrasesUnlocked++;
}
return numAdditionalPhrasesUnlocked;
}
u16 sub_811F01C(void)
u16 GetNewHipsterPhraseToTeach(void)
{
u16 i;
u16 additionalPhraseId;
u8 numAdditionalPhrasesUnlocked = sub_811EFF0();
if (numAdditionalPhrasesUnlocked == 33)
u8 numAdditionalPhrasesUnlocked = GetNumAdditionalPhrasesUnlocked();
if (numAdditionalPhrasesUnlocked == NUM_ADDITIONAL_PHRASES)
return 0xFFFF;
additionalPhraseId = Random() % (33 - numAdditionalPhrasesUnlocked);
for (i = 0; i < 33; i++)
additionalPhraseId = Random() % (NUM_ADDITIONAL_PHRASES - numAdditionalPhrasesUnlocked);
for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++)
{
if (!sub_811EF98(i))
if (!IsAdditionalPhraseUnlocked(i))
{
if (additionalPhraseId)
{
@@ -5179,7 +5180,7 @@ u16 sub_811F01C(void)
}
else
{
sub_811EFC0(i);
UnlockAdditionalPhrase(i);
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
}
}
@@ -5188,17 +5189,18 @@ u16 sub_811F01C(void)
return 0xFFFF;
}
u16 sub_811F090(void)
// Unused
u16 GetRandomTaughtHipsterPhrase(void)
{
u16 i;
u16 additionalPhraseId = sub_811EFF0();
u16 additionalPhraseId = GetNumAdditionalPhrasesUnlocked();
if (additionalPhraseId == 0)
return 0xFFFF;
additionalPhraseId = Random() % additionalPhraseId;
for (i = 0; i < 33; i++)
for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++)
{
if (sub_811EF98(i))
if (IsAdditionalPhraseUnlocked(i))
{
if (additionalPhraseId)
additionalPhraseId--;
@@ -5210,7 +5212,7 @@ u16 sub_811F090(void)
return 0xFFFF;
}
static bool8 sub_811F0F8(void)
static bool8 EasyChatIsNationalPokedexEnabled(void)
{
return IsNationalPokedexEnabled();
}
@@ -5497,7 +5499,7 @@ static bool8 sub_811F764(u16 wordIndex, u8 groupId)
case EC_GROUP_MOVE_2:
return TRUE;
case EC_GROUP_TRENDY_SAYING:
return sub_811EF98(wordIndex);
return IsAdditionalPhraseUnlocked(wordIndex);
default:
return gEasyChatGroups[groupId].wordData.words[wordIndex].enabled;
}
@@ -5545,7 +5547,7 @@ bool32 sub_811F8D8(int easyChatWord)
int groupId = EC_GROUP(easyChatWord);
int mask = 0x7F;
int index = EC_INDEX(easyChatWord);
if (!sub_811EA28(groupId & mask))
if (!IsEasyChatGroupUnlocked(groupId & mask))
return FALSE;
else
return sub_811F764(index, groupId & mask);
+1
View File
@@ -26,6 +26,7 @@
#include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/items.h"
#include "constants/mauville_old_man.h"
// this file was known as evobjmv.c in Game Freak's original source
+3 -3
View File
@@ -223,8 +223,8 @@ static bool8 TryStartInteractionScript(struct MapPosition *position, u16 metatil
return FALSE;
// Don't play interaction sound for certain scripts.
if (script != EventScript_PlayerPCMale
&& script != EventScript_PlayerPCFemale
if (script != LittlerootTown_BrendansHouse_2F_EventScript_PC
&& script != LittlerootTown_MaysHouse_2F_EventScript_PC
&& script != SecretBase_EventScript_PC
&& script != SecretBase_EventScript_RecordMixingPC
&& script != SecretBase_EventScript_DollInteract
@@ -738,7 +738,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
}
if (MetatileBehavior_IsMossdeepGymWarp(metatileBehavior) == TRUE)
{
sub_80AF87C();
DoMossdeepGymWarp();
return TRUE;
}
DoWarp();
+1 -1
View File
@@ -556,7 +556,7 @@ void sub_80AF848(void)
gFieldCallback = sub_80AF3E8;
}
void sub_80AF87C(void)
void DoMossdeepGymWarp(void)
{
sub_8085540(1);
ScriptContext2_Enable();
+2 -2
View File
@@ -302,7 +302,7 @@ void Task_HandlePorthole(u8 taskId)
}
break;
case EXIT_PORTHOLE: // exit porthole.
FlagClear(FLAG_SPECIAL_FLAG_0x4001);
FlagClear(FLAG_DONT_TRANSITION_MUSIC);
FlagClear(FLAG_HIDE_MAP_NAME_POPUP);
SetWarpDestinationToDynamicWarp(0);
DoDiveWarp();
@@ -339,7 +339,7 @@ void sub_80FB768(void)
void sub_80FB7A4(void)
{
FlagSet(FLAG_SYS_CRUISE_MODE);
FlagSet(FLAG_SPECIAL_FLAG_0x4001);
FlagSet(FLAG_DONT_TRANSITION_MUSIC);
FlagSet(FLAG_HIDE_MAP_NAME_POPUP);
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
sub_80FB59C();
+19 -19
View File
@@ -70,8 +70,8 @@
EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
EWRAM_DATA u8 gBikeCollisions = 0;
static EWRAM_DATA u32 sBikeCyclingTimer = 0;
static EWRAM_DATA u8 sUnknown_0203AB5C = 0;
static EWRAM_DATA u8 sPetalburgGymSlidingDoorFrameCounter = 0;
static EWRAM_DATA u8 sSlidingDoorNextFrameCounter = 0;
static EWRAM_DATA u8 sSlidingDoorFrame = 0;
static EWRAM_DATA u8 sTutorMoveAndElevatorWindowId = 0;
static EWRAM_DATA u16 sLilycoveDeptStore_NeverRead = 0;
static EWRAM_DATA u16 sLilycoveDeptStore_DefaultFloorChoice = 0;
@@ -97,8 +97,8 @@ u16 GetNumMovedLilycoveFanClubMembers(void);
static void RecordCyclingRoadResults(u32, u8);
static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum);
static void Task_PetalburgGym(u8);
static void PetalburgGymFunc(u8, u16);
static void Task_PetalburgGymSlideOpenRoomDoors(u8 taskId);
static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId);
static void Task_PCTurnOnEffect(u8);
static void PCTurnOnEffect_0(struct Task *);
static void PCTurnOnEffect_1(s16, s8, s8);
@@ -811,7 +811,7 @@ void MauvilleGymDeactivatePuzzle(void)
}
}
static const u8 gUnknown_085B2B78[] = {0, 1, 1, 1, 1};
static const bool8 sSlidingDoorNextFrameDelay[] = {0, 1, 1, 1, 1};
static const u16 sPetalburgGymSlidingDoorMetatiles[] = {
METATILE_ID(PetalburgGym, SlidingDoor_Frame0),
@@ -821,21 +821,21 @@ static const u16 sPetalburgGymSlidingDoorMetatiles[] = {
METATILE_ID(PetalburgGym, SlidingDoor_Frame4),
};
void PetalburgGymSpecial1(void)
void PetalburgGymSlideOpenRoomDoors(void)
{
sUnknown_0203AB5C = 0;
sPetalburgGymSlidingDoorFrameCounter = 0;
sSlidingDoorNextFrameCounter = 0;
sSlidingDoorFrame = 0;
PlaySE(SE_KI_GASYAN);
CreateTask(Task_PetalburgGym, 8);
CreateTask(Task_PetalburgGymSlideOpenRoomDoors, 8);
}
static void Task_PetalburgGym(u8 taskId)
static void Task_PetalburgGymSlideOpenRoomDoors(u8 taskId)
{
if (gUnknown_085B2B78[sPetalburgGymSlidingDoorFrameCounter] == sUnknown_0203AB5C)
if (sSlidingDoorNextFrameDelay[sSlidingDoorFrame] == sSlidingDoorNextFrameCounter)
{
PetalburgGymFunc(gSpecialVar_0x8004, sPetalburgGymSlidingDoorMetatiles[sPetalburgGymSlidingDoorFrameCounter]);
sUnknown_0203AB5C = 0;
if ((++sPetalburgGymSlidingDoorFrameCounter) == ARRAY_COUNT(sPetalburgGymSlidingDoorMetatiles))
PetalburgGymSetDoorMetatiles(gSpecialVar_0x8004, sPetalburgGymSlidingDoorMetatiles[sSlidingDoorFrame]);
sSlidingDoorNextFrameCounter = 0;
if ((++sSlidingDoorFrame) == ARRAY_COUNT(sPetalburgGymSlidingDoorMetatiles))
{
DestroyTask(taskId);
EnableBothScriptContexts();
@@ -843,11 +843,11 @@ static void Task_PetalburgGym(u8 taskId)
}
else
{
sUnknown_0203AB5C++;
sSlidingDoorNextFrameCounter++;
}
}
static void PetalburgGymFunc(u8 roomNumber, u16 metatileId)
static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId)
{
u16 doorCoordsX[4];
u16 doorCoordsY[4];
@@ -912,9 +912,9 @@ static void PetalburgGymFunc(u8 roomNumber, u16 metatileId)
DrawWholeMapView();
}
void PetalburgGymSpecial2(void)
void PetalburgGymUnlockRoomDoors(void)
{
PetalburgGymFunc(gSpecialVar_0x8004, sPetalburgGymSlidingDoorMetatiles[4]);
PetalburgGymSetDoorMetatiles(gSpecialVar_0x8004, sPetalburgGymSlidingDoorMetatiles[4]);
}
void ShowFieldMessageStringVar4(void)
@@ -974,7 +974,7 @@ void CableCarWarp(void)
}
}
void SetFlagInVar(void)
void SetHiddenItemFlag(void)
{
FlagSet(gSpecialVar_0x8004);
}
+9 -8
View File
@@ -16,6 +16,7 @@
#include "secret_base.h"
#include "sound.h"
#include "task.h"
#include "constants/field_tasks.h"
#include "constants/items.h"
#include "constants/songs.h"
#include "constants/vars.h"
@@ -38,14 +39,14 @@ static void Task_MuddySlope(u8 taskId);
static const TaskFunc sPerStepCallbacks[] =
{
DummyPerStepCallback,
AshGrassPerStepCallback,
FortreeBridgePerStepCallback,
PacifidlogBridgePerStepCallback,
SootopolisGymIcePerStepCallback,
EndTruckSequence,
SecretBasePerStepCallback,
CrackedFloorPerStepCallback
[STEP_CB_DUMMY] = DummyPerStepCallback,
[STEP_CB_ASH] = AshGrassPerStepCallback,
[STEP_CB_FORTREE_BRIDGE] = FortreeBridgePerStepCallback,
[STEP_CB_PACIFIDLOG_BRIDGE] = PacifidlogBridgePerStepCallback,
[STEP_CB_SOOTOPOLIS_ICE] = SootopolisGymIcePerStepCallback,
[STEP_CB_TRUCK] = EndTruckSequence,
[STEP_CB_SECRET_BASE] = SecretBasePerStepCallback,
[STEP_CB_CRACKED_FLOOR] = CrackedFloorPerStepCallback
};
// they are in pairs but declared as 1D array
+1 -1
View File
@@ -433,7 +433,7 @@ void sub_810CE68(struct Sprite *sprite)
StartSpriteAnim(sprite, gBattleAnimArgs[6]);
gBattleAnimArgs[6] = 0;
sub_80A7938(sprite);
AnimSnoreZ(sprite);
}
void sub_810CEB4(struct Sprite *sprite)
+2 -2
View File
@@ -622,7 +622,7 @@ static void AnimEmberFlare(struct Sprite *sprite)
|| gBattleAnimAttacker == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->callback = sub_80A7938;
sprite->callback = AnimSnoreZ;
sprite->callback(sprite);
}
@@ -631,7 +631,7 @@ static void sub_8109200(struct Sprite *sprite)
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->callback = sub_80A7938;
sprite->callback = AnimSnoreZ;
}
// Animates the a fire sprite in the first-half of the MOVE_FIRE_BLAST
+8 -8
View File
@@ -26,8 +26,8 @@ struct FlashStruct
};
// static functions
static void hm2_flash(void);
static void sub_81371B4(void);
static void FieldCallback_Flash(void);
static void FldEff_UseFlash(void);
static bool8 sub_8137304(void);
static void sub_81373F0(void);
static void sub_8137404(u8 taskId);
@@ -86,26 +86,26 @@ bool8 SetUpFieldMove_Flash(void)
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
{
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
gPostMenuFieldCallback = hm2_flash;
gPostMenuFieldCallback = FieldCallback_Flash;
return TRUE;
}
return FALSE;
}
static void hm2_flash(void)
static void FieldCallback_Flash(void)
{
u8 taskId = oei_task_add();
gFieldEffectArguments[0] = GetCursorSelectionMonId();
gTasks[taskId].data[8] = (uintptr_t)sub_81371B4 >> 16;
gTasks[taskId].data[9] = (uintptr_t)sub_81371B4;
gTasks[taskId].data[8] = (uintptr_t)FldEff_UseFlash >> 16;
gTasks[taskId].data[9] = (uintptr_t)FldEff_UseFlash;
}
static void sub_81371B4(void)
static void FldEff_UseFlash(void)
{
PlaySE(SE_W115);
FlagSet(FLAG_SYS_USE_FLASH);
ScriptContext1_SetupScript(EventScript_2926F8);
ScriptContext1_SetupScript(EventScript_FldEffFlash);
}
static void sub_81371D4(void)
+2 -2
View File
@@ -1889,11 +1889,11 @@ static void sub_81A3B64(void)
points = gSaveBlock2Ptr->frontier.field_EBA;
points += gUnknown_086118B4[challengeNum][facility][battleMode];
sub_80EED60(gUnknown_086118B4[challengeNum][facility][battleMode]);
IncrementDailyBattlePoints(gUnknown_086118B4[challengeNum][facility][battleMode]);
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
{
points += 10;
sub_80EED60(10);
IncrementDailyBattlePoints(10);
}
if (points > 0xFFFF)
points = 0xFFFF;
+1 -1
View File
@@ -1652,7 +1652,7 @@ void ItemMenu_UseOutOfBattle(u8 taskId)
if (gBagPositionStruct.pocket != BERRIES_POCKET)
ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId);
else
sub_80FDD10(taskId);
ItemUseOutOfBattle_Berry(taskId);
}
}
}
+20 -20
View File
@@ -43,9 +43,9 @@
#include "constants/vars.h"
#include "event_obj_lock.h"
extern u8 BerryTree_EventScript_274482[];
extern u8 BerryTree_EventScript_2744C0[];
extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[];
extern u8 BerryTree_EventScript_ItemUsePlantBerry[];
extern u8 BerryTree_EventScript_ItemUseWailmerPail[];
extern u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[];
void SetUpItemUseCallback(u8 taskId);
void MapPostLoadHook_UseItem(void);
@@ -61,9 +61,9 @@ void sub_80FDA94(u8 taskId);
void sub_80FDADC(u8 taskId);
void sub_80FD7C8(u8 taskId);
void sub_80FDC00(u8 taskId);
void sub_80FDD74(u8 taskId);
void sub_80FDE08(u8 taskId);
void sub_80FDE7C(u8 taskId);
void ItemUseOnFieldCB_Berry(u8 taskId);
void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId);
void ItemUseOnFieldCB_WailmerPailSudowoodo(u8 taskId);
static void BootUpSoundTMHM(u8 taskId);
static void Task_ShowTMHMContainedMessage(u8 taskId);
static void UseTMHMYesNo(u8 taskId);
@@ -81,7 +81,7 @@ u8 sub_80FD9B0(s16 a, s16 b);
void sub_80FDA24(u8 a);
void sub_80FD8E0(u8 taskId, s16 x, s16 y);
void sub_80FDBEC(void);
bool8 sub_80FDE2C(void);
bool8 TryToWaterSudowoodo(void);
void ItemUseOutOfBattle_CannotUse(u8 taskId);
// EWRAM variables
@@ -651,11 +651,11 @@ void ItemUseOutOfBattle_PowderJar(u8 taskId)
}
}
void sub_80FDD10(u8 taskId)
void ItemUseOutOfBattle_Berry(u8 taskId)
{
if (IsPlayerFacingEmptyBerryTreePatch() == TRUE)
{
gUnknown_0203A0F4 = sub_80FDD74;
gUnknown_0203A0F4 = ItemUseOnFieldCB_Berry;
gFieldCallback = MapPostLoadHook_UseItem;
gBagMenu->mainCallback2 = CB2_ReturnToField;
unknown_ItemMenu_Confirm(taskId);
@@ -666,24 +666,24 @@ void sub_80FDD10(u8 taskId)
}
}
void sub_80FDD74(u8 taskId)
void ItemUseOnFieldCB_Berry(u8 taskId)
{
RemoveBagItem(gSpecialVar_ItemId, 1);
ScriptContext2_Enable();
ScriptContext1_SetupScript(BerryTree_EventScript_274482);
ScriptContext1_SetupScript(BerryTree_EventScript_ItemUsePlantBerry);
DestroyTask(taskId);
}
void ItemUseOutOfBattle_WailmerPail(u8 taskId)
{
if (sub_80FDE2C() == TRUE)
if (TryToWaterSudowoodo() == TRUE)
{
gUnknown_0203A0F4 = sub_80FDE7C;
gUnknown_0203A0F4 = ItemUseOnFieldCB_WailmerPailSudowoodo;
SetUpItemUseOnFieldCallback(taskId);
}
else if (TryToWaterBerryTree() == TRUE)
{
gUnknown_0203A0F4 = sub_80FDE08;
gUnknown_0203A0F4 = ItemUseOnFieldCB_WailmerPailBerry;
SetUpItemUseOnFieldCallback(taskId);
}
else
@@ -692,14 +692,14 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId)
}
}
void sub_80FDE08(u8 taskId)
void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId)
{
ScriptContext2_Enable();
ScriptContext1_SetupScript(BerryTree_EventScript_2744C0);
ScriptContext1_SetupScript(BerryTree_EventScript_ItemUseWailmerPail);
DestroyTask(taskId);
}
bool8 sub_80FDE2C(void)
bool8 TryToWaterSudowoodo(void)
{
u16 x, y;
u8 z;
@@ -707,16 +707,16 @@ bool8 sub_80FDE2C(void)
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
z = PlayerGetZCoord();
objId = GetEventObjectIdByXYZ(x, y, z);
if (objId == 16 || gEventObjects[objId].graphicsId != 0xE4)
if (objId == EVENT_OBJECTS_COUNT || gEventObjects[objId].graphicsId != EVENT_OBJ_GFX_SUDOWOODO)
return FALSE;
else
return TRUE;
}
void sub_80FDE7C(u8 taskId)
void ItemUseOnFieldCB_WailmerPailSudowoodo(u8 taskId)
{
ScriptContext2_Enable();
ScriptContext1_SetupScript(BattleFrontier_OutsideEast_EventScript_242CFC);
ScriptContext1_SetupScript(BattleFrontier_OutsideEast_EventScript_WaterSudowoodo);
DestroyTask(taskId);
}
+260 -78
View File
@@ -22,6 +22,7 @@
#include "field_message_box.h"
#include "script_menu.h"
#include "trader.h"
#include "constants/mauville_old_man.h"
#define CHAR_SONG_WORD_SEPARATOR 0x37
@@ -41,7 +42,7 @@ static EWRAM_DATA u16 sUnknownBardRelated = 0;
static EWRAM_DATA struct MauvilleManStoryteller * sStorytellerPtr = NULL;
static EWRAM_DATA u8 sStorytellerWindowId = 0;
static const u16 sDefaultBardSongLyrics[6] = {
static const u16 sDefaultBardSongLyrics[BARD_SONG_LENGTH] = {
EC_WORD_SHAKE,
EC_WORD_IT,
EC_WORD_DO,
@@ -80,7 +81,7 @@ static void SetupBard(void)
bard->id = MAUVILLE_MAN_BARD;
bard->hasChangedSong = FALSE;
bard->language = gGameLanguage;
for (i = 0; i < 6; i++)
for (i = 0; i < BARD_SONG_LENGTH; i++)
bard->songLyrics[i] = sDefaultBardSongLyrics[i];
}
@@ -166,10 +167,10 @@ void ScrSpecial_SaveBardSongLyrics(void)
StringCopy(bard->playerName, gSaveBlock2Ptr->playerName);
for (i = 0; i < 4; i++)
for (i = 0; i < TRAINER_ID_LENGTH; i++)
bard->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
for (i = 0; i < 6; i++)
for (i = 0; i < BARD_SONG_LENGTH; i++)
bard->songLyrics[i] = bard->temporaryLyrics[i];
bard->hasChangedSong = TRUE;
@@ -248,15 +249,15 @@ void ScrSpecial_SetHipsterSpokenFlag(void)
void ScrSpecial_HipsterTeachWord(void)
{
u16 var = sub_811F01C();
u16 phrase = GetNewHipsterPhraseToTeach();
if (var == 0xFFFF)
if (phrase == 0xFFFF)
{
gSpecialVar_Result = FALSE;
}
else
{
CopyEasyChatWord(gStringVar1, var);
CopyEasyChatWord(gStringVar1, phrase);
gSpecialVar_Result = TRUE;
}
}
@@ -458,7 +459,7 @@ static void BardSing(struct Task *task, struct BardSong *song)
lyrics = bard->songLyrics;
else
lyrics = bard->temporaryLyrics;
for (i = 0; i < 6; i++)
for (i = 0; i < BARD_SONG_LENGTH; i++)
song->lyrics[i] = lyrics[i];
song->currWord = 0;
}
@@ -683,14 +684,14 @@ void ScrSpecial_SetMauvilleOldManEventObjGfx(void)
void sub_8120B70(union OldMan * oldMan)
{
s32 i;
u8 sp00[8];
u8 playerName[PLAYER_NAME_LENGTH + 1];
switch (oldMan->common.id)
{
case MAUVILLE_MAN_TRADER:
{
struct MauvilleOldManTrader * trader = &oldMan->trader;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_TRADER_ITEMS; i++)
{
if (trader->language[i] == LANGUAGE_JAPANESE)
{
@@ -702,17 +703,17 @@ void sub_8120B70(union OldMan * oldMan)
case MAUVILLE_MAN_STORYTELLER:
{
struct MauvilleManStoryteller * storyteller = &oldMan->storyteller;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
if (storyteller->gameStatIDs[i] != 0)
{
memcpy(sp00, storyteller->trainerNames[i], 7);
sp00[7] = EOS;
if (IsStringJapanese(sp00))
memcpy(playerName, storyteller->trainerNames[i], PLAYER_NAME_LENGTH);
playerName[PLAYER_NAME_LENGTH] = EOS;
if (IsStringJapanese(playerName))
{
memset(sp00, CHAR_SPACE, 8);
StringCopy(sp00, gText_Friend);
memcpy(storyteller->trainerNames[i], sp00, 7);
memset(playerName, CHAR_SPACE, PLAYER_NAME_LENGTH + 1);
StringCopy(playerName, gText_Friend);
memcpy(storyteller->trainerNames[i], playerName, PLAYER_NAME_LENGTH);
storyteller->language[i] = GAME_LANGUAGE;
}
}
@@ -732,7 +733,7 @@ void sub_8120C0C(union OldMan * oldMan, u32 r8, u32 r7, u32 r3)
{
struct MauvilleOldManTrader * trader = &oldMan->trader;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_TRADER_ITEMS; i++)
{
if (IsStringJapanese(trader->playerNames[i]))
{
@@ -749,7 +750,7 @@ void sub_8120C0C(union OldMan * oldMan, u32 r8, u32 r7, u32 r3)
{
struct MauvilleManStoryteller * storyteller = &oldMan->storyteller;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
if (IsStringJapanese(storyteller->trainerNames[i]))
{
@@ -797,19 +798,19 @@ void sub_8120C0C(union OldMan * oldMan, u32 r8, u32 r7, u32 r3)
void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language)
{
u8 sp00[8];
u8 playerName[PLAYER_NAME_LENGTH + 1];
s32 i;
if (oldMan->common.id == MAUVILLE_MAN_STORYTELLER && language == LANGUAGE_JAPANESE)
{
struct MauvilleManStoryteller * storyteller = &oldMan->storyteller;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
if (storyteller->gameStatIDs[i] != 0)
{
memcpy(sp00, storyteller->trainerNames[i], 7);
sp00[7] = EOS;
if (IsStringJapanese(sp00))
memcpy(playerName, storyteller->trainerNames[i], PLAYER_NAME_LENGTH);
playerName[PLAYER_NAME_LENGTH] = EOS;
if (IsStringJapanese(playerName))
storyteller->language[i] = LANGUAGE_JAPANESE;
else
storyteller->language[i] = GAME_LANGUAGE;
@@ -831,7 +832,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language
if (isRuby)
{
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_TRADER_ITEMS; i++)
{
u8 * str = trader->playerNames[i];
if (str[0] == EXT_CTRL_CODE_BEGIN && str[1] == EXT_CTRL_CODE_JPN)
@@ -845,7 +846,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language
}
else
{
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_TRADER_ITEMS; i++)
{
if (trader->language[i] == LANGUAGE_JAPANESE)
{
@@ -863,7 +864,7 @@ void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language
if (isRuby)
{
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
if (storyteller->gameStatIDs[i] != 0)
storyteller->language[i] = language;
@@ -914,42 +915,223 @@ struct Story
};
static const struct Story sStorytellerStories[] = {
{GAME_STAT_NUM_UNION_ROOM_BATTLES, 1, MauvilleCity_PokemonCenter_1F_Text_28E930, MauvilleCity_PokemonCenter_1F_Text_28E947, MauvilleCity_PokemonCenter_1F_Text_28E956},
{GAME_STAT_STARTED_TRENDS, 1, MauvilleCity_PokemonCenter_1F_Text_28E9D7, MauvilleCity_PokemonCenter_1F_Text_28E9EF, MauvilleCity_PokemonCenter_1F_Text_28E9FE},
{GAME_STAT_PLANTED_BERRIES, 1, MauvilleCity_PokemonCenter_1F_Text_28EA7D, MauvilleCity_PokemonCenter_1F_Text_28EA98, MauvilleCity_PokemonCenter_1F_Text_28EAA8},
{GAME_STAT_TRADED_BIKES, 1, MauvilleCity_PokemonCenter_1F_Text_28EB19, MauvilleCity_PokemonCenter_1F_Text_28EB31, MauvilleCity_PokemonCenter_1F_Text_28EB3E},
{GAME_STAT_GOT_INTERVIEWED, 1, MauvilleCity_PokemonCenter_1F_Text_28EBB5, MauvilleCity_PokemonCenter_1F_Text_28EBCD, MauvilleCity_PokemonCenter_1F_Text_28EBDD},
{GAME_STAT_TRAINER_BATTLES, 1, MauvilleCity_PokemonCenter_1F_Text_28EC60, MauvilleCity_PokemonCenter_1F_Text_28EC79, MauvilleCity_PokemonCenter_1F_Text_28EC81},
{GAME_STAT_POKEMON_CAPTURES, 1, MauvilleCity_PokemonCenter_1F_Text_28ED04, MauvilleCity_PokemonCenter_1F_Text_28ED21, MauvilleCity_PokemonCenter_1F_Text_28ED30},
{GAME_STAT_FISHING_CAPTURES, 1, MauvilleCity_PokemonCenter_1F_Text_28EDA1, MauvilleCity_PokemonCenter_1F_Text_28EDB5, MauvilleCity_PokemonCenter_1F_Text_28EDCF},
{GAME_STAT_HATCHED_EGGS, 1, MauvilleCity_PokemonCenter_1F_Text_28EE45, MauvilleCity_PokemonCenter_1F_Text_28EE5D, MauvilleCity_PokemonCenter_1F_Text_28EE6A},
{GAME_STAT_EVOLVED_POKEMON, 1, MauvilleCity_PokemonCenter_1F_Text_28EEDD, MauvilleCity_PokemonCenter_1F_Text_28EEF1, MauvilleCity_PokemonCenter_1F_Text_28EF01},
{GAME_STAT_USED_POKECENTER, 1, MauvilleCity_PokemonCenter_1F_Text_28EF73, MauvilleCity_PokemonCenter_1F_Text_28EF95, MauvilleCity_PokemonCenter_1F_Text_28EFAA},
{GAME_STAT_RESTED_AT_HOME, 1, MauvilleCity_PokemonCenter_1F_Text_28F045, MauvilleCity_PokemonCenter_1F_Text_28F05A, MauvilleCity_PokemonCenter_1F_Text_28F071},
{GAME_STAT_ENTERED_SAFARI_ZONE, 1, MauvilleCity_PokemonCenter_1F_Text_28F0F3, MauvilleCity_PokemonCenter_1F_Text_28F10D, MauvilleCity_PokemonCenter_1F_Text_28F125},
{GAME_STAT_USED_CUT, 1, MauvilleCity_PokemonCenter_1F_Text_28F1BE, MauvilleCity_PokemonCenter_1F_Text_28F1D5, MauvilleCity_PokemonCenter_1F_Text_28F1DE},
{GAME_STAT_USED_ROCK_SMASH, 1, MauvilleCity_PokemonCenter_1F_Text_28F24F, MauvilleCity_PokemonCenter_1F_Text_28F269, MauvilleCity_PokemonCenter_1F_Text_28F277},
{GAME_STAT_MOVED_SECRET_BASE, 1, MauvilleCity_PokemonCenter_1F_Text_28F2FC, MauvilleCity_PokemonCenter_1F_Text_28F314, MauvilleCity_PokemonCenter_1F_Text_28F32A},
{GAME_STAT_USED_SPLASH, 1, MauvilleCity_PokemonCenter_1F_Text_28F3AD, MauvilleCity_PokemonCenter_1F_Text_28F3C6, MauvilleCity_PokemonCenter_1F_Text_28F3D2},
{GAME_STAT_USED_STRUGGLE, 1, MauvilleCity_PokemonCenter_1F_Text_28F44B, MauvilleCity_PokemonCenter_1F_Text_28F461, MauvilleCity_PokemonCenter_1F_Text_28F47C},
{GAME_STAT_SLOT_JACKPOTS, 1, MauvilleCity_PokemonCenter_1F_Text_28F50C, MauvilleCity_PokemonCenter_1F_Text_28F51B, MauvilleCity_PokemonCenter_1F_Text_28F538},
{GAME_STAT_CONSECUTIVE_ROULETTE_WINS, 2, MauvilleCity_PokemonCenter_1F_Text_28F5BE, MauvilleCity_PokemonCenter_1F_Text_28F5D1, MauvilleCity_PokemonCenter_1F_Text_28F5F2},
{GAME_STAT_ENTERED_BATTLE_TOWER, 1, MauvilleCity_PokemonCenter_1F_Text_28F678, MauvilleCity_PokemonCenter_1F_Text_28F694, MauvilleCity_PokemonCenter_1F_Text_28F6B4},
{GAME_STAT_POKEBLOCKS, 1, MauvilleCity_PokemonCenter_1F_Text_28F751, MauvilleCity_PokemonCenter_1F_Text_28F76A, MauvilleCity_PokemonCenter_1F_Text_28F776},
{GAME_STAT_ENTERED_CONTEST, 1, MauvilleCity_PokemonCenter_1F_Text_28F7F6, MauvilleCity_PokemonCenter_1F_Text_28F811, MauvilleCity_PokemonCenter_1F_Text_28F822},
{GAME_STAT_WON_CONTEST, 1, MauvilleCity_PokemonCenter_1F_Text_28F89C, MauvilleCity_PokemonCenter_1F_Text_28F8AF, MauvilleCity_PokemonCenter_1F_Text_28F8BC},
{GAME_STAT_SHOPPED, 1, MauvilleCity_PokemonCenter_1F_Text_28F92F, MauvilleCity_PokemonCenter_1F_Text_28F941, MauvilleCity_PokemonCenter_1F_Text_28F949},
{GAME_STAT_USED_ITEMFINDER, 1, MauvilleCity_PokemonCenter_1F_Text_28F9D1, MauvilleCity_PokemonCenter_1F_Text_28F9EA, MauvilleCity_PokemonCenter_1F_Text_28F9FD},
{GAME_STAT_GOT_RAINED_ON, 1, MauvilleCity_PokemonCenter_1F_Text_28FA81, MauvilleCity_PokemonCenter_1F_Text_28FA99, MauvilleCity_PokemonCenter_1F_Text_28FAA7},
{GAME_STAT_CHECKED_POKEDEX, 1, MauvilleCity_PokemonCenter_1F_Text_28FB1D, MauvilleCity_PokemonCenter_1F_Text_28FB35, MauvilleCity_PokemonCenter_1F_Text_28FB47},
{GAME_STAT_RECEIVED_RIBBONS, 1, MauvilleCity_PokemonCenter_1F_Text_28FBC4, MauvilleCity_PokemonCenter_1F_Text_28FBD9, MauvilleCity_PokemonCenter_1F_Text_28FBEA},
{GAME_STAT_JUMPED_DOWN_LEDGES, 1, MauvilleCity_PokemonCenter_1F_Text_28FC6B, MauvilleCity_PokemonCenter_1F_Text_28FC85, MauvilleCity_PokemonCenter_1F_Text_28FC98},
{GAME_STAT_WATCHED_TV, 1, MauvilleCity_PokemonCenter_1F_Text_28FD1D, MauvilleCity_PokemonCenter_1F_Text_28FD35, MauvilleCity_PokemonCenter_1F_Text_28FD40},
{GAME_STAT_CHECKED_CLOCK, 1, MauvilleCity_PokemonCenter_1F_Text_28FDA2, MauvilleCity_PokemonCenter_1F_Text_28FDBD, MauvilleCity_PokemonCenter_1F_Text_28FDCE},
{GAME_STAT_WON_POKEMON_LOTTERY, 1, MauvilleCity_PokemonCenter_1F_Text_28FE57, MauvilleCity_PokemonCenter_1F_Text_28FE72, MauvilleCity_PokemonCenter_1F_Text_28FE88},
{GAME_STAT_USED_DAYCARE, 1, MauvilleCity_PokemonCenter_1F_Text_28FF0C, MauvilleCity_PokemonCenter_1F_Text_28FF27, MauvilleCity_PokemonCenter_1F_Text_28FF44},
{GAME_STAT_RODE_CABLE_CAR, 1, MauvilleCity_PokemonCenter_1F_Text_28FFDD, MauvilleCity_PokemonCenter_1F_Text_28FFFA, MauvilleCity_PokemonCenter_1F_Text_29000D},
{GAME_STAT_ENTERED_HOT_SPRINGS, 1, MauvilleCity_PokemonCenter_1F_Text_290097, MauvilleCity_PokemonCenter_1F_Text_2900B5, MauvilleCity_PokemonCenter_1F_Text_2900CB}
// The 50 below is replaced with GAME_STAT_SAVED_GAME
{
50, 1,
MauvilleCity_PokemonCenter_1F_Text_SavedGameTitle,
MauvilleCity_PokemonCenter_1F_Text_SavedGameAction,
MauvilleCity_PokemonCenter_1F_Text_SavedGameStory
},
{
GAME_STAT_STARTED_TRENDS, 1,
MauvilleCity_PokemonCenter_1F_Text_TrendsStartedTitle,
MauvilleCity_PokemonCenter_1F_Text_TrendsStartedAction,
MauvilleCity_PokemonCenter_1F_Text_TrendsStartedStory
},
{
GAME_STAT_PLANTED_BERRIES, 1,
MauvilleCity_PokemonCenter_1F_Text_BerriesPlantedTitle,
MauvilleCity_PokemonCenter_1F_Text_BerriesPlantedAction,
MauvilleCity_PokemonCenter_1F_Text_BerriesPlantedStory
},
{
GAME_STAT_TRADED_BIKES, 1,
MauvilleCity_PokemonCenter_1F_Text_BikeTradesTitle,
MauvilleCity_PokemonCenter_1F_Text_BikeTradesAction,
MauvilleCity_PokemonCenter_1F_Text_BikeTradesStory
},
{
GAME_STAT_GOT_INTERVIEWED, 1,
MauvilleCity_PokemonCenter_1F_Text_InterviewsTitle,
MauvilleCity_PokemonCenter_1F_Text_InterviewsAction,
MauvilleCity_PokemonCenter_1F_Text_InterviewsStory
},
{
GAME_STAT_TRAINER_BATTLES, 1,
MauvilleCity_PokemonCenter_1F_Text_TrainerBattlesTitle,
MauvilleCity_PokemonCenter_1F_Text_TrainerBattlesAction,
MauvilleCity_PokemonCenter_1F_Text_TrainerBattlesStory
},
{
GAME_STAT_POKEMON_CAPTURES, 1,
MauvilleCity_PokemonCenter_1F_Text_PokemonCaughtTitle,
MauvilleCity_PokemonCenter_1F_Text_PokemonCaughtAction,
MauvilleCity_PokemonCenter_1F_Text_PokemonCaughtStory
},
{
GAME_STAT_FISHING_CAPTURES, 1,
MauvilleCity_PokemonCenter_1F_Text_FishingPokemonCaughtTitle,
MauvilleCity_PokemonCenter_1F_Text_FishingPokemonCaughtAction,
MauvilleCity_PokemonCenter_1F_Text_FishingPokemonCaughtStory
},
{
GAME_STAT_HATCHED_EGGS, 1,
MauvilleCity_PokemonCenter_1F_Text_EggsHatchedTitle,
MauvilleCity_PokemonCenter_1F_Text_EggsHatchedAction,
MauvilleCity_PokemonCenter_1F_Text_EggsHatchedStory
},
{
GAME_STAT_EVOLVED_POKEMON, 1,
MauvilleCity_PokemonCenter_1F_Text_PokemonEvolvedTitle,
MauvilleCity_PokemonCenter_1F_Text_PokemonEvolvedAction,
MauvilleCity_PokemonCenter_1F_Text_PokemonEvolvedStory
},
{
GAME_STAT_USED_POKECENTER, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedPokemonCenterTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedPokemonCenterAction,
MauvilleCity_PokemonCenter_1F_Text_UsedPokemonCenterStory
},
{
GAME_STAT_RESTED_AT_HOME, 1,
MauvilleCity_PokemonCenter_1F_Text_RestedAtHomeTitle,
MauvilleCity_PokemonCenter_1F_Text_RestedAtHomeAction,
MauvilleCity_PokemonCenter_1F_Text_RestedAtHomeStory
},
{
GAME_STAT_ENTERED_SAFARI_ZONE, 1,
MauvilleCity_PokemonCenter_1F_Text_SafariGamesTitle,
MauvilleCity_PokemonCenter_1F_Text_SafariGamesAction,
MauvilleCity_PokemonCenter_1F_Text_SafariGamesStory
},
{
GAME_STAT_USED_CUT, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedCutTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedCutAction,
MauvilleCity_PokemonCenter_1F_Text_UsedCutStory
},
{
GAME_STAT_USED_ROCK_SMASH, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedRockSmashTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedRockSmashAction,
MauvilleCity_PokemonCenter_1F_Text_UsedRockSmashStory
},
{
GAME_STAT_MOVED_SECRET_BASE, 1,
MauvilleCity_PokemonCenter_1F_Text_MovedBasesTitle,
MauvilleCity_PokemonCenter_1F_Text_MovedBasesAction,
MauvilleCity_PokemonCenter_1F_Text_MovedBasesStory
},
{
GAME_STAT_USED_SPLASH, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedSplashTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedSplashAction,
MauvilleCity_PokemonCenter_1F_Text_UsedSplashStory
},
{
GAME_STAT_USED_STRUGGLE, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedStruggleTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedStruggleAction,
MauvilleCity_PokemonCenter_1F_Text_UsedStruggleStory
},
{
GAME_STAT_SLOT_JACKPOTS, 1,
MauvilleCity_PokemonCenter_1F_Text_SlotJackpotsTitle,
MauvilleCity_PokemonCenter_1F_Text_SlotJackpotsAction,
MauvilleCity_PokemonCenter_1F_Text_SlotJackpotsStory
},
{
GAME_STAT_CONSECUTIVE_ROULETTE_WINS, 2,
MauvilleCity_PokemonCenter_1F_Text_RouletteWinsTitle,
MauvilleCity_PokemonCenter_1F_Text_RouletteWinsAction,
MauvilleCity_PokemonCenter_1F_Text_RouletteWinsStory
},
{
GAME_STAT_ENTERED_BATTLE_TOWER, 1,
MauvilleCity_PokemonCenter_1F_Text_BattleTowerChallengesTitle,
MauvilleCity_PokemonCenter_1F_Text_BattleTowerChallengesAction,
MauvilleCity_PokemonCenter_1F_Text_BattleTowerChallengesStory
},
{
GAME_STAT_POKEBLOCKS, 1,
MauvilleCity_PokemonCenter_1F_Text_MadePokeblocksTitle,
MauvilleCity_PokemonCenter_1F_Text_MadePokeblocksAction,
MauvilleCity_PokemonCenter_1F_Text_MadePokeblocksStory
},
{
GAME_STAT_ENTERED_CONTEST, 1,
MauvilleCity_PokemonCenter_1F_Text_EnteredContestsTitle,
MauvilleCity_PokemonCenter_1F_Text_EnteredContestsAction,
MauvilleCity_PokemonCenter_1F_Text_EnteredContestsStory
},
{
GAME_STAT_WON_CONTEST, 1,
MauvilleCity_PokemonCenter_1F_Text_WonContestsTitle,
MauvilleCity_PokemonCenter_1F_Text_WonContestsAction,
MauvilleCity_PokemonCenter_1F_Text_WonContestsStory
},
{
GAME_STAT_SHOPPED, 1,
MauvilleCity_PokemonCenter_1F_Text_TimesShoppedTitle,
MauvilleCity_PokemonCenter_1F_Text_TimesShoppedAction,
MauvilleCity_PokemonCenter_1F_Text_TimesShoppedStory
},
{
GAME_STAT_USED_ITEMFINDER, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedItemFinderTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedItemFinderAction,
MauvilleCity_PokemonCenter_1F_Text_UsedItemFinderStory
},
{
GAME_STAT_GOT_RAINED_ON, 1,
MauvilleCity_PokemonCenter_1F_Text_TimesRainedTitle,
MauvilleCity_PokemonCenter_1F_Text_TimesRainedAction,
MauvilleCity_PokemonCenter_1F_Text_TimesRainedStory
},
{
GAME_STAT_CHECKED_POKEDEX, 1,
MauvilleCity_PokemonCenter_1F_Text_CheckedPokedexTitle,
MauvilleCity_PokemonCenter_1F_Text_CheckedPokedexAction,
MauvilleCity_PokemonCenter_1F_Text_CheckedPokedexStory
},
{
GAME_STAT_RECEIVED_RIBBONS, 1,
MauvilleCity_PokemonCenter_1F_Text_ReceivedRibbonsTitle,
MauvilleCity_PokemonCenter_1F_Text_ReceivedRibbonsAction,
MauvilleCity_PokemonCenter_1F_Text_ReceivedRibbonsStory
},
{
GAME_STAT_JUMPED_DOWN_LEDGES, 1,
MauvilleCity_PokemonCenter_1F_Text_LedgesJumpedTitle,
MauvilleCity_PokemonCenter_1F_Text_LedgesJumpedAction,
MauvilleCity_PokemonCenter_1F_Text_LedgesJumpedStory
},
{
GAME_STAT_WATCHED_TV, 1,
MauvilleCity_PokemonCenter_1F_Text_TVWatchedTitle,
MauvilleCity_PokemonCenter_1F_Text_TVWatchedAction,
MauvilleCity_PokemonCenter_1F_Text_TVWatchedStory
},
{
GAME_STAT_CHECKED_CLOCK, 1,
MauvilleCity_PokemonCenter_1F_Text_CheckedClockTitle,
MauvilleCity_PokemonCenter_1F_Text_CheckedClockAction,
MauvilleCity_PokemonCenter_1F_Text_CheckedClockStory
},
{
GAME_STAT_WON_POKEMON_LOTTERY, 1,
MauvilleCity_PokemonCenter_1F_Text_WonLotteryTitle,
MauvilleCity_PokemonCenter_1F_Text_WonLotteryAction,
MauvilleCity_PokemonCenter_1F_Text_WonLotteryStory
},
{
GAME_STAT_USED_DAYCARE, 1,
MauvilleCity_PokemonCenter_1F_Text_UsedDaycareTitle,
MauvilleCity_PokemonCenter_1F_Text_UsedDaycareAction,
MauvilleCity_PokemonCenter_1F_Text_UsedDaycareStory
},
{
GAME_STAT_RODE_CABLE_CAR, 1,
MauvilleCity_PokemonCenter_1F_Text_RodeCableCarTitle,
MauvilleCity_PokemonCenter_1F_Text_RodeCableCarAction,
MauvilleCity_PokemonCenter_1F_Text_RodeCableCarStory
},
{
GAME_STAT_ENTERED_HOT_SPRINGS, 1,
MauvilleCity_PokemonCenter_1F_Text_HotSpringsTitle,
MauvilleCity_PokemonCenter_1F_Text_HotSpringsAction,
MauvilleCity_PokemonCenter_1F_Text_HotSpringsStory
}
};
static void StorytellerSetup(void)
@@ -959,7 +1141,7 @@ static void StorytellerSetup(void)
sStorytellerPtr->id = MAUVILLE_MAN_STORYTELLER;
sStorytellerPtr->alreadyRecorded = FALSE;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
sStorytellerPtr->gameStatIDs[i] = 0;
sStorytellerPtr->trainerNames[0][i] = EOS; // Maybe they meant storyteller->trainerNames[i][0] instead?
@@ -977,7 +1159,7 @@ static void Storyteller_ResetFlag(void)
static u32 StorytellerGetGameStat(u8 stat)
{
if (stat == 50)
stat = 0;
stat = GAME_STAT_SAVED_GAME;
return GetGameStat(stat);
}
@@ -985,12 +1167,12 @@ static const struct Story *GetStoryByStat(u32 stat)
{
s32 i;
for (i = 0; i < 36; i++)
for (i = 0; i < (int)ARRAY_COUNT(sStorytellerStories); i++)
{
if (sStorytellerStories[i].stat == stat)
return &sStorytellerStories[i];
}
return &sStorytellerStories[35];
return &sStorytellerStories[ARRAY_COUNT(sStorytellerStories) - 1];
}
static const u8 *GetStoryTitleByStat(u32 stat)
@@ -1012,7 +1194,7 @@ static u8 GetFreeStorySlot(void)
{
u8 i;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
if (sStorytellerPtr->gameStatIDs[i] == 0)
break;
@@ -1049,15 +1231,15 @@ static void GetStoryByStattellerPlayerName(u32 player, void *dst)
{
u8 *name = sStorytellerPtr->trainerNames[player];
memset(dst, EOS, 8);
memcpy(dst, name, 7);
memset(dst, EOS, PLAYER_NAME_LENGTH + 1);
memcpy(dst, name, PLAYER_NAME_LENGTH);
}
static void StorytellerSetPlayerName(u32 player, const u8 * src)
{
u8 * name = sStorytellerPtr->trainerNames[player];
memset(name, EOS, 7);
memcpy(name, src, 7);
memset(name, EOS, PLAYER_NAME_LENGTH);
memcpy(name, src, PLAYER_NAME_LENGTH);
}
@@ -1110,15 +1292,15 @@ static bool8 StorytellerInitializeRandomStat(void)
u8 stat = sStorytellerStories[arr[i]].stat;
u8 minVal = sStorytellerStories[arr[i]].minVal;
for (j = 0; j < 4; j++)
for (j = 0; j < NUM_STORYTELLER_TALES; j++)
{
if (sStorytellerPtr->gameStatIDs[j] == stat)
break;
}
if (j == 4 && StorytellerGetGameStat(stat) >= minVal)
if (j == NUM_STORYTELLER_TALES && StorytellerGetGameStat(stat) >= minVal)
{
sStorytellerPtr->alreadyRecorded = TRUE;
if (GetFreeStorySlot() == 4)
if (GetFreeStorySlot() == NUM_STORYTELLER_TALES)
StorytellerRecordNewStat(sSelectedStory, stat);
else
StorytellerRecordNewStat(GetFreeStorySlot(), stat);
@@ -1144,7 +1326,7 @@ static void PrintStoryList(void)
s32 i;
s32 width = GetStringWidth(1, gText_Exit, 0);
u8 tileWidth;
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
s32 curWidth;
u16 gameStatID = sStorytellerPtr->gameStatIDs[i];
@@ -1157,7 +1339,7 @@ static void PrintStoryList(void)
}
sStorytellerWindowId = CreateWindowFromRect(0, 0, ConvertPixelWidthToTileWidth(width), GetFreeStorySlot() * 2 + 2);
SetStandardWindowBorderStyle(sStorytellerWindowId, 0);
for (i = 0; i < 4; i++)
for (i = 0; i < NUM_STORYTELLER_TALES; i++)
{
u16 gameStatID = sStorytellerPtr->gameStatIDs[i];
if (gameStatID == 0)
@@ -1169,7 +1351,7 @@ static void PrintStoryList(void)
CopyWindowToVram(sStorytellerWindowId, 3);
}
static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu
static void Task_StoryListMenu(u8 taskId)
{
struct Task *task = &gTasks[taskId];
s32 selection;
-314
View File
@@ -1,314 +0,0 @@
#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"
#include "constants/event_objects.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 objects[EVENT_OBJECTS_COUNT];
u8 count;
bool8 unk41;
};
// This file's functions.
static void AddEventObject(u8 eventTemplateId, u8 arg1);
static void sub_81A8D94(u8 eventTemplateId, u8 arg1);
// EWRAM vars
EWRAM_DATA static struct MossdeepStruct *gUnknown_0203CE50 = NULL;
// code
void InitMossdeepGymTiles(bool8 arg0)
{
if (gUnknown_0203CE50 == NULL)
gUnknown_0203CE50 = AllocZeroed(sizeof(*gUnknown_0203CE50));
gUnknown_0203CE50->unk41 = arg0;
}
void FinishMossdeepGymTiles(void)
{
u8 id;
if (gUnknown_0203CE50 != NULL)
FREE_AND_SET_NULL(gUnknown_0203CE50);
id = GetEventObjectIdByLocalIdAndMap(EVENT_OBJ_ID_PLAYER, 0, 0);
EventObjectClearHeldMovementIfFinished(&gEventObjects[id]);
ScriptMovement_UnfreezeEventObjects();
}
u16 MossdeepGym_MoveEvents(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)
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)
{
AddEventObject(i, r5);
localId = events[i].localId;
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
}
else
{
sub_81A8D94(i, r5);
}
}
}
return localId;
}
void MossdeepGym_TurnEvents(void)
{
u8 i;
s32 var;
struct EventObjectTemplate *events;
if (gUnknown_0203CE50 == NULL)
return;
if (!gUnknown_0203CE50->unk41)
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->objects[i].eventTemplateId].x + 7;
s16 y = events[gUnknown_0203CE50->objects[i].eventTemplateId].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
r0 = (u8)((metatile - var) % 8);
r0 -= (gUnknown_0203CE50->objects[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->objects[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->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_SOUTH:
movementScript = gUnknown_086126A8;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
case DIR_WEST:
movementScript = gUnknown_086126AA;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_NORTH:
movementScript = gUnknown_086126AC;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->objects[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->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_SOUTH:
movementScript = gUnknown_086126AC;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
case DIR_WEST:
movementScript = gUnknown_086126AE;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_NORTH:
movementScript = gUnknown_086126A8;
events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->objects[i].eventTemplateId].localId,
gSaveBlock1Ptr->location.mapNum,
gSaveBlock1Ptr->location.mapGroup,
movementScript);
}
}
}
}
static void AddEventObject(u8 eventTemplateId, u8 arg1)
{
gUnknown_0203CE50->objects[gUnknown_0203CE50->count].eventTemplateId = eventTemplateId;
gUnknown_0203CE50->objects[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)
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;
}
}
}
+1 -1
View File
@@ -286,7 +286,7 @@ bool8 MEScrCmd_givenationaldex(struct ScriptContext *ctx)
bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
{
sub_811EFC0(ScriptReadByte(ctx));
UnlockAdditionalPhrase(ScriptReadByte(ctx));
StringExpandPlaceholders(gStringVar4, gText_MysteryGiftRareWord);
ctx->data[2] = 2;
return FALSE;
+4 -8
View File
@@ -34,10 +34,6 @@ extern u16 gKeyRepeatStartDelay;
// extern text
extern const u8 gExpandedPlaceholder_Empty[];
extern const u8 gText_PkmnTransferredSomeonesPC[];
extern const u8 gText_PkmnTransferredLanettesPC[];
extern const u8 gText_PkmnBoxSomeonesPCFull[];
extern const u8 gText_PkmnBoxLanettesPCFull[];
extern const u8 gText_MoveOkBack[];
extern const u8 gText_YourName[];
extern const u8 gText_BoxName[];
@@ -51,12 +47,12 @@ static const u8 gSpriteImage_858BCB8[] = INCBIN_U8("graphics/naming_screen/pc_ic
static const u16 gUnknown_0858BD78[] = INCBIN_U16("graphics/naming_screen/0.gbapal");
static const u16 gUnknown_0858BD98[] = INCBIN_U16("graphics/naming_screen/1.gbapal");
static const u8 *const gUnknown_0858BDB8[] =
static const u8 *const sTransferredToPCMessages[] =
{
gText_PkmnTransferredSomeonesPC,
gText_PkmnTransferredLanettesPC,
gText_PkmnBoxSomeonesPCFull,
gText_PkmnBoxLanettesPCFull
gText_PkmnTransferredSomeonesPCBoxFull,
gText_PkmnTransferredLanettesPCBoxFull
};
static const u8 gUnknown_0858BDC8[] = _("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!");
@@ -562,7 +558,7 @@ static void DisplaySentToPCMessage(void)
if (FlagGet(FLAG_SYS_PC_LANETTE))
stringToDisplay++;
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
StringExpandPlaceholders(gStringVar4, sTransferredToPCMessages[stringToDisplay]);
DrawDialogueFrame(0, 0);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3);
+2 -2
View File
@@ -1183,7 +1183,7 @@ void Overworld_ClearSavedMusic(void)
static void sub_8085810(void)
{
if (FlagGet(FLAG_SPECIAL_FLAG_0x4001) != TRUE)
if (FlagGet(FLAG_DONT_TRANSITION_MUSIC) != TRUE)
{
u16 newMusic = GetWarpDestinationMusic();
u16 currentMusic = GetCurrentMapMusic();
@@ -1231,7 +1231,7 @@ void TryFadeOutOldMapMusic(void)
{
u16 currentMusic = GetCurrentMapMusic();
u16 warpMusic = GetWarpDestinationMusic();
if (FlagGet(FLAG_SPECIAL_FLAG_0x4001) != TRUE && warpMusic != GetCurrentMapMusic())
if (FlagGet(FLAG_DONT_TRANSITION_MUSIC) != TRUE && warpMusic != GetCurrentMapMusic())
{
if (currentMusic == MUS_NAMINORI
&& VarGet(VAR_SKY_PILLAR_STATE) == 2
+3 -3
View File
@@ -419,12 +419,12 @@ static void PlayerPC_Decoration(u8 taskId)
static void PlayerPC_TurnOff(u8 taskId)
{
if (gPcItemMenuOptionsNum == 4) // if the option count is 4, we are at the bedroom PC and not player PC, so do gender specific handling.
if (gPcItemMenuOptionsNum == 4) // if the option count is 4, we are at the bedroom PC, so do gender specific handling.
{
if (gSaveBlock2Ptr->playerGender == MALE)
ScriptContext1_SetupScript(LittlerootTown_BrendansHouse_2F_EventScript_1F863F);
ScriptContext1_SetupScript(LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC);
else
ScriptContext1_SetupScript(LittlerootTown_MaysHouse_2F_EventScript_1F958F);
ScriptContext1_SetupScript(LittlerootTown_MaysHouse_2F_EventScript_TurnOffPlayerPC);
}
else
{
+1 -1
View File
@@ -37,7 +37,7 @@ const struct SpriteTemplate gUnknown_08596134 =
.anims = gUnknown_08596130,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const union AnimCmd gUnknown_0859614C[] =
+2 -2
View File
@@ -49,7 +49,7 @@ const struct SpriteTemplate gUnknown_08596548 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_08596544,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const struct SpriteTemplate gUnknown_08596560 =
@@ -378,7 +378,7 @@ const struct SpriteTemplate gUnknown_08596898 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_08596894,
.callback = sub_80A77C8,
.callback = AnimSpriteOnMonPos,
};
const union AffineAnimCmd gUnknown_085968B0[] =
+1 -1
View File
@@ -631,7 +631,7 @@ static void ReceiveOldManData(OldMan *oldMan, size_t recordSize, u8 which)
u8 version;
u16 language;
OldMan *dest;
u32 mixIndices[4];
u32 mixIndices[MAX_LINK_PLAYERS];
ShufflePlayerIndices(mixIndices);
dest = (void *)oldMan + recordSize * mixIndices[which];
+338
View File
@@ -0,0 +1,338 @@
#include "global.h"
#include "event_object_movement.h"
#include "fieldmap.h"
#include "malloc.h"
#include "rotating_tile_puzzle.h"
#include "script_movement.h"
#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
#include "constants/metatile_labels.h"
extern const u8 RotatingTilePuzzle_Movement_ShiftRight[];
extern const u8 RotatingTilePuzzle_Movement_ShiftDown[];
extern const u8 RotatingTilePuzzle_Movement_ShiftLeft[];
extern const u8 RotatingTilePuzzle_Movement_ShiftUp[];
extern const u8 RotatingTilePuzzle_Movement_FaceRight[];
extern const u8 RotatingTilePuzzle_Movement_FaceDown[];
extern const u8 RotatingTilePuzzle_Movement_FaceLeft[];
extern const u8 RotatingTilePuzzle_Movement_FaceUp[];
#define ROTATE_COUNTERCLOCKWISE 0
#define ROTATE_CLOCKWISE 1
#define ROTATE_NONE 2
struct RotatingTileObject
{
u8 prevPuzzleTileNum;
u8 eventTemplateId;
};
struct RotatingTilePuzzle
{
struct RotatingTileObject objects[EVENT_OBJECTS_COUNT];
u8 numObjects;
bool8 isTrickHouse;
};
// This file's functions.
static void SaveRotatingTileObject(u8 eventTemplateId, u8 arg1);
static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 arg1);
// EWRAM vars
EWRAM_DATA static struct RotatingTilePuzzle *sRotatingTilePuzzle = NULL;
// code
void InitRotatingTilePuzzle(bool8 isTrickHouse)
{
if (sRotatingTilePuzzle == NULL)
sRotatingTilePuzzle = AllocZeroed(sizeof(*sRotatingTilePuzzle));
sRotatingTilePuzzle->isTrickHouse = isTrickHouse;
}
void FreeRotatingTilePuzzle(void)
{
u8 id;
if (sRotatingTilePuzzle != NULL)
FREE_AND_SET_NULL(sRotatingTilePuzzle);
id = GetEventObjectIdByLocalIdAndMap(EVENT_OBJ_ID_PLAYER, 0, 0);
EventObjectClearHeldMovementIfFinished(&gEventObjects[id]);
ScriptMovement_UnfreezeEventObjects();
}
u16 MoveRotatingTileObjects(u8 puzzleNumber)
{
u8 i;
struct EventObjectTemplate *eventObjects = gSaveBlock1Ptr->eventObjectTemplates;
u16 localId = 0;
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
s32 puzzleTileStart;
u8 puzzleTileNum;
s16 x = eventObjects[i].x + 7;
s16 y = eventObjects[i].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
if (!sRotatingTilePuzzle->isTrickHouse)
puzzleTileStart = METATILE_MossdeepGym_YellowArrow_Right;
else
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
// Object is on a metatile before the puzzle tile section
// UB: Because this is not if (metatile < puzzleTileStart), for the trick house (metatile - puzzleTileStart) below can result in casting a negative value to u8
if (metatile < METATILE_MossdeepGym_YellowArrow_Right)
continue;
// Object is on a metatile after the puzzle tile section (never occurs, in both cases the puzzle tiles are last)
if ((u8)((metatile - puzzleTileStart) / 8) >= 5)
continue;
// Object is on a metatile in puzzle tile section, but not one of the currently rotating color
if ((u8)((metatile - puzzleTileStart) / 8) != puzzleNumber)
continue;
puzzleTileNum = (u8)((metatile - puzzleTileStart) % 8);
// First 4 puzzle tiles are the colored arrows
if (puzzleTileNum < 4)
{
s8 x = 0;
s8 y = 0;
const u8 *movementScript;
switch (puzzleTileNum)
{
case 0: // Right Arrow
movementScript = RotatingTilePuzzle_Movement_ShiftRight;
x = 1;
break;
case 1: // Down Arrow
movementScript = RotatingTilePuzzle_Movement_ShiftDown;
y = 1;
break;
case 2: // Left Arrow
movementScript = RotatingTilePuzzle_Movement_ShiftLeft;
x = -1;
break;
case 3: // Up Arrow
movementScript = RotatingTilePuzzle_Movement_ShiftUp;
y = -1;
break;
default:
continue;
}
eventObjects[i].x += x;
eventObjects[i].y += y;
if (GetEventObjectIdByLocalIdAndMap(eventObjects[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup) != EVENT_OBJECTS_COUNT)
{
SaveRotatingTileObject(i, puzzleTileNum);
localId = eventObjects[i].localId;
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
}
// Never reached in normal gameplay
else
{
TurnUnsavedRotatingTileObject(i, puzzleTileNum);
}
}
}
return localId;
}
void TurnRotatingTileObjects(void)
{
u8 i;
s32 puzzleTileStart;
struct EventObjectTemplate *eventObjects;
if (sRotatingTilePuzzle == NULL)
return;
if (!sRotatingTilePuzzle->isTrickHouse)
puzzleTileStart = METATILE_MossdeepGym_YellowArrow_Right;
else
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
eventObjects = gSaveBlock1Ptr->eventObjectTemplates;
for (i = 0; i < sRotatingTilePuzzle->numObjects; i++)
{
s32 rotation;
s8 tileDifference;
u8 eventObjectId;
s16 x = eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].x + 7;
s16 y = eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
// NOTE: The following 2 assignments and if else could all be replaced with rotation = ROTATE_COUNTERCLOCKWISE
// For an object to be saved in sRotatingTilePuzzle->objects, it must have been on a colored arrow tile
// After the first assignment, tileDifference will always be a number [0-3] representing which arrow tile the object is on now (0: right, 1: down, 2: left, 3: up)
// prevPuzzleTileNum will similarly be a number [0-3] representing the arrow tile the object just moved from
// All the puzzles are oriented counter-clockwise and can only move 1 step at a time, so the difference between the current tile and the previous tile will always either be -1 or 3 (0-1, 1-2, 2-3, 3-0)
// Which means tileDifference will always either be -1 or 3 after the below subtraction, and rotation will always be ROTATE_COUNTERCLOCKWISE after the following conditionals
tileDifference = (u8)((metatile - puzzleTileStart) % 8);
tileDifference -= (sRotatingTilePuzzle->objects[i].prevPuzzleTileNum);
// Always true, see above
if (tileDifference < 0 || tileDifference == 3)
{
// Always false, see above
if (tileDifference == -3)
rotation = ROTATE_CLOCKWISE;
else
rotation = ROTATE_COUNTERCLOCKWISE;
}
else
{
if (tileDifference > 0)
rotation = ROTATE_CLOCKWISE;
else
rotation = ROTATE_NONE;
}
eventObjectId = GetEventObjectIdByLocalIdAndMap(eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
if (eventObjectId != EVENT_OBJECTS_COUNT)
{
const u8 *movementScript;
u8 direction = gEventObjects[eventObjectId].facingDirection;
if (rotation == ROTATE_COUNTERCLOCKWISE)
{
switch (direction)
{
case DIR_EAST:
movementScript = RotatingTilePuzzle_Movement_FaceUp;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_SOUTH:
movementScript = RotatingTilePuzzle_Movement_FaceRight;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
case DIR_WEST:
movementScript = RotatingTilePuzzle_Movement_FaceDown;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_NORTH:
movementScript = RotatingTilePuzzle_Movement_FaceLeft;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].localId,
gSaveBlock1Ptr->location.mapNum,
gSaveBlock1Ptr->location.mapGroup,
movementScript);
}
// Never reached
else if (rotation == ROTATE_CLOCKWISE)
{
switch (direction)
{
case DIR_EAST:
movementScript = RotatingTilePuzzle_Movement_FaceDown;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case DIR_SOUTH:
movementScript = RotatingTilePuzzle_Movement_FaceLeft;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
case DIR_WEST:
movementScript = RotatingTilePuzzle_Movement_FaceUp;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case DIR_NORTH:
movementScript = RotatingTilePuzzle_Movement_FaceRight;
eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
default:
continue;
}
ScriptMovement_StartObjectMovementScript(eventObjects[sRotatingTilePuzzle->objects[i].eventTemplateId].localId,
gSaveBlock1Ptr->location.mapNum,
gSaveBlock1Ptr->location.mapGroup,
movementScript);
}
}
}
}
static void SaveRotatingTileObject(u8 eventTemplateId, u8 puzzleTileNum)
{
sRotatingTilePuzzle->objects[sRotatingTilePuzzle->numObjects].eventTemplateId = eventTemplateId;
sRotatingTilePuzzle->objects[sRotatingTilePuzzle->numObjects].prevPuzzleTileNum = puzzleTileNum;
sRotatingTilePuzzle->numObjects++;
}
// Functionally unused
static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 puzzleTileNum)
{
s8 tileDifference;
s32 rotation;
s32 puzzleTileStart;
u16 movementType;
struct EventObjectTemplate *eventObjects = gSaveBlock1Ptr->eventObjectTemplates;
s16 x = eventObjects[eventTemplateId].x + 7;
s16 y = eventObjects[eventTemplateId].y + 7;
u16 metatile = MapGridGetMetatileIdAt(x, y);
if (!sRotatingTilePuzzle->isTrickHouse)
puzzleTileStart = METATILE_MossdeepGym_YellowArrow_Right;
else
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
tileDifference = (u8)((metatile - puzzleTileStart) % 8);
tileDifference -= puzzleTileNum;
if (tileDifference < 0 || tileDifference == 3)
rotation = ROTATE_COUNTERCLOCKWISE;
else if (tileDifference > 0 || tileDifference == -3)
rotation = ROTATE_CLOCKWISE;
else
rotation = ROTATE_NONE;
movementType = eventObjects[eventTemplateId].movementType;
if (rotation == ROTATE_COUNTERCLOCKWISE)
{
switch (movementType)
{
case MOVEMENT_TYPE_FACE_RIGHT:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case MOVEMENT_TYPE_FACE_DOWN:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
case MOVEMENT_TYPE_FACE_LEFT:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case MOVEMENT_TYPE_FACE_UP:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
default:
break;
}
}
else if (rotation == ROTATE_CLOCKWISE)
{
switch (movementType)
{
case MOVEMENT_TYPE_FACE_RIGHT:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
break;
case MOVEMENT_TYPE_FACE_DOWN:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
break;
case MOVEMENT_TYPE_FACE_LEFT:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
break;
case MOVEMENT_TYPE_FACE_UP:
eventObjects[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
break;
default:
break;
}
}
}
+1 -1
View File
@@ -1213,7 +1213,7 @@ static void sub_8140D6C(u8 r0)
static void sub_8140F6C(u8 r0)
{
sub_80EECA4();
IncrementDailyRouletteUses();
gUnknown_0203AB88->var28 = 0xFF;
if (gUnknown_0203AB88->var19 == 1)
gUnknown_0203AB88->var23 = 1;
+8 -8
View File
@@ -23,10 +23,10 @@ struct PokeblockFeeder
#define NUM_POKEBLOCK_FEEDERS 10
extern const u8 EventScript_2A4B8A[];
extern const u8 EventScript_2A4B6F[];
extern const u8 EventScript_2A4B4C[];
extern const u8 EventScript_2A4B9B[];
extern const u8 SafariZone_EventScript_TimesUp[];
extern const u8 SafariZone_EventScript_RetirePrompt[];
extern const u8 SafariZone_EventScript_OutOfBallsMidBattle[];
extern const u8 SafariZone_EventScript_OutOfBalls[];
EWRAM_DATA u8 gNumSafariBalls = 0;
EWRAM_DATA static u16 sSafariZoneStepCounter = 0;
@@ -83,7 +83,7 @@ bool8 SafariZoneTakeStep(void)
sSafariZoneStepCounter--;
if (sSafariZoneStepCounter == 0)
{
ScriptContext1_SetupScript(EventScript_2A4B8A);
ScriptContext1_SetupScript(SafariZone_EventScript_TimesUp);
return TRUE;
}
return FALSE;
@@ -91,7 +91,7 @@ bool8 SafariZoneTakeStep(void)
void SafariZoneRetirePrompt(void)
{
ScriptContext1_SetupScript(EventScript_2A4B6F);
ScriptContext1_SetupScript(SafariZone_EventScript_RetirePrompt);
}
void CB2_EndSafariBattle(void)
@@ -105,14 +105,14 @@ void CB2_EndSafariBattle(void)
}
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
{
ScriptContext2_RunNewScript(EventScript_2A4B4C);
ScriptContext2_RunNewScript(SafariZone_EventScript_OutOfBallsMidBattle);
WarpIntoMap();
gFieldCallback = sub_80AF6F0;
SetMainCallback2(CB2_LoadMap);
}
else if (gBattleOutcome == B_OUTCOME_CAUGHT)
{
ScriptContext1_SetupScript(EventScript_2A4B9B);
ScriptContext1_SetupScript(SafariZone_EventScript_OutOfBalls);
ScriptContext1_Stop();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
+13 -13
View File
@@ -27,13 +27,13 @@
#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"
#include "pokemon_storage_system.h"
#include "random.h"
#include "overworld.h"
#include "rotating_tile_puzzle.h"
#include "rtc.h"
#include "script.h"
#include "script_menu.h"
@@ -814,7 +814,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
return TRUE;
}
bool8 ScrCmd_warpD7(struct ScriptContext *ctx)
bool8 ScrCmd_warpmossdeepgym(struct ScriptContext *ctx)
{
u8 mapGroup = ScriptReadByte(ctx);
u8 mapNum = ScriptReadByte(ctx);
@@ -823,7 +823,7 @@ bool8 ScrCmd_warpD7(struct ScriptContext *ctx)
u16 y = VarGet(ScriptReadHalfword(ctx));
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF87C();
DoMossdeepGymWarp();
ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -2148,31 +2148,31 @@ bool8 ScrCmd_takecoins(struct ScriptContext *ctx)
return FALSE;
}
bool8 ScrCmd_mossdeepgym1(struct ScriptContext *ctx)
bool8 ScrCmd_moverotatingtileobjects(struct ScriptContext *ctx)
{
u16 v1 = VarGet(ScriptReadHalfword(ctx));
u16 puzzleNumber = VarGet(ScriptReadHalfword(ctx));
sMovingNpcId = MossdeepGym_MoveEvents(v1);
sMovingNpcId = MoveRotatingTileObjects(puzzleNumber);
return FALSE;
}
bool8 ScrCmd_mossdeepgym2(struct ScriptContext *ctx)
bool8 ScrCmd_turnrotatingtileobjects(struct ScriptContext *ctx)
{
MossdeepGym_TurnEvents();
TurnRotatingTileObjects();
return FALSE;
}
bool8 ScrCmd_mossdeepgym3(struct ScriptContext *ctx)
bool8 ScrCmd_initrotatingtilepuzzle(struct ScriptContext *ctx)
{
u16 v1 = VarGet(ScriptReadHalfword(ctx));
u16 isTrickHouse = VarGet(ScriptReadHalfword(ctx));
InitMossdeepGymTiles(v1);
InitRotatingTilePuzzle(isTrickHouse);
return FALSE;
}
bool8 ScrCmd_mossdeepgym4(struct ScriptContext *ctx)
bool8 ScrCmd_freerotatingtilepuzzle(struct ScriptContext *ctx)
{
FinishMossdeepGymTiles();
FreeRotatingTilePuzzle();
return FALSE;
}
+1 -1
View File
@@ -1060,7 +1060,7 @@ static bool8 SlotAction9(struct Task *task)
ReelTasks_SetUnkTaskData(1);
ReelTasks_SetUnkTaskData(2);
sub_80EEC80(); // something with daily slot variable
IncrementDailySlotsUses();
task->data[0] = 0;
if (sSlotMachine->luckyFlags & LUCKY_BIAS_REELTIME)
+4 -4
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "constants/decorations.h"
#include "constants/mauville_man.h"
#include "constants/mauville_old_man.h"
#include "decoration.h"
#include "decoration_inventory.h"
#include "event_data.h"
@@ -86,7 +86,7 @@ void CreateAvailableDecorationsMenu(u8 taskId)
schedule_bg_copy_tilemap_to_vram(0);
}
void sub_8133BE4(u8 taskId, u8 decorationId)
void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId)
{
s16 * data = gTasks[taskId].data;
if (decorationId > NUM_DECORATIONS)
@@ -118,14 +118,14 @@ void Task_HandleGetDecorationMenuInput(u8 taskId)
case MENU_B_PRESSED:
case 4:
PlaySE(SE_SELECT);
sub_8133BE4(taskId, 0);
Task_BufferDecorSelectionAndCloseWindow(taskId, 0);
break;
default:
PlaySE(SE_SELECT);
gSpecialVar_0x8005 = input;
StringCopy(gStringVar1, trader->playerNames[input]);
ConvertInternationalString(gStringVar1, trader->language[input]);
sub_8133BE4(taskId, trader->decorIds[input]);
Task_BufferDecorSelectionAndCloseWindow(taskId, trader->decorIds[input]);
break;
}
}
+8 -8
View File
@@ -2003,7 +2003,7 @@ void sub_80EDC60(const u16 *words)
}
}
void sub_80EDCE8(void)
void TryPutTreasureInvestigatorsOnAir(void)
{
TVShow *show;
@@ -2626,37 +2626,37 @@ static void sub_80EEBF4(u8 actionIdx)
}
}
void sub_80EEC80(void)
void IncrementDailySlotsUses(void)
{
VarSet(VAR_DAILY_SLOTS, VarGet(VAR_DAILY_SLOTS) + 1);
}
void sub_80EECA4(void)
void IncrementDailyRouletteUses(void)
{
VarSet(VAR_DAILY_ROULETTE, VarGet(VAR_DAILY_ROULETTE) + 1);
}
void sub_80EECC8(void)
void IncrementDailyWildBattles(void)
{
VarSet(VAR_DAILY_WILDS, VarGet(VAR_DAILY_WILDS) + 1);
}
void sub_80EECEC(void)
void IncrementDailyBerryBlender(void)
{
VarSet(VAR_DAILY_BLENDER, VarGet(VAR_DAILY_BLENDER) + 1);
}
void sub_80EED10(void)
void IncrementDailyPlantedBerries(void)
{
VarSet(VAR_DAILY_PLANTED_BERRIES, VarGet(VAR_DAILY_PLANTED_BERRIES) + 1);
}
void sub_80EED34(void)
void IncrementDailyPickedBerries(void)
{
VarSet(VAR_DAILY_PICKED_BERRIES, VarGet(VAR_DAILY_PICKED_BERRIES) + gSpecialVar_0x8006);
}
void sub_80EED60(u16 delta)
void IncrementDailyBattlePoints(u16 delta)
{
VarSet(VAR_DAILY_BP, VarGet(VAR_DAILY_BP) + delta);
}
+7 -7
View File
@@ -39,7 +39,7 @@ void sub_8108B94(struct Sprite *);
void sub_8108BE0(struct Sprite *);
void sub_8108C08(struct Sprite *);
void sub_8108C54(struct Sprite *);
void sub_8108CDC(struct Sprite *);
void AnimWaterPulseRing_Step(struct Sprite *);
void sub_810756C(u8);
void sub_81076F4(u8);
void sub_8107B84(u8);
@@ -54,7 +54,7 @@ void sub_810871C(struct Task*, u8);
void sub_8108AC0(struct Task*);
void sub_8108D54(struct Sprite*, int, int);
extern const union AffineAnimCmd *const gUnknown_08593420[];
extern const union AffineAnimCmd *const gGrowingRingAffineAnimTable[];
extern const union AffineAnimCmd *const gUnknown_08596208[];
extern const union AnimCmd *const gUnknown_08595AB8[];
@@ -257,7 +257,7 @@ const struct SpriteTemplate gUnknown_08595170 =
.oam = &gOamData_AffineDouble_ObjNormal_16x32,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_08593420,
.affineAnims = gGrowingRingAffineAnimTable,
.callback = sub_81075EC,
};
@@ -337,7 +337,7 @@ const struct SpriteTemplate gUnknown_08595208 =
.anims = gUnknown_08595200,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A78AC,
.callback = AnimThrowProjectile,
};
const struct SpriteTemplate gUnknown_08595220 =
@@ -1975,17 +1975,17 @@ void sub_8108C54(struct Sprite *sprite)
}
}
void sub_8108C94(struct Sprite *sprite)
void AnimWaterPulseRing(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[1] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[3] = gBattleAnimArgs[2];
sprite->data[4] = gBattleAnimArgs[3];
sprite->callback = sub_8108CDC;
sprite->callback = AnimWaterPulseRing_Step;
}
void sub_8108CDC(struct Sprite *sprite)
void AnimWaterPulseRing_Step(struct Sprite *sprite)
{
int xDiff = sprite->data[1] - sprite->pos1.x;
int yDiff = sprite->data[2] - sprite->pos1.y;