mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Merge remote-tracking branch 'pret/master' into RHH/pr/sync/pretsync20230413
This commit is contained in:
commit
7c29a24110
@ -7,7 +7,7 @@ AbandonedShip_CaptainsOffice_EventScript_CaptSternAide::
|
|||||||
goto_if_set FLAG_EXCHANGED_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
|
goto_if_set FLAG_EXCHANGED_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
|
||||||
checkitem ITEM_SCANNER
|
checkitem ITEM_SCANNER
|
||||||
goto_if_eq VAR_RESULT, TRUE, AbandonedShip_CaptainsOffice_EventScript_CanYouDeliverScanner
|
goto_if_eq VAR_RESULT, TRUE, AbandonedShip_CaptainsOffice_EventScript_CanYouDeliverScanner
|
||||||
goto_if_set FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
|
goto_if_set FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_2_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
|
||||||
msgbox AbandonedShip_CaptainsOffice_Text_NoSuccessFindingScanner, MSGBOX_DEFAULT
|
msgbox AbandonedShip_CaptainsOffice_Text_NoSuccessFindingScanner, MSGBOX_DEFAULT
|
||||||
release
|
release
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
"trainer_type": "TRAINER_TYPE_NONE",
|
"trainer_type": "TRAINER_TYPE_NONE",
|
||||||
"trainer_sight_or_berry_tree_id": "0",
|
"trainer_sight_or_berry_tree_id": "0",
|
||||||
"script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner",
|
"script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner",
|
||||||
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER"
|
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_2_SCANNER"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",
|
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",
|
||||||
|
@ -64,9 +64,9 @@ MauvilleCity_PokemonCenter_1F_EventScript_DeclineWritingLyrics::
|
|||||||
MauvilleCity_PokemonCenter_1F_EventScript_Hipster::
|
MauvilleCity_PokemonCenter_1F_EventScript_Hipster::
|
||||||
lock
|
lock
|
||||||
faceplayer
|
faceplayer
|
||||||
setflag FLAG_SYS_HIPSTER_MEET
|
setflag FLAG_UNLOCKED_TRENDY_SAYINGS
|
||||||
msgbox MauvilleCity_PokemonCenter_1F_Text_TeachWhatsHipAndHappening, MSGBOX_DEFAULT
|
msgbox MauvilleCity_PokemonCenter_1F_Text_TeachWhatsHipAndHappening, MSGBOX_DEFAULT
|
||||||
special GetHipsterSpokenFlag
|
special HasHipsterTaughtWord
|
||||||
goto_if_eq VAR_RESULT, FALSE, MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord
|
goto_if_eq VAR_RESULT, FALSE, MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord
|
||||||
msgbox MauvilleCity_PokemonCenter_1F_Text_IAlreadyTaughtYou, MSGBOX_DEFAULT
|
msgbox MauvilleCity_PokemonCenter_1F_Text_IAlreadyTaughtYou, MSGBOX_DEFAULT
|
||||||
release
|
release
|
||||||
@ -80,8 +80,8 @@ MauvilleCity_PokemonCenter_1F_EventScript_TryTeachWord::
|
|||||||
end
|
end
|
||||||
|
|
||||||
MauvilleCity_PokemonCenter_1F_EventScript_TeachWord::
|
MauvilleCity_PokemonCenter_1F_EventScript_TeachWord::
|
||||||
msgbox MauvilleCity_PokemonCenter_1F_Text_HaveYouHeardOfPhrase, MSGBOX_DEFAULT
|
msgbox MauvilleCity_PokemonCenter_1F_Text_HaveYouHeardOfWord, MSGBOX_DEFAULT
|
||||||
special SetHipsterSpokenFlag
|
special SetHipsterTaughtWord
|
||||||
release
|
release
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -969,7 +969,7 @@ MauvilleCity_PokemonCenter_1F_Text_IveGotNothingNewToTeach:
|
|||||||
.string "what's hip and happening.\p"
|
.string "what's hip and happening.\p"
|
||||||
.string "I've got nothing new to teach you!$"
|
.string "I've got nothing new to teach you!$"
|
||||||
|
|
||||||
MauvilleCity_PokemonCenter_1F_Text_HaveYouHeardOfPhrase:
|
MauvilleCity_PokemonCenter_1F_Text_HaveYouHeardOfWord:
|
||||||
.string "Hey, have you heard about\n"
|
.string "Hey, have you heard about\n"
|
||||||
.string "“{STR_VAR_1}”?\p"
|
.string "“{STR_VAR_1}”?\p"
|
||||||
.string "What's it mean? Well…\n"
|
.string "What's it mean? Well…\n"
|
||||||
|
@ -111,8 +111,8 @@ gSpecials::
|
|||||||
def_special Script_GetCurrentMauvilleMan
|
def_special Script_GetCurrentMauvilleMan
|
||||||
def_special HasBardSongBeenChanged
|
def_special HasBardSongBeenChanged
|
||||||
def_special SaveBardSongLyrics
|
def_special SaveBardSongLyrics
|
||||||
def_special GetHipsterSpokenFlag
|
def_special HasHipsterTaughtWord
|
||||||
def_special SetHipsterSpokenFlag
|
def_special SetHipsterTaughtWord
|
||||||
def_special HipsterTryTeachWord
|
def_special HipsterTryTeachWord
|
||||||
def_special PlayBardSong
|
def_special PlayBardSong
|
||||||
def_special SetMauvilleOldManObjEventGfx
|
def_special SetMauvilleOldManObjEventGfx
|
||||||
|
@ -36,7 +36,7 @@ static u32 GetGlyphWidth_Narrow(u16, bool32);
|
|||||||
static u32 GetGlyphWidth_SmallNarrow(u16, bool32);
|
static u32 GetGlyphWidth_SmallNarrow(u16, bool32);
|
||||||
|
|
||||||
static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0};
|
static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0};
|
||||||
static EWRAM_DATA struct TextPrinter sTextPrinters[NUM_TEXT_PRINTERS] = {0};
|
static EWRAM_DATA struct TextPrinter sTextPrinters[WINDOWS_MAX] = {0};
|
||||||
|
|
||||||
static u16 sFontHalfRowLookupTable[0x51];
|
static u16 sFontHalfRowLookupTable[0x51];
|
||||||
static u16 sLastTextBgColor;
|
static u16 sLastTextBgColor;
|
||||||
@ -244,7 +244,7 @@ static void SetFontsPointer(const struct FontInfo *fonts)
|
|||||||
void DeactivateAllTextPrinters(void)
|
void DeactivateAllTextPrinters(void)
|
||||||
{
|
{
|
||||||
int printer;
|
int printer;
|
||||||
for (printer = 0; printer < NUM_TEXT_PRINTERS; ++printer)
|
for (printer = 0; printer < WINDOWS_MAX; ++printer)
|
||||||
sTextPrinters[printer].active = FALSE;
|
sTextPrinters[printer].active = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ void RunTextPrinters(void)
|
|||||||
|
|
||||||
if (!gDisableTextPrinters)
|
if (!gDisableTextPrinters)
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
|
for (i = 0; i < WINDOWS_MAX; ++i)
|
||||||
{
|
{
|
||||||
if (sTextPrinters[i].active)
|
if (sTextPrinters[i].active)
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include "characters.h"
|
#include "characters.h"
|
||||||
|
|
||||||
#define NUM_TEXT_PRINTERS 32
|
|
||||||
|
|
||||||
// Given as a text speed when all the text should be
|
// Given as a text speed when all the text should be
|
||||||
// loaded at once but not copied to vram yet.
|
// loaded at once but not copied to vram yet.
|
||||||
#define TEXT_SKIP_DRAW 0xFF
|
#define TEXT_SKIP_DRAW 0xFF
|
||||||
|
@ -9,8 +9,6 @@ u8 gTransparentTileNumber;
|
|||||||
void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS];
|
void *gWindowBgTilemapBuffers[NUM_BACKGROUNDS];
|
||||||
extern u32 gWindowTileAutoAllocEnabled;
|
extern u32 gWindowTileAutoAllocEnabled;
|
||||||
|
|
||||||
#define WINDOWS_MAX 32
|
|
||||||
|
|
||||||
EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0};
|
EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0};
|
||||||
EWRAM_DATA static struct Window* sWindowPtr = NULL;
|
EWRAM_DATA static struct Window* sWindowPtr = NULL;
|
||||||
EWRAM_DATA static u16 sWindowSize = 0;
|
EWRAM_DATA static u16 sWindowSize = 0;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef GUARD_WINDOW_H
|
#ifndef GUARD_WINDOW_H
|
||||||
#define GUARD_WINDOW_H
|
#define GUARD_WINDOW_H
|
||||||
|
|
||||||
|
#define WINDOWS_MAX 32
|
||||||
|
|
||||||
#define PIXEL_FILL(num) ((num) | ((num) << 4))
|
#define PIXEL_FILL(num) ((num) | ((num) << 4))
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
BIN
graphics/cable_car/pylon_top.bin
Executable file
BIN
graphics/cable_car/pylon_top.bin
Executable file
Binary file not shown.
@ -1095,7 +1095,7 @@
|
|||||||
#define EC_WORD_OLD ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 30)
|
#define EC_WORD_OLD ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 30)
|
||||||
#define EC_WORD_YOUNG ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 31)
|
#define EC_WORD_YOUNG ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 31)
|
||||||
#define EC_WORD_UGLY ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 32)
|
#define EC_WORD_UGLY ((EC_GROUP_TRENDY_SAYING << EC_MASK_BITS) | 32)
|
||||||
#define NUM_ADDITIONAL_PHRASES 33
|
#define NUM_TRENDY_SAYINGS 33
|
||||||
|
|
||||||
// Special Berry Masters Wife phrases
|
// Special Berry Masters Wife phrases
|
||||||
#define NOT_SPECIAL_PHRASE 0
|
#define NOT_SPECIAL_PHRASE 0
|
||||||
|
@ -1123,7 +1123,7 @@
|
|||||||
#define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433
|
#define FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL 0x433
|
||||||
#define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434
|
#define FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE 0x434
|
||||||
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435
|
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL 0x435
|
||||||
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER 0x436
|
#define FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_2_SCANNER 0x436
|
||||||
#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437
|
#define FLAG_ITEM_SCORCHED_SLAB_TM11 0x437
|
||||||
#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438
|
#define FLAG_ITEM_METEOR_FALLS_B1F_2R_TM02 0x438
|
||||||
#define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439
|
#define FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL 0x439
|
||||||
@ -1348,7 +1348,7 @@
|
|||||||
#define FLAG_UNUSED_0x863 (SYSTEM_FLAGS + 0x3) // Unused Flag
|
#define FLAG_UNUSED_0x863 (SYSTEM_FLAGS + 0x3) // Unused Flag
|
||||||
#define FLAG_SYS_GAME_CLEAR (SYSTEM_FLAGS + 0x4)
|
#define FLAG_SYS_GAME_CLEAR (SYSTEM_FLAGS + 0x4)
|
||||||
#define FLAG_SYS_CHAT_USED (SYSTEM_FLAGS + 0x5)
|
#define FLAG_SYS_CHAT_USED (SYSTEM_FLAGS + 0x5)
|
||||||
#define FLAG_SYS_HIPSTER_MEET (SYSTEM_FLAGS + 0x6)
|
#define FLAG_UNLOCKED_TRENDY_SAYINGS (SYSTEM_FLAGS + 0x6)
|
||||||
|
|
||||||
// Badges
|
// Badges
|
||||||
#define FLAG_BADGE01_GET (SYSTEM_FLAGS + 0x7)
|
#define FLAG_BADGE01_GET (SYSTEM_FLAGS + 0x7)
|
||||||
|
@ -128,11 +128,11 @@ void InitializeEasyChatWordArray(u16 *words, u16 length);
|
|||||||
u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows);
|
u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows);
|
||||||
bool8 IsBardWordInvalid(u16 word);
|
bool8 IsBardWordInvalid(u16 word);
|
||||||
u16 GetRandomEasyChatWordFromGroup(u16 group);
|
u16 GetRandomEasyChatWordFromGroup(u16 group);
|
||||||
u16 GetNewHipsterPhraseToTeach(void);
|
u16 UnlockRandomTrendySaying(void);
|
||||||
u16 EasyChat_GetNumWordsInGroup(u8);
|
u16 EasyChat_GetNumWordsInGroup(u8);
|
||||||
u16 GetRandomEasyChatWordFromUnlockedGroup(u16);
|
u16 GetRandomEasyChatWordFromUnlockedGroup(u16);
|
||||||
void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType);
|
void DoEasyChatScreen(u8 type, u16 *words, MainCallback callback, u8 displayedPersonType);
|
||||||
void InitQuestionnaireWords(void);
|
void InitQuestionnaireWords(void);
|
||||||
void UnlockAdditionalPhrase(u8 additionalPhraseId);
|
void UnlockTrendySaying(u8 wordIndex);
|
||||||
|
|
||||||
#endif // GUARD_EASYCHAT_H
|
#endif // GUARD_EASYCHAT_H
|
||||||
|
@ -32,7 +32,7 @@ bool8 TryDoDiveWarp(struct MapPosition *position, u16 b);
|
|||||||
int SetCableClubWarp(void);
|
int SetCableClubWarp(void);
|
||||||
u8 TrySetDiveWarp(void);
|
u8 TrySetDiveWarp(void);
|
||||||
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction);
|
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction);
|
||||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
||||||
void ClearPoisonStepCounter(void);
|
void ClearPoisonStepCounter(void);
|
||||||
|
|
||||||
#endif // GUARD_FIELDCONTROLAVATAR_H
|
#endif // GUARD_FIELDCONTROLAVATAR_H
|
||||||
|
@ -48,8 +48,8 @@ void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout);
|
|||||||
void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout);
|
void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout);
|
||||||
void CopyPrimaryTilesetToVram(const struct MapLayout *);
|
void CopyPrimaryTilesetToVram(const struct MapLayout *);
|
||||||
void CopySecondaryTilesetToVram(const struct MapLayout *);
|
void CopySecondaryTilesetToVram(const struct MapLayout *);
|
||||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection);
|
const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection);
|
||||||
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
|
const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y);
|
||||||
void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
|
void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
|
||||||
|
|
||||||
// field_region_map.c
|
// field_region_map.c
|
||||||
|
@ -50,10 +50,10 @@ struct MapLayout
|
|||||||
{
|
{
|
||||||
/*0x00*/ s32 width;
|
/*0x00*/ s32 width;
|
||||||
/*0x04*/ s32 height;
|
/*0x04*/ s32 height;
|
||||||
/*0x08*/ u16 *border;
|
/*0x08*/ const u16 *border;
|
||||||
/*0x0C*/ u16 *map;
|
/*0x0C*/ const u16 *map;
|
||||||
/*0x10*/ struct Tileset *primaryTileset;
|
/*0x10*/ const struct Tileset *primaryTileset;
|
||||||
/*0x14*/ struct Tileset *secondaryTileset;
|
/*0x14*/ const struct Tileset *secondaryTileset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BackupMapLayout
|
struct BackupMapLayout
|
||||||
@ -98,7 +98,7 @@ struct CoordEvent
|
|||||||
u8 elevation;
|
u8 elevation;
|
||||||
u16 trigger;
|
u16 trigger;
|
||||||
u16 index;
|
u16 index;
|
||||||
u8 *script;
|
const u8 *script;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BgEvent
|
struct BgEvent
|
||||||
@ -107,7 +107,7 @@ struct BgEvent
|
|||||||
u8 elevation;
|
u8 elevation;
|
||||||
u8 kind; // The "kind" field determines how to access bgUnion union below.
|
u8 kind; // The "kind" field determines how to access bgUnion union below.
|
||||||
union {
|
union {
|
||||||
u8 *script;
|
const u8 *script;
|
||||||
struct {
|
struct {
|
||||||
u16 item;
|
u16 item;
|
||||||
u16 hiddenItemId;
|
u16 hiddenItemId;
|
||||||
@ -122,10 +122,10 @@ struct MapEvents
|
|||||||
u8 warpCount;
|
u8 warpCount;
|
||||||
u8 coordEventCount;
|
u8 coordEventCount;
|
||||||
u8 bgEventCount;
|
u8 bgEventCount;
|
||||||
struct ObjectEventTemplate *objectEvents;
|
const struct ObjectEventTemplate *objectEvents;
|
||||||
struct WarpEvent *warps;
|
const struct WarpEvent *warps;
|
||||||
struct CoordEvent *coordEvents;
|
const struct CoordEvent *coordEvents;
|
||||||
struct BgEvent *bgEvents;
|
const struct BgEvent *bgEvents;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapConnection
|
struct MapConnection
|
||||||
@ -139,7 +139,7 @@ struct MapConnection
|
|||||||
struct MapConnections
|
struct MapConnections
|
||||||
{
|
{
|
||||||
s32 count;
|
s32 count;
|
||||||
struct MapConnection *connections;
|
const struct MapConnection *connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MapHeader
|
struct MapHeader
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
|
|
||||||
#define NUM_DEX_FLAG_BYTES ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER)
|
#define NUM_DEX_FLAG_BYTES ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER)
|
||||||
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
|
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
|
||||||
#define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES)
|
#define NUM_TRENDY_SAYING_BYTES ROUND_BITS_TO_BYTES(NUM_TRENDY_SAYINGS)
|
||||||
|
|
||||||
// Calls m0/m1/.../m8 depending on how many arguments are passed.
|
// Calls m0/m1/.../m8 depending on how many arguments are passed.
|
||||||
#define VARARG_8(m, ...) CAT(m, NARG_8(__VA_ARGS__))(__VA_ARGS__)
|
#define VARARG_8(m, ...) CAT(m, NARG_8(__VA_ARGS__))(__VA_ARGS__)
|
||||||
@ -687,7 +687,7 @@ struct MauvilleManGiddy
|
|||||||
struct MauvilleManHipster
|
struct MauvilleManHipster
|
||||||
{
|
{
|
||||||
u8 id;
|
u8 id;
|
||||||
bool8 alreadySpoken;
|
bool8 taughtWord;
|
||||||
u8 language;
|
u8 language;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1045,7 +1045,7 @@ struct SaveBlock1
|
|||||||
/*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
|
/*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
|
||||||
/*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
|
/*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
|
||||||
/*0x2BE0*/ struct Mail mail[MAIL_COUNT];
|
/*0x2BE0*/ struct Mail mail[MAIL_COUNT];
|
||||||
/*0x2E20*/ u8 additionalPhrases[NUM_ADDITIONAL_PHRASE_BYTES]; // bitfield for 33 additional phrases in easy chat system
|
/*0x2E20*/ u8 unlockedTrendySayings[NUM_TRENDY_SAYING_BYTES]; // Bitfield for unlockable Easy Chat words in EC_GROUP_TRENDY_SAYING
|
||||||
/*0x2E25*/ //u8 padding5[3];
|
/*0x2E25*/ //u8 padding5[3];
|
||||||
/*0x2E28*/ OldMan oldMan;
|
/*0x2E28*/ OldMan oldMan;
|
||||||
/*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT];
|
/*0x2e64*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT];
|
||||||
|
@ -27,9 +27,11 @@
|
|||||||
|
|
||||||
#define STATE_END 0xFF
|
#define STATE_END 0xFF
|
||||||
|
|
||||||
#define TAG_CABLE_CAR 1
|
enum {
|
||||||
#define TAG_DOOR 2
|
TAG_CABLE_CAR = 1,
|
||||||
#define TAG_CABLE 3
|
TAG_DOOR,
|
||||||
|
TAG_CABLE,
|
||||||
|
};
|
||||||
|
|
||||||
struct CableCar
|
struct CableCar
|
||||||
{
|
{
|
||||||
@ -62,8 +64,8 @@ struct CableCar
|
|||||||
u16 *groundTilemap;
|
u16 *groundTilemap;
|
||||||
u16 *treesTilemap;
|
u16 *treesTilemap;
|
||||||
u16 *bgMountainsTilemap;
|
u16 *bgMountainsTilemap;
|
||||||
const u16 *pylonHookTilemapEntries;
|
const u16 *pylonTopTilemap;
|
||||||
u8 *pylonStemTilemap;
|
u16 *pylonPoleTilemap;
|
||||||
};
|
};
|
||||||
|
|
||||||
static EWRAM_DATA struct CableCar *sCableCar = NULL;
|
static EWRAM_DATA struct CableCar *sCableCar = NULL;
|
||||||
@ -129,24 +131,11 @@ static const struct BgTemplate sBgTemplates[4] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sGround_Tilemap[] = INCBIN_U8("graphics/cable_car/ground.bin.lz");
|
static const u16 sGround_Tilemap[] = INCBIN_U16("graphics/cable_car/ground.bin.lz");
|
||||||
static const u8 sTrees_Tilemap[] = INCBIN_U8("graphics/cable_car/trees.bin.lz");
|
static const u16 sTrees_Tilemap[] = INCBIN_U16("graphics/cable_car/trees.bin.lz");
|
||||||
static const u8 sBgMountains_Tilemap[] = INCBIN_U8("graphics/cable_car/bg_mountains.bin.lz");
|
static const u16 sBgMountains_Tilemap[] = INCBIN_U16("graphics/cable_car/bg_mountains.bin.lz");
|
||||||
|
static const u16 sPylonTop_Tilemap[] = INCBIN_U16("graphics/cable_car/pylon_top.bin");
|
||||||
static const u16 sPylonHook_TilemapEntries[] = {
|
static const u16 sPylonPole_Tilemap[] = INCBIN_U16("graphics/cable_car/pylon_pole.bin.lz");
|
||||||
0x3000,
|
|
||||||
0x3001,
|
|
||||||
0x3002,
|
|
||||||
0x3003,
|
|
||||||
0x3004,
|
|
||||||
0x3005,
|
|
||||||
0x3006,
|
|
||||||
0x3007,
|
|
||||||
0x3008,
|
|
||||||
0x3009,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const u8 sPylonStems_Tilemap[] = INCBIN_U8("graphics/cable_car/pylons.bin.lz");
|
|
||||||
|
|
||||||
static const struct CompressedSpriteSheet sSpriteSheets[] = {
|
static const struct CompressedSpriteSheet sSpriteSheets[] = {
|
||||||
{ gCableCar_Gfx, 0x800, TAG_CABLE_CAR },
|
{ gCableCar_Gfx, 0x800, TAG_CABLE_CAR },
|
||||||
@ -299,8 +288,8 @@ static void CB2_LoadCableCar(void)
|
|||||||
sCableCar->groundTilemap = malloc_and_decompress(sGround_Tilemap, &sizeOut);
|
sCableCar->groundTilemap = malloc_and_decompress(sGround_Tilemap, &sizeOut);
|
||||||
sCableCar->treesTilemap = malloc_and_decompress(sTrees_Tilemap, &sizeOut);
|
sCableCar->treesTilemap = malloc_and_decompress(sTrees_Tilemap, &sizeOut);
|
||||||
sCableCar->bgMountainsTilemap = malloc_and_decompress(sBgMountains_Tilemap, &sizeOut);
|
sCableCar->bgMountainsTilemap = malloc_and_decompress(sBgMountains_Tilemap, &sizeOut);
|
||||||
sCableCar->pylonStemTilemap = malloc_and_decompress(sPylonStems_Tilemap, &sizeOut);
|
sCableCar->pylonPoleTilemap = malloc_and_decompress(sPylonPole_Tilemap, &sizeOut);
|
||||||
sCableCar->pylonHookTilemapEntries = sPylonHook_TilemapEntries;
|
sCableCar->pylonTopTilemap = sPylonTop_Tilemap;
|
||||||
DecompressAndCopyTileDataToVram(0, gCableCarBg_Gfx, 0, 0, 0);
|
DecompressAndCopyTileDataToVram(0, gCableCarBg_Gfx, 0, 0, 0);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
@ -335,8 +324,8 @@ static void CB2_LoadCableCar(void)
|
|||||||
case 6:
|
case 6:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(1, sCableCar->treesTilemap, 0, 17, 32, 15, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(1, sCableCar->treesTilemap, 0, 17, 32, 15, 17);
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(2, sCableCar->bgMountainsTilemap, 0, 0, 30, 20, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(2, sCableCar->bgMountainsTilemap, 0, 0, 30, 20, 17);
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonHookTilemapEntries, 0, 0, 5, 2, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonTopTilemap, 0, 0, 5, 2, 17);
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 20, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonPoleTilemap, 0, 2, 2, 20, 17);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
@ -404,8 +393,8 @@ static void CB2_EndCableCar(void)
|
|||||||
UnsetBgTilemapBuffer(2);
|
UnsetBgTilemapBuffer(2);
|
||||||
UnsetBgTilemapBuffer(3);
|
UnsetBgTilemapBuffer(3);
|
||||||
ResetBgsAndClearDma3BusyFlags(0);
|
ResetBgsAndClearDma3BusyFlags(0);
|
||||||
sCableCar->pylonHookTilemapEntries = NULL;
|
sCableCar->pylonTopTilemap = NULL;
|
||||||
FREE_AND_SET_NULL(sCableCar->pylonStemTilemap);
|
FREE_AND_SET_NULL(sCableCar->pylonPoleTilemap);
|
||||||
FREE_AND_SET_NULL(sCableCar->bgMountainsTilemap);
|
FREE_AND_SET_NULL(sCableCar->bgMountainsTilemap);
|
||||||
FREE_AND_SET_NULL(sCableCar->treesTilemap);
|
FREE_AND_SET_NULL(sCableCar->treesTilemap);
|
||||||
FREE_AND_SET_NULL(sCableCar->groundTilemap);
|
FREE_AND_SET_NULL(sCableCar->groundTilemap);
|
||||||
@ -514,8 +503,8 @@ static void Task_AnimateBgGoingUp(u8 taskId)
|
|||||||
FillBgTilemapBufferRect(3, 0, 2, 0, 1, 2, 17);
|
FillBgTilemapBufferRect(3, 0, 2, 0, 1, 2, 17);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonHookTilemapEntries, 0, 0, 5, 2, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonTopTilemap, 0, 0, 5, 2, 17);
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 30, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonPoleTilemap, 0, 2, 2, 30, 17);
|
||||||
sCableCar->bg3VerticalOffset = 64;
|
sCableCar->bg3VerticalOffset = 64;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -542,7 +531,7 @@ static void Task_AnimateBgGoingDown(u8 taskId)
|
|||||||
switch (sCableCar->bg3HorizontalOffset)
|
switch (sCableCar->bg3HorizontalOffset)
|
||||||
{
|
{
|
||||||
case 176:
|
case 176:
|
||||||
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonStemTilemap, 0, 2, 2, 30, 17);
|
CopyToBgTilemapBufferRect_ChangePalette(3, sCableCar->pylonPoleTilemap, 0, 2, 2, 30, 17);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
FillBgTilemapBufferRect(3, 0, 2, 0, 3, 2, 17);
|
FillBgTilemapBufferRect(3, 0, 2, 0, 3, 2, 17);
|
||||||
@ -550,14 +539,14 @@ static void Task_AnimateBgGoingDown(u8 taskId)
|
|||||||
sCableCar->bg3VerticalOffset = 192;
|
sCableCar->bg3VerticalOffset = 192;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[2], 2, 0, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[2], 2, 0, 1, 1, 17);
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[3], 3, 0, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[3], 3, 0, 1, 1, 17);
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[7], 2, 1, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[7], 2, 1, 1, 1, 17);
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[8], 3, 1, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[8], 3, 1, 1, 1, 17);
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[4], 4, 0, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[4], 4, 0, 1, 1, 17);
|
||||||
FillBgTilemapBufferRect(3, sCableCar->pylonHookTilemapEntries[9], 4, 1, 1, 1, 17);
|
FillBgTilemapBufferRect(3, sCableCar->pylonTopTilemap[9], 4, 1, 1, 1, 17);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5500,7 +5500,7 @@ static void ContestBG_FillBoxWithTile(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 wi
|
|||||||
static bool32 Contest_RunTextPrinters(void)
|
static bool32 Contest_RunTextPrinters(void)
|
||||||
{
|
{
|
||||||
RunTextPrinters();
|
RunTextPrinters();
|
||||||
return IsTextPrinterActive(4);
|
return IsTextPrinterActive(WIN_GENERAL_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Contest_SetBgCopyFlags(u32 flagIndex)
|
static void Contest_SetBgCopyFlags(u32 flagIndex)
|
||||||
|
@ -5109,7 +5109,7 @@ static bool8 IsEasyChatGroupUnlocked(u8 groupId)
|
|||||||
switch (groupId)
|
switch (groupId)
|
||||||
{
|
{
|
||||||
case EC_GROUP_TRENDY_SAYING:
|
case EC_GROUP_TRENDY_SAYING:
|
||||||
return FlagGet(FLAG_SYS_HIPSTER_MEET);
|
return FlagGet(FLAG_UNLOCKED_TRENDY_SAYINGS);
|
||||||
case EC_GROUP_EVENTS:
|
case EC_GROUP_EVENTS:
|
||||||
case EC_GROUP_MOVE_1:
|
case EC_GROUP_MOVE_1:
|
||||||
case EC_GROUP_MOVE_2:
|
case EC_GROUP_MOVE_2:
|
||||||
@ -5425,80 +5425,99 @@ void BufferDeepLinkPhrase(void)
|
|||||||
CopyEasyChatWord(gStringVar2, easyChatWord);
|
CopyEasyChatWord(gStringVar2, easyChatWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 IsAdditionalPhraseUnlocked(u8 additionalPhraseId)
|
/*
|
||||||
|
### Trendy Sayings
|
||||||
|
|
||||||
|
Not to be confused with Dewford Town's "trendy phrase".
|
||||||
|
|
||||||
|
This is a group of easy chat words (EC_GROUP_TRENDY_SAYING) that are normally inaccessible.
|
||||||
|
They can be unlocked either through Mystery Event (where they're referred to as "rare" words)
|
||||||
|
or from the "Hipster" variety of the Mauville Old Man. The Hipster can unlock one word each
|
||||||
|
time he is received via record mixing (and once if he is the player's default Old Man).
|
||||||
|
|
||||||
|
Which words have been unlocked is saved in the unlockedTrendySayings bitfield in SaveBlock1
|
||||||
|
|
||||||
|
Unlocked trendy saying words are only accessible if the flag FLAG_UNLOCKED_TRENDY_SAYINGS is set.
|
||||||
|
It's set any time the player talks to the Hipster, but is not apparently set by Mystery Event,
|
||||||
|
meaning trendy saying words unlocked via Mystery Event may not be available until the player has
|
||||||
|
talked to the Hipster.
|
||||||
|
*/
|
||||||
|
static bool8 IsTrendySayingUnlocked(u8 wordIndex)
|
||||||
{
|
{
|
||||||
int byteOffset = additionalPhraseId / 8;
|
int byteOffset = wordIndex / 8;
|
||||||
int shift = additionalPhraseId % 8;
|
int shift = wordIndex % 8;
|
||||||
return (gSaveBlock1Ptr->additionalPhrases[byteOffset] >> shift) & 1;
|
return (gSaveBlock1Ptr->unlockedTrendySayings[byteOffset] >> shift) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnlockAdditionalPhrase(u8 additionalPhraseId)
|
void UnlockTrendySaying(u8 wordIndex)
|
||||||
{
|
{
|
||||||
if (additionalPhraseId < NUM_ADDITIONAL_PHRASES)
|
if (wordIndex < NUM_TRENDY_SAYINGS)
|
||||||
{
|
{
|
||||||
int byteOffset = additionalPhraseId / 8;
|
int byteOffset = wordIndex / 8;
|
||||||
int shift = additionalPhraseId % 8;
|
int shift = wordIndex % 8;
|
||||||
gSaveBlock1Ptr->additionalPhrases[byteOffset] |= 1 << shift;
|
gSaveBlock1Ptr->unlockedTrendySayings[byteOffset] |= 1 << shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 GetNumAdditionalPhrasesUnlocked(void)
|
static u8 GetNumTrendySayingsUnlocked(void)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 numAdditionalPhrasesUnlocked;
|
u8 numUnlocked;
|
||||||
|
|
||||||
for (i = 0, numAdditionalPhrasesUnlocked = 0; i < NUM_ADDITIONAL_PHRASES; i++)
|
for (i = 0, numUnlocked = 0; i < NUM_TRENDY_SAYINGS; i++)
|
||||||
{
|
{
|
||||||
if (IsAdditionalPhraseUnlocked(i))
|
if (IsTrendySayingUnlocked(i))
|
||||||
numAdditionalPhrasesUnlocked++;
|
numUnlocked++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return numAdditionalPhrasesUnlocked;
|
return numUnlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetNewHipsterPhraseToTeach(void)
|
u16 UnlockRandomTrendySaying(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
u16 additionalPhraseId;
|
u16 numToSkip;
|
||||||
u8 numAdditionalPhrasesUnlocked = GetNumAdditionalPhrasesUnlocked();
|
u8 numUnlocked = GetNumTrendySayingsUnlocked();
|
||||||
if (numAdditionalPhrasesUnlocked == NUM_ADDITIONAL_PHRASES)
|
if (numUnlocked == NUM_TRENDY_SAYINGS)
|
||||||
return EC_EMPTY_WORD;
|
return EC_EMPTY_WORD;
|
||||||
|
|
||||||
additionalPhraseId = Random() % (NUM_ADDITIONAL_PHRASES - numAdditionalPhrasesUnlocked);
|
numToSkip = Random() % (NUM_TRENDY_SAYINGS - numUnlocked);
|
||||||
for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++)
|
for (i = 0; i < NUM_TRENDY_SAYINGS; i++)
|
||||||
{
|
{
|
||||||
if (!IsAdditionalPhraseUnlocked(i))
|
if (!IsTrendySayingUnlocked(i))
|
||||||
{
|
{
|
||||||
if (additionalPhraseId)
|
if (numToSkip)
|
||||||
{
|
{
|
||||||
additionalPhraseId--;
|
// Skip the first n locked words, as determined by the Random call above.
|
||||||
|
numToSkip--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UnlockAdditionalPhrase(i);
|
UnlockTrendySaying(i);
|
||||||
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
|
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Would only be reached if there are no new words to teach, which is handled at the start.
|
||||||
return EC_EMPTY_WORD;
|
return EC_EMPTY_WORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
u16 GetRandomTaughtHipsterPhrase(void)
|
static u16 GetRandomUnlockedTrendySaying(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
u16 additionalPhraseId = GetNumAdditionalPhrasesUnlocked();
|
u16 n = GetNumTrendySayingsUnlocked();
|
||||||
if (additionalPhraseId == 0)
|
if (n == 0)
|
||||||
return EC_EMPTY_WORD;
|
return EC_EMPTY_WORD;
|
||||||
|
|
||||||
additionalPhraseId = Random() % additionalPhraseId;
|
n = Random() % n;
|
||||||
for (i = 0; i < NUM_ADDITIONAL_PHRASES; i++)
|
for (i = 0; i < NUM_TRENDY_SAYINGS; i++)
|
||||||
{
|
{
|
||||||
if (IsAdditionalPhraseUnlocked(i))
|
if (IsTrendySayingUnlocked(i))
|
||||||
{
|
{
|
||||||
if (additionalPhraseId)
|
if (n)
|
||||||
additionalPhraseId--;
|
n--;
|
||||||
else
|
else
|
||||||
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
|
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
|
||||||
}
|
}
|
||||||
@ -5569,10 +5588,10 @@ void InitEasyChatPhrases(void)
|
|||||||
// Mauville old man data is corrupted, which is initialized directly after
|
// Mauville old man data is corrupted, which is initialized directly after
|
||||||
// this function is called when starting a new game.
|
// this function is called when starting a new game.
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
gSaveBlock1Ptr->additionalPhrases[i] = 0;
|
gSaveBlock1Ptr->unlockedTrendySayings[i] = 0;
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->additionalPhrases); i++)
|
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->unlockedTrendySayings); i++)
|
||||||
gSaveBlock1Ptr->additionalPhrases[i] = 0;
|
gSaveBlock1Ptr->unlockedTrendySayings[i] = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5611,7 +5630,7 @@ static void SetUnlockedEasyChatGroups(void)
|
|||||||
sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_MOVE_2;
|
sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_MOVE_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlagGet(FLAG_SYS_HIPSTER_MEET))
|
if (FlagGet(FLAG_UNLOCKED_TRENDY_SAYINGS))
|
||||||
sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_TRENDY_SAYING;
|
sWordData->unlockedGroupIds[sWordData->numUnlockedGroups++] = EC_GROUP_TRENDY_SAYING;
|
||||||
|
|
||||||
if (IsNationalPokedexEnabled())
|
if (IsNationalPokedexEnabled())
|
||||||
@ -5800,7 +5819,7 @@ static bool8 IsEasyChatIndexAndGroupUnlocked(u16 wordIndex, u8 groupId)
|
|||||||
case EC_GROUP_MOVE_2:
|
case EC_GROUP_MOVE_2:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case EC_GROUP_TRENDY_SAYING:
|
case EC_GROUP_TRENDY_SAYING:
|
||||||
return IsAdditionalPhraseUnlocked(wordIndex);
|
return IsTrendySayingUnlocked(wordIndex);
|
||||||
default:
|
default:
|
||||||
return gEasyChatGroups[groupId].wordData.words[wordIndex].enabled;
|
return gEasyChatGroups[groupId].wordData.words[wordIndex].enabled;
|
||||||
}
|
}
|
||||||
|
@ -132,9 +132,9 @@ static void SetObjectEventDynamicGraphicsId(struct ObjectEvent *);
|
|||||||
static void RemoveObjectEventInternal(struct ObjectEvent *);
|
static void RemoveObjectEventInternal(struct ObjectEvent *);
|
||||||
static u16 GetObjectEventFlagIdByObjectEventId(u8);
|
static u16 GetObjectEventFlagIdByObjectEventId(u8);
|
||||||
static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
|
static void UpdateObjectEventVisibility(struct ObjectEvent *, struct Sprite *);
|
||||||
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
|
static void MakeSpriteTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *, struct SpriteTemplate *, const struct SubspriteTable **);
|
||||||
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
|
static void GetObjectEventMovingCameraOffset(s16 *, s16 *);
|
||||||
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
|
static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8, u8, u8);
|
||||||
static void LoadObjectEventPalette(u16);
|
static void LoadObjectEventPalette(u16);
|
||||||
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *);
|
static void RemoveObjectEventIfOutsideView(struct ObjectEvent *);
|
||||||
static void SpawnObjectEventOnReturnToField(u8, s16, s16);
|
static void SpawnObjectEventOnReturnToField(u8, s16, s16);
|
||||||
@ -148,7 +148,7 @@ static void SpriteCB_CameraObject(struct Sprite *);
|
|||||||
static void CameraObject_0(struct Sprite *);
|
static void CameraObject_0(struct Sprite *);
|
||||||
static void CameraObject_1(struct Sprite *);
|
static void CameraObject_1(struct Sprite *);
|
||||||
static void CameraObject_2(struct Sprite *);
|
static void CameraObject_2(struct Sprite *);
|
||||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, struct ObjectEventTemplate *, u8);
|
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8, const struct ObjectEventTemplate *, u8);
|
||||||
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
|
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
|
||||||
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
||||||
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
|
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
|
||||||
@ -1268,7 +1268,7 @@ static u8 GetObjectEventIdByLocalId(u8 localId)
|
|||||||
return OBJECT_EVENTS_COUNT;
|
return OBJECT_EVENTS_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 InitObjectEventStateFromTemplate(struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
|
static u8 InitObjectEventStateFromTemplate(const struct ObjectEventTemplate *template, u8 mapNum, u8 mapGroup)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *objectEvent;
|
struct ObjectEvent *objectEvent;
|
||||||
u8 objectEventId;
|
u8 objectEventId;
|
||||||
@ -1399,7 +1399,7 @@ void RemoveAllObjectEventsExceptPlayer(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
static u8 TrySetupObjectEventSprite(const struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||||
{
|
{
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
u8 paletteSlot;
|
u8 paletteSlot;
|
||||||
@ -1459,7 +1459,7 @@ static u8 TrySetupObjectEventSprite(struct ObjectEventTemplate *objectEventTempl
|
|||||||
return objectEventId;
|
return objectEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 TrySpawnObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
static u8 TrySpawnObjectEventTemplate(const struct ObjectEventTemplate *objectEventTemplate, u8 mapNum, u8 mapGroup, s16 cameraX, s16 cameraY)
|
||||||
{
|
{
|
||||||
u8 objectEventId;
|
u8 objectEventId;
|
||||||
struct SpriteTemplate spriteTemplate;
|
struct SpriteTemplate spriteTemplate;
|
||||||
@ -1513,7 +1513,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
|||||||
|
|
||||||
u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup)
|
u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate *objectEventTemplate;
|
const struct ObjectEventTemplate *objectEventTemplate;
|
||||||
s16 cameraX, cameraY;
|
s16 cameraX, cameraY;
|
||||||
|
|
||||||
objectEventTemplate = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
objectEventTemplate = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||||
@ -1543,7 +1543,7 @@ static void CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(u16 graphics
|
|||||||
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, sMovementTypeCallbacks[movementType], spriteTemplate, subspriteTables);
|
CopyObjectGraphicsInfoToSpriteTemplate(graphicsId, sMovementTypeCallbacks[movementType], spriteTemplate, subspriteTables);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MakeSpriteTemplateFromObjectEventTemplate(struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
|
static void MakeSpriteTemplateFromObjectEventTemplate(const struct ObjectEventTemplate *objectEventTemplate, struct SpriteTemplate *spriteTemplate, const struct SubspriteTable **subspriteTables)
|
||||||
{
|
{
|
||||||
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
|
CopyObjectGraphicsInfoToSpriteTemplate_WithMovementType(objectEventTemplate->graphicsId, objectEventTemplate->movementType, spriteTemplate, subspriteTables);
|
||||||
}
|
}
|
||||||
@ -2375,7 +2375,7 @@ const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId)
|
|||||||
|
|
||||||
static u16 GetObjectEventFlagIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
static u16 GetObjectEventFlagIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate *obj = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
const struct ObjectEventTemplate *obj = GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup);
|
||||||
#ifdef UBFIX
|
#ifdef UBFIX
|
||||||
// BUG: The function may return NULL, and attempting to read from NULL may freeze the game using modern compilers.
|
// BUG: The function may return NULL, and attempting to read from NULL may freeze the game using modern compilers.
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
@ -2422,9 +2422,9 @@ u8 GetObjectEventBerryTreeId(u8 objectEventId)
|
|||||||
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
|
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
static const struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate *templates;
|
const struct ObjectEventTemplate *templates;
|
||||||
const struct MapHeader *mapHeader;
|
const struct MapHeader *mapHeader;
|
||||||
u8 count;
|
u8 count;
|
||||||
|
|
||||||
@ -2442,7 +2442,7 @@ static struct ObjectEventTemplate *GetObjectEventTemplateByLocalIdAndMap(u8 loca
|
|||||||
return FindObjectEventTemplateByLocalId(localId, templates, count);
|
return FindObjectEventTemplateByLocalId(localId, templates, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, struct ObjectEventTemplate *templates, u8 count)
|
static const struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, const struct ObjectEventTemplate *templates, u8 count)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ static s8 GetWarpEventAtMapPosition(struct MapHeader *, struct MapPosition *);
|
|||||||
static void SetupWarp(struct MapHeader *, s8, struct MapPosition *);
|
static void SetupWarp(struct MapHeader *, s8, struct MapPosition *);
|
||||||
static bool8 TryDoorWarp(struct MapPosition *, u16, u8);
|
static bool8 TryDoorWarp(struct MapPosition *, u16, u8);
|
||||||
static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8);
|
static s8 GetWarpEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||||
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
|
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *, u16, u16, u8);
|
||||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
|
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *, u16, u16, u8);
|
||||||
static bool8 TryStartCoordEventScript(struct MapPosition *);
|
static bool8 TryStartCoordEventScript(struct MapPosition *);
|
||||||
static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
|
static bool8 TryStartWarpEventScript(struct MapPosition *, u16);
|
||||||
static bool8 TryStartMiscWalkingScripts(u16);
|
static bool8 TryStartMiscWalkingScripts(u16);
|
||||||
@ -334,7 +334,7 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
|
|||||||
|
|
||||||
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
||||||
{
|
{
|
||||||
struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||||
|
|
||||||
if (bgEvent == NULL)
|
if (bgEvent == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -516,7 +516,7 @@ static bool8 TryStartStepBasedScript(struct MapPosition *position, u16 metatileB
|
|||||||
|
|
||||||
static bool8 TryStartCoordEventScript(struct MapPosition *position)
|
static bool8 TryStartCoordEventScript(struct MapPosition *position)
|
||||||
{
|
{
|
||||||
u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
const u8 *script = GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||||
|
|
||||||
if (script == NULL)
|
if (script == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -885,7 +885,7 @@ static bool8 TryDoorWarp(struct MapPosition *position, u16 metatileBehavior, u8
|
|||||||
static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
struct WarpEvent *warpEvent = mapHeader->events->warps;
|
const struct WarpEvent *warpEvent = mapHeader->events->warps;
|
||||||
u8 warpCount = mapHeader->events->warpCount;
|
u8 warpCount = mapHeader->events->warpCount;
|
||||||
|
|
||||||
for (i = 0; i < warpCount; i++, warpEvent++)
|
for (i = 0; i < warpCount; i++, warpEvent++)
|
||||||
@ -899,7 +899,7 @@ static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 e
|
|||||||
return WARP_ID_NONE;
|
return WARP_ID_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
|
static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
|
||||||
{
|
{
|
||||||
if (coordEvent != NULL)
|
if (coordEvent != NULL)
|
||||||
{
|
{
|
||||||
@ -919,10 +919,10 @@ static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
|
const struct CoordEvent *coordEvents = mapHeader->events->coordEvents;
|
||||||
u8 coordEventCount = mapHeader->events->coordEventCount;
|
u8 coordEventCount = mapHeader->events->coordEventCount;
|
||||||
|
|
||||||
for (i = 0; i < coordEventCount; i++)
|
for (i = 0; i < coordEventCount; i++)
|
||||||
@ -931,7 +931,7 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
|||||||
{
|
{
|
||||||
if (coordEvents[i].elevation == elevation || coordEvents[i].elevation == 0)
|
if (coordEvents[i].elevation == elevation || coordEvents[i].elevation == 0)
|
||||||
{
|
{
|
||||||
u8 *script = TryRunCoordEventScript(&coordEvents[i]);
|
const u8 *script = TryRunCoordEventScript(&coordEvents[i]);
|
||||||
if (script != NULL)
|
if (script != NULL)
|
||||||
return script;
|
return script;
|
||||||
}
|
}
|
||||||
@ -940,15 +940,15 @@ static u8 *GetCoordEventScriptAtPosition(struct MapHeader *mapHeader, u16 x, u16
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position)
|
||||||
{
|
{
|
||||||
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
return GetCoordEventScriptAtPosition(&gMapHeader, position->x - MAP_OFFSET, position->y - MAP_OFFSET, position->elevation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
static const struct BgEvent *GetBackgroundEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 elevation)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
struct BgEvent *bgEvents = mapHeader->events->bgEvents;
|
const struct BgEvent *bgEvents = mapHeader->events->bgEvents;
|
||||||
u8 bgEventCount = mapHeader->events->bgEventCount;
|
u8 bgEventCount = mapHeader->events->bgEventCount;
|
||||||
|
|
||||||
for (i = 0; i < bgEventCount; i++)
|
for (i = 0; i < bgEventCount; i++)
|
||||||
|
@ -36,7 +36,7 @@ struct BackupMapLayout gBackupMapLayout;
|
|||||||
static const struct ConnectionFlags sDummyConnectionFlags = {0};
|
static const struct ConnectionFlags sDummyConnectionFlags = {0};
|
||||||
|
|
||||||
static void InitMapLayoutData(struct MapHeader *mapHeader);
|
static void InitMapLayoutData(struct MapHeader *mapHeader);
|
||||||
static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height);
|
static void InitBackupMapLayoutData(const u16 *map, u16 width, u16 height);
|
||||||
static void FillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
static void FillSouthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||||
static void FillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
static void FillNorthConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||||
static void FillWestConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
static void FillWestConnection(struct MapHeader const *mapHeader, struct MapHeader const *connectedMapHeader, s32 offset);
|
||||||
@ -44,14 +44,14 @@ static void FillEastConnection(struct MapHeader const *mapHeader, struct MapHead
|
|||||||
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader);
|
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader);
|
||||||
static void LoadSavedMapView(void);
|
static void LoadSavedMapView(void);
|
||||||
static bool8 SkipCopyingMetatileFromSavedMap(u16 *mapBlock, u16 mapWidth, u8 yMode);
|
static bool8 SkipCopyingMetatileFromSavedMap(u16 *mapBlock, u16 mapWidth, u8 yMode);
|
||||||
static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y);
|
static const struct MapConnection *GetIncomingConnection(u8 direction, int x, int y);
|
||||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, struct MapConnection *connection);
|
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection);
|
||||||
static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
|
static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax, int offset);
|
||||||
|
|
||||||
#define GetBorderBlockAt(x, y)({ \
|
#define GetBorderBlockAt(x, y)({ \
|
||||||
u16 block; \
|
u16 block; \
|
||||||
int i; \
|
int i; \
|
||||||
u16 *border = gMapHeader.mapLayout->border; \
|
const u16 *border = gMapHeader.mapLayout->border; /* Unused, they read it again below */ \
|
||||||
\
|
\
|
||||||
i = (x + 1) & 1; \
|
i = (x + 1) & 1; \
|
||||||
i += ((y + 1) & 1) * 2; \
|
i += ((y + 1) & 1) * 2; \
|
||||||
@ -63,7 +63,7 @@ static bool8 IsCoordInIncomingConnectingMap(int coord, int srcMax, int destMax,
|
|||||||
|
|
||||||
#define GetMapGridBlockAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.width * y] : GetBorderBlockAt(x, y))
|
#define GetMapGridBlockAt(x, y) (AreCoordsWithinMapGridBounds(x, y) ? gBackupMapLayout.map[x + gBackupMapLayout.width * y] : GetBorderBlockAt(x, y))
|
||||||
|
|
||||||
struct MapHeader const *const GetMapHeaderFromConnection(struct MapConnection *connection)
|
const struct MapHeader *const GetMapHeaderFromConnection(const struct MapConnection *connection)
|
||||||
{
|
{
|
||||||
return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum);
|
return Overworld_GetMapHeaderByGroupAndId(connection->mapGroup, connection->mapNum);
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ static void InitMapLayoutData(struct MapHeader *mapHeader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height)
|
static void InitBackupMapLayoutData(const u16 *map, u16 width, u16 height)
|
||||||
{
|
{
|
||||||
u16 *dest;
|
u16 *dest;
|
||||||
int y;
|
int y;
|
||||||
@ -133,7 +133,7 @@ static void InitBackupMapLayoutData(u16 *map, u16 width, u16 height)
|
|||||||
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
|
static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
struct MapConnection *connection;
|
const struct MapConnection *connection;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (mapHeader->connections)
|
if (mapHeader->connections)
|
||||||
@ -171,7 +171,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
|
|||||||
static void FillConnection(int x, int y, struct MapHeader const *connectedMapHeader, int x2, int y2, int width, int height)
|
static void FillConnection(int x, int y, struct MapHeader const *connectedMapHeader, int x2, int y2, int width, int height)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u16 *src;
|
const u16 *src;
|
||||||
u16 *dest;
|
u16 *dest;
|
||||||
int mapWidth;
|
int mapWidth;
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ bool32 CanCameraMoveInDirection(int direction)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetPositionFromConnection(struct MapConnection *connection, int direction, int x, int y)
|
static void SetPositionFromConnection(const struct MapConnection *connection, int direction, int x, int y)
|
||||||
{
|
{
|
||||||
struct MapHeader const *mapHeader;
|
struct MapHeader const *mapHeader;
|
||||||
mapHeader = GetMapHeaderFromConnection(connection);
|
mapHeader = GetMapHeaderFromConnection(connection);
|
||||||
@ -647,7 +647,7 @@ static void SetPositionFromConnection(struct MapConnection *connection, int dire
|
|||||||
bool8 CameraMove(int x, int y)
|
bool8 CameraMove(int x, int y)
|
||||||
{
|
{
|
||||||
int direction;
|
int direction;
|
||||||
struct MapConnection *connection;
|
const struct MapConnection *connection;
|
||||||
int old_x, old_y;
|
int old_x, old_y;
|
||||||
gCamera.active = FALSE;
|
gCamera.active = FALSE;
|
||||||
direction = GetPostCameraMoveMapBorderId(x, y);
|
direction = GetPostCameraMoveMapBorderId(x, y);
|
||||||
@ -675,11 +675,11 @@ bool8 CameraMove(int x, int y)
|
|||||||
return gCamera.active;
|
return gCamera.active;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
static const struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
int i;
|
int i;
|
||||||
struct MapConnection *connection;
|
const struct MapConnection *connection;
|
||||||
const struct MapConnections *connections = gMapHeader.connections;
|
const struct MapConnections *connections = gMapHeader.connections;
|
||||||
|
|
||||||
#ifdef UBFIX // UB: Multiple possible null dereferences
|
#ifdef UBFIX // UB: Multiple possible null dereferences
|
||||||
@ -696,7 +696,7 @@ static struct MapConnection *GetIncomingConnection(u8 direction, int x, int y)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, struct MapConnection *connection)
|
static bool8 IsPosInIncomingConnectingMap(u8 direction, int x, int y, const struct MapConnection *connection)
|
||||||
{
|
{
|
||||||
struct MapHeader const *mapHeader;
|
struct MapHeader const *mapHeader;
|
||||||
mapHeader = GetMapHeaderFromConnection(connection);
|
mapHeader = GetMapHeaderFromConnection(connection);
|
||||||
@ -737,7 +737,7 @@ static int IsCoordInConnectingMap(int coord, int max)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y)
|
static int IsPosInConnectingMap(const struct MapConnection *connection, int x, int y)
|
||||||
{
|
{
|
||||||
struct MapHeader const *mapHeader;
|
struct MapHeader const *mapHeader;
|
||||||
mapHeader = GetMapHeaderFromConnection(connection);
|
mapHeader = GetMapHeaderFromConnection(connection);
|
||||||
@ -753,10 +753,10 @@ static int IsPosInConnectingMap(struct MapConnection *connection, int x, int y)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y)
|
const struct MapConnection *GetMapConnectionAtPos(s16 x, s16 y)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
struct MapConnection *connection;
|
const struct MapConnection *connection;
|
||||||
int i;
|
int i;
|
||||||
u8 direction;
|
u8 direction;
|
||||||
if (!gMapHeader.connections)
|
if (!gMapHeader.connections)
|
||||||
|
@ -380,7 +380,7 @@ static bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 ta
|
|||||||
static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x, s16 y)
|
static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
u8 bgEventCount = events->bgEventCount;
|
u8 bgEventCount = events->bgEventCount;
|
||||||
struct BgEvent *bgEvent = events->bgEvents;
|
const struct BgEvent *bgEvent = events->bgEvents;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < bgEventCount; i++)
|
for (i = 0; i < bgEventCount; i++)
|
||||||
@ -396,7 +396,7 @@ static bool8 IsHiddenItemPresentAtCoords(const struct MapEvents *events, s16 x,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 IsHiddenItemPresentInConnection(struct MapConnection *connection, int x, int y)
|
static bool8 IsHiddenItemPresentInConnection(const struct MapConnection *connection, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
u16 localX, localY;
|
u16 localX, localY;
|
||||||
@ -461,7 +461,7 @@ static void CheckForHiddenItemsInMapConnection(u8 taskId)
|
|||||||
|| var2 > y
|
|| var2 > y
|
||||||
|| y >= height)
|
|| y >= height)
|
||||||
{
|
{
|
||||||
struct MapConnection *conn = GetMapConnectionAtPos(x, y);
|
const struct MapConnection *conn = GetMapConnectionAtPos(x, y);
|
||||||
if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE)
|
if (conn && IsHiddenItemPresentInConnection(conn, x, y) == TRUE)
|
||||||
SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY);
|
SetDistanceOfClosestHiddenItem(taskId, x - playerX, y - playerY);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ static void SetupHipster(void)
|
|||||||
struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster;
|
struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster;
|
||||||
|
|
||||||
hipster->id = MAUVILLE_MAN_HIPSTER;
|
hipster->id = MAUVILLE_MAN_HIPSTER;
|
||||||
hipster->alreadySpoken = FALSE;
|
hipster->taughtWord = FALSE;
|
||||||
hipster->language = gGameLanguage;
|
hipster->language = gGameLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,27 +225,28 @@ void PlayBardSong(void)
|
|||||||
ScriptContext_Stop();
|
ScriptContext_Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetHipsterSpokenFlag(void)
|
void HasHipsterTaughtWord(void)
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = (&gSaveBlock1Ptr->oldMan.hipster)->alreadySpoken;
|
gSpecialVar_Result = (&gSaveBlock1Ptr->oldMan.hipster)->taughtWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetHipsterSpokenFlag(void)
|
void SetHipsterTaughtWord(void)
|
||||||
{
|
{
|
||||||
(&gSaveBlock1Ptr->oldMan.hipster)->alreadySpoken = TRUE;
|
(&gSaveBlock1Ptr->oldMan.hipster)->taughtWord = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HipsterTryTeachWord(void)
|
void HipsterTryTeachWord(void)
|
||||||
{
|
{
|
||||||
u16 phrase = GetNewHipsterPhraseToTeach();
|
u16 word = UnlockRandomTrendySaying();
|
||||||
|
|
||||||
if (phrase == EC_EMPTY_WORD)
|
if (word == EC_EMPTY_WORD)
|
||||||
{
|
{
|
||||||
|
// All words already unlocked
|
||||||
gSpecialVar_Result = FALSE;
|
gSpecialVar_Result = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CopyEasyChatWord(gStringVar1, phrase);
|
CopyEasyChatWord(gStringVar1, word);
|
||||||
gSpecialVar_Result = TRUE;
|
gSpecialVar_Result = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,7 +370,7 @@ static void ResetBardFlag(void)
|
|||||||
|
|
||||||
static void ResetHipsterFlag(void)
|
static void ResetHipsterFlag(void)
|
||||||
{
|
{
|
||||||
(&gSaveBlock1Ptr->oldMan.hipster)->alreadySpoken = FALSE;
|
(&gSaveBlock1Ptr->oldMan.hipster)->taughtWord = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetTraderFlag(void)
|
static void ResetTraderFlag(void)
|
||||||
|
@ -293,7 +293,7 @@ bool8 MEScrCmd_givenationaldex(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
|
bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
UnlockAdditionalPhrase(ScriptReadByte(ctx));
|
UnlockTrendySaying(ScriptReadByte(ctx));
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventRareWord);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventRareWord);
|
||||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -156,7 +156,7 @@ static void InitMenuBasedScript(const u8 *);
|
|||||||
static void LoadCableClubPlayer(s32, s32, struct CableClubPlayer *);
|
static void LoadCableClubPlayer(s32, s32, struct CableClubPlayer *);
|
||||||
static bool32 IsCableClubPlayerUnfrozen(struct CableClubPlayer *);
|
static bool32 IsCableClubPlayerUnfrozen(struct CableClubPlayer *);
|
||||||
static bool32 CanCableClubPlayerPressStart(struct CableClubPlayer *);
|
static bool32 CanCableClubPlayerPressStart(struct CableClubPlayer *);
|
||||||
static u8 *TryGetTileEventScript(struct CableClubPlayer *);
|
static const u8 *TryGetTileEventScript(struct CableClubPlayer *);
|
||||||
static bool32 PlayerIsAtSouthExit(struct CableClubPlayer *);
|
static bool32 PlayerIsAtSouthExit(struct CableClubPlayer *);
|
||||||
static const u8 *TryInteractWithPlayer(struct CableClubPlayer *);
|
static const u8 *TryInteractWithPlayer(struct CableClubPlayer *);
|
||||||
static u16 KeyInterCB_DeferToRecvQueue(u32);
|
static u16 KeyInterCB_DeferToRecvQueue(u32);
|
||||||
@ -487,7 +487,7 @@ void LoadObjEventTemplatesFromHeader(void)
|
|||||||
|
|
||||||
void LoadSaveblockObjEventScripts(void)
|
void LoadSaveblockObjEventScripts(void)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
const struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
||||||
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
@ -2719,7 +2719,7 @@ static bool32 CanCableClubPlayerPressStart(struct CableClubPlayer *player)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *TryGetTileEventScript(struct CableClubPlayer *player)
|
static const u8 *TryGetTileEventScript(struct CableClubPlayer *player)
|
||||||
{
|
{
|
||||||
if (player->movementMode != MOVEMENT_MODE_SCRIPTED)
|
if (player->movementMode != MOVEMENT_MODE_SCRIPTED)
|
||||||
return FACING_NONE;
|
return FACING_NONE;
|
||||||
|
@ -685,7 +685,8 @@ static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 floorWidth) // floo
|
|||||||
void GenerateTrainerHillFloorLayout(u16 *mapArg)
|
void GenerateTrainerHillFloorLayout(u16 *mapArg)
|
||||||
{
|
{
|
||||||
s32 y, x;
|
s32 y, x;
|
||||||
u16 *src, *dst;
|
const u16 *src;
|
||||||
|
u16 *dst;
|
||||||
u8 mapId = GetCurrentTrainerHillMapId();
|
u8 mapId = GetCurrentTrainerHillMapId();
|
||||||
|
|
||||||
if (mapId == TRAINER_HILL_ENTRANCE)
|
if (mapId == TRAINER_HILL_ENTRANCE)
|
||||||
|
Loading…
Reference in New Issue
Block a user