From 6566a49bebc877e742f8ee325dd659879afe63f3 Mon Sep 17 00:00:00 2001 From: Wyrserth Date: Sat, 23 Mar 2019 21:52:58 +0100 Subject: [PATCH 01/42] Use constants for naming screen's pages. --- include/naming_screen.h | 2 +- src/naming_screen.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/naming_screen.h b/include/naming_screen.h index b04cb19b6..611f53ef2 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -59,9 +59,9 @@ struct NamingScreenData { enum { + PAGE_OTHERS, PAGE_UPPER, PAGE_LOWER, - PAGE_OTHERS, }; enum diff --git a/src/naming_screen.c b/src/naming_screen.c index 75b7c8566..d37144122 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -449,7 +449,7 @@ static u8 sub_80E3274(void) static bool8 MainState_BeginFadeIn(void) { sub_80E4CF8(3, gUnknown_08DD4544); - gNamingScreenData->currentPage = 1; + gNamingScreenData->currentPage = PAGE_UPPER; sub_80E4CF8(2, gUnknown_08DD46E0); sub_80E4CF8(1, gUnknown_08DD4620); sub_80E4DE4(gNamingScreenData->windows[1], 0); @@ -1856,7 +1856,7 @@ static const struct NamingScreenTemplate playerNamingScreenTemplate = .maxChars = 7, .iconFunction = 1, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 35, .title = gText_YourName, }; @@ -1867,7 +1867,7 @@ static const struct NamingScreenTemplate pcBoxNamingTemplate = .maxChars = 8, .iconFunction = 2, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 19, .title = gText_BoxName, }; @@ -1878,7 +1878,7 @@ static const struct NamingScreenTemplate monNamingScreenTemplate = .maxChars = 10, .iconFunction = 3, .addGenderIcon = 1, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 35, .title = gText_PkmnsNickname, }; @@ -1889,7 +1889,7 @@ static const struct NamingScreenTemplate wandaWordsScreenTemplate = .maxChars = 15, .iconFunction = 4, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 11, .title = gText_TellHimTheWords, }; From d13563b174119121964c2da62380bce44743b93f Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 14:09:40 -0500 Subject: [PATCH 02/42] Document some faraway_island code --- common_syms/faraway_island.txt | 3 + include/faraway_island.h | 2 +- src/event_object_movement.c | 4 +- src/faraway_island.c | 131 +++++++++++++++++---------------- sym_bss.txt | 9 +-- sym_ewram.txt | 5 +- 6 files changed, 74 insertions(+), 80 deletions(-) create mode 100755 common_syms/faraway_island.txt diff --git a/common_syms/faraway_island.txt b/common_syms/faraway_island.txt new file mode 100755 index 000000000..395c9a82f --- /dev/null +++ b/common_syms/faraway_island.txt @@ -0,0 +1,3 @@ +sPlayerToMewDeltaX +sPlayerToMewDeltaY +sMewDirectionCandidates \ No newline at end of file diff --git a/include/faraway_island.h b/include/faraway_island.h index 89b4bcd08..4946bda8a 100755 --- a/include/faraway_island.h +++ b/include/faraway_island.h @@ -1,7 +1,7 @@ #ifndef GUARD_FARAWAY_ISLAND_H #define GUARD_FARAWAY_ISLAND_H -u32 sub_81D427C(void); +u32 GetMewMoveDirection(void); bool8 sub_81D4A58(struct EventObject*); void UpdateFarawayIslandStepCounter(void); bool8 EventObjectIsFarawayIslandMew(struct EventObject *); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 30dffd8d7..6a3527bc1 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4414,8 +4414,8 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct EventObject *eventObject, struct Sp direction = playerDirection; if (EventObjectIsFarawayIslandMew(eventObject)) { - direction = sub_81D427C(); - if (direction == 0) + direction = GetMewMoveDirection(); + if (direction == DIR_NONE) { direction = playerDirection; direction = state_to_direction(gInitialMovementTypeFacingDirections[eventObject->movementType], eventObject->directionSequenceIndex, direction); diff --git a/src/faraway_island.c b/src/faraway_island.c index 1c8dff14e..6a835a02b 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -17,12 +17,13 @@ static u8 sub_81D4C9C(struct EventObject*, u8); static u8 sub_81D4C58(struct EventObject*, u8); static u8 sub_81D4CE0(struct EventObject*, u8); static u8 sub_81D4D24(u8); -static bool8 sub_81D4834(s16, s16); +static bool8 CanMewWalkToCoords(s16, s16); -extern u8 gUnknown_0203CF50; -extern s16 gUnknown_030012F8; -extern s16 gUnknown_030012FA; -extern u8 gUnknown_030012FC[4]; +static EWRAM_DATA u8 sUnknown_0203CF50 = 0; + +static s16 sPlayerToMewDeltaX; +static s16 sPlayerToMewDeltaY; +static u8 sMewDirectionCandidates[4]; extern const struct SpritePalette gFieldEffectObjectPaletteInfo1; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; @@ -35,23 +36,23 @@ static const s16 sFarawayIslandRockCoords[4][2] = {20, 20}, }; -static u8 sub_81D4258(void) +static u8 GetMewEventObjectId(void) { u8 eventObjectId; TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId); return eventObjectId; } -u32 sub_81D427C(void) +u32 GetMewMoveDirection(void) { u8 i; int skip; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; - gUnknown_030012F8 = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x; - gUnknown_030012FA = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y; - for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) - gUnknown_030012FC[i] = DIR_NONE; + sPlayerToMewDeltaX = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x; + sPlayerToMewDeltaY = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y; + for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++) + sMewDirectionCandidates[i] = DIR_NONE; if (gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x && gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y) @@ -85,33 +86,33 @@ u32 sub_81D427C(void) if (!skip) { - if (gUnknown_030012F8 > 0) + if (sPlayerToMewDeltaX > 0) { if (mew->currentCoords.x + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } } - else if (gUnknown_030012F8 < 0) + else if (sPlayerToMewDeltaX < 0) { if (mew->currentCoords.x - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } } if (mew->currentCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (gUnknown_030012FA > 0) + if (sPlayerToMewDeltaY > 0) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } else { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } } @@ -134,33 +135,33 @@ u32 sub_81D427C(void) if (!skip) { - if (gUnknown_030012FA > 0) + if (sPlayerToMewDeltaY > 0) { if (mew->currentCoords.y + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } } - else if (gUnknown_030012FA < 0) + else if (sPlayerToMewDeltaY < 0) { if (mew->currentCoords.y - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } } if (mew->currentCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (gUnknown_030012F8 > 0) + if (sPlayerToMewDeltaX > 0) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } else { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } } @@ -208,52 +209,52 @@ u32 sub_81D427C(void) return DIR_WEST; } - if (gUnknown_030012FA == 0) + if (sPlayerToMewDeltaY == 0) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y > mew->currentCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y < mew->currentCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } - if (gUnknown_030012F8 == 0) + if (sPlayerToMewDeltaX == 0) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x > mew->currentCoords.x) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x < mew->currentCoords.x) { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } return sub_81D4890(DIR_NONE); } -static bool8 sub_81D4834(s16 x, s16 y) +static bool8 CanMewWalkToCoords(s16 x, s16 y) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x == x && gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y == y) @@ -268,39 +269,39 @@ static u8 sub_81D4890(u8 ignoredDir) { u8 i; u8 count = 0; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; - for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) - gUnknown_030012FC[i] = DIR_NONE; + for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++) + sMewDirectionCandidates[i] = DIR_NONE; - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH) { - gUnknown_030012FC[count] = DIR_NORTH; + sMewDirectionCandidates[count] = DIR_NORTH; count++; } - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST) { - gUnknown_030012FC[count] = DIR_EAST; + sMewDirectionCandidates[count] = DIR_EAST; count++; } - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH) { - gUnknown_030012FC[count] = DIR_SOUTH; + sMewDirectionCandidates[count] = DIR_SOUTH; count++; } - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST) { - gUnknown_030012FC[count] = DIR_WEST; + sMewDirectionCandidates[count] = DIR_WEST; count++; } if (count > 1) - return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count]; + return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count]; else - return gUnknown_030012FC[0]; + return sMewDirectionCandidates[0]; } void UpdateFarawayIslandStepCounter(void) @@ -355,7 +356,7 @@ void sub_81D4A90(void) s16 x; s16 y; u8 spriteId; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; mew->invisible = 0; if (gSpecialVar_0x8004 == 1) @@ -378,10 +379,10 @@ void sub_81D4A90(void) x = mew->currentCoords.x; y = mew->currentCoords.y; sub_80930E0(&x, &y, 8, 8); - gUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); - if (gUnknown_0203CF50 != MAX_SPRITES) + sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); + if (sUnknown_0203CF50 != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[gUnknown_0203CF50]; + struct Sprite *sprite = &gSprites[sUnknown_0203CF50]; sprite->coordOffsetEnabled = 1; sprite->oam.priority = 2; sprite->callback = SpriteCallbackDummy; @@ -391,15 +392,15 @@ void sub_81D4A90(void) void sub_81D4BEC(void) { - if (gUnknown_0203CF50 != MAX_SPRITES) - DestroySprite(&gSprites[gUnknown_0203CF50]); + if (sUnknown_0203CF50 != MAX_SPRITES) + DestroySprite(&gSprites[sUnknown_0203CF50]); } static bool8 sub_81D4C14(struct EventObject *mew, u8 index) { - if (gUnknown_030012FA > 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (sPlayerToMewDeltaY > 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) { - gUnknown_030012FC[index] = DIR_NORTH; + sMewDirectionCandidates[index] = DIR_NORTH; return TRUE; } @@ -408,9 +409,9 @@ static bool8 sub_81D4C14(struct EventObject *mew, u8 index) static u8 sub_81D4C58(struct EventObject *mew, u8 index) { - if (gUnknown_030012F8 < 0 && sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (sPlayerToMewDeltaX < 0 && CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) { - gUnknown_030012FC[index] = DIR_EAST; + sMewDirectionCandidates[index] = DIR_EAST; return TRUE; } @@ -419,9 +420,9 @@ static u8 sub_81D4C58(struct EventObject *mew, u8 index) static u8 sub_81D4C9C(struct EventObject *mew, u8 index) { - if (gUnknown_030012FA < 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (sPlayerToMewDeltaY < 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) { - gUnknown_030012FC[index] = DIR_SOUTH; + sMewDirectionCandidates[index] = DIR_SOUTH; return TRUE; } @@ -430,9 +431,9 @@ static u8 sub_81D4C9C(struct EventObject *mew, u8 index) static u8 sub_81D4CE0(struct EventObject *mew, u8 index) { - if (gUnknown_030012F8 > 0 && sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (sPlayerToMewDeltaX > 0 && CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) { - gUnknown_030012FC[index] = DIR_WEST; + sMewDirectionCandidates[index] = DIR_WEST; return TRUE; } @@ -441,5 +442,5 @@ static u8 sub_81D4CE0(struct EventObject *mew, u8 index) static u8 sub_81D4D24(u8 mod) { - return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod]; + return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod]; } diff --git a/sym_bss.txt b/sym_bss.txt index 1eef0130b..25ca7c625 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -88,14 +88,7 @@ gUnknown_030012F2: @ 30012F2 gUnknown_030012F4: @ 30012F4 .space 0x4 -gUnknown_030012F8: @ 30012F8 - .space 0x2 - -gUnknown_030012FA: @ 30012FA - .space 0x2 - -gUnknown_030012FC: @ 30012FC - .space 0x4 + .include "src/faraway_island.o" gUnknown_03001300: @ 3001300 .space 0x40 diff --git a/sym_ewram.txt b/sym_ewram.txt index 6878e1bd1..50235ee72 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -214,9 +214,6 @@ gUnknown_0203CF44: @ 203CF44 .space 0x4 .include "src/menu_specialized.o" - -gUnknown_0203CF50: @ 203CF50 - .space 0x4 - + .include "src/faraway_island.o" .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" From 099ea89b77fdde1a6b31c7ef3e1975e57a175dd9 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 21:07:29 -0500 Subject: [PATCH 03/42] Document rain weather effect --- include/field_weather.h | 14 +- src/braille_puzzles.c | 72 ++-- src/field_weather.c | 5 +- src/field_weather_effect.c | 829 +++++++++++++++++++------------------ 4 files changed, 478 insertions(+), 442 deletions(-) diff --git a/include/field_weather.h b/include/field_weather.h index 76399200d..38fba68f1 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,6 +3,8 @@ #include "sprite.h" +#define MAX_RAIN_SPRITES 24 + // Controls how the weather should be changing the screen palettes. enum { @@ -27,7 +29,7 @@ struct Weather { struct { - struct Sprite *rainSprites[24]; + struct Sprite *rainSprites[MAX_RAIN_SPRITES]; struct Sprite *snowflakeSprites[101]; struct Sprite *cloudSprites[3]; } s1; @@ -62,12 +64,12 @@ struct Weather bool8 weatherChangeComplete; u8 weatherPicSpritePalIndex; u8 altGammaSpritePalIndex; - u16 unknown_6D6; - u8 unknown_6D8; - u8 unknown_6D9; + u16 rainSpriteVisibleCounter; + u8 curRainSpriteIndex; + u8 maxRainSprites; u8 rainSpriteCount; - u8 unknown_6DB; - u8 unknown_6DC; + u8 rainSpriteVisibleDelay; + u8 isHeavyRain; u8 rainStrength; /*0x6DE*/ u8 cloudSpritesCreated; u8 filler_6DF[1]; diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 07b941f11..659f8682e 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -25,42 +25,42 @@ EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; static const u8 gRegicePathCoords[][2] = { - {0x04, 0x15}, - {0x05, 0x15}, - {0x06, 0x15}, - {0x07, 0x15}, - {0x08, 0x15}, - {0x09, 0x15}, - {0x0a, 0x15}, - {0x0b, 0x15}, - {0x0c, 0x15}, - {0x0c, 0x16}, - {0x0c, 0x17}, - {0x0d, 0x17}, - {0x0d, 0x18}, - {0x0d, 0x19}, - {0x0d, 0x1a}, - {0x0d, 0x1b}, - {0x0c, 0x1b}, - {0x0c, 0x1c}, - {0x04, 0x1d}, - {0x05, 0x1d}, - {0x06, 0x1d}, - {0x07, 0x1d}, - {0x08, 0x1d}, - {0x09, 0x1d}, - {0x0a, 0x1d}, - {0x0b, 0x1d}, - {0x0c, 0x1d}, - {0x04, 0x1c}, - {0x04, 0x1b}, - {0x03, 0x1b}, - {0x03, 0x1a}, - {0x03, 0x19}, - {0x03, 0x18}, - {0x03, 0x17}, - {0x04, 0x17}, - {0x04, 0x16}, + {4, 21}, + {5, 21}, + {6, 21}, + {7, 21}, + {8, 21}, + {9, 21}, + {10, 21}, + {11, 21}, + {12, 21}, + {12, 22}, + {12, 23}, + {13, 23}, + {13, 24}, + {13, 25}, + {13, 26}, + {13, 27}, + {12, 27}, + {12, 28}, + {4, 29}, + {5, 29}, + {6, 29}, + {7, 29}, + {8, 29}, + {9, 29}, + {10, 29}, + {11, 29}, + {12, 29}, + {4, 28}, + {4, 27}, + {3, 27}, + {3, 26}, + {3, 25}, + {3, 24}, + {3, 23}, + {4, 23}, + {4, 22}, }; void SealedChamberShakingEffect(u8); diff --git a/src/field_weather.c b/src/field_weather.c index 9913e9a61..a2c40052b 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -167,7 +167,7 @@ void StartWeather(void) gWeatherPtr->altGammaSpritePalIndex = index; gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201); gWeatherPtr->rainSpriteCount = 0; - gWeatherPtr->unknown_6D8 = 0; + gWeatherPtr->curRainSpriteIndex = 0; gWeatherPtr->cloudSpritesCreated = 0; gWeatherPtr->snowflakeSpriteCount = 0; gWeatherPtr->ashSpritesCreated = 0; @@ -234,7 +234,8 @@ static void Task_WeatherMain(u8 taskId) { if (gWeatherPtr->currWeather != gWeatherPtr->nextWeather) { - if (!sWeatherFuncs[gWeatherPtr->currWeather].finish() && gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) + if (!sWeatherFuncs[gWeatherPtr->currWeather].finish() + && gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) { // Finished cleaning up previous weather. Now transition to next weather. sWeatherFuncs[gWeatherPtr->nextWeather].initVars(); diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 6ec83f1a0..95f80d061 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -12,9 +12,6 @@ #include "trig.h" #include "gpu_regs.h" -// This file's functions. -void sub_80AC6B4(struct Sprite *); - // EWRAM EWRAM_DATA static u8 gCurrentAlternatingWeather = 0; EWRAM_DATA static u16 gUnusedWeatherRelated = 0; @@ -32,6 +29,12 @@ const u8 gWeatherAshTiles[] = INCBIN_U8("graphics/weather/ash.4bpp"); const u8 gWeatherRainTiles[] = INCBIN_U8("graphics/weather/rain.4bpp"); const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp"); +//------------------------------------------------------------------------------ +// Clouds +//------------------------------------------------------------------------------ + +static void sub_80AC6B4(struct Sprite *); + static const struct Coords16 gUnknown_0854FB50[] = { { 0, 66}, @@ -39,7 +42,12 @@ static const struct Coords16 gUnknown_0854FB50[] = {10, 78}, }; -static const struct SpriteSheet sCloudSpriteSheet = {gWeatherCloudTiles, sizeof(gWeatherCloudTiles), 0x1200}; +static const struct SpriteSheet sCloudSpriteSheet = +{ + .data = gWeatherCloudTiles, + .size = sizeof(gWeatherCloudTiles), + .tag = 0x1200 +}; static const struct OamData gOamData_839A9DC = { @@ -80,10 +88,6 @@ static const struct SpriteTemplate sCloudSpriteTemplate = .callback = sub_80AC6B4, }; -//------------------------------------------------------------------------------ -// Clouds -//------------------------------------------------------------------------------ - void Clouds_InitVars(void) { gWeatherPtr->gammaTargetIndex = 0; @@ -214,7 +218,7 @@ void sub_807E0A0(void) gWeatherPtr->cloudSpritesCreated = FALSE; } -void sub_80AC6B4(struct Sprite *sprite) +static void sub_80AC6B4(struct Sprite *sprite) { sprite->data[0] = (sprite->data[0] + 1) & 1; if (sprite->data[0] != 0) @@ -350,197 +354,11 @@ void task50_0807B6D4(u8 taskId) // Light Rain //------------------------------------------------------------------------------ -void LightRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 8; - gWeatherPtr->unknown_6DC = 0; - gWeatherPtr->unknown_6D9 = 10; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - SetRainStrengthFromSoundEffect(SE_T_KOAME); -} - -void LightRain_InitAll(void) -{ - LightRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - LightRain_Main(); -} - -void LoadRainSpriteSheet(void); -u8 CreateRainSprite(void); -u8 sub_807E8E8(void); - -void LightRain_Main(void) -{ - switch (gWeatherPtr->initStep) - { - case 0: - LoadRainSpriteSheet(); - gWeatherPtr->initStep++; - break; - case 1: - if (CreateRainSprite() == 0) - gWeatherPtr->initStep++; - break; - case 2: - if (sub_807E8E8() == FALSE) - { - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - } - break; - } -} - -void DestroyRainSprites(void); - -bool8 LightRain_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT - || gWeatherPtr->nextWeather == WEATHER_RAIN_MED - || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) - { - gWeatherPtr->finishStep = 0xFF; - return FALSE; - } - else - { - gWeatherPtr->unknown_6D9 = 0; - gWeatherPtr->finishStep++; - } - // fall through - case 1: - if (sub_807E8E8() == FALSE) - { - DestroyRainSprites(); - gWeatherPtr->finishStep++; - return FALSE; - } - return TRUE; - } - return FALSE; -} - -// defined below -extern const s16 gUnknown_0839AABC[][2]; -extern const u16 gUnknown_0839AAC4[][2]; - -void sub_807E4EC(struct Sprite *sprite) -{ - u32 randVal; - u16 r6; - s32 r4; - s32 r0; - - if (sprite->data[1] == 0) - sprite->data[1] = 361; - randVal = sprite->data[1] * 1103515245 + 12345; - sprite->data[1] = ((randVal & 0x7FFF0000) >> 16) % 600; - - r6 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; - - r4 = sprite->data[1] % 30; - sprite->data[2] = r4 * 8; // useless assignment - - r0 = sprite->data[1] / 30; - sprite->data[3] = r0 * 8; // useless assignment - - sprite->data[2] = r4; - sprite->data[2] <<= 7; - - sprite->data[3] = r0; - sprite->data[3] <<= 7; - - sprite->data[2] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0] * r6; - sprite->data[3] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1] * r6; - - StartSpriteAnim(sprite, 0); - sprite->data[4] = 0; - sprite->coordOffsetEnabled = FALSE; - sprite->data[0] = r6; -} - -void sub_807E5C0(struct Sprite *sprite) -{ - if (sprite->data[4] == 0) - { - sprite->data[2] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0]; - sprite->data[3] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1]; - sprite->pos1.x = sprite->data[2] >> 4; - sprite->pos1.y = sprite->data[3] >> 4; - - if (sprite->data[5] != 0 - && (sprite->pos1.x >= -8 && sprite->pos1.x <= 248) - && sprite->pos1.y >= -16 && sprite->pos1.y <= 176) - sprite->invisible = FALSE; - else - sprite->invisible = TRUE; - - sprite->data[0]--; - if (sprite->data[0] == 0) - { - StartSpriteAnim(sprite, gWeatherPtr->unknown_6DC + 1); - sprite->data[4] = 1; - sprite->pos1.x -= gSpriteCoordOffsetX; - sprite->pos1.y -= gSpriteCoordOffsetY; - sprite->coordOffsetEnabled = TRUE; - } - } - else if (sprite->animEnded) - { - sprite->invisible = TRUE; - sub_807E4EC(sprite); - } -} - -void sub_807E6C4(struct Sprite *sprite) -{ - if (sprite->data[0] == 0) - { - sub_807E4EC(sprite); - sprite->callback = sub_807E5C0; - } - else - { - sprite->data[0]--; - } -} - -void sub_807E6F0(struct Sprite *sprite, u16 b) -{ - u16 r8 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; - u16 r6 = b / (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); - u16 r4 = b % (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); - - while (--r6 != 0xFFFF) - sub_807E4EC(sprite); - if (r4 < r8) - { - while (--r4 != 0xFFFF) - sub_807E5C0(sprite); - sprite->data[6] = 0; - } - else - { - sprite->data[0] = r4 - r8; - sprite->invisible = TRUE; - sprite->data[6] = 1; - } -} - -extern const struct SpriteSheet sRainSpriteSheet; // defined below - -void LoadRainSpriteSheet(void) -{ - LoadSpriteSheet(&sRainSpriteSheet); -} +static void LoadRainSpriteSheet(void); +static bool8 CreateRainSprite(void); +static void UpdateRainSprite(struct Sprite *sprite); +static bool8 UpdateVisibleRainSprites(void); +static void DestroyRainSprites(void); static const struct Coords16 sRainSpriteCoords[] = { @@ -570,7 +388,7 @@ static const struct Coords16 sRainSpriteCoords[] = { 48, 96}, }; -static const struct OamData gOamData_839AA68 = +static const struct OamData sRainSpriteOamData = { .y = 0, .affineMode = 0, @@ -587,13 +405,13 @@ static const struct OamData gOamData_839AA68 = .affineParam = 0, }; -static const union AnimCmd gSpriteAnim_839AA70[] = +static const union AnimCmd sRainSpriteFallAnimCmd[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_JUMP(0), }; -static const union AnimCmd gSpriteAnim_839AA78[] = +static const union AnimCmd sRainSpriteSplashAnimCmd[] = { ANIMCMD_FRAME(8, 3), ANIMCMD_FRAME(32, 2), @@ -601,7 +419,7 @@ static const union AnimCmd gSpriteAnim_839AA78[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_839AA88[] = +static const union AnimCmd sRainSpriteHeavySplashAnimCmd[] = { ANIMCMD_FRAME(8, 3), ANIMCMD_FRAME(16, 3), @@ -609,37 +427,418 @@ static const union AnimCmd gSpriteAnim_839AA88[] = ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839AA98[] = +static const union AnimCmd *const sRainSpriteAnimCmds[] = { - gSpriteAnim_839AA70, - gSpriteAnim_839AA78, - gSpriteAnim_839AA88, + sRainSpriteFallAnimCmd, + sRainSpriteSplashAnimCmd, + sRainSpriteHeavySplashAnimCmd, }; static const struct SpriteTemplate sRainSpriteTemplate = { .tileTag = 4614, .paletteTag = 4608, - .oam = &gOamData_839AA68, - .anims = gSpriteAnimTable_839AA98, + .oam = &sRainSpriteOamData, + .anims = sRainSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807E5C0, + .callback = UpdateRainSprite, }; -const s16 gUnknown_0839AABC[][2] = +// Q28.4 fixed-point format values +static const s16 sRainSpriteMovement[][2] = { - {-104, 208}, - {-160, 320}, + {-0x68, 0xD0}, + {-0xA0, 0x140}, }; -const u16 gUnknown_0839AAC4[][2] = +// First byte is the number of frames a raindrop falls before it splashes. +// Second byte is the maximum number of frames a raindrop can "wait" before +// it appears and starts falling. (This is only for the initial raindrop spawn.) +static const u16 sRainSpriteFallingDurations[][2] = { {18, 7}, {12, 10}, }; -static const struct SpriteSheet sRainSpriteSheet = {gWeatherRainTiles, sizeof(gWeatherRainTiles), 0x1206}; +static const struct SpriteSheet sRainSpriteSheet = +{ + .data = gWeatherRainTiles, + .size = sizeof(gWeatherRainTiles), + .tag = 0x1206, +}; + +void LightRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 8; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->maxRainSprites = 10; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + SetRainStrengthFromSoundEffect(SE_T_KOAME); +} + +void LightRain_InitAll(void) +{ + LightRain_InitVars(); + while (!gWeatherPtr->weatherGfxLoaded) + LightRain_Main(); +} + +void LightRain_Main(void) +{ + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (!CreateRainSprite()) + gWeatherPtr->initStep++; + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + } +} + +bool8 LightRain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + { + gWeatherPtr->finishStep = 0xFF; + return FALSE; + } + else + { + gWeatherPtr->maxRainSprites = 0; + gWeatherPtr->finishStep++; + } + // fall through + case 1: + if (!UpdateVisibleRainSprites()) + { + DestroyRainSprites(); + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +#define tCounter data[0] +#define tRandom data[1] +#define tPosX data[2] +#define tPosY data[3] +#define tState data[4] +#define tActive data[5] +#define tWaiting data[6] + +static void StartRainSpriteFall(struct Sprite *sprite) +{ + u32 rand; + u16 numFallingFrames; + int tileX; + int tileY; + + if (sprite->tRandom == 0) + sprite->tRandom = 361; + + // Standard RNG sequence. + rand = sprite->tRandom * 1103515245 + 12345; + sprite->tRandom = ((rand & 0x7FFF0000) >> 16) % 600; + + numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0]; + + tileX = sprite->tRandom % 30; + sprite->tPosX = tileX * 8; // Useless assignment, leftover from before fixed-point values were used + + tileY = sprite->tRandom / 30; + sprite->tPosY = tileY * 8; // Useless assignment, leftover from before fixed-point values were used + + sprite->tPosX = tileX; + sprite->tPosX <<= 7; // This is tileX * 8, using a fixed-point value with 4 decimal places + + sprite->tPosY = tileY; + sprite->tPosY <<= 7; // This is tileX * 8, using a fixed-point value with 4 decimal places + + // "Rewind" the rain sprites, from their ending position. + sprite->tPosX -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][0] * numFallingFrames; + sprite->tPosY -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][1] * numFallingFrames; + + StartSpriteAnim(sprite, 0); + sprite->tState = 0; + sprite->coordOffsetEnabled = FALSE; + sprite->tCounter = numFallingFrames; +} + +static void UpdateRainSprite(struct Sprite *sprite) +{ + if (sprite->tState == 0) + { + // Raindrop is in its "falling" motion. + sprite->tPosX += sRainSpriteMovement[gWeatherPtr->isHeavyRain][0]; + sprite->tPosY += sRainSpriteMovement[gWeatherPtr->isHeavyRain][1]; + sprite->pos1.x = sprite->tPosX >> 4; + sprite->pos1.y = sprite->tPosY >> 4; + + if (sprite->tActive + && (sprite->pos1.x >= -8 && sprite->pos1.x <= 248) + && sprite->pos1.y >= -16 && sprite->pos1.y <= 176) + sprite->invisible = FALSE; + else + sprite->invisible = TRUE; + + if (--sprite->tCounter == 0) + { + // Make raindrop splash on the ground + StartSpriteAnim(sprite, gWeatherPtr->isHeavyRain + 1); + sprite->tState = 1; + sprite->pos1.x -= gSpriteCoordOffsetX; + sprite->pos1.y -= gSpriteCoordOffsetY; + sprite->coordOffsetEnabled = TRUE; + } + } + else if (sprite->animEnded) + { + // The splashing animation ended. + sprite->invisible = TRUE; + StartRainSpriteFall(sprite); + } +} + +static void WaitRainSprite(struct Sprite *sprite) +{ + if (sprite->tCounter == 0) + { + StartRainSpriteFall(sprite); + sprite->callback = UpdateRainSprite; + } + else + { + sprite->tCounter--; + } +} + +static void InitRainSpriteMovement(struct Sprite *sprite, u16 val) +{ + u16 numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0]; + u16 numAdvanceRng = val / (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames); + u16 frameVal = val % (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames); + + while (--numAdvanceRng != 0xFFFF) + StartRainSpriteFall(sprite); + + if (frameVal < numFallingFrames) + { + while (--frameVal != 0xFFFF) + UpdateRainSprite(sprite); + + sprite->tWaiting = 0; + } + else + { + sprite->tCounter = frameVal - numFallingFrames; + sprite->invisible = TRUE; + sprite->tWaiting = 1; + } +} + +static void LoadRainSpriteSheet(void) +{ + LoadSpriteSheet(&sRainSpriteSheet); +} + +static bool8 CreateRainSprite(void) +{ + u8 spriteIndex; + u8 spriteId; + + if (gWeatherPtr->rainSpriteCount == MAX_RAIN_SPRITES) + return FALSE; + + spriteIndex = gWeatherPtr->rainSpriteCount; + spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, + sRainSpriteCoords[spriteIndex].x, sRainSpriteCoords[spriteIndex].y, 78); + + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].tActive = 0; + gSprites[spriteId].tRandom = spriteIndex * 145; + while (gSprites[spriteId].tRandom >= 600) + gSprites[spriteId].tRandom -= 600; + + StartRainSpriteFall(&gSprites[spriteId]); + InitRainSpriteMovement(&gSprites[spriteId], spriteIndex * 9); + gSprites[spriteId].invisible = TRUE; + gWeatherPtr->sprites.s1.rainSprites[spriteIndex] = &gSprites[spriteId]; + } + else + { + gWeatherPtr->sprites.s1.rainSprites[spriteIndex] = NULL; + } + + if (++gWeatherPtr->rainSpriteCount == MAX_RAIN_SPRITES) + { + u16 i; + for (i = 0; i < MAX_RAIN_SPRITES; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i]) + { + if (!gWeatherPtr->sprites.s1.rainSprites[i]->tWaiting) + gWeatherPtr->sprites.s1.rainSprites[i]->callback = UpdateRainSprite; + else + gWeatherPtr->sprites.s1.rainSprites[i]->callback = WaitRainSprite; + } + } + + return FALSE; + } + + return TRUE; +} + +static bool8 UpdateVisibleRainSprites(void) +{ + if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->maxRainSprites) + return FALSE; + + if (++gWeatherPtr->rainSpriteVisibleCounter > gWeatherPtr->rainSpriteVisibleDelay) + { + gWeatherPtr->rainSpriteVisibleCounter = 0; + if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->maxRainSprites) + { + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex++]->tActive = 1; + } + else + { + gWeatherPtr->curRainSpriteIndex--; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex]->tActive = 0; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex]->invisible = TRUE; + } + } + return TRUE; +} + +static void DestroyRainSprites(void) +{ + u16 i; + + for (i = 0; i < gWeatherPtr->rainSpriteCount; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s1.rainSprites[i]); + } + gWeatherPtr->rainSpriteCount = 0; + FreeSpriteTilesByTag(0x1206); +} + +#undef tCounter +#undef tRandom +#undef tPosX +#undef tPosY +#undef tState +#undef tActive +#undef tWaiting + +//------------------------------------------------------------------------------ +// Snow +//------------------------------------------------------------------------------ + +void Snow_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->unknown_6E5 = 16; + gWeatherPtr->unknown_6E0 = 0; +} + +void Snow_Main(void); +void sub_807ED48(struct Sprite *); + +void Snow_InitAll(void) +{ + Snow_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + { + u16 i; + + Snow_Main(); + for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) + { + sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); + } + } +} + +u8 snowflakes_progress(void); + +void Snow_Main(void) +{ + if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } +} + +bool8 Snow_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6E5 = 0; + gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + if (snowflakes_progress() == FALSE) + { + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +bool8 CreateSnowflakeSprite(void); +bool8 RemoveSnowflakeSprite(void); + +bool8 snowflakes_progress(void) +{ + if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) + return FALSE; + + gWeatherPtr->unknown_6E0++; + if (gWeatherPtr->unknown_6E0 > 36) + { + gWeatherPtr->unknown_6E0 = 0; + if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) + CreateSnowflakeSprite(); + else + RemoveSnowflakeSprite(); + } + return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); +} + +void sub_807EC40(struct Sprite *); static const struct OamData gOamData_839AAD4 = { @@ -783,172 +982,6 @@ static const struct SpriteTemplate sFog1SpriteTemplate = .callback = Fog1SpriteCallback, }; -bool8 CreateRainSprite(void) -{ - u8 spriteNum; - u8 spriteId; - - if (gWeatherPtr->rainSpriteCount == 24) - return FALSE; - - spriteNum = gWeatherPtr->rainSpriteCount; - spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, - sRainSpriteCoords[spriteNum].x, sRainSpriteCoords[spriteNum].y, 78); - if (spriteId != MAX_SPRITES) - { - gSprites[spriteId].data[5] = 0; - gSprites[spriteId].data[1] = spriteNum * 145; - while (gSprites[spriteId].data[1] >= 600) - gSprites[spriteId].data[1] -= 600; - sub_807E4EC(&gSprites[spriteId]); - sub_807E6F0(&gSprites[spriteId], spriteNum * 9); - gSprites[spriteId].invisible = TRUE; - gWeatherPtr->sprites.s1.rainSprites[spriteNum] = &gSprites[spriteId]; - } - else - { - gWeatherPtr->sprites.s1.rainSprites[spriteNum] = NULL; - } - - if (++gWeatherPtr->rainSpriteCount == 24) - { - u16 i; - - for (i = 0; i < 24; i++) - { - if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) - { - if (gWeatherPtr->sprites.s1.rainSprites[i]->data[6] == 0) - gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E5C0; - else - gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E6C4; - } - } - return FALSE; - } - return TRUE; -} - -bool8 sub_807E8E8(void) -{ - if (gWeatherPtr->unknown_6D8 == gWeatherPtr->unknown_6D9) - return FALSE; - - if (++gWeatherPtr->unknown_6D6 > gWeatherPtr->unknown_6DB) - { - gWeatherPtr->unknown_6D6 = 0; - if (gWeatherPtr->unknown_6D8 < gWeatherPtr->unknown_6D9) - { - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8++]->data[5] = 1; - } - else - { - gWeatherPtr->unknown_6D8--; - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->data[5] = 0; - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->invisible = TRUE; - } - } - return TRUE; -} - -void DestroyRainSprites(void) -{ - u16 i; - - for (i = 0; i < gWeatherPtr->rainSpriteCount; i++) - { - if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) - DestroySprite(gWeatherPtr->sprites.s1.rainSprites[i]); - } - gWeatherPtr->rainSpriteCount = 0; - FreeSpriteTilesByTag(0x1206); -} - -//------------------------------------------------------------------------------ -// Snow -//------------------------------------------------------------------------------ - -void Snow_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6E5 = 16; - gWeatherPtr->unknown_6E0 = 0; -} - -void Snow_Main(void); -void sub_807ED48(struct Sprite *); - -void Snow_InitAll(void) -{ - Snow_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - { - u16 i; - - Snow_Main(); - for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) - { - sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); - } - } -} - -u8 snowflakes_progress(void); - -void Snow_Main(void) -{ - if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) - { - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - } -} - -bool8 Snow_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - gWeatherPtr->unknown_6E5 = 0; - gWeatherPtr->unknown_6E0 = 0; - gWeatherPtr->finishStep++; - // fall through - case 1: - if (snowflakes_progress() == FALSE) - { - gWeatherPtr->finishStep++; - return FALSE; - } - return TRUE; - } - return FALSE; -} - -bool8 CreateSnowflakeSprite(void); -bool8 RemoveSnowflakeSprite(void); - -bool8 snowflakes_progress(void) -{ - if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) - return FALSE; - - gWeatherPtr->unknown_6E0++; - if (gWeatherPtr->unknown_6E0 > 36) - { - gWeatherPtr->unknown_6E0 = 0; - if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) - CreateSnowflakeSprite(); - else - RemoveSnowflakeSprite(); - } - return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); -} - -void sub_807EC40(struct Sprite *); - bool8 CreateSnowflakeSprite(void) { u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); @@ -1057,10 +1090,10 @@ void MedRain_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 4; - gWeatherPtr->unknown_6DC = 0; - gWeatherPtr->unknown_6D9 = 16; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->maxRainSprites = 16; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment @@ -1085,10 +1118,10 @@ void HeavyRain_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 4; - gWeatherPtr->unknown_6DC = 1; - gWeatherPtr->unknown_6D9 = 24; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 1; + gWeatherPtr->maxRainSprites = 24; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment @@ -1102,8 +1135,8 @@ void HeavyRain_InitAll(void) Rain_Main(); } -void UpdateThunderSound(void); -void SetThunderCounter(u16); +static void UpdateThunderSound(void); +static void SetThunderCounter(u16); void Rain_Main(void) { @@ -1120,7 +1153,7 @@ void Rain_Main(void) gWeatherPtr->initStep++; break; case 2: - if (sub_807E8E8()) + if (UpdateVisibleRainSprites()) break; gWeatherPtr->weatherGfxLoaded = TRUE; gWeatherPtr->initStep++; @@ -1224,12 +1257,12 @@ bool8 Rain_Finish(void) || gWeatherPtr->nextWeather == WEATHER_RAIN_MED || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) return FALSE; - gWeatherPtr->unknown_6D9 = 0; + gWeatherPtr->maxRainSprites = 0; gWeatherPtr->finishStep++; } break; case 2: - if (sub_807E8E8()) + if (UpdateVisibleRainSprites()) break; DestroyRainSprites(); gWeatherPtr->unknown_6ED = 0; @@ -1241,7 +1274,7 @@ bool8 Rain_Finish(void) return TRUE; } -void SetThunderCounter(u16 max) +static void SetThunderCounter(u16 max) { if (gWeatherPtr->unknown_6ED == 0) { @@ -1250,7 +1283,7 @@ void SetThunderCounter(u16 max) } } -void UpdateThunderSound(void) +static void UpdateThunderSound(void) { if (gWeatherPtr->unknown_6ED == 1) { @@ -2125,7 +2158,7 @@ bool8 Shade_Finish(void) } //------------------------------------------------------------------------------ -// Weather 14 +// Bubbles //------------------------------------------------------------------------------ const u8 gUnknown_0839AC68[] = {40, 90, 60, 90, 2, 60, 40, 30}; From 35505c7f5b421b7589d1d761dcbd41a1c40affb6 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 1 Apr 2019 20:04:23 -0500 Subject: [PATCH 04/42] Document somre more weather effects --- include/event_object_movement.h | 2 +- include/field_weather.h | 33 +- src/event_object_movement.c | 49 +- src/field_effect_helpers.c | 2 +- src/field_weather.c | 2 +- src/field_weather_effect.c | 1035 ++++++++++++++++--------------- src/overworld.c | 2 +- 7 files changed, 582 insertions(+), 543 deletions(-) diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 63ac09f2d..23a3ffa49 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -89,7 +89,7 @@ u8 AddPseudoEventObject(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subprio u8 show_sprite(u8, u8, u8); u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z); u8 SpawnSpecialEventObject(struct EventObjectTemplate *); -void sub_8093038(s16, s16, s16 *, s16 *); +void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *); void CameraObjectReset1(void); void EventObjectSetGraphicsId(struct EventObject *, u8 graphicsId); void EventObjectTurn(struct EventObject *, u8); diff --git a/include/field_weather.h b/include/field_weather.h index 38fba68f1..7a4864075 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,7 +3,10 @@ #include "sprite.h" -#define MAX_RAIN_SPRITES 24 +#define MAX_RAIN_SPRITES 24 +#define NUM_CLOUD_SPRITES 3 +#define NUM_FOG_SPRITES 20 +#define NUM_ASH_SPRITES 20 // Controls how the weather should be changing the screen palettes. enum @@ -31,13 +34,13 @@ struct Weather { struct Sprite *rainSprites[MAX_RAIN_SPRITES]; struct Sprite *snowflakeSprites[101]; - struct Sprite *cloudSprites[3]; + struct Sprite *cloudSprites[NUM_CLOUD_SPRITES]; } s1; struct { u8 filler0[0xA0]; - struct Sprite *fog1Sprites[20]; - struct Sprite *ashSprites[20]; + struct Sprite *fog1Sprites[NUM_FOG_SPRITES]; + struct Sprite *ashSprites[NUM_ASH_SPRITES]; struct Sprite *fog2Sprites[20]; struct Sprite *sandstormSprites1[20]; struct Sprite *sandstormSprites2[5]; @@ -66,30 +69,30 @@ struct Weather u8 altGammaSpritePalIndex; u16 rainSpriteVisibleCounter; u8 curRainSpriteIndex; - u8 maxRainSprites; + u8 targetRainSpriteCount; u8 rainSpriteCount; u8 rainSpriteVisibleDelay; u8 isHeavyRain; u8 rainStrength; /*0x6DE*/ u8 cloudSpritesCreated; u8 filler_6DF[1]; - u16 unknown_6E0; + u16 snowflakeVisibleCounter; u16 unknown_6E2; u8 snowflakeSpriteCount; - u8 unknown_6E5; + u8 targetSnowflakeSpriteCount; u16 unknown_6E6; u16 thunderCounter; u8 unknown_6EA; u8 unknown_6EB; u8 unknown_6EC; - u8 unknown_6ED; + u8 thunderTriggered; u16 fog1ScrollPosX; - u16 unknown_6F0; - u16 unknown_6F2; + u16 fog1ScrollCounter; + u16 fog1ScrollOffset; u8 lightenedFogSpritePals[6]; u8 lightenedFogSpritePalsCount; u8 fog1SpritesCreated; - u16 unknown_6FC; + u16 baseAshSpritesX; u16 unknown_6FE; u8 ashSpritesCreated; u8 filler_701[3]; @@ -176,10 +179,10 @@ void Clouds_InitVars(void); void Clouds_Main(void); void Clouds_InitAll(void); bool8 Clouds_Finish(void); -void Weather2_InitVars(void); -void Weather2_Main(void); -void Weather2_InitAll(void); -bool8 Weather2_Finish(void); +void Sunny_InitVars(void); +void Sunny_Main(void); +void Sunny_InitAll(void); +bool8 Sunny_Finish(void); void LightRain_InitVars(void); void LightRain_Main(void); void LightRain_InitAll(void); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 6a3527bc1..45b721f56 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1949,7 +1949,7 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId) sprite->oam.paletteNum = paletteSlot; eventObject->inanimate = graphicsInfo->inanimate; eventObject->graphicsId = graphicsId; - sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->pos1.x += 8; @@ -2253,7 +2253,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y) sprite = &gSprites[eventObject->spriteId]; graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); SetEventObjectCoords(eventObject, x, y); - sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->pos1.x += 8; @@ -5024,44 +5024,37 @@ static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 delta *y -= dy2; } -void sub_8092FF0(s16 x, s16 y, s16 *dest_x, s16 *dest_y) +void sub_8092FF0(s16 x, s16 y, s16 *destX, s16 *destY) { - *dest_x = (x - gSaveBlock1Ptr->pos.x) << 4; - *dest_y = (y - gSaveBlock1Ptr->pos.y) << 4; - *dest_x -= gTotalCameraPixelOffsetX; - *dest_y -= gTotalCameraPixelOffsetY; + *destX = (x - gSaveBlock1Ptr->pos.x) << 4; + *destY = (y - gSaveBlock1Ptr->pos.y) << 4; + *destX -= gTotalCameraPixelOffsetX; + *destY -= gTotalCameraPixelOffsetY; } -void sub_8093038(s16 x, s16 y, s16 *dest_x, s16 *dest_y) +void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY) { - s16 dx; - s16 dy; - - dx = -gTotalCameraPixelOffsetX - gFieldCamera.x; - dy = -gTotalCameraPixelOffsetY - gFieldCamera.y; + s16 dx = -gTotalCameraPixelOffsetX - gFieldCamera.x; + s16 dy = -gTotalCameraPixelOffsetY - gFieldCamera.y; if (gFieldCamera.x > 0) - { - dx += 0x10; - } + dx += 1 << 4; + if (gFieldCamera.x < 0) - { - dx -= 0x10; - } + dx -= 1 << 4; + if (gFieldCamera.y > 0) - { - dy += 0x10; - } + dy += 1 << 4; + if (gFieldCamera.y < 0) - { - dy -= 0x10; - } - *dest_x = ((x - gSaveBlock1Ptr->pos.x) << 4) + dx; - *dest_y = ((y - gSaveBlock1Ptr->pos.y) << 4) + dy; + dy -= 1 << 4; + + *destX = ((mapX - gSaveBlock1Ptr->pos.x) << 4) + dx; + *destY = ((mapY - gSaveBlock1Ptr->pos.y) << 4) + dy; } void sub_80930E0(s16 *x, s16 *y, s16 dx, s16 dy) { - sub_8093038(*x, *y, x, y); + SetSpritePosToMapCoords(*x, *y, x, y); *x += dx; *y += dy; } diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 3f75fbb84..c715da25d 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -191,7 +191,7 @@ void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y) sprite = &gSprites[spriteId]; if (sprite->invisible || sprite->data[0] != x || sprite->data[1] != y) { - sub_8093038(x, y, &x2, &y2); + SetSpritePosToMapCoords(x, y, &x2, &y2); sprite = &gSprites[spriteId]; sprite->pos1.x = x2 + 8; sprite->pos1.y = y2 + 8; diff --git a/src/field_weather.c b/src/field_weather.c index a2c40052b..346d30a38 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -91,7 +91,7 @@ static const struct WeatherCallbacks sWeatherFuncs[] = { {None_Init, None_Main, None_Init, None_Finish}, {Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish}, - {Weather2_InitVars, Weather2_Main, Weather2_InitAll, Weather2_Finish}, + {Sunny_InitVars, Sunny_Main, Sunny_InitAll, Sunny_Finish}, {LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish}, {Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish}, {MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish}, diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 95f80d061..0544710ad 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -33,9 +33,13 @@ const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp") // Clouds //------------------------------------------------------------------------------ -static void sub_80AC6B4(struct Sprite *); +static void CreateCloudSprites(void); +static void DestroyCloudSprites(void); +static void UpdateCloudSprite(struct Sprite *); -static const struct Coords16 gUnknown_0854FB50[] = +// The clouds are positioned on the map's grid. +// These coordinates are for the lower half of Route 120. +static const struct Coords16 sCloudSpriteMapCoords[] = { { 0, 66}, { 5, 73}, @@ -49,11 +53,11 @@ static const struct SpriteSheet sCloudSpriteSheet = .tag = 0x1200 }; -static const struct OamData gOamData_839A9DC = +static const struct OamData sCloudSpriteOamData = { .y = 0, .affineMode = 0, - .objMode = 1, + .objMode = ST_OAM_OBJ_BLEND, .mosaic = 0, .bpp = 0, .shape = SPRITE_SHAPE(64x64), @@ -66,26 +70,26 @@ static const struct OamData gOamData_839A9DC = .affineParam = 0, }; -static const union AnimCmd gSpriteAnim_839A9E4[] = +static const union AnimCmd sCloudSpriteAnimCmd[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839A9EC[] = +static const union AnimCmd *const sCloudSpriteAnimCmds[] = { - gSpriteAnim_839A9E4, + sCloudSpriteAnimCmd, }; static const struct SpriteTemplate sCloudSpriteTemplate = { - .tileTag = 4608, - .paletteTag = 4609, - .oam = &gOamData_839A9DC, - .anims = gSpriteAnimTable_839A9EC, + .tileTag = 0x1200, + .paletteTag = 0x1201, + .oam = &sCloudSpriteOamData, + .anims = sCloudSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80AC6B4, + .callback = UpdateCloudSprite, }; void Clouds_InitVars(void) @@ -105,8 +109,6 @@ void Clouds_InitAll(void) Clouds_Main(); } -void CreateCloudSprites(void); - void Clouds_Main(void) { switch (gWeatherPtr->initStep) @@ -129,8 +131,6 @@ void Clouds_Main(void) } } -void sub_807E0A0(void); - bool8 Clouds_Finish(void) { switch (gWeatherPtr->finishStep) @@ -142,7 +142,7 @@ bool8 Clouds_Finish(void) case 1: if (Weather_UpdateBlend()) { - sub_807E0A0(); + DestroyCloudSprites(); gWeatherPtr->finishStep++; } return TRUE; @@ -150,49 +150,45 @@ bool8 Clouds_Finish(void) return FALSE; } -//------------------------------------------------------------------------------ -// Weather 2 -//------------------------------------------------------------------------------ - -void Weather2_InitVars(void) +void Sunny_InitVars(void) { gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; } -void Weather2_InitAll(void) +void Sunny_InitAll(void) { - Weather2_InitVars(); + Sunny_InitVars(); } -void Weather2_Main(void) +void Sunny_Main(void) { } -bool8 Weather2_Finish(void) +bool8 Sunny_Finish(void) { - return 0; + return FALSE; } -void CreateCloudSprites(void) +static void CreateCloudSprites(void) { u16 i; + u8 spriteId; + struct Sprite *sprite; if (gWeatherPtr->cloudSpritesCreated == TRUE) return; + LoadSpriteSheet(&sCloudSpriteSheet); LoadCustomWeatherSpritePalette(gUnknown_0854C290); - for (i = 0; i < 3; i++) + for (i = 0; i < NUM_CLOUD_SPRITES; i++) { - u8 spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); - + spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite; - gWeatherPtr->sprites.s1.cloudSprites[i] = &gSprites[spriteId]; sprite = gWeatherPtr->sprites.s1.cloudSprites[i]; - sub_8093038(gUnknown_0854FB50[i].x + 7, gUnknown_0854FB50[i].y + 7, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(sCloudSpriteMapCoords[i].x + 7, sCloudSpriteMapCoords[i].y + 7, &sprite->pos1.x, &sprite->pos1.y); sprite->coordOffsetEnabled = TRUE; } else @@ -200,28 +196,32 @@ void CreateCloudSprites(void) gWeatherPtr->sprites.s1.cloudSprites[i] = NULL; } } + gWeatherPtr->cloudSpritesCreated = TRUE; } -void sub_807E0A0(void) +static void DestroyCloudSprites(void) { u16 i; - if (gWeatherPtr->cloudSpritesCreated == FALSE) + if (!gWeatherPtr->cloudSpritesCreated) return; - for (i = 0; i < 3; i++) + + for (i = 0; i < NUM_CLOUD_SPRITES; i++) { if (gWeatherPtr->sprites.s1.cloudSprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s1.cloudSprites[i]); } + FreeSpriteTilesByTag(0x1200); gWeatherPtr->cloudSpritesCreated = FALSE; } -static void sub_80AC6B4(struct Sprite *sprite) +static void UpdateCloudSprite(struct Sprite *sprite) { + // Move 1 pixel left every 2 frames. sprite->data[0] = (sprite->data[0] + 1) & 1; - if (sprite->data[0] != 0) + if (sprite->data[0]) sprite->pos1.x--; } @@ -437,7 +437,7 @@ static const union AnimCmd *const sRainSpriteAnimCmds[] = static const struct SpriteTemplate sRainSpriteTemplate = { .tileTag = 4614, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &sRainSpriteOamData, .anims = sRainSpriteAnimCmds, .images = NULL, @@ -475,7 +475,7 @@ void LightRain_InitVars(void) gWeatherPtr->rainSpriteVisibleCounter = 0; gWeatherPtr->rainSpriteVisibleDelay = 8; gWeatherPtr->isHeavyRain = 0; - gWeatherPtr->maxRainSprites = 10; + gWeatherPtr->targetRainSpriteCount = 10; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; SetRainStrengthFromSoundEffect(SE_T_KOAME); @@ -524,7 +524,7 @@ bool8 LightRain_Finish(void) } else { - gWeatherPtr->maxRainSprites = 0; + gWeatherPtr->targetRainSpriteCount = 0; gWeatherPtr->finishStep++; } // fall through @@ -714,13 +714,13 @@ static bool8 CreateRainSprite(void) static bool8 UpdateVisibleRainSprites(void) { - if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->maxRainSprites) + if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->targetRainSpriteCount) return FALSE; if (++gWeatherPtr->rainSpriteVisibleCounter > gWeatherPtr->rainSpriteVisibleDelay) { gWeatherPtr->rainSpriteVisibleCounter = 0; - if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->maxRainSprites) + if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->targetRainSpriteCount) { gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex++]->tActive = 1; } @@ -759,39 +759,38 @@ static void DestroyRainSprites(void) // Snow //------------------------------------------------------------------------------ +static void UpdateSnowflakeSprite(struct Sprite *); +static bool8 UpdateVisibleSnowflakeSprites(void); +static bool8 CreateSnowflakeSprite(void); +static bool8 DestroySnowflakeSprite(void); +static void InitSnowflakeSpriteMovement(struct Sprite *); + void Snow_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6E5 = 16; - gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->targetSnowflakeSpriteCount = 16; + gWeatherPtr->snowflakeVisibleCounter = 0; } -void Snow_Main(void); -void sub_807ED48(struct Sprite *); - void Snow_InitAll(void) { + u16 i; + Snow_InitVars(); while (gWeatherPtr->weatherGfxLoaded == FALSE) { - u16 i; - Snow_Main(); for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) - { - sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); - } + UpdateSnowflakeSprite(gWeatherPtr->sprites.s1.snowflakeSprites[i]); } } -u8 snowflakes_progress(void); - void Snow_Main(void) { - if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) + if (gWeatherPtr->initStep == 0 && !UpdateVisibleSnowflakeSprites()) { gWeatherPtr->weatherGfxLoaded = TRUE; gWeatherPtr->initStep++; @@ -803,44 +802,40 @@ bool8 Snow_Finish(void) switch (gWeatherPtr->finishStep) { case 0: - gWeatherPtr->unknown_6E5 = 0; - gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->targetSnowflakeSpriteCount = 0; + gWeatherPtr->snowflakeVisibleCounter = 0; gWeatherPtr->finishStep++; // fall through case 1: - if (snowflakes_progress() == FALSE) + if (!UpdateVisibleSnowflakeSprites()) { gWeatherPtr->finishStep++; return FALSE; } return TRUE; } + return FALSE; } -bool8 CreateSnowflakeSprite(void); -bool8 RemoveSnowflakeSprite(void); - -bool8 snowflakes_progress(void) +static bool8 UpdateVisibleSnowflakeSprites(void) { - if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) + if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->targetSnowflakeSpriteCount) return FALSE; - gWeatherPtr->unknown_6E0++; - if (gWeatherPtr->unknown_6E0 > 36) + if (++gWeatherPtr->snowflakeVisibleCounter > 36) { - gWeatherPtr->unknown_6E0 = 0; - if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) + gWeatherPtr->snowflakeVisibleCounter = 0; + if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->targetSnowflakeSpriteCount) CreateSnowflakeSprite(); else - RemoveSnowflakeSprite(); + DestroySnowflakeSprite(); } - return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); + + return gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->targetSnowflakeSpriteCount; } -void sub_807EC40(struct Sprite *); - -static const struct OamData gOamData_839AAD4 = +static const struct OamData sSnowflakeSpriteOamData = { .y = 0, .affineMode = 0, @@ -857,42 +852,391 @@ static const struct OamData gOamData_839AAD4 = .affineParam = 0, }; -static const struct SpriteFrameImage gSpriteImageTable_839AADC[] = +static const struct SpriteFrameImage sSnowflakeSpriteImages[] = { {gWeatherSnow1Tiles, sizeof(gWeatherSnow1Tiles)}, {gWeatherSnow2Tiles, sizeof(gWeatherSnow2Tiles)}, }; -static const union AnimCmd gSpriteAnim_839AAEC[] = +static const union AnimCmd sSnowflakeAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_839AAF4[] = +static const union AnimCmd sSnowflakeAnimCmd1[] = { ANIMCMD_FRAME(1, 16), ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839AAFC[] = +static const union AnimCmd *const sSnowflakeAnimCmds[] = { - gSpriteAnim_839AAEC, - gSpriteAnim_839AAF4, + sSnowflakeAnimCmd0, + sSnowflakeAnimCmd1, }; -void sub_807ED48(struct Sprite *); static const struct SpriteTemplate sSnowflakeSpriteTemplate = { .tileTag = 0xFFFF, - .paletteTag = 4608, - .oam = &gOamData_839AAD4, - .anims = gSpriteAnimTable_839AAFC, - .images = gSpriteImageTable_839AADC, + .paletteTag = 0x1200, + .oam = &sSnowflakeSpriteOamData, + .anims = sSnowflakeAnimCmds, + .images = sSnowflakeSpriteImages, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807ED48, + .callback = UpdateSnowflakeSprite, }; +#define tPosY data[0] +#define tDeltaY data[1] +#define tWaveDelta data[2] +#define tWaveIndex data[3] +#define tSnowflakeId data[4] +#define tFallCounter data[5] +#define tFallDuration data[6] +#define tDeltaY2 data[7] + +static bool8 CreateSnowflakeSprite(void) +{ + u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); + if (spriteId == MAX_SPRITES) + return FALSE; + + gSprites[spriteId].tSnowflakeId = gWeatherPtr->snowflakeSpriteCount; + InitSnowflakeSpriteMovement(&gSprites[spriteId]); + gSprites[spriteId].coordOffsetEnabled = TRUE; + gWeatherPtr->sprites.s1.snowflakeSprites[gWeatherPtr->snowflakeSpriteCount++] = &gSprites[spriteId]; + return TRUE; +} + +static bool8 DestroySnowflakeSprite(void) +{ + if (gWeatherPtr->snowflakeSpriteCount) + { + DestroySprite(gWeatherPtr->sprites.s1.snowflakeSprites[--gWeatherPtr->snowflakeSpriteCount]); + return TRUE; + } + + return FALSE; +} + +static void InitSnowflakeSpriteMovement(struct Sprite *sprite) +{ + u16 rand; + u16 x = ((sprite->tSnowflakeId * 5) & 7) * 30 + (Random() % 30); + + sprite->pos1.y = -3 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->pos1.x = x - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + sprite->tPosY = sprite->pos1.y * 128; + sprite->pos2.x = 0; + rand = Random(); + sprite->tDeltaY = (rand & 3) * 5 + 64; + sprite->tDeltaY2 = sprite->tDeltaY; + StartSpriteAnim(sprite, (rand & 1) ? 0 : 1); + sprite->tWaveIndex = 0; + sprite->tWaveDelta = ((rand & 3) == 0) ? 2 : 1; + sprite->tFallDuration = (rand & 0x1F) + 210; + sprite->tFallCounter = 0; +} + +static void WaitSnowflakeSprite(struct Sprite *sprite) +{ + if (gWeatherPtr->unknown_6E2 > 18) + { + sprite->invisible = FALSE; + sprite->callback = UpdateSnowflakeSprite; + sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->tPosY = sprite->pos1.y * 128; + gWeatherPtr->unknown_6E2 = 0; + } +} + +static void UpdateSnowflakeSprite(struct Sprite *sprite) +{ + s16 x; + s16 y; + + sprite->tPosY += sprite->tDeltaY; + sprite->pos1.y = sprite->tPosY >> 7; + sprite->tWaveIndex += sprite->tWaveDelta; + sprite->tWaveIndex &= 0xFF; + sprite->pos2.x = gSineTable[sprite->tWaveIndex] / 64; + + x = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; + if (x & 0x100) + x |= -0x100; + + if (x < -3) + sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + else if (x > 242) + sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + + y = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; + if (y > 163 && y < 171) + { + sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->tPosY = sprite->pos1.y * 128; + sprite->tFallCounter = 0; + sprite->tFallDuration = 220; + } + else if (y > 242 && y < 250) + { + sprite->pos1.y = 163; + sprite->tPosY = sprite->pos1.y * 128; + sprite->tFallCounter = 0; + sprite->tFallDuration = 220; + sprite->invisible = TRUE; + sprite->callback = WaitSnowflakeSprite; + } + + if (++sprite->tFallCounter == sprite->tFallDuration) + { + InitSnowflakeSpriteMovement(sprite); + sprite->pos1.y = 250; + sprite->invisible = TRUE; + sprite->callback = WaitSnowflakeSprite; + } +} + +#undef tPosY +#undef tDeltaY +#undef tWaveDelta +#undef tWaveIndex +#undef tSnowflakeId +#undef tFallCounter +#undef tFallDuration +#undef tDeltaY2 + +//------------------------------------------------------------------------------ +// Medium Rain +//------------------------------------------------------------------------------ + +void MedRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->targetRainSpriteCount = 16; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + gWeatherPtr->thunderTriggered = 0; + SetRainStrengthFromSoundEffect(SE_T_AME); +} + +void MedRain_InitAll(void) +{ + MedRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +//------------------------------------------------------------------------------ +// Heavy Rain +//------------------------------------------------------------------------------ + +static void UpdateThunderSound(void); +static void SetThunderCounter(u16); + +void HeavyRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 1; + gWeatherPtr->targetRainSpriteCount = 24; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + SetRainStrengthFromSoundEffect(SE_T_OOAME); +} + +void HeavyRain_InitAll(void) +{ + HeavyRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +void Rain_Main(void) +{ + UpdateThunderSound(); + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (!CreateRainSprite()) + gWeatherPtr->initStep++; + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + case 3: + if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_CHANGING_WEATHER) + gWeatherPtr->initStep = 6; + break; + case 4: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6E6 = (Random() % 360) + 360; + gWeatherPtr->initStep++; + // fall through + case 5: + if (--gWeatherPtr->unknown_6E6 == 0) + gWeatherPtr->initStep++; + break; + case 6: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6EB = Random() % 2; + gWeatherPtr->initStep++; + break; + case 7: + gWeatherPtr->unknown_6EC = (Random() & 1) + 1; + gWeatherPtr->initStep++; + // fall through + case 8: + sub_80ABC48(19); + if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1) + SetThunderCounter(20); + + gWeatherPtr->unknown_6E6 = (Random() % 3) + 6; + gWeatherPtr->initStep++; + break; + case 9: + if (--gWeatherPtr->unknown_6E6 == 0) + { + sub_80ABC48(3); + gWeatherPtr->unknown_6EA = 1; + if (--gWeatherPtr->unknown_6EC != 0) + { + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep = 10; + } + else if (gWeatherPtr->unknown_6EB == 0) + { + gWeatherPtr->initStep = 4; + } + else + { + gWeatherPtr->initStep = 11; + } + } + break; + case 10: + if (--gWeatherPtr->unknown_6E6 == 0) + gWeatherPtr->initStep = 8; + break; + case 11: + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep++; + break; + case 12: + if (--gWeatherPtr->unknown_6E6 == 0) + { + SetThunderCounter(100); + sub_80ABC48(19); + gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30; + gWeatherPtr->initStep++; + } + break; + case 13: + if (--gWeatherPtr->unknown_6E6 == 0) + { + sub_80ABC7C(19, 3, 5); + gWeatherPtr->initStep++; + } + break; + case 14: + if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE) + { + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->initStep = 4; + } + break; + } +} + +bool8 Rain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6EA = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + Rain_Main(); + if (gWeatherPtr->unknown_6EA) + { + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + return FALSE; + + gWeatherPtr->targetRainSpriteCount = 0; + gWeatherPtr->finishStep++; + } + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + DestroyRainSprites(); + gWeatherPtr->thunderTriggered = 0; + gWeatherPtr->finishStep++; + return FALSE; + } + break; + default: + return FALSE; + } + return TRUE; +} + +static void SetThunderCounter(u16 max) +{ + if (gWeatherPtr->thunderTriggered == 0) + { + gWeatherPtr->thunderCounter = Random() % max; + gWeatherPtr->thunderTriggered = 1; + } +} + +static void UpdateThunderSound(void) +{ + if (gWeatherPtr->thunderTriggered == 1) + { + if (gWeatherPtr->thunderCounter == 0) + { + if (IsSEPlaying()) + return; + + if (Random() & 1) + PlaySE(SE_T_KAMI); + else + PlaySE(SE_T_KAMI2); + + gWeatherPtr->thunderTriggered = 0; + } + else + { + gWeatherPtr->thunderCounter--; + } + } +} + +//------------------------------------------------------------------------------ +// Fog 1 +//------------------------------------------------------------------------------ + // unused data static const u16 unusedData_839AB1C[] = {0, 6, 6, 12, 18, 42, 300, 300}; @@ -973,8 +1317,8 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_839AB8C[] = static void Fog1SpriteCallback(struct Sprite *); static const struct SpriteTemplate sFog1SpriteTemplate = { - .tileTag = 4609, - .paletteTag = 4608, + .tileTag = 0x1201, + .paletteTag = 0x1200, .oam = &gOamData_839AB2C, .anims = gSpriteAnimTable_839AB64, .images = NULL, @@ -982,332 +1326,6 @@ static const struct SpriteTemplate sFog1SpriteTemplate = .callback = Fog1SpriteCallback, }; -bool8 CreateSnowflakeSprite(void) -{ - u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); - - if (spriteId == MAX_SPRITES) - return FALSE; - gSprites[spriteId].data[4] = gWeatherPtr->snowflakeSpriteCount; - sub_807EC40(&gSprites[spriteId]); - gSprites[spriteId].coordOffsetEnabled = TRUE; - gWeatherPtr->sprites.s1.snowflakeSprites[gWeatherPtr->snowflakeSpriteCount++] = &gSprites[spriteId]; - return TRUE; -} - -bool8 RemoveSnowflakeSprite(void) -{ - if (gWeatherPtr->snowflakeSpriteCount != 0) - { - DestroySprite(gWeatherPtr->sprites.s1.snowflakeSprites[--gWeatherPtr->snowflakeSpriteCount]); - return TRUE; - } - return FALSE; -} - -void sub_807EC40(struct Sprite *sprite) -{ - u16 r4 = ((sprite->data[4] * 5) & 7) * 30 + (Random() % 30); - u16 r6; - - sprite->pos1.y = -3 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->pos1.x = r4 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - sprite->data[0] = sprite->pos1.y * 128; - sprite->pos2.x = 0; - r6 = Random(); - sprite->data[1] = (r6 & 3) * 5 + 64; - sprite->data[7] = (r6 & 3) * 5 + 64; - StartSpriteAnim(sprite, (r6 & 1) ? 0 : 1); - sprite->data[3] = 0; - sprite->data[2] = ((r6 & 3) == 0) ? 2 : 1; - sprite->data[6] = (r6 & 0x1F) + 210; - sprite->data[5] = 0; -} - -void sub_807ECEC(struct Sprite *sprite) -{ - if (gWeatherPtr->unknown_6E2 > 18) - { - sprite->invisible = FALSE; - sprite->callback = sub_807ED48; - sprite->pos1.y = 0xFA - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->data[0] = sprite->pos1.y * 128; - gWeatherPtr->unknown_6E2 = 0; - } -} - -void sub_807ED48(struct Sprite *sprite) -{ - s16 r3; - s16 r2; - - sprite->data[0] += sprite->data[1]; - sprite->pos1.y = sprite->data[0] >> 7; - sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF; - sprite->pos2.x = gSineTable[sprite->data[3]] / 64; - - r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; - if (r3 & 0x100) - r3 |= -0x100; // hmm... what is this? - if (r3 < -3) - sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - else if (r3 > 242) - sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - - r2 = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; - if (r2 > 163 && r2 < 171) - { - sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->data[0] = sprite->pos1.y * 128; - sprite->data[5] = 0; - sprite->data[6] = 220; - } - else if (r2 > 242 && r2 < 250) - { - sprite->pos1.y = 163; - sprite->data[0] = sprite->pos1.y * 128; - sprite->data[5] = 0; - sprite->data[6] = 220; - sprite->invisible = TRUE; - sprite->callback = sub_807ECEC; - } - - sprite->data[5]++; - if (sprite->data[5] == sprite->data[6]) - { - sub_807EC40(sprite); - sprite->pos1.y = 250; - sprite->invisible = TRUE; - sprite->callback = sub_807ECEC; - } -} - -//------------------------------------------------------------------------------ -// Medium Rain -//------------------------------------------------------------------------------ - -void MedRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->rainSpriteVisibleCounter = 0; - gWeatherPtr->rainSpriteVisibleDelay = 4; - gWeatherPtr->isHeavyRain = 0; - gWeatherPtr->maxRainSprites = 16; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment - gWeatherPtr->unknown_6ED = 0; - SetRainStrengthFromSoundEffect(SE_T_AME); -} - -void Rain_Main(void); - -void MedRain_InitAll(void) -{ - MedRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Rain_Main(); -} - -//------------------------------------------------------------------------------ -// Heavy Rain -//------------------------------------------------------------------------------ - -void HeavyRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->rainSpriteVisibleCounter = 0; - gWeatherPtr->rainSpriteVisibleDelay = 4; - gWeatherPtr->isHeavyRain = 1; - gWeatherPtr->maxRainSprites = 24; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment - SetRainStrengthFromSoundEffect(SE_T_OOAME); -} - -void HeavyRain_InitAll(void) -{ - HeavyRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Rain_Main(); -} - -static void UpdateThunderSound(void); -static void SetThunderCounter(u16); - -void Rain_Main(void) -{ - UpdateThunderSound(); - switch (gWeatherPtr->initStep) - { - case 0: - LoadRainSpriteSheet(); - gWeatherPtr->initStep++; - break; - case 1: - if (CreateRainSprite()) - break; - gWeatherPtr->initStep++; - break; - case 2: - if (UpdateVisibleRainSprites()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - break; - case 3: - if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_CHANGING_WEATHER) - break; - gWeatherPtr->initStep = 6; - break; - case 4: - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->unknown_6E6 = (Random() % 360) + 360; - gWeatherPtr->initStep++; - // fall through - case 5: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - gWeatherPtr->initStep++; - break; - case 6: - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->unknown_6EB = Random() % 2; - gWeatherPtr->initStep++; - break; - case 7: - gWeatherPtr->unknown_6EC = (Random() & 1) + 1; - gWeatherPtr->initStep++; - // fall through - case 8: - sub_80ABC48(19); - if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1) - SetThunderCounter(20); - gWeatherPtr->unknown_6E6 = (Random() % 3) + 6; - gWeatherPtr->initStep++; - break; - case 9: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - sub_80ABC48(3); - gWeatherPtr->unknown_6EA = 1; - if (--gWeatherPtr->unknown_6EC != 0) - { - gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; - gWeatherPtr->initStep = 10; - } - else if (gWeatherPtr->unknown_6EB == 0) - { - gWeatherPtr->initStep = 4; - } - else - { - gWeatherPtr->initStep = 11; - } - break; - case 10: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - gWeatherPtr->initStep = 8; - break; - case 11: - gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; - gWeatherPtr->initStep++; - break; - case 12: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - SetThunderCounter(100); - sub_80ABC48(19); - // Why use "% 16" everywhere else and "& 0xF" here. So dumb. - gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30; - gWeatherPtr->initStep++; - break; - case 13: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - sub_80ABC7C(19, 3, 5); - gWeatherPtr->initStep++; - break; - case 14: - if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_IDLE) - break; - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->initStep = 4; - break; - } -} - -bool8 Rain_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - gWeatherPtr->unknown_6EA = 0; - gWeatherPtr->finishStep++; - // fall through - case 1: - Rain_Main(); - if (gWeatherPtr->unknown_6EA != 0) - { - if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT - || gWeatherPtr->nextWeather == WEATHER_RAIN_MED - || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) - return FALSE; - gWeatherPtr->maxRainSprites = 0; - gWeatherPtr->finishStep++; - } - break; - case 2: - if (UpdateVisibleRainSprites()) - break; - DestroyRainSprites(); - gWeatherPtr->unknown_6ED = 0; - gWeatherPtr->finishStep++; - return FALSE; - default: - return FALSE; - } - return TRUE; -} - -static void SetThunderCounter(u16 max) -{ - if (gWeatherPtr->unknown_6ED == 0) - { - gWeatherPtr->thunderCounter = Random() % max; - gWeatherPtr->unknown_6ED = 1; - } -} - -static void UpdateThunderSound(void) -{ - if (gWeatherPtr->unknown_6ED == 1) - { - if (gWeatherPtr->thunderCounter == 0) - { - if (IsSEPlaying()) - return; - if (Random() & 1) - PlaySE(SE_T_KAMI); - else - PlaySE(SE_T_KAMI2); - gWeatherPtr->unknown_6ED = 0; - } - else - { - gWeatherPtr->thunderCounter--; - } - } -} - -//------------------------------------------------------------------------------ -// Fog 1 -//------------------------------------------------------------------------------ - void Fog1_Main(void); static void CreateFog1Sprites(void); static void DestroyFog1Sprites(void); @@ -1320,8 +1338,8 @@ void Fog1_InitVars(void) gWeatherPtr->gammaStepDelay = 20; if (gWeatherPtr->fog1SpritesCreated == 0) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2 = 0; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset = 0; gWeatherPtr->fog1ScrollPosX = 0; Weather_SetBlendCoeffs(0, 16); } @@ -1336,11 +1354,11 @@ void Fog1_InitAll(void) void Fog1_Main(void) { - gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; - if (++gWeatherPtr->unknown_6F0 > 3) + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF; + if (++gWeatherPtr->fog1ScrollCounter > 3) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2++; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset++; } switch (gWeatherPtr->initStep) { @@ -1364,12 +1382,13 @@ void Fog1_Main(void) bool8 Fog1_Finish(void) { - gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; - if (++gWeatherPtr->unknown_6F0 > 3) + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF; + if (++gWeatherPtr->fog1ScrollCounter > 3) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2++; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset++; } + switch (gWeatherPtr->finishStep) { case 0: @@ -1377,9 +1396,8 @@ bool8 Fog1_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + gWeatherPtr->finishStep++; break; case 2: DestroyFog1Sprites(); @@ -1391,15 +1409,15 @@ bool8 Fog1_Finish(void) return TRUE; } -#define sprColumn data[0] +#define tSpriteColumn data[0] static void Fog1SpriteCallback(struct Sprite *sprite) { sprite->pos2.y = (u8)gSpriteCoordOffsetY; - sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->sprColumn * 64; - if (sprite->pos1.x > 0x10F) + sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->tSpriteColumn * 64; + if (sprite->pos1.x > 271) { - sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->sprColumn) * 64; + sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } @@ -1407,21 +1425,24 @@ static void Fog1SpriteCallback(struct Sprite *sprite) static void CreateFog1Sprites(void) { u16 i; + u8 spriteId; + struct Sprite *sprite; if (!gWeatherPtr->fog1SpritesCreated) { - struct SpriteSheet fog1SpriteSheet = {gWeatherFog1Tiles, sizeof(gWeatherFog1Tiles), 0x1201}; - + struct SpriteSheet fog1SpriteSheet = { + .data = gWeatherFog1Tiles, + .size = sizeof(gWeatherFog1Tiles), + .tag = 0x1201, + }; LoadSpriteSheet(&fog1SpriteSheet); - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); - + spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->sprColumn = i % 5; + sprite = &gSprites[spriteId]; + sprite->tSpriteColumn = i % 5; sprite->pos1.x = (i % 5) * 64 + 32; sprite->pos1.y = (i / 5) * 64 + 32; gWeatherPtr->sprites.s2.fog1Sprites[i] = sprite; @@ -1431,36 +1452,38 @@ static void CreateFog1Sprites(void) gWeatherPtr->sprites.s2.fog1Sprites[i] = NULL; } } + gWeatherPtr->fog1SpritesCreated = TRUE; } } -#undef sprColumn - static void DestroyFog1Sprites(void) { u16 i; if (gWeatherPtr->fog1SpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG_SPRITES; i++) { if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]); } + FreeSpriteTilesByTag(0x1201); gWeatherPtr->fog1SpritesCreated = 0; } } +#undef tSpriteColumn + //------------------------------------------------------------------------------ // Volcanic ash //------------------------------------------------------------------------------ -void Ash_Main(void); -void LoadAshSpriteSheet(void); -void CreateAshSprites(void); -void DestroyAshSprites(void); +static void LoadAshSpriteSheet(void); +static void CreateAshSprites(void); +static void DestroyAshSprites(void); +static void UpdateAshSprite(struct Sprite *); void Ash_InitVars(void) { @@ -1472,7 +1495,7 @@ void Ash_InitVars(void) if (!gWeatherPtr->ashSpritesCreated) { Weather_SetBlendCoeffs(0, 16); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // Those aren't even valid coefficients! + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients! } } @@ -1485,9 +1508,10 @@ void Ash_InitAll(void) void Ash_Main(void) { - gWeatherPtr->unknown_6FC = gSpriteCoordOffsetX & 0x1FF; - while (gWeatherPtr->unknown_6FC > 0xEF) - gWeatherPtr->unknown_6FC -= 0xF0; + gWeatherPtr->baseAshSpritesX = gSpriteCoordOffsetX & 0x1FF; + while (gWeatherPtr->baseAshSpritesX >= 240) + gWeatherPtr->baseAshSpritesX -= 240; + switch (gWeatherPtr->initStep) { case 0: @@ -1497,14 +1521,16 @@ void Ash_Main(void) case 1: if (!gWeatherPtr->ashSpritesCreated) CreateAshSprites(); + Weather_SetTargetBlendCoeffs(16, 0, 1); gWeatherPtr->initStep++; break; case 2: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } break; default: Weather_UpdateBlend(); @@ -1521,10 +1547,11 @@ bool8 Ash_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - DestroyAshSprites(); - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + { + DestroyAshSprites(); + gWeatherPtr->finishStep++; + } break; case 2: SetGpuReg(REG_OFFSET_BLDALPHA, 0); @@ -1536,18 +1563,23 @@ bool8 Ash_Finish(void) return TRUE; } -static const struct SpriteSheet sAshSpriteSheet = {gWeatherAshTiles, sizeof(gWeatherAshTiles), 0x1202}; +static const struct SpriteSheet sAshSpriteSheet = +{ + .data = gWeatherAshTiles, + .size = sizeof(gWeatherAshTiles), + .tag = 0x1202, +}; -void LoadAshSpriteSheet(void) +static void LoadAshSpriteSheet(void) { LoadSpriteSheet(&sAshSpriteSheet); } -const struct OamData gOamData_839ABB8 = +static const struct OamData sAshSpriteOamData = { .y = 0, .affineMode = 0, - .objMode = 1, + .objMode = ST_OAM_OBJ_BLEND, .mosaic = 0, .bpp = 0, .shape = SPRITE_SHAPE(64x64), @@ -1560,48 +1592,52 @@ const struct OamData gOamData_839ABB8 = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839ABC0[] = +static const union AnimCmd sAshSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 60), ANIMCMD_FRAME(64, 60), ANIMCMD_JUMP(0), }; -const union AnimCmd *const gSpriteAnimTable_839ABCC[] = +static const union AnimCmd *const sAshSpriteAnimCmds[] = { - gSpriteAnim_839ABC0, + sAshSpriteAnimCmd0, }; -void sub_807FAA8(struct Sprite *); static const struct SpriteTemplate sAshSpriteTemplate = { .tileTag = 4610, - .paletteTag = 4608, - .oam = &gOamData_839ABB8, - .anims = gSpriteAnimTable_839ABCC, + .paletteTag = 0x1200, + .oam = &sAshSpriteOamData, + .anims = sAshSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807FAA8, + .callback = UpdateAshSprite, }; -void CreateAshSprites(void) +#define tOffsetY data[0] +#define tCounterY data[1] +#define tSpriteColumn data[2] +#define tSpriteRow data[3] + +static void CreateAshSprites(void) { u8 i; + u8 spriteId; + struct Sprite *sprite; if (!gWeatherPtr->ashSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_ASH_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sAshSpriteTemplate, 0, 0, 0x4E); - + spriteId = CreateSpriteAtEnd(&sAshSpriteTemplate, 0, 0, 0x4E); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->data[1] = 0; - sprite->data[2] = (u8)(i % 5); - sprite->data[3] = (u8)(i / 5); - sprite->data[0] = sprite->data[3] * 64 + 32; + sprite = &gSprites[spriteId]; + sprite->tCounterY = 0; + sprite->tSpriteColumn = (u8)(i % 5); + sprite->tSpriteRow = (u8)(i / 5); + sprite->tOffsetY = sprite->tSpriteRow * 64 + 32; gWeatherPtr->sprites.s2.ashSprites[i] = sprite; } else @@ -1609,43 +1645,50 @@ void CreateAshSprites(void) gWeatherPtr->sprites.s2.ashSprites[i] = NULL; } } + gWeatherPtr->ashSpritesCreated = TRUE; } } -void DestroyAshSprites(void) +static void DestroyAshSprites(void) { u16 i; if (gWeatherPtr->ashSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_ASH_SPRITES; i++) { if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.ashSprites[i]); } + FreeSpriteTilesByTag(0x1202); gWeatherPtr->ashSpritesCreated = FALSE; } } -void sub_807FAA8(struct Sprite *sprite) +static void UpdateAshSprite(struct Sprite *sprite) { - sprite->data[1]++; - if (sprite->data[1] > 5) + if (++sprite->tCounterY > 5) { - sprite->data[1] = 0; - sprite->data[0]++; + sprite->tCounterY = 0; + sprite->tOffsetY++; } - sprite->pos1.y = gSpriteCoordOffsetY + sprite->data[0]; - sprite->pos1.x = gWeatherPtr->unknown_6FC + 32 + sprite->data[2] * 64; + + sprite->pos1.y = gSpriteCoordOffsetY + sprite->tOffsetY; + sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_6FC + 0x1E0 - (4 - sprite->data[2]) * 64; + sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } +#undef tOffsetY +#undef tCounterY +#undef tSpriteColumn +#undef tSpriteRow + //------------------------------------------------------------------------------ // Fog 2 //------------------------------------------------------------------------------ @@ -1656,8 +1699,8 @@ void Fog2_InitVars(void) gWeatherPtr->weatherGfxLoaded = 0; gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2 = 1; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset = 1; if (gWeatherPtr->fog2SpritesCreated == 0) { gWeatherPtr->unknown_71C = 0; @@ -1812,7 +1855,7 @@ void Fog2SpriteCallback(struct Sprite *); const struct SpriteTemplate sFog2SpriteTemplate = { .tileTag = 4611, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &gOamData_839ABF0, .anims = gSpriteAnimTable_839AC00, .images = NULL, @@ -2017,8 +2060,8 @@ const union AnimCmd *const gSpriteAnimTable_839AC34[] = void SandstormSpriteCallback1(struct Sprite *); const struct SpriteTemplate sSandstormSpriteTemplate = { - .tileTag = 4612, - .paletteTag = 4609, + .tileTag = 0x1204, + .paletteTag = 0x1201, .oam = &gOamData_839AC1C, .anims = gSpriteAnimTable_839AC34, .images = NULL, @@ -2250,7 +2293,7 @@ void unc_0807DAB4(struct Sprite *); const struct SpriteTemplate gSpriteTemplate_839ACBC = { .tileTag = 4613, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &gUnknown_08524904, .anims = gSpriteAnimTable_839ACB8, .images = NULL, diff --git a/src/overworld.c b/src/overworld.c index ce1e21ab1..ae6efefd7 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2960,7 +2960,7 @@ static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s1 eventObj->currentCoords.y = y; eventObj->previousCoords.x = x; eventObj->previousCoords.y = y; - sub_8093038(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y); + SetSpritePosToMapCoords(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y); eventObj->initialCoords.x += 8; EventObjectUpdateZCoord(eventObj); } From ca9f7fe3563b84504d499bdb291ca10d38cbf229 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 00:59:01 -0400 Subject: [PATCH 05/42] Fix hardcoded array sizes --- src/pokenav_match_call.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c index b775ed10e..0a21c4edc 100644 --- a/src/pokenav_match_call.c +++ b/src/pokenav_match_call.c @@ -680,7 +680,7 @@ bool32 MatchCallFlagGetByIndex(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -727,7 +727,7 @@ u8 sub_81D16DC(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -771,7 +771,7 @@ bool32 MatchCall_IsRematchable(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -810,13 +810,13 @@ bool32 sub_81D17E8(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); if (gUnknown_08625338[i](matchCall)) return TRUE; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) return TRUE; @@ -854,7 +854,7 @@ u32 MatchCall_GetRematchTableIdx(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return REMATCH_TABLE_ENTRIES; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -891,7 +891,7 @@ void MatchCall_GetMessage(u32 idx, u8 *dest) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -1093,7 +1093,7 @@ void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -1146,11 +1146,11 @@ const u8 *sub_81D1B40(u32 idx, u32 offset) { u32 i; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) { - for (; i + 1 < 4 && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++) + for (; i + 1 < ARRAY_COUNT(sMatchCallCheckPageOverrides) && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++) { if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4)) break; @@ -1244,7 +1244,7 @@ s32 sub_81D1BD0(u32 idx) { u32 i; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) return sMatchCallCheckPageOverrides[i].v2; @@ -1256,7 +1256,7 @@ bool32 sub_81D1BF8(u32 idx) { s32 i; - for (i = 0; i < 21; i++) + for (i = 0; i < (s32)ARRAY_COUNT(sMatchCallHeaders); i++) { u32 r0 = MatchCall_GetRematchTableIdx(i); if (r0 != REMATCH_TABLE_ENTRIES && r0 == idx) From 65d8b68f9db02252ae5e4ba8ee779218eb67f135 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 01:10:20 -0400 Subject: [PATCH 06/42] Expicitly hardcode rematch indecies Inserting an entry without updating the indecies will now cause a compiler error. This will make it easier for modders to remember to update the constants. --- src/battle_setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/battle_setup.c b/src/battle_setup.c index 347486a0b..cb7b63ebe 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -296,7 +296,8 @@ const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, - {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, + // Wally's entry index is hardcoded. + [REMATCH_WALLY_ENTRY] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, @@ -305,7 +306,8 @@ const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, - {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, + + [REMATCH_ELITE_FOUR_ENTRIES] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, From 6916f09cd5cdb508e270bfba40f1bd165a16762f Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 03:22:07 -0400 Subject: [PATCH 07/42] Expand MatchCallStruct defs, use REMATCH_* enum --- include/battle_setup.h | 5 +- include/constants/flags.h | 13 +- include/gym_leader_rematch.h | 2 + src/battle_setup.c | 162 ++++++++++++------------ src/pokenav_match_call.c | 236 ++++++++++++++++++++++++++++++----- 5 files changed, 298 insertions(+), 120 deletions(-) diff --git a/include/battle_setup.h b/include/battle_setup.h index 3b327e3f7..e3faa5dcf 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -1,10 +1,11 @@ #ifndef GUARD_BATTLE_SETUP_H #define GUARD_BATTLE_SETUP_H +#include "gym_leader_rematch.h" + #define REMATCHES_COUNT 5 #define REMATCH_TABLE_ENTRIES 78 -#define REMATCH_WALLY_ENTRY 64 -#define REMATCH_ELITE_FOUR_ENTRIES 73 +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY struct RematchTrainer { diff --git a/include/constants/flags.h b/include/constants/flags.h index f28af3278..0450e988d 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -445,13 +445,14 @@ #define FLAG_REMATCH_NORMAN 0x1A2 #define FLAG_REMATCH_WINONA 0x1A3 #define FLAG_REMATCH_TATE_AND_LIZA 0x1A4 -#define FLAG_REMATCH_JUAN 0x1A5 -#define FLAG_REMATCH_SIDNEY 0x1A6 -#define FLAG_REMATCH_PHOEBE 0x1A7 -#define FLAG_REMATCH_GLACIA 0x1A8 -#define FLAG_REMATCH_DRAKE 0x1A9 -#define FLAG_REMATCH_WALLACE 0x1AA +// Note: FLAG_REMATCH_JUAN is handled by FLAG_ENABLE_JUAN_MATCH_CALL instead. +#define FLAG_REMATCH_SIDNEY 0x1A5 +#define FLAG_REMATCH_PHOEBE 0x1A6 +#define FLAG_REMATCH_GLACIA 0x1A7 +#define FLAG_REMATCH_DRAKE 0x1A8 +#define FLAG_REMATCH_WALLACE 0x1A9 +#define FLAG_UNUSED_0x1AA 0x1AA // Unused Flag #define FLAG_UNUSED_0x1AB 0x1AB // Unused Flag #define FLAG_DEFEATED_DEOXYS 0x1AC diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ef0e5fef1..ed1143db5 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -75,6 +75,8 @@ enum { REMATCH_WINONA, REMATCH_TATE_AND_LIZA, REMATCH_JUAN, + + // Entries below SIDNEY are considered part of REMATCH_ELITE_FOUR_ENTRIES. REMATCH_SIDNEY, REMATCH_PHOEBE, REMATCH_GLACIA, diff --git a/src/battle_setup.c b/src/battle_setup.c index cb7b63ebe..7395c175b 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -232,86 +232,84 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[] const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = { - {{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21}, - {{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14}, - {{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a}, - {{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18}, - {{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18}, - {{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27}, - {{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24}, - {{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a}, - {{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a}, - {{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14}, - {{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13}, - {{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38}, - {{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24}, - {{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13}, - {{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d}, - {{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16}, - {{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e}, - {{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a}, - {{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26}, - {{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21}, - {{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d}, - {{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd}, - {{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1}, - {{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23}, - {{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26}, - {{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26}, - {{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24}, - {{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f}, - {{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f}, - {{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20}, - {{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19}, - {{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12}, - {{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e}, - {{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc}, - {{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11}, - {{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15}, - {{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b}, - {{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20}, - {{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19}, - {{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20}, - {{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b}, - {{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19}, - {{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29}, - {{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1}, - {{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23}, - {{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c}, - {{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e}, - {{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c}, - {{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27}, - {{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd}, - {{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12}, - {{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28}, - {{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17}, - {{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19}, - {{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20}, - {{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20}, - {{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11}, - {{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22}, - {{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22}, - {{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13}, - {{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb}, - {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, - {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, - {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, - // Wally's entry index is hardcoded. - [REMATCH_WALLY_ENTRY] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, - {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, - {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, - {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, - {{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc}, - {{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0}, - {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, - {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, - {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, - - [REMATCH_ELITE_FOUR_ENTRIES] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, - {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, - {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, - {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, - {{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8}, + [REMATCH_ROSE] = {{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21}, + [REMATCH_ANDRES] = {{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14}, + [REMATCH_DUSTY] = {{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a}, + [REMATCH_LOLA] = {{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18}, + [REMATCH_RICKY] = {{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18}, + [REMATCH_LILA_AND_ROY] = {{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27}, + [REMATCH_CRISTIN] = {{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24}, + [REMATCH_BROOKE] = {{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a}, + [REMATCH_WILTON] = {{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a}, + [REMATCH_VALERIE] = {{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14}, + [REMATCH_CINDY] = {{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13}, + [REMATCH_THALIA] = {{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38}, + [REMATCH_JESSICA] = {{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24}, + [REMATCH_WINSTON] = {{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13}, + [REMATCH_STEVE] = {{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d}, + [REMATCH_TONY] = {{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16}, + [REMATCH_NOB] = {{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e}, + [REMATCH_KOJI] = {{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a}, + [REMATCH_FERNANDO] = {{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26}, + [REMATCH_DALTON] = {{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21}, + [REMATCH_BERNIE] = {{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d}, + [REMATCH_ETHAN] = {{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd}, + [REMATCH_JOHN_AND_JAY] = {{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1}, + [REMATCH_JEFFREY] = {{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23}, + [REMATCH_CAMERON] = {{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26}, + [REMATCH_JACKI] = {{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26}, + [REMATCH_WALTER] = {{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24}, + [REMATCH_KAREN] = {{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f}, + [REMATCH_JERRY] = {{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f}, + [REMATCH_ANNA_AND_MEG] = {{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20}, + [REMATCH_ISABEL] = {{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19}, + [REMATCH_MIGUEL] = {{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12}, + [REMATCH_TIMOTHY] = {{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e}, + [REMATCH_SHELBY] = {{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc}, + [REMATCH_CALVIN] = {{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11}, + [REMATCH_ELLIOT] = {{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15}, + [REMATCH_ISAIAH] = {{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b}, + [REMATCH_MARIA] = {{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20}, + [REMATCH_ABIGAIL] = {{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19}, + [REMATCH_DYLAN] = {{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20}, + [REMATCH_KATELYN] = {{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b}, + [REMATCH_BENJAMIN] = {{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19}, + [REMATCH_PABLO] = {{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29}, + [REMATCH_NICOLAS] = {{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1}, + [REMATCH_ROBERT] = {{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23}, + [REMATCH_LAO] = {{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c}, + [REMATCH_CYNDY] = {{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e}, + [REMATCH_MADELINE] = {{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c}, + [REMATCH_JENNY] = {{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27}, + [REMATCH_DIANA] = {{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd}, + [REMATCH_AMY_AND_LIV] = {{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12}, + [REMATCH_ERNEST] = {{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28}, + [REMATCH_CORY] = {{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17}, + [REMATCH_EDWIN] = {{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19}, + [REMATCH_LYDIA] = {{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20}, + [REMATCH_ISAAC] = {{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20}, + [REMATCH_GABRIELLE] = {{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11}, + [REMATCH_CATHERINE] = {{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22}, + [REMATCH_JACKSON] = {{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22}, + [REMATCH_HALEY] = {{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13}, + [REMATCH_JAMES] = {{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb}, + [REMATCH_TRENT] = {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, + [REMATCH_SAWYER] = {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, + [REMATCH_KIRA_AND_DAN] = {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, + [REMATCH_WALLY_3] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, + [REMATCH_ROXANNE] = {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, + [REMATCH_BRAWLY] = {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, + [REMATCH_WATTSON] = {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, + [REMATCH_FLANNERY] = {{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc}, + [REMATCH_NORMAN] = {{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0}, + [REMATCH_WINONA] = {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, + [REMATCH_TATE_AND_LIZA] = {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, + [REMATCH_JUAN] = {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, + [REMATCH_SIDNEY] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, + [REMATCH_PHOEBE] = {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, + [REMATCH_GLACIA] = {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, + [REMATCH_DRAKE] = {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, + [REMATCH_WALLACE] = {{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8}, }; static const u16 sBadgeFlags[8] = @@ -1547,7 +1545,7 @@ static bool32 sub_80B1D94(s32 rematchTableId) { if (rematchTableId >= REMATCH_ELITE_FOUR_ENTRIES) return TRUE; - else if (rematchTableId == REMATCH_WALLY_ENTRY) + else if (rematchTableId == REMATCH_WALLY_3) return (FlagGet(FLAG_DEFEATED_WALLY_VICTORY_ROAD) == FALSE); else return FALSE; @@ -1575,7 +1573,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u s32 i; bool32 ret = FALSE; - for (i = 0; i <= REMATCH_WALLY_ENTRY; i++) + for (i = 0; i <= REMATCH_WALLY_3; i++) { if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && !sub_80B1D94(i)) { diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c index 0a21c4edc..ce00401a9 100644 --- a/src/pokenav_match_call.c +++ b/src/pokenav_match_call.c @@ -73,22 +73,17 @@ struct MatchCallStruct4 { const match_call_text_data_t *textData; }; +// Note: Type1 and Type5 have identical struct layouts. struct MatchCallStruct5 { u8 type; u8 v1; u16 flag; - u16 v4; + u16 rematchTableIdx; const u8 *desc; const u8 *name; const match_call_text_data_t *textData; }; -#define MATCHCALLDEF(name, type_, ...) \ -static const struct MatchCallStruct##type_ name = { \ - .type = type_, \ - __VA_ARGS__ \ -}; - typedef union { const struct MatchCallStructCommon *common; const struct MatchCallStruct0 *type0; @@ -328,7 +323,15 @@ static const match_call_text_data_t sMrStoneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sMrStoneMatchCallHeader, 0, 10, 0xffff, gMrStoneMatchCallDesc, gMrStoneMatchCallName, sMrStoneTextScripts); +static const struct MatchCallStruct0 sMrStoneMatchCallHeader = +{ + .type = 0, + .v1 = 10, + .flag = 0xFFFF, + .desc = gMrStoneMatchCallDesc, + .name = gMrStoneMatchCallName, + .textData = sMrStoneTextScripts +}; static const match_call_text_data_t sNormanTextScripts[] = { { gText_Norman_Pokenav_2B5719, FLAG_ENABLE_NORMAN_MATCH_CALL, 0xFFFF }, @@ -343,9 +346,25 @@ static const match_call_text_data_t sNormanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sNormanMatchCallHeader, 5, 7, FLAG_ENABLE_NORMAN_MATCH_CALL, 0x45, gNormanMatchCallDesc, gNormanMatchCallName, sNormanTextScripts); +static const struct MatchCallStruct5 sNormanMatchCallHeader = +{ + .type = 5, + .v1 = 7, + .flag = FLAG_ENABLE_NORMAN_MATCH_CALL, + .rematchTableIdx = REMATCH_NORMAN, + .desc = gNormanMatchCallDesc, + .name = gNormanMatchCallName, + .textData = sNormanTextScripts +}; -MATCHCALLDEF(sProfBirchMatchCallHeader, 3, 0, FLAG_ENABLE_PROF_BIRCH_MATCH_CALL, gProfBirchMatchCallDesc, gProfBirchMatchCallName) +static const struct MatchCallStruct3 sProfBirchMatchCallHeader = +{ + .type = 3, + .v1 = 0, + .flag = FLAG_ENABLE_PROF_BIRCH_MATCH_CALL, + .desc = gProfBirchMatchCallDesc, + .name = gProfBirchMatchCallName +}; static const match_call_text_data_t sMomTextScripts[] = { { gText_Mom_Pokenav_2B227B, 0xffff, 0xffff }, @@ -354,7 +373,15 @@ static const match_call_text_data_t sMomTextScripts[] = { { NULL, 0xffff, 0xffff } }; -MATCHCALLDEF(sMomMatchCallHeader, 0, 0, FLAG_ENABLE_MOM_MATCH_CALL, gMomMatchCallDesc, gMomMatchCallName, sMomTextScripts); +static const struct MatchCallStruct0 sMomMatchCallHeader = +{ + .type = 0, + .v1 = 0, + .flag = FLAG_ENABLE_MOM_MATCH_CALL, + .desc = gMomMatchCallDesc, + .name = gMomMatchCallName, + .textData = sMomTextScripts +}; static const match_call_text_data_t sStevenTextScripts[] = { { gText_Steven_Pokenav_2B5B95, 0xffff, 0xffff }, @@ -367,7 +394,15 @@ static const match_call_text_data_t sStevenTextScripts[] = { { NULL, 0xffff, 0xffff }, }; -MATCHCALLDEF(sStevenMatchCallHeader, 0, 0xd5, FLAG_REGISTERED_STEVEN_POKENAV, gStevenMatchCallDesc, gStevenMatchCallName, sStevenTextScripts); +static const struct MatchCallStruct0 sStevenMatchCallHeader = +{ + .type = 0, + .v1 = 0xD5, + .flag = FLAG_REGISTERED_STEVEN_POKENAV, + .desc = gStevenMatchCallDesc, + .name = gStevenMatchCallName, + .textData = sStevenTextScripts +}; static const match_call_text_data_t sMayTextScripts[] = { { gText_May_Pokenav_2B3AB3, 0xFFFF, 0xFFFF }, @@ -388,7 +423,15 @@ static const match_call_text_data_t sMayTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sMayMatchCallHeader, 4, MALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_May, sMayTextScripts); +static const struct MatchCallStruct4 sMayMatchCallHeader = +{ + .type = 4, + .gender = MALE, + .flag = FLAG_ENABLE_RIVAL_MATCH_CALL, + .desc = gMayBrendanMatchCallDesc, + .name = gExpandedPlaceholder_May, + .textData = sMayTextScripts +}; static const match_call_text_data_t sBrendanTextScripts[] = { { gText_Brendan_Pokenav_2B43EF, 0xFFFF, 0xFFFF }, @@ -409,7 +452,15 @@ static const match_call_text_data_t sBrendanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sBrendanMatchCallHeader, 4, FEMALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_Brendan, sBrendanTextScripts); +static const struct MatchCallStruct4 sBrendanMatchCallHeader = +{ + .type = 4, + .gender = FEMALE, + .flag = FLAG_ENABLE_RIVAL_MATCH_CALL, + .desc = gMayBrendanMatchCallDesc, + .name = gExpandedPlaceholder_Brendan, + .textData = sBrendanTextScripts +}; static const match_call_text_data_t sWallyTextScripts[] = { { gText_Wally_Pokenav_2B4DE2, 0xFFFF, 0xFFFF }, @@ -429,7 +480,16 @@ const struct MatchCallSubstruct2 sWallyAdditionalData[] = { { 0xFFFF, 0xD5 } }; -MATCHCALLDEF(sWallyMatchCallHeader, 2, 0, FLAG_ENABLE_WALLY_MATCH_CALL, REMATCH_WALLY_3, gWallyMatchCallDesc, sWallyTextScripts, sWallyAdditionalData); +static const struct MatchCallStruct2 sWallyMatchCallHeader = +{ + .type = 2, + .v1 = 0, + .flag = FLAG_ENABLE_WALLY_MATCH_CALL, + .rematchTableIdx = REMATCH_WALLY_3, + .desc = gWallyMatchCallDesc, + .textData = sWallyTextScripts, + .v10 = sWallyAdditionalData +}; static const match_call_text_data_t sScottTextScripts[] = { { gText_Scott_Pokenav_2B5184, 0xFFFF, 0xFFFF }, @@ -443,7 +503,15 @@ static const match_call_text_data_t sScottTextScripts[] = { }; -MATCHCALLDEF(sScottMatchCallHeader, 0, 0xD5, FLAG_ENABLE_SCOTT_MATCH_CALL, gScottMatchCallDesc, gScottMatchCallName, sScottTextScripts); +static const struct MatchCallStruct0 sScottMatchCallHeader = +{ + .type = 0, + .v1 = 0xD5, + .flag = FLAG_ENABLE_SCOTT_MATCH_CALL, + .desc = gScottMatchCallDesc, + .name = gScottMatchCallName, + .textData = sScottTextScripts +}; static const match_call_text_data_t sRoxanneTextScripts[] = { { gText_Roxanne_Pokenav_2B2456, 0xFFFE, 0xFFFF }, @@ -453,7 +521,16 @@ static const match_call_text_data_t sRoxanneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sRoxanneMatchCallHeader, 5, 10, FLAG_ENABLE_ROXANNE_MATCH_CALL, 0x41, gRoxanneMatchCallDesc, NULL, sRoxanneTextScripts); +static const struct MatchCallStruct5 sRoxanneMatchCallHeader = +{ + .type = 5, + .v1 = 10, + .flag = FLAG_ENABLE_ROXANNE_MATCH_CALL, + .rematchTableIdx = REMATCH_ROXANNE, + .desc = gRoxanneMatchCallDesc, + .name = NULL, + .textData = sRoxanneTextScripts +}; static const match_call_text_data_t sBrawlyTextScripts[] = { { gText_Brawly_Pokenav_2B2659, 0xFFFE, 0xFFFF }, @@ -463,7 +540,16 @@ static const match_call_text_data_t sBrawlyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sBrawlyMatchCallHeader, 5, 2, FLAG_ENABLE_BRAWLY_MATCH_CALL, 0x42, gBrawlyMatchCallDesc, NULL, sBrawlyTextScripts); +static const struct MatchCallStruct5 sBrawlyMatchCallHeader = +{ + .type = 5, + .v1 = 2, + .flag = FLAG_ENABLE_BRAWLY_MATCH_CALL, + .rematchTableIdx = REMATCH_BRAWLY, + .desc = gBrawlyMatchCallDesc, + .name = NULL, + .textData = sBrawlyTextScripts +}; static const match_call_text_data_t sWattsonTextScripts[] = { { gText_Wattson_Pokenav_2B2912, 0xFFFE, 0xFFFF }, @@ -473,7 +559,16 @@ static const match_call_text_data_t sWattsonTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWattsonMatchCallHeader, 5, 9, FLAG_ENABLE_WATTSON_MATCH_CALL, 0x43, gWattsonMatchCallDesc, NULL, sWattsonTextScripts); +static const struct MatchCallStruct5 sWattsonMatchCallHeader = +{ + .type = 5, + .v1 = 9, + .flag = FLAG_ENABLE_WATTSON_MATCH_CALL, + .rematchTableIdx = REMATCH_WATTSON, + .desc = gWattsonMatchCallDesc, + .name = NULL, + .textData = sWattsonTextScripts +}; static const match_call_text_data_t sFlanneryTextScripts[] = { { gText_Flannery_Pokenav_2B2B4D, 0xFFFE, 0xFFFF }, @@ -483,7 +578,16 @@ static const match_call_text_data_t sFlanneryTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sFlanneryMatchCallHeader, 5, 3, FLAG_ENABLE_FLANNERY_MATCH_CALL, 0x44, gFlanneryMatchCallDesc, NULL, sFlanneryTextScripts); +static const struct MatchCallStruct5 sFlanneryMatchCallHeader = +{ + .type = 5, + .v1 = 3, + .flag = FLAG_ENABLE_FLANNERY_MATCH_CALL, + .rematchTableIdx = REMATCH_FLANNERY, + .desc = gFlanneryMatchCallDesc, + .name = NULL, + .textData = sFlanneryTextScripts +}; static const match_call_text_data_t sWinonaTextScripts[] = { { gText_Winona_Pokenav_2B2DA4, 0xFFFE, 0xFFFF }, @@ -493,7 +597,16 @@ static const match_call_text_data_t sWinonaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWinonaMatchCallHeader, 5, 11, FLAG_ENABLE_WINONA_MATCH_CALL, 0x46, gWinonaMatchCallDesc, NULL, sWinonaTextScripts); +static const struct MatchCallStruct5 sWinonaMatchCallHeader = +{ + .type = 5, + .v1 = 11, + .flag = FLAG_ENABLE_WINONA_MATCH_CALL, + .rematchTableIdx = REMATCH_WINONA, + .desc = gWinonaMatchCallDesc, + .name = NULL, + .textData = sWinonaTextScripts +}; static const match_call_text_data_t sTateLizaTextScripts[] = { { gText_TateLiza_Pokenav_2B2F97, 0xFFFE, 0xFFFF }, @@ -503,7 +616,16 @@ static const match_call_text_data_t sTateLizaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sTateLizaMatchCallHeader, 5, 13, FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, 0x47, gTateLizaMatchCallDesc, NULL, sTateLizaTextScripts); +static const struct MatchCallStruct5 sTateLizaMatchCallHeader = +{ + .type = 5, + .v1 = 13, + .flag = FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, + .rematchTableIdx = REMATCH_TATE_AND_LIZA, + .desc = gTateLizaMatchCallDesc, + .name = NULL, + .textData = sTateLizaTextScripts +}; static const match_call_text_data_t sJuanTextScripts[] = { { gText_Juan_Pokenav_2B3249, 0xFFFE, 0xFFFF }, @@ -513,42 +635,96 @@ static const match_call_text_data_t sJuanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sJuanMatchCallHeader, 5, 14, FLAG_ENABLE_JUAN_MATCH_CALL, 0x48, gJuanMatchCallDesc, NULL, sJuanTextScripts); +static const struct MatchCallStruct5 sJuanMatchCallHeader = +{ + .type = 5, + .v1 = 14, + .flag = FLAG_ENABLE_JUAN_MATCH_CALL, + .rematchTableIdx = REMATCH_JUAN, + .desc = gJuanMatchCallDesc, + .name = NULL, + .textData = sJuanTextScripts +}; static const match_call_text_data_t sSidneyTextScripts[] = { { gText_Sidney_Pokenav_2B34CC, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sSidneyMatchCallHeader, 5, 15, FLAG_REMATCH_JUAN, 0x49, gEliteFourMatchCallDesc, NULL, sSidneyTextScripts); +static const struct MatchCallStruct5 sSidneyMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_SIDNEY, + .rematchTableIdx = REMATCH_SIDNEY, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sSidneyTextScripts +}; static const match_call_text_data_t sPhoebeTextScripts[] = { { gText_Phoebe_Pokenav_2B3561, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sPhoebeMatchCallHeader, 5, 15, FLAG_REMATCH_SIDNEY, 0x4A, gEliteFourMatchCallDesc, NULL, sPhoebeTextScripts); +static const struct MatchCallStruct5 sPhoebeMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_PHOEBE, + .rematchTableIdx = REMATCH_PHOEBE, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sPhoebeTextScripts +}; static const match_call_text_data_t sGlaciaTextScripts[] = { { gText_Glacia_Pokenav_2B35E4, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sGlaciaMatchCallHeader, 5, 15, FLAG_REMATCH_PHOEBE, 0x4B, gEliteFourMatchCallDesc, NULL, sGlaciaTextScripts); +static const struct MatchCallStruct5 sGlaciaMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_GLACIA, + .rematchTableIdx = REMATCH_GLACIA, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sGlaciaTextScripts +}; static const match_call_text_data_t sDrakeTextScripts[] = { { gText_Drake_Pokenav_2B368B, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sDrakeMatchCallHeader, 5, 15, FLAG_REMATCH_GLACIA, 0x4C, gEliteFourMatchCallDesc, NULL, sDrakeTextScripts); +static const struct MatchCallStruct5 sDrakeMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_DRAKE, + .rematchTableIdx = REMATCH_DRAKE, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sDrakeTextScripts +}; static const match_call_text_data_t sWallaceTextScripts[] = { { gText_Wallace_Pokenav_2B3790, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWallaceMatchCallHeader, 5, 15, FLAG_REMATCH_DRAKE, 0x4D, gChampionMatchCallDesc, NULL, sWallaceTextScripts); +static const struct MatchCallStruct5 sWallaceMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_WALLACE, + .rematchTableIdx = REMATCH_WALLACE, + .desc = gChampionMatchCallDesc, + .name = NULL, + .textData = sWallaceTextScripts +}; static const match_call_t sMatchCallHeaders[] = { {.type0 = &sMrStoneMatchCallHeader}, @@ -906,9 +1082,9 @@ static void MatchCall_GetMessage_Type0(match_call_t matchCall, u8 *dest) static void MatchCall_GetMessage_Type1(match_call_t matchCall, u8 *dest) { if (matchCall.common->type != 5) - sub_81D1920(matchCall.type5->textData, dest); + sub_81D1920(matchCall.type1->textData, dest); else - sub_81D199C(matchCall.type1->textData, matchCall.type1->rematchTableIdx, dest); + sub_81D199C(matchCall.type5->textData, matchCall.type5->rematchTableIdx, dest); } static void MatchCall_GetMessage_Type2(match_call_t matchCall, u8 *dest) From 9f44ebc5cd2b3088469f188c355db4fe905d299a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 03:27:05 -0400 Subject: [PATCH 08/42] Automatically calculate REMATCH_TABLE_ENTRIES Uses the standard C way of calculating the length of an enum. --- include/battle_setup.h | 1 - include/gym_leader_rematch.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/battle_setup.h b/include/battle_setup.h index e3faa5dcf..984c820bb 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -4,7 +4,6 @@ #include "gym_leader_rematch.h" #define REMATCHES_COUNT 5 -#define REMATCH_TABLE_ENTRIES 78 #define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY struct RematchTrainer diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ed1143db5..778d7a1e8 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -81,7 +81,11 @@ enum { REMATCH_PHOEBE, REMATCH_GLACIA, REMATCH_DRAKE, - REMATCH_WALLACE + REMATCH_WALLACE, + + // The total number of rematch entries. This must be the last element + // in the enum. + REMATCH_TABLE_ENTRIES }; void UpdateGymLeaderRematch(void); From 1aa95a1821cd4ebe552a39bbfed067a305071e31 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 08:36:22 +0200 Subject: [PATCH 09/42] Document a bit of anims --- asm/macros/battle_anim_script.inc | 14 +++---- data/battle_anim_scripts.s | 70 +++++++++++++++---------------- src/battle_anim_effects_1.c | 16 +++---- src/battle_anim_effects_2.c | 4 +- src/bug.c | 19 ++++++--- src/dark.c | 44 +++++++++++-------- 6 files changed, 91 insertions(+), 76 deletions(-) diff --git a/asm/macros/battle_anim_script.inc b/asm/macros/battle_anim_script.inc index 6ccd8d505..32d9de82c 100644 --- a/asm/macros/battle_anim_script.inc +++ b/asm/macros/battle_anim_script.inc @@ -153,19 +153,19 @@ .byte \param4 .endm - .macro loopsewithpan se:req, param1:req, param2:req, param3:req + .macro loopsewithpan se:req, pan:req, wait:req, times:req .byte 0x1c .2byte \se - .byte \param1 - .byte \param2 - .byte \param3 + .byte \pan + .byte \wait + .byte \times .endm - .macro waitplaysewithpan se:req, param1:req, param2:req + .macro waitplaysewithpan se:req, pan:req, wait:req .byte 0x1d .2byte \se - .byte \param1 - .byte \param2 + .byte \pan + .byte \wait .endm .macro setbldcnt param0:req diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index e7a7e89b6..5a19061d0 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1515,7 +1515,7 @@ Move_VINE_WHIP: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 6 delay 6 playsewithpan SE_W010, SOUND_PAN_TARGET - createsprite gUnknown_085928E8, ANIM_TARGET, 2, 0, 0 + createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 0, 0 delay 6 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 6, 1 end @@ -1656,12 +1656,12 @@ Explosion1: Move_DEFENSE_CURL: loadspritegfx ANIM_TAG_ECLIPSING_ORB loopsewithpan SE_W161, SOUND_PAN_ATTACKER, 18, 3 - createvisualtask sub_811489C, 5, 0, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 0 createvisualtask sub_815B338, 5 waitforvisualfinish createsprite gUnknown_085CE338, ANIM_ATTACKER, 2, 0, 6, 0, 1 waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 waitforvisualfinish end @@ -2003,7 +2003,7 @@ Move_ATTRACT: createsprite gBattleAnimSpriteTemplate_85939B8, ANIM_TARGET, 3, -384, -31 waitforvisualfinish waitplaysewithpan SE_W213B, 0, 15 - createvisualtask sub_81062E8, 5 + createvisualtask AnimTask_HeartsBackground, 5 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 16, 256, 0 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 224, 240, 15 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 126, 272, 30 @@ -2012,7 +2012,7 @@ Move_ATTRACT: createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 40, 256, 75 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 112, 256, 90 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 200, 272, 90 - delay 0x4B + delay 75 createvisualtask sub_8115A04, 2, 4, 4, 4, 0, 10, RGB(31, 25, 27) end @@ -3220,13 +3220,13 @@ EndureEffect: Move_CHARM: loadspritegfx ANIM_TAG_MAGENTA_HEART createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER waitforvisualfinish end @@ -4358,7 +4358,7 @@ Move_AERIAL_ACE: Move_IRON_DEFENSE: loopsewithpan SE_REAPOKE, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 2, RGB_WHITEALPHA, 14, -1, 0 waitforvisualfinish end @@ -4393,13 +4393,13 @@ Move_COVET: loadspritegfx ANIM_TAG_MAGENTA_HEART loadspritegfx ANIM_TAG_ITEM_BAG createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER waitforvisualfinish createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 8, 1 @@ -4570,7 +4570,7 @@ Move_SHOCK_WAVE: Move_HARDEN: loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish end @@ -7213,7 +7213,7 @@ Move_STEEL_WING: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_IMPACT loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish monbg ANIM_DEF_PARTNER monbgprio_28 ANIM_TARGET @@ -7239,7 +7239,7 @@ Move_STEEL_WING: Move_IRON_TAIL: loadspritegfx ANIM_TAG_IMPACT loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 1, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 1, 0, 0 waitforvisualfinish monbg ANIM_TARGET setalpha 12, 8 @@ -7249,7 +7249,7 @@ Move_IRON_TAIL: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_W233B, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 clearmonbg ANIM_TARGET blendoff waitforvisualfinish @@ -7259,7 +7259,7 @@ Move_POISON_TAIL: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_POISON_BUBBLE loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 1, 1, RGB(24, 6, 23) + createvisualtask AnimTask_MetallicShine, 5, 1, 1, RGB(24, 6, 23) waitforvisualfinish monbg ANIM_TARGET setalpha 12, 8 @@ -7269,7 +7269,7 @@ Move_POISON_TAIL: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_W233B, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 clearmonbg ANIM_TARGET blendoff call PoisonBubblesEffect @@ -7279,7 +7279,7 @@ Move_POISON_TAIL: Move_METAL_CLAW: loadspritegfx ANIM_TAG_CLAW_SLASH loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 4 delay 2 @@ -7459,7 +7459,7 @@ Move_STRING_SHOT: end StringShot1: - createsprite gUnknown_085969E0, ANIM_TARGET, 2, 20, 0, 512, 20, 1 + createsprite gWebThreadSpriteTemplate, ANIM_TARGET, 2, 20, 0, 512, 20, 1 delay 1 return @@ -7488,7 +7488,7 @@ Move_SPIDER_WEB: call SpiderWeb1 waitforvisualfinish playsewithpan SE_W081B, SOUND_PAN_TARGET - createsprite gUnknown_08596A2C, ANIM_ATTACKER, 2 + createsprite gSpiderWebSpriteTemplate, ANIM_ATTACKER, 2 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 1 @@ -7496,7 +7496,7 @@ Move_SPIDER_WEB: end SpiderWeb1: - createsprite gUnknown_085969E0, ANIM_TARGET, 2, 20, 0, 512, 20, 0 + createsprite gWebThreadSpriteTemplate, ANIM_TARGET, 2, 20, 0, 512, 20, 0 delay 1 return @@ -7941,16 +7941,16 @@ Move_PERISH_SONG: panse_1B SE_W195, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 delay 80 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_BLACK - createvisualtask sub_811489C, 5, 4, 0 - createvisualtask sub_811489C, 5, 5, 0 - createvisualtask sub_811489C, 5, 6, 0 - createvisualtask sub_811489C, 5, 7, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 4, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 5, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 6, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 7, 0 delay 100 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_BLACK - createvisualtask sub_811489C, 5, 4, 1 - createvisualtask sub_811489C, 5, 5, 1 - createvisualtask sub_811489C, 5, 6, 1 - createvisualtask sub_811489C, 5, 7, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 4, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 5, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 6, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 7, 1 waitforvisualfinish end @@ -9570,7 +9570,7 @@ Move_DOOM_DESIRE: createvisualtask sub_8114960, 2 delay 1 monbg ANIM_ATK_PARTNER - createvisualtask sub_811489C, 5, 1, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_TARGET, 0 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB_BLACK waitforvisualfinish setalpha 8, 8 @@ -9578,7 +9578,7 @@ Move_DOOM_DESIRE: createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_ATTACKER, 1 waitforvisualfinish delay 20 - createvisualtask sub_811489C, 5, 1, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_TARGET, 1 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATK_PARTNER @@ -10237,13 +10237,13 @@ Burn1: Status_Infatuation: loadspritegfx ANIM_TAG_MAGENTA_HEART playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 delay 15 playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 delay 15 playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 end Status_Sleep: diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index f14e502f3..af4bc19ec 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -1093,7 +1093,7 @@ const struct SpriteTemplate gUnknown_085928D0 = .callback = sub_8100A50, }; -const struct SpriteTemplate gUnknown_085928E8 = +const struct SpriteTemplate gVineWhipSpriteTemplate = { .tileTag = ANIM_TAG_WHIP_HIT, .paletteTag = ANIM_TAG_WHIP_HIT, @@ -2336,7 +2336,7 @@ void AnimHyperBeamOrb(struct Sprite* sprite) { u16 speed; u16 animNum = Random2(); - + StartSpriteAnim(sprite, animNum % 8); sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); @@ -2660,7 +2660,7 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) s16 a = sprite->data[0]; s16 b = sprite->data[7]; s16 r0; - + sprite->data[0] = 1; TranslateAnimHorizontalArc(sprite); r0 = sprite->data[7]; @@ -2675,7 +2675,7 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) if (sprite->oam.affineParam == 30) destroy = TRUE; } - + if (sprite->pos1.x + sprite->pos2.x > 256 || sprite->pos1.x + sprite->pos2.x < -16 || sprite->pos1.y + sprite->pos2.y > 160 @@ -3748,7 +3748,7 @@ void sub_81009F8(struct Sprite* sprite) void sub_8100A50(struct Sprite* sprite) { - if (GetBattlerSide(gBattleAnimAttacker) == 0) + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) StartSpriteAnim(sprite, 1); sprite->callback = sub_81009DC; @@ -3770,7 +3770,7 @@ void sub_8100A94(struct Sprite* sprite) } // Moves the sprite in a diagonally slashing motion across the target mon. -// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE. +// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE. // arg 0: initial x pixel offset // arg 1: initial y pixel offset // arg 2: slice direction; 0 = right-to-left, 1 = left-to-right @@ -5350,10 +5350,10 @@ static void sub_8102DE4(struct Sprite* sprite) void sub_8102EB0(struct Sprite* sprite) { - int a; + int a; if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) { - a = gBattleAnimArgs[1]; + a = gBattleAnimArgs[1]; (u16)gBattleAnimArgs[1] = -a; } diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 80b3258b4..e3295acb8 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -889,7 +889,7 @@ const struct SpriteTemplate gUnknown_08593958 = .callback = sub_8105DE8, }; -const struct SpriteTemplate gUnknown_08593970 = +const struct SpriteTemplate gMagentaHeartSpriteTemplate = { .tileTag = ANIM_TAG_MAGENTA_HEART, .paletteTag = ANIM_TAG_MAGENTA_HEART, @@ -3286,7 +3286,7 @@ static void sub_810627C(struct Sprite *sprite) } } -void sub_81062E8(u8 taskId) +void AnimTask_HeartsBackground(u8 taskId) { struct BattleAnimBgData animBg; diff --git a/src/bug.c b/src/bug.c index 88f93a3d5..4fa6a5bb6 100644 --- a/src/bug.c +++ b/src/bug.c @@ -6,7 +6,7 @@ void sub_8110368(struct Sprite *); void sub_8110438(struct Sprite *); -void sub_81104E4(struct Sprite *); +void AnimTranslateWebThread(struct Sprite *); void sub_81105B4(struct Sprite *); void sub_811067C(struct Sprite *); void AnimTranslateStinger(struct Sprite *); @@ -90,7 +90,7 @@ const struct SpriteTemplate gUnknown_085969C8 = .callback = sub_8110438, }; -const struct SpriteTemplate gUnknown_085969E0 = +const struct SpriteTemplate gWebThreadSpriteTemplate = { .tileTag = ANIM_TAG_WEB_THREAD, .paletteTag = ANIM_TAG_WEB_THREAD, @@ -98,7 +98,7 @@ const struct SpriteTemplate gUnknown_085969E0 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81104E4, + .callback = AnimTranslateWebThread, }; const struct SpriteTemplate gUnknown_085969F8 = @@ -124,7 +124,7 @@ const union AffineAnimCmd *const gUnknown_08596A28[] = gUnknown_08596A10, }; -const struct SpriteTemplate gUnknown_08596A2C = +const struct SpriteTemplate gSpiderWebSpriteTemplate = { .tileTag = ANIM_TAG_SPIDER_WEB, .paletteTag = ANIM_TAG_SPIDER_WEB, @@ -247,12 +247,19 @@ void sub_8110438(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -void sub_81104E4(struct Sprite *sprite) +// Creates a single web thread that travels from attacker to target. +// Used by MOVE_STRING_SHOT and MOVE_SPIDER_WEB in their first move phase. +// arg 0: x +// arg 1: y +// arg 2: controls the left-to-right movement +// arg 3: amplitude +// arg 4: if targets both opponents +void AnimTranslateWebThread(struct Sprite *sprite) { if (IsContest()) gBattleAnimArgs[2] /= 2; - InitSpritePosToAnimAttacker(sprite, 1); + InitSpritePosToAnimAttacker(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[2]; sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; diff --git a/src/dark.c b/src/dark.c index 80ce61800..482c09c04 100644 --- a/src/dark.c +++ b/src/dark.c @@ -803,17 +803,23 @@ void sub_81144BC(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -void sub_81144F8(u8 taskId) +// Makes the attacker metallic and shining. +// Used by MOVE_HARDEN and MOVE_IRON_DEFENSE. +// arg0: if true won't change battler's palette back +// arg1: if true, use custom color +// arg2: custom color +// Custom color argument is used in MOVE_POISON_TAIL to make the mon turn purplish/pinkish as if became cloaked in poison. +void AnimTask_MetallicShine(u8 taskId) { u16 species; u8 spriteId; u8 newSpriteId; u16 paletteNum; struct BattleAnimBgData animBg; - int var0 = 0; + bool32 priorityChanged = FALSE; - gBattle_WIN0H = var0; - gBattle_WIN0V = var0; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR | WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON); @@ -832,7 +838,7 @@ void sub_81144F8(u8 taskId) { gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority--; SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); - var0 = 1; + priorityChanged = TRUE; } } } @@ -861,7 +867,7 @@ void sub_81144F8(u8 taskId) gBattle_BG1_Y = -gSprites[spriteId].pos1.y + 32; paletteNum = 16 + gSprites[spriteId].oam.paletteNum; - if (gBattleAnimArgs[1] == 0) + if (gBattleAnimArgs[1] == 0) SetGreyscaleOrOriginalPalette(paletteNum, FALSE); else BlendPalette(paletteNum * 16, 16, 11, gBattleAnimArgs[2]); @@ -870,7 +876,7 @@ void sub_81144F8(u8 taskId) gTasks[taskId].data[1] = gBattleAnimArgs[0]; gTasks[taskId].data[2] = gBattleAnimArgs[1]; gTasks[taskId].data[3] = gBattleAnimArgs[2]; - gTasks[taskId].data[6] = var0; + gTasks[taskId].data[6] = priorityChanged; gTasks[taskId].func = sub_8114748; } @@ -879,29 +885,28 @@ static void sub_8114748(u8 taskId) struct BattleAnimBgData animBg; u16 paletteNum; u8 spriteId; - u8 taskIdCopy = taskId; - gTasks[taskIdCopy].data[10] += 4; + gTasks[taskId].data[10] += 4; gBattle_BG1_X -= 4; - if (gTasks[taskIdCopy].data[10] == 128) + if (gTasks[taskId].data[10] == 128) { - gTasks[taskIdCopy].data[10] = 0; + gTasks[taskId].data[10] = 0; gBattle_BG1_X += 128; - gTasks[taskIdCopy].data[11]++; - if (gTasks[taskIdCopy].data[11] == 2) + gTasks[taskId].data[11]++; + if (gTasks[taskId].data[11] == 2) { spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); paletteNum = 16 + gSprites[spriteId].oam.paletteNum; - if (gTasks[taskIdCopy].data[1] == 0) + if (gTasks[taskId].data[1] == 0) SetGreyscaleOrOriginalPalette(paletteNum, 1); - DestroySprite(&gSprites[gTasks[taskIdCopy].data[0]]); + DestroySprite(&gSprites[gTasks[taskId].data[0]]); sub_80A6B30(&animBg); sub_80A6C68(animBg.bgId); - if (gTasks[taskIdCopy].data[6] == 1) + if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; } - else if (gTasks[taskIdCopy].data[11] == 3) + else if (gTasks[taskId].data[11] == 3) { gBattle_WIN0H = 0; gBattle_WIN0V = 0; @@ -918,7 +923,10 @@ static void sub_8114748(u8 taskId) } } -void sub_811489C(u8 taskId) +// Changes battler's palette to either greyscale or original. +// arg0: which battler +// arg1: 0 grayscale, 1 original +void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) { u8 spriteId; u8 battler; From 201c0953ae4f6c6b65958065f009cbaee3c8f3ee Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 1 Apr 2019 18:31:10 -0400 Subject: [PATCH 10/42] Cleanup OamData entries --- src/battle_anim.c | 362 +++++++++++++++++++++++++++++++++++++ src/battle_main.c | 22 +-- src/cable_car.c | 34 +++- src/contest.c | 39 ++-- src/contest_painting.c | 5 +- src/decoration.c | 13 +- src/field_effect.c | 41 ++++- src/field_weather_effect.c | 29 ++- src/link_rfu.c | 14 +- src/naming_screen.c | 29 ++- src/pokedex_cry_screen.c | 8 +- src/pokemon_icon.c | 11 +- 12 files changed, 511 insertions(+), 96 deletions(-) mode change 100755 => 100644 src/cable_car.c mode change 100755 => 100644 src/pokedex_cry_screen.c diff --git a/src/battle_anim.c b/src/battle_anim.c index 31ff11ee8..88de3ee88 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -117,651 +117,1011 @@ EWRAM_DATA u8 gUnknown_02038440 = 0; const struct OamData gUnknown_08524904 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852490C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524914 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852491C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524924 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852492C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524934 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852493C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524944 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852494C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524954 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852495C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524964 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852496C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524974 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852497C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524984 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852498C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524994 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852499C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249A4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249AC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249B4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249BC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249C4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249CC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249D4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249DC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249E4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249EC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249F4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249FC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A04 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A0C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A14 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A1C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A24 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A2C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A34 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A3C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A44 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A4C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A54 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A5C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A64 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A6C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A74 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A7C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A84 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A8C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A94 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A9C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AA4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AAC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AB4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ABC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AC4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ACC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AD4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ADC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AE4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AEC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AF4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AFC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B04 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B0C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B14 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B1C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B24 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B2C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B34 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B3C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct CompressedSpriteSheet gBattleAnimPicTable[] = @@ -3088,3 +3448,5 @@ static void ScriptCmd_stopsound(void) m4aMPlayStop(&gMPlayInfo_SE2); sBattleAnimScriptPtr++; } + + diff --git a/src/battle_main.c b/src/battle_main.c index 19fd01e3c..92f12636d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -293,35 +293,31 @@ static const u8 sText_ShedinjaJpnName[] = _("ヌケニン"); // Nukenin const struct OamData gOamData_831ACA8 = { .y = 0, - .affineMode = 1, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 0, - .affineParam = 0 + .affineParam = 0, }; const struct OamData gOamData_831ACB0 = { .y = 0, - .affineMode = 1, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 2, - .affineParam = 0 + .affineParam = 0, }; // Unknown and unused data. Feel free to remove. @@ -5891,3 +5887,5 @@ static void HandleAction_ActionFinished(void) gBattleScripting.multihitMoveEffect = 0; gBattleResources->battleScriptsStack->size = 0; } + + diff --git a/src/cable_car.c b/src/cable_car.c old mode 100755 new mode 100644 index ab7b5726a..4e6980c4e --- a/src/cable_car.c +++ b/src/cable_car.c @@ -151,25 +151,46 @@ const struct SpritePalette gUnknown_085CDB74[] = { { } }; -const struct OamData gOamData_85CDB84 = { +const struct OamData gOamData_85CDB84 = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; -const struct OamData gOamData_85CDB8C = { +const struct OamData gOamData_85CDB8C = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; -const struct OamData gOamData_85CDB94 = { +const struct OamData gOamData_85CDB94 = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; const struct SpriteTemplate gSpriteTemplate_85CDB9C[] = @@ -1007,3 +1028,4 @@ static void sub_81514C8(u8 arg0) sCableCar->unk1C = 0; } + diff --git a/src/contest.c b/src/contest.c index 0591668ff..02d7038cf 100644 --- a/src/contest.c +++ b/src/contest.c @@ -445,18 +445,15 @@ const struct CompressedSpriteSheet gUnknown_08587B88 = const struct OamData gOamData_8587B90 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(16x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587B98 = @@ -486,18 +483,15 @@ const struct SpritePalette gUnknown_08587BB8 = const struct OamData gOamData_8587BC0 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x32), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587BC8 = @@ -514,18 +508,15 @@ const struct SpriteTemplate gSpriteTemplate_8587BC8 = const struct OamData gOamData_8587BE0 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 3, .paletteNum = 2, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587BE8 = @@ -768,18 +759,16 @@ static const struct SpritePalette sUnknown_08589924[] = const struct OamData gOamData_8589944 = { .y = 0, - .affineMode = 3, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 + .affineParam = 0, }; const union AffineAnimCmd gSpriteAffineAnim_858994C[] = @@ -5762,3 +5751,5 @@ void sub_80DFA08(struct ContestPokemon *mon, s32 language) name[PLAYER_NAME_LENGTH] = EOS; } } + + diff --git a/src/contest_painting.c b/src/contest_painting.c index 29f3c871d..87598f2bd 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -152,16 +152,14 @@ const struct OamData gUnknown_085B0830 = .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = 1, + .mosaic = TRUE, .bpp = ST_OAM_8BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)}; @@ -705,3 +703,4 @@ static void sub_8130884(u8 arg0, u8 arg1) sub_8130688(arg0); sub_8130430(arg0, arg1); } + diff --git a/src/decoration.c b/src/decoration.c index 3c8809c6a..4baa6d4c8 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -391,10 +391,18 @@ const struct SpritePalette gUnknown_085A73E0 = { Unknown_085A7328, OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG }; -const struct OamData Unknown_085A73E8 = { +const struct OamData Unknown_085A73E8 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), - .priority = 1 + .tileNum = 0, + .priority = 1, + .paletteNum = 0, }; const union AnimCmd Unknown_085A73F0[] = { @@ -2740,3 +2748,4 @@ void sub_812A478(u8 taskId) StringExpandPlaceholders(gStringVar4, gText_DecorationThrownAway); DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); } + diff --git a/src/field_effect.c b/src/field_effect.c index 825efc380..93d7e5ef8 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -284,20 +284,44 @@ bool8 (*const gFieldEffectScriptFuncs[])(u8 **, u32 *) = const struct OamData gNewGameBirchOamAttributes = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), - .size = SPRITE_SIZE(64x64) + .x = 0, + .size = SPRITE_SIZE(64x64), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct OamData gOamData_855C218 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), - .size = SPRITE_SIZE(8x8) + .x = 0, + .size = SPRITE_SIZE(8x8), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct OamData gOamData_855C220 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), - .size = SPRITE_SIZE(16x16) + .x = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct SpriteFrameImage gNewGameBirchPicTable[] = @@ -347,8 +371,16 @@ const struct SpritePalette gFieldEffectObjectPaletteInfo5 = const struct OamData gOamData_855C26C = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), - .size = SPRITE_SIZE(32x16) + .x = 0, + .size = SPRITE_SIZE(32x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct SpriteFrameImage gSpriteImageTable_855C274[] = @@ -3759,3 +3791,4 @@ static void Fldeff_MoveDeoxysRock_Step(u8 taskId) break; } } + diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 6ec83f1a0..1468f7ca0 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1513,18 +1513,15 @@ void LoadAshSpriteSheet(void) const struct OamData gOamData_839ABB8 = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 1, .paletteNum = 15, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839ABC0[] = @@ -1750,18 +1747,15 @@ void CreateFog2Sprites(void) const struct OamData gOamData_839ABF0 = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 0, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839ABF8[] = @@ -1949,18 +1943,15 @@ void sub_80800E4(void) const struct OamData gOamData_839AC1C = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 1, .paletteNum = 0, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839AC24[] = @@ -2470,3 +2461,5 @@ static void UpdateRainCounter(u8 newWeather, u8 oldWeather) && (newWeather == WEATHER_RAIN_LIGHT || newWeather == WEATHER_RAIN_MED)) IncrementGameStat(GAME_STAT_GOT_RAINED_ON); } + + diff --git a/src/link_rfu.c b/src/link_rfu.c index a430f6e24..1e4c9c7e6 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -154,9 +154,18 @@ const u8 sWireless_RSEtoASCIITable[] = { 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 }; -const struct OamData sWirelessStatusIndicatorOamData = { +const struct OamData sWirelessStatusIndicatorOamData = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), - .size = SPRITE_SIZE(16x16) + .x = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; static const union AnimCmd sWirelessStatusIndicatorAnim0[] = { // 3 bars @@ -5182,3 +5191,4 @@ u32 GetRfuRecvQueueLength(void) { return gUnknown_03005000.unk_124.unk_8c2; } + diff --git a/src/naming_screen.c b/src/naming_screen.c index 75b7c8566..3b8ba037c 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1906,52 +1906,43 @@ static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = const struct OamData gOamData_858BFEC = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(8x8), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const struct OamData gOamData_858BFF4 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(16x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const struct OamData gOamData_858BFFC = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(32x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; static const struct Subsprite gUnknown_0858C004[] = @@ -2203,3 +2194,5 @@ static const struct SpritePalette gUnknown_0858C230[] = {gNamingScreenMenu_Pal + 0x40, 0x0007}, {NULL} }; + + diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c old mode 100755 new mode 100644 index 8ca0c8d6e..487db6d58 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -169,9 +169,14 @@ const struct OamData gOamData_85B8C60 = { .y = 160, .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), - .priority = 1 + .tileNum = 0, + .priority = 1, + .paletteNum = 0, }; const struct SpriteTemplate gUnknown_085B8C68 = @@ -521,3 +526,4 @@ static void sub_8145B24(s8 a0) sCryVolumeMeter->unk1 = r2; sCryVolumeMeter->unk2 = 5; } + diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 4ff182a0e..a5d3f8961 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -927,18 +927,15 @@ const struct SpritePalette gMonIconPaletteTable[] = const struct OamData sMonIconOamData = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(32x32), .tileNum = 0, .priority = 1, .paletteNum = 0, - .affineParam = 0 }; // fastest to slowest @@ -1311,3 +1308,5 @@ void sub_80D32C8(struct Sprite *sprite, u8 animNum) sprite->animDelayCounter = 0; sprite->animCmdIndex = 0; } + + From 02e2b1af97dc46824faa3b3b6a28dc2483c1b41d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 20:57:09 +0200 Subject: [PATCH 11/42] Use species defines in gMonIconTable --- src/pokemon_icon.c | 886 ++++++++++++++++++++++----------------------- 1 file changed, 442 insertions(+), 444 deletions(-) diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index a5d3f8961..6a135875e 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -25,446 +25,446 @@ static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8); const u8 *const gMonIconTable[] = { - gMonIcon_Bulbasaur, - gMonIcon_Bulbasaur, - gMonIcon_Ivysaur, - gMonIcon_Venusaur, - gMonIcon_Charmander, - gMonIcon_Charmeleon, - gMonIcon_Charizard, - gMonIcon_Squirtle, - gMonIcon_Wartortle, - gMonIcon_Blastoise, - gMonIcon_Caterpie, - gMonIcon_Metapod, - gMonIcon_Butterfree, - gMonIcon_Weedle, - gMonIcon_Kakuna, - gMonIcon_Beedrill, - gMonIcon_Pidgey, - gMonIcon_Pidgeotto, - gMonIcon_Pidgeot, - gMonIcon_Rattata, - gMonIcon_Raticate, - gMonIcon_Spearow, - gMonIcon_Fearow, - gMonIcon_Ekans, - gMonIcon_Arbok, - gMonIcon_Pikachu, - gMonIcon_Raichu, - gMonIcon_Sandshrew, - gMonIcon_Sandslash, - gMonIcon_NidoranF, - gMonIcon_Nidorina, - gMonIcon_Nidoqueen, - gMonIcon_NidoranM, - gMonIcon_Nidorino, - gMonIcon_Nidoking, - gMonIcon_Clefairy, - gMonIcon_Clefable, - gMonIcon_Vulpix, - gMonIcon_Ninetales, - gMonIcon_Jigglypuff, - gMonIcon_Wigglytuff, - gMonIcon_Zubat, - gMonIcon_Golbat, - gMonIcon_Oddish, - gMonIcon_Gloom, - gMonIcon_Vileplume, - gMonIcon_Paras, - gMonIcon_Parasect, - gMonIcon_Venonat, - gMonIcon_Venomoth, - gMonIcon_Diglett, - gMonIcon_Dugtrio, - gMonIcon_Meowth, - gMonIcon_Persian, - gMonIcon_Psyduck, - gMonIcon_Golduck, - gMonIcon_Mankey, - gMonIcon_Primeape, - gMonIcon_Growlithe, - gMonIcon_Arcanine, - gMonIcon_Poliwag, - gMonIcon_Poliwhirl, - gMonIcon_Poliwrath, - gMonIcon_Abra, - gMonIcon_Kadabra, - gMonIcon_Alakazam, - gMonIcon_Machop, - gMonIcon_Machoke, - gMonIcon_Machamp, - gMonIcon_Bellsprout, - gMonIcon_Weepinbell, - gMonIcon_Victreebel, - gMonIcon_Tentacool, - gMonIcon_Tentacruel, - gMonIcon_Geodude, - gMonIcon_Graveler, - gMonIcon_Golem, - gMonIcon_Ponyta, - gMonIcon_Rapidash, - gMonIcon_Slowpoke, - gMonIcon_Slowbro, - gMonIcon_Magnemite, - gMonIcon_Magneton, - gMonIcon_Farfetchd, - gMonIcon_Doduo, - gMonIcon_Dodrio, - gMonIcon_Seel, - gMonIcon_Dewgong, - gMonIcon_Grimer, - gMonIcon_Muk, - gMonIcon_Shellder, - gMonIcon_Cloyster, - gMonIcon_Gastly, - gMonIcon_Haunter, - gMonIcon_Gengar, - gMonIcon_Onix, - gMonIcon_Drowzee, - gMonIcon_Hypno, - gMonIcon_Krabby, - gMonIcon_Kingler, - gMonIcon_Voltorb, - gMonIcon_Electrode, - gMonIcon_Exeggcute, - gMonIcon_Exeggutor, - gMonIcon_Cubone, - gMonIcon_Marowak, - gMonIcon_Hitmonlee, - gMonIcon_Hitmonchan, - gMonIcon_Lickitung, - gMonIcon_Koffing, - gMonIcon_Weezing, - gMonIcon_Rhyhorn, - gMonIcon_Rhydon, - gMonIcon_Chansey, - gMonIcon_Tangela, - gMonIcon_Kangaskhan, - gMonIcon_Horsea, - gMonIcon_Seadra, - gMonIcon_Goldeen, - gMonIcon_Seaking, - gMonIcon_Staryu, - gMonIcon_Starmie, - gMonIcon_Mrmime, - gMonIcon_Scyther, - gMonIcon_Jynx, - gMonIcon_Electabuzz, - gMonIcon_Magmar, - gMonIcon_Pinsir, - gMonIcon_Tauros, - gMonIcon_Magikarp, - gMonIcon_Gyarados, - gMonIcon_Lapras, - gMonIcon_Ditto, - gMonIcon_Eevee, - gMonIcon_Vaporeon, - gMonIcon_Jolteon, - gMonIcon_Flareon, - gMonIcon_Porygon, - gMonIcon_Omanyte, - gMonIcon_Omastar, - gMonIcon_Kabuto, - gMonIcon_Kabutops, - gMonIcon_Aerodactyl, - gMonIcon_Snorlax, - gMonIcon_Articuno, - gMonIcon_Zapdos, - gMonIcon_Moltres, - gMonIcon_Dratini, - gMonIcon_Dragonair, - gMonIcon_Dragonite, - gMonIcon_Mewtwo, - gMonIcon_Mew, - gMonIcon_Chikorita, - gMonIcon_Bayleef, - gMonIcon_Meganium, - gMonIcon_Cyndaquil, - gMonIcon_Quilava, - gMonIcon_Typhlosion, - gMonIcon_Totodile, - gMonIcon_Croconaw, - gMonIcon_Feraligatr, - gMonIcon_Sentret, - gMonIcon_Furret, - gMonIcon_Hoothoot, - gMonIcon_Noctowl, - gMonIcon_Ledyba, - gMonIcon_Ledian, - gMonIcon_Spinarak, - gMonIcon_Ariados, - gMonIcon_Crobat, - gMonIcon_Chinchou, - gMonIcon_Lanturn, - gMonIcon_Pichu, - gMonIcon_Cleffa, - gMonIcon_Igglybuff, - gMonIcon_Togepi, - gMonIcon_Togetic, - gMonIcon_Natu, - gMonIcon_Xatu, - gMonIcon_Mareep, - gMonIcon_Flaaffy, - gMonIcon_Ampharos, - gMonIcon_Bellossom, - gMonIcon_Marill, - gMonIcon_Azumarill, - gMonIcon_Sudowoodo, - gMonIcon_Politoed, - gMonIcon_Hoppip, - gMonIcon_Skiploom, - gMonIcon_Jumpluff, - gMonIcon_Aipom, - gMonIcon_Sunkern, - gMonIcon_Sunflora, - gMonIcon_Yanma, - gMonIcon_Wooper, - gMonIcon_Quagsire, - gMonIcon_Espeon, - gMonIcon_Umbreon, - gMonIcon_Murkrow, - gMonIcon_Slowking, - gMonIcon_Misdreavus, - gMonIcon_UnownA, - gMonIcon_Wobbuffet, - gMonIcon_Girafarig, - gMonIcon_Pineco, - gMonIcon_Forretress, - gMonIcon_Dunsparce, - gMonIcon_Gligar, - gMonIcon_Steelix, - gMonIcon_Snubbull, - gMonIcon_Granbull, - gMonIcon_Qwilfish, - gMonIcon_Scizor, - gMonIcon_Shuckle, - gMonIcon_Heracross, - gMonIcon_Sneasel, - gMonIcon_Teddiursa, - gMonIcon_Ursaring, - gMonIcon_Slugma, - gMonIcon_Magcargo, - gMonIcon_Swinub, - gMonIcon_Piloswine, - gMonIcon_Corsola, - gMonIcon_Remoraid, - gMonIcon_Octillery, - gMonIcon_Delibird, - gMonIcon_Mantine, - gMonIcon_Skarmory, - gMonIcon_Houndour, - gMonIcon_Houndoom, - gMonIcon_Kingdra, - gMonIcon_Phanpy, - gMonIcon_Donphan, - gMonIcon_Porygon2, - gMonIcon_Stantler, - gMonIcon_Smeargle, - gMonIcon_Tyrogue, - gMonIcon_Hitmontop, - gMonIcon_Smoochum, - gMonIcon_Elekid, - gMonIcon_Magby, - gMonIcon_Miltank, - gMonIcon_Blissey, - gMonIcon_Raikou, - gMonIcon_Entei, - gMonIcon_Suicune, - gMonIcon_Larvitar, - gMonIcon_Pupitar, - gMonIcon_Tyranitar, - gMonIcon_Lugia, - gMonIcon_HoOh, - gMonIcon_Celebi, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_Treecko, - gMonIcon_Grovyle, - gMonIcon_Sceptile, - gMonIcon_Torchic, - gMonIcon_Combusken, - gMonIcon_Blaziken, - gMonIcon_Mudkip, - gMonIcon_Marshtomp, - gMonIcon_Swampert, - gMonIcon_Poochyena, - gMonIcon_Mightyena, - gMonIcon_Zigzagoon, - gMonIcon_Linoone, - gMonIcon_Wurmple, - gMonIcon_Silcoon, - gMonIcon_Beautifly, - gMonIcon_Cascoon, - gMonIcon_Dustox, - gMonIcon_Lotad, - gMonIcon_Lombre, - gMonIcon_Ludicolo, - gMonIcon_Seedot, - gMonIcon_Nuzleaf, - gMonIcon_Shiftry, - gMonIcon_Nincada, - gMonIcon_Ninjask, - gMonIcon_Shedinja, - gMonIcon_Taillow, - gMonIcon_Swellow, - gMonIcon_Shroomish, - gMonIcon_Breloom, - gMonIcon_Spinda, - gMonIcon_Wingull, - gMonIcon_Pelipper, - gMonIcon_Surskit, - gMonIcon_Masquerain, - gMonIcon_Wailmer, - gMonIcon_Wailord, - gMonIcon_Skitty, - gMonIcon_Delcatty, - gMonIcon_Kecleon, - gMonIcon_Baltoy, - gMonIcon_Claydol, - gMonIcon_Nosepass, - gMonIcon_Torkoal, - gMonIcon_Sableye, - gMonIcon_Barboach, - gMonIcon_Whiscash, - gMonIcon_Luvdisc, - gMonIcon_Corphish, - gMonIcon_Crawdaunt, - gMonIcon_Feebas, - gMonIcon_Milotic, - gMonIcon_Carvanha, - gMonIcon_Sharpedo, - gMonIcon_Trapinch, - gMonIcon_Vibrava, - gMonIcon_Flygon, - gMonIcon_Makuhita, - gMonIcon_Hariyama, - gMonIcon_Electrike, - gMonIcon_Manectric, - gMonIcon_Numel, - gMonIcon_Camerupt, - gMonIcon_Spheal, - gMonIcon_Sealeo, - gMonIcon_Walrein, - gMonIcon_Cacnea, - gMonIcon_Cacturne, - gMonIcon_Snorunt, - gMonIcon_Glalie, - gMonIcon_Lunatone, - gMonIcon_Solrock, - gMonIcon_Azurill, - gMonIcon_Spoink, - gMonIcon_Grumpig, - gMonIcon_Plusle, - gMonIcon_Minun, - gMonIcon_Mawile, - gMonIcon_Meditite, - gMonIcon_Medicham, - gMonIcon_Swablu, - gMonIcon_Altaria, - gMonIcon_Wynaut, - gMonIcon_Duskull, - gMonIcon_Dusclops, - gMonIcon_Roselia, - gMonIcon_Slakoth, - gMonIcon_Vigoroth, - gMonIcon_Slaking, - gMonIcon_Gulpin, - gMonIcon_Swalot, - gMonIcon_Tropius, - gMonIcon_Whismur, - gMonIcon_Loudred, - gMonIcon_Exploud, - gMonIcon_Clamperl, - gMonIcon_Huntail, - gMonIcon_Gorebyss, - gMonIcon_Absol, - gMonIcon_Shuppet, - gMonIcon_Banette, - gMonIcon_Seviper, - gMonIcon_Zangoose, - gMonIcon_Relicanth, - gMonIcon_Aron, - gMonIcon_Lairon, - gMonIcon_Aggron, - gMonIcon_Castform, - gMonIcon_Volbeat, - gMonIcon_Illumise, - gMonIcon_Lileep, - gMonIcon_Cradily, - gMonIcon_Anorith, - gMonIcon_Armaldo, - gMonIcon_Ralts, - gMonIcon_Kirlia, - gMonIcon_Gardevoir, - gMonIcon_Bagon, - gMonIcon_Shelgon, - gMonIcon_Salamence, - gMonIcon_Beldum, - gMonIcon_Metang, - gMonIcon_Metagross, - gMonIcon_Regirock, - gMonIcon_Regice, - gMonIcon_Registeel, - gMonIcon_Kyogre, - gMonIcon_Groudon, - gMonIcon_Rayquaza, - gMonIcon_Latias, - gMonIcon_Latios, - gMonIcon_Jirachi, - gMonIcon_Deoxys, - gMonIcon_Chimecho, - gMonIcon_Egg, - gMonIcon_UnownB, - gMonIcon_UnownC, - gMonIcon_UnownD, - gMonIcon_UnownE, - gMonIcon_UnownF, - gMonIcon_UnownG, - gMonIcon_UnownH, - gMonIcon_UnownI, - gMonIcon_UnownJ, - gMonIcon_UnownK, - gMonIcon_UnownL, - gMonIcon_UnownM, - gMonIcon_UnownN, - gMonIcon_UnownO, - gMonIcon_UnownP, - gMonIcon_UnownQ, - gMonIcon_UnownR, - gMonIcon_UnownS, - gMonIcon_UnownT, - gMonIcon_UnownU, - gMonIcon_UnownV, - gMonIcon_UnownW, - gMonIcon_UnownX, - gMonIcon_UnownY, - gMonIcon_UnownZ, - gMonIcon_UnownExclamationMark, - gMonIcon_UnownQuestionMark, + [SPECIES_NONE] = gMonIcon_Bulbasaur, + [SPECIES_BULBASAUR] = gMonIcon_Bulbasaur, + [SPECIES_IVYSAUR] = gMonIcon_Ivysaur, + [SPECIES_VENUSAUR] = gMonIcon_Venusaur, + [SPECIES_CHARMANDER] = gMonIcon_Charmander, + [SPECIES_CHARMELEON] = gMonIcon_Charmeleon, + [SPECIES_CHARIZARD] = gMonIcon_Charizard, + [SPECIES_SQUIRTLE] = gMonIcon_Squirtle, + [SPECIES_WARTORTLE] = gMonIcon_Wartortle, + [SPECIES_BLASTOISE] = gMonIcon_Blastoise, + [SPECIES_CATERPIE] = gMonIcon_Caterpie, + [SPECIES_METAPOD] = gMonIcon_Metapod, + [SPECIES_BUTTERFREE] = gMonIcon_Butterfree, + [SPECIES_WEEDLE] = gMonIcon_Weedle, + [SPECIES_KAKUNA] = gMonIcon_Kakuna, + [SPECIES_BEEDRILL] = gMonIcon_Beedrill, + [SPECIES_PIDGEY] = gMonIcon_Pidgey, + [SPECIES_PIDGEOTTO] = gMonIcon_Pidgeotto, + [SPECIES_PIDGEOT] = gMonIcon_Pidgeot, + [SPECIES_RATTATA] = gMonIcon_Rattata, + [SPECIES_RATICATE] = gMonIcon_Raticate, + [SPECIES_SPEAROW] = gMonIcon_Spearow, + [SPECIES_FEAROW] = gMonIcon_Fearow, + [SPECIES_EKANS] = gMonIcon_Ekans, + [SPECIES_ARBOK] = gMonIcon_Arbok, + [SPECIES_PIKACHU] = gMonIcon_Pikachu, + [SPECIES_RAICHU] = gMonIcon_Raichu, + [SPECIES_SANDSHREW] = gMonIcon_Sandshrew, + [SPECIES_SANDSLASH] = gMonIcon_Sandslash, + [SPECIES_NIDORAN_F] = gMonIcon_NidoranF, + [SPECIES_NIDORINA] = gMonIcon_Nidorina, + [SPECIES_NIDOQUEEN] = gMonIcon_Nidoqueen, + [SPECIES_NIDORAN_M] = gMonIcon_NidoranM, + [SPECIES_NIDORINO] = gMonIcon_Nidorino, + [SPECIES_NIDOKING] = gMonIcon_Nidoking, + [SPECIES_CLEFAIRY] = gMonIcon_Clefairy, + [SPECIES_CLEFABLE] = gMonIcon_Clefable, + [SPECIES_VULPIX] = gMonIcon_Vulpix, + [SPECIES_NINETALES] = gMonIcon_Ninetales, + [SPECIES_JIGGLYPUFF] = gMonIcon_Jigglypuff, + [SPECIES_WIGGLYTUFF] = gMonIcon_Wigglytuff, + [SPECIES_ZUBAT] = gMonIcon_Zubat, + [SPECIES_GOLBAT] = gMonIcon_Golbat, + [SPECIES_ODDISH] = gMonIcon_Oddish, + [SPECIES_GLOOM] = gMonIcon_Gloom, + [SPECIES_VILEPLUME] = gMonIcon_Vileplume, + [SPECIES_PARAS] = gMonIcon_Paras, + [SPECIES_PARASECT] = gMonIcon_Parasect, + [SPECIES_VENONAT] = gMonIcon_Venonat, + [SPECIES_VENOMOTH] = gMonIcon_Venomoth, + [SPECIES_DIGLETT] = gMonIcon_Diglett, + [SPECIES_DUGTRIO] = gMonIcon_Dugtrio, + [SPECIES_MEOWTH] = gMonIcon_Meowth, + [SPECIES_PERSIAN] = gMonIcon_Persian, + [SPECIES_PSYDUCK] = gMonIcon_Psyduck, + [SPECIES_GOLDUCK] = gMonIcon_Golduck, + [SPECIES_MANKEY] = gMonIcon_Mankey, + [SPECIES_PRIMEAPE] = gMonIcon_Primeape, + [SPECIES_GROWLITHE] = gMonIcon_Growlithe, + [SPECIES_ARCANINE] = gMonIcon_Arcanine, + [SPECIES_POLIWAG] = gMonIcon_Poliwag, + [SPECIES_POLIWHIRL] = gMonIcon_Poliwhirl, + [SPECIES_POLIWRATH] = gMonIcon_Poliwrath, + [SPECIES_ABRA] = gMonIcon_Abra, + [SPECIES_KADABRA] = gMonIcon_Kadabra, + [SPECIES_ALAKAZAM] = gMonIcon_Alakazam, + [SPECIES_MACHOP] = gMonIcon_Machop, + [SPECIES_MACHOKE] = gMonIcon_Machoke, + [SPECIES_MACHAMP] = gMonIcon_Machamp, + [SPECIES_BELLSPROUT] = gMonIcon_Bellsprout, + [SPECIES_WEEPINBELL] = gMonIcon_Weepinbell, + [SPECIES_VICTREEBEL] = gMonIcon_Victreebel, + [SPECIES_TENTACOOL] = gMonIcon_Tentacool, + [SPECIES_TENTACRUEL] = gMonIcon_Tentacruel, + [SPECIES_GEODUDE] = gMonIcon_Geodude, + [SPECIES_GRAVELER] = gMonIcon_Graveler, + [SPECIES_GOLEM] = gMonIcon_Golem, + [SPECIES_PONYTA] = gMonIcon_Ponyta, + [SPECIES_RAPIDASH] = gMonIcon_Rapidash, + [SPECIES_SLOWPOKE] = gMonIcon_Slowpoke, + [SPECIES_SLOWBRO] = gMonIcon_Slowbro, + [SPECIES_MAGNEMITE] = gMonIcon_Magnemite, + [SPECIES_MAGNETON] = gMonIcon_Magneton, + [SPECIES_FARFETCHD] = gMonIcon_Farfetchd, + [SPECIES_DODUO] = gMonIcon_Doduo, + [SPECIES_DODRIO] = gMonIcon_Dodrio, + [SPECIES_SEEL] = gMonIcon_Seel, + [SPECIES_DEWGONG] = gMonIcon_Dewgong, + [SPECIES_GRIMER] = gMonIcon_Grimer, + [SPECIES_MUK] = gMonIcon_Muk, + [SPECIES_SHELLDER] = gMonIcon_Shellder, + [SPECIES_CLOYSTER] = gMonIcon_Cloyster, + [SPECIES_GASTLY] = gMonIcon_Gastly, + [SPECIES_HAUNTER] = gMonIcon_Haunter, + [SPECIES_GENGAR] = gMonIcon_Gengar, + [SPECIES_ONIX] = gMonIcon_Onix, + [SPECIES_DROWZEE] = gMonIcon_Drowzee, + [SPECIES_HYPNO] = gMonIcon_Hypno, + [SPECIES_KRABBY] = gMonIcon_Krabby, + [SPECIES_KINGLER] = gMonIcon_Kingler, + [SPECIES_VOLTORB] = gMonIcon_Voltorb, + [SPECIES_ELECTRODE] = gMonIcon_Electrode, + [SPECIES_EXEGGCUTE] = gMonIcon_Exeggcute, + [SPECIES_EXEGGUTOR] = gMonIcon_Exeggutor, + [SPECIES_CUBONE] = gMonIcon_Cubone, + [SPECIES_MAROWAK] = gMonIcon_Marowak, + [SPECIES_HITMONLEE] = gMonIcon_Hitmonlee, + [SPECIES_HITMONCHAN] = gMonIcon_Hitmonchan, + [SPECIES_LICKITUNG] = gMonIcon_Lickitung, + [SPECIES_KOFFING] = gMonIcon_Koffing, + [SPECIES_WEEZING] = gMonIcon_Weezing, + [SPECIES_RHYHORN] = gMonIcon_Rhyhorn, + [SPECIES_RHYDON] = gMonIcon_Rhydon, + [SPECIES_CHANSEY] = gMonIcon_Chansey, + [SPECIES_TANGELA] = gMonIcon_Tangela, + [SPECIES_KANGASKHAN] = gMonIcon_Kangaskhan, + [SPECIES_HORSEA] = gMonIcon_Horsea, + [SPECIES_SEADRA] = gMonIcon_Seadra, + [SPECIES_GOLDEEN] = gMonIcon_Goldeen, + [SPECIES_SEAKING] = gMonIcon_Seaking, + [SPECIES_STARYU] = gMonIcon_Staryu, + [SPECIES_STARMIE] = gMonIcon_Starmie, + [SPECIES_MR_MIME] = gMonIcon_Mrmime, + [SPECIES_SCYTHER] = gMonIcon_Scyther, + [SPECIES_JYNX] = gMonIcon_Jynx, + [SPECIES_ELECTABUZZ] = gMonIcon_Electabuzz, + [SPECIES_MAGMAR] = gMonIcon_Magmar, + [SPECIES_PINSIR] = gMonIcon_Pinsir, + [SPECIES_TAUROS] = gMonIcon_Tauros, + [SPECIES_MAGIKARP] = gMonIcon_Magikarp, + [SPECIES_GYARADOS] = gMonIcon_Gyarados, + [SPECIES_LAPRAS] = gMonIcon_Lapras, + [SPECIES_DITTO] = gMonIcon_Ditto, + [SPECIES_EEVEE] = gMonIcon_Eevee, + [SPECIES_VAPOREON] = gMonIcon_Vaporeon, + [SPECIES_JOLTEON] = gMonIcon_Jolteon, + [SPECIES_FLAREON] = gMonIcon_Flareon, + [SPECIES_PORYGON] = gMonIcon_Porygon, + [SPECIES_OMANYTE] = gMonIcon_Omanyte, + [SPECIES_OMASTAR] = gMonIcon_Omastar, + [SPECIES_KABUTO] = gMonIcon_Kabuto, + [SPECIES_KABUTOPS] = gMonIcon_Kabutops, + [SPECIES_AERODACTYL] = gMonIcon_Aerodactyl, + [SPECIES_SNORLAX] = gMonIcon_Snorlax, + [SPECIES_ARTICUNO] = gMonIcon_Articuno, + [SPECIES_ZAPDOS] = gMonIcon_Zapdos, + [SPECIES_MOLTRES] = gMonIcon_Moltres, + [SPECIES_DRATINI] = gMonIcon_Dratini, + [SPECIES_DRAGONAIR] = gMonIcon_Dragonair, + [SPECIES_DRAGONITE] = gMonIcon_Dragonite, + [SPECIES_MEWTWO] = gMonIcon_Mewtwo, + [SPECIES_MEW] = gMonIcon_Mew, + [SPECIES_CHIKORITA] = gMonIcon_Chikorita, + [SPECIES_BAYLEEF] = gMonIcon_Bayleef, + [SPECIES_MEGANIUM] = gMonIcon_Meganium, + [SPECIES_CYNDAQUIL] = gMonIcon_Cyndaquil, + [SPECIES_QUILAVA] = gMonIcon_Quilava, + [SPECIES_TYPHLOSION] = gMonIcon_Typhlosion, + [SPECIES_TOTODILE] = gMonIcon_Totodile, + [SPECIES_CROCONAW] = gMonIcon_Croconaw, + [SPECIES_FERALIGATR] = gMonIcon_Feraligatr, + [SPECIES_SENTRET] = gMonIcon_Sentret, + [SPECIES_FURRET] = gMonIcon_Furret, + [SPECIES_HOOTHOOT] = gMonIcon_Hoothoot, + [SPECIES_NOCTOWL] = gMonIcon_Noctowl, + [SPECIES_LEDYBA] = gMonIcon_Ledyba, + [SPECIES_LEDIAN] = gMonIcon_Ledian, + [SPECIES_SPINARAK] = gMonIcon_Spinarak, + [SPECIES_ARIADOS] = gMonIcon_Ariados, + [SPECIES_CROBAT] = gMonIcon_Crobat, + [SPECIES_CHINCHOU] = gMonIcon_Chinchou, + [SPECIES_LANTURN] = gMonIcon_Lanturn, + [SPECIES_PICHU] = gMonIcon_Pichu, + [SPECIES_CLEFFA] = gMonIcon_Cleffa, + [SPECIES_IGGLYBUFF] = gMonIcon_Igglybuff, + [SPECIES_TOGEPI] = gMonIcon_Togepi, + [SPECIES_TOGETIC] = gMonIcon_Togetic, + [SPECIES_NATU] = gMonIcon_Natu, + [SPECIES_XATU] = gMonIcon_Xatu, + [SPECIES_MAREEP] = gMonIcon_Mareep, + [SPECIES_FLAAFFY] = gMonIcon_Flaaffy, + [SPECIES_AMPHAROS] = gMonIcon_Ampharos, + [SPECIES_BELLOSSOM] = gMonIcon_Bellossom, + [SPECIES_MARILL] = gMonIcon_Marill, + [SPECIES_AZUMARILL] = gMonIcon_Azumarill, + [SPECIES_SUDOWOODO] = gMonIcon_Sudowoodo, + [SPECIES_POLITOED] = gMonIcon_Politoed, + [SPECIES_HOPPIP] = gMonIcon_Hoppip, + [SPECIES_SKIPLOOM] = gMonIcon_Skiploom, + [SPECIES_JUMPLUFF] = gMonIcon_Jumpluff, + [SPECIES_AIPOM] = gMonIcon_Aipom, + [SPECIES_SUNKERN] = gMonIcon_Sunkern, + [SPECIES_SUNFLORA] = gMonIcon_Sunflora, + [SPECIES_YANMA] = gMonIcon_Yanma, + [SPECIES_WOOPER] = gMonIcon_Wooper, + [SPECIES_QUAGSIRE] = gMonIcon_Quagsire, + [SPECIES_ESPEON] = gMonIcon_Espeon, + [SPECIES_UMBREON] = gMonIcon_Umbreon, + [SPECIES_MURKROW] = gMonIcon_Murkrow, + [SPECIES_SLOWKING] = gMonIcon_Slowking, + [SPECIES_MISDREAVUS] = gMonIcon_Misdreavus, + [SPECIES_UNOWN] = gMonIcon_UnownA, + [SPECIES_WOBBUFFET] = gMonIcon_Wobbuffet, + [SPECIES_GIRAFARIG] = gMonIcon_Girafarig, + [SPECIES_PINECO] = gMonIcon_Pineco, + [SPECIES_FORRETRESS] = gMonIcon_Forretress, + [SPECIES_DUNSPARCE] = gMonIcon_Dunsparce, + [SPECIES_GLIGAR] = gMonIcon_Gligar, + [SPECIES_STEELIX] = gMonIcon_Steelix, + [SPECIES_SNUBBULL] = gMonIcon_Snubbull, + [SPECIES_GRANBULL] = gMonIcon_Granbull, + [SPECIES_QWILFISH] = gMonIcon_Qwilfish, + [SPECIES_SCIZOR] = gMonIcon_Scizor, + [SPECIES_SHUCKLE] = gMonIcon_Shuckle, + [SPECIES_HERACROSS] = gMonIcon_Heracross, + [SPECIES_SNEASEL] = gMonIcon_Sneasel, + [SPECIES_TEDDIURSA] = gMonIcon_Teddiursa, + [SPECIES_URSARING] = gMonIcon_Ursaring, + [SPECIES_SLUGMA] = gMonIcon_Slugma, + [SPECIES_MAGCARGO] = gMonIcon_Magcargo, + [SPECIES_SWINUB] = gMonIcon_Swinub, + [SPECIES_PILOSWINE] = gMonIcon_Piloswine, + [SPECIES_CORSOLA] = gMonIcon_Corsola, + [SPECIES_REMORAID] = gMonIcon_Remoraid, + [SPECIES_OCTILLERY] = gMonIcon_Octillery, + [SPECIES_DELIBIRD] = gMonIcon_Delibird, + [SPECIES_MANTINE] = gMonIcon_Mantine, + [SPECIES_SKARMORY] = gMonIcon_Skarmory, + [SPECIES_HOUNDOUR] = gMonIcon_Houndour, + [SPECIES_HOUNDOOM] = gMonIcon_Houndoom, + [SPECIES_KINGDRA] = gMonIcon_Kingdra, + [SPECIES_PHANPY] = gMonIcon_Phanpy, + [SPECIES_DONPHAN] = gMonIcon_Donphan, + [SPECIES_PORYGON2] = gMonIcon_Porygon2, + [SPECIES_STANTLER] = gMonIcon_Stantler, + [SPECIES_SMEARGLE] = gMonIcon_Smeargle, + [SPECIES_TYROGUE] = gMonIcon_Tyrogue, + [SPECIES_HITMONTOP] = gMonIcon_Hitmontop, + [SPECIES_SMOOCHUM] = gMonIcon_Smoochum, + [SPECIES_ELEKID] = gMonIcon_Elekid, + [SPECIES_MAGBY] = gMonIcon_Magby, + [SPECIES_MILTANK] = gMonIcon_Miltank, + [SPECIES_BLISSEY] = gMonIcon_Blissey, + [SPECIES_RAIKOU] = gMonIcon_Raikou, + [SPECIES_ENTEI] = gMonIcon_Entei, + [SPECIES_SUICUNE] = gMonIcon_Suicune, + [SPECIES_LARVITAR] = gMonIcon_Larvitar, + [SPECIES_PUPITAR] = gMonIcon_Pupitar, + [SPECIES_TYRANITAR] = gMonIcon_Tyranitar, + [SPECIES_LUGIA] = gMonIcon_Lugia, + [SPECIES_HO_OH] = gMonIcon_HoOh, + [SPECIES_CELEBI] = gMonIcon_Celebi, + [SPECIES_OLD_UNOWN_B] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_C] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_D] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_E] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_F] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_G] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_H] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_I] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_J] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_K] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_L] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_M] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_N] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_O] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_P] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Q] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_R] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_S] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_T] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_U] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_V] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_W] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_X] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Y] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Z] = gMonIcon_QuestionMark, + [SPECIES_TREECKO] = gMonIcon_Treecko, + [SPECIES_GROVYLE] = gMonIcon_Grovyle, + [SPECIES_SCEPTILE] = gMonIcon_Sceptile, + [SPECIES_TORCHIC] = gMonIcon_Torchic, + [SPECIES_COMBUSKEN] = gMonIcon_Combusken, + [SPECIES_BLAZIKEN] = gMonIcon_Blaziken, + [SPECIES_MUDKIP] = gMonIcon_Mudkip, + [SPECIES_MARSHTOMP] = gMonIcon_Marshtomp, + [SPECIES_SWAMPERT] = gMonIcon_Swampert, + [SPECIES_POOCHYENA] = gMonIcon_Poochyena, + [SPECIES_MIGHTYENA] = gMonIcon_Mightyena, + [SPECIES_ZIGZAGOON] = gMonIcon_Zigzagoon, + [SPECIES_LINOONE] = gMonIcon_Linoone, + [SPECIES_WURMPLE] = gMonIcon_Wurmple, + [SPECIES_SILCOON] = gMonIcon_Silcoon, + [SPECIES_BEAUTIFLY] = gMonIcon_Beautifly, + [SPECIES_CASCOON] = gMonIcon_Cascoon, + [SPECIES_DUSTOX] = gMonIcon_Dustox, + [SPECIES_LOTAD] = gMonIcon_Lotad, + [SPECIES_LOMBRE] = gMonIcon_Lombre, + [SPECIES_LUDICOLO] = gMonIcon_Ludicolo, + [SPECIES_SEEDOT] = gMonIcon_Seedot, + [SPECIES_NUZLEAF] = gMonIcon_Nuzleaf, + [SPECIES_SHIFTRY] = gMonIcon_Shiftry, + [SPECIES_NINCADA] = gMonIcon_Nincada, + [SPECIES_NINJASK] = gMonIcon_Ninjask, + [SPECIES_SHEDINJA] = gMonIcon_Shedinja, + [SPECIES_TAILLOW] = gMonIcon_Taillow, + [SPECIES_SWELLOW] = gMonIcon_Swellow, + [SPECIES_SHROOMISH] = gMonIcon_Shroomish, + [SPECIES_BRELOOM] = gMonIcon_Breloom, + [SPECIES_SPINDA] = gMonIcon_Spinda, + [SPECIES_WINGULL] = gMonIcon_Wingull, + [SPECIES_PELIPPER] = gMonIcon_Pelipper, + [SPECIES_SURSKIT] = gMonIcon_Surskit, + [SPECIES_MASQUERAIN] = gMonIcon_Masquerain, + [SPECIES_WAILMER] = gMonIcon_Wailmer, + [SPECIES_WAILORD] = gMonIcon_Wailord, + [SPECIES_SKITTY] = gMonIcon_Skitty, + [SPECIES_DELCATTY] = gMonIcon_Delcatty, + [SPECIES_KECLEON] = gMonIcon_Kecleon, + [SPECIES_BALTOY] = gMonIcon_Baltoy, + [SPECIES_CLAYDOL] = gMonIcon_Claydol, + [SPECIES_NOSEPASS] = gMonIcon_Nosepass, + [SPECIES_TORKOAL] = gMonIcon_Torkoal, + [SPECIES_SABLEYE] = gMonIcon_Sableye, + [SPECIES_BARBOACH] = gMonIcon_Barboach, + [SPECIES_WHISCASH] = gMonIcon_Whiscash, + [SPECIES_LUVDISC] = gMonIcon_Luvdisc, + [SPECIES_CORPHISH] = gMonIcon_Corphish, + [SPECIES_CRAWDAUNT] = gMonIcon_Crawdaunt, + [SPECIES_FEEBAS] = gMonIcon_Feebas, + [SPECIES_MILOTIC] = gMonIcon_Milotic, + [SPECIES_CARVANHA] = gMonIcon_Carvanha, + [SPECIES_SHARPEDO] = gMonIcon_Sharpedo, + [SPECIES_TRAPINCH] = gMonIcon_Trapinch, + [SPECIES_VIBRAVA] = gMonIcon_Vibrava, + [SPECIES_FLYGON] = gMonIcon_Flygon, + [SPECIES_MAKUHITA] = gMonIcon_Makuhita, + [SPECIES_HARIYAMA] = gMonIcon_Hariyama, + [SPECIES_ELECTRIKE] = gMonIcon_Electrike, + [SPECIES_MANECTRIC] = gMonIcon_Manectric, + [SPECIES_NUMEL] = gMonIcon_Numel, + [SPECIES_CAMERUPT] = gMonIcon_Camerupt, + [SPECIES_SPHEAL] = gMonIcon_Spheal, + [SPECIES_SEALEO] = gMonIcon_Sealeo, + [SPECIES_WALREIN] = gMonIcon_Walrein, + [SPECIES_CACNEA] = gMonIcon_Cacnea, + [SPECIES_CACTURNE] = gMonIcon_Cacturne, + [SPECIES_SNORUNT] = gMonIcon_Snorunt, + [SPECIES_GLALIE] = gMonIcon_Glalie, + [SPECIES_LUNATONE] = gMonIcon_Lunatone, + [SPECIES_SOLROCK] = gMonIcon_Solrock, + [SPECIES_AZURILL] = gMonIcon_Azurill, + [SPECIES_SPOINK] = gMonIcon_Spoink, + [SPECIES_GRUMPIG] = gMonIcon_Grumpig, + [SPECIES_PLUSLE] = gMonIcon_Plusle, + [SPECIES_MINUN] = gMonIcon_Minun, + [SPECIES_MAWILE] = gMonIcon_Mawile, + [SPECIES_MEDITITE] = gMonIcon_Meditite, + [SPECIES_MEDICHAM] = gMonIcon_Medicham, + [SPECIES_SWABLU] = gMonIcon_Swablu, + [SPECIES_ALTARIA] = gMonIcon_Altaria, + [SPECIES_WYNAUT] = gMonIcon_Wynaut, + [SPECIES_DUSKULL] = gMonIcon_Duskull, + [SPECIES_DUSCLOPS] = gMonIcon_Dusclops, + [SPECIES_ROSELIA] = gMonIcon_Roselia, + [SPECIES_SLAKOTH] = gMonIcon_Slakoth, + [SPECIES_VIGOROTH] = gMonIcon_Vigoroth, + [SPECIES_SLAKING] = gMonIcon_Slaking, + [SPECIES_GULPIN] = gMonIcon_Gulpin, + [SPECIES_SWALOT] = gMonIcon_Swalot, + [SPECIES_TROPIUS] = gMonIcon_Tropius, + [SPECIES_WHISMUR] = gMonIcon_Whismur, + [SPECIES_LOUDRED] = gMonIcon_Loudred, + [SPECIES_EXPLOUD] = gMonIcon_Exploud, + [SPECIES_CLAMPERL] = gMonIcon_Clamperl, + [SPECIES_HUNTAIL] = gMonIcon_Huntail, + [SPECIES_GOREBYSS] = gMonIcon_Gorebyss, + [SPECIES_ABSOL] = gMonIcon_Absol, + [SPECIES_SHUPPET] = gMonIcon_Shuppet, + [SPECIES_BANETTE] = gMonIcon_Banette, + [SPECIES_SEVIPER] = gMonIcon_Seviper, + [SPECIES_ZANGOOSE] = gMonIcon_Zangoose, + [SPECIES_RELICANTH] = gMonIcon_Relicanth, + [SPECIES_ARON] = gMonIcon_Aron, + [SPECIES_LAIRON] = gMonIcon_Lairon, + [SPECIES_AGGRON] = gMonIcon_Aggron, + [SPECIES_CASTFORM] = gMonIcon_Castform, + [SPECIES_VOLBEAT] = gMonIcon_Volbeat, + [SPECIES_ILLUMISE] = gMonIcon_Illumise, + [SPECIES_LILEEP] = gMonIcon_Lileep, + [SPECIES_CRADILY] = gMonIcon_Cradily, + [SPECIES_ANORITH] = gMonIcon_Anorith, + [SPECIES_ARMALDO] = gMonIcon_Armaldo, + [SPECIES_RALTS] = gMonIcon_Ralts, + [SPECIES_KIRLIA] = gMonIcon_Kirlia, + [SPECIES_GARDEVOIR] = gMonIcon_Gardevoir, + [SPECIES_BAGON] = gMonIcon_Bagon, + [SPECIES_SHELGON] = gMonIcon_Shelgon, + [SPECIES_SALAMENCE] = gMonIcon_Salamence, + [SPECIES_BELDUM] = gMonIcon_Beldum, + [SPECIES_METANG] = gMonIcon_Metang, + [SPECIES_METAGROSS] = gMonIcon_Metagross, + [SPECIES_REGIROCK] = gMonIcon_Regirock, + [SPECIES_REGICE] = gMonIcon_Regice, + [SPECIES_REGISTEEL] = gMonIcon_Registeel, + [SPECIES_KYOGRE] = gMonIcon_Kyogre, + [SPECIES_GROUDON] = gMonIcon_Groudon, + [SPECIES_RAYQUAZA] = gMonIcon_Rayquaza, + [SPECIES_LATIAS] = gMonIcon_Latias, + [SPECIES_LATIOS] = gMonIcon_Latios, + [SPECIES_JIRACHI] = gMonIcon_Jirachi, + [SPECIES_DEOXYS] = gMonIcon_Deoxys, + [SPECIES_CHIMECHO] = gMonIcon_Chimecho, + [SPECIES_EGG] = gMonIcon_Egg, + [SPECIES_UNOWN_B] = gMonIcon_UnownB, + [SPECIES_UNOWN_C] = gMonIcon_UnownC, + [SPECIES_UNOWN_D] = gMonIcon_UnownD, + [SPECIES_UNOWN_E] = gMonIcon_UnownE, + [SPECIES_UNOWN_F] = gMonIcon_UnownF, + [SPECIES_UNOWN_G] = gMonIcon_UnownG, + [SPECIES_UNOWN_H] = gMonIcon_UnownH, + [SPECIES_UNOWN_I] = gMonIcon_UnownI, + [SPECIES_UNOWN_J] = gMonIcon_UnownJ, + [SPECIES_UNOWN_K] = gMonIcon_UnownK, + [SPECIES_UNOWN_L] = gMonIcon_UnownL, + [SPECIES_UNOWN_M] = gMonIcon_UnownM, + [SPECIES_UNOWN_N] = gMonIcon_UnownN, + [SPECIES_UNOWN_O] = gMonIcon_UnownO, + [SPECIES_UNOWN_P] = gMonIcon_UnownP, + [SPECIES_UNOWN_Q] = gMonIcon_UnownQ, + [SPECIES_UNOWN_R] = gMonIcon_UnownR, + [SPECIES_UNOWN_S] = gMonIcon_UnownS, + [SPECIES_UNOWN_T] = gMonIcon_UnownT, + [SPECIES_UNOWN_U] = gMonIcon_UnownU, + [SPECIES_UNOWN_V] = gMonIcon_UnownV, + [SPECIES_UNOWN_W] = gMonIcon_UnownW, + [SPECIES_UNOWN_X] = gMonIcon_UnownX, + [SPECIES_UNOWN_Y] = gMonIcon_UnownY, + [SPECIES_UNOWN_Z] = gMonIcon_UnownZ, + [SPECIES_UNOWN_EMARK] = gMonIcon_UnownExclamationMark, + [SPECIES_UNOWN_QMARK] = gMonIcon_UnownQuestionMark, }; const u8 gMonIconPaletteIndices[] = @@ -1138,7 +1138,7 @@ void sub_80D2EF8(struct Sprite *sprite) void LoadMonIconPalettes(void) { u8 i; - for (i = 0; i < 6; i++) + for (i = 0; i < ARRAY_COUNT(gMonIconPaletteTable); i++) LoadSpritePalette(&gMonIconPaletteTable[i]); } @@ -1192,7 +1192,7 @@ void sub_80D3014(struct Sprite *sprite) const u8* GetMonIconTiles(u16 species, bool32 extra) { const u8* iconSprite = gMonIconTable[species]; - if(species == SPECIES_DEOXYS && extra == TRUE) + if (species == SPECIES_DEOXYS && extra == TRUE) { iconSprite = (const u8*)(0x400 + (u32)iconSprite); //WTF? } @@ -1308,5 +1308,3 @@ void sub_80D32C8(struct Sprite *sprite, u8 animNum) sprite->animDelayCounter = 0; sprite->animCmdIndex = 0; } - - From 2745cdc7d26e84d7efc5349519a494610390e130 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 18:02:43 +0200 Subject: [PATCH 12/42] Remove unneeded sMonAnimationDelayTable entries --- src/pokemon.c | 358 +------------------------------------------------- 1 file changed, 1 insertion(+), 357 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 7c26b4c22..984c484a2 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1810,419 +1810,63 @@ static const u8 sMonFrontAnimIdsTable[] = [SPECIES_CHIMECHO - 1] = 0x1d, }; -static const u8 sMonAnimationDelayTable[] = +static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] = { - [SPECIES_BULBASAUR - 1] = 0x00, - [SPECIES_IVYSAUR - 1] = 0x00, - [SPECIES_VENUSAUR - 1] = 0x00, - [SPECIES_CHARMANDER - 1] = 0x00, - [SPECIES_CHARMELEON - 1] = 0x00, - [SPECIES_CHARIZARD - 1] = 0x00, - [SPECIES_SQUIRTLE - 1] = 0x00, - [SPECIES_WARTORTLE - 1] = 0x00, [SPECIES_BLASTOISE - 1] = 0x32, - [SPECIES_CATERPIE - 1] = 0x00, - [SPECIES_METAPOD - 1] = 0x00, - [SPECIES_BUTTERFREE - 1] = 0x00, [SPECIES_WEEDLE - 1] = 0x0a, [SPECIES_KAKUNA - 1] = 0x14, [SPECIES_BEEDRILL - 1] = 0x23, - [SPECIES_PIDGEY - 1] = 0x00, [SPECIES_PIDGEOTTO - 1] = 0x19, - [SPECIES_PIDGEOT - 1] = 0x00, - [SPECIES_RATTATA - 1] = 0x00, - [SPECIES_RATICATE - 1] = 0x00, - [SPECIES_SPEAROW - 1] = 0x00, [SPECIES_FEAROW - 1] = 0x02, [SPECIES_EKANS - 1] = 0x1e, - [SPECIES_ARBOK - 1] = 0x00, - [SPECIES_PIKACHU - 1] = 0x00, - [SPECIES_RAICHU - 1] = 0x00, - [SPECIES_SANDSHREW - 1] = 0x00, - [SPECIES_SANDSLASH - 1] = 0x00, [SPECIES_NIDORAN_F - 1] = 0x1c, - [SPECIES_NIDORINA - 1] = 0x00, - [SPECIES_NIDOQUEEN - 1] = 0x00, - [SPECIES_NIDORAN_M - 1] = 0x00, - [SPECIES_NIDORINO - 1] = 0x00, [SPECIES_NIDOKING - 1] = 0x19, - [SPECIES_CLEFAIRY - 1] = 0x00, - [SPECIES_CLEFABLE - 1] = 0x00, - [SPECIES_VULPIX - 1] = 0x00, - [SPECIES_NINETALES - 1] = 0x00, - [SPECIES_JIGGLYPUFF - 1] = 0x00, - [SPECIES_WIGGLYTUFF - 1] = 0x00, - [SPECIES_ZUBAT - 1] = 0x00, - [SPECIES_GOLBAT - 1] = 0x00, - [SPECIES_ODDISH - 1] = 0x00, - [SPECIES_GLOOM - 1] = 0x00, - [SPECIES_VILEPLUME - 1] = 0x00, [SPECIES_PARAS - 1] = 0x0a, [SPECIES_PARASECT - 1] = 0x2d, [SPECIES_VENONAT - 1] = 0x14, - [SPECIES_VENOMOTH - 1] = 0x00, [SPECIES_DIGLETT - 1] = 0x19, [SPECIES_DUGTRIO - 1] = 0x23, [SPECIES_MEOWTH - 1] = 0x28, [SPECIES_PERSIAN - 1] = 0x14, - [SPECIES_PSYDUCK - 1] = 0x00, - [SPECIES_GOLDUCK - 1] = 0x00, [SPECIES_MANKEY - 1] = 0x14, - [SPECIES_PRIMEAPE - 1] = 0x00, [SPECIES_GROWLITHE - 1] = 0x1e, [SPECIES_ARCANINE - 1] = 0x28, - [SPECIES_POLIWAG - 1] = 0x00, [SPECIES_POLIWHIRL - 1] = 0x05, - [SPECIES_POLIWRATH - 1] = 0x00, - [SPECIES_ABRA - 1] = 0x00, - [SPECIES_KADABRA - 1] = 0x00, - [SPECIES_ALAKAZAM - 1] = 0x00, - [SPECIES_MACHOP - 1] = 0x00, - [SPECIES_MACHOKE - 1] = 0x00, - [SPECIES_MACHAMP - 1] = 0x00, - [SPECIES_BELLSPROUT - 1] = 0x00, [SPECIES_WEEPINBELL - 1] = 0x03, - [SPECIES_VICTREEBEL - 1] = 0x00, - [SPECIES_TENTACOOL - 1] = 0x00, - [SPECIES_TENTACRUEL - 1] = 0x00, - [SPECIES_GEODUDE - 1] = 0x00, - [SPECIES_GRAVELER - 1] = 0x00, - [SPECIES_GOLEM - 1] = 0x00, - [SPECIES_PONYTA - 1] = 0x00, - [SPECIES_RAPIDASH - 1] = 0x00, - [SPECIES_SLOWPOKE - 1] = 0x00, - [SPECIES_SLOWBRO - 1] = 0x00, - [SPECIES_MAGNEMITE - 1] = 0x00, - [SPECIES_MAGNETON - 1] = 0x00, - [SPECIES_FARFETCHD - 1] = 0x00, - [SPECIES_DODUO - 1] = 0x00, - [SPECIES_DODRIO - 1] = 0x00, - [SPECIES_SEEL - 1] = 0x00, - [SPECIES_DEWGONG - 1] = 0x00, - [SPECIES_GRIMER - 1] = 0x00, [SPECIES_MUK - 1] = 0x2d, [SPECIES_SHELLDER - 1] = 0x14, - [SPECIES_CLOYSTER - 1] = 0x00, - [SPECIES_GASTLY - 1] = 0x00, [SPECIES_HAUNTER - 1] = 0x17, - [SPECIES_GENGAR - 1] = 0x00, - [SPECIES_ONIX - 1] = 0x00, [SPECIES_DROWZEE - 1] = 0x30, [SPECIES_HYPNO - 1] = 0x28, - [SPECIES_KRABBY - 1] = 0x00, - [SPECIES_KINGLER - 1] = 0x00, - [SPECIES_VOLTORB - 1] = 0x00, - [SPECIES_ELECTRODE - 1] = 0x00, - [SPECIES_EXEGGCUTE - 1] = 0x00, - [SPECIES_EXEGGUTOR - 1] = 0x00, - [SPECIES_CUBONE - 1] = 0x00, - [SPECIES_MAROWAK - 1] = 0x00, - [SPECIES_HITMONLEE - 1] = 0x00, [SPECIES_HITMONCHAN - 1] = 0x19, - [SPECIES_LICKITUNG - 1] = 0x00, - [SPECIES_KOFFING - 1] = 0x00, - [SPECIES_WEEZING - 1] = 0x00, - [SPECIES_RHYHORN - 1] = 0x00, - [SPECIES_RHYDON - 1] = 0x00, - [SPECIES_CHANSEY - 1] = 0x00, - [SPECIES_TANGELA - 1] = 0x00, - [SPECIES_KANGASKHAN - 1] = 0x00, - [SPECIES_HORSEA - 1] = 0x00, - [SPECIES_SEADRA - 1] = 0x00, - [SPECIES_GOLDEEN - 1] = 0x00, - [SPECIES_SEAKING - 1] = 0x00, - [SPECIES_STARYU - 1] = 0x00, - [SPECIES_STARMIE - 1] = 0x00, - [SPECIES_MR_MIME - 1] = 0x00, [SPECIES_SCYTHER - 1] = 0x0a, - [SPECIES_JYNX - 1] = 0x00, - [SPECIES_ELECTABUZZ - 1] = 0x00, - [SPECIES_MAGMAR - 1] = 0x00, - [SPECIES_PINSIR - 1] = 0x00, [SPECIES_TAUROS - 1] = 0x0a, - [SPECIES_MAGIKARP - 1] = 0x00, - [SPECIES_GYARADOS - 1] = 0x00, - [SPECIES_LAPRAS - 1] = 0x00, - [SPECIES_DITTO - 1] = 0x00, - [SPECIES_EEVEE - 1] = 0x00, - [SPECIES_VAPOREON - 1] = 0x00, - [SPECIES_JOLTEON - 1] = 0x00, - [SPECIES_FLAREON - 1] = 0x00, - [SPECIES_PORYGON - 1] = 0x00, - [SPECIES_OMANYTE - 1] = 0x00, - [SPECIES_OMASTAR - 1] = 0x00, - [SPECIES_KABUTO - 1] = 0x00, - [SPECIES_KABUTOPS - 1] = 0x00, - [SPECIES_AERODACTYL - 1] = 0x00, - [SPECIES_SNORLAX - 1] = 0x00, - [SPECIES_ARTICUNO - 1] = 0x00, - [SPECIES_ZAPDOS - 1] = 0x00, - [SPECIES_MOLTRES - 1] = 0x00, - [SPECIES_DRATINI - 1] = 0x00, - [SPECIES_DRAGONAIR - 1] = 0x00, - [SPECIES_DRAGONITE - 1] = 0x00, - [SPECIES_MEWTWO - 1] = 0x00, - [SPECIES_MEW - 1] = 0x00, - [SPECIES_CHIKORITA - 1] = 0x00, - [SPECIES_BAYLEEF - 1] = 0x00, - [SPECIES_MEGANIUM - 1] = 0x00, - [SPECIES_CYNDAQUIL - 1] = 0x00, - [SPECIES_QUILAVA - 1] = 0x00, [SPECIES_TYPHLOSION - 1] = 0x14, - [SPECIES_TOTODILE - 1] = 0x00, - [SPECIES_CROCONAW - 1] = 0x00, [SPECIES_FERALIGATR - 1] = 0x05, - [SPECIES_SENTRET - 1] = 0x00, - [SPECIES_FURRET - 1] = 0x00, - [SPECIES_HOOTHOOT - 1] = 0x00, - [SPECIES_NOCTOWL - 1] = 0x00, - [SPECIES_LEDYBA - 1] = 0x00, - [SPECIES_LEDIAN - 1] = 0x00, - [SPECIES_SPINARAK - 1] = 0x00, - [SPECIES_ARIADOS - 1] = 0x00, - [SPECIES_CROBAT - 1] = 0x00, - [SPECIES_CHINCHOU - 1] = 0x00, - [SPECIES_LANTURN - 1] = 0x00, - [SPECIES_PICHU - 1] = 0x00, - [SPECIES_CLEFFA - 1] = 0x00, - [SPECIES_IGGLYBUFF - 1] = 0x00, - [SPECIES_TOGEPI - 1] = 0x00, - [SPECIES_TOGETIC - 1] = 0x00, [SPECIES_NATU - 1] = 0x1e, - [SPECIES_XATU - 1] = 0x00, [SPECIES_MAREEP - 1] = 0x32, - [SPECIES_FLAAFFY - 1] = 0x00, [SPECIES_AMPHAROS - 1] = 0x0a, - [SPECIES_BELLOSSOM - 1] = 0x00, - [SPECIES_MARILL - 1] = 0x00, - [SPECIES_AZUMARILL - 1] = 0x00, - [SPECIES_SUDOWOODO - 1] = 0x00, [SPECIES_POLITOED - 1] = 0x28, - [SPECIES_HOPPIP - 1] = 0x00, - [SPECIES_SKIPLOOM - 1] = 0x00, - [SPECIES_JUMPLUFF - 1] = 0x00, - [SPECIES_AIPOM - 1] = 0x00, - [SPECIES_SUNKERN - 1] = 0x00, - [SPECIES_SUNFLORA - 1] = 0x00, - [SPECIES_YANMA - 1] = 0x00, - [SPECIES_WOOPER - 1] = 0x00, - [SPECIES_QUAGSIRE - 1] = 0x00, - [SPECIES_ESPEON - 1] = 0x00, - [SPECIES_UMBREON - 1] = 0x00, - [SPECIES_MURKROW - 1] = 0x00, - [SPECIES_SLOWKING - 1] = 0x00, - [SPECIES_MISDREAVUS - 1] = 0x00, - [SPECIES_UNOWN - 1] = 0x00, - [SPECIES_WOBBUFFET - 1] = 0x00, - [SPECIES_GIRAFARIG - 1] = 0x00, - [SPECIES_PINECO - 1] = 0x00, - [SPECIES_FORRETRESS - 1] = 0x00, [SPECIES_DUNSPARCE - 1] = 0x0a, - [SPECIES_GLIGAR - 1] = 0x00, [SPECIES_STEELIX - 1] = 0x2d, - [SPECIES_SNUBBULL - 1] = 0x00, - [SPECIES_GRANBULL - 1] = 0x00, [SPECIES_QWILFISH - 1] = 0x27, [SPECIES_SCIZOR - 1] = 0x13, - [SPECIES_SHUCKLE - 1] = 0x00, - [SPECIES_HERACROSS - 1] = 0x00, - [SPECIES_SNEASEL - 1] = 0x00, - [SPECIES_TEDDIURSA - 1] = 0x00, - [SPECIES_URSARING - 1] = 0x00, - [SPECIES_SLUGMA - 1] = 0x00, - [SPECIES_MAGCARGO - 1] = 0x00, - [SPECIES_SWINUB - 1] = 0x00, - [SPECIES_PILOSWINE - 1] = 0x00, - [SPECIES_CORSOLA - 1] = 0x00, - [SPECIES_REMORAID - 1] = 0x00, [SPECIES_OCTILLERY - 1] = 0x14, - [SPECIES_DELIBIRD - 1] = 0x00, - [SPECIES_MANTINE - 1] = 0x00, - [SPECIES_SKARMORY - 1] = 0x00, - [SPECIES_HOUNDOUR - 1] = 0x00, - [SPECIES_HOUNDOOM - 1] = 0x00, - [SPECIES_KINGDRA - 1] = 0x00, - [SPECIES_PHANPY - 1] = 0x00, - [SPECIES_DONPHAN - 1] = 0x00, - [SPECIES_PORYGON2 - 1] = 0x00, - [SPECIES_STANTLER - 1] = 0x00, - [SPECIES_SMEARGLE - 1] = 0x00, - [SPECIES_TYROGUE - 1] = 0x00, - [SPECIES_HITMONTOP - 1] = 0x00, [SPECIES_SMOOCHUM - 1] = 0x28, - [SPECIES_ELEKID - 1] = 0x00, - [SPECIES_MAGBY - 1] = 0x00, - [SPECIES_MILTANK - 1] = 0x00, - [SPECIES_BLISSEY - 1] = 0x00, - [SPECIES_RAIKOU - 1] = 0x00, - [SPECIES_ENTEI - 1] = 0x00, - [SPECIES_SUICUNE - 1] = 0x00, - [SPECIES_LARVITAR - 1] = 0x00, - [SPECIES_PUPITAR - 1] = 0x00, [SPECIES_TYRANITAR - 1] = 0x0a, [SPECIES_LUGIA - 1] = 0x14, - [SPECIES_HO_OH - 1] = 0x00, - [SPECIES_CELEBI - 1] = 0x00, - [SPECIES_OLD_UNOWN_B - 1] = 0x00, - [SPECIES_OLD_UNOWN_C - 1] = 0x00, - [SPECIES_OLD_UNOWN_D - 1] = 0x00, - [SPECIES_OLD_UNOWN_E - 1] = 0x00, - [SPECIES_OLD_UNOWN_F - 1] = 0x00, - [SPECIES_OLD_UNOWN_G - 1] = 0x00, - [SPECIES_OLD_UNOWN_H - 1] = 0x00, - [SPECIES_OLD_UNOWN_I - 1] = 0x00, - [SPECIES_OLD_UNOWN_J - 1] = 0x00, - [SPECIES_OLD_UNOWN_K - 1] = 0x00, - [SPECIES_OLD_UNOWN_L - 1] = 0x00, - [SPECIES_OLD_UNOWN_M - 1] = 0x00, - [SPECIES_OLD_UNOWN_N - 1] = 0x00, - [SPECIES_OLD_UNOWN_O - 1] = 0x00, - [SPECIES_OLD_UNOWN_P - 1] = 0x00, - [SPECIES_OLD_UNOWN_Q - 1] = 0x00, - [SPECIES_OLD_UNOWN_R - 1] = 0x00, - [SPECIES_OLD_UNOWN_S - 1] = 0x00, - [SPECIES_OLD_UNOWN_T - 1] = 0x00, - [SPECIES_OLD_UNOWN_U - 1] = 0x00, - [SPECIES_OLD_UNOWN_V - 1] = 0x00, - [SPECIES_OLD_UNOWN_W - 1] = 0x00, - [SPECIES_OLD_UNOWN_X - 1] = 0x00, - [SPECIES_OLD_UNOWN_Y - 1] = 0x00, - [SPECIES_OLD_UNOWN_Z - 1] = 0x00, - [SPECIES_TREECKO - 1] = 0x00, - [SPECIES_GROVYLE - 1] = 0x00, - [SPECIES_SCEPTILE - 1] = 0x00, - [SPECIES_TORCHIC - 1] = 0x00, - [SPECIES_COMBUSKEN - 1] = 0x00, - [SPECIES_BLAZIKEN - 1] = 0x00, - [SPECIES_MUDKIP - 1] = 0x00, - [SPECIES_MARSHTOMP - 1] = 0x00, - [SPECIES_SWAMPERT - 1] = 0x00, - [SPECIES_POOCHYENA - 1] = 0x00, - [SPECIES_MIGHTYENA - 1] = 0x00, - [SPECIES_ZIGZAGOON - 1] = 0x00, - [SPECIES_LINOONE - 1] = 0x00, - [SPECIES_WURMPLE - 1] = 0x00, - [SPECIES_SILCOON - 1] = 0x00, - [SPECIES_BEAUTIFLY - 1] = 0x00, - [SPECIES_CASCOON - 1] = 0x00, - [SPECIES_DUSTOX - 1] = 0x00, - [SPECIES_LOTAD - 1] = 0x00, - [SPECIES_LOMBRE - 1] = 0x00, - [SPECIES_LUDICOLO - 1] = 0x00, - [SPECIES_SEEDOT - 1] = 0x00, - [SPECIES_NUZLEAF - 1] = 0x00, - [SPECIES_SHIFTRY - 1] = 0x00, - [SPECIES_NINCADA - 1] = 0x00, - [SPECIES_NINJASK - 1] = 0x00, - [SPECIES_SHEDINJA - 1] = 0x00, - [SPECIES_TAILLOW - 1] = 0x00, - [SPECIES_SWELLOW - 1] = 0x00, - [SPECIES_SHROOMISH - 1] = 0x00, - [SPECIES_BRELOOM - 1] = 0x00, - [SPECIES_SPINDA - 1] = 0x00, - [SPECIES_WINGULL - 1] = 0x00, - [SPECIES_PELIPPER - 1] = 0x00, - [SPECIES_SURSKIT - 1] = 0x00, - [SPECIES_MASQUERAIN - 1] = 0x00, - [SPECIES_WAILMER - 1] = 0x00, [SPECIES_WAILORD - 1] = 0x0a, - [SPECIES_SKITTY - 1] = 0x00, - [SPECIES_DELCATTY - 1] = 0x00, [SPECIES_KECLEON - 1] = 0x1e, - [SPECIES_BALTOY - 1] = 0x00, - [SPECIES_CLAYDOL - 1] = 0x00, - [SPECIES_NOSEPASS - 1] = 0x00, - [SPECIES_TORKOAL - 1] = 0x00, - [SPECIES_SABLEYE - 1] = 0x00, - [SPECIES_BARBOACH - 1] = 0x00, - [SPECIES_WHISCASH - 1] = 0x00, - [SPECIES_LUVDISC - 1] = 0x00, - [SPECIES_CORPHISH - 1] = 0x00, - [SPECIES_CRAWDAUNT - 1] = 0x00, - [SPECIES_FEEBAS - 1] = 0x00, [SPECIES_MILOTIC - 1] = 0x2d, - [SPECIES_CARVANHA - 1] = 0x00, - [SPECIES_SHARPEDO - 1] = 0x00, - [SPECIES_TRAPINCH - 1] = 0x00, - [SPECIES_VIBRAVA - 1] = 0x00, - [SPECIES_FLYGON - 1] = 0x00, - [SPECIES_MAKUHITA - 1] = 0x00, - [SPECIES_HARIYAMA - 1] = 0x00, - [SPECIES_ELECTRIKE - 1] = 0x00, - [SPECIES_MANECTRIC - 1] = 0x00, - [SPECIES_NUMEL - 1] = 0x00, - [SPECIES_CAMERUPT - 1] = 0x00, [SPECIES_SPHEAL - 1] = 0x0f, - [SPECIES_SEALEO - 1] = 0x00, - [SPECIES_WALREIN - 1] = 0x00, - [SPECIES_CACNEA - 1] = 0x00, - [SPECIES_CACTURNE - 1] = 0x00, [SPECIES_SNORUNT - 1] = 0x14, - [SPECIES_GLALIE - 1] = 0x00, - [SPECIES_LUNATONE - 1] = 0x00, - [SPECIES_SOLROCK - 1] = 0x00, - [SPECIES_AZURILL - 1] = 0x00, - [SPECIES_SPOINK - 1] = 0x00, [SPECIES_GRUMPIG - 1] = 0x0f, - [SPECIES_PLUSLE - 1] = 0x00, - [SPECIES_MINUN - 1] = 0x00, - [SPECIES_MAWILE - 1] = 0x00, - [SPECIES_MEDITITE - 1] = 0x00, - [SPECIES_MEDICHAM - 1] = 0x00, - [SPECIES_SWABLU - 1] = 0x00, - [SPECIES_ALTARIA - 1] = 0x00, [SPECIES_WYNAUT - 1] = 0x0f, - [SPECIES_DUSKULL - 1] = 0x00, [SPECIES_DUSCLOPS - 1] = 0x1e, - [SPECIES_ROSELIA - 1] = 0x00, - [SPECIES_SLAKOTH - 1] = 0x00, - [SPECIES_VIGOROTH - 1] = 0x00, - [SPECIES_SLAKING - 1] = 0x00, - [SPECIES_GULPIN - 1] = 0x00, - [SPECIES_SWALOT - 1] = 0x00, - [SPECIES_TROPIUS - 1] = 0x00, - [SPECIES_WHISMUR - 1] = 0x00, - [SPECIES_LOUDRED - 1] = 0x00, - [SPECIES_EXPLOUD - 1] = 0x00, - [SPECIES_CLAMPERL - 1] = 0x00, - [SPECIES_HUNTAIL - 1] = 0x00, - [SPECIES_GOREBYSS - 1] = 0x00, [SPECIES_ABSOL - 1] = 0x2d, - [SPECIES_SHUPPET - 1] = 0x00, - [SPECIES_BANETTE - 1] = 0x00, - [SPECIES_SEVIPER - 1] = 0x00, - [SPECIES_ZANGOOSE - 1] = 0x00, - [SPECIES_RELICANTH - 1] = 0x00, - [SPECIES_ARON - 1] = 0x00, - [SPECIES_LAIRON - 1] = 0x00, - [SPECIES_AGGRON - 1] = 0x00, - [SPECIES_CASTFORM - 1] = 0x00, - [SPECIES_VOLBEAT - 1] = 0x00, - [SPECIES_ILLUMISE - 1] = 0x00, - [SPECIES_LILEEP - 1] = 0x00, - [SPECIES_CRADILY - 1] = 0x00, - [SPECIES_ANORITH - 1] = 0x00, - [SPECIES_ARMALDO - 1] = 0x00, - [SPECIES_RALTS - 1] = 0x00, - [SPECIES_KIRLIA - 1] = 0x00, - [SPECIES_GARDEVOIR - 1] = 0x00, - [SPECIES_BAGON - 1] = 0x00, - [SPECIES_SHELGON - 1] = 0x00, [SPECIES_SALAMENCE - 1] = 0x46, - [SPECIES_BELDUM - 1] = 0x00, - [SPECIES_METANG - 1] = 0x00, - [SPECIES_METAGROSS - 1] = 0x00, - [SPECIES_REGIROCK - 1] = 0x00, - [SPECIES_REGICE - 1] = 0x00, - [SPECIES_REGISTEEL - 1] = 0x00, [SPECIES_KYOGRE - 1] = 0x3c, - [SPECIES_GROUDON - 1] = 0x00, [SPECIES_RAYQUAZA - 1] = 0x3c, - [SPECIES_LATIAS - 1] = 0x00, - [SPECIES_LATIOS - 1] = 0x00, - [SPECIES_JIRACHI - 1] = 0x00, - [SPECIES_DEOXYS - 1] = 0x00, - [SPECIES_CHIMECHO - 1] = 0x00, }; const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values From baa187665b102b0210ecd7296aaaf0de512d3e87 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 13:35:52 +0200 Subject: [PATCH 13/42] Document a bit of script menu and battle anims --- data/battle_anim_scripts.s | 16 ++--- include/menu.h | 2 +- include/script_menu.h | 2 +- src/ghost.c | 106 +++++++++++++++-------------- src/mauville_old_man.c | 2 +- src/menu.c | 14 ++-- src/script_menu.c | 107 ++++++++++++++---------------- src/script_pokemon_util_80F87D8.c | 2 +- 8 files changed, 126 insertions(+), 125 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 5a19061d0..8655d9bc3 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -5347,7 +5347,7 @@ Move_ICE_BEAM: loadspritegfx ANIM_TAG_ICE_CRYSTALS createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK waitforvisualfinish - createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 + createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, 12, 0, 12, 20 createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, -12, 0, -12, 20 delay 1 @@ -5403,7 +5403,7 @@ Move_AURORA_BEAM: call AuroraBeam1 call AuroraBeam1 setarg 7, -1 - createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10 + createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 40, 1 call AuroraBeam1 call AuroraBeam1 @@ -7123,7 +7123,7 @@ Move_PSYBEAM: loadspritegfx ANIM_TAG_GOLD_RING playsewithpan SE_W060, SOUND_PAN_ATTACKER call SetPsychicBackground - createsoundtask sub_8158C58, 200, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + createsoundtask sub_8158C58, SE_W060B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 call Psybeam1 call Psybeam1 createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET @@ -7169,7 +7169,7 @@ Move_PSYWAVE: playsewithpan SE_W060, SOUND_PAN_ATTACKER call SetPsychicBackground createvisualtask sub_81076C8, 5, 100 - createsoundtask sub_8158C58, 203, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 + createsoundtask sub_8158C58, SE_W100, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 call Psywave1 call Psywave1 createvisualtask sub_8115A04, 2, 4, 1, 4, 0, 12, RGB(31, 18, 31) @@ -7346,8 +7346,8 @@ Move_SHADOW_BALL: fadetobg BG_GHOST waitbgfadein delay 15 - createsoundtask sub_8158C58, 168, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5 - createsprite gUnknown_08596D58, ANIM_TARGET, 2, 16, 16, 8 + createsoundtask sub_8158C58, SE_W054, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5 + createsprite gShadowBallSpriteTemplate, ANIM_TARGET, 2, 16, 16, 8 waitforvisualfinish playsewithpan SE_W028, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 @@ -8019,7 +8019,7 @@ Move_TRI_ATTACK: delay 20 playsewithpan SE_W161, SOUND_PAN_ATTACKER delay 20 - createsoundtask sub_8158C58, 220, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 + createsoundtask sub_8158C58, SE_W161, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 waitforvisualfinish createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK delay 16 @@ -8356,7 +8356,7 @@ Move_HYPER_BEAM: createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 4, 1 waitforvisualfinish delay 30 - createsoundtask sub_8158C58, 247, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5 + createsoundtask sub_8158C58, SE_W063B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5 createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 createvisualtask sub_8115D94, 2, ANIM_TAG_ORBS, 1, 12, 31, 16, 0, 0 call HyperBeam1 diff --git a/include/menu.h b/include/menu.h index 4f3c4a3cc..2392de703 100644 --- a/include/menu.h +++ b/include/menu.h @@ -91,7 +91,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); void sub_8197AE8(bool8 copyToVram); -void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs); +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); diff --git a/include/script_menu.h b/include/script_menu.h index 1f4e549fe..efb51870b 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -11,7 +11,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3); bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void); int convert_pixel_width_to_tile_width(int); u8 CreateWindowFromRect(u8, u8, u8, u8); -void sub_80E2A78(u8); +void ClearToTransparentAndRemoveWindow(u8); int display_text_and_get_width(const u8*, int); int sub_80E2D5C(int arg0, int tileWidth); bool16 ScrSpecial_CreatePCMenu(void); diff --git a/src/ghost.c b/src/ghost.c index 998be0caa..97b86aa76 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -87,7 +87,7 @@ const union AffineAnimCmd *const gUnknown_08596D54[] = gUnknown_08596D44, }; -const struct SpriteTemplate gUnknown_08596D58 = +const struct SpriteTemplate gShadowBallSpriteTemplate = { .tileTag = ANIM_TAG_SHADOW_BALL, .paletteTag = ANIM_TAG_SHADOW_BALL, @@ -261,20 +261,20 @@ static void sub_81116E8(struct Sprite *sprite) AnimTranslateLinear(sprite); sprite->pos2.x += Sin(sprite->data[5], 10); sprite->pos2.y += Cos(sprite->data[5], 15); - + r2 = sprite->data[5]; sprite->data[5] = (sprite->data[5] + 5) & 0xFF; r0 = sprite->data[5]; - + if (r2 == 0 || r2 > 196) { if (r0 > 0) PlaySE(SE_W109); } - + if (sprite->data[6] == 0) { - sprite->invisible = TRUE; + sprite->invisible = TRUE; sprite->callback = DestroyAnimSpriteAndDisableBlend; } else @@ -283,18 +283,18 @@ static void sub_81116E8(struct Sprite *sprite) static void sub_8111764(struct Sprite *sprite) { - - s16 r0; + + s16 r0; if (sprite->data[6] > 0xFF) { if (++sprite->data[6] == 0x10d) sprite->data[6] = 0; return; } - + r0 = sprite->data[7]; sprite->data[7]++; - + if ((r0 & 0xFF) == 0) { sprite->data[7] &= 0xff00; @@ -392,16 +392,16 @@ static void sub_811196C(u8 taskId) } } -// Spins a sprite towards the target, pausing in the middle. -// Used in Shadow Ball. +// Spins a sprite towards the target, pausing in the middle. +// Used in Shadow Ball. // arg 0: duration step 1 (attacker -> center) // arg 1: duration step 2 (spin center) // arg 2: duration step 3 (center -> target) static void InitAnimShadowBall(struct Sprite *sprite) { - u16 r5, r6; - r5 = sprite->pos1.x; - r6 = sprite->pos1.y; + s16 oldPosX = sprite->pos1.x; + s16 oldPosY = sprite->pos1.y; + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); sprite->data[0] = 0; @@ -410,8 +410,8 @@ static void InitAnimShadowBall(struct Sprite *sprite) sprite->data[3] = gBattleAnimArgs[2]; sprite->data[4] = sprite->pos1.x << 4; sprite->data[5] = sprite->pos1.y << 4; - sprite->data[6] = (((s16)r5 - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1); - sprite->data[7] = (((s16)r6 - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1); + sprite->data[6] = ((oldPosX - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1); + sprite->data[7] = ((oldPosY - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1); sprite->callback = AnimShadowBallStep; } @@ -465,50 +465,57 @@ static void sub_8111B9C(struct Sprite *sprite) sprite->callback = sub_8111BB4; } -static void sub_8111BB4(struct Sprite *sprite) { - - s8 r5 = FALSE; +static void sub_8111BB4(struct Sprite *sprite) +{ + bool8 r5 = FALSE; bool8 r6 = FALSE; - if(sprite->animEnded) + + if (sprite->animEnded) { - if(!(sprite->invisible)) - sprite->invisible=TRUE; - switch(sprite->data[0]) + if (!sprite->invisible) + sprite->invisible = TRUE; + + switch (sprite->data[0]) { - case 0: - if((sprite->data[1]) != 2) - break; - goto loc_08111C06; - case 1: - if((sprite->data[1]) == 4) - r5 = TRUE; - break; - default: - r6 = TRUE; + default: + r6 = TRUE; + break; + case 0: + if (sprite->data[1] == 2) + r5 = TRUE; + break; + case 1: + if (sprite->data[1] == 4) + r5 = TRUE; + break; } - if(r5) + + if (r5) { - loc_08111C06: sprite->invisible ^= 1; sprite->data[2]++; sprite->data[1] = 0; - if(sprite->data[2] == 5) + if (sprite->data[2] == 5) { sprite->data[2] = 0; sprite->data[0]++; } } - else if(r6) + else if (r6) + { DestroyAnimSprite(sprite); + } else + { sprite->data[1]++; + } } } void sub_8111C50(u8 taskId) { struct Task *task; - + task = &gTasks[taskId]; task->data[0] = CloneBattlerSpriteWithBlend(1); if (task->data[0] < 0) @@ -523,7 +530,7 @@ void sub_8111C50(u8 taskId) SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3])); gSprites[task->data[0]].data[0] = 80; - if (GetBattlerSide(gBattleAnimTarget) == 0) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gSprites[task->data[0]].data[1] = -144; gSprites[task->data[0]].data[2] = 112; @@ -573,6 +580,7 @@ static void sub_8111D78(u8 taskId) break; case 2: DestroyAnimVisualTask(taskId); + break; } } @@ -595,7 +603,7 @@ static void sub_8111E78(u8 taskId) switch (task->data[15]) { case 0: - task->data[14] = AllocSpritePalette(0x2771); + task->data[14] = AllocSpritePalette(ANIM_TAG_BENT_SPOON); if (task->data[14] == 0xFF || task->data[14] == 0xF) { DestroyAnimVisualTask(taskId); @@ -605,7 +613,7 @@ static void sub_8111E78(u8 taskId) task->data[0] = CloneBattlerSpriteWithBlend(1); if (task->data[0] < 0) { - FreeSpritePaletteByTag(0x2771); + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); DestroyAnimVisualTask(taskId); } else @@ -698,14 +706,14 @@ static void sub_81120DC(u8 taskId) static void sub_8112170(u8 taskId) { struct Task *task = &gTasks[taskId]; - u8 position = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget); + u8 rank = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget); switch (task->data[15]) { case 0: gScanlineEffect.state = 3; task->data[14] = GetAnimBattlerSpriteId(1); - if (position == 1) + if (rank == 1) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); @@ -714,12 +722,12 @@ static void sub_8112170(u8 taskId) BlendPalette(task->data[4], 16, 0, RGB(13, 0, 15)); break; case 2: - gSprites[task->data[14]].invisible = 1; + gSprites[task->data[14]].invisible = TRUE; obj_delete_but_dont_free_vram(&gSprites[task->data[0]]); - FreeSpritePaletteByTag(0x2771); + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); - if (position == 1) + if (rank == 1) SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); @@ -886,7 +894,7 @@ static void sub_81125E0(u8 taskId) } } } - + if (task->data[10]) task->data[10]--; else if (task->data[6]) @@ -1081,7 +1089,7 @@ static void sub_8112ACC(struct Sprite *sprite) if (sprite->data[0] == 0) { SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); sprite->data[0]++; sprite->data[1] = 0; sprite->data[2] = 0; @@ -1120,7 +1128,7 @@ static void sub_8112B78(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[0], 12); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos2.x = -sprite->pos2.x; - + sprite->data[0] = (sprite->data[0] + 6) & 0xFF; sprite->data[1] += 0x100; sprite->pos2.y = -(sprite->data[1] >> 8); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index ddd3f931e..8bb9cb6e4 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1193,7 +1193,7 @@ static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu gSpecialVar_Result = 1; sSelectedStory = selection; } - sub_80E2A78(sStorytellerWindowId); + ClearToTransparentAndRemoveWindow(sStorytellerWindowId); DestroyTask(taskId); EnableBothScriptContexts(); break; diff --git a/src/menu.c b/src/menu.c index 958788b25..80d440771 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1661,16 +1661,14 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); } -void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs) +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs) { - u32 i; - u32 j; - for (i = 0; i < a7; i++) + u32 i, j; + + for (i = 0; i < verticalCount; i++) { - for (j = 0; j < a6; j++) - { - AddTextPrinterParameterized(windowId, 1, strs[(i * a6) + j].text, (a4 * j) + 8, (i * 16) + 1, 0xFF, NULL); - } + for (j = 0; j < horizontalCount; j++) + AddTextPrinterParameterized(windowId, 1, strs[(i * horizontalCount) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); } CopyWindowToVram(windowId, 2); } diff --git a/src/script_menu.c b/src/script_menu.c index c7523a370..082253e35 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1183,7 +1183,7 @@ static void Task_HandleMultichoiceInput(u8 taskId) { gSpecialVar_Result = selection; } - sub_80E2A78(tWindowId); + ClearToTransparentAndRemoveWindow(tWindowId); DestroyTask(taskId); EnableBothScriptContexts(); } @@ -1219,8 +1219,6 @@ bool8 IsScriptActive(void) static void Task_HandleYesNoInput(u8 taskId) { - u8 left, top; - if (gTasks[taskId].tRight < 5) { gTasks[taskId].tRight++; @@ -1229,9 +1227,9 @@ static void Task_HandleYesNoInput(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -2: + case MENU_NOTHING_CHOSEN: return; - case -1: + case MENU_B_PRESSED: case 1: PlaySE(SE_SELECT); gSpecialVar_Result = 0; @@ -1247,8 +1245,6 @@ static void Task_HandleYesNoInput(u8 taskId) bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount) { - u8 bottom = 0; - if (FuncIsActiveTask(Task_HandleMultichoiceGridInput) == TRUE) { return FALSE; @@ -1256,10 +1252,8 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr else { u8 taskId; - u8 unk2; - int width; - int i; - u8 newWidth; + u8 rowCount, newWidth; + int i, width; gSpecialVar_Result = 0xFF; width = 0; @@ -1272,15 +1266,15 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr newWidth = convert_pixel_width_to_tile_width(width); left = sub_80E2D5C(left, columnCount * newWidth); - unk2 = gMultichoiceLists[multichoiceId].count / columnCount; + rowCount = gMultichoiceLists[multichoiceId].count / columnCount; taskId = CreateTask(Task_HandleMultichoiceGridInput, 80); gTasks[taskId].tIgnoreBPress = ignoreBPress; - gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, unk2 * 2); + gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, rowCount * 2); SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 0); - sub_81997AC(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, gMultichoiceLists[multichoiceId].list); - sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, 0); + PrintMenuGridTable(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, gMultichoiceLists[multichoiceId].list); + sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, 0); CopyWindowToVram(gTasks[taskId].tWindowId, 3); return TRUE; } @@ -1291,23 +1285,24 @@ static void Task_HandleMultichoiceGridInput(u8 taskId) s16 *data = gTasks[taskId].data; s8 selection = Menu_ProcessInputGridLayout(); - if (selection != -2) + switch (selection) { - if (selection == -1) - { - if (tIgnoreBPress) - return; - PlaySE(SE_SELECT); - gSpecialVar_Result = 0x7F; - } - else - { - gSpecialVar_Result = selection; - } - sub_80E2A78(tWindowId); - DestroyTask(taskId); - EnableBothScriptContexts(); + case MENU_NOTHING_CHOSEN: + return; + case MENU_B_PRESSED: + if (tIgnoreBPress) + return; + PlaySE(SE_SELECT); + gSpecialVar_Result = 0x7F; + break; + default: + gSpecialVar_Result = selection; + break; } + + ClearToTransparentAndRemoveWindow(tWindowId); + DestroyTask(taskId); + EnableBothScriptContexts(); } #undef tWindowId @@ -1564,7 +1559,7 @@ static void Task_PokemonPicWindow(u8 taskId) task->tState++; break; case 3: - sub_80E2A78(task->tWindowId); + ClearToTransparentAndRemoveWindow(task->tWindowId); DestroyTask(taskId); break; } @@ -1628,7 +1623,7 @@ u8 CreateWindowFromRect(u8 x, u8 y, u8 width, u8 height) return windowId; } -void sub_80E2A78(u8 windowId) +void ClearToTransparentAndRemoveWindow(u8 windowId) { ClearStdWindowAndFrameToTransparent(windowId, TRUE); RemoveWindow(windowId); @@ -1638,30 +1633,30 @@ static void sub_80E2A94(u8 multichoiceId) { switch (multichoiceId) { - case 77: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 76: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 78: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 79: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 75: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 74: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; + case 77: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 76: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 78: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 79: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 75: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 74: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; } } diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7e4c14531..ece030395 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -395,7 +395,7 @@ static void sub_80F8EE8(u8 taskId) task->data[0]++; break; case 4: - sub_80E2A78(gTasks[taskId].data[5]); + ClearToTransparentAndRemoveWindow(gTasks[taskId].data[5]); DestroyTask(taskId); break; } From d8c9f1b30fb92289e7aa4d44dfcf1b2120bea8d6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 15:06:44 +0200 Subject: [PATCH 14/42] Rows and columns --- include/menu.h | 4 ++-- src/menu.c | 60 +++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/menu.h b/include/menu.h index 2392de703..4d55fc955 100644 --- a/include/menu.h +++ b/include/menu.h @@ -69,7 +69,7 @@ u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8); -u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, u8 initialCursorPos); +u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); @@ -91,7 +91,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); void sub_8197AE8(bool8 copyToVram); -void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs); +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); diff --git a/src/menu.c b/src/menu.c index 80d440771..b766b1b86 100644 --- a/src/menu.c +++ b/src/menu.c @@ -43,8 +43,8 @@ struct Menu u8 fontId; u8 optionWidth; u8 optionHeight; - u8 horizontalCount; - u8 verticalCount; + u8 columns; + u8 rows; bool8 APressMuted; }; @@ -1283,8 +1283,8 @@ u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, sMenu.fontId = fontId; sMenu.optionWidth = a4; sMenu.optionHeight = cursorHeight; - sMenu.horizontalCount = a6; - sMenu.verticalCount = a7; + sMenu.columns = a6; + sMenu.rows = a7; pos = a9; @@ -1308,16 +1308,16 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos) { u8 cursorWidth = GetMenuCursorDimensionByFont(sMenu.fontId, 0); u8 cursorHeight = GetMenuCursorDimensionByFont(sMenu.fontId, 1); - u8 xPos = (oldCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; - u8 yPos = (oldCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + u8 xPos = (oldCursorPos % sMenu.columns) * sMenu.optionWidth + sMenu.left; + u8 yPos = (oldCursorPos / sMenu.columns) * sMenu.optionHeight + sMenu.top; FillWindowPixelRect(sMenu.windowId, PIXEL_FILL(1), xPos, yPos, cursorWidth, cursorHeight); - xPos = (newCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; - yPos = (newCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + xPos = (newCursorPos % sMenu.columns) * sMenu.optionWidth + sMenu.left; + yPos = (newCursorPos / sMenu.columns) * sMenu.optionHeight + sMenu.top; AddTextPrinterParameterized(sMenu.windowId, sMenu.fontId, gText_SelectorArrow3, @@ -1333,13 +1333,13 @@ u8 sub_8199134(s8 deltaX, s8 deltaY) if (deltaX != 0) { - if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < 0) + if ((sMenu.cursorPos % sMenu.columns) + deltaX < 0) { - sMenu.cursorPos += sMenu.horizontalCount - 1; + sMenu.cursorPos += sMenu.columns - 1; } - else if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= sMenu.horizontalCount) + else if ((sMenu.cursorPos % sMenu.columns) + deltaX >= sMenu.columns) { - sMenu.cursorPos = (sMenu.cursorPos / sMenu.horizontalCount) * sMenu.horizontalCount; + sMenu.cursorPos = (sMenu.cursorPos / sMenu.columns) * sMenu.columns; } else { @@ -1349,17 +1349,17 @@ u8 sub_8199134(s8 deltaX, s8 deltaY) if (deltaY != 0) { - if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < 0) + if ((sMenu.cursorPos / sMenu.columns) + deltaY < 0) { - sMenu.cursorPos += sMenu.horizontalCount * (sMenu.verticalCount - 1); + sMenu.cursorPos += sMenu.columns * (sMenu.rows - 1); } - else if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= sMenu.verticalCount) + else if ((sMenu.cursorPos / sMenu.columns) + deltaY >= sMenu.rows) { - sMenu.cursorPos -= sMenu.horizontalCount * (sMenu.verticalCount - 1); + sMenu.cursorPos -= sMenu.columns * (sMenu.rows - 1); } else { - sMenu.cursorPos += (sMenu.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.columns * deltaY); } } @@ -1381,8 +1381,8 @@ u8 sub_81991F8(s8 deltaX, s8 deltaY) if (deltaX != 0) { - if (((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= 0) && - ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < sMenu.horizontalCount)) + if (((sMenu.cursorPos % sMenu.columns) + deltaX >= 0) && + ((sMenu.cursorPos % sMenu.columns) + deltaX < sMenu.columns)) { sMenu.cursorPos += deltaX; } @@ -1390,10 +1390,10 @@ u8 sub_81991F8(s8 deltaX, s8 deltaY) if (deltaY != 0) { - if (((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= 0) && - ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < sMenu.verticalCount)) + if (((sMenu.cursorPos / sMenu.columns) + deltaY >= 0) && + ((sMenu.cursorPos / sMenu.columns) + deltaY < sMenu.rows)) { - sMenu.cursorPos += (sMenu.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.columns * deltaY); } } @@ -1661,14 +1661,14 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); } -void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs) +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs) { u32 i, j; - for (i = 0; i < verticalCount; i++) + for (i = 0; i < rows; i++) { - for (j = 0; j < horizontalCount; j++) - AddTextPrinterParameterized(windowId, 1, strs[(i * horizontalCount) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); + for (j = 0; j < columns; j++) + AddTextPrinterParameterized(windowId, 1, strs[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); } CopyWindowToVram(windowId, 2); } @@ -1704,20 +1704,20 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M CopyWindowToVram(windowId, 2); } -u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, u8 initialCursorPos) +u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos) { s32 pos; sMenu.left = 0; sMenu.top = 1; sMenu.minCursorPos = 0; - sMenu.maxCursorPos = (horizontalCount * verticalCount) - 1; + sMenu.maxCursorPos = (columns * rows) - 1; sMenu.windowId = windowId; sMenu.fontId = 1; sMenu.optionWidth = optionWidth; sMenu.optionHeight = 16; - sMenu.horizontalCount = horizontalCount; - sMenu.verticalCount = verticalCount; + sMenu.columns = columns; + sMenu.rows = rows; pos = initialCursorPos; From 1241700b204b9f450221299c6e837c0f522f60b2 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 2 Apr 2019 18:28:56 -0500 Subject: [PATCH 15/42] Finish documenting the other weather effects --- data/specials.inc | 2 +- graphics/weather/1.pal | 19 -- graphics/weather/2.pal | 19 -- include/field_weather.h | 59 ++-- src/cable_car.c | 19 +- src/field_weather.c | 6 +- src/field_weather_effect.c | 603 ++++++++++++++++++++----------------- 7 files changed, 366 insertions(+), 361 deletions(-) delete mode 100644 graphics/weather/1.pal delete mode 100644 graphics/weather/2.pal diff --git a/data/specials.inc b/data/specials.inc index 5a812cffa..af69b51a1 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -327,7 +327,7 @@ gSpecials:: @ 81DBA64 def_special SetUpTrainerMovement def_special DoSealedChamberShakingEffect2 def_special FoundBlackGlasses - def_special sub_80AC81C + def_special StartDroughtWeatherBlend def_special DoDiveWarp def_special DoFallWarp def_special ShowContestEntryMonPic diff --git a/graphics/weather/1.pal b/graphics/weather/1.pal deleted file mode 100644 index fe57a8c7f..000000000 --- a/graphics/weather/1.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -65 148 255 -180 222 255 -115 205 246 -131 197 255 -82 189 246 -172 238 246 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/weather/2.pal b/graphics/weather/2.pal deleted file mode 100644 index 9516c7a19..000000000 --- a/graphics/weather/2.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -0 0 0 -255 230 139 -189 131 74 -238 197 123 -213 164 98 -164 106 49 -255 246 164 -222 205 164 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/include/field_weather.h b/include/field_weather.h index 7a4864075..3a84a8a73 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,10 +3,13 @@ #include "sprite.h" -#define MAX_RAIN_SPRITES 24 -#define NUM_CLOUD_SPRITES 3 -#define NUM_FOG_SPRITES 20 -#define NUM_ASH_SPRITES 20 +#define MAX_RAIN_SPRITES 24 +#define NUM_CLOUD_SPRITES 3 +#define NUM_FOG1_SPRITES 20 +#define NUM_ASH_SPRITES 20 +#define NUM_FOG2_SPRITES 20 +#define NUM_SANDSTORM_SPRITES 20 +#define NUM_SWIRL_SANDSTORM_SPRITES 5 // Controls how the weather should be changing the screen palettes. enum @@ -39,11 +42,11 @@ struct Weather struct { u8 filler0[0xA0]; - struct Sprite *fog1Sprites[NUM_FOG_SPRITES]; + struct Sprite *fog1Sprites[NUM_FOG1_SPRITES]; struct Sprite *ashSprites[NUM_ASH_SPRITES]; - struct Sprite *fog2Sprites[20]; - struct Sprite *sandstormSprites1[20]; - struct Sprite *sandstormSprites2[5]; + struct Sprite *fog2Sprites[NUM_FOG2_SPRITES]; + struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES]; + struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES]; } s2; } sprites; u8 gammaShifts[19][32]; @@ -92,32 +95,32 @@ struct Weather u8 lightenedFogSpritePals[6]; u8 lightenedFogSpritePalsCount; u8 fog1SpritesCreated; - u16 baseAshSpritesX; + u16 ashBaseSpritesX; u16 unknown_6FE; u8 ashSpritesCreated; u8 filler_701[3]; - u32 unknown_704; - u32 unknown_708; + u32 sandstormXOffset; + u32 sandstormYOffset; u8 filler_70C[2]; - u16 unknown_70E; - u16 unknown_710; - u16 unknown_712; - u16 unknown_714; - u8 sandstormSprites1Created; - u8 sandstormSprites2Created; - u16 unknown_718; - u16 unknown_71A; - u16 unknown_71C; - u16 unknown_71E; - u16 unknown_720; - u16 unknown_722; + u16 sandstormBaseSpritesX; + u16 sandstormPosY; + u16 sandstormWaveIndex; + u16 sandstormWaveCounter; + u8 sandstormSpritesCreated; + u8 sandstormSwirlSpritesCreated; + u16 fog2BaseSpritesX; + u16 fog2PosY; + u16 fog2ScrollXCounter; + u16 fog2ScrollYCounter; + u16 fog2XOffset; + u16 fog2YOffset; u8 fog2SpritesCreated; u8 filler_725[1]; - u16 unknown_726; - u16 unknown_728; - u16 unknown_72A; - u16 unknown_72C; - u8 unknown_72E; + u16 bubblesDelayCounter; + u16 bubblesDelayIndex; + u16 bubblesCoordsIndex; + u16 bubblesSpriteCount; + u8 bubblesSpritesCreated; u8 filler_72F; u16 currBlendEVA; u16 currBlendEVB; diff --git a/src/cable_car.c b/src/cable_car.c index ab7b5726a..42137e804 100755 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -407,13 +407,12 @@ static void sub_81503E4(u8 taskId) case WEATHER_ASH: if (gWeatherPtr->sprites.s2.ashSprites[0] != NULL && gWeatherPtr->sprites.s2.ashSprites[0]->oam.priority != 0) { - for (; i < 20; i++) + for (; i < NUM_ASH_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) - { + if (gWeatherPtr->sprites.s2.ashSprites[i]) gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0; - } } + sCableCar->state = 2; } break; @@ -424,12 +423,10 @@ static void sub_81503E4(u8 taskId) } else if (sCableCar->timer >= sCableCar->unk4 + 8) { - for (; i < 20; i++) + for (; i < NUM_ASH_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) - { - gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= TRUE; - } + if (gWeatherPtr->sprites.s2.ashSprites[i]) + gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= 1; } } break; @@ -445,9 +442,7 @@ static void sub_81503E4(u8 taskId) break; case 3: if (!gPaletteFade.active) - { sCableCar->state = 0xFF; - } break; case 0xFF: SetVBlankCallback(NULL); @@ -536,7 +531,7 @@ static void sub_8150664(u8 taskId) if (sCableCar->timer < sCableCar->unk4) gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248; else - gWeatherPtr->unknown_6FC = (gWeatherPtr->unknown_6FC + 247) % 248; + gWeatherPtr->ashBaseSpritesX = (gWeatherPtr->ashBaseSpritesX + 247) % 248; } static void CableCarVblankCallback(void) diff --git a/src/field_weather.c b/src/field_weather.c index 346d30a38..814e85ef4 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -173,9 +173,9 @@ void StartWeather(void) gWeatherPtr->ashSpritesCreated = 0; gWeatherPtr->fog1SpritesCreated = 0; gWeatherPtr->fog2SpritesCreated = 0; - gWeatherPtr->sandstormSprites1Created = 0; - gWeatherPtr->sandstormSprites2Created = 0; - gWeatherPtr->unknown_72E = 0; + gWeatherPtr->sandstormSpritesCreated = 0; + gWeatherPtr->sandstormSwirlSpritesCreated = 0; + gWeatherPtr->bubblesSpritesCreated = 0; gWeatherPtr->lightenedFogSpritePalsCount = 0; Weather_SetBlendCoeffs(16, 0); gWeatherPtr->currWeather = 0; diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 0544710ad..eac434983 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1,4 +1,5 @@ #include "global.h" +#include "battle_anim.h" #include "event_object_movement.h" #include "field_weather.h" #include "overworld.h" @@ -17,8 +18,8 @@ EWRAM_DATA static u8 gCurrentAlternatingWeather = 0; EWRAM_DATA static u16 gUnusedWeatherRelated = 0; // CONST -const u16 gUnknown_0854C290[] = INCBIN_U16("graphics/weather/1.gbapal"); -const u16 gUnknown_0854C2B0[] = INCBIN_U16("graphics/weather/2.gbapal"); +const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); +const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u8 gWeatherFog2Tiles[] = INCBIN_U8("graphics/weather/fog2.4bpp"); const u8 gWeatherFog1Tiles[] = INCBIN_U8("graphics/weather/fog1.4bpp"); const u8 gWeatherCloudTiles[] = INCBIN_U8("graphics/weather/cloud.4bpp"); @@ -180,7 +181,7 @@ static void CreateCloudSprites(void) return; LoadSpriteSheet(&sCloudSpriteSheet); - LoadCustomWeatherSpritePalette(gUnknown_0854C290); + LoadCustomWeatherSpritePalette(gCloudsWeatherPalette); for (i = 0; i < NUM_CLOUD_SPRITES; i++) { spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); @@ -229,6 +230,8 @@ static void UpdateCloudSprite(struct Sprite *sprite) // Drought //------------------------------------------------------------------------------ +static void UpdateDroughtBlend(u8); + void Drought_InitVars(void) { gWeatherPtr->initStep = 0; @@ -280,14 +283,12 @@ void Drought_Main(void) bool8 Drought_Finish(void) { - return 0; + return FALSE; } -void task50_0807B6D4(u8); - -void sub_80AC81C(void) +void StartDroughtWeatherBlend(void) { - CreateTask(task50_0807B6D4, 0x50); + CreateTask(UpdateDroughtBlend, 0x50); } #define tState data[0] @@ -295,7 +296,7 @@ void sub_80AC81C(void) #define tBlendDelay data[2] #define tWinRange data[3] -void task50_0807B6D4(u8 taskId) +static void UpdateDroughtBlend(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1436,7 +1437,7 @@ static void CreateFog1Sprites(void) .tag = 0x1201, }; LoadSpriteSheet(&fog1SpriteSheet); - for (i = 0; i < NUM_FOG_SPRITES; i++) + for (i = 0; i < NUM_FOG1_SPRITES; i++) { spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) @@ -1463,7 +1464,7 @@ static void DestroyFog1Sprites(void) if (gWeatherPtr->fog1SpritesCreated) { - for (i = 0; i < NUM_FOG_SPRITES; i++) + for (i = 0; i < NUM_FOG1_SPRITES; i++) { if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]); @@ -1508,9 +1509,9 @@ void Ash_InitAll(void) void Ash_Main(void) { - gWeatherPtr->baseAshSpritesX = gSpriteCoordOffsetX & 0x1FF; - while (gWeatherPtr->baseAshSpritesX >= 240) - gWeatherPtr->baseAshSpritesX -= 240; + gWeatherPtr->ashBaseSpritesX = gSpriteCoordOffsetX & 0x1FF; + while (gWeatherPtr->ashBaseSpritesX >= 240) + gWeatherPtr->ashBaseSpritesX -= 240; switch (gWeatherPtr->initStep) { @@ -1676,10 +1677,10 @@ static void UpdateAshSprite(struct Sprite *sprite) } sprite->pos1.y = gSpriteCoordOffsetY + sprite->tOffsetY; - sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 32 + sprite->tSpriteColumn * 64; + sprite->pos1.x = gWeatherPtr->ashBaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; + sprite->pos1.x = gWeatherPtr->ashBaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } @@ -1693,6 +1694,11 @@ static void UpdateAshSprite(struct Sprite *sprite) // Fog 2 //------------------------------------------------------------------------------ +static void UpdateFog2Movement(void); +static void CreateFog2Sprites(void); +static void DestroyFog2Sprites(void); +static void UpdateFog2Sprite(struct Sprite *); + void Fog2_InitVars(void) { gWeatherPtr->initStep = 0; @@ -1701,20 +1707,18 @@ void Fog2_InitVars(void) gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->fog1ScrollCounter = 0; gWeatherPtr->fog1ScrollOffset = 1; - if (gWeatherPtr->fog2SpritesCreated == 0) + if (!gWeatherPtr->fog2SpritesCreated) { - gWeatherPtr->unknown_71C = 0; - gWeatherPtr->unknown_71E = 0; - gWeatherPtr->unknown_720 = 0; - gWeatherPtr->unknown_722 = 0; - gWeatherPtr->unknown_718 = 0; - gWeatherPtr->unknown_71A = 0; + gWeatherPtr->fog2ScrollXCounter = 0; + gWeatherPtr->fog2ScrollYCounter = 0; + gWeatherPtr->fog2XOffset = 0; + gWeatherPtr->fog2YOffset = 0; + gWeatherPtr->fog2BaseSpritesX = 0; + gWeatherPtr->fog2PosY = 0; Weather_SetBlendCoeffs(0, 16); } } -void Fog2_Main(void); - void Fog2_InitAll(void) { Fog2_InitVars(); @@ -1722,12 +1726,9 @@ void Fog2_InitAll(void) Fog2_Main(); } -void sub_807FC9C(void); -void CreateFog2Sprites(void); - void Fog2_Main(void) { - sub_807FC9C(); + UpdateFog2Movement(); switch (gWeatherPtr->initStep) { case 0: @@ -1747,11 +1748,9 @@ void Fog2_Main(void) } } -void DestroyFog2Sprites(void); - bool8 Fog2_Finish(void) { - sub_807FC9C(); + UpdateFog2Movement(); switch (gWeatherPtr->finishStep) { case 0: @@ -1773,57 +1772,32 @@ bool8 Fog2_Finish(void) return TRUE; } -void sub_807FC9C(void) +static void UpdateFog2Movement(void) { - if (++gWeatherPtr->unknown_71C > 2) + if (++gWeatherPtr->fog2ScrollXCounter > 2) { - gWeatherPtr->unknown_720++; - gWeatherPtr->unknown_71C = 0; + gWeatherPtr->fog2XOffset++; + gWeatherPtr->fog2ScrollXCounter = 0; } - if (++gWeatherPtr->unknown_71E > 4) + if (++gWeatherPtr->fog2ScrollYCounter > 4) { - gWeatherPtr->unknown_722++; - gWeatherPtr->unknown_71E = 0; + gWeatherPtr->fog2YOffset++; + gWeatherPtr->fog2ScrollYCounter = 0; } - gWeatherPtr->unknown_718 = (gSpriteCoordOffsetX - gWeatherPtr->unknown_720) & 0xFF; - gWeatherPtr->unknown_71A = gSpriteCoordOffsetY + gWeatherPtr->unknown_722; + gWeatherPtr->fog2BaseSpritesX = (gSpriteCoordOffsetX - gWeatherPtr->fog2XOffset) & 0xFF; + gWeatherPtr->fog2PosY = gSpriteCoordOffsetY + gWeatherPtr->fog2YOffset; } -extern const struct SpriteTemplate sFog2SpriteTemplate; // defined below - -void CreateFog2Sprites(void) +static const struct SpriteSheet gFog2SpriteSheet = { - u16 i; + .data = gWeatherFog2Tiles, + .size = sizeof(gWeatherFog2Tiles), + .tag = 0x1203, +}; - if (!gWeatherPtr->fog2SpritesCreated) - { - struct SpriteSheet fog2SpriteSheet = {gWeatherFog2Tiles, sizeof(gWeatherFog2Tiles), 0x1203}; - - LoadSpriteSheet(&fog2SpriteSheet); - for (i = 0; i < 20; i++) - { - u8 spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF); - - if (spriteId != MAX_SPRITES) - { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->data[0] = i % 5; - sprite->data[1] = i / 5; - gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite; - } - else - { - gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL; - } - } - gWeatherPtr->fog2SpritesCreated = TRUE; - } -} - -const struct OamData gOamData_839ABF0 = +static const struct OamData sFog2SpriteOamData = { .y = 0, .affineMode = 0, @@ -1840,103 +1814,146 @@ const struct OamData gOamData_839ABF0 = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839ABF8[] = +static const union AnimCmd sFog2SpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839AC00[] = +static const union AnimCmd *const sFog2SpriteAnimCmds[] = { - gSpriteAnim_839ABF8, + sFog2SpriteAnimCmd0, }; -void Fog2SpriteCallback(struct Sprite *); -const struct SpriteTemplate sFog2SpriteTemplate = +static const struct SpriteTemplate sFog2SpriteTemplate = { - .tileTag = 4611, + .tileTag = 0x1203, .paletteTag = 0x1200, - .oam = &gOamData_839ABF0, - .anims = gSpriteAnimTable_839AC00, + .oam = &sFog2SpriteOamData, + .anims = sFog2SpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = Fog2SpriteCallback, + .callback = UpdateFog2Sprite, }; -void DestroyFog2Sprites(void) +#define tSpriteColumn data[0] +#define tSpriteRow data[1] + +static void CreateFog2Sprites(void) +{ + u16 i; + struct SpriteSheet fog2SpriteSheet; + u8 spriteId; + struct Sprite *sprite; + + if (!gWeatherPtr->fog2SpritesCreated) + { + fog2SpriteSheet = gFog2SpriteSheet; + LoadSpriteSheet(&fog2SpriteSheet); + for (i = 0; i < NUM_FOG2_SPRITES; i++) + { + spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->tSpriteColumn = i % 5; + sprite->tSpriteRow = i / 5; + gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite; + } + else + { + gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL; + } + } + + gWeatherPtr->fog2SpritesCreated = TRUE; + } +} + +static void DestroyFog2Sprites(void) { u16 i; if (gWeatherPtr->fog2SpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG2_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.fog2Sprites[i] != NULL) + if (gWeatherPtr->sprites.s2.fog2Sprites[i]) DestroySprite(gWeatherPtr->sprites.s2.fog2Sprites[i]); } + FreeSpriteTilesByTag(0x1203); gWeatherPtr->fog2SpritesCreated = FALSE; } } -void Fog2SpriteCallback(struct Sprite *sprite) +static void UpdateFog2Sprite(struct Sprite *sprite) { - sprite->pos2.y = gWeatherPtr->unknown_71A; - sprite->pos1.x = gWeatherPtr->unknown_718 + 32 + sprite->data[0] * 64; + sprite->pos2.y = gWeatherPtr->fog2PosY; + sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_718 + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } +#undef tSpriteColumn +#undef tSpriteRow + //------------------------------------------------------------------------------ // Sandstorm //------------------------------------------------------------------------------ +static void UpdateSandstormWaveIndex(void); +static void UpdateSandstormMovement(void); +static void CreateSandstormSprites(void); +static void CreateSwirlSandstormSprites(void); +static void DestroySandstormSprites(void); +static void UpdateSandstormSprite(struct Sprite *); +static void WaitSandSwirlSpriteEntrance(struct Sprite *); +static void UpdateSandstormSwirlSprite(struct Sprite *); + +#define MIN_SANDSTORM_WAVE_INDEX 0x20 + void Sandstorm_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = 0; gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; - if (gWeatherPtr->sandstormSprites1Created == 0) + if (!gWeatherPtr->sandstormSpritesCreated) { - gWeatherPtr->unknown_704 = gWeatherPtr->unknown_708 = 0; - gWeatherPtr->unknown_712 = 8; - gWeatherPtr->unknown_714 = 0; + gWeatherPtr->sandstormXOffset = gWeatherPtr->sandstormYOffset = 0; + gWeatherPtr->sandstormWaveIndex = 8; + gWeatherPtr->sandstormWaveCounter = 0; // Dead code. How does the compiler not optimize this out? - if (gWeatherPtr->unknown_712 > 0x5F) - gWeatherPtr->unknown_712 = 0x80 - gWeatherPtr->unknown_712; + if (gWeatherPtr->sandstormWaveIndex >= 0x80 - MIN_SANDSTORM_WAVE_INDEX) + gWeatherPtr->sandstormWaveIndex = 0x80 - gWeatherPtr->sandstormWaveIndex; + Weather_SetBlendCoeffs(0, 16); } } -void Sandstorm_Main(void); - void Sandstorm_InitAll(void) { Sandstorm_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) + while (!gWeatherPtr->weatherGfxLoaded) Sandstorm_Main(); } -void sub_808002C(void); -void sub_8080064(void); -void CreateSandstormSprites_1(void); -void CreateSandstormSprites_2(void); - void Sandstorm_Main(void) { - sub_8080064(); - sub_808002C(); - if (gWeatherPtr->unknown_712 > 0x5F) - gWeatherPtr->unknown_712 = 32; + UpdateSandstormMovement(); + UpdateSandstormWaveIndex(); + if (gWeatherPtr->sandstormWaveIndex >= 0x80 - MIN_SANDSTORM_WAVE_INDEX) + gWeatherPtr->sandstormWaveIndex = MIN_SANDSTORM_WAVE_INDEX; + switch (gWeatherPtr->initStep) { case 0: - CreateSandstormSprites_1(); - CreateSandstormSprites_2(); + CreateSandstormSprites(); + CreateSwirlSandstormSprites(); gWeatherPtr->initStep++; break; case 1: @@ -1944,20 +1961,19 @@ void Sandstorm_Main(void) gWeatherPtr->initStep++; break; case 2: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } break; } } -void sub_80800E4(void); - bool8 Sandstorm_Finish(void) { - sub_8080064(); - sub_808002C(); + UpdateSandstormMovement(); + UpdateSandstormWaveIndex(); switch (gWeatherPtr->finishStep) { case 0: @@ -1965,64 +1981,66 @@ bool8 Sandstorm_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + gWeatherPtr->finishStep++; break; case 2: - sub_80800E4(); + DestroySandstormSprites(); gWeatherPtr->finishStep++; break; default: return FALSE; } + return TRUE; } -void sub_808002C(void) +static void UpdateSandstormWaveIndex(void) { - if (gWeatherPtr->unknown_714++ > 4) + if (gWeatherPtr->sandstormWaveCounter++ > 4) { - gWeatherPtr->unknown_712++; - gWeatherPtr->unknown_714 = 0; + gWeatherPtr->sandstormWaveIndex++; + gWeatherPtr->sandstormWaveCounter = 0; } } -void sub_8080064(void) +static void UpdateSandstormMovement(void) { - gWeatherPtr->unknown_704 -= gSineTable[gWeatherPtr->unknown_712] * 4; - gWeatherPtr->unknown_708 -= gSineTable[gWeatherPtr->unknown_712]; - gWeatherPtr->unknown_70E = (gSpriteCoordOffsetX + (gWeatherPtr->unknown_704 >> 8)) & 0xFF; - gWeatherPtr->unknown_710 = gSpriteCoordOffsetY + (gWeatherPtr->unknown_708 >> 8); + gWeatherPtr->sandstormXOffset -= gSineTable[gWeatherPtr->sandstormWaveIndex] * 4; + gWeatherPtr->sandstormYOffset -= gSineTable[gWeatherPtr->sandstormWaveIndex]; + gWeatherPtr->sandstormBaseSpritesX = (gSpriteCoordOffsetX + (gWeatherPtr->sandstormXOffset >> 8)) & 0xFF; + gWeatherPtr->sandstormPosY = gSpriteCoordOffsetY + (gWeatherPtr->sandstormYOffset >> 8); } -void sub_80800E4(void) +static void DestroySandstormSprites(void) { u16 i; - if (gWeatherPtr->sandstormSprites1Created) + if (gWeatherPtr->sandstormSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_SANDSTORM_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.sandstormSprites1[i] != NULL) + if (gWeatherPtr->sprites.s2.sandstormSprites1[i]) DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites1[i]); } - gWeatherPtr->sandstormSprites1Created = FALSE; + + gWeatherPtr->sandstormSpritesCreated = FALSE; FreeSpriteTilesByTag(0x1204); } - if (gWeatherPtr->sandstormSprites2Created) + if (gWeatherPtr->sandstormSwirlSpritesCreated) { - for (i = 0; i < 5; i++) + for (i = 0; i < NUM_SWIRL_SANDSTORM_SPRITES; i++) { if (gWeatherPtr->sprites.s2.sandstormSprites2[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites2[i]); } - gWeatherPtr->sandstormSprites2Created = FALSE; + + gWeatherPtr->sandstormSwirlSpritesCreated = FALSE; } } -const struct OamData gOamData_839AC1C = +static const struct OamData sSandstormSpriteOamData = { .y = 0, .affineMode = 0, @@ -2039,142 +2057,162 @@ const struct OamData gOamData_839AC1C = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839AC24[] = +static const union AnimCmd sSandstormSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 3), ANIMCMD_END, }; -const union AnimCmd gSpriteAnim_839AC2C[] = +static const union AnimCmd sSandstormSpriteAnimCmd1[] = { ANIMCMD_FRAME(64, 3), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839AC34[] = +static const union AnimCmd *const sSandstormSpriteAnimCmds[] = { - gSpriteAnim_839AC24, - gSpriteAnim_839AC2C, + sSandstormSpriteAnimCmd0, + sSandstormSpriteAnimCmd1, }; -void SandstormSpriteCallback1(struct Sprite *); -const struct SpriteTemplate sSandstormSpriteTemplate = +static const struct SpriteTemplate sSandstormSpriteTemplate = { .tileTag = 0x1204, .paletteTag = 0x1201, - .oam = &gOamData_839AC1C, - .anims = gSpriteAnimTable_839AC34, + .oam = &sSandstormSpriteOamData, + .anims = sSandstormSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SandstormSpriteCallback1, + .callback = UpdateSandstormSprite, }; -static const struct SpriteSheet sSandstormSpriteSheet = {gWeatherSandstormTiles, sizeof(gWeatherSandstormTiles), 0x1204}; +static const struct SpriteSheet sSandstormSpriteSheet = +{ + .data = gWeatherSandstormTiles, + .size = sizeof(gWeatherSandstormTiles), + .tag = 0x1204, +}; -void CreateSandstormSprites_1(void) +// Regular sandstorm sprites +#define tSpriteColumn data[0] +#define tSpriteRow data[1] + +// Swirly sandstorm sprites +#define tRadius data[0] +#define tWaveIndex data[1] +#define tRadiusCounter data[2] +#define tEntranceDelay data[3] + +static void CreateSandstormSprites(void) { u16 i; + u8 spriteId; - if (!gWeatherPtr->sandstormSprites1Created) + if (!gWeatherPtr->sandstormSpritesCreated) { LoadSpriteSheet(&sSandstormSpriteSheet); - LoadCustomWeatherSpritePalette(gUnknown_0854C2B0); - for (i = 0; i < 20; i++) + LoadCustomWeatherSpritePalette(gSandstormWeatherPalette); + for (i = 0; i < NUM_SANDSTORM_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, 0, (i / 5) * 64, 1); - + spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, 0, (i / 5) * 64, 1); if (spriteId != MAX_SPRITES) { gWeatherPtr->sprites.s2.sandstormSprites1[i] = &gSprites[spriteId]; - gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[0] = i % 5; - gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[1] = i / 5; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->tSpriteColumn = i % 5; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->tSpriteRow = i / 5; } else { gWeatherPtr->sprites.s2.sandstormSprites1[i] = NULL; } } - gWeatherPtr->sandstormSprites1Created = TRUE; + + gWeatherPtr->sandstormSpritesCreated = TRUE; } } -const u16 gUnknown_0839AC5C[] = {0, 120, 80, 160, 40, 0}; +static const u16 sSwirlEntranceDelays[] = {0, 120, 80, 160, 40, 0}; -void SandstormSpriteCallback2(struct Sprite *); - -void CreateSandstormSprites_2(void) +static void CreateSwirlSandstormSprites(void) { u16 i; + u8 spriteId; - if (!gWeatherPtr->sandstormSprites2Created) + if (!gWeatherPtr->sandstormSwirlSpritesCreated) { - for (i = 0; i < 5; i++) + for (i = 0; i < NUM_SWIRL_SANDSTORM_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 24, 208, 1); - + spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 24, 208, 1); if (spriteId != MAX_SPRITES) { gWeatherPtr->sprites.s2.sandstormSprites2[i] = &gSprites[spriteId]; gWeatherPtr->sprites.s2.sandstormSprites2[i]->oam.size = 2; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[1] = i * 51; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[0] = 8; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[2] = 0; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[4] = 0x6730; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[3] = gUnknown_0839AC5C[i]; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tSpriteRow = i * 51; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tRadius = 8; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tRadiusCounter = 0; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[4] = 0x6730; // unused value + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tEntranceDelay = sSwirlEntranceDelays[i]; StartSpriteAnim(gWeatherPtr->sprites.s2.sandstormSprites2[i], 1); CalcCenterToCornerVec(gWeatherPtr->sprites.s2.sandstormSprites2[i], 0, 2, 0); - gWeatherPtr->sprites.s2.sandstormSprites2[i]->callback = SandstormSpriteCallback2; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->callback = WaitSandSwirlSpriteEntrance; } else { gWeatherPtr->sprites.s2.sandstormSprites2[i] = NULL; } - gWeatherPtr->sandstormSprites2Created = TRUE; + + gWeatherPtr->sandstormSwirlSpritesCreated = TRUE; } } } -void SandstormSpriteCallback1(struct Sprite *sprite) +static void UpdateSandstormSprite(struct Sprite *sprite) { - sprite->pos2.y = gWeatherPtr->unknown_710; - sprite->pos1.x = gWeatherPtr->unknown_70E + 32 + sprite->data[0] * 64; + sprite->pos2.y = gWeatherPtr->sandstormPosY; + sprite->pos1.x = gWeatherPtr->sandstormBaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_70E + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x = gWeatherPtr->sandstormBaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } -void SandstormSpriteCallback3(struct Sprite *); - -void SandstormSpriteCallback2(struct Sprite *sprite) +static void WaitSandSwirlSpriteEntrance(struct Sprite *sprite) { - if (--sprite->data[3] == -1) - sprite->callback = SandstormSpriteCallback3; + if (--sprite->tEntranceDelay == -1) + sprite->callback = UpdateSandstormSwirlSprite; } -void SandstormSpriteCallback3(struct Sprite *sprite) +static void UpdateSandstormSwirlSprite(struct Sprite *sprite) { - u32 x; - u32 y; + u32 x, y; if (--sprite->pos1.y < -48) { sprite->pos1.y = 208; - sprite->data[0] = 4; + sprite->tRadius = 4; } - x = sprite->data[0] * gSineTable[sprite->data[1]]; - y = sprite->data[0] * gSineTable[sprite->data[1] + 64]; + + x = sprite->tRadius * gSineTable[sprite->tWaveIndex]; + y = sprite->tRadius * gSineTable[sprite->tWaveIndex + 0x40]; sprite->pos2.x = x >> 8; sprite->pos2.y = y >> 8; - sprite->data[1] = (sprite->data[1] + 10) & 0xFF; - if (++sprite->data[2] > 8) + sprite->tWaveIndex = (sprite->tWaveIndex + 10) & 0xFF; + if (++sprite->tRadiusCounter > 8) { - sprite->data[2] = 0; - sprite->data[0]++; + sprite->tRadiusCounter = 0; + sprite->tRadius++; } } +#undef tSpriteColumn +#undef tSpriteRow + +#undef tRadius +#undef tWaveIndex +#undef tRadiusCounter +#undef tEntranceDelay + //------------------------------------------------------------------------------ // Shade //------------------------------------------------------------------------------ @@ -2204,61 +2242,20 @@ bool8 Shade_Finish(void) // Bubbles //------------------------------------------------------------------------------ -const u8 gUnknown_0839AC68[] = {40, 90, 60, 90, 2, 60, 40, 30}; +static void CreateBubbleSprite(u16); +static void DestroyBubbleSprites(void); +static void UpdateBubbleSprite(struct Sprite *); -const struct SpriteSheet gWeatherBubbleSpriteSheet = {gWeatherBubbleTiles, sizeof(gWeatherBubbleTiles), 0x1205}; +static const u8 sBubbleStartDelays[] = {40, 90, 60, 90, 2, 60, 40, 30}; -void Bubbles_InitVars(void) +static const struct SpriteSheet sWeatherBubbleSpriteSheet = { - Fog1_InitVars(); - if (gWeatherPtr->unknown_72E == 0) - { - LoadSpriteSheet(&gWeatherBubbleSpriteSheet); - gWeatherPtr->unknown_728 = 0; - gWeatherPtr->unknown_726 = gUnknown_0839AC68[0]; - gWeatherPtr->unknown_72A = 0; - gWeatherPtr->unknown_72C = 0; - } -} + .data = gWeatherBubbleTiles, + .size = sizeof(gWeatherBubbleTiles), + .tag = 0x1205, +}; -void Bubbles_Main(void); - -void Bubbles_InitAll(void) -{ - Bubbles_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Bubbles_Main(); -} - -void sub_8080588(u16); - -void Bubbles_Main(void) -{ - Fog1_Main(); - if (++gWeatherPtr->unknown_726 > gUnknown_0839AC68[gWeatherPtr->unknown_728]) - { - gWeatherPtr->unknown_726 = 0; - if (++gWeatherPtr->unknown_728 > 7) - gWeatherPtr->unknown_728 = 0; - sub_8080588(gWeatherPtr->unknown_72A); - if (++gWeatherPtr->unknown_72A > 12) - gWeatherPtr->unknown_72A = 0; - } -} - -void sub_8080610(void); - -bool8 Bubbles_Finish(void) -{ - if (!Fog1_Finish()) - { - sub_8080610(); - return FALSE; - } - return TRUE; -} - -const s16 gUnknown_0839AC78[][2] = +static const s16 sBubbleStartCoords[][2] = { {120, 160}, {376, 160}, @@ -2275,91 +2272,139 @@ const s16 gUnknown_0839AC78[][2] = {256, 160}, }; -const union AnimCmd gSpriteAnim_839ACAC[] = +void Bubbles_InitVars(void) +{ + Fog1_InitVars(); + if (!gWeatherPtr->bubblesSpritesCreated) + { + LoadSpriteSheet(&sWeatherBubbleSpriteSheet); + gWeatherPtr->bubblesDelayIndex = 0; + gWeatherPtr->bubblesDelayCounter = sBubbleStartDelays[0]; + gWeatherPtr->bubblesCoordsIndex = 0; + gWeatherPtr->bubblesSpriteCount = 0; + } +} + +void Bubbles_InitAll(void) +{ + Bubbles_InitVars(); + while (!gWeatherPtr->weatherGfxLoaded) + Bubbles_Main(); +} + +void Bubbles_Main(void) +{ + Fog1_Main(); + if (++gWeatherPtr->bubblesDelayCounter > sBubbleStartDelays[gWeatherPtr->bubblesDelayIndex]) + { + gWeatherPtr->bubblesDelayCounter = 0; + if (++gWeatherPtr->bubblesDelayIndex > ARRAY_COUNT(sBubbleStartDelays) - 1) + gWeatherPtr->bubblesDelayIndex = 0; + + CreateBubbleSprite(gWeatherPtr->bubblesCoordsIndex); + if (++gWeatherPtr->bubblesCoordsIndex > ARRAY_COUNT(sBubbleStartCoords) - 1) + gWeatherPtr->bubblesCoordsIndex = 0; + } +} + +bool8 Bubbles_Finish(void) +{ + if (!Fog1_Finish()) + { + DestroyBubbleSprites(); + return FALSE; + } + + return TRUE; +} + +static const union AnimCmd sBubbleSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_FRAME(1, 16), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839ACB8[] = +static const union AnimCmd *const sBubbleSpriteAnimCmds[] = { - gSpriteAnim_839ACAC, + sBubbleSpriteAnimCmd0, }; -extern const struct OamData gUnknown_08524904; - -void unc_0807DAB4(struct Sprite *); -const struct SpriteTemplate gSpriteTemplate_839ACBC = +static const struct SpriteTemplate sBubbleSpriteTemplate = { - .tileTag = 4613, + .tileTag = 0x1205, .paletteTag = 0x1200, .oam = &gUnknown_08524904, - .anims = gSpriteAnimTable_839ACB8, + .anims = sBubbleSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = unc_0807DAB4, + .callback = UpdateBubbleSprite, }; -void sub_8080588(u16 a) -{ - s16 x = gUnknown_0839AC78[a][0]; - s16 y = gUnknown_0839AC78[a][1] - gSpriteCoordOffsetY; - u8 spriteId = CreateSpriteAtEnd( - &gSpriteTemplate_839ACBC, - x, - y, - 0); +#define tScrollXCounter data[0] +#define tScrollXDir data[1] +#define tCounter data[2] +static void CreateBubbleSprite(u16 coordsIndex) +{ + s16 x = sBubbleStartCoords[coordsIndex][0]; + s16 y = sBubbleStartCoords[coordsIndex][1] - gSpriteCoordOffsetY; + u8 spriteId = CreateSpriteAtEnd(&sBubbleSpriteTemplate, x, y, 0); if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.priority = 1; gSprites[spriteId].coordOffsetEnabled = TRUE; - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].data[2] = 0; - gWeatherPtr->unknown_72C++; + gSprites[spriteId].tScrollXCounter = 0; + gSprites[spriteId].tScrollXDir = 0; + gSprites[spriteId].tCounter = 0; + gWeatherPtr->bubblesSpriteCount++; } } -void sub_8080610(void) +static void DestroyBubbleSprites(void) { u16 i; - if (gWeatherPtr->unknown_72C != 0) + if (gWeatherPtr->bubblesSpriteCount) { - for (i = 0; i < 64; i++) + for (i = 0; i < MAX_SPRITES; i++) { - if (gSprites[i].template == &gSpriteTemplate_839ACBC) + if (gSprites[i].template == &sBubbleSpriteTemplate) DestroySprite(&gSprites[i]); } + FreeSpriteTilesByTag(0x1205); - gWeatherPtr->unknown_72C = 0; + gWeatherPtr->bubblesSpriteCount = 0; } } -void unc_0807DAB4(struct Sprite *sprite) +static void UpdateBubbleSprite(struct Sprite *sprite) { - ++sprite->data[0]; - if (++sprite->data[0] > 8) // double increment + ++sprite->tScrollXCounter; + if (++sprite->tScrollXCounter > 8) // double increment { - sprite->data[0] = 0; - if (sprite->data[1] == 0) + sprite->tScrollXCounter = 0; + if (sprite->tScrollXDir == 0) { if (++sprite->pos2.x > 4) - sprite->data[1] = 1; + sprite->tScrollXDir = 1; } else { if (--sprite->pos2.x <= 0) - sprite->data[1] = 0; + sprite->tScrollXDir = 0; } } + sprite->pos1.y -= 3; - if (++sprite->data[2] > 0x77) + if (++sprite->tCounter >= 120) DestroySprite(sprite); } +#undef tScrollXCounter +#undef tScrollXDir +#undef tCounter + //------------------------------------------------------------------------------ // Unused function. From 02651f6177032baad32efdddeee54a9af624812b Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Tue, 2 Apr 2019 19:18:36 -0700 Subject: [PATCH 16/42] Attempt to decompile menu_specialized. 2 NONMATCHING --- asm/menu_specialized.s | 336 ---------------------------- include/menu_specialized.h | 6 +- include/strings.h | 2 + ld_script.txt | 1 - src/menu_specialized.c | 437 ++++++++++++++++++++++++++++++++++++- 5 files changed, 441 insertions(+), 341 deletions(-) delete mode 100644 asm/menu_specialized.s diff --git a/asm/menu_specialized.s b/asm/menu_specialized.s deleted file mode 100644 index 36db0f865..000000000 --- a/asm/menu_specialized.s +++ /dev/null @@ -1,336 +0,0 @@ - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - thumb_func_start DrawLevelUpWindowPg1 -DrawLevelUpWindowPg1: @ 81D3640 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r6, r1, 0 - adds r5, r2, 0 - adds r4, r3, 0 - ldr r3, [sp, 0x4C] - ldr r0, [sp, 0x50] - mov r9, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r3, [sp, 0x28] - bl FillWindowPixelBuffer - add r2, sp, 0xC - ldrh r0, [r5] - ldrh r1, [r6] - subs r0, r1 - strh r0, [r2] - ldrh r0, [r5, 0x2] - ldrh r1, [r6, 0x2] - subs r0, r1 - strh r0, [r2, 0x2] - ldrh r0, [r5, 0x4] - ldrh r1, [r6, 0x4] - subs r0, r1 - strh r0, [r2, 0x4] - ldrh r0, [r5, 0x8] - ldrh r1, [r6, 0x8] - subs r0, r1 - strh r0, [r2, 0x6] - ldrh r0, [r5, 0xA] - ldrh r1, [r6, 0xA] - subs r0, r1 - strh r0, [r2, 0x8] - ldrh r0, [r5, 0x6] - ldrh r1, [r6, 0x6] - subs r0, r1 - strh r0, [r2, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - ldr r3, [sp, 0x28] - strb r3, [r0, 0x1] - mov r1, r9 - strb r1, [r0, 0x2] - movs r7, 0 - mov r10, r0 - movs r0, 0x1 - negs r0, r0 - mov r9, r0 - add r6, sp, 0x18 -_081D36CA: - lsls r0, r7, 4 - subs r0, r7 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r7, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - lsls r0, r7, 1 - mov r4, sp - adds r4, r0 - adds r4, 0xC - movs r1, 0 - ldrsh r0, [r4, r1] - ldr r1, =gText_Dash - cmp r0, 0 - blt _081D3704 - ldr r1, =gText_UnkCtrlF904 -_081D3704: - adds r0, r6, 0 - bl StringCopy - mov r0, r10 - str r0, [sp] - mov r1, r9 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0x38 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - movs r0, 0 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081D372C - negs r0, r1 -_081D372C: - movs r4, 0xC - cmp r0, 0x9 - bgt _081D3734 - movs r4, 0x12 -_081D3734: - cmp r1, 0 - bge _081D373A - negs r1, r1 -_081D373A: - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r2, r4, 0 - adds r2, 0x38 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x5 - bls _081D36CA - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DrawLevelUpWindowPg1 - - thumb_func_start DrawLevelUpWindowPg2 -DrawLevelUpWindowPg2: @ 81D3784 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r5, r1, 0 - adds r4, r2, 0 - adds r6, r3, 0 - ldr r2, [sp, 0x4C] - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r2, [sp, 0x28] - bl FillWindowPixelBuffer - add r1, sp, 0xC - ldrh r0, [r5] - strh r0, [r1] - ldrh r0, [r5, 0x2] - strh r0, [r1, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r1, 0x4] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x6] - ldrh r0, [r5, 0xA] - strh r0, [r1, 0x8] - ldrh r0, [r5, 0x6] - strh r0, [r1, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - strb r6, [r0, 0x1] - ldr r2, [sp, 0x28] - strb r2, [r0, 0x2] - movs r6, 0 - add r1, sp, 0x18 - mov r9, r1 - mov r7, r8 - mov r10, r0 - movs r2, 0x1 - negs r2, r2 - mov r8, r2 -_081D37EE: - lsls r1, r6, 1 - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r0, [r0, r2] - movs r4, 0x3 - cmp r0, 0x63 - bgt _081D3808 - movs r4, 0x1 - cmp r0, 0x9 - ble _081D3808 - movs r4, 0x2 -_081D3808: - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r1, [r0, r2] - mov r0, r9 - movs r2, 0 - adds r3, r4, 0 - bl ConvertIntToDecimalStringN - movs r0, 0x4 - subs r0, r4 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 17 - lsrs r4, 16 - lsls r5, r6, 4 - subs r5, r6 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r6, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - mov r2, r10 - str r2, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _081D37EE - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DrawLevelUpWindowPg2 - - thumb_func_start GetMonLevelUpWindowStats -GetMonLevelUpWindowStats: @ 81D388C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - movs r1, 0x3A @ MON_DATA_MAX_HP - bl GetMonData - strh r0, [r5] - adds r0, r4, 0 - movs r1, 0x3B @ MON_DATA_ATK - bl GetMonData - strh r0, [r5, 0x2] - adds r0, r4, 0 - movs r1, 0x3C @ MON_DATA_DEF - bl GetMonData - strh r0, [r5, 0x4] - adds r0, r4, 0 - movs r1, 0x3D @ MON_DATA_SPEED - bl GetMonData - strh r0, [r5, 0x6] - adds r0, r4, 0 - movs r1, 0x3E @ MON_DATA_SPATK - bl GetMonData - strh r0, [r5, 0x8] - adds r0, r4, 0 - movs r1, 0x3F @ MON_DATA_SPDEF - bl GetMonData - strh r0, [r5, 0xA] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetMonLevelUpWindowStats - - .align 2, 0 @ Don't pad with nop. diff --git a/include/menu_specialized.h b/include/menu_specialized.h index d29ac5751..fb23e7ce6 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -32,8 +32,8 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1EC0(void); void sub_81D1D04(u8 a0); -void DrawLevelUpWindowPg1(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); -void DrawLevelUpWindowPg2(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void DrawLevelUpWindowPg1(u16 arg0, u16* statStoreLocation1, u16* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); @@ -47,7 +47,7 @@ bool16 MoveRelearnerRunTextPrinters(void); void MoveRelearnerCreateYesNoMenu(void); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); void InitMoveRelearnerWindows(bool8 useContextWindow); -void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); +void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); diff --git a/include/strings.h b/include/strings.h index 8aa296eb1..fc5724af3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -471,6 +471,8 @@ extern const u8 gText_EggCantBattle[]; extern const u8 gText_PkmnAlreadySelected[]; extern const u8 gText_PkmnAlreadyInBattle[]; extern const u8 gText_PkmnCantSwitchOut[]; +extern const u8 gText_Dash[]; +extern const u8 gText_UnkCtrlF904[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/ld_script.txt b/ld_script.txt index 619abfce1..5cb7851bf 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -303,7 +303,6 @@ SECTIONS { asm/pokenav.o(.text); src/pokenav_match_call.o(.text); src/menu_specialized.o(.text); - asm/menu_specialized.o(.text); src/ereader_helpers.o(.text); src/faraway_island.o(.text); src/ereader_screen.o(.text); diff --git a/src/menu_specialized.c b/src/menu_specialized.c index f21f4e51a..c8c46fbc1 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -28,6 +28,7 @@ #include "gba/io_reg.h" extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u8 *gUnknown_08625B54[]; EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0}; EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL; @@ -259,7 +260,7 @@ static void sub_81D1D44(u8 windowId, s32 itemId, u8 y) u8 buffer[30]; u16 length; - if (itemId == LIST_CANCEL) + if (itemId == LIST_CANCEL) return; StringCopy(buffer, gSaveBlock1Ptr->mail[6 + itemId].playerName); @@ -1639,3 +1640,437 @@ static void sub_81D35E8(struct Sprite *sprite) id = gSprites[id].data[5]; } } + + +#ifdef NONMATCHING +void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +{ + s32 i; + s16 array[6]; + u8 *text; + u8 *text2; + s16 *ptr; + u8 something[14]; + s32 var; + u8 var2; + s32 var3; + + + + + + FillWindowPixelBuffer(arg0, arg3 * 16 | arg3); + + + array[0] = statStoreLocation2[0] - statStoreLocation1[0]; + array[1] = statStoreLocation2[1] - statStoreLocation1[1]; + array[2] = statStoreLocation2[2] - statStoreLocation1[2]; + array[3] = statStoreLocation2[4] - statStoreLocation1[4]; + array[4] = statStoreLocation2[5] - statStoreLocation1[5]; + array[5] = statStoreLocation2[3] - statStoreLocation1[3]; + + + for(i = 0; i < 6; i++) + { + AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg3, TEXT_SPEED_FF, gUnknown_08625B54[i]); + ptr = &array[i]; + text = (u8 *) gText_Dash; + + if(*ptr >= 0) + { + text = (u8 *) gText_UnkCtrlF904; + } + + StringCopy(text2, text); + AddTextPrinterParameterized3(arg0, 1, 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + var3 = *ptr; + var = var3; + + if(var3 < 0) + { + var = -var3; + } + + var2 = 12; + + if(var <= 9) + { + var2 = 18; + } + + if(var3 < 0) + { + var3 = -var3; + } + + ConvertIntToDecimalStringN(text2, var3, 0, 2); + AddTextPrinterParameterized3(arg0, 1, var2 + 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + } +} +#else +NAKED +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +{ + asm(".syntax unified\n\ +push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x2C\n\ + mov r8, r0\n\ + adds r6, r1, 0\n\ + adds r5, r2, 0\n\ + adds r4, r3, 0\n\ + ldr r3, [sp, 0x4C]\n\ + ldr r0, [sp, 0x50]\n\ + mov r9, r0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + mov r1, r9\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r9, r1\n\ + mov r0, r8\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r1, r4, 4\n\ + orrs r1, r4\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + str r3, [sp, 0x28]\n\ + bl FillWindowPixelBuffer\n\ + add r2, sp, 0xC\n\ + ldrh r0, [r5]\n\ + ldrh r1, [r6]\n\ + subs r0, r1\n\ + strh r0, [r2]\n\ + ldrh r0, [r5, 0x2]\n\ + ldrh r1, [r6, 0x2]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x2]\n\ + ldrh r0, [r5, 0x4]\n\ + ldrh r1, [r6, 0x4]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x4]\n\ + ldrh r0, [r5, 0x8]\n\ + ldrh r1, [r6, 0x8]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x6]\n\ + ldrh r0, [r5, 0xA]\n\ + ldrh r1, [r6, 0xA]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x8]\n\ + ldrh r0, [r5, 0x6]\n\ + ldrh r1, [r6, 0x6]\n\ + subs r0, r1\n\ + strh r0, [r2, 0xA]\n\ + add r0, sp, 0x24\n\ + strb r4, [r0]\n\ + ldr r3, [sp, 0x28]\n\ + strb r3, [r0, 0x1]\n\ + mov r1, r9\n\ + strb r1, [r0, 0x2]\n\ + movs r7, 0\n\ + mov r10, r0\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + mov r9, r0\n\ + add r6, sp, 0x18\n\ +_081D36CA:\n\ + lsls r0, r7, 4\n\ + subs r0, r7\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + mov r1, r10\n\ + str r1, [sp]\n\ + mov r0, r9\n\ + str r0, [sp, 0x4]\n\ + ldr r1, =gUnknown_08625B54\n\ + lsls r0, r7, 2\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + str r0, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + movs r2, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + lsls r0, r7, 1\n\ + mov r4, sp\n\ + adds r4, r0\n\ + adds r4, 0xC\n\ + movs r1, 0\n\ + ldrsh r0, [r4, r1]\n\ + ldr r1, =gText_Dash\n\ + cmp r0, 0\n\ + blt _081D3704\n\ + ldr r1, =gText_UnkCtrlF904\n\ +_081D3704:\n\ + adds r0, r6, 0\n\ + bl StringCopy\n\ + mov r0, r10\n\ + str r0, [sp]\n\ + mov r1, r9\n\ + str r1, [sp, 0x4]\n\ + str r6, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + movs r2, 0x38\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + movs r0, 0\n\ + ldrsh r1, [r4, r0]\n\ + adds r0, r1, 0\n\ + cmp r1, 0\n\ + bge _081D372C\n\ + negs r0, r1\n\ +_081D372C:\n\ + movs r4, 0xC\n\ + cmp r0, 0x9\n\ + bgt _081D3734\n\ + movs r4, 0x12\n\ +_081D3734:\n\ + cmp r1, 0\n\ + bge _081D373A\n\ + negs r1, r1\n\ +_081D373A:\n\ + adds r0, r6, 0\n\ + movs r2, 0\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + adds r2, r4, 0\n\ + adds r2, 0x38\n\ + mov r1, r10\n\ + str r1, [sp]\n\ + mov r0, r9\n\ + str r0, [sp, 0x4]\n\ + str r6, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r0, r7, 0x1\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + cmp r7, 0x5\n\ + bls _081D36CA\n\ + add sp, 0x2C\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +#ifdef NONMATCHING +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +{ + s32 i; + s32 var; + s32 var2; + u8 text; + s16 array[6]; + u8 *something; + u8 some; + FillWindowPixelBuffer(arg0, arg2 * 16 | arg2); + array[0] = statStoreLocation1[0]; + array[1] = statStoreLocation1[1]; + array[2] = statStoreLocation1[2]; + array[3] = statStoreLocation1[4]; + array[4] = statStoreLocation1[5]; + array[5] = statStoreLocation1[3]; + for(i = 0; i <= 5; i++) + { + var = array[i]; + var2 = 3; + if(var <= 99) + { + var2 = 1; + if(var > 9) + { + var2 = 2; + } + } + something = ConvertIntToDecimalStringN(&text, array[i], 0, var2); + some = (((4 - *something) * 2) + *something) * 2; + AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg2, TEXT_SPEED_FF, gUnknown_08625B54[i]); + AddTextPrinterParameterized3(arg0, 1, some + 56, 15 * i, &arg2, TEXT_SPEED_FF, &text); + } +} +#else +NAKED +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x2C\n\ + mov r8, r0\n\ + adds r5, r1, 0\n\ + adds r4, r2, 0\n\ + adds r6, r3, 0\n\ + ldr r2, [sp, 0x4C]\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r1, r4, 4\n\ + orrs r1, r4\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + str r2, [sp, 0x28]\n\ + bl FillWindowPixelBuffer\n\ + add r1, sp, 0xC\n\ + ldrh r0, [r5]\n\ + strh r0, [r1]\n\ + ldrh r0, [r5, 0x2]\n\ + strh r0, [r1, 0x2]\n\ + ldrh r0, [r5, 0x4]\n\ + strh r0, [r1, 0x4]\n\ + ldrh r0, [r5, 0x8]\n\ + strh r0, [r1, 0x6]\n\ + ldrh r0, [r5, 0xA]\n\ + strh r0, [r1, 0x8]\n\ + ldrh r0, [r5, 0x6]\n\ + strh r0, [r1, 0xA]\n\ + add r0, sp, 0x24\n\ + strb r4, [r0]\n\ + strb r6, [r0, 0x1]\n\ + ldr r2, [sp, 0x28]\n\ + strb r2, [r0, 0x2]\n\ + movs r6, 0\n\ + add r1, sp, 0x18\n\ + mov r9, r1\n\ + mov r7, r8\n\ + mov r10, r0\n\ + movs r2, 0x1\n\ + negs r2, r2\n\ + mov r8, r2\n\ +_081D37EE:\n\ + lsls r1, r6, 1\n\ + mov r0, sp\n\ + adds r0, r1\n\ + adds r0, 0xC\n\ + movs r2, 0\n\ + ldrsh r0, [r0, r2]\n\ + movs r4, 0x3\n\ + cmp r0, 0x63\n\ + bgt _081D3808\n\ + movs r4, 0x1\n\ + cmp r0, 0x9\n\ + ble _081D3808\n\ + movs r4, 0x2\n\ +_081D3808:\n\ + mov r0, sp\n\ + adds r0, r1\n\ + adds r0, 0xC\n\ + movs r2, 0\n\ + ldrsh r1, [r0, r2]\n\ + mov r0, r9\n\ + movs r2, 0\n\ + adds r3, r4, 0\n\ + bl ConvertIntToDecimalStringN\n\ + movs r0, 0x4\n\ + subs r0, r4\n\ + lsls r4, r0, 1\n\ + adds r4, r0\n\ + lsls r4, 17\n\ + lsrs r4, 16\n\ + lsls r5, r6, 4\n\ + subs r5, r6\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + mov r0, r10\n\ + str r0, [sp]\n\ + mov r1, r8\n\ + str r1, [sp, 0x4]\n\ + ldr r1, =gUnknown_08625B54\n\ + lsls r0, r6, 2\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + str r0, [sp, 0x8]\n\ + adds r0, r7, 0\n\ + movs r1, 0x1\n\ + movs r2, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r4, 0x38\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + mov r2, r10\n\ + str r2, [sp]\n\ + mov r0, r8\n\ + str r0, [sp, 0x4]\n\ + mov r1, r9\n\ + str r1, [sp, 0x8]\n\ + adds r0, r7, 0\n\ + movs r1, 0x1\n\ + adds r2, r4, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r0, r6, 0x1\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + cmp r6, 0x5\n\ + bls _081D37EE\n\ + add sp, 0x2C\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation) +{ + statStoreLocation[0] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[1] = GetMonData(mon, MON_DATA_ATK); + statStoreLocation[2] = GetMonData(mon, MON_DATA_DEF); + statStoreLocation[3] = GetMonData(mon, MON_DATA_SPEED); + statStoreLocation[4] = GetMonData(mon, MON_DATA_SPATK); + statStoreLocation[5] = GetMonData(mon, MON_DATA_SPDEF); +} + + + + + + + + + + + + + + + + + + + + + + From 438521bf21e24afc15adf871f154d5d7c361408a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 3 Apr 2019 22:00:15 +0200 Subject: [PATCH 17/42] Get rid of redundant cast --- src/pokemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokemon.c b/src/pokemon.c index 984c484a2..a75701cb0 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5463,7 +5463,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) if (gEvolutionTable[species][i].param == heldItem) { heldItem = 0; - SetMonData(mon, MON_DATA_HELD_ITEM, (u8 *)&heldItem); + SetMonData(mon, MON_DATA_HELD_ITEM, &heldItem); targetSpecies = gEvolutionTable[species][i].targetSpecies; } break; From a455d98385cdeadc65ee3df992fc8d6be36495b3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 08:43:16 -0400 Subject: [PATCH 18/42] start porting mevent_server from firered --- asm/mevent_server.s | 115 +------------------------------- asm/mevent_server_helpers.s | 6 +- asm/mevent_server_ish.s | 2 +- data/mevent_server.s | 4 +- include/mevent_server.h | 74 ++++++++++++++++++++ include/mevent_server_helpers.h | 6 ++ ld_script.txt | 2 + src/mevent_server.c | 56 ++++++++++++++++ sym_ewram.txt | 10 +-- 9 files changed, 150 insertions(+), 125 deletions(-) create mode 100644 include/mevent_server_helpers.h create mode 100644 src/mevent_server.c diff --git a/asm/mevent_server.s b/asm/mevent_server.s index 8c76e2d0d..ea4416ac7 100755 --- a/asm/mevent_server.s +++ b/asm/mevent_server.s @@ -5,115 +5,6 @@ .text - thumb_func_start mevent_srv_init_wnews -mevent_srv_init_wnews: @ 801D07C - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F298C - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_init_wnews - - thumb_func_start mevent_srv_new_wcard -mevent_srv_new_wcard: @ 801D0A0 - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F29EC - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_new_wcard - - thumb_func_start mevent_srv_common_do_exec -mevent_srv_common_do_exec: @ 801D0C4 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =gUnknown_02022C7C - ldr r0, [r4] - cmp r0, 0 - bne _0801D0D8 - movs r0, 0x3 - b _0801D0F8 - .pool -_0801D0D8: - bl mevent_dispatch_08145600 - adds r5, r0, 0 - cmp r5, 0x3 - bne _0801D0F6 - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl mevent_srv_free_resources - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D0F6: - adds r0, r5, 0 -_0801D0F8: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_srv_common_do_exec - - thumb_func_start mevent_srv_init_common -mevent_srv_init_common: @ 801D100 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - mov r9, r3 - movs r5, 0 - str r5, [r4] - str r5, [r4, 0x8] - movs r0, 0xA6 - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x18] - movs r0, 0xDE - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x80 - lsls r0, 3 - bl AllocZeroed - str r0, [r4, 0x14] - movs r0, 0x64 - bl AllocZeroed - str r0, [r4, 0x20] - str r6, [r4, 0x10] - str r5, [r4, 0xC] - adds r4, 0x38 - adds r0, r4, 0 - mov r1, r8 - mov r2, r9 - bl sub_801D8D8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_init_common - thumb_func_start mevent_srv_free_resources mevent_srv_free_resources: @ 801D158 push {r4,lr} @@ -517,8 +408,8 @@ _0801D464: bx r1 thumb_func_end sub_801D1F0 - thumb_func_start mevent_dispatch_08145600 -mevent_dispatch_08145600: @ 801D46C + thumb_func_start mevent_srv_exec_common +mevent_srv_exec_common: @ 801D46C push {lr} ldr r2, =gUnknown_082F2548 ldr r1, [r0, 0x8] @@ -529,6 +420,6 @@ mevent_dispatch_08145600: @ 801D46C pop {r1} bx r1 .pool - thumb_func_end mevent_dispatch_08145600 + thumb_func_end mevent_srv_exec_common .align 2, 0 @ don't pad with nop diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s index f92f1e2c7..6a60649a4 100755 --- a/asm/mevent_server_helpers.s +++ b/asm/mevent_server_helpers.s @@ -23,8 +23,8 @@ sub_801D8CC: @ 801D8CC bx r1 thumb_func_end sub_801D8CC - thumb_func_start sub_801D8D8 -sub_801D8D8: @ 801D8D8 + thumb_func_start mevent_srv_sub_init +mevent_srv_sub_init: @ 801D8D8 movs r3, 0 strb r1, [r0, 0x4] strb r2, [r0, 0x5] @@ -43,7 +43,7 @@ sub_801D8D8: @ 801D8D8 str r1, [r0, 0x20] bx lr .pool - thumb_func_end sub_801D8D8 + thumb_func_end mevent_srv_sub_init thumb_func_start sub_801D904 sub_801D904: @ 801D904 diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s index f61666982..765b39b7e 100755 --- a/asm/mevent_server_ish.s +++ b/asm/mevent_server_ish.s @@ -115,7 +115,7 @@ mevent_srv_ish_init: @ 801D50C adds r0, r4, 0 adds r1, r6, 0 mov r2, r8 - bl sub_801D8D8 + bl mevent_srv_sub_init pop {r3} mov r8, r3 pop {r4-r6} diff --git a/data/mevent_server.s b/data/mevent_server.s index 02fe9476e..eaab75c36 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -242,7 +242,7 @@ gUnknown_082F292C:: @ 82F292C .byte 0x00, 0x00, 0x00, 0x00 .align 2 -gUnknown_082F298C:: @ 82F298C +s_mevent_wonder_news:: @ 82F298C .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 .byte 0x20, 0x00, 0x00, 0x00 @@ -262,7 +262,7 @@ gUnknown_082F298C:: @ 82F298C .4byte gUnknown_082F2800 .align 2 -gUnknown_082F29EC:: @ 82F29EC +s_mevent_wonder_card:: @ 82F29EC .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/include/mevent_server.h b/include/mevent_server.h index d7657b270..772aae6b1 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -1,6 +1,80 @@ #ifndef GUARD_MEVENT_SERVER_H #define GUARD_MEVENT_SERVER_H +#define ME_SEND_BUF_SIZE 0x400 + +struct mevent_srv_sub +{ + s32 seqno; + u8 sendPlayerNo; + u8 recvPlayerNo; + u16 recvIdent; + u16 recvCounter; + u16 recvCRC; + u16 recvSize; + u16 sendIdent; + u16 sendCounter; + u16 sendCRC; + u16 sendSize; + void * recvBfr; + const void * sendBfr; + u32 (*recvFunc)(struct mevent_srv_sub *); + u32 (*sendFunc)(struct mevent_srv_sub *); +}; + +struct send_recv_header +{ + u16 ident; + u16 crc; + u16 size; +}; + +struct mevent_cmd_ish +{ + u32 instr; + u32 parameter; +}; + +struct mevent_srv_ish +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 flag; + u32 cmdidx; + void * sendBuffer; + void * recvBuffer; + struct mevent_cmd_ish * cmdBuffer; + void * buffer; + struct mevent_srv_sub manager; +}; + +struct mevent_cmd +{ + u32 instr; + bool32 flag; + void * parameter; +}; + +struct mevent_srv_common +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 cmdidx; + const struct mevent_cmd * cmdBuffer; + void * recvBuffer; + struct MEventBuffer_32E0_Sub * mevent_32e0; + struct MEventBuffer_3120_Sub * mevent_3120; + struct MEventStruct_Unk1442CC * mevent_unk1442cc; + void * sendBuffer1; + u32 sendBuffer1Size; + void * sendBuffer2; + u32 sendBuffer2Size; + u32 sendWord; + struct mevent_srv_sub manager; +}; + void mevent_srv_new_wcard(); void mevent_srv_init_wnews(); u32 mevent_srv_common_do_exec(u16 * a0); diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h new file mode 100644 index 000000000..d2b4608fb --- /dev/null +++ b/include/mevent_server_helpers.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT_SERVER_HELPERS_H +#define GUARD_MEVENT_SERVER_HELPERS_H + +void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); + +#endif //GUARD_MEVENT_SERVER_HELPERS_H diff --git a/ld_script.txt b/ld_script.txt index 619abfce1..31de8d730 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -60,6 +60,7 @@ SECTIONS { src/union_room_battle.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); + src/mevent_server.o(.text); asm/mevent_server.o(.text); asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); @@ -416,6 +417,7 @@ SECTIONS { src/union_room_battle.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); + src/mevent_server.o(.rodata); data/mevent_server.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server.c b/src/mevent_server.c new file mode 100644 index 000000000..ea5a18626 --- /dev/null +++ b/src/mevent_server.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "alloc.h" +#include "mevent.h" +#include "mevent_server.h" +#include "mevent_server_helpers.h" + +EWRAM_DATA struct mevent_srv_common * s_mevent_srv_common_ptr = NULL; +EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; + +static void mevent_srv_init_common(struct mevent_srv_common *, const void *, u32, u32); +u32 mevent_srv_exec_common(struct mevent_srv_common *); +u32 mevent_srv_free_resources(struct mevent_srv_common *); + +extern const struct mevent_cmd s_mevent_wonder_news[]; +extern const struct mevent_cmd s_mevent_wonder_card[]; + +void mevent_srv_init_wnews(void) +{ + s_mevent_srv_common_ptr = AllocZeroed(sizeof(struct mevent_srv_common)); + mevent_srv_init_common(s_mevent_srv_common_ptr, s_mevent_wonder_news, 0, 1); +} + +void mevent_srv_new_wcard(void) +{ + s_mevent_srv_common_ptr = AllocZeroed(sizeof(struct mevent_srv_common)); + mevent_srv_init_common(s_mevent_srv_common_ptr, s_mevent_wonder_card, 0, 1); +} + +u32 mevent_srv_common_do_exec(u16 * a0) +{ + u32 result; + if (s_mevent_srv_common_ptr == NULL) + return 3; + result = mevent_srv_exec_common(s_mevent_srv_common_ptr); + if (result == 3) + { + *a0 = s_mevent_srv_common_ptr->param; + mevent_srv_free_resources(s_mevent_srv_common_ptr); + Free(s_mevent_srv_common_ptr); + s_mevent_srv_common_ptr = NULL; + } + return result; +} + +static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * cmdBuffer, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->unk_00 = 0; + svr->mainseqno = 0; + svr->mevent_32e0 = AllocZeroed(sizeof(struct MEventBuffer_32E0_Sub)); + svr->mevent_3120 = AllocZeroed(sizeof(struct MEventBuffer_3120_Sub)); + svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->mevent_unk1442cc = AllocZeroed(sizeof(struct MEventStruct_Unk1442CC)); + svr->cmdBuffer = cmdBuffer; + svr->cmdidx = 0; + mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); +} diff --git a/sym_ewram.txt b/sym_ewram.txt index fa0306b1e..22afe8226 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -12,14 +12,10 @@ .include "src/union_room_battle.o" .include "src/mevent2.o" .include "src/mevent_801BAAC.o" + .include "src/mevent_server.o" - @ mevent_server -gUnknown_02022C7C: @ 2022C7C - .space 0x4 - -s_mevent_srv_ish_ptr: @ 2022C80 - .space 0x4 - + @ union_room_chat + .align 2 gUnknown_02022C84: @ 2022C84 .space 0x4 From dabd1f6177ee6e2f65553d3fe43efcf023e0c3fe Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 10:54:51 -0400 Subject: [PATCH 19/42] finish mevent_server.s --- asm/mevent_server.s | 425 -------------------------------- asm/mevent_server_helpers.s | 24 +- asm/mevent_server_ish.s | 12 +- data/mevent_server.s | 8 - include/mevent_server_helpers.h | 4 + ld_script.txt | 4 +- src/mevent_server.c | 235 +++++++++++++++++- src/mevent_server_helpers.c | 1 + src/mevent_server_ish.c | 7 + sym_ewram.txt | 1 + 10 files changed, 266 insertions(+), 455 deletions(-) delete mode 100755 asm/mevent_server.s create mode 100644 src/mevent_server_helpers.c create mode 100644 src/mevent_server_ish.c diff --git a/asm/mevent_server.s b/asm/mevent_server.s deleted file mode 100755 index ea4416ac7..000000000 --- a/asm/mevent_server.s +++ /dev/null @@ -1,425 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_free_resources -mevent_srv_free_resources: @ 801D158 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_free_resources - - thumb_func_start mevent_srv_814501C -mevent_srv_814501C: @ 801D17C - push {lr} - adds r0, 0x38 - bl sub_801D904 - pop {r0} - bx r0 - thumb_func_end mevent_srv_814501C - - thumb_func_start sub_801D188 -sub_801D188: @ 801D188 - push {lr} - cmp r0, 0 - bne _0801D190 - adds r0, r1, 0 -_0801D190: - pop {r1} - bx r1 - thumb_func_end sub_801D188 - - thumb_func_start sub_801D194 -sub_801D194: @ 801D194 - push {lr} - cmp r1, r0 - bcs _0801D19E - movs r0, 0 - b _0801D1A8 -_0801D19E: - cmp r1, r0 - beq _0801D1A6 - movs r0, 0x2 - b _0801D1A8 -_0801D1A6: - movs r0, 0x1 -_0801D1A8: - pop {r1} - bx r1 - thumb_func_end sub_801D194 - - thumb_func_start sub_801D1AC -sub_801D1AC: @ 801D1AC - movs r1, 0x4 - str r1, [r0, 0x8] - movs r0, 0 - bx lr - thumb_func_end sub_801D1AC - - thumb_func_start sub_801D1B4 -sub_801D1B4: @ 801D1B4 - movs r0, 0x3 - bx lr - thumb_func_end sub_801D1B4 - - thumb_func_start sub_801D1B8 -sub_801D1B8: @ 801D1B8 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8C0 - cmp r0, 0 - beq _0801D1CA - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1CA: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1B8 - - thumb_func_start sub_801D1D4 -sub_801D1D4: @ 801D1D4 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8CC - cmp r0, 0 - beq _0801D1E6 - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1E6: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1D4 - - thumb_func_start sub_801D1F0 -sub_801D1F0: @ 801D1F0 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, [r5, 0xC] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r2, [r5, 0x10] - adds r3, r2, r1 - adds r0, 0x1 - str r0, [r5, 0xC] - ldr r0, [r3] - cmp r0, 0x1E - bls _0801D20C - b _0801D464 -_0801D20C: - lsls r0, 2 - ldr r1, =_0801D21C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D21C: - .4byte _0801D298 - .4byte _0801D2A2 - .4byte _0801D2A8 - .4byte _0801D2E2 - .4byte _0801D2D8 - .4byte _0801D2BA - .4byte _0801D2C6 - .4byte _0801D2EC - .4byte _0801D300 - .4byte _0801D308 - .4byte _0801D31E - .4byte _0801D32E - .4byte _0801D33A - .4byte _0801D360 - .4byte _0801D348 - .4byte _0801D390 - .4byte _0801D378 - .4byte _0801D3DC - .4byte _0801D3A8 - .4byte _0801D3C0 - .4byte _0801D3CE - .4byte _0801D406 - .4byte _0801D3EA - .4byte _0801D3F8 - .4byte _0801D40E - .4byte _0801D418 - .4byte _0801D422 - .4byte _0801D43C - .4byte _0801D450 - .4byte _0801D458 - .4byte _0801D2CC -_0801D298: - movs r0, 0x1 - str r0, [r5, 0x8] - ldr r0, [r3, 0x4] - str r0, [r5, 0x4] - b _0801D464 -_0801D2A2: - movs r0, 0x3 - str r0, [r5, 0x8] - b _0801D464 -_0801D2A8: - adds r0, r5, 0 - adds r0, 0x38 - ldr r1, [r3, 0x4] - ldr r2, [r5, 0x14] - bl sub_801D928 - movs r0, 0x2 - str r0, [r5, 0x8] - b _0801D464 -_0801D2BA: - ldr r0, [r5, 0x20] - ldr r1, [r5, 0x14] - movs r2, 0x64 - bl memcpy - b _0801D464 -_0801D2C6: - ldr r0, [r5, 0x20] - movs r1, 0 - b _0801D2D0 -_0801D2CC: - ldr r0, [r5, 0x20] - movs r1, 0x1 -_0801D2D0: - bl sub_801B6A0 - str r0, [r5, 0x4] - b _0801D464 -_0801D2D8: - ldr r1, [r5, 0x4] - ldr r0, [r3, 0x4] - cmp r1, r0 - beq _0801D2E2 - b _0801D464 -_0801D2E2: - movs r0, 0 - str r0, [r5, 0xC] - ldr r0, [r3, 0x8] - str r0, [r5, 0x10] - b _0801D464 -_0801D2EC: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B6EC - str r0, [r5, 0x4] - b _0801D464 -_0801D300: - ldr r0, [r5, 0x14] - ldr r0, [r0] - str r0, [r5, 0x4] - b _0801D464 -_0801D308: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B708 - str r0, [r5, 0x4] - b _0801D464 -_0801D31E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x4] - bl sub_801B784 - lsls r0, 16 - lsrs r0, 16 - str r0, [r5, 0x4] - b _0801D464 -_0801D32E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x8] - bl sub_801B748 - str r0, [r5, 0x4] - b _0801D464 -_0801D33A: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x14] - ldr r1, [r1] - bl sub_801D194 - str r0, [r5, 0x4] - b _0801D464 -_0801D348: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x1C] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xDE - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x17 - bl mevent_srv_814501C - b _0801D464 -_0801D360: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xA6 - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x16 - bl mevent_srv_814501C - b _0801D464 -_0801D378: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - adds r0, r5, 0 - movs r1, 0x18 - movs r3, 0x4 - bl mevent_srv_814501C - b _0801D464 -_0801D390: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D39C - ldr r2, [r5, 0x24] - ldr r3, [r5, 0x28] - b _0801D39E -_0801D39C: - ldr r3, [r3, 0x4] -_0801D39E: - adds r0, r5, 0 - movs r1, 0x19 - bl mevent_srv_814501C - b _0801D464 -_0801D3A8: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D3B4 - ldr r2, [r5, 0x2C] - ldr r3, [r5, 0x30] - b _0801D3B6 -_0801D3B4: - ldr r3, [r3, 0x4] -_0801D3B6: - adds r0, r5, 0 - movs r1, 0x10 - bl mevent_srv_814501C - b _0801D464 -_0801D3C0: - ldr r2, [r3, 0x8] - adds r0, r5, 0 - movs r1, 0x1A - movs r3, 0xBC - bl mevent_srv_814501C - b _0801D464 -_0801D3CE: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x15 - bl mevent_srv_814501C - b _0801D464 -_0801D3DC: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1C - bl mevent_srv_814501C - b _0801D464 -_0801D3EA: - ldr r0, [r5, 0x18] - ldr r1, [r3, 0x8] - movs r2, 0xA6 - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D3F8: - ldr r0, [r5, 0x1C] - ldr r1, [r3, 0x8] - movs r2, 0xDE - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D406: - ldr r0, [r3, 0x8] - ldr r0, [r0] - str r0, [r5, 0x34] - b _0801D464 -_0801D40E: - ldr r0, [r3, 0x8] - str r0, [r5, 0x24] - ldr r0, [r3, 0x4] - str r0, [r5, 0x28] - b _0801D464 -_0801D418: - ldr r0, [r3, 0x8] - str r0, [r5, 0x2C] - ldr r0, [r3, 0x4] - str r0, [r5, 0x30] - b _0801D464 -_0801D422: - ldr r4, [r5, 0x18] - bl sav1_get_mevent_buffer_1 - adds r1, r0, 0 - movs r2, 0xA6 - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - ldr r0, [r5, 0x18] - bl sub_801B3C0 - b _0801D464 -_0801D43C: - ldr r4, [r5, 0x1C] - bl sav1_get_mevent_buffer_0 - adds r1, r0, 0 - movs r2, 0xDE - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - b _0801D464 -_0801D450: - bl sub_8099244 - str r0, [r5, 0x24] - b _0801D464 -_0801D458: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1B - bl mevent_srv_814501C -_0801D464: - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801D1F0 - - thumb_func_start mevent_srv_exec_common -mevent_srv_exec_common: @ 801D46C - push {lr} - ldr r2, =gUnknown_082F2548 - ldr r1, [r0, 0x8] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r1} - bx r1 - .pool - thumb_func_end mevent_srv_exec_common - - .align 2, 0 @ don't pad with nop diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s index 6a60649a4..9bb70ff63 100755 --- a/asm/mevent_server_helpers.s +++ b/asm/mevent_server_helpers.s @@ -5,23 +5,23 @@ .text - thumb_func_start sub_801D8C0 -sub_801D8C0: @ 801D8C0 + thumb_func_start mevent_srv_sub_recv +mevent_srv_sub_recv: @ 801D8C0 push {lr} ldr r1, [r0, 0x20] bl _call_via_r1 pop {r1} bx r1 - thumb_func_end sub_801D8C0 + thumb_func_end mevent_srv_sub_recv - thumb_func_start sub_801D8CC -sub_801D8CC: @ 801D8CC + thumb_func_start mevent_srv_sub_send +mevent_srv_sub_send: @ 801D8CC push {lr} ldr r1, [r0, 0x24] bl _call_via_r1 pop {r1} bx r1 - thumb_func_end sub_801D8CC + thumb_func_end mevent_srv_sub_send thumb_func_start mevent_srv_sub_init mevent_srv_sub_init: @ 801D8D8 @@ -45,8 +45,8 @@ mevent_srv_sub_init: @ 801D8D8 .pool thumb_func_end mevent_srv_sub_init - thumb_func_start sub_801D904 -sub_801D904: @ 801D904 + thumb_func_start mevent_srv_sub_init_send +mevent_srv_sub_init_send: @ 801D904 push {r4,lr} adds r4, r0, 0 movs r0, 0 @@ -67,10 +67,10 @@ _0801D920: pop {r4} pop {r0} bx r0 - thumb_func_end sub_801D904 + thumb_func_end mevent_srv_sub_init_send - thumb_func_start sub_801D928 -sub_801D928: @ 801D928 + thumb_func_start mevent_srv_sub_init_recv +mevent_srv_sub_init_recv: @ 801D928 movs r3, 0 str r3, [r0] strh r1, [r0, 0x6] @@ -79,7 +79,7 @@ sub_801D928: @ 801D928 strh r3, [r0, 0xC] str r2, [r0, 0x18] bx lr - thumb_func_end sub_801D928 + thumb_func_end mevent_srv_sub_init_recv thumb_func_start sub_801D938 sub_801D938: @ 801D938 diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s index 765b39b7e..fe4c9cd46 100755 --- a/asm/mevent_server_ish.s +++ b/asm/mevent_server_ish.s @@ -175,7 +175,7 @@ sub_801D59C: @ 801D59C adds r0, r4, 0 adds r1, r6, 0 movs r3, 0x4 - bl sub_801D904 + bl mevent_srv_sub_init_send add sp, 0x4 pop {r4-r6} pop {r0} @@ -215,7 +215,7 @@ sub_801D5FC: @ 801D5FC push {r4,lr} adds r4, r0, 0 adds r0, 0x24 - bl sub_801D8C0 + bl mevent_srv_sub_recv cmp r0, 0 beq _0801D612 movs r0, 0x4 @@ -234,7 +234,7 @@ sub_801D61C: @ 801D61C push {r4,lr} adds r4, r0, 0 adds r0, 0x24 - bl sub_801D8CC + bl mevent_srv_sub_send cmp r0, 0 beq _0801D632 movs r0, 0x4 @@ -303,7 +303,7 @@ _0801D6C4: adds r0, 0x24 ldr r1, [r2, 0x4] ldr r2, [r4, 0x18] - bl sub_801D928 + bl mevent_srv_sub_init_recv movs r0, 0x2 b _0801D7FE _0801D6D4: @@ -315,7 +315,7 @@ _0801D6D8: ldr r2, [r4, 0x14] movs r1, 0x14 movs r3, 0 - bl sub_801D904 + bl mevent_srv_sub_init_send movs r0, 0x3 b _0801D7FE _0801D6EA: @@ -391,7 +391,7 @@ _0801D764: ldr r2, [r4, 0x14] movs r1, 0x11 movs r3, 0x64 - bl sub_801D904 + bl mevent_srv_sub_init_send b _0801D804 _0801D77C: ldr r2, [r4, 0x4] diff --git a/data/mevent_server.s b/data/mevent_server.s index eaab75c36..bd15692fe 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -3,14 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F2548:: @ 82F2548 - .4byte sub_801D1AC - .4byte sub_801D1B4 - .4byte sub_801D1B8 - .4byte sub_801D1D4 - .4byte sub_801D1F0 - .align 2 gUnknown_082F255C:: @ 82F255C .4byte sub_801D5D0 diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h index d2b4608fb..f682e362d 100644 --- a/include/mevent_server_helpers.h +++ b/include/mevent_server_helpers.h @@ -2,5 +2,9 @@ #define GUARD_MEVENT_SERVER_HELPERS_H void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); +void mevent_srv_sub_init_send(struct mevent_srv_sub * manager, u32 ident, const void * src, u32 size); +bool32 mevent_srv_sub_recv(struct mevent_srv_sub * manager); +bool32 mevent_srv_sub_send(struct mevent_srv_sub * manager); +void mevent_srv_sub_init_recv(struct mevent_srv_sub *, u32, void *); #endif //GUARD_MEVENT_SERVER_HELPERS_H diff --git a/ld_script.txt b/ld_script.txt index 31de8d730..8059dadd0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,7 +61,7 @@ SECTIONS { src/mevent2.o(.text); src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); - asm/mevent_server.o(.text); + src/mevent_server_ish.o(.text); asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); @@ -418,6 +418,8 @@ SECTIONS { src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); + src/mevent_server_ish.o(.rodata); + src/mevent_server_helpers.o(.rodata); data/mevent_server.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server.c b/src/mevent_server.c index ea5a18626..6a129ee28 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -1,15 +1,15 @@ #include "global.h" #include "alloc.h" +#include "script.h" #include "mevent.h" #include "mevent_server.h" #include "mevent_server_helpers.h" EWRAM_DATA struct mevent_srv_common * s_mevent_srv_common_ptr = NULL; -EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; static void mevent_srv_init_common(struct mevent_srv_common *, const void *, u32, u32); -u32 mevent_srv_exec_common(struct mevent_srv_common *); -u32 mevent_srv_free_resources(struct mevent_srv_common *); +static void mevent_srv_free_resources(struct mevent_srv_common *); +static u32 mevent_srv_exec_common(struct mevent_srv_common *); extern const struct mevent_cmd s_mevent_wonder_news[]; extern const struct mevent_cmd s_mevent_wonder_card[]; @@ -54,3 +54,232 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * svr->cmdidx = 0; mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); } + +static void mevent_srv_free_resources(struct mevent_srv_common * svr) +{ + Free(svr->mevent_32e0); + Free(svr->mevent_3120); + Free(svr->recvBuffer); + Free(svr->mevent_unk1442cc); +} + +void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, const void * src, u32 size) +{ + AGB_ASSERT(size <= ME_SEND_BUF_SIZE); + mevent_srv_sub_init_send(&svr->manager, ident, src, size); +} + +static void * mevent_first_if_not_null_else_second(void * a0, void * a1) +{ + if (a0 != NULL) + return a0; + else + return a1; +} + +static u32 mevent_compare_pointers(void * a0, void * a1) +{ + if (a1 < a0) + return 0; + else if (a1 == a0) + return 1; + else + return 2; +} + +static u32 common_mainseq_0(struct mevent_srv_common * svr) +{ + // start + svr->mainseqno = 4; + return 0; +} + +static u32 common_mainseq_1(struct mevent_srv_common * svr) +{ + // done + return 3; +} + +static u32 common_mainseq_2(struct mevent_srv_common * svr) +{ + // do recv + if (mevent_srv_sub_recv(&svr->manager)) + svr->mainseqno = 4; + return 1; +} + +static u32 common_mainseq_3(struct mevent_srv_common * svr) +{ + // do send + if (mevent_srv_sub_send(&svr->manager)) + svr->mainseqno = 4; + return 1; +} + +static u32 common_mainseq_4(struct mevent_srv_common * svr) +{ + // process command + const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; + void * ptr; + svr->cmdidx++; + + switch (cmd->instr) + { + case 0: + AGB_ASSERT(cmd->parameter == NULL); + svr->mainseqno = 1; + svr->param = cmd->flag; + break; + case 1: + svr->mainseqno = 3; + break; + case 2: + AGB_ASSERT(cmd->parameter == NULL); + mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer); + svr->mainseqno = 2; + break; + case 3: + AGB_ASSERT(cmd->flag == FALSE); + svr->cmdidx = 0; + svr->cmdBuffer = cmd->parameter; + break; + case 5: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC)); + break; + case 6: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE); + break; + case 30: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE); + break; + case 4: + if (svr->param == cmd->flag) + { + svr->cmdidx = 0; + svr->cmdBuffer = cmd->parameter; + } + break; + case 7: + AGB_ASSERT(cmd->flag == FALSE); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); + svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); + break; + case 8: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = *(u32 *)svr->recvBuffer; + break; + case 9: + AGB_ASSERT(cmd->flag == FALSE); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord); + svr->param = sub_801B708(ptr, svr->mevent_unk1442cc, ptr); + break; + case 10: + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B784(svr->mevent_unk1442cc, cmd->flag); + break; + case 11: + AGB_ASSERT(cmd->flag == FALSE); + svr->param = sub_801B748(svr->mevent_unk1442cc, cmd->parameter); + break; + case 12: + AGB_ASSERT(cmd->flag == FALSE); + svr->param = mevent_compare_pointers(cmd->parameter, *(void **)svr->recvBuffer); + break; + case 14: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_3120), sizeof(struct MEventBuffer_3120_Sub)); + break; + case 13: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0), sizeof(struct MEventBuffer_32E0_Sub)); + break; + case 16: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x18, mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord), 4); + break; + case 15: + if (cmd->parameter == NULL) + mevent_srv_common_init_send(svr, 0x19, svr->sendBuffer1, svr->sendBuffer1Size); + else + mevent_srv_common_init_send(svr, 0x19, cmd->parameter, cmd->flag); + break; + case 18: + if (cmd->parameter == NULL) + mevent_srv_common_init_send(svr, 0x10, svr->sendBuffer2, svr->sendBuffer2Size); + else + mevent_srv_common_init_send(svr, 0x10, cmd->parameter, cmd->flag); + break; + case 19: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x1a, cmd->parameter, 188); + break; + case 20: + mevent_srv_common_init_send(svr, 0x15, cmd->parameter, cmd->flag); + break; + case 17: + mevent_srv_common_init_send(svr, 0x1c, cmd->parameter, cmd->flag); + break; + case 22: + AGB_ASSERT(cmd->flag == FALSE); + memcpy(svr->mevent_32e0, cmd->parameter, 332); + break; + case 23: + AGB_ASSERT(cmd->flag == FALSE); + memcpy(svr->mevent_3120, cmd->parameter, 444); + break; + case 21: + AGB_ASSERT(cmd->flag == FALSE); + svr->sendWord = *(u32 *)cmd->parameter; + break; + case 24: + svr->sendBuffer1 = cmd->parameter; + svr->sendBuffer1Size = cmd->flag; + break; + case 25: + svr->sendBuffer2 = cmd->parameter; + svr->sendBuffer2Size = cmd->flag; + break; + case 26: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + memcpy(svr->mevent_32e0, sav1_get_mevent_buffer_1(), 332); + sub_801B3C0(svr->mevent_32e0); + break; + case 27: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + memcpy(svr->mevent_3120, sav1_get_mevent_buffer_0(), 444); + break; + case 28: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + svr->sendBuffer1 = sub_8099244(); + break; + case 29: + mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag); + break; + } + + return 1; +} + +static u32 (*const func_tbl[])(struct mevent_srv_common *) = { + common_mainseq_0, + common_mainseq_1, + common_mainseq_2, + common_mainseq_3, + common_mainseq_4 +}; + +static u32 mevent_srv_exec_common(struct mevent_srv_common * svr) +{ + u32 response; + AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + response = func_tbl[svr->mainseqno](svr); + AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + return response; +} diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c new file mode 100644 index 000000000..dc4f98a6e --- /dev/null +++ b/src/mevent_server_helpers.c @@ -0,0 +1 @@ +#include "global.h" diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c new file mode 100644 index 000000000..30793cf5c --- /dev/null +++ b/src/mevent_server_ish.c @@ -0,0 +1,7 @@ +#include "global.h" +#include "alloc.h" +#include "mevent.h" +#include "mevent_server.h" +#include "mevent_server_helpers.h" + +EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; diff --git a/sym_ewram.txt b/sym_ewram.txt index 22afe8226..06e3180a0 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -13,6 +13,7 @@ .include "src/mevent2.o" .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" + .include "src/mevent_server_ish.o" @ union_room_chat .align 2 From 03badd9c40de5d50562376d39348fb5c85f8340b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 11:43:29 -0400 Subject: [PATCH 20/42] mevent_server_ish --- asm/mevent_server_ish.s | 567 -------------------------------- data/mevent_server.s | 11 - include/mevent_server.h | 48 +-- include/mevent_server_helpers.h | 28 ++ include/mevent_server_ish.h | 23 ++ ld_script.txt | 1 - src/mevent_server_ish.c | 290 +++++++++++++++- 7 files changed, 340 insertions(+), 628 deletions(-) delete mode 100755 asm/mevent_server_ish.s diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s deleted file mode 100755 index fe4c9cd46..000000000 --- a/asm/mevent_server_ish.s +++ /dev/null @@ -1,567 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_ish_do_init -mevent_srv_ish_do_init: @ 801D484 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =s_mevent_srv_ish_ptr - movs r0, 0x50 - bl AllocZeroed - str r0, [r4] - movs r1, 0x1 - movs r2, 0 - bl mevent_srv_ish_init - ldr r0, [r4] - str r5, [r0, 0x4C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_ish_do_init - - thumb_func_start mevent_srv_ish_do_exec -mevent_srv_ish_do_exec: @ 801D4A8 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =s_mevent_srv_ish_ptr - ldr r0, [r4] - cmp r0, 0 - bne _0801D4BC - movs r0, 0x6 - b _0801D4DC - .pool -_0801D4BC: - bl mevent_srv_ish_exec - adds r5, r0, 0 - cmp r5, 0x6 - bne _0801D4DA - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl mevent_srv_ish_free_resources - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D4DA: - adds r0, r5, 0 -_0801D4DC: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_srv_ish_do_exec - - thumb_func_start mevent_srv_ish_inc_flag -mevent_srv_ish_inc_flag: @ 801D4E4 - ldr r0, =s_mevent_srv_ish_ptr - ldr r1, [r0] - ldr r0, [r1, 0xC] - adds r0, 0x1 - str r0, [r1, 0xC] - bx lr - .pool - thumb_func_end mevent_srv_ish_inc_flag - - thumb_func_start mevent_srv_ish_get_buffer -mevent_srv_ish_get_buffer: @ 801D4F4 - ldr r0, =s_mevent_srv_ish_ptr - ldr r0, [r0] - ldr r0, [r0, 0x20] - bx lr - .pool - thumb_func_end mevent_srv_ish_get_buffer - - thumb_func_start mevent_srv_ish_set_param -mevent_srv_ish_set_param: @ 801D500 - ldr r1, =s_mevent_srv_ish_ptr - ldr r1, [r1] - str r0, [r1, 0x4] - bx lr - .pool - thumb_func_end mevent_srv_ish_set_param - - thumb_func_start mevent_srv_ish_init -mevent_srv_ish_init: @ 801D50C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - movs r0, 0 - str r0, [r4] - str r0, [r4, 0x8] - str r0, [r4, 0xC] - movs r5, 0x80 - lsls r5, 3 - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x14] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x18] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x20] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - mov r2, r8 - bl mevent_srv_sub_init - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_init - - thumb_func_start mevent_srv_ish_free_resources -mevent_srv_ish_free_resources: @ 801D55C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_free_resources - - thumb_func_start mevent_srv_ish_jmp_buffer -mevent_srv_ish_jmp_buffer: @ 801D580 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0 - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_jmp_buffer - - thumb_func_start sub_801D59C -sub_801D59C: @ 801D59C - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - movs r0, 0 - str r0, [sp] - ldr r1, [r4, 0x14] - ldr r2, =0x05000100 - mov r0, sp - bl CpuSet - ldr r2, [r4, 0x14] - str r5, [r2] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - movs r3, 0x4 - bl mevent_srv_sub_init_send - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D59C - - thumb_func_start sub_801D5D0 -sub_801D5D0: @ 801D5D0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, =gUnknown_082F2598 - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r1, 0 - str r1, [r4, 0x10] - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D5D0 - - thumb_func_start sub_801D5F8 -sub_801D5F8: @ 801D5F8 - movs r0, 0x6 - bx lr - thumb_func_end sub_801D5F8 - - thumb_func_start sub_801D5FC -sub_801D5FC: @ 801D5FC - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl mevent_srv_sub_recv - cmp r0, 0 - beq _0801D612 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D612: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D5FC - - thumb_func_start sub_801D61C -sub_801D61C: @ 801D61C - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl mevent_srv_sub_send - cmp r0, 0 - beq _0801D632 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D632: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D61C - - thumb_func_start sub_801D63C -sub_801D63C: @ 801D63C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x10] - lsls r2, r0, 3 - ldr r1, [r4, 0x1C] - adds r2, r1, r2 - adds r0, 0x1 - str r0, [r4, 0x10] - ldr r0, [r2] - cmp r0, 0x15 - bls _0801D654 - b _0801D804 -_0801D654: - lsls r0, 2 - ldr r1, =_0801D664 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D664: - .4byte _0801D804 - .4byte _0801D6BC - .4byte _0801D6C4 - .4byte _0801D6D4 - .4byte _0801D70E - .4byte _0801D716 - .4byte _0801D6FE - .4byte _0801D708 - .4byte _0801D764 - .4byte _0801D790 - .4byte _0801D788 - .4byte _0801D72C - .4byte _0801D742 - .4byte _0801D758 - .4byte _0801D77C - .4byte _0801D7B8 - .4byte _0801D7BC - .4byte _0801D7C4 - .4byte _0801D7D0 - .4byte _0801D6EA - .4byte _0801D6D8 - .4byte _0801D7F0 -_0801D6BC: - ldr r0, [r2, 0x4] - str r0, [r4, 0x4] - movs r0, 0x1 - b _0801D7FE -_0801D6C4: - adds r0, r4, 0 - adds r0, 0x24 - ldr r1, [r2, 0x4] - ldr r2, [r4, 0x18] - bl mevent_srv_sub_init_recv - movs r0, 0x2 - b _0801D7FE -_0801D6D4: - movs r0, 0x3 - b _0801D7FE -_0801D6D8: - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x14 - movs r3, 0 - bl mevent_srv_sub_init_send - movs r0, 0x3 - b _0801D7FE -_0801D6EA: - ldrb r0, [r2, 0x4] - bl GetGameStat - adds r2, r0, 0 - adds r0, r4, 0 - movs r1, 0x12 - bl sub_801D59C - movs r0, 0x3 - b _0801D7FE -_0801D6FE: - ldr r0, [r4, 0x4] - cmp r0, 0 - beq _0801D706 - b _0801D804 -_0801D706: - b _0801D70E -_0801D708: - ldr r0, [r4, 0x4] - cmp r0, 0x1 - bne _0801D804 -_0801D70E: - adds r0, r4, 0 - bl mevent_srv_ish_jmp_buffer - b _0801D804 -_0801D716: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x2 - b _0801D806 -_0801D72C: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x3 - b _0801D806 -_0801D742: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x5 - b _0801D806 -_0801D758: - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x4 - b _0801D806 -_0801D764: - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x4C] - bl sub_801B580 - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x11 - movs r3, 0x64 - bl mevent_srv_sub_init_send - b _0801D804 -_0801D77C: - ldr r2, [r4, 0x4] - adds r0, r4, 0 - movs r1, 0x13 - bl sub_801D59C - b _0801D804 -_0801D788: - ldr r0, [r4, 0x18] - bl sub_801B21C - b _0801D804 -_0801D790: - ldr r0, [r4, 0x18] - bl sub_801B1A4 - cmp r0, 0 - bne _0801D7AC - ldr r0, [r4, 0x18] - bl sub_801B078 - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0 - bl sub_801D59C - b _0801D804 -_0801D7AC: - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0x1 - bl sub_801D59C - b _0801D804 -_0801D7B8: - movs r0, 0x6 - b _0801D7FE -_0801D7BC: - ldr r0, [r4, 0x18] - bl sub_801B508 - b _0801D804 -_0801D7C4: - ldr r0, [r4, 0x18] - movs r1, 0xFA - lsls r1, 2 - bl sub_80992A0 - b _0801D804 -_0801D7D0: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000bec - adds r0, r1 - ldr r1, [r4, 0x18] - movs r2, 0xBC - bl memcpy - bl ValidateEReaderTrainer - b _0801D804 - .pool -_0801D7F0: - ldr r0, =gDecompressionBuffer - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0x7 -_0801D7FE: - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D804: - movs r0, 0x1 -_0801D806: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D63C - - thumb_func_start sub_801D810 -sub_801D810: @ 801D810 - push {lr} - adds r1, r0, 0 - ldr r0, [r1, 0xC] - cmp r0, 0 - beq _0801D822 - movs r0, 0x4 - str r0, [r1, 0x8] - movs r0, 0 - str r0, [r1, 0xC] -_0801D822: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_801D810 - - thumb_func_start sub_801D828 -sub_801D828: @ 801D828 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0xC] - cmp r0, 0 - beq _0801D838 - cmp r0, 0x1 - beq _0801D846 - b _0801D858 -_0801D838: - ldr r0, [r4, 0x18] - bl sub_8153870 - ldr r0, [r4, 0xC] - adds r0, 0x1 - str r0, [r4, 0xC] - b _0801D858 -_0801D846: - adds r0, r4, 0x4 - bl sub_8153884 - adds r1, r0, 0 - cmp r1, 0 - bne _0801D858 - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] -_0801D858: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D828 - - thumb_func_start sub_801D860 -sub_801D860: @ 801D860 - push {r4,lr} - adds r4, r0, 0 - ldr r3, =gDecompressionBuffer - adds r0, r4, 0x4 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - bl _call_via_r3 - cmp r0, 0x1 - bne _0801D880 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D880: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D860 - - thumb_func_start mevent_srv_ish_exec -mevent_srv_ish_exec: @ 801D894 - push {r4,r5,lr} - sub sp, 0x20 - mov r2, sp - ldr r1, =gUnknown_082F255C - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3,r4} - stm r2!, {r3,r4} - ldr r1, [r0, 0x8] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - bl _call_via_r1 - add sp, 0x20 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_srv_ish_exec - - .align 2, 0 @ don't pad with nop diff --git a/data/mevent_server.s b/data/mevent_server.s index bd15692fe..b6d8b4e25 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -3,17 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F255C:: @ 82F255C - .4byte sub_801D5D0 - .4byte sub_801D5F8 - .4byte sub_801D5FC - .4byte sub_801D61C - .4byte sub_801D63C - .4byte sub_801D810 - .4byte sub_801D828 - .4byte sub_801D860 - .align 2 gText_CanceledReadingCard:: @ 82F257C .string "Canceled reading\nthe Card.$" diff --git a/include/mevent_server.h b/include/mevent_server.h index 772aae6b1..ed9812d8a 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -1,53 +1,7 @@ #ifndef GUARD_MEVENT_SERVER_H #define GUARD_MEVENT_SERVER_H -#define ME_SEND_BUF_SIZE 0x400 - -struct mevent_srv_sub -{ - s32 seqno; - u8 sendPlayerNo; - u8 recvPlayerNo; - u16 recvIdent; - u16 recvCounter; - u16 recvCRC; - u16 recvSize; - u16 sendIdent; - u16 sendCounter; - u16 sendCRC; - u16 sendSize; - void * recvBfr; - const void * sendBfr; - u32 (*recvFunc)(struct mevent_srv_sub *); - u32 (*sendFunc)(struct mevent_srv_sub *); -}; - -struct send_recv_header -{ - u16 ident; - u16 crc; - u16 size; -}; - -struct mevent_cmd_ish -{ - u32 instr; - u32 parameter; -}; - -struct mevent_srv_ish -{ - u32 unk_00; - u32 param; - u32 mainseqno; - u32 flag; - u32 cmdidx; - void * sendBuffer; - void * recvBuffer; - struct mevent_cmd_ish * cmdBuffer; - void * buffer; - struct mevent_srv_sub manager; -}; +#include "mevent_server_helpers.h" struct mevent_cmd { diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h index f682e362d..e4e409862 100644 --- a/include/mevent_server_helpers.h +++ b/include/mevent_server_helpers.h @@ -1,6 +1,34 @@ #ifndef GUARD_MEVENT_SERVER_HELPERS_H #define GUARD_MEVENT_SERVER_HELPERS_H +#define ME_SEND_BUF_SIZE 0x400 + +struct mevent_srv_sub +{ + s32 seqno; + u8 sendPlayerNo; + u8 recvPlayerNo; + u16 recvIdent; + u16 recvCounter; + u16 recvCRC; + u16 recvSize; + u16 sendIdent; + u16 sendCounter; + u16 sendCRC; + u16 sendSize; + void * recvBfr; + const void * sendBfr; + u32 (*recvFunc)(struct mevent_srv_sub *); + u32 (*sendFunc)(struct mevent_srv_sub *); +}; + +struct send_recv_header +{ + u16 ident; + u16 crc; + u16 size; +}; + void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); void mevent_srv_sub_init_send(struct mevent_srv_sub * manager, u32 ident, const void * src, u32 size); bool32 mevent_srv_sub_recv(struct mevent_srv_sub * manager); diff --git a/include/mevent_server_ish.h b/include/mevent_server_ish.h index 31f98ed52..35833ea12 100644 --- a/include/mevent_server_ish.h +++ b/include/mevent_server_ish.h @@ -1,6 +1,29 @@ #ifndef GUARD_MEVENT_SERVER_ISH_H #define GUARD_MEVENT_SERVER_ISH_H +#include "mevent_server_helpers.h" + +struct mevent_cmd_ish +{ + u32 instr; + u32 parameter; +}; + +struct mevent_srv_ish +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 flag; + u32 cmdidx; + void * sendBuffer; + void * recvBuffer; + struct mevent_cmd_ish * cmdBuffer; + void * buffer; + struct mevent_srv_sub manager; + u32 unk_4C; +}; + void mevent_srv_ish_do_init(u32 arg); u32 mevent_srv_ish_do_exec(u16 * a0); void mevent_srv_ish_inc_flag(void); diff --git a/ld_script.txt b/ld_script.txt index 8059dadd0..0a7838883 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,6 @@ SECTIONS { src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); src/mevent_server_ish.o(.text); - asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 30793cf5c..2b310c981 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -1,7 +1,293 @@ #include "global.h" #include "alloc.h" +#include "decompress.h" +#include "overworld.h" +#include "script.h" +#include "battle_tower.h" #include "mevent.h" -#include "mevent_server.h" -#include "mevent_server_helpers.h" +#include "mystery_event_script.h" +#include "mevent_server_ish.h" EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; + +static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); +static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); +static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); + +extern const u8 gUnknown_082F2598[]; +extern const struct mevent_cmd gUnknown_8468B6C[]; +extern const struct mevent_cmd gUnknown_8468BCC[]; + +void mevent_srv_ish_do_init(u32 arg) +{ + s_mevent_srv_ish_ptr = AllocZeroed(sizeof(struct mevent_srv_ish)); + mevent_srv_ish_init(s_mevent_srv_ish_ptr, 1, 0); + s_mevent_srv_ish_ptr->unk_4C = arg; +} + +u32 mevent_srv_ish_do_exec(u16 * a0) +{ + u32 result; + if (s_mevent_srv_ish_ptr == NULL) + return 6; + result = mevent_srv_ish_exec(s_mevent_srv_ish_ptr); + if (result == 6) + { + *a0 = s_mevent_srv_ish_ptr->param; + mevent_srv_ish_free_resources(s_mevent_srv_ish_ptr); + Free(s_mevent_srv_ish_ptr); + s_mevent_srv_ish_ptr = NULL; + } + return result; +} + +void mevent_srv_ish_inc_flag(void) +{ + s_mevent_srv_ish_ptr->flag++; +} + +void * mevent_srv_ish_get_buffer(void) +{ + return s_mevent_srv_ish_ptr->buffer; +} + +void mevent_srv_ish_set_param(u32 a0) +{ + s_mevent_srv_ish_ptr->param = a0; +} + +static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->unk_00 = 0; + svr->mainseqno = 0; + svr->flag = 0; + svr->sendBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->cmdBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->buffer = AllocZeroed(0x40); + mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); +} + +static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) +{ + Free(svr->sendBuffer); + Free(svr->recvBuffer); + Free(svr->cmdBuffer); + Free(svr->buffer); +} + +static void mevent_srv_ish_jmp_buffer(struct mevent_srv_ish * svr) +{ + memcpy(svr->cmdBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); + svr->cmdidx = 0; +} + +static void mevent_srv_ish_send_word(struct mevent_srv_ish * svr, u32 ident, u32 word) +{ + CpuFill32(0, svr->sendBuffer, ME_SEND_BUF_SIZE); + *(u32 *)svr->sendBuffer = word; + mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); +} + +static u32 ish_mainseq_0(struct mevent_srv_ish * svr) +{ + // init + memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); + svr->cmdidx = 0; + svr->mainseqno = 4; + svr->flag = 0; + return 0; +} + +static u32 ish_mainseq_1(struct mevent_srv_ish * svr) +{ + // done + return 6; +} + + +static u32 ish_mainseq_2(struct mevent_srv_ish * svr) +{ + // do recv + if (mevent_srv_sub_recv(&svr->manager)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_3(struct mevent_srv_ish * svr) +{ + // do send + if (mevent_srv_sub_send(&svr->manager)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_4(struct mevent_srv_ish * svr) +{ + // process command + struct mevent_cmd_ish * cmd = &svr->cmdBuffer[svr->cmdidx]; + ++svr->cmdidx; + switch (cmd->instr) + { + case 0: + break; + case 1: + svr->param = cmd->parameter; + svr->mainseqno = 1; + svr->flag = 0; + break; + case 2: + mevent_srv_sub_init_recv(&svr->manager, cmd->parameter, svr->recvBuffer); + svr->mainseqno = 2; + svr->flag = 0; + break; + case 3: + svr->mainseqno = 3; + svr->flag = 0; + break; + case 20: + mevent_srv_sub_init_send(&svr->manager, 0x14, svr->sendBuffer, 0); + svr->mainseqno = 3; + svr->flag = 0; + break; + case 19: + mevent_srv_ish_send_word(svr, 0x12, GetGameStat(cmd->parameter)); + svr->mainseqno = 3; + svr->flag = 0; + break; + case 6: + if (svr->param == 0) + mevent_srv_ish_jmp_buffer(svr); + break; + case 7: + if (svr->param == 1) + mevent_srv_ish_jmp_buffer(svr); + break; + case 4: + mevent_srv_ish_jmp_buffer(svr); + break; + case 5: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 2; + case 11: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 3; + case 12: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 5; + case 13: + svr->mainseqno = 5; + svr->flag = 0; + return 4; + case 8: + sub_801B580(svr->sendBuffer, svr->unk_4C); + mevent_srv_sub_init_send(&svr->manager, 0x11, svr->sendBuffer, sizeof(struct MEventStruct_Unk1442CC)); + break; + case 14: + mevent_srv_ish_send_word(svr, 0x13, svr->param); + break; + case 10: + sub_801B21C(svr->recvBuffer); + break; + case 9: + if (!sub_801B1A4(svr->recvBuffer)) + { + sub_801B078(svr->recvBuffer); + mevent_srv_ish_send_word(svr, 0x13, 0); + } + else + mevent_srv_ish_send_word(svr, 0x13, 1); + break; + case 15: + svr->mainseqno = 6; + svr->flag = 0; + break; + case 16: + sub_801B508(svr->recvBuffer); + break; + case 17: + sub_80992A0(svr->recvBuffer, 1000); + break; + case 18: + memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, svr->recvBuffer, 0xbc); + ValidateEReaderTrainer(); + break; + case 21: + memcpy(gDecompressionBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); + svr->mainseqno = 7; + svr->flag = 0; + break; + } + + return 1; +} + +static u32 ish_mainseq_5(struct mevent_srv_ish * svr) +{ + // wait flag + if (svr->flag) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_6(struct mevent_srv_ish * svr) +{ + // ??? + switch (svr->flag) + { + case 0: + sub_8153870(svr->recvBuffer); + ++svr->flag; + break; + case 1: + if (!sub_8153884(&svr->param)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + break; + } + return 1; +} + +static u32 ish_mainseq_7(struct mevent_srv_ish * svr) +{ + // exec arbitrary code + u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; + if (func(&svr->param, gSaveBlock2Ptr, gSaveBlock1Ptr) == 1) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 mevent_srv_ish_exec(struct mevent_srv_ish * svr) +{ + u32 (*funcs[])(struct mevent_srv_ish *) = { + ish_mainseq_0, + ish_mainseq_1, + ish_mainseq_2, + ish_mainseq_3, + ish_mainseq_4, + ish_mainseq_5, + ish_mainseq_6, + ish_mainseq_7 + }; + return funcs[svr->mainseqno](svr); +} From 6c12d154e7a6a0bc60c988497b3daa4f8126a5b2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 12:22:39 -0400 Subject: [PATCH 21/42] Reformat mevent server and client scripts --- asm/mevent_server_helpers.s | 373 ------------------------------------ data/mevent_server.s | 318 ++++++++++++------------------ include/util.h | 4 +- ld_script.txt | 2 +- src/mevent_server_helpers.c | 210 ++++++++++++++++++++ src/mevent_server_ish.c | 4 +- src/util.c | 4 +- 7 files changed, 335 insertions(+), 580 deletions(-) delete mode 100755 asm/mevent_server_helpers.s diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s deleted file mode 100755 index 9bb70ff63..000000000 --- a/asm/mevent_server_helpers.s +++ /dev/null @@ -1,373 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_sub_recv -mevent_srv_sub_recv: @ 801D8C0 - push {lr} - ldr r1, [r0, 0x20] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end mevent_srv_sub_recv - - thumb_func_start mevent_srv_sub_send -mevent_srv_sub_send: @ 801D8CC - push {lr} - ldr r1, [r0, 0x24] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end mevent_srv_sub_send - - thumb_func_start mevent_srv_sub_init -mevent_srv_sub_init: @ 801D8D8 - movs r3, 0 - strb r1, [r0, 0x4] - strb r2, [r0, 0x5] - str r3, [r0] - strh r3, [r0, 0x12] - strh r3, [r0, 0x14] - strh r3, [r0, 0x10] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - strh r3, [r0, 0x8] - str r3, [r0, 0x1C] - str r3, [r0, 0x18] - ldr r1, =sub_801DA5C - str r1, [r0, 0x24] - ldr r1, =sub_801D988 - str r1, [r0, 0x20] - bx lr - .pool - thumb_func_end mevent_srv_sub_init - - thumb_func_start mevent_srv_sub_init_send -mevent_srv_sub_init_send: @ 801D904 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - str r0, [r4] - strh r1, [r4, 0xE] - strh r0, [r4, 0x10] - strh r0, [r4, 0x12] - cmp r3, 0 - beq _0801D91A - strh r3, [r4, 0x14] - b _0801D920 -_0801D91A: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x14] -_0801D920: - str r2, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_sub_init_send - - thumb_func_start mevent_srv_sub_init_recv -mevent_srv_sub_init_recv: @ 801D928 - movs r3, 0 - str r3, [r0] - strh r1, [r0, 0x6] - strh r3, [r0, 0x8] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - str r2, [r0, 0x18] - bx lr - thumb_func_end mevent_srv_sub_init_recv - - thumb_func_start sub_801D938 -sub_801D938: @ 801D938 - push {lr} - adds r3, r0, 0 - adds r0, r1, 0 - lsls r3, 8 - ldr r1, =gBlockRecvBuffer - adds r3, r1 - adds r1, r3, 0 - bl memcpy - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D938 - - thumb_func_start sub_801D954 -sub_801D954: @ 801D954 - push {r4,lr} - adds r4, r0, 0 - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801D96E - movs r0, 0 - b _0801D970 -_0801D96E: - movs r0, 0x1 -_0801D970: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D954 - - thumb_func_start sub_801D978 -sub_801D978: @ 801D978 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag - pop {r0} - bx r0 - thumb_func_end sub_801D978 - - thumb_func_start sub_801D988 -sub_801D988: @ 801D988 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r6, [r5] - cmp r6, 0x1 - beq _0801D9EC - cmp r6, 0x1 - bgt _0801D99E - cmp r6, 0 - beq _0801D9A4 - b _0801DA52 -_0801D99E: - cmp r6, 0x2 - beq _0801DA38 - b _0801DA52 -_0801D9A4: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrb r0, [r5, 0x5] - mov r4, sp - mov r1, sp - movs r2, 0x8 - bl sub_801D938 - ldrh r1, [r4, 0x4] - strh r1, [r5, 0xC] - ldrh r0, [r4, 0x2] - strh r0, [r5, 0xA] - lsls r1, 16 - movs r0, 0x80 - lsls r0, 19 - cmp r1, r0 - bls _0801D9D2 -_0801D9CC: - bl sub_8010198 - b _0801DA52 -_0801D9D2: - mov r1, sp - ldrh r0, [r5, 0x6] - ldrh r1, [r1] - cmp r0, r1 - bne _0801D9CC - strh r6, [r5, 0x8] - ldrb r0, [r5, 0x5] - bl sub_801D978 - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA52 -_0801D9EC: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrh r0, [r5, 0x8] - lsls r1, r0, 6 - subs r1, r0 - lsls r3, r1, 2 - ldrh r0, [r5, 0xC] - subs r2, r0, r3 - cmp r2, 0xFC - bhi _0801DA1E - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA30 -_0801DA1E: - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - movs r2, 0xFC - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_0801DA30: - ldrb r0, [r5, 0x5] - bl sub_801D978 - b _0801DA52 -_0801DA38: - ldr r0, [r5, 0x18] - ldrh r1, [r5, 0xC] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r5, 0xA] - cmp r0, r1 - bne _0801D9CC - movs r0, 0 - str r0, [r5] - movs r0, 0x1 - b _0801DA54 -_0801DA52: - movs r0, 0 -_0801DA54: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801D988 - - thumb_func_start sub_801DA5C -sub_801DA5C: @ 801DA5C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, [r4] - cmp r5, 0x1 - beq _0801DAC8 - cmp r5, 0x1 - bgt _0801DA72 - cmp r5, 0 - beq _0801DA7C - b _0801DB5E -_0801DA72: - cmp r5, 0x2 - beq _0801DB1C - cmp r5, 0x3 - beq _0801DB46 - b _0801DB5E -_0801DA7C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrh r1, [r4, 0xE] - ldr r2, =0xffff0000 - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - str r0, [sp] - ldrh r1, [r4, 0x14] - ldr r0, [sp, 0x4] - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x4] - ldr r0, [r4, 0x1C] - bl CalcCRC16WithTable - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - lsrs r1, 16 - strh r1, [r4, 0x12] - strh r5, [r4, 0x10] - movs r0, 0 - mov r1, sp - movs r2, 0x8 - bl SendBlock - b _0801DB3E - .pool -_0801DAC8: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - ldrh r1, [r4, 0x10] - lsls r0, r1, 6 - subs r0, r1 - lsls r3, r0, 2 - ldrh r0, [r4, 0x14] - subs r0, r3 - cmp r0, 0xFC - bhi _0801DB08 - ldr r1, [r4, 0x1C] - adds r1, r3 - lsls r2, r0, 16 - lsrs r2, 16 - movs r0, 0 - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB3E -_0801DB08: - ldr r1, [r4, 0x1C] - adds r1, r3 - movs r0, 0 - movs r2, 0xFC - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB5E -_0801DB1C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldr r0, [r4, 0x1C] - ldrh r1, [r4, 0x14] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r4, 0x12] - cmp r0, r1 - beq _0801DB3E - bl sub_8010198 - b _0801DB5E -_0801DB3E: - ldr r0, [r4] - adds r0, 0x1 - str r0, [r4] - b _0801DB5E -_0801DB46: - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - movs r0, 0 - str r0, [r4] - movs r0, 0x1 - b _0801DB60 -_0801DB5E: - movs r0, 0 -_0801DB60: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801DA5C - - .align 2, 0 @ don't pad with nop diff --git a/data/mevent_server.s b/data/mevent_server.s index b6d8b4e25..47e474e61 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -9,265 +9,185 @@ gText_CanceledReadingCard:: @ 82F257C .align 2 gUnknown_082F2598:: @ 82F2598 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F25A8:: @ 82F25A8 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 8, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F25C8:: @ 82F25C8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 10 .align 2 gUnknown_082F25D8:: @ 82F25D8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 11 .align 2 gUnknown_082F25E8:: @ 82F25E8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 0 .align 2 gUnknown_082F25F8:: @ 82F25F8 - .byte 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .4byte 2, 22 + .4byte 10, 0 + .4byte 2, 25 + .4byte 17, 0 + .4byte 20, 0 + .4byte 1, 2 .align 2 gUnknown_082F2628:: @ 82F2628 - .byte 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 2, 23 + .4byte 9, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F2650:: @ 82F2650 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 7 .align 2 gUnknown_082F2660:: @ 82F2660 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 3 .align 2 gUnknown_082F2670:: @ 82F2670 - .byte 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 13, 0 + .4byte 14, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F2698:: @ 82F2698 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 9 .align 2 gUnknown_082F26A8:: @ 82F26A8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 5 .align 2 gUnknown_082F26B8:: @ 82F26B8 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 + .4byte 2, 21 + .4byte 12, 0 + .4byte 20, 0 + .4byte 1, 14 + .4byte 2, 21 + .4byte 12, 0 + .4byte 20, 0 + .4byte 1, 13 .align 2 gUnknown_082F26F8:: @ 82F26F8 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25C8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25D8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2698 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F25C8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x0a, NULL + .4byte 18, 0x10, gUnknown_082F25D8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x0b, NULL + .4byte 18, 0x10, gUnknown_082F2698 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x09, NULL .align 2 gUnknown_082F2788:: @ 82F2788 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26B8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00 - - .4byte gText_CanceledReadingCard - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x20, gUnknown_082F26B8 + .4byte 1, 0x00, NULL + .4byte 20, 0x1b, gText_CanceledReadingCard + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x09, NULL .align 2 gUnknown_082F27D0:: @ 82F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2650 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F2650 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x07, NULL .align 2 gUnknown_082F2800:: @ 82F2800 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2628 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2660 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x28, gUnknown_082F2628 + .4byte 1, 0x00, NULL + .4byte 14, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 2, 0x13, NULL + .4byte 8, 0x00, NULL + .4byte 4, 0x01, gUnknown_082F27D0 + .4byte 18, 0x10, gUnknown_082F2660 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x03, NULL .align 2 gUnknown_082F2884:: @ 82F2884 - .byte 0x12, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25F8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x30, gUnknown_082F25F8 + .4byte 1, 0x00, NULL + .4byte 13, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 15, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x02, NULL .align 2 gUnknown_082F28E4:: @ 82F28E4 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2670 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2788 + .4byte 18, 0x28, gUnknown_082F2670 + .4byte 1, 0x00, NULL + .4byte 2, 0x13, NULL + .4byte 8, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F2884 + .4byte 3, 0x00, gUnknown_082F2788 .align 2 gUnknown_082F292C:: @ 82F292C - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25E8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F26A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x05, NULL + .4byte 18, 0x10, gUnknown_082F25E8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x00, NULL .align 2 s_mevent_wonder_news:: @ 82F298C - .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2800 + .4byte 27, 0x00, NULL + .4byte 18, 0x20, gUnknown_082F25A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x11, NULL + .4byte 5, 0x00, NULL + .4byte 30, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F26F8 + .4byte 3, 0x00, gUnknown_082F2800 .align 2 s_mevent_wonder_card:: @ 82F29EC - .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F28E4 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F292C + .4byte 26, 0x00, NULL + .4byte 28, 0x00, NULL + .4byte 18, 0x20, gUnknown_082F25A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x11, NULL + .4byte 5, 0x00, NULL + .4byte 6, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F26F8 + .4byte 7, 0x00, NULL + .4byte 4, 0x02, gUnknown_082F28E4 + .4byte 4, 0x00, gUnknown_082F2884 + .4byte 3, 0x00, gUnknown_082F292C diff --git a/include/util.h b/include/util.h index 56c89359a..77062de96 100644 --- a/include/util.h +++ b/include/util.h @@ -10,8 +10,8 @@ u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *)); void StoreWordInTwoHalfwords(u16 *, u32); void LoadWordFromTwoHalfwords(u16 *, u32 *); int CountTrailingZeroBits(u32 value); -u16 CalcCRC16(u8 *data, s32 length); -u16 CalcCRC16WithTable(u8 *data, u32 length); +u16 CalcCRC16(const u8 *data, s32 length); +u16 CalcCRC16WithTable(const u8 *data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); diff --git a/ld_script.txt b/ld_script.txt index 0a7838883..65f171171 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,7 @@ SECTIONS { src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); src/mevent_server_ish.o(.text); - asm/mevent_server_helpers.o(.text); + src/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); src/berry_crush.o(.text); diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c index dc4f98a6e..af14b514c 100644 --- a/src/mevent_server_helpers.c +++ b/src/mevent_server_helpers.c @@ -1 +1,211 @@ #include "global.h" +#include "alloc.h" +#include "decompress.h" +#include "util.h" +#include "link.h" +#include "link_rfu.h" +#include "overworld.h" +#include "script.h" +#include "battle_tower.h" +#include "mystery_event_script.h" +#include "mevent.h" +#include "mevent_server_helpers.h" + +static u32 mevent_receive_func(struct mevent_srv_sub *); +static u32 mevent_send_func(struct mevent_srv_sub *); + +u32 mevent_srv_sub_recv(struct mevent_srv_sub * svr) +{ + return svr->recvFunc(svr); +} + +u32 mevent_srv_sub_send(struct mevent_srv_sub * svr) +{ + return svr->sendFunc(svr); +} + +void mevent_srv_sub_init(struct mevent_srv_sub * svr, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->sendPlayerNo = sendPlayerNo; + svr->recvPlayerNo = recvPlayerNo; + svr->seqno = 0; + svr->sendCRC = 0; + svr->sendSize = 0; + svr->sendCounter = 0; + svr->recvCRC = 0; + svr->recvSize = 0; + svr->recvCounter = 0; + svr->sendBfr = NULL; + svr->recvBfr = NULL; + svr->sendFunc = mevent_send_func; + svr->recvFunc = mevent_receive_func; +} + +void mevent_srv_sub_init_send(struct mevent_srv_sub * svr, u32 ident, const void * src, u32 size) +{ + svr->seqno = 0; + svr->sendIdent = ident; + svr->sendCounter = 0; + svr->sendCRC = 0; + if (size != 0) + svr->sendSize = size; + else + svr->sendSize = ME_SEND_BUF_SIZE; + svr->sendBfr = src; +} + +void mevent_srv_sub_init_recv(struct mevent_srv_sub * svr, u32 ident, void * dest) +{ + svr->seqno = 0; + svr->recvIdent = ident; + svr->recvCounter = 0; + svr->recvCRC = 0; + svr->recvSize = 0; + svr->recvBfr = dest; +} + +static void mevent_recv_block(u32 recv_idx, void * dest, size_t size) +{ + memcpy(dest, gBlockRecvBuffer[recv_idx], size); +} + +static bool32 mevent_has_received(u32 recv_idx) +{ + if ((GetBlockReceivedStatus() >> recv_idx) & 1) + return TRUE; + else + return FALSE; +} + +static void mevent_reset_recv(u32 recv_idx) +{ + ResetBlockReceivedFlag(recv_idx); +} + +static bool32 mevent_receive_func(struct mevent_srv_sub * svr) +{ + struct send_recv_header header; + + switch (svr->seqno) + { + case 0: + if (mevent_has_received(svr->recvPlayerNo)) + { + mevent_recv_block(svr->recvPlayerNo, &header, sizeof(header)); + svr->recvSize = header.size; + svr->recvCRC = header.crc; + if (svr->recvSize > ME_SEND_BUF_SIZE) + { + sub_8010198(); + return FALSE; + } + else if (svr->recvIdent != header.ident) + { + sub_8010198(); + return FALSE; + } + else + { + svr->recvCounter = 0; + mevent_reset_recv(svr->recvPlayerNo); + ++svr->seqno; + } + } + break; + case 1: + if (mevent_has_received(svr->recvPlayerNo)) + { + size_t blocksiz = svr->recvCounter * 252; + if (svr->recvSize - blocksiz <= 252) + { + mevent_recv_block(svr->recvPlayerNo, svr->recvBfr + blocksiz, svr->recvSize - blocksiz); + ++svr->recvCounter; + ++svr->seqno; + } + else + { + mevent_recv_block(svr->recvPlayerNo, svr->recvBfr + blocksiz, 252); + ++svr->recvCounter; + } + mevent_reset_recv(svr->recvPlayerNo); + } + break; + case 2: + if (CalcCRC16WithTable(svr->recvBfr, svr->recvSize) != svr->recvCRC) + { + sub_8010198(); + return FALSE; + } + else + { + svr->seqno = 0; + return TRUE; + } + break; + + } + + return FALSE; +} + +static bool32 mevent_send_func(struct mevent_srv_sub * svr) +{ + struct send_recv_header header; + + switch (svr->seqno) + { + case 0: + if (IsLinkTaskFinished()) + { + header.ident = svr->sendIdent; + header.size = svr->sendSize; + header.crc = CalcCRC16WithTable(svr->sendBfr, svr->sendSize); + svr->sendCRC = header.crc; + svr->sendCounter = 0; + SendBlock(0, &header, sizeof(header)); + ++svr->seqno; + } + break; + case 1: + if (IsLinkTaskFinished()) + { + if (mevent_has_received(svr->sendPlayerNo)) + { + size_t blocksiz; + mevent_reset_recv(svr->sendPlayerNo); + blocksiz = 252 * svr->sendCounter; + if (svr->sendSize - blocksiz <= 252) + { + SendBlock(0, svr->sendBfr + blocksiz, svr->sendSize - blocksiz); + ++svr->sendCounter; + ++svr->seqno; + } + else + { + SendBlock(0, svr->sendBfr + blocksiz, 252); + ++svr->sendCounter; + } + } + } + break; + case 2: + if (IsLinkTaskFinished()) + { + if (CalcCRC16WithTable(svr->sendBfr, svr->sendSize) != svr->sendCRC) + sub_8010198(); + else + ++svr->seqno; + } + break; + case 3: + if (mevent_has_received(svr->sendPlayerNo)) + { + mevent_reset_recv(svr->sendPlayerNo); + svr->seqno = 0; + return TRUE; + } + break; + } + + return FALSE; +} diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 2b310c981..0303bfd9b 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -14,9 +14,7 @@ static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); -extern const u8 gUnknown_082F2598[]; -extern const struct mevent_cmd gUnknown_8468B6C[]; -extern const struct mevent_cmd gUnknown_8468BCC[]; +extern const struct mevent_cmd_ish gUnknown_082F2598[]; void mevent_srv_ish_do_init(u32 arg) { diff --git a/src/util.c b/src/util.c index 47112774a..8aa54857a 100644 --- a/src/util.c +++ b/src/util.c @@ -218,7 +218,7 @@ int CountTrailingZeroBits(u32 value) return 0; } -u16 CalcCRC16(u8 *data, s32 length) +u16 CalcCRC16(const u8 *data, s32 length) { u16 i, j; u16 crc = 0x1121; @@ -237,7 +237,7 @@ u16 CalcCRC16(u8 *data, s32 length) return ~crc; } -u16 CalcCRC16WithTable(u8 *data, u32 length) +u16 CalcCRC16WithTable(const u8 *data, u32 length) { u16 i; u16 crc = 0x1121; From 28646ea64ea628596dc1cd9496febf6f46cc9e41 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:26:06 -0400 Subject: [PATCH 22/42] Decompile mevent server scripts --- data/mevent_server.s | 193 ---------------------------------------- include/mevent.h | 4 +- include/mevent_server.h | 6 +- ld_script.txt | 3 +- src/mevent2.c | 4 +- src/mevent_scripts.c | 191 +++++++++++++++++++++++++++++++++++++++ src/mevent_server.c | 16 +++- 7 files changed, 212 insertions(+), 205 deletions(-) delete mode 100755 data/mevent_server.s create mode 100644 src/mevent_scripts.c diff --git a/data/mevent_server.s b/data/mevent_server.s deleted file mode 100755 index 47e474e61..000000000 --- a/data/mevent_server.s +++ /dev/null @@ -1,193 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gText_CanceledReadingCard:: @ 82F257C - .string "Canceled reading\nthe Card.$" - - .align 2 -gUnknown_082F2598:: @ 82F2598 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F25A8:: @ 82F25A8 - .4byte 8, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F25C8:: @ 82F25C8 - .4byte 20, 0 - .4byte 1, 10 - - .align 2 -gUnknown_082F25D8:: @ 82F25D8 - .4byte 20, 0 - .4byte 1, 11 - - .align 2 -gUnknown_082F25E8:: @ 82F25E8 - .4byte 20, 0 - .4byte 1, 0 - - .align 2 -gUnknown_082F25F8:: @ 82F25F8 - .4byte 2, 22 - .4byte 10, 0 - .4byte 2, 25 - .4byte 17, 0 - .4byte 20, 0 - .4byte 1, 2 - - .align 2 -gUnknown_082F2628:: @ 82F2628 - .4byte 2, 23 - .4byte 9, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F2650:: @ 82F2650 - .4byte 20, 0 - .4byte 1, 7 - - .align 2 -gUnknown_082F2660:: @ 82F2660 - .4byte 20, 0 - .4byte 1, 3 - - .align 2 -gUnknown_082F2670:: @ 82F2670 - .4byte 13, 0 - .4byte 14, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F2698:: @ 82F2698 - .4byte 20, 0 - .4byte 1, 9 - - .align 2 -gUnknown_082F26A8:: @ 82F26A8 - .4byte 20, 0 - .4byte 1, 5 - - .align 2 -gUnknown_082F26B8:: @ 82F26B8 - .4byte 2, 21 - .4byte 12, 0 - .4byte 20, 0 - .4byte 1, 14 - .4byte 2, 21 - .4byte 12, 0 - .4byte 20, 0 - .4byte 1, 13 - - .align 2 -gUnknown_082F26F8:: @ 82F26F8 - .4byte 18, 0x10, gUnknown_082F25C8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x0a, NULL - .4byte 18, 0x10, gUnknown_082F25D8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x0b, NULL - .4byte 18, 0x10, gUnknown_082F2698 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x09, NULL - - .align 2 -gUnknown_082F2788:: @ 82F2788 - .4byte 18, 0x20, gUnknown_082F26B8 - .4byte 1, 0x00, NULL - .4byte 20, 0x1b, gText_CanceledReadingCard - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x09, NULL - - .align 2 -gUnknown_082F27D0:: @ 82F27D0 - .4byte 18, 0x10, gUnknown_082F2650 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x07, NULL - - .align 2 -gUnknown_082F2800:: @ 82F2800 - .4byte 18, 0x28, gUnknown_082F2628 - .4byte 1, 0x00, NULL - .4byte 14, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 2, 0x13, NULL - .4byte 8, 0x00, NULL - .4byte 4, 0x01, gUnknown_082F27D0 - .4byte 18, 0x10, gUnknown_082F2660 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x03, NULL - - .align 2 -gUnknown_082F2884:: @ 82F2884 - .4byte 18, 0x30, gUnknown_082F25F8 - .4byte 1, 0x00, NULL - .4byte 13, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 15, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x02, NULL - - .align 2 -gUnknown_082F28E4:: @ 82F28E4 - .4byte 18, 0x28, gUnknown_082F2670 - .4byte 1, 0x00, NULL - .4byte 2, 0x13, NULL - .4byte 8, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F2884 - .4byte 3, 0x00, gUnknown_082F2788 - - .align 2 -gUnknown_082F292C:: @ 82F292C - .4byte 18, 0x10, gUnknown_082F26A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x05, NULL - .4byte 18, 0x10, gUnknown_082F25E8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x00, NULL - - .align 2 -s_mevent_wonder_news:: @ 82F298C - .4byte 27, 0x00, NULL - .4byte 18, 0x20, gUnknown_082F25A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x11, NULL - .4byte 5, 0x00, NULL - .4byte 30, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F26F8 - .4byte 3, 0x00, gUnknown_082F2800 - - .align 2 -s_mevent_wonder_card:: @ 82F29EC - .4byte 26, 0x00, NULL - .4byte 28, 0x00, NULL - .4byte 18, 0x20, gUnknown_082F25A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x11, NULL - .4byte 5, 0x00, NULL - .4byte 6, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F26F8 - .4byte 7, 0x00, NULL - .4byte 4, 0x02, gUnknown_082F28E4 - .4byte 4, 0x00, gUnknown_082F2884 - .4byte 3, 0x00, gUnknown_082F292C diff --git a/include/mevent.h b/include/mevent.h index 9c5d559bf..68c19abfc 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -52,8 +52,8 @@ bool32 CheckReceivedGiftFromWonderCard(void); bool32 sub_801B508(const u16 *data); void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1); bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1); -u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused); -u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused); +u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); +u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command); u16 mevent_081445C0(u32 command); diff --git a/include/mevent_server.h b/include/mevent_server.h index ed9812d8a..019f3c685 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -7,7 +7,7 @@ struct mevent_cmd { u32 instr; bool32 flag; - void * parameter; + const void * parameter; }; struct mevent_srv_common @@ -21,9 +21,9 @@ struct mevent_srv_common struct MEventBuffer_32E0_Sub * mevent_32e0; struct MEventBuffer_3120_Sub * mevent_3120; struct MEventStruct_Unk1442CC * mevent_unk1442cc; - void * sendBuffer1; + const void * sendBuffer1; u32 sendBuffer1Size; - void * sendBuffer2; + const void * sendBuffer2; u32 sendBuffer2Size; u32 sendWord; struct mevent_srv_sub manager; diff --git a/ld_script.txt b/ld_script.txt index 65f171171..c5ffc06fe 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -418,8 +418,7 @@ SECTIONS { src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); src/mevent_server_ish.o(.rodata); - src/mevent_server_helpers.o(.rodata); - data/mevent_server.o(.rodata); + src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); data/berry_crush.o(.rodata); diff --git a/src/mevent2.c b/src/mevent2.c index 4174c4055..8585224ef 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -399,7 +399,7 @@ bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1) return TRUE; } -u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused) +u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused) { if (a1->unk_14 == 0) return 0; @@ -410,7 +410,7 @@ u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *un return 2; } -u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused) +u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused) { int r4 = a1->unk_44 - sub_801B438(&a1->unk_20, a1->unk_44); if (r4 == 0) diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c new file mode 100644 index 000000000..4a1a26535 --- /dev/null +++ b/src/mevent_scripts.c @@ -0,0 +1,191 @@ +#include "global.h" +#include "mevent_server_ish.h" +#include "mevent_server.h" + +const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); + + +const struct mevent_cmd_ish gUnknown_082F2598[] = { + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25A8[] = { + { 8, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25C8[] = { + {20, 0}, + { 1, 10} +}; + +const struct mevent_cmd_ish gUnknown_082F25D8[] = { + {20, 0}, + { 1, 11} +}; + +const struct mevent_cmd_ish gUnknown_082F25E8[] = { + {20, 0}, + { 1, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25F8[] = { + { 2, 22}, + {10, 0}, + { 2, 25}, + {17, 0}, + {20, 0}, + { 1, 2} +}; + +const struct mevent_cmd_ish gUnknown_082F2628[] = { + { 2, 23}, + { 9, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F2650[] = { + {20, 0}, + { 1, 7} +}; + +const struct mevent_cmd_ish gUnknown_082F2660[] = { + {20, 0}, + { 1, 3} +}; + +const struct mevent_cmd_ish gUnknown_082F2670[] = { + {13, 0}, + {14, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F2698[] = { + {20, 0}, + { 1, 9} +}; + +const struct mevent_cmd_ish gUnknown_082F26A8[] = { + {20, 0}, + { 1, 5} +}; + +const struct mevent_cmd_ish gUnknown_082F26B8[] = { + { 2, 21}, + {12, 0}, + {20, 0}, + { 1, 14}, + { 2, 21}, + {12, 0}, + {20, 0}, + { 1, 13} +}; + +const struct mevent_cmd gUnknown_082F26F8[] = { + {18, 0x10, gUnknown_082F25C8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x0a, NULL}, + {18, 0x10, gUnknown_082F25D8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x0b, NULL}, + {18, 0x10, gUnknown_082F2698}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x09, NULL} +}; + +const struct mevent_cmd gUnknown_082F2788[] = { + {18, 0x20, gUnknown_082F26B8}, + { 1, 0x00, NULL}, + {20, 0x1b, gText_CanceledReadingCard}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x09, NULL} +}; + +const struct mevent_cmd gUnknown_082F27D0[] = { + {18, 0x10, gUnknown_082F2650}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x07, NULL} +}; + +const struct mevent_cmd gUnknown_082F2800[] = { + {18, 0x28, gUnknown_082F2628}, + { 1, 0x00, NULL}, + {14, 0x00, NULL}, + { 1, 0x00, NULL}, + { 2, 0x13, NULL}, + { 8, 0x00, NULL}, + { 4, 0x01, gUnknown_082F27D0}, + {18, 0x10, gUnknown_082F2660}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x03, NULL} +}; + +const struct mevent_cmd gUnknown_082F2884[] = { + {18, 0x30, gUnknown_082F25F8}, + { 1, 0x00, NULL}, + {13, 0x00, NULL}, + { 1, 0x00, NULL}, + {15, 0x00, NULL}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x02, NULL} +}; + +const struct mevent_cmd gUnknown_082F28E4[] = { + {18, 0x28, gUnknown_082F2670}, + { 1, 0x00, NULL}, + { 2, 0x13, NULL}, + { 8, 0x00, NULL}, + { 4, 0x00, gUnknown_082F2884}, + { 3, 0x00, gUnknown_082F2788} +}; + +const struct mevent_cmd gUnknown_082F292C[] = { + {18, 0x10, gUnknown_082F26A8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x05, NULL}, + {18, 0x10, gUnknown_082F25E8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x00, NULL} +}; + +const struct mevent_cmd s_mevent_wonder_news[] = { + {27, 0x00, NULL}, + {18, 0x20, gUnknown_082F25A8}, + { 1, 0x00, NULL}, + { 2, 0x11, NULL}, + { 5, 0x00, NULL}, + {30, 0x00, NULL}, + { 4, 0x00, gUnknown_082F26F8}, + { 3, 0x00, gUnknown_082F2800} +}; + +const struct mevent_cmd s_mevent_wonder_card[] = { + {26, 0x00, NULL}, + {28, 0x00, NULL}, + {18, 0x20, gUnknown_082F25A8}, + {1, 0x00, NULL}, + {2, 0x11, NULL}, + {5, 0x00, NULL}, + {6, 0x00, NULL}, + {4, 0x00, gUnknown_082F26F8}, + {7, 0x00, NULL}, + {4, 0x02, gUnknown_082F28E4}, + {4, 0x00, gUnknown_082F2884}, + {3, 0x00, gUnknown_082F292C}, +}; diff --git a/src/mevent_server.c b/src/mevent_server.c index 6a129ee28..fe13943ff 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -69,7 +69,7 @@ void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, cons mevent_srv_sub_init_send(&svr->manager, ident, src, size); } -static void * mevent_first_if_not_null_else_second(void * a0, void * a1) +static const void * mevent_first_if_not_null_else_second(const void * a0, const void * a1) { if (a0 != NULL) return a0; @@ -77,7 +77,7 @@ static void * mevent_first_if_not_null_else_second(void * a0, void * a1) return a1; } -static u32 mevent_compare_pointers(void * a0, void * a1) +static u32 mevent_compare_pointers(const void * a0, const void * a1) { if (a1 < a0) return 0; @@ -120,45 +120,53 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) { // process command const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; - void * ptr; + const void * ptr; svr->cmdidx++; switch (cmd->instr) { case 0: + // end AGB_ASSERT(cmd->parameter == NULL); svr->mainseqno = 1; svr->param = cmd->flag; break; case 1: + // wait_send svr->mainseqno = 3; break; case 2: + // receive AGB_ASSERT(cmd->parameter == NULL); mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer); svr->mainseqno = 2; break; case 3: + // jump AGB_ASSERT(cmd->flag == FALSE); svr->cmdidx = 0; svr->cmdBuffer = cmd->parameter; break; case 5: + // get_1442CC AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC)); break; case 6: + // check_header__pass_false AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE); break; case 30: + // check_header__pass_true AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE); break; case 4: + // jump_if_eq if (svr->param == cmd->flag) { svr->cmdidx = 0; @@ -166,11 +174,13 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) } break; case 7: + // check_crc AGB_ASSERT(cmd->flag == FALSE); ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); break; case 8: + // read_word AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = *(u32 *)svr->recvBuffer; From b17c85ff7c975359b6d075453fb1ad668262f87f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:35:38 -0400 Subject: [PATCH 23/42] Use named fields for command structs --- src/mevent_scripts.c | 238 +++++++++++++++++++++---------------------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c index 4a1a26535..29b37119e 100644 --- a/src/mevent_scripts.c +++ b/src/mevent_scripts.c @@ -6,186 +6,186 @@ const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); const struct mevent_cmd_ish gUnknown_082F2598[] = { - { 2, 16}, - { 4, 0} + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25A8[] = { - { 8, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 8, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25C8[] = { - {20, 0}, - { 1, 10} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 10} }; const struct mevent_cmd_ish gUnknown_082F25D8[] = { - {20, 0}, - { 1, 11} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 11} }; const struct mevent_cmd_ish gUnknown_082F25E8[] = { - {20, 0}, - { 1, 0} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25F8[] = { - { 2, 22}, - {10, 0}, - { 2, 25}, - {17, 0}, - {20, 0}, - { 1, 2} + {.instr = 2, .parameter = 22}, + {.instr = 10, .parameter = 0}, + {.instr = 2, .parameter = 25}, + {.instr = 17, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 2} }; const struct mevent_cmd_ish gUnknown_082F2628[] = { - { 2, 23}, - { 9, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 2, .parameter = 23}, + {.instr = 9, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F2650[] = { - {20, 0}, - { 1, 7} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 7} }; const struct mevent_cmd_ish gUnknown_082F2660[] = { - {20, 0}, - { 1, 3} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 3} }; const struct mevent_cmd_ish gUnknown_082F2670[] = { - {13, 0}, - {14, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 13, .parameter = 0}, + {.instr = 14, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F2698[] = { - {20, 0}, - { 1, 9} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 9} }; const struct mevent_cmd_ish gUnknown_082F26A8[] = { - {20, 0}, - { 1, 5} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 5} }; const struct mevent_cmd_ish gUnknown_082F26B8[] = { - { 2, 21}, - {12, 0}, - {20, 0}, - { 1, 14}, - { 2, 21}, - {12, 0}, - {20, 0}, - { 1, 13} + {.instr = 2, .parameter = 21}, + {.instr = 12, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 14}, + {.instr = 2, .parameter = 21}, + {.instr = 12, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 13} }; const struct mevent_cmd gUnknown_082F26F8[] = { - {18, 0x10, gUnknown_082F25C8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x0a, NULL}, - {18, 0x10, gUnknown_082F25D8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x0b, NULL}, - {18, 0x10, gUnknown_082F2698}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x09, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25C8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x0a, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25D8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x0b, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2698}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x09, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2788[] = { - {18, 0x20, gUnknown_082F26B8}, - { 1, 0x00, NULL}, - {20, 0x1b, gText_CanceledReadingCard}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x09, NULL} + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F26B8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 20, .flag = 0x1b, .parameter = gText_CanceledReadingCard}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x09, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F27D0[] = { - {18, 0x10, gUnknown_082F2650}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x07, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2650}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x07, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2800[] = { - {18, 0x28, gUnknown_082F2628}, - { 1, 0x00, NULL}, - {14, 0x00, NULL}, - { 1, 0x00, NULL}, - { 2, 0x13, NULL}, - { 8, 0x00, NULL}, - { 4, 0x01, gUnknown_082F27D0}, - {18, 0x10, gUnknown_082F2660}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x03, NULL} + {.instr = 18, .flag = 0x28, .parameter = gUnknown_082F2628}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 14, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x13, .parameter = NULL}, + {.instr = 8, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x01, .parameter = gUnknown_082F27D0}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2660}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x03, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2884[] = { - {18, 0x30, gUnknown_082F25F8}, - { 1, 0x00, NULL}, - {13, 0x00, NULL}, - { 1, 0x00, NULL}, - {15, 0x00, NULL}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x02, NULL} + {.instr = 18, .flag = 0x30, .parameter = gUnknown_082F25F8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 13, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 15, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x02, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F28E4[] = { - {18, 0x28, gUnknown_082F2670}, - { 1, 0x00, NULL}, - { 2, 0x13, NULL}, - { 8, 0x00, NULL}, - { 4, 0x00, gUnknown_082F2884}, - { 3, 0x00, gUnknown_082F2788} + {.instr = 18, .flag = 0x28, .parameter = gUnknown_082F2670}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x13, .parameter = NULL}, + {.instr = 8, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F2884}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F2788} }; const struct mevent_cmd gUnknown_082F292C[] = { - {18, 0x10, gUnknown_082F26A8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x05, NULL}, - {18, 0x10, gUnknown_082F25E8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x00, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F26A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x05, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25E8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x00, .parameter = NULL} }; const struct mevent_cmd s_mevent_wonder_news[] = { - {27, 0x00, NULL}, - {18, 0x20, gUnknown_082F25A8}, - { 1, 0x00, NULL}, - { 2, 0x11, NULL}, - { 5, 0x00, NULL}, - {30, 0x00, NULL}, - { 4, 0x00, gUnknown_082F26F8}, - { 3, 0x00, gUnknown_082F2800} + {.instr = 27, .flag = 0x00, .parameter = NULL}, + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F25A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x11, .parameter = NULL}, + {.instr = 5, .flag = 0x00, .parameter = NULL}, + {.instr = 30, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F26F8}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F2800} }; const struct mevent_cmd s_mevent_wonder_card[] = { - {26, 0x00, NULL}, - {28, 0x00, NULL}, - {18, 0x20, gUnknown_082F25A8}, - {1, 0x00, NULL}, - {2, 0x11, NULL}, - {5, 0x00, NULL}, - {6, 0x00, NULL}, - {4, 0x00, gUnknown_082F26F8}, - {7, 0x00, NULL}, - {4, 0x02, gUnknown_082F28E4}, - {4, 0x00, gUnknown_082F2884}, - {3, 0x00, gUnknown_082F292C}, + {.instr = 26, .flag = 0x00, .parameter = NULL}, + {.instr = 28, .flag = 0x00, .parameter = NULL}, + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F25A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x11, .parameter = NULL}, + {.instr = 5, .flag = 0x00, .parameter = NULL}, + {.instr = 6, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F26F8}, + {.instr = 7, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x02, .parameter = gUnknown_082F28E4}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F2884}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F292C} }; From d220f876fc9e7281075419ce6bbb5bf9e8dbef8f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:57:03 -0400 Subject: [PATCH 24/42] Some symbol documentation --- include/global.h | 16 +++---- include/mevent.h | 14 +++---- include/mevent_801BAAC.h | 4 +- include/mevent_server.h | 4 +- include/script.h | 6 +-- src/mevent2.c | 90 ++++++++++++++++++++-------------------- src/mevent_801BAAC.c | 8 ++-- src/mevent_server.c | 30 +++++++------- src/mevent_server_ish.c | 2 +- src/mystery_gift.c | 4 +- src/scrcmd.c | 2 +- src/script.c | 6 +-- 12 files changed, 93 insertions(+), 93 deletions(-) diff --git a/include/global.h b/include/global.h index 0506c036e..7b570d72e 100644 --- a/include/global.h +++ b/include/global.h @@ -816,7 +816,7 @@ struct MysteryEventStruct u8 unk_1; }; - struct MEventBuffer_3120_Sub + struct WonderNews { u16 unk_00; u8 unk_02; @@ -825,13 +825,13 @@ struct MysteryEventStruct u8 unk_2C[10][40]; }; - struct MEventBuffer_3120 + struct WonderNewsSaveStruct { u32 crc; - struct MEventBuffer_3120_Sub data; + struct WonderNews data; }; - struct MEventBuffer_32E0_Sub + struct WonderCard { u16 unk_00; u16 unk_02; @@ -847,10 +847,10 @@ struct MysteryEventStruct u8 unk_122[40]; }; - struct MEventBuffer_32E0 + struct WonderCardSaveStruct { u32 crc; - struct MEventBuffer_32E0_Sub data; + struct WonderCard data; }; struct MEventBuffer_3430_Sub @@ -870,8 +870,8 @@ struct MysteryEventStruct struct MEventBuffers { - /*0x000 0x322C*/ struct MEventBuffer_3120 buffer_000; - /*0x1c0 0x33EC*/ struct MEventBuffer_32E0 buffer_1c0; + /*0x000 0x322C*/ struct WonderNewsSaveStruct wonderNews; + /*0x1c0 0x33EC*/ struct WonderCardSaveStruct wonderCard; /*0x310 0x353C*/ struct MEventBuffer_3430 buffer_310; /*0x338 0x3564*/ u16 unk_338[4]; /*0x340 0x356C*/ struct MysteryEventStruct unk_340; diff --git a/include/mevent.h b/include/mevent.h index 68c19abfc..a34ca355c 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -32,30 +32,30 @@ struct MEventStruct_Unk1442CC }; void sub_801AFD8(void); -struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void); -struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void); +struct WonderNews *GetSavedWonderNews(void); +struct WonderCard *GetSavedWonderCard(void); struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void); struct MysteryEventStruct *sub_801B044(void); u16 *sub_801B058(void); void DestroyWonderNews(void); -bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src); +bool32 sub_801B078(const struct WonderNews *src); bool32 ValidateReceivedWonderNews(void); bool32 WonderNews_Test_Unk_02(void); bool32 sub_801B1A4(const u8 *src); void DestroyWonderCard(void); -bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data); +bool32 sub_801B21C(const struct WonderCard *data); bool32 ValidateReceivedWonderCard(void); bool32 WonderCard_Test_Unk_08_6(void); u16 GetWonderCardFlagID(void); -void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer); +void WonderCard_ResetInternalReceivedFlag(struct WonderCard *buffer); bool32 CheckReceivedGiftFromWonderCard(void); bool32 sub_801B508(const u16 *data); void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1); bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1); u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); -bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); -u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command); +bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); +u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command); u16 mevent_081445C0(u32 command); void sub_801B940(void); bool32 sub_801B94C(u16 a0); diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index 547d5237b..d76bc92c2 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -1,8 +1,8 @@ #ifndef GUARD_MEVENT_801BAAC_H #define GUARD_MEVENT_801BAAC_H -bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); -bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0); +bool32 InitWonderCardResources(struct WonderCard * r5, struct MEventBuffer_3430_Sub * r6); +bool32 InitWonderNewsResources(const struct WonderNews * a0); s32 FadeToWonderCardMenu(void); s32 FadeToWonderNewsMenu(void); s32 FadeOutFromWonderCard(bool32 flag); diff --git a/include/mevent_server.h b/include/mevent_server.h index 019f3c685..e74337cf6 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -18,8 +18,8 @@ struct mevent_srv_common u32 cmdidx; const struct mevent_cmd * cmdBuffer; void * recvBuffer; - struct MEventBuffer_32E0_Sub * mevent_32e0; - struct MEventBuffer_3120_Sub * mevent_3120; + struct WonderCard * wonder_card; + struct WonderNews * wonder_news; struct MEventStruct_Unk1442CC * mevent_unk1442cc; const void * sendBuffer1; u32 sendBuffer1Size; diff --git a/include/script.h b/include/script.h index 34f4635bb..cfe493479 100644 --- a/include/script.h +++ b/include/script.h @@ -57,9 +57,9 @@ u32 CalculateRamScriptChecksum(void); void ClearRamScript(void); bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId); const u8 *GetRamScript(u8 objectId, const u8 *script); -bool32 sub_80991F8(void); -u8 *sub_8099244(void); -void sub_80992A0(u8 *script, u16 scriptSize); +bool32 ValidateSavedRamScript(void); +u8 *GetSavedRamScriptIfValid(void); +void InitRamScript_NoEventObject(u8 *script, u16 scriptSize); // srccmd.h void sub_809BE48(u16 npcId); diff --git a/src/mevent2.c b/src/mevent2.c index 8585224ef..f36e5d06b 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -15,8 +15,8 @@ static EWRAM_DATA bool32 gUnknown_02022C70 = FALSE; static void sub_801B180(void); static void s_DestroyWonderNews(void); -static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data); -static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data); +static bool32 sub_801B114(const struct WonderNews *data); +static bool32 sub_801B2CC(const struct WonderCard *data); static void sub_801B330(void); static void sub_801B368(void); static void sub_801B9F8(void); @@ -29,14 +29,14 @@ void sub_801AFD8(void) sub_811F8BC(); } -struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void) +struct WonderNews *GetSavedWonderNews(void) { - return &gSaveBlock1Ptr->unk_322C.buffer_000.data; + return &gSaveBlock1Ptr->unk_322C.wonderNews.data; } -struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void) +struct WonderCard *GetSavedWonderCard(void) { - return &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + return &gSaveBlock1Ptr->unk_322C.wonderCard.data; } struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void) @@ -59,28 +59,28 @@ void DestroyWonderNews(void) s_DestroyWonderNews(); } -bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src) +bool32 sub_801B078(const struct WonderNews *src) { if (!sub_801B114(src)) return FALSE; s_DestroyWonderNews(); - gSaveBlock1Ptr->unk_322C.buffer_000.data = *src; - gSaveBlock1Ptr->unk_322C.buffer_000.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)); + gSaveBlock1Ptr->unk_322C.wonderNews.data = *src; + gSaveBlock1Ptr->unk_322C.wonderNews.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews)); return TRUE; } bool32 ValidateReceivedWonderNews(void) { - if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)) != gSaveBlock1Ptr->unk_322C.buffer_000.crc) + if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews)) != gSaveBlock1Ptr->unk_322C.wonderNews.crc) return FALSE; - if (!sub_801B114(&gSaveBlock1Ptr->unk_322C.buffer_000.data)) + if (!sub_801B114(&gSaveBlock1Ptr->unk_322C.wonderNews.data)) return FALSE; return TRUE; } -static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data) +static bool32 sub_801B114(const struct WonderNews *data) { if (data->unk_00 == 0) return FALSE; @@ -90,7 +90,7 @@ static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data) bool32 WonderNews_Test_Unk_02(void) { - const struct MEventBuffer_3120_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_000.data; + const struct WonderNews *data = &gSaveBlock1Ptr->unk_322C.wonderNews.data; if (data->unk_02 == 0) return FALSE; @@ -99,8 +99,8 @@ bool32 WonderNews_Test_Unk_02(void) static void s_DestroyWonderNews(void) { - CpuFill32(0, sav1_get_mevent_buffer_0(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data)); - gSaveBlock1Ptr->unk_322C.buffer_000.crc = 0; + CpuFill32(0, GetSavedWonderNews(), sizeof(gSaveBlock1Ptr->unk_322C.wonderNews.data)); + gSaveBlock1Ptr->unk_322C.wonderNews.crc = 0; } static void sub_801B180(void) @@ -111,12 +111,12 @@ static void sub_801B180(void) bool32 sub_801B1A4(const u8 *src) { - const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.buffer_000.data; + const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.wonderNews.data; u32 i; if (!ValidateReceivedWonderNews()) return FALSE; - for (i = 0; i < sizeof(struct MEventBuffer_3120_Sub); i++) + for (i = 0; i < sizeof(struct WonderNews); i++) { if (r5[i] != src[i]) return FALSE; @@ -136,35 +136,35 @@ void DestroyWonderCard(void) ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); } -bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data) +bool32 sub_801B21C(const struct WonderCard *data) { struct MEventBuffer_3430_Sub *r2; - struct MEventBuffer_32E0_Sub *r1; + struct WonderCard *r1; if (!sub_801B2CC(data)) return FALSE; DestroyWonderCard(); - memcpy(&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, data, sizeof(struct MEventBuffer_32E0_Sub)); - gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); + memcpy(&gSaveBlock1Ptr->unk_322C.wonderCard.data, data, sizeof(struct WonderCard)); + gSaveBlock1Ptr->unk_322C.wonderCard.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard)); r2 = &gSaveBlock1Ptr->unk_322C.buffer_310.data; - r1 = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + r1 = &gSaveBlock1Ptr->unk_322C.wonderCard.data; r2->unk_06 = r1->unk_02; return TRUE; } bool32 ValidateReceivedWonderCard(void) { - if (gSaveBlock1Ptr->unk_322C.buffer_1c0.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub))) + if (gSaveBlock1Ptr->unk_322C.wonderCard.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard))) return FALSE; - if (!sub_801B2CC(&gSaveBlock1Ptr->unk_322C.buffer_1c0.data)) + if (!sub_801B2CC(&gSaveBlock1Ptr->unk_322C.wonderCard.data)) return FALSE; - if (!sub_80991F8()) + if (!ValidateSavedRamScript()) return FALSE; return TRUE; } -static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data) +static bool32 sub_801B2CC(const struct WonderCard *data) { if (data->unk_00 == 0) return FALSE; @@ -182,7 +182,7 @@ static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data) bool32 WonderCard_Test_Unk_08_6(void) { - const struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + const struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_6 == 0) return FALSE; @@ -191,8 +191,8 @@ bool32 WonderCard_Test_Unk_08_6(void) static void sub_801B330(void) { - CpuFill32(0, &gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); - gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = 0; + CpuFill32(0, &gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard)); + gSaveBlock1Ptr->unk_322C.wonderCard.crc = 0; } static void sub_801B368(void) @@ -204,12 +204,12 @@ static void sub_801B368(void) u16 GetWonderCardFlagID(void) { if (ValidateReceivedWonderCard()) - return gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00; + return gSaveBlock1Ptr->unk_322C.wonderCard.data.unk_00; return 0; } -void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer) +void WonderCard_ResetInternalReceivedFlag(struct WonderCard *buffer) { if (buffer->unk_08_6 == 1) buffer->unk_08_6 = 0; @@ -299,11 +299,11 @@ static bool32 sub_801B4A4(const u16 *data) static int sub_801B4CC(void) { - struct MEventBuffer_32E0_Sub *data; + struct WonderCard *data; if (!ValidateReceivedWonderCard()) return 0; - data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 != 1) return 0; @@ -312,7 +312,7 @@ static int sub_801B4CC(void) bool32 sub_801B508(const u16 *data) { - struct MEventBuffer_32E0_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *buffer = &gSaveBlock1Ptr->unk_322C.wonderCard.data; int size = buffer->unk_09; int i; if (!sub_801B4A4(data)) @@ -355,9 +355,9 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1) if (ValidateReceivedWonderCard()) { - data->unk_14 = sav1_get_mevent_buffer_1()->unk_00; + data->unk_14 = GetSavedWonderCard()->unk_00; data->unk_20 = *sav1_get_mevent_buffer_2(); - data->unk_44 = sav1_get_mevent_buffer_1()->unk_09; + data->unk_44 = GetSavedWonderCard()->unk_09; } else { @@ -422,7 +422,7 @@ u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const vo return 2; } -bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1) +bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1) { int i; for (i = 0; i < 4; i++) @@ -439,7 +439,7 @@ static int sub_801B770(const struct MEventStruct_Unk1442CC *a0) return sub_801B438(&a0->unk_20, a0->unk_44); } -u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command) +u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command) { switch (command) { @@ -461,7 +461,7 @@ u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command) static void sub_801B7D8(u32 command) { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { u16 *dest = NULL; @@ -495,7 +495,7 @@ u16 mevent_081445C0(u32 command) { case 0: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -505,7 +505,7 @@ u16 mevent_081445C0(u32 command) } case 1: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -515,7 +515,7 @@ u16 mevent_081445C0(u32 command) } case 2: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -525,14 +525,14 @@ u16 mevent_081445C0(u32 command) } case 3: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 1) return sub_801B4CC(); break; } case 4: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 1) return data->unk_09; break; @@ -557,7 +557,7 @@ bool32 sub_801B94C(u16 a0) if (!ValidateReceivedWonderCard()) return FALSE; - if (gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00 != a0) + if (gSaveBlock1Ptr->unk_322C.wonderCard.data.unk_00 != a0) return FALSE; gUnknown_02022C70 = TRUE; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 24a999f69..62240af98 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -35,7 +35,7 @@ struct UnkStruct_203F3C8_02DC struct UnkStruct_203F3C8 { - /*0000*/ struct MEventBuffer_32E0_Sub unk_0000; + /*0000*/ struct WonderCard unk_0000; /*014c*/ struct MEventBuffer_3430_Sub unk_014C; /*0170*/ const struct UnkStruct_8467FB8 * unk_0170; /*0174*/ u8 unk_0174; @@ -150,7 +150,7 @@ const struct UnkStruct_8467FB8 gUnknown_082F1D60[8] = { {1, 0, 0, 7, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8} }; -bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6) +bool32 InitWonderCardResources(struct WonderCard * r5, struct MEventBuffer_3430_Sub * r6) { if (r5 == NULL || r6 == NULL) return FALSE; @@ -465,7 +465,7 @@ void sub_801C61C(void) struct UnkStruct_203F3CC { - /*0000*/ struct MEventBuffer_3120_Sub unk_0000; + /*0000*/ struct WonderNews unk_0000; /*01bc*/ const struct UnkStruct_8467FB8 * unk_01BC; /*01c0*/ u8 unk_01C0_0:1; u8 unk_01C0_1:7; @@ -542,7 +542,7 @@ const struct UnkStruct_8467FB8 gUnknown_082F24C8[] = { {1, 0, 0, 0, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8} }; -bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0) +bool32 InitWonderNewsResources(const struct WonderNews * a0) { if (a0 == NULL) return FALSE; diff --git a/src/mevent_server.c b/src/mevent_server.c index fe13943ff..06b10dd95 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -46,8 +46,8 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * { svr->unk_00 = 0; svr->mainseqno = 0; - svr->mevent_32e0 = AllocZeroed(sizeof(struct MEventBuffer_32E0_Sub)); - svr->mevent_3120 = AllocZeroed(sizeof(struct MEventBuffer_3120_Sub)); + svr->wonder_card = AllocZeroed(sizeof(struct WonderCard)); + svr->wonder_news = AllocZeroed(sizeof(struct WonderNews)); svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); svr->mevent_unk1442cc = AllocZeroed(sizeof(struct MEventStruct_Unk1442CC)); svr->cmdBuffer = cmdBuffer; @@ -57,8 +57,8 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * static void mevent_srv_free_resources(struct mevent_srv_common * svr) { - Free(svr->mevent_32e0); - Free(svr->mevent_3120); + Free(svr->wonder_card); + Free(svr->wonder_news); Free(svr->recvBuffer); Free(svr->mevent_unk1442cc); } @@ -176,7 +176,7 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) case 7: // check_crc AGB_ASSERT(cmd->flag == FALSE); - ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_card); svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); break; case 8: @@ -192,11 +192,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 10: AGB_ASSERT(cmd->parameter == NULL); - svr->param = sub_801B784(svr->mevent_unk1442cc, cmd->flag); + svr->param = MEventStruct_Unk1442CC_GetValueNFrom_unk_20(svr->mevent_unk1442cc, cmd->flag); break; case 11: AGB_ASSERT(cmd->flag == FALSE); - svr->param = sub_801B748(svr->mevent_unk1442cc, cmd->parameter); + svr->param = MEventStruct_Unk1442CC_CompareField_unk_16(svr->mevent_unk1442cc, cmd->parameter); break; case 12: AGB_ASSERT(cmd->flag == FALSE); @@ -204,11 +204,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 14: AGB_ASSERT(cmd->flag == FALSE); - mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_3120), sizeof(struct MEventBuffer_3120_Sub)); + mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_news), sizeof(struct WonderNews)); break; case 13: AGB_ASSERT(cmd->flag == FALSE); - mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0), sizeof(struct MEventBuffer_32E0_Sub)); + mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_card), sizeof(struct WonderCard)); break; case 16: AGB_ASSERT(cmd->flag == FALSE); @@ -238,11 +238,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 22: AGB_ASSERT(cmd->flag == FALSE); - memcpy(svr->mevent_32e0, cmd->parameter, 332); + memcpy(svr->wonder_card, cmd->parameter, 332); break; case 23: AGB_ASSERT(cmd->flag == FALSE); - memcpy(svr->mevent_3120, cmd->parameter, 444); + memcpy(svr->wonder_news, cmd->parameter, 444); break; case 21: AGB_ASSERT(cmd->flag == FALSE); @@ -258,16 +258,16 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 26: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - memcpy(svr->mevent_32e0, sav1_get_mevent_buffer_1(), 332); - sub_801B3C0(svr->mevent_32e0); + memcpy(svr->wonder_card, GetSavedWonderCard(), 332); + WonderCard_ResetInternalReceivedFlag(svr->wonder_card); break; case 27: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - memcpy(svr->mevent_3120, sav1_get_mevent_buffer_0(), 444); + memcpy(svr->wonder_news, GetSavedWonderNews(), 444); break; case 28: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - svr->sendBuffer1 = sub_8099244(); + svr->sendBuffer1 = GetSavedRamScriptIfValid(); break; case 29: mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag); diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 0303bfd9b..48f72eaad 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -216,7 +216,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) sub_801B508(svr->recvBuffer); break; case 17: - sub_80992A0(svr->recvBuffer, 1000); + InitRamScript_NoEventObject(svr->recvBuffer, 1000); break; case 18: memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, svr->recvBuffer, 0xbc); diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c8b3a9060..c935e9b25 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -815,11 +815,11 @@ static bool32 HandleLoadWonderCardOrNews(u8 * state, bool32 cardOrNews) case 0: if (cardOrNews == 0) { - InitWonderCardResources(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); + InitWonderCardResources(GetSavedWonderCard(), sav1_get_mevent_buffer_2()); } else { - InitWonderNewsResources(sav1_get_mevent_buffer_0()); + InitWonderNewsResources(GetSavedWonderNews()); } (*state)++; break; diff --git a/src/scrcmd.c b/src/scrcmd.c index 314504600..0b1006cef 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2217,7 +2217,7 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) { - const u8* v1 = sub_8099244(); + const u8* v1 = GetSavedRamScriptIfValid(); if (v1) { diff --git a/src/script.c b/src/script.c index cb06300bf..27476dba3 100644 --- a/src/script.c +++ b/src/script.c @@ -386,7 +386,7 @@ const u8 *GetRamScript(u8 objectId, const u8 *script) } } -bool32 sub_80991F8(void) +bool32 ValidateSavedRamScript(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (scriptData->magic != RAM_SCRIPT_MAGIC) @@ -402,7 +402,7 @@ bool32 sub_80991F8(void) return TRUE; } -u8 *sub_8099244(void) +u8 *GetSavedRamScriptIfValid(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (!ValidateReceivedWonderCard()) @@ -426,7 +426,7 @@ u8 *sub_8099244(void) } } -void sub_80992A0(u8 *script, u16 scriptSize) +void InitRamScript_NoEventObject(u8 *script, u16 scriptSize) { if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script)) scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script); From d0384ee95e124f16e33cdfbf1d18d02ef97145b4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 14:02:13 -0400 Subject: [PATCH 25/42] mevent_server_ish --> mevent_client --- .../{mevent_server_ish.h => mevent_client.h} | 16 ++-- ld_script.txt | 4 +- src/{mevent_server_ish.c => mevent_client.c} | 90 +++++++++---------- src/mevent_scripts.c | 28 +++--- src/mystery_gift.c | 52 +++++------ sym_ewram.txt | 2 +- 6 files changed, 96 insertions(+), 96 deletions(-) rename include/{mevent_server_ish.h => mevent_client.h} (58%) rename src/{mevent_server_ish.c => mevent_client.c} (66%) diff --git a/include/mevent_server_ish.h b/include/mevent_client.h similarity index 58% rename from include/mevent_server_ish.h rename to include/mevent_client.h index 35833ea12..58893794e 100644 --- a/include/mevent_server_ish.h +++ b/include/mevent_client.h @@ -3,13 +3,13 @@ #include "mevent_server_helpers.h" -struct mevent_cmd_ish +struct mevent_client_cmd { u32 instr; u32 parameter; }; -struct mevent_srv_ish +struct mevent_client { u32 unk_00; u32 param; @@ -18,16 +18,16 @@ struct mevent_srv_ish u32 cmdidx; void * sendBuffer; void * recvBuffer; - struct mevent_cmd_ish * cmdBuffer; + struct mevent_client_cmd * cmdBuffer; void * buffer; struct mevent_srv_sub manager; u32 unk_4C; }; -void mevent_srv_ish_do_init(u32 arg); -u32 mevent_srv_ish_do_exec(u16 * a0); -void mevent_srv_ish_inc_flag(void); -void * mevent_srv_ish_get_buffer(void); -void mevent_srv_ish_set_param(u32 a0); +void mevent_client_do_init(u32 arg); +u32 mevent_client_do_exec(u16 * a0); +void mevent_client_inc_flag(void); +void * mevent_client_get_buffer(void); +void mevent_client_set_param(u32 a0); #endif //GUARD_MEVENT_SERVER_ISH_H diff --git a/ld_script.txt b/ld_script.txt index c5ffc06fe..af70cafb7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,7 +61,7 @@ SECTIONS { src/mevent2.o(.text); src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); - src/mevent_server_ish.o(.text); + src/mevent_client.o(.text); src/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); @@ -417,7 +417,7 @@ SECTIONS { src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); - src/mevent_server_ish.o(.rodata); + src/mevent_client.o(.rodata); src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server_ish.c b/src/mevent_client.c similarity index 66% rename from src/mevent_server_ish.c rename to src/mevent_client.c index 48f72eaad..cdf976a41 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_client.c @@ -6,55 +6,55 @@ #include "battle_tower.h" #include "mevent.h" #include "mystery_event_script.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" -EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; +EWRAM_DATA struct mevent_client * s_mevent_client_ptr = NULL; -static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); -static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); -static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); +static void mevent_client_init(struct mevent_client *, u32, u32); +static u32 mevent_client_exec(struct mevent_client *); +static void mevent_client_free_resources(struct mevent_client *); -extern const struct mevent_cmd_ish gUnknown_082F2598[]; +extern const struct mevent_client_cmd gUnknown_082F2598[]; -void mevent_srv_ish_do_init(u32 arg) +void mevent_client_do_init(u32 arg) { - s_mevent_srv_ish_ptr = AllocZeroed(sizeof(struct mevent_srv_ish)); - mevent_srv_ish_init(s_mevent_srv_ish_ptr, 1, 0); - s_mevent_srv_ish_ptr->unk_4C = arg; + s_mevent_client_ptr = AllocZeroed(sizeof(struct mevent_client)); + mevent_client_init(s_mevent_client_ptr, 1, 0); + s_mevent_client_ptr->unk_4C = arg; } -u32 mevent_srv_ish_do_exec(u16 * a0) +u32 mevent_client_do_exec(u16 * a0) { u32 result; - if (s_mevent_srv_ish_ptr == NULL) + if (s_mevent_client_ptr == NULL) return 6; - result = mevent_srv_ish_exec(s_mevent_srv_ish_ptr); + result = mevent_client_exec(s_mevent_client_ptr); if (result == 6) { - *a0 = s_mevent_srv_ish_ptr->param; - mevent_srv_ish_free_resources(s_mevent_srv_ish_ptr); - Free(s_mevent_srv_ish_ptr); - s_mevent_srv_ish_ptr = NULL; + *a0 = s_mevent_client_ptr->param; + mevent_client_free_resources(s_mevent_client_ptr); + Free(s_mevent_client_ptr); + s_mevent_client_ptr = NULL; } return result; } -void mevent_srv_ish_inc_flag(void) +void mevent_client_inc_flag(void) { - s_mevent_srv_ish_ptr->flag++; + s_mevent_client_ptr->flag++; } -void * mevent_srv_ish_get_buffer(void) +void * mevent_client_get_buffer(void) { - return s_mevent_srv_ish_ptr->buffer; + return s_mevent_client_ptr->buffer; } -void mevent_srv_ish_set_param(u32 a0) +void mevent_client_set_param(u32 a0) { - s_mevent_srv_ish_ptr->param = a0; + s_mevent_client_ptr->param = a0; } -static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u32 recvPlayerNo) +static void mevent_client_init(struct mevent_client * svr, u32 sendPlayerNo, u32 recvPlayerNo) { svr->unk_00 = 0; svr->mainseqno = 0; @@ -66,7 +66,7 @@ static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); } -static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) +static void mevent_client_free_resources(struct mevent_client * svr) { Free(svr->sendBuffer); Free(svr->recvBuffer); @@ -74,20 +74,20 @@ static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) Free(svr->buffer); } -static void mevent_srv_ish_jmp_buffer(struct mevent_srv_ish * svr) +static void mevent_client_jmp_buffer(struct mevent_client * svr) { memcpy(svr->cmdBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); svr->cmdidx = 0; } -static void mevent_srv_ish_send_word(struct mevent_srv_ish * svr, u32 ident, u32 word) +static void mevent_client_send_word(struct mevent_client * svr, u32 ident, u32 word) { CpuFill32(0, svr->sendBuffer, ME_SEND_BUF_SIZE); *(u32 *)svr->sendBuffer = word; mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); } -static u32 ish_mainseq_0(struct mevent_srv_ish * svr) +static u32 ish_mainseq_0(struct mevent_client * svr) { // init memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); @@ -97,14 +97,14 @@ static u32 ish_mainseq_0(struct mevent_srv_ish * svr) return 0; } -static u32 ish_mainseq_1(struct mevent_srv_ish * svr) +static u32 ish_mainseq_1(struct mevent_client * svr) { // done return 6; } -static u32 ish_mainseq_2(struct mevent_srv_ish * svr) +static u32 ish_mainseq_2(struct mevent_client * svr) { // do recv if (mevent_srv_sub_recv(&svr->manager)) @@ -115,7 +115,7 @@ static u32 ish_mainseq_2(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_3(struct mevent_srv_ish * svr) +static u32 ish_mainseq_3(struct mevent_client * svr) { // do send if (mevent_srv_sub_send(&svr->manager)) @@ -126,10 +126,10 @@ static u32 ish_mainseq_3(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_4(struct mevent_srv_ish * svr) +static u32 ish_mainseq_4(struct mevent_client * svr) { // process command - struct mevent_cmd_ish * cmd = &svr->cmdBuffer[svr->cmdidx]; + struct mevent_client_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; ++svr->cmdidx; switch (cmd->instr) { @@ -155,20 +155,20 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) svr->flag = 0; break; case 19: - mevent_srv_ish_send_word(svr, 0x12, GetGameStat(cmd->parameter)); + mevent_client_send_word(svr, 0x12, GetGameStat(cmd->parameter)); svr->mainseqno = 3; svr->flag = 0; break; case 6: if (svr->param == 0) - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 7: if (svr->param == 1) - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 4: - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 5: memcpy(svr->buffer, svr->recvBuffer, 0x40); @@ -194,7 +194,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) mevent_srv_sub_init_send(&svr->manager, 0x11, svr->sendBuffer, sizeof(struct MEventStruct_Unk1442CC)); break; case 14: - mevent_srv_ish_send_word(svr, 0x13, svr->param); + mevent_client_send_word(svr, 0x13, svr->param); break; case 10: sub_801B21C(svr->recvBuffer); @@ -203,10 +203,10 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) if (!sub_801B1A4(svr->recvBuffer)) { sub_801B078(svr->recvBuffer); - mevent_srv_ish_send_word(svr, 0x13, 0); + mevent_client_send_word(svr, 0x13, 0); } else - mevent_srv_ish_send_word(svr, 0x13, 1); + mevent_client_send_word(svr, 0x13, 1); break; case 15: svr->mainseqno = 6; @@ -232,7 +232,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_5(struct mevent_srv_ish * svr) +static u32 ish_mainseq_5(struct mevent_client * svr) { // wait flag if (svr->flag) @@ -243,7 +243,7 @@ static u32 ish_mainseq_5(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_6(struct mevent_srv_ish * svr) +static u32 ish_mainseq_6(struct mevent_client * svr) { // ??? switch (svr->flag) @@ -263,7 +263,7 @@ static u32 ish_mainseq_6(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_7(struct mevent_srv_ish * svr) +static u32 ish_mainseq_7(struct mevent_client * svr) { // exec arbitrary code u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; @@ -275,9 +275,9 @@ static u32 ish_mainseq_7(struct mevent_srv_ish * svr) return 1; } -static u32 mevent_srv_ish_exec(struct mevent_srv_ish * svr) +static u32 mevent_client_exec(struct mevent_client * svr) { - u32 (*funcs[])(struct mevent_srv_ish *) = { + u32 (*funcs[])(struct mevent_client *) = { ish_mainseq_0, ish_mainseq_1, ish_mainseq_2, diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c index 29b37119e..41a5ddd51 100644 --- a/src/mevent_scripts.c +++ b/src/mevent_scripts.c @@ -1,38 +1,38 @@ #include "global.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" #include "mevent_server.h" const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); -const struct mevent_cmd_ish gUnknown_082F2598[] = { +const struct mevent_client_cmd gUnknown_082F2598[] = { {.instr = 2, .parameter = 16}, {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25A8[] = { +const struct mevent_client_cmd gUnknown_082F25A8[] = { {.instr = 8, .parameter = 0}, {.instr = 3, .parameter = 0}, {.instr = 2, .parameter = 16}, {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25C8[] = { +const struct mevent_client_cmd gUnknown_082F25C8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 10} }; -const struct mevent_cmd_ish gUnknown_082F25D8[] = { +const struct mevent_client_cmd gUnknown_082F25D8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 11} }; -const struct mevent_cmd_ish gUnknown_082F25E8[] = { +const struct mevent_client_cmd gUnknown_082F25E8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25F8[] = { +const struct mevent_client_cmd gUnknown_082F25F8[] = { {.instr = 2, .parameter = 22}, {.instr = 10, .parameter = 0}, {.instr = 2, .parameter = 25}, @@ -41,7 +41,7 @@ const struct mevent_cmd_ish gUnknown_082F25F8[] = { {.instr = 1, .parameter = 2} }; -const struct mevent_cmd_ish gUnknown_082F2628[] = { +const struct mevent_client_cmd gUnknown_082F2628[] = { {.instr = 2, .parameter = 23}, {.instr = 9, .parameter = 0}, {.instr = 3, .parameter = 0}, @@ -49,17 +49,17 @@ const struct mevent_cmd_ish gUnknown_082F2628[] = { {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F2650[] = { +const struct mevent_client_cmd gUnknown_082F2650[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 7} }; -const struct mevent_cmd_ish gUnknown_082F2660[] = { +const struct mevent_client_cmd gUnknown_082F2660[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 3} }; -const struct mevent_cmd_ish gUnknown_082F2670[] = { +const struct mevent_client_cmd gUnknown_082F2670[] = { {.instr = 13, .parameter = 0}, {.instr = 14, .parameter = 0}, {.instr = 3, .parameter = 0}, @@ -67,17 +67,17 @@ const struct mevent_cmd_ish gUnknown_082F2670[] = { {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F2698[] = { +const struct mevent_client_cmd gUnknown_082F2698[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 9} }; -const struct mevent_cmd_ish gUnknown_082F26A8[] = { +const struct mevent_client_cmd gUnknown_082F26A8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 5} }; -const struct mevent_cmd_ish gUnknown_082F26B8[] = { +const struct mevent_client_cmd gUnknown_082F26B8[] = { {.instr = 2, .parameter = 21}, {.instr = 12, .parameter = 0}, {.instr = 20, .parameter = 0}, diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c935e9b25..ab3df9020 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -25,7 +25,7 @@ #include "mevent_801BAAC.h" #include "save.h" #include "link.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" #include "event_data.h" #include "link_rfu.h" #include "mevent_news.h" @@ -1269,7 +1269,7 @@ void task00_mystery_gift(u8 taskId) { ClearScreenInBg0(TRUE); data->state = 7; - mevent_srv_ish_do_init(data->IsCardOrNews); + mevent_client_do_init(data->IsCardOrNews); } else if (gSpecialVar_Result == 5) { @@ -1282,7 +1282,7 @@ void task00_mystery_gift(u8 taskId) data->state = 8; break; case 8: - switch (mevent_srv_ish_do_exec(&data->curPromptWindowId)) + switch (mevent_client_do_exec(&data->curPromptWindowId)) { case 6: task_add_05_task_del_08FA224_when_no_RfuFunc(); @@ -1290,8 +1290,8 @@ void task00_mystery_gift(u8 taskId) data->state = 13; break; case 5: - memcpy(data->buffer, mevent_srv_ish_get_buffer(), 0x40); - mevent_srv_ish_inc_flag(); + memcpy(data->buffer, mevent_client_get_buffer(), 0x40); + mevent_client_inc_flag(); break; case 3: data->state = 10; @@ -1306,29 +1306,29 @@ void task00_mystery_gift(u8 taskId) } break; case 9: - switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_srv_ish_get_buffer())) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer())) { case 0: - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } break; case 10: - if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, mevent_srv_ish_get_buffer())) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, mevent_client_get_buffer())) { - mevent_srv_ish_inc_flag(); + mevent_client_inc_flag(); data->state = 7; } break; @@ -1342,19 +1342,19 @@ void task00_mystery_gift(u8 taskId) } else { - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; } break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } @@ -1363,18 +1363,18 @@ void task00_mystery_gift(u8 taskId) switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift)) { case 0: - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 06e3180a0..25cf13069 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -13,7 +13,7 @@ .include "src/mevent2.o" .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" - .include "src/mevent_server_ish.o" + .include "src/mevent_client.o" @ union_room_chat .align 2 From 33ee31b2e099a3e2cefa2542f710d51087e09a83 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 14:48:27 -0400 Subject: [PATCH 26/42] remove last remaining trace of "ish" --- src/mevent_client.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mevent_client.c b/src/mevent_client.c index cdf976a41..ec8908af2 100644 --- a/src/mevent_client.c +++ b/src/mevent_client.c @@ -87,7 +87,7 @@ static void mevent_client_send_word(struct mevent_client * svr, u32 ident, u32 w mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); } -static u32 ish_mainseq_0(struct mevent_client * svr) +static u32 mainseq_0(struct mevent_client * svr) { // init memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); @@ -97,14 +97,14 @@ static u32 ish_mainseq_0(struct mevent_client * svr) return 0; } -static u32 ish_mainseq_1(struct mevent_client * svr) +static u32 mainseq_1(struct mevent_client * svr) { // done return 6; } -static u32 ish_mainseq_2(struct mevent_client * svr) +static u32 mainseq_2(struct mevent_client * svr) { // do recv if (mevent_srv_sub_recv(&svr->manager)) @@ -115,7 +115,7 @@ static u32 ish_mainseq_2(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_3(struct mevent_client * svr) +static u32 mainseq_3(struct mevent_client * svr) { // do send if (mevent_srv_sub_send(&svr->manager)) @@ -126,7 +126,7 @@ static u32 ish_mainseq_3(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_4(struct mevent_client * svr) +static u32 mainseq_4(struct mevent_client * svr) { // process command struct mevent_client_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; @@ -232,7 +232,7 @@ static u32 ish_mainseq_4(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_5(struct mevent_client * svr) +static u32 mainseq_5(struct mevent_client * svr) { // wait flag if (svr->flag) @@ -243,7 +243,7 @@ static u32 ish_mainseq_5(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_6(struct mevent_client * svr) +static u32 mainseq_6(struct mevent_client * svr) { // ??? switch (svr->flag) @@ -263,7 +263,7 @@ static u32 ish_mainseq_6(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_7(struct mevent_client * svr) +static u32 mainseq_7(struct mevent_client * svr) { // exec arbitrary code u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; @@ -278,14 +278,14 @@ static u32 ish_mainseq_7(struct mevent_client * svr) static u32 mevent_client_exec(struct mevent_client * svr) { u32 (*funcs[])(struct mevent_client *) = { - ish_mainseq_0, - ish_mainseq_1, - ish_mainseq_2, - ish_mainseq_3, - ish_mainseq_4, - ish_mainseq_5, - ish_mainseq_6, - ish_mainseq_7 + mainseq_0, + mainseq_1, + mainseq_2, + mainseq_3, + mainseq_4, + mainseq_5, + mainseq_6, + mainseq_7 }; return funcs[svr->mainseqno](svr); } From 4fadbaf16153c0160f6ad38dc0053e7ff6db7472 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 3 Apr 2019 09:55:17 -0400 Subject: [PATCH 27/42] Minor fixes gotoram --> returnram cmdCF/execram --> gotoram fix indentation in sym_ewram.txt fix mevent_client.h guard name --- asm/macros/event.inc | 4 ++-- data/mystery_event_msg.s | 2 +- data/script_cmd_table.inc | 4 ++-- data/scripts/cable_club.inc | 2 +- include/link_rfu.h | 2 +- include/mevent_client.h | 6 +++--- src/link_rfu.c | 2 +- src/mevent_server_helpers.c | 8 ++++---- src/overworld.c | 2 +- src/scrcmd.c | 4 ++-- sym_ewram.txt | 14 +++++++------- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 8b3466fe7..e00bdb600 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -77,7 +77,7 @@ .endm @ Executes a script stored in a default RAM location. - .macro gotoram + .macro returnram .byte 0x0c .endm @@ -1440,7 +1440,7 @@ .endm @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0. - .macro execram + .macro gotoram .byte 0xcf .endm diff --git a/data/mystery_event_msg.s b/data/mystery_event_msg.s index 24a075181..dd1f8e681 100644 --- a/data/mystery_event_msg.s +++ b/data/mystery_event_msg.s @@ -36,7 +36,7 @@ MysteryEventScript_SurfPichu:: @ 8674D3D setvaddress MysteryEventScript_SurfPichu checkflag FLAG_MYSTERY_EVENT_DONE vgoto_if 0, SurfPichu_GiveIfPossible - gotoram + returnram SurfPichu_GiveIfPossible: @ 8674D4C specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 39864b2a8..e9a14437a 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -12,7 +12,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_callstd .4byte ScrCmd_gotostd_if .4byte ScrCmd_callstd_if - .4byte ScrCmd_gotoram + .4byte ScrCmd_returnram .4byte ScrCmd_killscript .4byte ScrCmd_setmysteryeventstatus .4byte ScrCmd_loadword @@ -207,7 +207,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_nop1 .4byte ScrCmd_setmonobedient .4byte ScrCmd_checkmonobedience - .4byte ScrCmd_cmdCF + .4byte ScrCmd_gotoram .4byte ScrCmd_nop1 .4byte ScrCmd_warpD1 .4byte ScrCmd_setmonmetlocation diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index e0b289899..c755493dc 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -60,7 +60,7 @@ VerdanturfTown_PokemonCenter_2F_EventScript_276B03:: @ 8276B03 end OldaleTown_PokemonCenter_2F_EventScript_276B19:: @ 8276B19 - execram + gotoram OldaleTown_PokemonCenter_2F_EventScript_276B1A:: @ 8276B1A msgbox gUnknown_08273178, MSGBOX_NPC diff --git a/include/link_rfu.h b/include/link_rfu.h index b8ba1a927..edfd0ed20 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -284,7 +284,7 @@ bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void sub_8011BA4(void); -void sub_8010198(void); +void LinkRfu_FatalError(void); bool32 sub_8011A9C(void); void sub_80104B0(void); void sub_8011A50(void); diff --git a/include/mevent_client.h b/include/mevent_client.h index 58893794e..c32d14d7a 100644 --- a/include/mevent_client.h +++ b/include/mevent_client.h @@ -1,5 +1,5 @@ -#ifndef GUARD_MEVENT_SERVER_ISH_H -#define GUARD_MEVENT_SERVER_ISH_H +#ifndef GUARD_MEVENT_CLIENT_H +#define GUARD_MEVENT_CLIENT_H #include "mevent_server_helpers.h" @@ -30,4 +30,4 @@ void mevent_client_inc_flag(void); void * mevent_client_get_buffer(void); void mevent_client_set_param(u32 a0); -#endif //GUARD_MEVENT_SERVER_ISH_H +#endif //GUARD_MEVENT_CLIENT_H diff --git a/src/link_rfu.c b/src/link_rfu.c index 1e4c9c7e6..7c55df783 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3674,7 +3674,7 @@ void sub_8010168(void) gUnknown_03005000.unk_00 = sub_8010148; } -void sub_8010198(void) +void LinkRfu_FatalError(void) { sub_800D630(); gUnknown_03005000.unk_ce4 = 1; diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c index af14b514c..9d47ba745 100644 --- a/src/mevent_server_helpers.c +++ b/src/mevent_server_helpers.c @@ -96,12 +96,12 @@ static bool32 mevent_receive_func(struct mevent_srv_sub * svr) svr->recvCRC = header.crc; if (svr->recvSize > ME_SEND_BUF_SIZE) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else if (svr->recvIdent != header.ident) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else @@ -133,7 +133,7 @@ static bool32 mevent_receive_func(struct mevent_srv_sub * svr) case 2: if (CalcCRC16WithTable(svr->recvBfr, svr->recvSize) != svr->recvCRC) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else @@ -192,7 +192,7 @@ static bool32 mevent_send_func(struct mevent_srv_sub * svr) if (IsLinkTaskFinished()) { if (CalcCRC16WithTable(svr->sendBfr, svr->sendSize) != svr->sendCRC) - sub_8010198(); + LinkRfu_FatalError(); else ++svr->seqno; } diff --git a/src/overworld.c b/src/overworld.c index ae6efefd7..9ed147c0a 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2287,7 +2287,7 @@ static void SetKeyInterceptCallback(u16 (*func)(u32)) static void CheckRfuKeepAliveTimer(void) { if (gWirelessCommType != 0 && ++sRfuKeepAliveTimer > 60) - sub_8010198(); + LinkRfu_FatalError(); } static void ResetAllTradingStates(void) diff --git a/src/scrcmd.c b/src/scrcmd.c index 0b1006cef..125a57c01 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -281,7 +281,7 @@ bool8 ScrCmd_callstd_if(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_gotoram(struct ScriptContext *ctx) +bool8 ScrCmd_returnram(struct ScriptContext *ctx) { ScriptJump(ctx, gUnknown_020375C0); return FALSE; @@ -2215,7 +2215,7 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) +bool8 ScrCmd_gotoram(struct ScriptContext *ctx) { const u8* v1 = GetSavedRamScriptIfValid(); diff --git a/sym_ewram.txt b/sym_ewram.txt index 25cf13069..ff27b4cfb 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -7,16 +7,16 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" - .include "src/mystery_gift.o" - .include "src/union_room_player_avatar.o" - .include "src/union_room_battle.o" + .include "src/mystery_gift.o" + .include "src/union_room_player_avatar.o" + .include "src/union_room_battle.o" .include "src/mevent2.o" .include "src/mevent_801BAAC.o" - .include "src/mevent_server.o" - .include "src/mevent_client.o" + .include "src/mevent_server.o" + .include "src/mevent_client.o" - @ union_room_chat - .align 2 + @ union_room_chat + .align 2 gUnknown_02022C84: @ 2022C84 .space 0x4 From 48d27c035ae194419317884f64ddf4beec001e7c Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 15:15:08 -0700 Subject: [PATCH 28/42] Remove pokemon_3.h --- include/pokemon_3.h | 10 ---------- src/main_menu.c | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 include/pokemon_3.h diff --git a/include/pokemon_3.h b/include/pokemon_3.h deleted file mode 100644 index 263839b19..000000000 --- a/include/pokemon_3.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GUARD_POKEMON_3_H -#define GUARD_POKEMON_3_H - -u16 sub_806EFF0(u16); -const u8* GetTrainerClassNameFromId(u16 trainerId); -const u8* GetTrainerNameFromId(u16 trainerId); -void PlayMapChosenOrBattleBGM(u16 song); -u8 GetTrainerEncounterMusicId(u16 trainerOpponentId); - -#endif // GUARD_POKEMON_3_H diff --git a/src/main_menu.c b/src/main_menu.c index 8c9612c24..504c1bd33 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -23,7 +23,7 @@ #include "palette.h" #include "pokeball.h" #include "pokedex.h" -#include "pokemon_3.h" +#include "pokemon.h" #include "random.h" #include "rtc.h" #include "save.h" From 91a94a0ca1f2df00a776c85b40d76c193977d13a Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 21:13:26 -0700 Subject: [PATCH 29/42] Try to get closer to matching. --- include/menu_specialized.h | 6 +- src/battle_script_commands.c | 8 +- src/menu_specialized.c | 160 ++++++++++++++++++++--------------- 3 files changed, 100 insertions(+), 74 deletions(-) diff --git a/include/menu_specialized.h b/include/menu_specialized.h index fb23e7ce6..405d78830 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -32,8 +32,8 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1EC0(void); void sub_81D1D04(u8 a0); -void DrawLevelUpWindowPg1(u16 arg0, u16* statStoreLocation1, u16* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); @@ -47,7 +47,7 @@ bool16 MoveRelearnerRunTextPrinters(void); void MoveRelearnerCreateYesNoMenu(void); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); void InitMoveRelearnerWindows(bool8 useContextWindow); -void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation); +void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0a0c34ad2..d1d8d87ac 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6295,16 +6295,16 @@ static void sub_804F100(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg1(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg1(0xD, (u16*) gBattleResources->statsBeforeLvlUp,(u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F144(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg2(0xD, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg2(0xD, (u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F17C(void) diff --git a/src/menu_specialized.c b/src/menu_specialized.c index c8c46fbc1..58ed6e982 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1643,47 +1643,51 @@ static void sub_81D35E8(struct Sprite *sprite) #ifdef NONMATCHING -void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) { - s32 i; + u16 i; s16 array[6]; u8 *text; - u8 *text2; - s16 *ptr; - u8 something[14]; + u8 text2; + s16 *statVal; s32 var; - u8 var2; + u8 padding; s32 var3; + u8 color[11]; + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg3)); + + array[0] = statStoreLocation2[STAT_HP] - statStoreLocation1[STAT_HP]; + array[1] = statStoreLocation2[STAT_ATK] - statStoreLocation1[STAT_ATK]; + array[2] = statStoreLocation2[STAT_DEF] - statStoreLocation1[STAT_DEF]; + array[3] = statStoreLocation2[STAT_SPATK] - statStoreLocation1[STAT_SPATK]; + array[4] = statStoreLocation2[STAT_SPDEF] - statStoreLocation1[STAT_SPDEF]; + array[5] = statStoreLocation2[STAT_SPEED] - statStoreLocation1[STAT_SPEED]; + + color[0] = arg3; + color[1] = arg4; + color[2] = arg5; - - - - FillWindowPixelBuffer(arg0, arg3 * 16 | arg3); - - - array[0] = statStoreLocation2[0] - statStoreLocation1[0]; - array[1] = statStoreLocation2[1] - statStoreLocation1[1]; - array[2] = statStoreLocation2[2] - statStoreLocation1[2]; - array[3] = statStoreLocation2[4] - statStoreLocation1[4]; - array[4] = statStoreLocation2[5] - statStoreLocation1[5]; - array[5] = statStoreLocation2[3] - statStoreLocation1[3]; - - - for(i = 0; i < 6; i++) + for(i = 0; i <= 5; i++) { - AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg3, TEXT_SPEED_FF, gUnknown_08625B54[i]); - ptr = &array[i]; - text = (u8 *) gText_Dash; - - if(*ptr >= 0) - { - text = (u8 *) gText_UnkCtrlF904; - } - - StringCopy(text2, text); - AddTextPrinterParameterized3(arg0, 1, 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); - var3 = *ptr; + AddTextPrinterParameterized3(arg0, + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); + statVal = &array[i]; + text = array[i] >= 0 ? (u8 *) gText_UnkCtrlF904 : (u8 *) gText_Dash;//Plus sign for stat gain, dash for none maybe + StringCopy(&text2, text); + AddTextPrinterParameterized3(arg0, + 1, + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); + var3 = *statVal; var = var3; if(var3 < 0) @@ -1691,11 +1695,11 @@ void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocati var = -var3; } - var2 = 12; + padding = 12; //amount of padding if(var <= 9) { - var2 = 18; + padding = 18; //more padding for single digit numbers } if(var3 < 0) @@ -1703,8 +1707,14 @@ void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocati var3 = -var3; } - ConvertIntToDecimalStringN(text2, var3, 0, 2); - AddTextPrinterParameterized3(arg0, 1, var2 + 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + ConvertIntToDecimalStringN(&text2, var3, STR_CONV_MODE_LEFT_ALIGN, 2); + AddTextPrinterParameterized3(arg0, + 1, + padding + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); } } #else @@ -1872,43 +1882,59 @@ _081D373A:\n\ #endif // NONMATCHING #ifdef NONMATCHING -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) { s32 i; - s32 var; - s32 var2; + s16 *var; + s32 numDigits; u8 text; s16 array[6]; - u8 *something; - u8 some; - FillWindowPixelBuffer(arg0, arg2 * 16 | arg2); - array[0] = statStoreLocation1[0]; - array[1] = statStoreLocation1[1]; - array[2] = statStoreLocation1[2]; - array[3] = statStoreLocation1[4]; - array[4] = statStoreLocation1[5]; - array[5] = statStoreLocation1[3]; + u8 color[11]; + + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg2)); + + array[0] = statStoreLocation1[STAT_HP]; + array[1] = statStoreLocation1[STAT_ATK]; + array[2] = statStoreLocation1[STAT_DEF]; + array[3] = statStoreLocation1[STAT_SPATK]; + array[4] = statStoreLocation1[STAT_SPDEF]; + array[5] = statStoreLocation1[STAT_SPEED]; + + color[0] = arg2; + color[1] = arg3; + color[2] = arg4; + for(i = 0; i <= 5; i++) { - var = array[i]; - var2 = 3; - if(var <= 99) + numDigits = 3; //3 digit stat + if(array[i] <= 99) { - var2 = 1; - if(var > 9) + numDigits = 1; //1 digit stat + if(array[i] > 9) { - var2 = 2; + numDigits = 2; //2 digit stat } } - something = ConvertIntToDecimalStringN(&text, array[i], 0, var2); - some = (((4 - *something) * 2) + *something) * 2; - AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg2, TEXT_SPEED_FF, gUnknown_08625B54[i]); - AddTextPrinterParameterized3(arg0, 1, some + 56, 15 * i, &arg2, TEXT_SPEED_FF, &text); + ConvertIntToDecimalStringN(&text, array[i], STR_CONV_MODE_LEFT_ALIGN, numDigits); + AddTextPrinterParameterized3(arg0, + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); + AddTextPrinterParameterized3(arg0, + 1, + 6 * (4 - numDigits) + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text); } } #else NAKED -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) { asm(".syntax unified\n\ push {r4-r7,lr}\n\ @@ -2043,14 +2069,14 @@ _081D3808:\n\ } #endif // NONMATCHING -void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation) +void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation) { - statStoreLocation[0] = GetMonData(mon, MON_DATA_MAX_HP); - statStoreLocation[1] = GetMonData(mon, MON_DATA_ATK); - statStoreLocation[2] = GetMonData(mon, MON_DATA_DEF); - statStoreLocation[3] = GetMonData(mon, MON_DATA_SPEED); - statStoreLocation[4] = GetMonData(mon, MON_DATA_SPATK); - statStoreLocation[5] = GetMonData(mon, MON_DATA_SPDEF); + statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[STAT_ATK] = GetMonData(mon, MON_DATA_ATK); + statStoreLocation[STAT_DEF] = GetMonData(mon, MON_DATA_DEF); + statStoreLocation[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED); + statStoreLocation[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK); + statStoreLocation[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF); } From 64da3d051ecf8617c081f64a49f62c7e79354585 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 21:15:45 -0700 Subject: [PATCH 30/42] Fix formatting. --- src/menu_specialized.c | 108 ++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 65 deletions(-) diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 58ed6e982..cbdef3d39 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1653,10 +1653,10 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat s32 var; u8 padding; s32 var3; - u8 color[11]; + u8 color[11]; FillWindowPixelBuffer(arg0, PIXEL_FILL(arg3)); - + array[0] = statStoreLocation2[STAT_HP] - statStoreLocation1[STAT_HP]; array[1] = statStoreLocation2[STAT_ATK] - statStoreLocation1[STAT_ATK]; array[2] = statStoreLocation2[STAT_DEF] - statStoreLocation1[STAT_DEF]; @@ -1665,28 +1665,28 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat array[5] = statStoreLocation2[STAT_SPEED] - statStoreLocation1[STAT_SPEED]; color[0] = arg3; - color[1] = arg4; - color[2] = arg5; + color[1] = arg4; + color[2] = arg5; for(i = 0; i <= 5; i++) { AddTextPrinterParameterized3(arg0, - 1, - 0, - 15 * i, - color, - TEXT_SPEED_FF, - gUnknown_08625B54[i]); + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); statVal = &array[i]; text = array[i] >= 0 ? (u8 *) gText_UnkCtrlF904 : (u8 *) gText_Dash;//Plus sign for stat gain, dash for none maybe StringCopy(&text2, text); AddTextPrinterParameterized3(arg0, - 1, - 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text2); + 1, + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); var3 = *statVal; var = var3; @@ -1709,12 +1709,12 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat ConvertIntToDecimalStringN(&text2, var3, STR_CONV_MODE_LEFT_ALIGN, 2); AddTextPrinterParameterized3(arg0, - 1, - padding + 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text2); + 1, + padding + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); } } #else @@ -1889,21 +1889,21 @@ void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u s32 numDigits; u8 text; s16 array[6]; - u8 color[11]; - + u8 color[11]; + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg2)); - + array[0] = statStoreLocation1[STAT_HP]; array[1] = statStoreLocation1[STAT_ATK]; array[2] = statStoreLocation1[STAT_DEF]; array[3] = statStoreLocation1[STAT_SPATK]; array[4] = statStoreLocation1[STAT_SPDEF]; array[5] = statStoreLocation1[STAT_SPEED]; - - color[0] = arg2; - color[1] = arg3; - color[2] = arg4; - + + color[0] = arg2; + color[1] = arg3; + color[2] = arg4; + for(i = 0; i <= 5; i++) { numDigits = 3; //3 digit stat @@ -1917,19 +1917,19 @@ void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u } ConvertIntToDecimalStringN(&text, array[i], STR_CONV_MODE_LEFT_ALIGN, numDigits); AddTextPrinterParameterized3(arg0, - 1, - 0, - 15 * i, - color, - TEXT_SPEED_FF, - gUnknown_08625B54[i]); + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); AddTextPrinterParameterized3(arg0, - 1, - 6 * (4 - numDigits) + 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text); + 1, + 6 * (4 - numDigits) + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text); } } #else @@ -2071,32 +2071,10 @@ _081D3808:\n\ void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation) { - statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); statStoreLocation[STAT_ATK] = GetMonData(mon, MON_DATA_ATK); statStoreLocation[STAT_DEF] = GetMonData(mon, MON_DATA_DEF); statStoreLocation[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED); statStoreLocation[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK); statStoreLocation[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF); } - - - - - - - - - - - - - - - - - - - - - - From a47abb3949f8d1050379f51005368a5093c15113 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 3 Apr 2019 21:46:59 -0400 Subject: [PATCH 31/42] union_room_chat data, 1 --- data/union_room_chat.s | 169 ----------------------------- include/global.h | 13 +-- include/graphics.h | 1 + include/strings.h | 16 +++ src/union_room_chat.c | 240 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 238 insertions(+), 201 deletions(-) diff --git a/data/union_room_chat.s b/data/union_room_chat.s index 143678cd4..4f6b976b5 100755 --- a/data/union_room_chat.s +++ b/data/union_room_chat.s @@ -3,175 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F2AA8:: @ 82F2AA8 - .byte 0x00, 0x16, 0x17, 0x68, 0x19, 0x1a, 0x1b, 0x1c - .byte 0x1d, 0x1e, 0x00, 0x20, 0x21, 0x22, 0x23, 0x24 - .byte 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02 - .byte 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 - .byte 0x13, 0x14, 0x2a, 0x2b, 0x2c, 0x2d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x36, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x53, 0x54, 0x55, 0x56, 0x00 - .byte 0x00, 0x00, 0x6f, 0x5b, 0x5c, 0x5d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x84, 0x85, 0x86, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 - .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf - .byte 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 - .byte 0xb8, 0xb9, 0xba, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9 - .byte 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1 - .byte 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9 - .byte 0xea, 0xeb, 0xec, 0xed, 0xee, 0xbb, 0xbc, 0xbd - .byte 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5 - .byte 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd - .byte 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xef - .byte 0xf0, 0xf4, 0xf5, 0xf6, 0xf1, 0xf2, 0xf3, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2BA8:: @ 82F2BA8 - .4byte gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F - .4byte gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B - .4byte gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA - - .align 2 -gUnknown_082F2C20:: @ 82F2C20 - .incbin "graphics/interface/unk_palette1.gbapal" - - .align 2 -gUnknown_082F2C40:: @ 82F2C40 - .incbin "graphics/interface/unk_palette2.gbapal" - - .align 2 -gUnknown_082F2C60:: @ 82F2C60 struct BgTemplate - .4byte 0x00000070, 0x000011fd, 0x0000217a, 0x000070f7 - - .align 2 -gUnknown_082F2C70:: @ 82F2C70 - window_template 0x03, 0x08, 0x01, 0x15, 0x13, 0x0f, 0x0001 - window_template 0x01, 0x09, 0x12, 0x0f, 0x02, 0x0c, 0x007a - window_template 0x01, 0x00, 0x02, 0x06, 0x0f, 0x07, 0x0020 - window_template 0x00, 0x01, 0x02, 0x07, 0x09, 0x0e, 0x0013 - null_window_template - - .align 2 -gUnknown_082F2C98:: @ 82F2C98 - .4byte 0x00000000, sub_801F658 - .4byte 0x00000003, sub_801F6F8 - .4byte 0x00000004, sub_801F730 - .4byte 0x00000005, sub_801F768 - .4byte 0x00000001, sub_801F7D4 - .4byte 0x00000006, sub_801F7E0 - .4byte 0x00000007, sub_801F82C - .4byte 0x00000008, sub_801F870 - .4byte 0x00000009, sub_801F8DC - .4byte 0x0000000a, sub_801F984 - .4byte 0x0000000b, sub_801FA2C - .4byte 0x0000000c, sub_801FA68 - .4byte 0x00000002, sub_801FB44 - .4byte 0x0000000d, sub_801FB70 - .4byte 0x00000012, sub_801FBB4 - .4byte 0x00000013, sub_801FBF8 - .4byte 0x0000000e, sub_801FC4C - .4byte 0x0000000f, sub_801FC9C - .4byte 0x00000010, sub_801FCEC - .4byte 0x00000011, sub_801FD30 - .4byte 0x00000014, sub_801FD88 - - .align 2 -gUnknown_082F2D40:: @ 82F2D40 - .4byte gText_QuitChatting - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextWhere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextHere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_InputText - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_ExitingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_LeaderLeftEndingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00 - - .4byte gText_RegisteredTextChanged - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_AlreadySavedFile_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_SavingDontTurnOff_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_PlayerSavedGame_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00 - - .4byte gText_IfLeaderLeavesChatEnds - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .align 2 -gText_Ellipsis:: @ 82F2DC4 - .string "…$" - - .align 2 -gUnknown_082F2DC8:: @ 82F2DC8 - .4byte gText_Upper, 0x00000000 - .4byte gText_Lower, 0x00000000 - .4byte gText_Symbols, 0x00000000 - .4byte gText_Register2, 0x00000000 - .4byte gText_Exit2, 0x00000000 - - .align 2 -gUnknown_082F2DF0:: @ 82F2DF0 - .incbin "graphics/interface/unk_palette3.gbapal" - - .align 2 -gUnknown_082F2E10:: @ 82F2E10 - .incbin "graphics/interface/unk_cursor.4bpp.lz" - - .align 2 -gUnknown_082F3094:: @ 82F3094 - .incbin "graphics/interface/unk_dash.4bpp.lz" - - .align 2 -gUnknown_082F30B4:: @ 82F30B4 - .incbin "graphics/interface/unk_cursor_arrow.4bpp.lz" - - .align 2 -gUnknown_082F30E0:: @ 82F30E0 - .incbin "graphics/interface/unk_rbutton.4bpp.lz" - - .align 2 -gUnknown_082F3134:: @ 82F3134 - .4byte gUnknown_082F2E10 - .2byte 0x1000, 0x0000 - - .4byte gUnknown_082F30B4 - .2byte 0x0040, 0x0001 - - .4byte gUnknown_082F3094 - .2byte 0x0040, 0x0002 - - .4byte gUnknown_082F30E0 - .2byte 0x0080, 0x0003 - - .4byte gUnknown_08DD4CF8 - .2byte 0x0400, 0x0004 - .align 2 gUnknown_082F315C:: @ 82F315C struct SpritePalette .4byte gUnknown_082F2DF0 diff --git a/include/global.h b/include/global.h index 7b570d72e..864a7fa55 100644 --- a/include/global.h +++ b/include/global.h @@ -18,12 +18,13 @@ #if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER) #define _(x) x #define __(x) x -#define INCBIN_U8 {0} -#define INCBIN_U16 {0} -#define INCBIN_U32 {0} -#define INCBIN_S8 {0} -#define INCBIN_S16 {0} -#define INCBIN_S32 {0} +// CLion is an idiot +#define INCBIN_U8(x) {0} +#define INCBIN_U16(x) {0} +#define INCBIN_U32(x) {0} +#define INCBIN_S8(x) {0} +#define INCBIN_S16(x) {0} +#define INCBIN_S32(x) {0} #endif // IDE support #define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0])) diff --git a/include/graphics.h b/include/graphics.h index 2584e713e..30ca2af82 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4921,6 +4921,7 @@ extern const u16 gUnknown_08DD4BB0[]; extern const u16 gUnknown_08DD4BD0[]; extern const u32 gUnknown_08DD4BF0[]; extern const u32 gUnknown_08DD4C4C[]; +extern const u32 gUnknown_08DD4CF8[]; extern const u16 gLinkMiscMenu_Pal[]; extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Tilemap[]; diff --git a/include/strings.h b/include/strings.h index fc5724af3..cb54afb13 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2682,5 +2682,21 @@ extern const u8 gText_PeopleCommunicating[]; extern const u8 gText_CommStandbyAwaitingOtherPlayer[]; extern const u8 gText_RefusedBattle[]; extern const u8 gText_BattleWasRefused[]; +extern const u8 gText_QuitChatting[]; +extern const u8 gText_RegisterTextWhere[]; +extern const u8 gText_RegisterTextHere[]; +extern const u8 gText_InputText[]; +extern const u8 gText_ExitingChat[]; +extern const u8 gText_LeaderLeftEndingChat[]; +extern const u8 gText_RegisteredTextChanged[]; +extern const u8 gText_AlreadySavedFile_Unused[]; +extern const u8 gText_SavingDontTurnOff_Unused[]; +extern const u8 gText_PlayerSavedGame_Unused[]; +extern const u8 gText_IfLeaderLeavesChatEnds[]; +extern const u8 gText_Upper[]; +extern const u8 gText_Lower[]; +extern const u8 gText_Symbols[]; +extern const u8 gText_Register2[]; +extern const u8 gText_Exit2[]; #endif // GUARD_STRINGS_H diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 120252d36..1528cdd5f 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -190,22 +190,33 @@ static void sub_80209E0(void); static bool32 sub_8020A1C(void); static void sub_80207C0(s16); static void sub_8020818(s16); +static bool32 sub_801F658(u8 *state); +static bool32 sub_801F6F8(u8 *state); +static bool32 sub_801F730(u8 *state); +static bool32 sub_801F768(u8 *state); +static bool32 sub_801F7D4(u8 *state); +static bool32 sub_801F7E0(u8 *state); +static bool32 sub_801F82C(u8 *state); +static bool32 sub_801F870(u8 *state); +static bool32 sub_801F8DC(u8 *state); +static bool32 sub_801F984(u8 *state); +static bool32 sub_801FA2C(u8 *state); +static bool32 sub_801FA68(u8 *state); +static bool32 sub_801FB44(u8 *state); +static bool32 sub_801FB70(u8 *state); +static bool32 sub_801FBB4(u8 *state); +static bool32 sub_801FBF8(u8 *state); +static bool32 sub_801FC4C(u8 *state); +static bool32 sub_801FC9C(u8 *state); +static bool32 sub_801FCEC(u8 *state); +static bool32 sub_801FD30(u8 *state); +static bool32 sub_801FD88(u8 *state); extern struct UnionRoomChat *gUnknown_02022C84; extern struct UnionRoomChat2 *gUnknown_02022C88; extern struct UnionRoomChat3 *gUnknown_02022C8C; - -extern const u8 *const gUnknown_082F2BA8[][10]; -extern const u8 gUnknown_082F2AA8[]; -extern const struct BgTemplate gUnknown_082F2C60[4]; -extern const struct WindowTemplate gUnknown_082F2C70[]; -extern const struct Unk82F2C98 gUnknown_082F2C98[]; -extern const struct Unk82F2D40 gUnknown_082F2D40[]; -extern const u8 gText_Ellipsis[]; -extern const struct MenuAction gUnknown_082F2DC8[]; extern const u16 gUnknown_082F2C20[]; extern const u16 gUnknown_082F2C40[]; -extern const struct CompressedSpriteSheet gUnknown_082F3134[]; extern const struct SpritePalette gUnknown_082F315C; extern const struct SpriteTemplate gUnknown_082F319C; extern const u16 gUnknown_082F2DF0[]; @@ -214,6 +225,199 @@ extern const struct SpriteTemplate gUnknown_082F31D4; extern const struct SpriteTemplate gUnknown_082F322C; extern const struct SpriteTemplate gUnknown_082F3244; +void (*const gUnknown_082F2A7C[])(void) = + { + sub_801DFAC, + sub_801E030, + sub_801E120, + sub_801E240, + sub_801E764, + sub_801E838, + sub_801E460, + sub_801E5C4, + sub_801E668, + sub_801E978, + }; + +static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; + +static const u8 gUnknown_082F2AA8[] = { + CHAR_SPACE, 0x16, 0x17, 0x68, 0x19, 0x1A, 0x1B, 0x1C, + 0x1D, 0x1E, CHAR_SPACE, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02, + CHAR_SPACE, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, CHAR_SPACE, + 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, + 0x13, 0x14, 0x2A, 0x2B, 0x2C, 0x2D, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x35, 0x36, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x53, 0x54, 0x55, 0x56, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, 0x6F, 0x5B, 0x5C, 0x5D, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + 0x03, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x5A, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x84, 0x85, 0x86, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + 0xA0, CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, + CHAR_7, CHAR_8, CHAR_9, CHAR_EXCL_MARK, CHAR_QUESTION_MARK, CHAR_PERIOD, CHAR_HYPHEN, 0xAF, + CHAR_ELLIPSIS, CHAR_DBL_QUOT_LEFT, CHAR_DBL_QUOT_RIGHT, CHAR_SGL_QUOT_LEFT, CHAR_SGL_QUOT_RIGHT, CHAR_MALE, CHAR_FEMALE, CHAR_CURRENCY, + CHAR_COMMA, CHAR_MULT_SIGN, CHAR_SLASH, CHAR_a, CHAR_b, CHAR_c, CHAR_d, CHAR_e, + CHAR_f, CHAR_g, CHAR_h, CHAR_i, CHAR_j, CHAR_k, CHAR_l, CHAR_m, + CHAR_n, CHAR_o, CHAR_p, CHAR_q, CHAR_r, CHAR_s, CHAR_t, CHAR_u, + CHAR_v, CHAR_w, CHAR_x, CHAR_y, CHAR_z, CHAR_A, CHAR_B, CHAR_C, + CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_K, + CHAR_L, CHAR_M, CHAR_N, CHAR_O, CHAR_P, CHAR_Q, CHAR_R, CHAR_S, + CHAR_T, CHAR_U, CHAR_V, CHAR_W, CHAR_X, CHAR_Y, CHAR_Z, 0xEF, + CHAR_COLON, 0xF4, 0xF5, 0xF6, 0xF1, 0xF2, 0xF3, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE +}; + +const u8 *const gUnknown_082F2BA8[][10] = { + {gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F}, + {gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B}, + {gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA} +}; + +const u16 gUnknown_082F2C20[] = INCBIN_U16("graphics/interface/unk_palette1.gbapal"); +const u16 gUnknown_082F2C40[] = INCBIN_U16("graphics/interface/unk_palette2.gbapal"); + +const struct BgTemplate gUnknown_082F2C60[] = { + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 7, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, { + .bg = 1, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 23, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, { + .bg = 3, + .charBaseIndex = 1, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 1 + } +}; + +const struct WindowTemplate gUnknown_082F2C70[] = { + { + .bg = 0x03, + .tilemapLeft = 0x08, + .tilemapTop = 0x01, + .width = 0x15, + .height = 0x13, + .paletteNum = 0x0f, + .baseBlock = 0x0001, + }, { + .bg = 0x01, + .tilemapLeft = 0x09, + .tilemapTop = 0x12, + .width = 0x0f, + .height = 0x02, + .paletteNum = 0x0c, + .baseBlock = 0x007a, + }, { + .bg = 0x01, + .tilemapLeft = 0x00, + .tilemapTop = 0x02, + .width = 0x06, + .height = 0x0f, + .paletteNum = 0x07, + .baseBlock = 0x0020, + }, { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x02, + .width = 0x07, + .height = 0x09, + .paletteNum = 0x0e, + .baseBlock = 0x0013, + }, { 0xFF } +}; + +const struct Unk82F2C98 gUnknown_082F2C98[] = { + {0x00000000, sub_801F658}, + {0x00000003, sub_801F6F8}, + {0x00000004, sub_801F730}, + {0x00000005, sub_801F768}, + {0x00000001, sub_801F7D4}, + {0x00000006, sub_801F7E0}, + {0x00000007, sub_801F82C}, + {0x00000008, sub_801F870}, + {0x00000009, sub_801F8DC}, + {0x0000000a, sub_801F984}, + {0x0000000b, sub_801FA2C}, + {0x0000000c, sub_801FA68}, + {0x00000002, sub_801FB44}, + {0x0000000d, sub_801FB70}, + {0x00000012, sub_801FBB4}, + {0x00000013, sub_801FBF8}, + {0x0000000e, sub_801FC4C}, + {0x0000000f, sub_801FC9C}, + {0x00000010, sub_801FCEC}, + {0x00000011, sub_801FD30}, + {0x00000014, sub_801FD88} +}; + +const struct Unk82F2D40 gUnknown_082F2D40[] = { + {gText_QuitChatting, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_RegisterTextWhere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_RegisterTextHere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_InputText, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_ExitingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_LeaderLeftEndingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00}, + {gText_RegisteredTextChanged, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_AlreadySavedFile_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_SavingDontTurnOff_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_PlayerSavedGame_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01}, + {gText_IfLeaderLeavesChatEnds, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01} +}; + +const u8 gText_Ellipsis[] = _("…"); + +const struct MenuAction gUnknown_082F2DC8[] = { + {gText_Upper, NULL}, + {gText_Lower, NULL}, + {gText_Symbols, NULL}, + {gText_Register2, NULL}, + {gText_Exit2, NULL}, +}; + +const u16 gUnknown_082F2DF0[] = INCBIN_U16("graphics/interface/unk_palette3.gbapal"); +const u32 gUnknown_082F2E10[] = INCBIN_U32("graphics/interface/unk_cursor.4bpp.lz"); +const u32 gUnknown_082F3094[] = INCBIN_U32("graphics/interface/unk_dash.4bpp.lz"); +const u32 gUnknown_082F30B4[] = INCBIN_U32("graphics/interface/unk_cursor_arrow.4bpp.lz"); +const u32 gUnknown_082F30E0[] = INCBIN_U32("graphics/interface/unk_rbutton.4bpp.lz"); + +const struct CompressedSpriteSheet gUnknown_082F3134[] = { + {gUnknown_082F2E10, 0x1000, 0x0000}, + {gUnknown_082F30B4, 0x0040, 0x0001}, + {gUnknown_082F3094, 0x0040, 0x0002}, + {gUnknown_082F30E0, 0x0080, 0x0003}, + {gUnknown_08DD4CF8, 0x0400, 0x0004} +}; void sub_801DD98(void) { @@ -305,20 +509,6 @@ static void sub_801DF38(void) UpdatePaletteFade(); } -void (*const gUnknown_082F2A7C[])(void) = -{ - sub_801DFAC, - sub_801E030, - sub_801E120, - sub_801E240, - sub_801E764, - sub_801E838, - sub_801E460, - sub_801E5C4, - sub_801E668, - sub_801E978, -}; - static void sub_801DF54(u8 taskId) { switch (gUnknown_02022C84->unk17) @@ -939,8 +1129,6 @@ static void sub_801EBD4(u16 arg0) gUnknown_02022C84->unk6 = 0; } -static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; - static bool32 sub_801EBE4(void) { if (!(gMain.newAndRepeatedKeys & DPAD_UP)) From 53efbe2832f5e7a6973c3c5a6a6d7240ea5ecbdd Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 08:49:01 -0400 Subject: [PATCH 32/42] Finish decomp of union_room_chat --- data/union_room_chat.s | 90 --------------------------- include/global.h | 13 ++-- ld_script.txt | 1 - src/union_room_chat.c | 138 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 142 insertions(+), 100 deletions(-) delete mode 100755 data/union_room_chat.s diff --git a/data/union_room_chat.s b/data/union_room_chat.s deleted file mode 100755 index 4f6b976b5..000000000 --- a/data/union_room_chat.s +++ /dev/null @@ -1,90 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082F315C:: @ 82F315C struct SpritePalette - .4byte gUnknown_082F2DF0 - .2byte 0x0000 - - .align 2 -gUnknown_082F3164:: @ 82F3164 - .2byte 0x4000, 0xc000, 0x0400, 0x0000 - - .align 2 -gUnknown_082F316C:: @ 82F316C - .2byte 0x0000, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3174:: @ 82F3174 - .2byte 0x0020, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F317C:: @ 82F317C - .2byte 0x0040, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3184:: @ 82F3184 - .2byte 0x0060, 0x001e, 0xffff, 0x0000 - -gUnknown_082F318C:: @ 82F318C - .4byte gUnknown_082F316C - .4byte gUnknown_082F3174 - .4byte gUnknown_082F317C - .4byte gUnknown_082F3184 - - .align 2 -gUnknown_082F319C:: @ 82F319C - spr_template 0x0000, 0x0000, gUnknown_082F3164, gUnknown_082F318C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F31B4:: @ 82F31B4 - .byte 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31BC:: @ 82F31BC - spr_template 0x0002, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020ABC - - .align 2 -gUnknown_082F31D4:: @ 82F31D4 - spr_template 0x0001, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020AF4 - - .align 2 -gUnknown_082F31EC:: @ 82F31EC - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31F4:: @ 82F31F4 - .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31FC:: @ 82F31FC - .2byte 0x0000, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3204:: @ 82F3204 - .2byte 0x0008, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F320C:: @ 82F320C - .2byte 0x0010, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3214:: @ 82F3214 - .2byte 0x0018, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F321C:: @ 82F321C - .4byte gUnknown_082F31FC - .4byte gUnknown_082F3204 - .4byte gUnknown_082F320C - .4byte gUnknown_082F3214 - - .align 2 -gUnknown_082F322C:: @ 82F322C - spr_template 0x0003, 0x0000, gUnknown_082F31EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F3244:: @ 82F3244 - spr_template 0x0004, 0x0000, gUnknown_082F31F4, gUnknown_082F321C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy diff --git a/include/global.h b/include/global.h index 864a7fa55..7b570d72e 100644 --- a/include/global.h +++ b/include/global.h @@ -18,13 +18,12 @@ #if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER) #define _(x) x #define __(x) x -// CLion is an idiot -#define INCBIN_U8(x) {0} -#define INCBIN_U16(x) {0} -#define INCBIN_U32(x) {0} -#define INCBIN_S8(x) {0} -#define INCBIN_S16(x) {0} -#define INCBIN_S32(x) {0} +#define INCBIN_U8 {0} +#define INCBIN_U16 {0} +#define INCBIN_U32 {0} +#define INCBIN_S8 {0} +#define INCBIN_S16 {0} +#define INCBIN_S32 {0} #endif // IDE support #define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0])) diff --git a/ld_script.txt b/ld_script.txt index a7f9948b8..f38378a90 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -419,7 +419,6 @@ SECTIONS { src/mevent_client.o(.rodata); src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); - data/union_room_chat.o(.rodata); data/berry_crush.o(.rodata); data/berry_powder.o(.rodata); data/dodrio_berry_picking.o(.rodata); diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 1528cdd5f..ffe30d863 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -211,6 +211,8 @@ static bool32 sub_801FC9C(u8 *state); static bool32 sub_801FCEC(u8 *state); static bool32 sub_801FD30(u8 *state); static bool32 sub_801FD88(u8 *state); +static void sub_8020ABC(struct Sprite *sprite); +static void sub_8020AF4(struct Sprite *sprite); extern struct UnionRoomChat *gUnknown_02022C84; extern struct UnionRoomChat2 *gUnknown_02022C88; @@ -419,6 +421,138 @@ const struct CompressedSpriteSheet gUnknown_082F3134[] = { {gUnknown_08DD4CF8, 0x0400, 0x0004} }; +const struct SpritePalette gUnknown_082F315C = { + gUnknown_082F2DF0, 0x0000 +}; + +const struct OamData gUnknown_082F3164 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 3, + .priority = 1 +}; + +const union AnimCmd gUnknown_082F316C[] = { + ANIMCMD_FRAME(0x00, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3174[] = { + ANIMCMD_FRAME(0x20, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F317C[] = { + ANIMCMD_FRAME(0x40, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3184[] = { + ANIMCMD_FRAME(0x60, 30), + ANIMCMD_END +}; + +const union AnimCmd *const gUnknown_082F318C[] = { + gUnknown_082F316C, + gUnknown_082F3174, + gUnknown_082F317C, + gUnknown_082F3184 +}; + +const struct SpriteTemplate gUnknown_082F319C = { + .tileTag = 0x0000, + .paletteTag = 0x0000, + .oam = &gUnknown_082F3164, + .anims = gUnknown_082F318C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct OamData gUnknown_082F31B4 = { + .shape = ST_OAM_V_RECTANGLE, + .size = 0, + .priority = 2 +}; + +const struct SpriteTemplate gUnknown_082F31BC = { + .tileTag = 0x0002, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31B4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8020ABC +}; + +const struct SpriteTemplate gUnknown_082F31D4 = { + .tileTag = 0x0001, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31B4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8020AF4 +}; + +const struct OamData gUnknown_082F31EC = { + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 2 +}; + +const struct OamData gUnknown_082F31F4 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2 +}; + +const union AnimCmd gUnknown_082F31FC[] = { + ANIMCMD_FRAME(0x00, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3204[] = { + ANIMCMD_FRAME(0x08, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F320C[] = { + ANIMCMD_FRAME(0x10, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3214[] = { + ANIMCMD_FRAME(0x18, 2), + ANIMCMD_END +}; + +const union AnimCmd *const gUnknown_082F321C[] = { + gUnknown_082F31FC, + gUnknown_082F3204, + gUnknown_082F320C, + gUnknown_082F3214 +}; + +const struct SpriteTemplate gUnknown_082F322C = { + .tileTag = 0x0003, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31EC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct SpriteTemplate gUnknown_082F3244 = { + .tileTag = 0x0004, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31F4, + .anims = gUnknown_082F321C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + void sub_801DD98(void) { gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84)); @@ -2754,7 +2888,7 @@ static void sub_8020A68(void) gUnknown_02022C8C->unk4 = &gSprites[spriteId]; } -void sub_8020ABC(struct Sprite *sprite) +static void sub_8020ABC(struct Sprite *sprite) { int var0 = sub_801F198(); if (var0 == 15) @@ -2768,7 +2902,7 @@ void sub_8020ABC(struct Sprite *sprite) } } -void sub_8020AF4(struct Sprite *sprite) +static void sub_8020AF4(struct Sprite *sprite) { if (++sprite->data[0] > 4) { From cb04af05dc473f15eb97ae181dcba624efa2b8d1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:23:13 -0400 Subject: [PATCH 33/42] Resolve unnecessarily externed symbols --- src/union_room_chat.c | 15 +++------------ sym_ewram.txt | 12 ++---------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/union_room_chat.c b/src/union_room_chat.c index ffe30d863..84a0406be 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -214,18 +214,9 @@ static bool32 sub_801FD88(u8 *state); static void sub_8020ABC(struct Sprite *sprite); static void sub_8020AF4(struct Sprite *sprite); -extern struct UnionRoomChat *gUnknown_02022C84; -extern struct UnionRoomChat2 *gUnknown_02022C88; -extern struct UnionRoomChat3 *gUnknown_02022C8C; -extern const u16 gUnknown_082F2C20[]; -extern const u16 gUnknown_082F2C40[]; -extern const struct SpritePalette gUnknown_082F315C; -extern const struct SpriteTemplate gUnknown_082F319C; -extern const u16 gUnknown_082F2DF0[]; -extern const struct SpriteTemplate gUnknown_082F31BC; -extern const struct SpriteTemplate gUnknown_082F31D4; -extern const struct SpriteTemplate gUnknown_082F322C; -extern const struct SpriteTemplate gUnknown_082F3244; +EWRAM_DATA struct UnionRoomChat *gUnknown_02022C84 = NULL; +EWRAM_DATA struct UnionRoomChat2 *gUnknown_02022C88 = NULL; +EWRAM_DATA struct UnionRoomChat3 *gUnknown_02022C8C = NULL; void (*const gUnknown_082F2A7C[])(void) = { diff --git a/sym_ewram.txt b/sym_ewram.txt index ff27b4cfb..141d42875 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -14,18 +14,10 @@ .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" .include "src/mevent_client.o" + .include "src/union_room_chat.o" - @ union_room_chat + @ berry_crush .align 2 -gUnknown_02022C84: @ 2022C84 - .space 0x4 - -gUnknown_02022C88: @ 2022C88 - .space 0x4 - -gUnknown_02022C8C: @ 2022C8C - .space 0x4 - gUnknown_02022C90: @ 2022C90 .space 0x4 From 09874870ef552b6026f7ddfadb3f2dd6456888b8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:43:28 -0400 Subject: [PATCH 34/42] Mark file boundaries on remaining syms declared in sym_ewram.txt --- sym_ewram.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sym_ewram.txt b/sym_ewram.txt index 141d42875..bc3f1e8d7 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -24,6 +24,7 @@ gUnknown_02022C90: @ 2022C90 .include "src/berry_powder.o" .align 2 + @ dodrio_berry_picking gUnknown_02022C98: @ 2022C98 .space 0x4 @@ -45,6 +46,7 @@ gUnknown_02022CF4: @ 2022CF4 gUnknown_02022CF8: @ 2022CF8 .space 0x4 + @ pokemon_jump gUnknown_02022CFC: @ 2022CFC .space 0x4 @@ -172,6 +174,7 @@ gUnknown_02022D00: @ 2022D00 .include "src/unk_pokedex_area_screen_helper.o" .include "src/battle_pyramid_bag.o" + @ pokenav gUnknown_0203CF3C: @ 203CF3C .space 0x4 From b3a4509b9a884fa5ac9619e425de498f961fe9e6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:54:43 -0400 Subject: [PATCH 35/42] Move m4a BSS syms to m4a_1.s --- asm/m4a_1.s | 25 +++++++++++++++++++++++++ sym_bss.txt | 19 +++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/asm/m4a_1.s b/asm/m4a_1.s index 361f66c1a..cab4ed174 100644 --- a/asm/m4a_1.s +++ b/asm/m4a_1.s @@ -1907,3 +1907,28 @@ _081DDD90: thumb_func_end ply_mod .align 2, 0 @ Don't pad with nop. + + .bss +gUnknown_03001300: + .space 0x40 + .size gUnknown_03001300, .-gUnknown_03001300 + + .global gMPlayTrack_BGM +gMPlayTrack_BGM: + .space 0x320 + .size gMPlayTrack_BGM, .-gMPlayTrack_BGM + + .global gMPlayTrack_SE1 +gMPlayTrack_SE1: + .space 0xF0 + .size gMPlayTrack_SE1, .-gMPlayTrack_SE1 + + .global gMPlayTrack_SE2 +gMPlayTrack_SE2: + .space 0x2D0 + .size gMPlayTrack_SE2, .-gMPlayTrack_SE2 + + .global gMPlayTrack_SE3 +gMPlayTrack_SE3: + .space 0x50 + .size gMPlayTrack_SE3, .-gMPlayTrack_SE3 diff --git a/sym_bss.txt b/sym_bss.txt index 58b1312dc..7cce13449 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -47,6 +47,7 @@ .include "src/mirage_tower.o" .include "src/berry_fix_program.o" + @ pokenav gUnknown_030012BC: @ 30012BC .space 0x4 @@ -56,6 +57,7 @@ gUnknown_030012C0: @ 30012C0 gUnknown_030012C4: @ 30012C4 .space 0x4 + @ ereader_helpers gUnknown_030012C8: @ 30012C8 .space 0x18 @@ -90,22 +92,7 @@ gUnknown_030012F4: @ 30012F4 .space 0x4 .include "src/faraway_island.o" - -gUnknown_03001300: @ 3001300 - .space 0x40 - -gMPlayTrack_BGM: @ 3001340 - .space 0x320 - -gMPlayTrack_SE1: @ 3001660 - .space 0xF0 - -gMPlayTrack_SE2: @ 3001750 - .space 0x2D0 - -gMPlayTrack_SE3: @ 3001A20 - .space 0x50 - + .include "asm/m4a_1.o" .include "src/agb_flash.o" .include "src/siirtc.o" .include "*libgcc.a:dp-bit.o" From c46f271f676812b7292560f36f890010c71ef5d1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 11:55:18 -0400 Subject: [PATCH 36/42] Documentation of ereader_helpers, 1 --- data/ereader_helpers.s | 87 +++++++++++++++++++++------------------ include/ereader_helpers.h | 38 +++++++++++++++-- include/save.h | 5 ++- src/ereader_helpers.c | 69 +++++++++++++++---------------- src/ereader_screen.c | 4 +- src/recorded_battle.c | 4 +- src/save.c | 10 ++--- src/trainer_hill.c | 2 +- sym_bss.txt | 35 +--------------- 9 files changed, 128 insertions(+), 126 deletions(-) diff --git a/data/ereader_helpers.s b/data/ereader_helpers.s index 0ddddbc08..246fe749b 100644 --- a/data/ereader_helpers.s +++ b/data/ereader_helpers.s @@ -5,44 +5,49 @@ gUnknown_08625B6C:: @ 8625B6C @ apparently e-reader trainer data? idk -.byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 -.byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a -.byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 -.byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e -.byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a -.byte 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e -.byte 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01 -.byte 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a -.byte 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00 -.byte 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02, 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16 -.byte 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00 -.byte 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00 -.byte 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff -.byte 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18, 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff -.byte 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00 -.byte 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10 -.byte 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00, 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01 -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 + .byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a + .byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 + .byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e + .byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + + + .byte 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e + .byte 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a + .byte 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01, 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00 + .byte 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00, 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02 + .byte 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16, 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a + .byte 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00 + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00, 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00 + .byte 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e + .byte 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18 + .byte 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff, 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00, 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a + .byte 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00 + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00 + .byte 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0 + .byte 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 54b36ef0f..95079ff50 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -3,13 +3,43 @@ struct Unk81D38FC { - u8 unk0[0x270]; + u8 unk0[12]; + u8 unkC[0x148]; + u8 unk154[0x11C]; int checksum; }; -bool8 sub_81D3920(u8 *buffer); -bool32 sub_81D3AB0(struct Unk81D38FC *arg0); -bool32 sub_81D3B34(void); +struct EReaderTrainerHillSet +{ + u8 unk_0; + u8 unk_1; + u8 unk_2; + u8 unk_3; + int checksum; + struct Unk81D38FC unk_8[6]; + u8 unk_ec0[40]; +}; + +struct Unk81D3998Sub +{ + u8 unk_000[4]; + u8 unk_004[0x148]; + u8 unk_14C[0x148]; + u8 unk_294[0x124]; +}; + +struct Unk81D3998 +{ + u8 unk_000; + u8 unk_001; + u8 unk_002; + int checksum; + struct Unk81D3998Sub unk_008[4]; +}; + +bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer); +bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0); +bool32 ReadTrainerHillAndValidate(void); int sub_81D3D70(u8, u32, u32*, u32*); void sub_81D3F9C(void); void sub_81D3FAC(void); diff --git a/include/save.h b/include/save.h index 88e5f2280..5e2cf7267 100644 --- a/include/save.h +++ b/include/save.h @@ -33,6 +33,7 @@ struct SaveSectionOffsets #define NUM_SECTORS_PER_SLOT 16 #define UNKNOWN_CHECK_VALUE 0x8012025 +#define SPECIAL_SECTION_SENTINEL 0xB39D // SetDamagedSectorBits states enum @@ -88,8 +89,8 @@ bool8 CheckSaveFile(void); u8 Save_LoadGameData(u8 a1); u16 sub_815355C(void); u8 sub_81534D0(u8); -u32 TryCopySpecialSaveSection(u8 sector, u8* dst); -u32 sub_8153634(u8 sector, u8* src); +u32 TryReadSpecialSaveSection(u8 sector, u8* dst); +u32 TryWriteSpecialSaveSection(u8 sector, u8* src); void sub_8153688(u8 taskId); // save_failed_screen.c diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index cdb829ac8..48c41301e 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -26,17 +26,17 @@ static void sub_81D414C(void); static void sub_81D3F1C(u32, u32*, u32*); static void sub_81D3F68(void); -extern struct Unknown030012C8 gUnknown_030012C8; -extern u16 gUnknown_030012E0; -extern u16 gUnknown_030012E2; -extern u16 gUnknown_030012E4; -extern u16 gUnknown_030012E6; -extern u32 gUnknown_030012E8; -extern u16 gUnknown_030012EC; -extern u16 gUnknown_030012EE; -extern u16 gUnknown_030012F0; -extern u16 gUnknown_030012F2; -extern u16 gUnknown_030012F4; +IWRAM_DATA struct Unknown030012C8 gUnknown_030012C8; +IWRAM_DATA u16 gUnknown_030012E0; +IWRAM_DATA u16 gUnknown_030012E2; +IWRAM_DATA u16 gUnknown_030012E4; +IWRAM_DATA u16 gUnknown_030012E6; +IWRAM_DATA u32 gUnknown_030012E8; +IWRAM_DATA u16 gUnknown_030012EC; +IWRAM_DATA u16 gUnknown_030012EE; +IWRAM_DATA u16 gUnknown_030012F0; +IWRAM_DATA u16 gUnknown_030012F2; +IWRAM_DATA u16 gUnknown_030012F4; extern const u8 gUnknown_08625B6C[]; @@ -45,7 +45,7 @@ static u8 sub_81D38D4(void) return (gSaveBlock1Ptr->trainerHill.unused + 1) % 256; } -static bool32 sub_81D38FC(struct Unk81D38FC *arg0) +static bool32 Struct_Unk81D38FC_ValidateChecksum(struct Unk81D38FC *arg0) { int checksum = CalcByteArraySum(arg0->unk0, 0x270); if (checksum != arg0->checksum) @@ -54,43 +54,42 @@ static bool32 sub_81D38FC(struct Unk81D38FC *arg0) return TRUE; } -bool8 sub_81D3920(u8 *buffer) +bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer) { u32 i; u32 checksum; - int var0 = buffer[0]; + int var0 = buffer->unk_0; if (var0 < 1 || var0 > 8) return FALSE; for (i = 0; i < var0; i++) { - struct Unk81D38FC *var1 = (struct Unk81D38FC *)(&buffer[i * (sizeof(struct Unk81D38FC)) + 8]); - if (!sub_81D38FC(var1)) + if (!Struct_Unk81D38FC_ValidateChecksum(&buffer->unk_8[i])) return FALSE; } - checksum = CalcByteArraySum(buffer + 8, var0 * 0x274); - if (checksum != ((int *)buffer)[1]) + checksum = CalcByteArraySum((u8 *)buffer->unk_8, var0 * sizeof(struct Unk81D38FC)); + if (checksum != buffer->checksum) return FALSE; return TRUE; } -static bool32 sub_81D396C(u8 *buffer) +static bool32 TrainerHill_VerifyChecksum(struct EReaderTrainerHillSet *buffer) { u32 checksum; - int var0 = buffer[0]; + int var0 = buffer->unk_0; if (var0 < 1 || var0 > 8) return FALSE; - checksum = CalcByteArraySum(buffer + 8, 0xEE0); - if (checksum != ((int *)buffer)[1]) + checksum = CalcByteArraySum((u8 *)buffer->unk_8, sizeof(struct EReaderTrainerHillSet) - offsetof(struct EReaderTrainerHillSet, unk_8)); + if (checksum != buffer->checksum) return FALSE; return TRUE; } -static bool32 sub_81D3998(struct Unk81D38FC *arg0, u8 *buffer2) +static bool32 TryWriteTrainerHill_r(struct Unk81D38FC *arg0, u8 *buffer2) { int i; const u8 *ereaderVals; @@ -131,44 +130,44 @@ static bool32 sub_81D3998(struct Unk81D38FC *arg0, u8 *buffer2) } ((int *)buffer2)[1] = CalcByteArraySum(buffer2 + 8, 0xEE0); - if (sub_8153634(SECTOR_ID_TRAINER_HILL, buffer2) != 1) + if (TryWriteSpecialSaveSection(SECTOR_ID_TRAINER_HILL, (u8 *)buffer2) != 1) return FALSE; return TRUE; } -bool32 sub_81D3AB0(struct Unk81D38FC *arg0) +bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0) { u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3998(arg0, var0); + bool32 result = TryWriteTrainerHill_r(arg0, var0); Free(var0); return result; } -static bool32 sub_81D3AD8(u8 *arg0, u8 *arg1) +static bool32 TryReadTrainerHill_r(struct EReaderTrainerHillSet *arg0, u8 *arg1) { - if (TryCopySpecialSaveSection(SECTOR_ID_TRAINER_HILL, arg1) != 1) + if (TryReadSpecialSaveSection(SECTOR_ID_TRAINER_HILL, arg1) != 1) return FALSE; - memcpy(arg0, arg1, 0xEE8); - if (!sub_81D396C(arg0)) + memcpy(arg0, arg1, sizeof(struct EReaderTrainerHillSet)); + if (!TrainerHill_VerifyChecksum(arg0)) return FALSE; return TRUE; } -static bool32 sub_81D3B0C(u8 *arg0) +static bool32 TryReadTrainerHill(struct EReaderTrainerHillSet *arg0) { u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3AD8(arg0, var0); + bool32 result = TryReadTrainerHill_r(arg0, var0); Free(var0); return result; } -bool32 sub_81D3B34(void) +bool32 ReadTrainerHillAndValidate(void) { - u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3B0C(var0); + struct EReaderTrainerHillSet *var0 = AllocZeroed(0x1000); + bool32 result = TryReadTrainerHill(var0); Free(var0); return result; } diff --git a/src/ereader_screen.c b/src/ereader_screen.c index bac29cd42..8dc2a539b 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -402,7 +402,7 @@ static void sub_81D5084(u8 taskId) } break; case 15: - data->unkE = sub_81D3920(gDecompressionBuffer); + data->unkE = EReader_IsReceivedDataValid((struct EReaderTrainerHillSet *)gDecompressionBuffer); sub_800ABF4(data->unkE); data->unk8 = 16; break; @@ -416,7 +416,7 @@ static void sub_81D5084(u8 taskId) } break; case 17: - if (sub_81D3AB0((struct Unk81D38FC *)&gDecompressionBuffer)) + if (TryWriteTrainerHill((struct Unk81D38FC *)&gDecompressionBuffer)) { AddTextPrinterToWindow1(gUnknown_085EE0FA); sub_81D505C(&data->unk0); diff --git a/src/recorded_battle.c b/src/recorded_battle.c index acd4c2ce6..9f2be36af 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -322,7 +322,7 @@ static bool32 RecordedBattleToSave(struct RecordedBattleSave *battleSave, struct saveSection->checksum = CalcByteArraySum((void*)(saveSection), sizeof(*saveSection) - 4); - if (sub_8153634(31, (void*)(saveSection)) != 1) + if (TryWriteSpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveSection)) != 1) return FALSE; else return TRUE; @@ -491,7 +491,7 @@ bool32 MoveRecordedBattleToSaveData(void) static bool32 TryCopyRecordedBattleSaveData(struct RecordedBattleSave *dst, struct SaveSection *saveBuffer) { - if (TryCopySpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1) + if (TryReadSpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1) return FALSE; memcpy(dst, saveBuffer, sizeof(struct RecordedBattleSave)); diff --git a/src/save.c b/src/save.c index 361a88e1e..45a75b5dc 100644 --- a/src/save.c +++ b/src/save.c @@ -849,7 +849,7 @@ u16 sub_815355C(void) return 0; } -u32 TryCopySpecialSaveSection(u8 sector, u8* dst) +u32 TryReadSpecialSaveSection(u8 sector, u8* dst) { s32 i; s32 size; @@ -858,7 +858,7 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst) if (sector != SECTOR_ID_TRAINER_HILL && sector != SECTOR_ID_RECORDED_BATTLE) return 0xFF; ReadFlash(sector, 0, (u8 *)&gSaveDataBuffer, sizeof(struct SaveSection)); - if (*(u32*)(&gSaveDataBuffer.data[0]) != 0xB39D) + if (*(u32*)(&gSaveDataBuffer.data[0]) != SPECIAL_SECTION_SENTINEL) return 0xFF; // copies whole save section except u32 counter i = 0; @@ -869,18 +869,18 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst) return 1; } -u32 sub_8153634(u8 sector, u8* src) +u32 TryWriteSpecialSaveSection(u8 sector, u8* src) { s32 i; s32 size; u8* savData; void* savDataBuffer; - if (sector != 30 && sector != 31) + if (sector != SECTOR_ID_TRAINER_HILL && sector != SECTOR_ID_RECORDED_BATTLE) return 0xFF; savDataBuffer = &gSaveDataBuffer; - *(u32*)(savDataBuffer) = 0xB39D; + *(u32*)(savDataBuffer) = SPECIAL_SECTION_SENTINEL; // copies whole save section except u32 counter i = 0; diff --git a/src/trainer_hill.c b/src/trainer_hill.c index eafd1eb3d..650a748cb 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -428,7 +428,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId) static void TrainerHillStartChallenge(void) { nullsub_2(); - if (!sub_81D3B34()) + if (!ReadTrainerHillAndValidate()) gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 1; else gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; diff --git a/sym_bss.txt b/sym_bss.txt index 7cce13449..4d21151ef 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -57,40 +57,7 @@ gUnknown_030012C0: @ 30012C0 gUnknown_030012C4: @ 30012C4 .space 0x4 - @ ereader_helpers -gUnknown_030012C8: @ 30012C8 - .space 0x18 - -gUnknown_030012E0: @ 30012E0 - .space 0x2 - -gUnknown_030012E2: @ 30012E2 - .space 0x2 - -gUnknown_030012E4: @ 30012E4 - .space 0x2 - -gUnknown_030012E6: @ 30012E6 - .space 0x2 - -gUnknown_030012E8: @ 30012E8 - .space 0x4 - -gUnknown_030012EC: @ 30012EC - .space 0x2 - -gUnknown_030012EE: @ 30012EE - .space 0x2 - -gUnknown_030012F0: @ 30012F0 - .space 0x2 - -gUnknown_030012F2: @ 30012F2 - .space 0x2 - -gUnknown_030012F4: @ 30012F4 - .space 0x4 - + .include "src/ereader_helpers.o" .include "src/faraway_island.o" .include "asm/m4a_1.o" .include "src/agb_flash.o" From 8db03ba6fab0d335d6141f1a9289122c1477a7b6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 13:44:43 -0400 Subject: [PATCH 37/42] Documentation of ereader helpers, 2 --- include/ereader_helpers.h | 9 ++++---- src/ereader_helpers.c | 45 ++++++++++++++++----------------------- src/ereader_screen.c | 2 +- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 95079ff50..bcbb68d4f 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -3,9 +3,10 @@ struct Unk81D38FC { - u8 unk0[12]; - u8 unkC[0x148]; - u8 unk154[0x11C]; + u8 unk0; + u8 filler_1[3]; + u8 unk4[0x148]; + u8 unk14C[0x124]; int checksum; }; @@ -38,7 +39,7 @@ struct Unk81D3998 }; bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer); -bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0); +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *arg0); bool32 ReadTrainerHillAndValidate(void); int sub_81D3D70(u8, u32, u32*, u32*); void sub_81D3F9C(void); diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 48c41301e..cd64afe0e 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -38,7 +38,7 @@ IWRAM_DATA u16 gUnknown_030012F0; IWRAM_DATA u16 gUnknown_030012F2; IWRAM_DATA u16 gUnknown_030012F4; -extern const u8 gUnknown_08625B6C[]; +extern const u8 gUnknown_08625B6C[][0x148]; static u8 sub_81D38D4(void) { @@ -47,7 +47,7 @@ static u8 sub_81D38D4(void) static bool32 Struct_Unk81D38FC_ValidateChecksum(struct Unk81D38FC *arg0) { - int checksum = CalcByteArraySum(arg0->unk0, 0x270); + int checksum = CalcByteArraySum((u8 *)arg0, 0x270); if (checksum != arg0->checksum) return FALSE; @@ -89,56 +89,47 @@ static bool32 TrainerHill_VerifyChecksum(struct EReaderTrainerHillSet *buffer) return TRUE; } -static bool32 TryWriteTrainerHill_r(struct Unk81D38FC *arg0, u8 *buffer2) +static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *arg0, struct Unk81D3998 *buffer2) { int i; - const u8 *ereaderVals; memset(buffer2, 0, 0x1000); - buffer2[0] = arg0->unk0[0]; - buffer2[1] = sub_81D38D4(); - buffer2[2] = (arg0->unk0[0] + 1) / 2; + buffer2->unk_000 = arg0->unk_0; + buffer2->unk_001 = sub_81D38D4(); + buffer2->unk_002 = (arg0->unk_0 + 1) / 2; - for (i = 0; i < arg0->unk0[0]; i++) + for (i = 0; i < arg0->unk_0; i++) { if (!(i & 1)) { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - u8 *var1 = arg0[i].unk0; - var0[8] = var1[8]; - memcpy(&var0[0x29C], &var1[0x154], 0x124); - var0 += 0xC; - var1 += 0xC; - memcpy(var0, var1, 0x148); + buffer2->unk_008[i / 2].unk_000[0] = arg0->unk_8[i].unk0; + memcpy(buffer2->unk_008[i / 2].unk_294, arg0->unk_8[i].unk14C, 0x124); + memcpy(buffer2->unk_008[i / 2].unk_004, arg0->unk_8[i].unk4, 0x148); } else { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - u8 *var1 = arg0[i].unk0; - var0[9] = var1[8]; - memcpy(&var0[0x154], &var1[0xC], 0x148); + buffer2->unk_008[i / 2].unk_000[1] = arg0->unk_8[i].unk0; + memcpy(buffer2->unk_008[i / 2].unk_14C, arg0->unk_8[i].unk4, 0x148); } } if (i & 1) { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - var0 += 0x154; - - ereaderVals = gUnknown_08625B6C; - memcpy(var0, &ereaderVals[(i / 2) * 0x148], 0x148); + u8 * dest = buffer2->unk_008[i / 2].unk_14C; + const u8 (* src)[0x148] = gUnknown_08625B6C; + memcpy(dest, src[i / 2], 0x148); } - ((int *)buffer2)[1] = CalcByteArraySum(buffer2 + 8, 0xEE0); + buffer2->checksum = CalcByteArraySum((u8 *)buffer2->unk_008, sizeof(struct Unk81D3998) - offsetof(struct Unk81D3998, unk_008)); if (TryWriteSpecialSaveSection(SECTOR_ID_TRAINER_HILL, (u8 *)buffer2) != 1) return FALSE; return TRUE; } -bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0) +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *arg0) { - u8 *var0 = AllocZeroed(0x1000); + struct Unk81D3998 *var0 = AllocZeroed(0x1000); bool32 result = TryWriteTrainerHill_r(arg0, var0); Free(var0); return result; diff --git a/src/ereader_screen.c b/src/ereader_screen.c index 8dc2a539b..f74efa32b 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -416,7 +416,7 @@ static void sub_81D5084(u8 taskId) } break; case 17: - if (TryWriteTrainerHill((struct Unk81D38FC *)&gDecompressionBuffer)) + if (TryWriteTrainerHill((struct EReaderTrainerHillSet *)&gDecompressionBuffer)) { AddTextPrinterToWindow1(gUnknown_085EE0FA); sub_81D505C(&data->unk0); From 016021ac049961a3ad2b2419f358801138edd757 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 14:55:24 -0400 Subject: [PATCH 38/42] Move gUnknown_02022C90 from sym_ewram.txt --- src/berry_crush.c | 2 +- sym_ewram.txt | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/berry_crush.c b/src/berry_crush.c index 51dbe8203..307bd49a7 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -139,7 +139,7 @@ void sub_8022960(struct BerryCrushGame *); void sub_8022524(struct BerryCrushGame_138 *, u16); void sub_8022B28(struct Sprite *); -extern struct BerryCrushGame *gUnknown_02022C90; +static EWRAM_DATA struct BerryCrushGame *gUnknown_02022C90 = NULL; extern const struct BgTemplate gUnknown_082F32C8[4]; extern const u8 gBerryCrushGrinderTopTilemap[]; diff --git a/sym_ewram.txt b/sym_ewram.txt index bc3f1e8d7..40171a167 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -15,12 +15,7 @@ .include "src/mevent_server.o" .include "src/mevent_client.o" .include "src/union_room_chat.o" - - @ berry_crush - .align 2 -gUnknown_02022C90: @ 2022C90 - .space 0x4 - + .include "src/berry_crush.o" .include "src/berry_powder.o" .align 2 From 704f025a00e32a910b6fd70a54511844e755663f Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Wed, 3 Apr 2019 10:36:50 -0400 Subject: [PATCH 39/42] Fix a typo in as(s)istattackselect --- src/battle_script_commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d1d8d87ac..2e78e1ca0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -296,7 +296,7 @@ static void atkDA_tryswapabilities(void); static void atkDB_tryimprison(void); static void atkDC_trysetgrudge(void); static void atkDD_weightdamagecalculation(void); -static void atkDE_asistattackselect(void); +static void atkDE_assistattackselect(void); static void atkDF_trysetmagiccoat(void); static void atkE0_trysetsnatch(void); static void atkE1_trygetintimidatetarget(void); @@ -548,7 +548,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = atkDB_tryimprison, atkDC_trysetgrudge, atkDD_weightdamagecalculation, - atkDE_asistattackselect, + atkDE_assistattackselect, atkDF_trysetmagiccoat, atkE0_trysetsnatch, atkE1_trygetintimidatetarget, @@ -9660,7 +9660,7 @@ static void atkDD_weightdamagecalculation(void) gBattlescriptCurrInstr++; } -static void atkDE_asistattackselect(void) +static void atkDE_assistattackselect(void) { s32 chooseableMovesNo = 0; struct Pokemon* party; From 90e32f4ec57f6597dc02b11dcae54b14e9d4ceaa Mon Sep 17 00:00:00 2001 From: Fontbane Date: Wed, 3 Apr 2019 14:13:11 -0400 Subject: [PATCH 40/42] Document landmark setting and item balls --- asm/macros/battle_script.inc | 2 +- data/battle_scripts_1.s | 2 +- .../AbandonedShip_CaptainsOffice/map.json | 2 +- data/maps/AbandonedShip_Deck/scripts.inc | 4 +- .../AbandonedShip_HiddenFloorRooms/map.json | 8 +- data/maps/AbandonedShip_Room_B1F/map.json | 2 +- data/maps/AbandonedShip_Rooms2_1F/map.json | 2 +- data/maps/AbandonedShip_Rooms2_B1F/map.json | 2 +- data/maps/AbandonedShip_Rooms_1F/map.json | 2 +- data/maps/AbandonedShip_Rooms_B1F/map.json | 2 +- data/maps/AlteringCave/scripts.inc | 4 +- data/maps/AquaHideout_B1F/map.json | 6 +- data/maps/AquaHideout_B2F/map.json | 2 +- data/maps/ArtisanCave_1F/map.json | 2 +- data/maps/ArtisanCave_B1F/map.json | 2 +- data/maps/ArtisanCave_B1F/scripts.inc | 4 +- .../BattleFrontier_ReceptionGate/scripts.inc | 4 +- data/maps/DesertUnderpass/scripts.inc | 4 +- data/maps/FieryPath/map.json | 4 +- data/maps/GraniteCave_1F/map.json | 2 +- data/maps/GraniteCave_B1F/map.json | 2 +- data/maps/GraniteCave_B2F/map.json | 4 +- data/maps/JaggedPass/map.json | 2 +- data/maps/LilycoveCity/map.json | 2 +- data/maps/MagmaHideout_1F/map.json | 2 +- data/maps/MagmaHideout_2F_2R/map.json | 4 +- data/maps/MagmaHideout_3F_1R/map.json | 2 +- data/maps/MagmaHideout_3F_2R/map.json | 2 +- data/maps/MagmaHideout_3F_3R/map.json | 2 +- data/maps/MagmaHideout_4F/map.json | 2 +- data/maps/MauvilleCity/map.json | 2 +- data/maps/MeteorFalls_1F_1R/map.json | 8 +- data/maps/MeteorFalls_B1F_2R/map.json | 2 +- data/maps/MossdeepCity/map.json | 2 +- data/maps/MtPyre_2F/map.json | 2 +- data/maps/MtPyre_3F/map.json | 2 +- data/maps/MtPyre_4F/map.json | 2 +- data/maps/MtPyre_5F/map.json | 2 +- data/maps/MtPyre_6F/map.json | 2 +- data/maps/MtPyre_Exterior/map.json | 4 +- data/maps/NewMauville_Entrance/scripts.inc | 4 +- data/maps/NewMauville_Inside/map.json | 10 +- data/maps/PetalburgCity/map.json | 4 +- data/maps/PetalburgWoods/map.json | 8 +- data/maps/Route102/map.json | 2 +- data/maps/Route103/map.json | 4 +- data/maps/Route104/map.json | 8 +- data/maps/Route105/map.json | 2 +- data/maps/Route106/map.json | 2 +- data/maps/Route108/map.json | 2 +- data/maps/Route109/map.json | 4 +- data/maps/Route109_SeashoreHouse/scripts.inc | 4 +- data/maps/Route110/map.json | 6 +- data/maps/Route110_TrickHousePuzzle1/map.json | 2 +- data/maps/Route110_TrickHousePuzzle2/map.json | 4 +- data/maps/Route110_TrickHousePuzzle3/map.json | 4 +- data/maps/Route110_TrickHousePuzzle4/map.json | 2 +- data/maps/Route110_TrickHousePuzzle6/map.json | 2 +- data/maps/Route110_TrickHousePuzzle7/map.json | 2 +- data/maps/Route110_TrickHousePuzzle8/map.json | 2 +- data/maps/Route111/map.json | 8 +- .../Route111_OldLadysRestStop/scripts.inc | 4 +- data/maps/Route112/map.json | 2 +- data/maps/Route113/map.json | 6 +- data/maps/Route114/map.json | 6 +- .../Route114_FossilManiacsHouse/scripts.inc | 4 +- data/maps/Route114_LanettesHouse/scripts.inc | 4 +- data/maps/Route115/map.json | 12 +- data/maps/Route116/map.json | 10 +- .../Route116_TunnelersRestHouse/scripts.inc | 4 +- data/maps/Route117/map.json | 4 +- data/maps/Route117_PokemonDayCare/scripts.inc | 4 +- data/maps/Route118/map.json | 2 +- data/maps/Route119/map.json | 18 +- data/maps/Route120/map.json | 10 +- data/maps/Route121/map.json | 6 +- data/maps/Route123/map.json | 10 +- .../Route123_BerryMastersHouse/scripts.inc | 4 +- data/maps/Route124/map.json | 6 +- .../scripts.inc | 4 +- data/maps/Route125/map.json | 2 +- data/maps/Route126/map.json | 2 +- data/maps/Route127/map.json | 6 +- data/maps/Route132/map.json | 4 +- data/maps/Route133/map.json | 6 +- data/maps/Route134/map.json | 4 +- data/maps/RustboroCity/map.json | 2 +- data/maps/RusturfTunnel/map.json | 4 +- data/maps/SafariZone_North/map.json | 2 +- data/maps/SafariZone_Northeast/map.json | 2 +- data/maps/SafariZone_Northwest/map.json | 2 +- data/maps/SafariZone_Southeast/map.json | 2 +- data/maps/SafariZone_Southwest/map.json | 2 +- data/maps/ScorchedSlab/map.json | 2 +- data/maps/ScorchedSlab/scripts.inc | 4 +- data/maps/SeafloorCavern_Room9/map.json | 2 +- data/maps/SealedChamber_OuterRoom/scripts.inc | 4 +- .../ShoalCave_LowTideEntranceRoom/map.json | 2 +- data/maps/ShoalCave_LowTideIceRoom/map.json | 4 +- data/maps/ShoalCave_LowTideInnerRoom/map.json | 2 +- .../maps/ShoalCave_LowTideStairsRoom/map.json | 2 +- data/maps/SkyPillar_Entrance/scripts.inc | 4 +- data/maps/SouthernIsland_Exterior/scripts.inc | 4 +- data/maps/VictoryRoad_1F/map.json | 4 +- data/maps/VictoryRoad_B1F/map.json | 4 +- data/maps/VictoryRoad_B2F/map.json | 2 +- data/scripts/item_ball_scripts.inc | 332 +++++++++--------- 107 files changed, 366 insertions(+), 366 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 7a1af4c17..997af51cc 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1124,7 +1124,7 @@ .byte 0xdd .endm - .macro asistattackselect param0:req + .macro assistattackselect param0:req .byte 0xde .4byte \param0 .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a3ba7eb08..244a3ac05 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2384,7 +2384,7 @@ BattleScript_EffectWish:: BattleScript_EffectAssist:: attackcanceler attackstring - asistattackselect BattleScript_ButItFailedPpReduce + assistattackselect BattleScript_ButItFailedPpReduce attackanimation waitanimation setbyte sB_ANIM_TURN, 0x0 diff --git a/data/maps/AbandonedShip_CaptainsOffice/map.json b/data/maps/AbandonedShip_CaptainsOffice/map.json index a78d433b6..b876ad849 100644 --- a/data/maps/AbandonedShip_CaptainsOffice/map.json +++ b/data/maps/AbandonedShip_CaptainsOffice/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_CaptainsOffice_EventScript_29126E", + "script": "AbandonedShip_CaptainsOffice_EventScript_ItemStorageKey", "flag": "FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY" } ], diff --git a/data/maps/AbandonedShip_Deck/scripts.inc b/data/maps/AbandonedShip_Deck/scripts.inc index 041c54593..f256fe521 100644 --- a/data/maps/AbandonedShip_Deck/scripts.inc +++ b/data/maps/AbandonedShip_Deck/scripts.inc @@ -1,8 +1,8 @@ AbandonedShip_Deck_MapScripts:: @ 823799A - map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_2379A0 + map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_SetLandmark .byte 0 -AbandonedShip_Deck_MapScript1_2379A0: @ 82379A0 +AbandonedShip_Deck_MapScript1_SetLandmark: @ 82379A0 setflag FLAG_LANDMARK_ABANDONED_SHIP end diff --git a/data/maps/AbandonedShip_HiddenFloorRooms/map.json b/data/maps/AbandonedShip_HiddenFloorRooms/map.json index f71ad8eb3..fdfb8a187 100644 --- a/data/maps/AbandonedShip_HiddenFloorRooms/map.json +++ b/data/maps/AbandonedShip_HiddenFloorRooms/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_29127B", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemLuxuryBall", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_291288", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_2912A2", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_291295", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemWaterStone", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE" } ], diff --git a/data/maps/AbandonedShip_Room_B1F/map.json b/data/maps/AbandonedShip_Room_B1F/map.json index 60dd5e1b3..b8e2a71da 100644 --- a/data/maps/AbandonedShip_Room_B1F/map.json +++ b/data/maps/AbandonedShip_Room_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Room_B1F_EventScript_291254", + "script": "AbandonedShip_Room_B1F_EventScript_ItemTM13", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13" } ], diff --git a/data/maps/AbandonedShip_Rooms2_1F/map.json b/data/maps/AbandonedShip_Rooms2_1F/map.json index 49a4c2da0..35b029f7f 100644 --- a/data/maps/AbandonedShip_Rooms2_1F/map.json +++ b/data/maps/AbandonedShip_Rooms2_1F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms2_1F_EventScript_291261", + "script": "AbandonedShip_Rooms2_1F_EventScript_ItemRevive", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE" }, { diff --git a/data/maps/AbandonedShip_Rooms2_B1F/map.json b/data/maps/AbandonedShip_Rooms2_B1F/map.json index 3f56bf6cd..621b80bb1 100644 --- a/data/maps/AbandonedShip_Rooms2_B1F/map.json +++ b/data/maps/AbandonedShip_Rooms2_B1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms2_B1F_EventScript_291247", + "script": "AbandonedShip_Rooms2_B1F_EventScript_ItemDiveBall", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL" } ], diff --git a/data/maps/AbandonedShip_Rooms_1F/map.json b/data/maps/AbandonedShip_Rooms_1F/map.json index e97c74fcf..af25a3994 100644 --- a/data/maps/AbandonedShip_Rooms_1F/map.json +++ b/data/maps/AbandonedShip_Rooms_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms_1F_EventScript_29122D", + "script": "AbandonedShip_Rooms_1F_EventScript_ItemHarborMail", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL" }, { diff --git a/data/maps/AbandonedShip_Rooms_B1F/map.json b/data/maps/AbandonedShip_Rooms_B1F/map.json index 65b5fb9cf..2e836f3a1 100644 --- a/data/maps/AbandonedShip_Rooms_B1F/map.json +++ b/data/maps/AbandonedShip_Rooms_B1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms_B1F_EventScript_29123A", + "script": "AbandonedShip_Rooms_B1F_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE" } ], diff --git a/data/maps/AlteringCave/scripts.inc b/data/maps/AlteringCave/scripts.inc index 185466c80..19fd1fb0b 100644 --- a/data/maps/AlteringCave/scripts.inc +++ b/data/maps/AlteringCave/scripts.inc @@ -1,8 +1,8 @@ AlteringCave_MapScripts:: @ 823B177 - map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_23B17D + map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_SetLandmark .byte 0 -AlteringCave_MapScript1_23B17D: @ 823B17D +AlteringCave_MapScript1_SetLandmark: @ 823B17D setflag FLAG_LANDMARK_ALTERING_CAVE end diff --git a/data/maps/AquaHideout_B1F/map.json b/data/maps/AquaHideout_B1F/map.json index 5b6beee11..8cdc901ec 100644 --- a/data/maps/AquaHideout_B1F/map.json +++ b/data/maps/AquaHideout_B1F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291372", + "script": "AquaHideout_B1F_EventScript_ItemMaxElixir", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR" }, { @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291358", + "script": "AquaHideout_B1F_EventScript_ItemMasterBall", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_MASTER_BALL" }, { @@ -102,7 +102,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291365", + "script": "AquaHideout_B1F_EventScript_ItemNugget", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_NUGGET" }, { diff --git a/data/maps/AquaHideout_B2F/map.json b/data/maps/AquaHideout_B2F/map.json index 64c6eddff..b286872af 100644 --- a/data/maps/AquaHideout_B2F/map.json +++ b/data/maps/AquaHideout_B2F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B2F_EventScript_29137F", + "script": "AquaHideout_B2F_EventScript_ItemNestBall", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL" }, { diff --git a/data/maps/ArtisanCave_1F/map.json b/data/maps/ArtisanCave_1F/map.json index 2092ca7ea..dc7792d8a 100644 --- a/data/maps/ArtisanCave_1F/map.json +++ b/data/maps/ArtisanCave_1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ArtisanCave_1F_EventScript_2914D1", + "script": "ArtisanCave_1F_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ARTISAN_CAVE_1F_CARBOS" } ], diff --git a/data/maps/ArtisanCave_B1F/map.json b/data/maps/ArtisanCave_B1F/map.json index 32174cd44..2fec826cd 100644 --- a/data/maps/ArtisanCave_B1F/map.json +++ b/data/maps/ArtisanCave_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ArtisanCave_B1F_EventScript_2914C4", + "script": "ArtisanCave_B1F_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ARTISAN_CAVE_B1F_HP_UP" } ], diff --git a/data/maps/ArtisanCave_B1F/scripts.inc b/data/maps/ArtisanCave_B1F/scripts.inc index 433991bea..a64fe4ab9 100644 --- a/data/maps/ArtisanCave_B1F/scripts.inc +++ b/data/maps/ArtisanCave_B1F/scripts.inc @@ -1,8 +1,8 @@ ArtisanCave_B1F_MapScripts:: @ 823AFAD - map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_23AFB3 + map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_SetLandmark .byte 0 -ArtisanCave_B1F_MapScript1_23AFB3: @ 823AFB3 +ArtisanCave_B1F_MapScript1_SetLandmark: @ 823AFB3 setflag FLAG_LANDMARK_ARTISAN_CAVE end diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc index 8ce438d75..369c30aca 100644 --- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc +++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc @@ -1,9 +1,9 @@ BattleFrontier_ReceptionGate_MapScripts:: @ 82661DA map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_ReceptionGate_MapScript2_2661E9 - map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_2661E5 + map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_SetLandmark .byte 0 -BattleFrontier_ReceptionGate_MapScript1_2661E5: @ 82661E5 +BattleFrontier_ReceptionGate_MapScript1_SetLandmark: @ 82661E5 setflag FLAG_LANDMARK_BATTLE_FRONTIER end diff --git a/data/maps/DesertUnderpass/scripts.inc b/data/maps/DesertUnderpass/scripts.inc index 9c5e83180..1b8324d8a 100644 --- a/data/maps/DesertUnderpass/scripts.inc +++ b/data/maps/DesertUnderpass/scripts.inc @@ -1,8 +1,8 @@ DesertUnderpass_MapScripts:: @ 823AF37 - map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_23AF3D + map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_SetLandmark .byte 0 -DesertUnderpass_MapScript1_23AF3D: @ 823AF3D +DesertUnderpass_MapScript1_SetLandmark: @ 823AF3D setflag FLAG_LANDMARK_DESERT_UNDERPASS end diff --git a/data/maps/FieryPath/map.json b/data/maps/FieryPath/map.json index 61324a8ff..9bb09fe5a 100644 --- a/data/maps/FieryPath/map.json +++ b/data/maps/FieryPath/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "FieryPath_EventScript_29119E", + "script": "FieryPath_EventScript_ItemTM06", "flag": "FLAG_ITEM_FIERY_PATH_TM06" }, { @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "FieryPath_EventScript_291191", + "script": "FieryPath_EventScript_ItemFireStone", "flag": "FLAG_ITEM_FIERY_PATH_FIRE_STONE" } ], diff --git a/data/maps/GraniteCave_1F/map.json b/data/maps/GraniteCave_1F/map.json index 67f2e8000..2413a023d 100644 --- a/data/maps/GraniteCave_1F/map.json +++ b/data/maps/GraniteCave_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_1F_EventScript_291150", + "script": "GraniteCave_1F_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_GRANITE_CAVE_1F_ESCAPE_ROPE" } ], diff --git a/data/maps/GraniteCave_B1F/map.json b/data/maps/GraniteCave_B1F/map.json index b33e751e5..5a4548164 100644 --- a/data/maps/GraniteCave_B1F/map.json +++ b/data/maps/GraniteCave_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B1F_EventScript_29115D", + "script": "GraniteCave_B1F_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_GRANITE_CAVE_B1F_POKE_BALL" } ], diff --git a/data/maps/GraniteCave_B2F/map.json b/data/maps/GraniteCave_B2F/map.json index 48de00180..73a13d6d2 100644 --- a/data/maps/GraniteCave_B2F/map.json +++ b/data/maps/GraniteCave_B2F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B2F_EventScript_29116A", + "script": "GraniteCave_B2F_EventScript_ItemRepel", "flag": "FLAG_ITEM_GRANITE_CAVE_B2F_REPEL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B2F_EventScript_291177", + "script": "GraniteCave_B2F_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_GRANITE_CAVE_B2F_RARE_CANDY" }, { diff --git a/data/maps/JaggedPass/map.json b/data/maps/JaggedPass/map.json index 3ec89fce6..e695c826c 100644 --- a/data/maps/JaggedPass/map.json +++ b/data/maps/JaggedPass/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "JaggedPass_EventScript_291184", + "script": "JaggedPass_EventScript_ItemBurnHeal", "flag": "FLAG_ITEM_JAGGED_PASS_BURN_HEAL" }, { diff --git a/data/maps/LilycoveCity/map.json b/data/maps/LilycoveCity/map.json index ea771c3b5..26f0ad36d 100644 --- a/data/maps/LilycoveCity/map.json +++ b/data/maps/LilycoveCity/map.json @@ -165,7 +165,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "LilycoveCity_EventScript_2910E8", + "script": "LilycoveCity_EventScript_ItemMaxRepel", "flag": "FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL" }, { diff --git a/data/maps/MagmaHideout_1F/map.json b/data/maps/MagmaHideout_1F/map.json index 8eb3e23b5..2bbcf77a0 100644 --- a/data/maps/MagmaHideout_1F/map.json +++ b/data/maps/MagmaHideout_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_1F_EventScript_2914DE", + "script": "MagmaHideout_1F_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_1F_RARE_CANDY" }, { diff --git a/data/maps/MagmaHideout_2F_2R/map.json b/data/maps/MagmaHideout_2F_2R/map.json index ef7086bbf..b52d34212 100644 --- a/data/maps/MagmaHideout_2F_2R/map.json +++ b/data/maps/MagmaHideout_2F_2R/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_2F_2R_EventScript_2914EB", + "script": "MagmaHideout_2F_2R_EventScript_MaxElixir", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_2F_2R_MAX_ELIXIR" }, { @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_2F_2R_EventScript_2914F8", + "script": "MagmaHideout_2F_2R_EventScript_ItemFullRestore", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_2F_2R_FULL_RESTORE" } ], diff --git a/data/maps/MagmaHideout_3F_1R/map.json b/data/maps/MagmaHideout_3F_1R/map.json index 67202e748..e3c1bac70 100644 --- a/data/maps/MagmaHideout_3F_1R/map.json +++ b/data/maps/MagmaHideout_3F_1R/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_1R_EventScript_291505", + "script": "MagmaHideout_3F_1R_EventScript_ItemNugget", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_1R_NUGGET" } ], diff --git a/data/maps/MagmaHideout_3F_2R/map.json b/data/maps/MagmaHideout_3F_2R/map.json index bc67b15e5..e4b267858 100644 --- a/data/maps/MagmaHideout_3F_2R/map.json +++ b/data/maps/MagmaHideout_3F_2R/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_2R_EventScript_291512", + "script": "MagmaHideout_3F_2R_EventScript_ItemPPMax", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_2R_PP_MAX" } ], diff --git a/data/maps/MagmaHideout_3F_3R/map.json b/data/maps/MagmaHideout_3F_3R/map.json index 00fc5a46c..6ec900c31 100644 --- a/data/maps/MagmaHideout_3F_3R/map.json +++ b/data/maps/MagmaHideout_3F_3R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_3R_EventScript_29152C", + "script": "MagmaHideout_3F_3R_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_3R_ECAPE_ROPE" } ], diff --git a/data/maps/MagmaHideout_4F/map.json b/data/maps/MagmaHideout_4F/map.json index b627ae1ed..5eebc41d8 100644 --- a/data/maps/MagmaHideout_4F/map.json +++ b/data/maps/MagmaHideout_4F/map.json @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_4F_EventScript_29151F", + "script": "MagmaHideout_4F_EventScript_MaxRevive", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_4F_MAX_REVIVE" } ], diff --git a/data/maps/MauvilleCity/map.json b/data/maps/MauvilleCity/map.json index e44bc78dd..4163f4d9d 100644 --- a/data/maps/MauvilleCity/map.json +++ b/data/maps/MauvilleCity/map.json @@ -149,7 +149,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MauvilleCity_EventScript_2910CE", + "script": "MauvilleCity_EventScript_ItemXSpeed", "flag": "FLAG_ITEM_MAUVILLE_CITY_X_SPEED" }, { diff --git a/data/maps/MeteorFalls_1F_1R/map.json b/data/maps/MeteorFalls_1F_1R/map.json index 586de013f..200c03e86 100644 --- a/data/maps/MeteorFalls_1F_1R/map.json +++ b/data/maps/MeteorFalls_1F_1R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911AB", + "script": "MeteorFalls_1F_1R_EventScript_ItemTM23", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911C5", + "script": "MeteorFalls_1F_1R_EventScript_ItemMoonStone", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911B8", + "script": "MeteorFalls_1F_1R_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL" }, { @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911D2", + "script": "MeteorFalls_1F_1R_EventScript_ItemPPUP", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP" }, { diff --git a/data/maps/MeteorFalls_B1F_2R/map.json b/data/maps/MeteorFalls_B1F_2R/map.json index 7c45bfdd0..8fd3eb4a2 100644 --- a/data/maps/MeteorFalls_B1F_2R/map.json +++ b/data/maps/MeteorFalls_B1F_2R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_B1F_2R_EventScript_2911DF", + "script": "MeteorFalls_B1F_2R_EventScript_ItemTM02", "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02" } ], diff --git a/data/maps/MossdeepCity/map.json b/data/maps/MossdeepCity/map.json index 99d7ae01c..533183a35 100644 --- a/data/maps/MossdeepCity/map.json +++ b/data/maps/MossdeepCity/map.json @@ -105,7 +105,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MossdeepCity_EventScript_2910F5", + "script": "MossdeepCity_EventScript_ItemNetBall", "flag": "FLAG_ITEM_MOSSDEEP_CITY_NET_BALL" }, { diff --git a/data/maps/MtPyre_2F/map.json b/data/maps/MtPyre_2F/map.json index 7a5c4d639..64657cb0d 100644 --- a/data/maps/MtPyre_2F/map.json +++ b/data/maps/MtPyre_2F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_2F_EventScript_2912FD", + "script": "MtPyre_2F_EventScript_ItemUltraBall", "flag": "FLAG_ITEM_MT_PYRE_2F_ULTRA_BALL" }, { diff --git a/data/maps/MtPyre_3F/map.json b/data/maps/MtPyre_3F/map.json index b8684cff9..3e06adf8c 100644 --- a/data/maps/MtPyre_3F/map.json +++ b/data/maps/MtPyre_3F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_3F_EventScript_29130A", + "script": "MtPyre_3F_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_MT_PYRE_3F_SUPER_REPEL" }, { diff --git a/data/maps/MtPyre_4F/map.json b/data/maps/MtPyre_4F/map.json index 59d4dd110..782a6221e 100644 --- a/data/maps/MtPyre_4F/map.json +++ b/data/maps/MtPyre_4F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_4F_EventScript_291317", + "script": "MtPyre_4F_EventScript_ItemSeaIncense", "flag": "FLAG_ITEM_MT_PYRE_4F_SEA_INCENSE" } ], diff --git a/data/maps/MtPyre_5F/map.json b/data/maps/MtPyre_5F/map.json index 1c035bd4d..edd3544ca 100644 --- a/data/maps/MtPyre_5F/map.json +++ b/data/maps/MtPyre_5F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_5F_EventScript_291324", + "script": "MtPyre_5F_EventScript_ItemLaxIncense", "flag": "FLAG_ITEM_MT_PYRE_5F_LAX_INCENSE" } ], diff --git a/data/maps/MtPyre_6F/map.json b/data/maps/MtPyre_6F/map.json index 8f7c4f30f..3c889a7e0 100644 --- a/data/maps/MtPyre_6F/map.json +++ b/data/maps/MtPyre_6F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_6F_EventScript_291331", + "script": "MtPyre_6F_EventScript_ItemTM30", "flag": "FLAG_ITEM_MT_PYRE_6F_TM_30" }, { diff --git a/data/maps/MtPyre_Exterior/map.json b/data/maps/MtPyre_Exterior/map.json index 2a8a5eaff..c7653bbd1 100644 --- a/data/maps/MtPyre_Exterior/map.json +++ b/data/maps/MtPyre_Exterior/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_Exterior_EventScript_29133E", + "script": "MtPyre_Exterior_EventScript_ItemMaxPotion", "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_Exterior_EventScript_29134B", + "script": "MtPyre_Exterior_EventScript_ItemTM48", "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48" } ], diff --git a/data/maps/NewMauville_Entrance/scripts.inc b/data/maps/NewMauville_Entrance/scripts.inc index c3ed930a5..1df4c53e4 100644 --- a/data/maps/NewMauville_Entrance/scripts.inc +++ b/data/maps/NewMauville_Entrance/scripts.inc @@ -1,6 +1,6 @@ NewMauville_Entrance_MapScripts:: @ 82372AD map_script MAP_SCRIPT_ON_LOAD, NewMauville_Entrance_MapScript1_2372B8 - map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_2372FB + map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_SetLandmark .byte 0 NewMauville_Entrance_MapScript1_2372B8: @ 82372B8 @@ -17,7 +17,7 @@ NewMauville_Entrance_EventScript_2372C4:: @ 82372C4 setmetatile 5, 1, 798, 1 return -NewMauville_Entrance_MapScript1_2372FB: @ 82372FB +NewMauville_Entrance_MapScript1_SetLandmark: @ 82372FB setflag FLAG_LANDMARK_NEW_MAUVILLE end diff --git a/data/maps/NewMauville_Inside/map.json b/data/maps/NewMauville_Inside/map.json index b13d6059d..e58588a47 100644 --- a/data/maps/NewMauville_Inside/map.json +++ b/data/maps/NewMauville_Inside/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_2911EC", + "script": "NewMauville_Inside_EventScript_ItemUltraRope", "flag": "FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_2911F9", + "script": "NewMauville_Inside_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291206", + "script": "NewMauville_Inside_EventScript_ItemThunderStone", "flag": "FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291213", + "script": "NewMauville_Inside_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_NEW_MAUVILLE_FULL_HEAL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291220", + "script": "NewMauville_Inside_EventScript_ItemParalyzeHeal", "flag": "FLAG_ITEM_NEW_MAUVILLE_PARALYZE_HEAL" }, { diff --git a/data/maps/PetalburgCity/map.json b/data/maps/PetalburgCity/map.json index 6a9a6b33d..00e89bfa0 100644 --- a/data/maps/PetalburgCity/map.json +++ b/data/maps/PetalburgCity/map.json @@ -100,7 +100,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgCity_EventScript_2910B4", + "script": "PetalburgCity_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_PETALBURG_CITY_MAX_REVIVE" }, { @@ -113,7 +113,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgCity_EventScript_2910C1", + "script": "PetalburgCity_EventScript_ItemEther", "flag": "FLAG_ITEM_PETALBURG_CITY_ETHER" }, { diff --git a/data/maps/PetalburgWoods/map.json b/data/maps/PetalburgWoods/map.json index 4bca7bb5e..6d1bc22a5 100644 --- a/data/maps/PetalburgWoods/map.json +++ b/data/maps/PetalburgWoods/map.json @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_29110F", + "script": "PetalburgWoods_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_PETALBURG_WOODS_GREAT_BALL" }, { @@ -89,7 +89,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_291102", + "script": "PetalburgWoods_EventScript_ItemXAttack", "flag": "FLAG_ITEM_PETALBURG_WOODS_X_ATTACK" }, { @@ -102,7 +102,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_29111C", + "script": "PetalburgWoods_EventScript_ItemEther", "flag": "FLAG_ITEM_PETALBURG_WOODS_ETHER" }, { @@ -167,7 +167,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_291129", + "script": "PetalburgWoods_EventScript_ItemParalyzeHeal", "flag": "FLAG_ITEM_PETALBURD_WOODS_PARALYZE_HEAL" }, { diff --git a/data/maps/Route102/map.json b/data/maps/Route102/map.json index 7a6c6d963..323c4142b 100644 --- a/data/maps/Route102/map.json +++ b/data/maps/Route102/map.json @@ -100,7 +100,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route102_EventScript_290CD8", + "script": "Route102_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_102_POTION" }, { diff --git a/data/maps/Route103/map.json b/data/maps/Route103/map.json index 6516e99dc..91004d1ab 100644 --- a/data/maps/Route103/map.json +++ b/data/maps/Route103/map.json @@ -191,7 +191,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route103_EventScript_290CE5", + "script": "Route103_EventScript_ItemGuardSpec", "flag": "FLAG_ITEM_ROUTE_103_GUARD_SPEC" }, { @@ -282,7 +282,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route103_EventScript_290CF2", + "script": "Route103_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_103_PP_UP" } ], diff --git a/data/maps/Route104/map.json b/data/maps/Route104/map.json index e14a73c29..7bfe6e164 100644 --- a/data/maps/Route104/map.json +++ b/data/maps/Route104/map.json @@ -300,7 +300,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290CFF", + "script": "Route104_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_104_PP_UP" }, { @@ -378,7 +378,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D0C", + "script": "Route104_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_ROUTE_104_POKE_BALL" }, { @@ -404,7 +404,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D19", + "script": "Route104_EventScript_ItemXAccuracy", "flag": "FLAG_ITEM_ROUTE_104_X_ACCURACY" }, { @@ -430,7 +430,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D26", + "script": "Route104_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_104_POTION" }, { diff --git a/data/maps/Route105/map.json b/data/maps/Route105/map.json index b42965229..4d447d4f8 100644 --- a/data/maps/Route105/map.json +++ b/data/maps/Route105/map.json @@ -92,7 +92,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route105_EventScript_290D33", + "script": "Route105_EventScript_ItemIron", "flag": "FLAG_ITEM_ROUTE_105_IRON" }, { diff --git a/data/maps/Route106/map.json b/data/maps/Route106/map.json index 93e98078b..70558d26e 100644 --- a/data/maps/Route106/map.json +++ b/data/maps/Route106/map.json @@ -87,7 +87,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route106_EventScript_290D40", + "script": "Route106_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_106_PROTEIN" } ], diff --git a/data/maps/Route108/map.json b/data/maps/Route108/map.json index bb22c01e3..b8b188637 100644 --- a/data/maps/Route108/map.json +++ b/data/maps/Route108/map.json @@ -113,7 +113,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route108_EventScript_290D4D", + "script": "Route108_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_108_STAR_PIECE" } ], diff --git a/data/maps/Route109/map.json b/data/maps/Route109/map.json index 9bb4d21de..361467266 100644 --- a/data/maps/Route109/map.json +++ b/data/maps/Route109/map.json @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route109_EventScript_290D5A", + "script": "Route109_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_109_PP_UP" }, { @@ -321,7 +321,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route109_EventScript_290D67", + "script": "Route109_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_109_POTION" }, { diff --git a/data/maps/Route109_SeashoreHouse/scripts.inc b/data/maps/Route109_SeashoreHouse/scripts.inc index ed27e32ff..d33113136 100644 --- a/data/maps/Route109_SeashoreHouse/scripts.inc +++ b/data/maps/Route109_SeashoreHouse/scripts.inc @@ -1,8 +1,8 @@ Route109_SeashoreHouse_MapScripts:: @ 82693F4 - map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_2693FA + map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_SetLandmark .byte 0 -Route109_SeashoreHouse_MapScript1_2693FA: @ 82693FA +Route109_SeashoreHouse_MapScript1_SetLandmark: @ 82693FA setflag FLAG_LANDMARK_SEASHORE_HOUSE end diff --git a/data/maps/Route110/map.json b/data/maps/Route110/map.json index a9ac7796a..8cbc93af6 100644 --- a/data/maps/Route110/map.json +++ b/data/maps/Route110/map.json @@ -274,7 +274,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D81", + "script": "Route110_EventScript_ItemDireHit", "flag": "FLAG_ITEM_ROUTE_110_DIRE_HIT" }, { @@ -287,7 +287,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D74", + "script": "Route110_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_109_RARE_CANDY" }, { @@ -482,7 +482,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D8E", + "script": "Route110_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_110_ELIXIR" }, { diff --git a/data/maps/Route110_TrickHousePuzzle1/map.json b/data/maps/Route110_TrickHousePuzzle1/map.json index 849e74b62..c6609d103 100644 --- a/data/maps/Route110_TrickHousePuzzle1/map.json +++ b/data/maps/Route110_TrickHousePuzzle1/map.json @@ -180,7 +180,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle1_EventScript_29140E", + "script": "Route110_TrickHousePuzzle1_EventScript_ItemOrangeMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_1_ORANGE_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle2/map.json b/data/maps/Route110_TrickHousePuzzle2/map.json index 9903231e7..3a9ed637d 100644 --- a/data/maps/Route110_TrickHousePuzzle2/map.json +++ b/data/maps/Route110_TrickHousePuzzle2/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle2_EventScript_291428", + "script": "Route110_TrickHousePuzzle2_EventScript_ItemWaveMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_2_WAVE_MAIL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle2_EventScript_29141B", + "script": "Route110_TrickHousePuzzle2_EventScript_ItemHarborMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_2_HARBOR_MAIL" } ], diff --git a/data/maps/Route110_TrickHousePuzzle3/map.json b/data/maps/Route110_TrickHousePuzzle3/map.json index 22807b80b..e69580793 100644 --- a/data/maps/Route110_TrickHousePuzzle3/map.json +++ b/data/maps/Route110_TrickHousePuzzle3/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle3_EventScript_291442", + "script": "Route110_TrickHousePuzzle3_EventScript_ItemWoodMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_3_WOOD_MAIL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle3_EventScript_291435", + "script": "Route110_TrickHousePuzzle3_EventScript_ItemShadowMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_3_SHADOW_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle4/map.json b/data/maps/Route110_TrickHousePuzzle4/map.json index 542a67aec..47238a559 100644 --- a/data/maps/Route110_TrickHousePuzzle4/map.json +++ b/data/maps/Route110_TrickHousePuzzle4/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle4_EventScript_29144F", + "script": "Route110_TrickHousePuzzle4_EventScript_ItemMechMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_4_MECH_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle6/map.json b/data/maps/Route110_TrickHousePuzzle6/map.json index 144916353..aef182fbb 100644 --- a/data/maps/Route110_TrickHousePuzzle6/map.json +++ b/data/maps/Route110_TrickHousePuzzle6/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle6_EventScript_29145C", + "script": "Route110_TrickHousePuzzle6_EventScript_ItemGlitterMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_6_GLITTER_MAIL" } ], diff --git a/data/maps/Route110_TrickHousePuzzle7/map.json b/data/maps/Route110_TrickHousePuzzle7/map.json index 0263e0848..09fdafbe2 100644 --- a/data/maps/Route110_TrickHousePuzzle7/map.json +++ b/data/maps/Route110_TrickHousePuzzle7/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle7_EventScript_291469", + "script": "Route110_TrickHousePuzzle7_EventScript_ItemTropicMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_7_TROPIC_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle8/map.json b/data/maps/Route110_TrickHousePuzzle8/map.json index f73e60337..b7a06abce 100644 --- a/data/maps/Route110_TrickHousePuzzle8/map.json +++ b/data/maps/Route110_TrickHousePuzzle8/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle8_EventScript_291476", + "script": "Route110_TrickHousePuzzle8_EventScript_ItemBeadMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_8_BEAD_MAIL" } ], diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index ef981272a..d3428f8c6 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -261,7 +261,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290D9B", + "script": "Route111_EventScript_ItemTM37", "flag": "FLAG_ITEM_ROUTE_111_TM_37" }, { @@ -352,7 +352,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DA8", + "script": "Route111_EventScript_ItemStardust", "flag": "FLAG_ITEM_ROUTE_111_STARDUST" }, { @@ -365,7 +365,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DB5", + "script": "Route111_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ROUTE_111_HP_UP" }, { @@ -573,7 +573,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DC2", + "script": "Route111_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_111_ELIXIR" }, { diff --git a/data/maps/Route111_OldLadysRestStop/scripts.inc b/data/maps/Route111_OldLadysRestStop/scripts.inc index 9427e8692..9495c4539 100644 --- a/data/maps/Route111_OldLadysRestStop/scripts.inc +++ b/data/maps/Route111_OldLadysRestStop/scripts.inc @@ -1,8 +1,8 @@ Route111_OldLadysRestStop_MapScripts:: @ 822A916 - map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_22A91C + map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_SetLandmark .byte 0 -Route111_OldLadysRestStop_MapScript1_22A91C: @ 822A91C +Route111_OldLadysRestStop_MapScript1_SetLandmark: @ 822A91C setflag FLAG_LANDMARK_OLD_LADY_REST_SHOP end diff --git a/data/maps/Route112/map.json b/data/maps/Route112/map.json index 8839cc114..b963c6c48 100644 --- a/data/maps/Route112/map.json +++ b/data/maps/Route112/map.json @@ -183,7 +183,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route112_EventScript_290DCF", + "script": "Route112_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_112_NUGGET" }, { diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 1ae33fda7..bcff99de4 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -105,7 +105,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DDC", + "script": "Route113_EventScript_ItemMaxEther", "flag": "FLAG_ITEM_ROUTE_113_MAX_ETHER" }, { @@ -118,7 +118,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DE9", + "script": "Route113_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_ROUTE_113_SUPER_REPEL" }, { @@ -183,7 +183,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DF6", + "script": "Route113_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_113_HYPER_POTION" }, { diff --git a/data/maps/Route114/map.json b/data/maps/Route114/map.json index 9d1002910..08f2996d2 100644 --- a/data/maps/Route114/map.json +++ b/data/maps/Route114/map.json @@ -139,7 +139,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E03", + "script": "Route114_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_114_RARE_CANDY" }, { @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E10", + "script": "Route114_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_114_PROTEIN" }, { @@ -360,7 +360,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E1D", + "script": "Route114_EventScript_ItemEnergyPowder", "flag": "FLAG_ITEM_ROUTE_114_ENERGY_POWDER" }, { diff --git a/data/maps/Route114_FossilManiacsHouse/scripts.inc b/data/maps/Route114_FossilManiacsHouse/scripts.inc index c6b63d8da..d41bc0dee 100644 --- a/data/maps/Route114_FossilManiacsHouse/scripts.inc +++ b/data/maps/Route114_FossilManiacsHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_FossilManiacsHouse_MapScripts:: @ 822AD30 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_22AD36 + map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_SetLandmark .byte 0 -Route114_FossilManiacsHouse_MapScript1_22AD36: @ 822AD36 +Route114_FossilManiacsHouse_MapScript1_SetLandmark: @ 822AD36 setflag FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE end diff --git a/data/maps/Route114_LanettesHouse/scripts.inc b/data/maps/Route114_LanettesHouse/scripts.inc index 1cf7ffb47..5ea42a42a 100644 --- a/data/maps/Route114_LanettesHouse/scripts.inc +++ b/data/maps/Route114_LanettesHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_LanettesHouse_MapScripts:: @ 822B2C8 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_22B2CE + map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_SetLandmark .byte 0 -Route114_LanettesHouse_MapScript1_22B2CE: @ 822B2CE +Route114_LanettesHouse_MapScript1_SetLandmark: @ 822B2CE setflag FLAG_LANDMARK_LANETTES_HOUSE end diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index 1c7603b58..484699ec6 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E2A", + "script": "Route115_EventScript_ItemSuperPotion", "flag": "FLAG_ITEM_ROUTE_115_SUPER_POTION" }, { @@ -165,7 +165,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E37", + "script": "Route115_EventScript_ItemTM01", "flag": "FLAG_ITEM_ROUTE_115_TM_01" }, { @@ -178,7 +178,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E44", + "script": "Route115_EventScript_ItemIron", "flag": "FLAG_ITEM_ROUTE_115_IRON" }, { @@ -230,7 +230,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E51", + "script": "Route115_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_ROUTE_115_GREAT_BALL" }, { @@ -308,7 +308,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E6B", + "script": "Route115_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_115_PP_UP" }, { @@ -321,7 +321,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E5E", + "script": "Route115_EventScript_ItemHealPowder", "flag": "FLAG_ITEM_ROUTE_115_HEAL_POWDER" } ], diff --git a/data/maps/Route116/map.json b/data/maps/Route116/map.json index 27eb381d0..0745af08c 100644 --- a/data/maps/Route116/map.json +++ b/data/maps/Route116/map.json @@ -113,7 +113,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E85", + "script": "Route116_EventScript_ItemEther", "flag": "FLAG_ITEM_ROUTE_116_ETHER" }, { @@ -126,7 +126,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E92", + "script": "Route116_EventScript_ItemRepel", "flag": "FLAG_ITEM_ROUTE_116_REPEL" }, { @@ -217,7 +217,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E9F", + "script": "Route116_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ROUTE_116_HP_UP" }, { @@ -282,7 +282,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E78", + "script": "Route116_EventScript_ItemXSpecial", "flag": "FLAG_ITEM_ROUTE_116_X_SPECIAL" }, { @@ -347,7 +347,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290EAC", + "script": "Route116_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_116_POTION" }, { diff --git a/data/maps/Route116_TunnelersRestHouse/scripts.inc b/data/maps/Route116_TunnelersRestHouse/scripts.inc index bdd22aadd..f9ebcc76a 100644 --- a/data/maps/Route116_TunnelersRestHouse/scripts.inc +++ b/data/maps/Route116_TunnelersRestHouse/scripts.inc @@ -1,8 +1,8 @@ Route116_TunnelersRestHouse_MapScripts:: @ 822B850 - map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_22B856 + map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_SetLandmark .byte 0 -Route116_TunnelersRestHouse_MapScript1_22B856: @ 822B856 +Route116_TunnelersRestHouse_MapScript1_SetLandmark: @ 822B856 setflag FLAG_LANDMARK_TUNNELERS_REST_HOUSE end diff --git a/data/maps/Route117/map.json b/data/maps/Route117/map.json index c4cb4d5e5..efaad2802 100644 --- a/data/maps/Route117/map.json +++ b/data/maps/Route117/map.json @@ -204,7 +204,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_EventScript_290EB9", + "script": "Route117_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_ROUTE_117_GREAT_BALL" }, { @@ -230,7 +230,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_EventScript_290EC6", + "script": "Route117_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_117_REVIVE" }, { diff --git a/data/maps/Route117_PokemonDayCare/scripts.inc b/data/maps/Route117_PokemonDayCare/scripts.inc index ea9894ffc..b9ddfaa5a 100644 --- a/data/maps/Route117_PokemonDayCare/scripts.inc +++ b/data/maps/Route117_PokemonDayCare/scripts.inc @@ -1,8 +1,8 @@ Route117_PokemonDayCare_MapScripts:: @ 822BBB1 - map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_22BBB7 + map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_SetLandmark .byte 0 -Route117_PokemonDayCare_MapScript1_22BBB7: @ 822BBB7 +Route117_PokemonDayCare_MapScript1_SetLandmark: @ 822BBB7 setflag FLAG_LANDMARK_POKEMON_DAYCARE end diff --git a/data/maps/Route118/map.json b/data/maps/Route118/map.json index 7fc1e45c7..0a3fee210 100644 --- a/data/maps/Route118/map.json +++ b/data/maps/Route118/map.json @@ -287,7 +287,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route118_EventScript_290ED3", + "script": "Route118_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_118_HYPER_POTION" }, { diff --git a/data/maps/Route119/map.json b/data/maps/Route119/map.json index 2146d5ec7..c84ff9db1 100644 --- a/data/maps/Route119/map.json +++ b/data/maps/Route119/map.json @@ -243,7 +243,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EE0", + "script": "Route119_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_ROUTE_119_SUPER_REPEL" }, { @@ -256,7 +256,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EED", + "script": "Route119_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_119_ZINC" }, { @@ -269,7 +269,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EFA", + "script": "Route119_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_119_ELIXIR_1" }, { @@ -282,7 +282,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F07", + "script": "Route119_EventScript_ItemLeafStone", "flag": "FLAG_ITEM_ROUTE_119_LEAF_STONE" }, { @@ -295,7 +295,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F14", + "script": "Route119_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_119_RARE_CANDY" }, { @@ -308,7 +308,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F21", + "script": "Route119_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_119_HYPER_POTION_1" }, { @@ -438,7 +438,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F2E", + "script": "Route119_EventScript_ItemHyperPotion2", "flag": "FLAG_ITEM_ROUTE_119_HYPER_POTION_2" }, { @@ -555,7 +555,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_291399", + "script": "Route119_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_119_NUGGET" }, { @@ -568,7 +568,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F3B", + "script": "Route119_EventScript_ItemElixir2", "flag": "FLAG_ITEM_ROUTE_119_ELIXIR_2" }, { diff --git a/data/maps/Route120/map.json b/data/maps/Route120/map.json index 63585f86f..1bdbd0bca 100644 --- a/data/maps/Route120/map.json +++ b/data/maps/Route120/map.json @@ -230,7 +230,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F48", + "script": "Route120_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_120_NUGGET" }, { @@ -308,7 +308,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F55", + "script": "Route120_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_ROUTE_120_FULL_HEAL" }, { @@ -386,7 +386,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F6F", + "script": "Route120_EventScript_ItemNestBall", "flag": "FLAG_ITEM_ROUTE_120_NEST_BALL" }, { @@ -399,7 +399,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F62", + "script": "Route120_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_120_HYPER_POTION" }, { @@ -594,7 +594,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F7C", + "script": "Route120_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_120_REVIVE" } ], diff --git a/data/maps/Route121/map.json b/data/maps/Route121/map.json index 4339b149d..f1152b465 100644 --- a/data/maps/Route121/map.json +++ b/data/maps/Route121/map.json @@ -300,7 +300,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290F89", + "script": "Route121_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_121_CARBOS" }, { @@ -391,7 +391,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290F96", + "script": "Route121_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_121_REVIVE" }, { @@ -404,7 +404,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290FA3", + "script": "Route121_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_121_ZINC" } ], diff --git a/data/maps/Route123/map.json b/data/maps/Route123/map.json index 6562fa7a9..1e562420d 100644 --- a/data/maps/Route123/map.json +++ b/data/maps/Route123/map.json @@ -295,7 +295,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FB0", + "script": "Route123_EventScript_ItemCalcium", "flag": "FLAG_ITEM_ROUTE_123_CALCIUM" }, { @@ -438,7 +438,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FBD", + "script": "Route123_EventScript_ItemUltraBall", "flag": "FLAG_ITEM_ROUTE_123_ULTRA_BALL" }, { @@ -451,7 +451,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FCA", + "script": "Route123_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_123_ELIXIR" }, { @@ -542,7 +542,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FD7", + "script": "Route123_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_123_PP_UP" }, { @@ -581,7 +581,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FE4", + "script": "Route123_EventScript_ItemRevivalHerb", "flag": "FLAG_ITEM_ROUTE_123_REVIVAL_HERB" } ], diff --git a/data/maps/Route123_BerryMastersHouse/scripts.inc b/data/maps/Route123_BerryMastersHouse/scripts.inc index 31158782d..0f0326119 100644 --- a/data/maps/Route123_BerryMastersHouse/scripts.inc +++ b/data/maps/Route123_BerryMastersHouse/scripts.inc @@ -1,8 +1,8 @@ Route123_BerryMastersHouse_MapScripts:: @ 826F83B - map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_26F841 + map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_SetLandmark .byte 0 -Route123_BerryMastersHouse_MapScript1_26F841: @ 826F841 +Route123_BerryMastersHouse_MapScript1_SetLandmark: @ 826F841 setflag FLAG_LANDMARK_BERRY_MASTERS_HOUSE end diff --git a/data/maps/Route124/map.json b/data/maps/Route124/map.json index c1a22a2d0..913208954 100644 --- a/data/maps/Route124/map.json +++ b/data/maps/Route124/map.json @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_290FF1", + "script": "Route124_EventScript_ItemRedShard", "flag": "FLAG_ITEM_ROUTE_124_RED_SHARD" }, { @@ -128,7 +128,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_290FFE", + "script": "Route124_EventScript_ItemBlueShard", "flag": "FLAG_ITEM_ROUTE_124_BLUE_SHARD" }, { @@ -141,7 +141,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_29100B", + "script": "Route124_EventScript_ItemYellowShard", "flag": "FLAG_ITEM_ROUTE_124_YELLOW_SHARD" }, { diff --git a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc index 250a5ba51..a1b7527a1 100644 --- a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc +++ b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc @@ -1,8 +1,8 @@ Route124_DivingTreasureHuntersHouse_MapScripts:: @ 8270A28 - map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_270A2E + map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark .byte 0 -Route124_DivingTreasureHuntersHouse_MapScript1_270A2E: @ 8270A2E +Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark: @ 8270A2E setflag FLAG_LANDMARK_HUNTERS_HOUSE end diff --git a/data/maps/Route125/map.json b/data/maps/Route125/map.json index 0ce520fdd..27615a521 100644 --- a/data/maps/Route125/map.json +++ b/data/maps/Route125/map.json @@ -157,7 +157,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route125_EventScript_291018", + "script": "Route125_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_ROUTE_125_BIG_PEARL" } ], diff --git a/data/maps/Route126/map.json b/data/maps/Route126/map.json index ea63eb80d..b8359bd84 100644 --- a/data/maps/Route126/map.json +++ b/data/maps/Route126/map.json @@ -92,7 +92,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route126_EventScript_291025", + "script": "Route126_EventScript_ItemGreenShard", "flag": "FLAG_ITEM_ROUTE_126_GREEN_SHARD" }, { diff --git a/data/maps/Route127/map.json b/data/maps/Route127/map.json index e4a68c3e1..08d39d971 100644 --- a/data/maps/Route127/map.json +++ b/data/maps/Route127/map.json @@ -71,7 +71,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_291032", + "script": "Route127_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_127_ZINC" }, { @@ -84,7 +84,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_29103F", + "script": "Route127_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_127_CARBOS" }, { @@ -175,7 +175,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_29104C", + "script": "Route127_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_127_RARE_CANDY" } ], diff --git a/data/maps/Route132/map.json b/data/maps/Route132/map.json index 15c0de83d..8a7597826 100644 --- a/data/maps/Route132/map.json +++ b/data/maps/Route132/map.json @@ -61,7 +61,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route132_EventScript_291059", + "script": "Route132_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_132_RARE_CANDY" }, { @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route132_EventScript_291066", + "script": "Route132_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_132_PROTEIN" } ], diff --git a/data/maps/Route133/map.json b/data/maps/Route133/map.json index eed30d7ee..8622515f0 100644 --- a/data/maps/Route133/map.json +++ b/data/maps/Route133/map.json @@ -74,7 +74,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_291073", + "script": "Route133_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_ROUTE_133_BIG_PEARL" }, { @@ -87,7 +87,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_291080", + "script": "Route133_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_133_STAR_PIECE" }, { @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_29108D", + "script": "Route133_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_ROUTE_133_MAX_REVIVE" } ], diff --git a/data/maps/Route134/map.json b/data/maps/Route134/map.json index 8b3a9518e..e45920576 100644 --- a/data/maps/Route134/map.json +++ b/data/maps/Route134/map.json @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route134_EventScript_29109A", + "script": "Route134_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_134_CARBOS" }, { @@ -165,7 +165,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route134_EventScript_2910A7", + "script": "Route134_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_134_STAR_PIECE" } ], diff --git a/data/maps/RustboroCity/map.json b/data/maps/RustboroCity/map.json index 04c68baa3..94e22985b 100644 --- a/data/maps/RustboroCity/map.json +++ b/data/maps/RustboroCity/map.json @@ -183,7 +183,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RustboroCity_EventScript_2910DB", + "script": "RustboroCity_EventScript_ItemXDefend", "flag": "FLAG_ITEM_RUSTBORO_CITY_X_DEFEND" }, { diff --git a/data/maps/RusturfTunnel/map.json b/data/maps/RusturfTunnel/map.json index b873c76c8..9fc378729 100644 --- a/data/maps/RusturfTunnel/map.json +++ b/data/maps/RusturfTunnel/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RusturfTunnel_EventScript_291136", + "script": "RusturfTunnel_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_RUSTURF_TUNNEL_POKE_BALL" }, { @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RusturfTunnel_EventScript_291143", + "script": "RusturfTunnel_EventScript_ItemMaxEther", "flag": "FLAG_ITEM_RUSTURF_TUNNEL_MAX_ETHER" }, { diff --git a/data/maps/SafariZone_North/map.json b/data/maps/SafariZone_North/map.json index 7c637f0ef..967e55f3e 100644 --- a/data/maps/SafariZone_North/map.json +++ b/data/maps/SafariZone_North/map.json @@ -144,7 +144,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_North_EventScript_2912C9", + "script": "SafariZone_North_EventScript_ItemCalcium", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_CALCIUM" } ], diff --git a/data/maps/SafariZone_Northeast/map.json b/data/maps/SafariZone_Northeast/map.json index 8e3337f53..94c2c268f 100644 --- a/data/maps/SafariZone_Northeast/map.json +++ b/data/maps/SafariZone_Northeast/map.json @@ -139,7 +139,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Northeast_EventScript_2912E3", + "script": "SafariZone_Northeast_EventScript_ItemNugget", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_EAST_NUGGET" } ], diff --git a/data/maps/SafariZone_Northwest/map.json b/data/maps/SafariZone_Northwest/map.json index 2d3a1fa49..6ead6d714 100644 --- a/data/maps/SafariZone_Northwest/map.json +++ b/data/maps/SafariZone_Northwest/map.json @@ -48,7 +48,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Northwest_EventScript_2912BC", + "script": "SafariZone_Northwest_EventScript_ItemTM22", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22" } ], diff --git a/data/maps/SafariZone_Southeast/map.json b/data/maps/SafariZone_Southeast/map.json index 3ace62488..cb293b149 100644 --- a/data/maps/SafariZone_Southeast/map.json +++ b/data/maps/SafariZone_Southeast/map.json @@ -74,7 +74,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Southeast_EventScript_2912F0", + "script": "SafariZone_Southeast_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_SAFARI_ZONE_SOUTH_EAST_BIG_PEARL" }, { diff --git a/data/maps/SafariZone_Southwest/map.json b/data/maps/SafariZone_Southwest/map.json index 5e383a694..3784db801 100644 --- a/data/maps/SafariZone_Southwest/map.json +++ b/data/maps/SafariZone_Southwest/map.json @@ -48,7 +48,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Southwest_EventScript_2912D6", + "script": "SafariZone_Southwest_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_SAFARI_ZONE_SOUTH_WEST_MAX_REVIVE" } ], diff --git a/data/maps/ScorchedSlab/map.json b/data/maps/ScorchedSlab/map.json index 304ebd676..5abcf9adf 100644 --- a/data/maps/ScorchedSlab/map.json +++ b/data/maps/ScorchedSlab/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ScorchedSlab_EventScript_2912AF", + "script": "ScorchedSlab_EventScript_ItemTM11", "flag": "FLAG_ITEM_SCORCHED_SLAB_TM_11" } ], diff --git a/data/maps/ScorchedSlab/scripts.inc b/data/maps/ScorchedSlab/scripts.inc index 62a546780..3d6aa1cfe 100644 --- a/data/maps/ScorchedSlab/scripts.inc +++ b/data/maps/ScorchedSlab/scripts.inc @@ -1,8 +1,8 @@ ScorchedSlab_MapScripts:: @ 8239291 - map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_239297 + map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_SetLandmark .byte 0 -ScorchedSlab_MapScript1_239297: @ 8239297 +ScorchedSlab_MapScript1_SetLandmark: @ 8239297 setflag FLAG_LANDMARK_SCORCHED_SLAB end diff --git a/data/maps/SeafloorCavern_Room9/map.json b/data/maps/SeafloorCavern_Room9/map.json index f4f7fd336..77dcdc169 100644 --- a/data/maps/SeafloorCavern_Room9/map.json +++ b/data/maps/SeafloorCavern_Room9/map.json @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SeafloorCavern_Room9_EventScript_291401", + "script": "SeafloorCavern_Room9_EventScript_ItemTM26", "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26" }, { diff --git a/data/maps/SealedChamber_OuterRoom/scripts.inc b/data/maps/SealedChamber_OuterRoom/scripts.inc index 71e6426fe..f0337548e 100644 --- a/data/maps/SealedChamber_OuterRoom/scripts.inc +++ b/data/maps/SealedChamber_OuterRoom/scripts.inc @@ -1,6 +1,6 @@ SealedChamber_OuterRoom_MapScripts:: @ 8239106 map_script MAP_SCRIPT_ON_RESUME, SealedChamber_OuterRoom_MapScript1_239116 - map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_239127 + map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_SetLandmark map_script MAP_SCRIPT_ON_LOAD, SealedChamber_OuterRoom_MapScript1_23912B .byte 0 @@ -9,7 +9,7 @@ SealedChamber_OuterRoom_MapScript1_239116: @ 8239116 setescapewarp MAP_UNDERWATER_SEALED_CHAMBER, 255, 12, 44 end -SealedChamber_OuterRoom_MapScript1_239127: @ 8239127 +SealedChamber_OuterRoom_MapScript1_SetLandmark: @ 8239127 setflag FLAG_LANDMARK_SEALED_CHAMBER end diff --git a/data/maps/ShoalCave_LowTideEntranceRoom/map.json b/data/maps/ShoalCave_LowTideEntranceRoom/map.json index 1ebb9f555..4b5d23110 100644 --- a/data/maps/ShoalCave_LowTideEntranceRoom/map.json +++ b/data/maps/ShoalCave_LowTideEntranceRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideEntranceRoom_EventScript_2913C0", + "script": "ShoalCave_LowTideEntranceRoom_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL" }, { diff --git a/data/maps/ShoalCave_LowTideIceRoom/map.json b/data/maps/ShoalCave_LowTideIceRoom/map.json index dffef7da9..d2f69b51f 100644 --- a/data/maps/ShoalCave_LowTideIceRoom/map.json +++ b/data/maps/ShoalCave_LowTideIceRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideIceRoom_EventScript_2913E7", + "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07", "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07" }, { @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideIceRoom_EventScript_2913F4", + "script": "ShoalCave_LowTideIceRoom_EventScript_ItemNeverMeltIce", "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE" } ], diff --git a/data/maps/ShoalCave_LowTideInnerRoom/map.json b/data/maps/ShoalCave_LowTideInnerRoom/map.json index 04e4ec67f..f9eec06c4 100644 --- a/data/maps/ShoalCave_LowTideInnerRoom/map.json +++ b/data/maps/ShoalCave_LowTideInnerRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideInnerRoom_EventScript_2913CD", + "script": "ShoalCave_LowTideInnerRoom_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY" } ], diff --git a/data/maps/ShoalCave_LowTideStairsRoom/map.json b/data/maps/ShoalCave_LowTideStairsRoom/map.json index 239effc74..4da33c163 100644 --- a/data/maps/ShoalCave_LowTideStairsRoom/map.json +++ b/data/maps/ShoalCave_LowTideStairsRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideStairsRoom_EventScript_2913DA", + "script": "ShoalCave_LowTideStairsRoom_EventScript_ItemIceHeal", "flag": "FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL" } ], diff --git a/data/maps/SkyPillar_Entrance/scripts.inc b/data/maps/SkyPillar_Entrance/scripts.inc index 40d57a485..7b5434eff 100644 --- a/data/maps/SkyPillar_Entrance/scripts.inc +++ b/data/maps/SkyPillar_Entrance/scripts.inc @@ -1,8 +1,8 @@ SkyPillar_Entrance_MapScripts:: @ 823929E - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_2392A4 + map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_SetLandmark .byte 0 -SkyPillar_Entrance_MapScript1_2392A4: @ 82392A4 +SkyPillar_Entrance_MapScript1_SetLandmark: @ 82392A4 setflag FLAG_LANDMARK_SKY_PILLAR end diff --git a/data/maps/SouthernIsland_Exterior/scripts.inc b/data/maps/SouthernIsland_Exterior/scripts.inc index 618ce864a..84406d111 100644 --- a/data/maps/SouthernIsland_Exterior/scripts.inc +++ b/data/maps/SouthernIsland_Exterior/scripts.inc @@ -1,8 +1,8 @@ SouthernIsland_Exterior_MapScripts:: @ 82429C8 - map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_2429CE + map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_SetLandmark .byte 0 -SouthernIsland_Exterior_MapScript1_2429CE: @ 82429CE +SouthernIsland_Exterior_MapScript1_SetLandmark: @ 82429CE setflag FLAG_LANDMARK_SOUTHERN_ISLAND end diff --git a/data/maps/VictoryRoad_1F/map.json b/data/maps/VictoryRoad_1F/map.json index 05eb2b795..8685f3341 100644 --- a/data/maps/VictoryRoad_1F/map.json +++ b/data/maps/VictoryRoad_1F/map.json @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_1F_EventScript_291483", + "script": "VictoryRoad_1F_EventScript_ItemMaxElixir", "flag": "FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR" }, { @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_1F_EventScript_291490", + "script": "VictoryRoad_1F_EventScript_ItemPPUp", "flag": "FLAG_ITEM_VICTORY_ROAD_1F_PP_UP" }, { diff --git a/data/maps/VictoryRoad_B1F/map.json b/data/maps/VictoryRoad_B1F/map.json index 2fde10090..74bd3dbf8 100644 --- a/data/maps/VictoryRoad_B1F/map.json +++ b/data/maps/VictoryRoad_B1F/map.json @@ -245,7 +245,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B1F_EventScript_29149D", + "script": "VictoryRoad_B1F_EventScript_ItemTM29", "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_29" }, { @@ -258,7 +258,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B1F_EventScript_2914AA", + "script": "VictoryRoad_B1F_EventScript_ItemFullRestore", "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE" }, { diff --git a/data/maps/VictoryRoad_B2F/map.json b/data/maps/VictoryRoad_B2F/map.json index fd9195ed4..de10ef891 100644 --- a/data/maps/VictoryRoad_B2F/map.json +++ b/data/maps/VictoryRoad_B2F/map.json @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B2F_EventScript_2914B7", + "script": "VictoryRoad_B2F_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL" }, { diff --git a/data/scripts/item_ball_scripts.inc b/data/scripts/item_ball_scripts.inc index 2b0083175..045fbb5a7 100644 --- a/data/scripts/item_ball_scripts.inc +++ b/data/scripts/item_ball_scripts.inc @@ -1,659 +1,659 @@ -Route102_EventScript_290CD8:: @ 8290CD8 +Route102_EventScript_ItemPotion:: @ 8290CD8 giveitem_std ITEM_POTION, 1, 1 end -Route103_EventScript_290CE5:: @ 8290CE5 +Route103_EventScript_ItemGuardSpec:: @ 8290CE5 giveitem_std ITEM_GUARD_SPEC, 1, 1 end -Route103_EventScript_290CF2:: @ 8290CF2 +Route103_EventScript_ItemPPUp:: @ 8290CF2 giveitem_std ITEM_PP_UP, 1, 1 end -Route104_EventScript_290CFF:: @ 8290CFF +Route104_EventScript_ItemPPUp:: @ 8290CFF giveitem_std ITEM_PP_UP, 1, 1 end -Route104_EventScript_290D0C:: @ 8290D0C +Route104_EventScript_ItemPokeBall:: @ 8290D0C giveitem_std ITEM_POKE_BALL, 1, 1 end -Route104_EventScript_290D19:: @ 8290D19 +Route104_EventScript_ItemXAccuracy:: @ 8290D19 giveitem_std ITEM_X_ACCURACY, 1, 1 end -Route104_EventScript_290D26:: @ 8290D26 +Route104_EventScript_ItemPotion:: @ 8290D26 giveitem_std ITEM_POTION, 1, 1 end -Route105_EventScript_290D33:: @ 8290D33 +Route105_EventScript_ItemIron:: @ 8290D33 giveitem_std ITEM_IRON, 1, 1 end -Route106_EventScript_290D40:: @ 8290D40 +Route106_EventScript_ItemProtein:: @ 8290D40 giveitem_std ITEM_PROTEIN, 1, 1 end -Route108_EventScript_290D4D:: @ 8290D4D +Route108_EventScript_ItemStarPiece:: @ 8290D4D giveitem_std ITEM_STAR_PIECE, 1, 1 end -Route109_EventScript_290D5A:: @ 8290D5A +Route109_EventScript_ItemPPUp:: @ 8290D5A giveitem_std ITEM_PP_UP, 1, 1 end -Route109_EventScript_290D67:: @ 8290D67 +Route109_EventScript_ItemPotion:: @ 8290D67 giveitem_std ITEM_POTION, 1, 1 end -Route110_EventScript_290D74:: @ 8290D74 +Route110_EventScript_ItemRareCandy:: @ 8290D74 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route110_EventScript_290D81:: @ 8290D81 +Route110_EventScript_ItemDireHit:: @ 8290D81 giveitem_std ITEM_DIRE_HIT, 1, 1 end -Route110_EventScript_290D8E:: @ 8290D8E +Route110_EventScript_ItemElixir:: @ 8290D8E giveitem_std ITEM_ELIXIR, 1, 1 end -Route111_EventScript_290D9B:: @ 8290D9B +Route111_EventScript_ItemTM37:: @ 8290D9B giveitem_std ITEM_TM37, 1, 1 end -Route111_EventScript_290DA8:: @ 8290DA8 +Route111_EventScript_ItemStardust:: @ 8290DA8 giveitem_std ITEM_STARDUST, 1, 1 end -Route111_EventScript_290DB5:: @ 8290DB5 +Route111_EventScript_ItemHPUp:: @ 8290DB5 giveitem_std ITEM_HP_UP, 1, 1 end -Route111_EventScript_290DC2:: @ 8290DC2 +Route111_EventScript_ItemElixir:: @ 8290DC2 giveitem_std ITEM_ELIXIR, 1, 1 end -Route112_EventScript_290DCF:: @ 8290DCF +Route112_EventScript_ItemNugget:: @ 8290DCF giveitem_std ITEM_NUGGET, 1, 1 end -Route113_EventScript_290DDC:: @ 8290DDC +Route113_EventScript_ItemMaxEther:: @ 8290DDC giveitem_std ITEM_MAX_ETHER, 1, 1 end -Route113_EventScript_290DE9:: @ 8290DE9 +Route113_EventScript_ItemSuperRepel:: @ 8290DE9 giveitem_std ITEM_SUPER_REPEL, 1, 1 end -Route113_EventScript_290DF6:: @ 8290DF6 +Route113_EventScript_ItemHyperPotion:: @ 8290DF6 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route114_EventScript_290E03:: @ 8290E03 +Route114_EventScript_ItemRareCandy:: @ 8290E03 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route114_EventScript_290E10:: @ 8290E10 +Route114_EventScript_ItemProtein:: @ 8290E10 giveitem_std ITEM_PROTEIN, 1, 1 end -Route114_EventScript_290E1D:: @ 8290E1D +Route114_EventScript_ItemEnergyPowder:: @ 8290E1D giveitem_std ITEM_ENERGY_POWDER, 1, 1 end -Route115_EventScript_290E2A:: @ 8290E2A +Route115_EventScript_ItemSuperPotion:: @ 8290E2A giveitem_std ITEM_SUPER_POTION, 1, 1 end -Route115_EventScript_290E37:: @ 8290E37 +Route115_EventScript_ItemTM01:: @ 8290E37 giveitem_std ITEM_TM01, 1, 1 end -Route115_EventScript_290E44:: @ 8290E44 +Route115_EventScript_ItemIron:: @ 8290E44 giveitem_std ITEM_IRON, 1, 1 end -Route115_EventScript_290E51:: @ 8290E51 +Route115_EventScript_ItemGreatBall:: @ 8290E51 giveitem_std ITEM_GREAT_BALL, 1, 1 end -Route115_EventScript_290E5E:: @ 8290E5E +Route115_EventScript_ItemHealPowder:: @ 8290E5E giveitem_std ITEM_HEAL_POWDER, 1, 1 end -Route115_EventScript_290E6B:: @ 8290E6B +Route115_EventScript_ItemPPUp:: @ 8290E6B giveitem_std ITEM_PP_UP, 1, 1 end -Route116_EventScript_290E78:: @ 8290E78 +Route116_EventScript_ItemXSpecial:: @ 8290E78 giveitem_std ITEM_X_SPECIAL, 1, 1 end -Route116_EventScript_290E85:: @ 8290E85 +Route116_EventScript_ItemEther:: @ 8290E85 giveitem_std ITEM_ETHER, 1, 1 end -Route116_EventScript_290E92:: @ 8290E92 +Route116_EventScript_ItemRepel:: @ 8290E92 giveitem_std ITEM_REPEL, 1, 1 end -Route116_EventScript_290E9F:: @ 8290E9F +Route116_EventScript_ItemHPUp:: @ 8290E9F giveitem_std ITEM_HP_UP, 1, 1 end -Route116_EventScript_290EAC:: @ 8290EAC +Route116_EventScript_ItemPotion:: @ 8290EAC giveitem_std ITEM_POTION, 1, 1 end -Route117_EventScript_290EB9:: @ 8290EB9 +Route117_EventScript_ItemGreatBall:: @ 8290EB9 giveitem_std ITEM_GREAT_BALL, 1, 1 end -Route117_EventScript_290EC6:: @ 8290EC6 +Route117_EventScript_ItemRevive:: @ 8290EC6 giveitem_std ITEM_REVIVE, 1, 1 end -Route118_EventScript_290ED3:: @ 8290ED3 +Route118_EventScript_ItemHyperPotion:: @ 8290ED3 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290EE0:: @ 8290EE0 +Route119_EventScript_ItemSuperRepel:: @ 8290EE0 giveitem_std ITEM_SUPER_REPEL, 1, 1 end -Route119_EventScript_290EED:: @ 8290EED +Route119_EventScript_ItemZinc:: @ 8290EED giveitem_std ITEM_ZINC, 1, 1 end -Route119_EventScript_290EFA:: @ 8290EFA +Route119_EventScript_ItemElixir:: @ 8290EFA giveitem_std ITEM_ELIXIR, 1, 1 end -Route119_EventScript_290F07:: @ 8290F07 +Route119_EventScript_ItemLeafStone:: @ 8290F07 giveitem_std ITEM_LEAF_STONE, 1, 1 end -Route119_EventScript_290F14:: @ 8290F14 +Route119_EventScript_ItemRareCandy:: @ 8290F14 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route119_EventScript_290F21:: @ 8290F21 +Route119_EventScript_ItemHyperPotion:: @ 8290F21 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290F2E:: @ 8290F2E +Route119_EventScript_ItemHyperPotion2:: @ 8290F2E giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290F3B:: @ 8290F3B +Route119_EventScript_ItemElixir2:: @ 8290F3B giveitem_std ITEM_ELIXIR, 1, 1 end -Route120_EventScript_290F48:: @ 8290F48 +Route120_EventScript_ItemNugget:: @ 8290F48 giveitem_std ITEM_NUGGET, 1, 1 end -Route120_EventScript_290F55:: @ 8290F55 +Route120_EventScript_ItemFullHeal:: @ 8290F55 giveitem_std ITEM_FULL_HEAL, 1, 1 end -Route120_EventScript_290F62:: @ 8290F62 +Route120_EventScript_ItemHyperPotion:: @ 8290F62 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route120_EventScript_290F6F:: @ 8290F6F +Route120_EventScript_ItemNestBall:: @ 8290F6F giveitem_std ITEM_NEST_BALL, 1, 1 end -Route120_EventScript_290F7C:: @ 8290F7C +Route120_EventScript_ItemRevive:: @ 8290F7C giveitem_std ITEM_REVIVE, 1, 1 end -Route121_EventScript_290F89:: @ 8290F89 +Route121_EventScript_ItemCarbos:: @ 8290F89 giveitem_std ITEM_CARBOS, 1, 1 end -Route121_EventScript_290F96:: @ 8290F96 +Route121_EventScript_ItemRevive:: @ 8290F96 giveitem_std ITEM_REVIVE, 1, 1 end -Route121_EventScript_290FA3:: @ 8290FA3 +Route121_EventScript_ItemZinc:: @ 8290FA3 giveitem_std ITEM_ZINC, 1, 1 end -Route123_EventScript_290FB0:: @ 8290FB0 +Route123_EventScript_ItemCalcium:: @ 8290FB0 giveitem_std ITEM_CALCIUM, 1, 1 end -Route123_EventScript_290FBD:: @ 8290FBD +Route123_EventScript_ItemUltraBall:: @ 8290FBD giveitem_std ITEM_ULTRA_BALL, 1, 1 end -Route123_EventScript_290FCA:: @ 8290FCA +Route123_EventScript_ItemElixir:: @ 8290FCA giveitem_std ITEM_ELIXIR, 1, 1 end -Route123_EventScript_290FD7:: @ 8290FD7 +Route123_EventScript_ItemPPUp:: @ 8290FD7 giveitem_std ITEM_PP_UP, 1, 1 end -Route123_EventScript_290FE4:: @ 8290FE4 +Route123_EventScript_ItemRevivalHerb:: @ 8290FE4 giveitem_std ITEM_REVIVAL_HERB, 1, 1 end -Route124_EventScript_290FF1:: @ 8290FF1 +Route124_EventScript_ItemRedShard:: @ 8290FF1 giveitem_std ITEM_RED_SHARD, 1, 1 end -Route124_EventScript_290FFE:: @ 8290FFE +Route124_EventScript_ItemBlueShard:: @ 8290FFE giveitem_std ITEM_BLUE_SHARD, 1, 1 end -Route124_EventScript_29100B:: @ 829100B +Route124_EventScript_ItemYellowShard:: @ 829100B giveitem_std ITEM_YELLOW_SHARD, 1, 1 end -Route125_EventScript_291018:: @ 8291018 +Route125_EventScript_ItemBigPearl:: @ 8291018 giveitem_std ITEM_BIG_PEARL, 1, 1 end -Route126_EventScript_291025:: @ 8291025 +Route126_EventScript_ItemGreenShard:: @ 8291025 giveitem_std ITEM_GREEN_SHARD, 1, 1 end -Route127_EventScript_291032:: @ 8291032 +Route127_EventScript_ItemZinc:: @ 8291032 giveitem_std ITEM_ZINC, 1, 1 end -Route127_EventScript_29103F:: @ 829103F +Route127_EventScript_ItemCarbos:: @ 829103F giveitem_std ITEM_CARBOS, 1, 1 end -Route127_EventScript_29104C:: @ 829104C +Route127_EventScript_ItemRareCandy:: @ 829104C giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route132_EventScript_291059:: @ 8291059 +Route132_EventScript_ItemRareCandy:: @ 8291059 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route132_EventScript_291066:: @ 8291066 +Route132_EventScript_ItemProtein:: @ 8291066 giveitem_std ITEM_PROTEIN, 1, 1 end -Route133_EventScript_291073:: @ 8291073 +Route133_EventScript_ItemBigPearl:: @ 8291073 giveitem_std ITEM_BIG_PEARL, 1, 1 end -Route133_EventScript_291080:: @ 8291080 +Route133_EventScript_ItemStarPiece:: @ 8291080 giveitem_std ITEM_STAR_PIECE, 1, 1 end -Route133_EventScript_29108D:: @ 829108D +Route133_EventScript_ItemMaxRevive:: @ 829108D giveitem_std ITEM_MAX_REVIVE, 1, 1 end -Route134_EventScript_29109A:: @ 829109A +Route134_EventScript_ItemCarbos:: @ 829109A giveitem_std ITEM_CARBOS, 1, 1 end -Route134_EventScript_2910A7:: @ 82910A7 +Route134_EventScript_ItemStarPiece:: @ 82910A7 giveitem_std ITEM_STAR_PIECE, 1, 1 end -PetalburgCity_EventScript_2910B4:: @ 82910B4 +PetalburgCity_EventScript_ItemMaxRevive:: @ 82910B4 giveitem_std ITEM_MAX_REVIVE, 1, 1 end -PetalburgCity_EventScript_2910C1:: @ 82910C1 +PetalburgCity_EventScript_ItemEther:: @ 82910C1 giveitem_std ITEM_ETHER, 1, 1 end -MauvilleCity_EventScript_2910CE:: @ 82910CE +MauvilleCity_EventScript_ItemXSpeed:: @ 82910CE giveitem_std ITEM_X_SPEED, 1, 1 end -RustboroCity_EventScript_2910DB:: @ 82910DB +RustboroCity_EventScript_ItemXDefend:: @ 82910DB giveitem_std ITEM_X_DEFEND, 1, 1 end -LilycoveCity_EventScript_2910E8:: @ 82910E8 +LilycoveCity_EventScript_ItemMaxRepel:: @ 82910E8 giveitem_std ITEM_MAX_REPEL, 1, 1 end -MossdeepCity_EventScript_2910F5:: @ 82910F5 +MossdeepCity_EventScript_ItemNetBall:: @ 82910F5 giveitem_std ITEM_NET_BALL, 1, 1 end -PetalburgWoods_EventScript_291102:: @ 8291102 +PetalburgWoods_EventScript_ItemXAttack:: @ 8291102 giveitem_std ITEM_X_ATTACK, 1, 1 end -PetalburgWoods_EventScript_29110F:: @ 829110F +PetalburgWoods_EventScript_ItemGreatBall:: @ 829110F giveitem_std ITEM_GREAT_BALL, 1, 1 end -PetalburgWoods_EventScript_29111C:: @ 829111C +PetalburgWoods_EventScript_ItemEther:: @ 829111C giveitem_std ITEM_ETHER, 1, 1 end -PetalburgWoods_EventScript_291129:: @ 8291129 +PetalburgWoods_EventScript_ItemParalyzeHeal:: @ 8291129 giveitem_std ITEM_PARALYZE_HEAL, 1, 1 end -RusturfTunnel_EventScript_291136:: @ 8291136 +RusturfTunnel_EventScript_ItemPokeBall:: @ 8291136 giveitem_std ITEM_POKE_BALL, 1, 1 end -RusturfTunnel_EventScript_291143:: @ 8291143 +RusturfTunnel_EventScript_ItemMaxEther:: @ 8291143 giveitem_std ITEM_MAX_ETHER, 1, 1 end -GraniteCave_1F_EventScript_291150:: @ 8291150 +GraniteCave_1F_EventScript_ItemEscapeRope:: @ 8291150 giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -GraniteCave_B1F_EventScript_29115D:: @ 829115D +GraniteCave_B1F_EventScript_ItemPokeBall:: @ 829115D giveitem_std ITEM_POKE_BALL, 1, 1 end -GraniteCave_B2F_EventScript_29116A:: @ 829116A +GraniteCave_B2F_EventScript_ItemRepel:: @ 829116A giveitem_std ITEM_REPEL, 1, 1 end -GraniteCave_B2F_EventScript_291177:: @ 8291177 +GraniteCave_B2F_EventScript_ItemRareCandy:: @ 8291177 giveitem_std ITEM_RARE_CANDY, 1, 1 end -JaggedPass_EventScript_291184:: @ 8291184 +JaggedPass_EventScript_ItemBurnHeal:: @ 8291184 giveitem_std ITEM_BURN_HEAL, 1, 1 end -FieryPath_EventScript_291191:: @ 8291191 +FieryPath_EventScript_ItemFireStone:: @ 8291191 giveitem_std ITEM_FIRE_STONE, 1, 1 end -FieryPath_EventScript_29119E:: @ 829119E +FieryPath_EventScript_ItemTM06:: @ 829119E giveitem_std ITEM_TM06, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911AB:: @ 82911AB +MeteorFalls_1F_1R_EventScript_ItemTM23:: @ 82911AB giveitem_std ITEM_TM23, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911B8:: @ 82911B8 +MeteorFalls_1F_1R_EventScript_ItemFullHeal:: @ 82911B8 giveitem_std ITEM_FULL_HEAL, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911C5:: @ 82911C5 +MeteorFalls_1F_1R_EventScript_ItemMoonStone:: @ 82911C5 giveitem_std ITEM_MOON_STONE, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911D2:: @ 82911D2 +MeteorFalls_1F_1R_EventScript_ItemPPUP:: @ 82911D2 giveitem_std ITEM_PP_UP, 1, 1 end -MeteorFalls_B1F_2R_EventScript_2911DF:: @ 82911DF +MeteorFalls_B1F_2R_EventScript_ItemTM02:: @ 82911DF giveitem_std ITEM_TM02, 1, 1 end -NewMauville_Inside_EventScript_2911EC:: @ 82911EC +NewMauville_Inside_EventScript_ItemUltraRope:: @ 82911EC giveitem_std ITEM_ULTRA_BALL, 1, 1 end -NewMauville_Inside_EventScript_2911F9:: @ 82911F9 +NewMauville_Inside_EventScript_ItemEscapeRope:: @ 82911F9 giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -NewMauville_Inside_EventScript_291206:: @ 8291206 +NewMauville_Inside_EventScript_ItemThunderStone:: @ 8291206 giveitem_std ITEM_THUNDER_STONE, 1, 1 end -NewMauville_Inside_EventScript_291213:: @ 8291213 +NewMauville_Inside_EventScript_ItemFullHeal:: @ 8291213 giveitem_std ITEM_FULL_HEAL, 1, 1 end -NewMauville_Inside_EventScript_291220:: @ 8291220 +NewMauville_Inside_EventScript_ItemParalyzeHeal:: @ 8291220 giveitem_std ITEM_PARALYZE_HEAL, 1, 1 end -AbandonedShip_Rooms_1F_EventScript_29122D:: @ 829122D +AbandonedShip_Rooms_1F_EventScript_ItemHarborMail:: @ 829122D giveitem_std ITEM_HARBOR_MAIL, 1, 1 end -AbandonedShip_Rooms_B1F_EventScript_29123A:: @ 829123A +AbandonedShip_Rooms_B1F_EventScript_ItemEscapeRope:: @ 829123A giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -AbandonedShip_Rooms2_B1F_EventScript_291247:: @ 8291247 +AbandonedShip_Rooms2_B1F_EventScript_ItemDiveBall:: @ 8291247 giveitem_std ITEM_DIVE_BALL, 1, 1 end -AbandonedShip_Room_B1F_EventScript_291254:: @ 8291254 +AbandonedShip_Room_B1F_EventScript_ItemTM13:: @ 8291254 giveitem_std ITEM_TM13, 1, 1 end -AbandonedShip_Rooms2_1F_EventScript_291261:: @ 8291261 +AbandonedShip_Rooms2_1F_EventScript_ItemRevive:: @ 8291261 giveitem_std ITEM_REVIVE, 1, 1 end -AbandonedShip_CaptainsOffice_EventScript_29126E:: @ 829126E +AbandonedShip_CaptainsOffice_EventScript_ItemStorageKey:: @ 829126E giveitem_std ITEM_STORAGE_KEY, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_29127B:: @ 829127B +AbandonedShip_HiddenFloorRooms_EventScript_ItemLuxuryBall:: @ 829127B giveitem_std ITEM_LUXURY_BALL, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_291288:: @ 8291288 +AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner:: @ 8291288 giveitem_std ITEM_SCANNER, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_291295:: @ 8291295 +AbandonedShip_HiddenFloorRooms_EventScript_ItemWaterStone:: @ 8291295 giveitem_std ITEM_WATER_STONE, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_2912A2:: @ 82912A2 +AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18:: @ 82912A2 giveitem_std ITEM_TM18, 1, 1 end -ScorchedSlab_EventScript_2912AF:: @ 82912AF +ScorchedSlab_EventScript_ItemTM11:: @ 82912AF giveitem_std ITEM_TM11, 1, 1 end -SafariZone_Northwest_EventScript_2912BC:: @ 82912BC +SafariZone_Northwest_EventScript_ItemTM22:: @ 82912BC giveitem_std ITEM_TM22, 1, 1 end -SafariZone_North_EventScript_2912C9:: @ 82912C9 +SafariZone_North_EventScript_ItemCalcium:: @ 82912C9 giveitem_std ITEM_CALCIUM, 1, 1 end -SafariZone_Southwest_EventScript_2912D6:: @ 82912D6 +SafariZone_Southwest_EventScript_ItemMaxRevive:: @ 82912D6 giveitem_std ITEM_MAX_REVIVE, 1, 1 end -SafariZone_Northeast_EventScript_2912E3:: @ 82912E3 +SafariZone_Northeast_EventScript_ItemNugget:: @ 82912E3 giveitem_std ITEM_NUGGET, 1, 1 end -SafariZone_Southeast_EventScript_2912F0:: @ 82912F0 +SafariZone_Southeast_EventScript_ItemBigPearl:: @ 82912F0 giveitem_std ITEM_BIG_PEARL, 1, 1 end -MtPyre_2F_EventScript_2912FD:: @ 82912FD +MtPyre_2F_EventScript_ItemUltraBall:: @ 82912FD giveitem_std ITEM_ULTRA_BALL, 1, 1 end -MtPyre_3F_EventScript_29130A:: @ 829130A +MtPyre_3F_EventScript_ItemSuperRepel:: @ 829130A giveitem_std ITEM_SUPER_REPEL, 1, 1 end -MtPyre_4F_EventScript_291317:: @ 8291317 +MtPyre_4F_EventScript_ItemSeaIncense:: @ 8291317 giveitem_std ITEM_SEA_INCENSE, 1, 1 end -MtPyre_5F_EventScript_291324:: @ 8291324 +MtPyre_5F_EventScript_ItemLaxIncense:: @ 8291324 giveitem_std ITEM_LAX_INCENSE, 1, 1 end -MtPyre_6F_EventScript_291331:: @ 8291331 +MtPyre_6F_EventScript_ItemTM30:: @ 8291331 giveitem_std ITEM_TM30, 1, 1 end -MtPyre_Exterior_EventScript_29133E:: @ 829133E +MtPyre_Exterior_EventScript_ItemMaxPotion:: @ 829133E giveitem_std ITEM_MAX_POTION, 1, 1 end -MtPyre_Exterior_EventScript_29134B:: @ 829134B +MtPyre_Exterior_EventScript_ItemTM48:: @ 829134B giveitem_std ITEM_TM48, 1, 1 end -AquaHideout_B1F_EventScript_291358:: @ 8291358 +AquaHideout_B1F_EventScript_ItemMasterBall:: @ 8291358 giveitem_std ITEM_MASTER_BALL, 1, 1 end -AquaHideout_B1F_EventScript_291365:: @ 8291365 +AquaHideout_B1F_EventScript_ItemNugget:: @ 8291365 giveitem_std ITEM_NUGGET, 1, 1 end -AquaHideout_B1F_EventScript_291372:: @ 8291372 +AquaHideout_B1F_EventScript_ItemMaxElixir:: @ 8291372 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -AquaHideout_B2F_EventScript_29137F:: @ 829137F +AquaHideout_B2F_EventScript_ItemNestBall:: @ 829137F giveitem_std ITEM_NEST_BALL, 1, 1 end -AquaHideout_B2F_EventScript_29138C:: @ 829138C - giveitem_std ITEM_MASTER_BALL, 1, 1 +AquaHideout_B2F_EventScript_ItemMasterBall:: @ 829138C + giveitem_std ITEM_MASTER_BALL, 1, 1 // Unused end -Route119_EventScript_291399:: @ 8291399 +Route119_EventScript_ItemNugget:: @ 8291399 giveitem_std ITEM_NUGGET, 1, 1 end -Route119_EventScript_2913A6:: @ 82913A6 +Route119_EventScript_ItemMaxElixir:: @ 82913A6 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -Route119_EventScript_2913B3:: @ 82913B3 +Route119_EventScript_ItemNestBall:: @ 82913B3 giveitem_std ITEM_NEST_BALL, 1, 1 end -ShoalCave_LowTideEntranceRoom_EventScript_2913C0:: @ 82913C0 +ShoalCave_LowTideEntranceRoom_EventScript_ItemBigPearl:: @ 82913C0 giveitem_std ITEM_BIG_PEARL, 1, 1 end -ShoalCave_LowTideInnerRoom_EventScript_2913CD:: @ 82913CD +ShoalCave_LowTideInnerRoom_EventScript_ItemRareCandy:: @ 82913CD giveitem_std ITEM_RARE_CANDY, 1, 1 end -ShoalCave_LowTideStairsRoom_EventScript_2913DA:: @ 82913DA +ShoalCave_LowTideStairsRoom_EventScript_ItemIceHeal:: @ 82913DA giveitem_std ITEM_ICE_HEAL, 1, 1 end -ShoalCave_LowTideIceRoom_EventScript_2913E7:: @ 82913E7 +ShoalCave_LowTideIceRoom_EventScript_ItemTM07:: @ 82913E7 giveitem_std ITEM_TM07, 1, 1 end -ShoalCave_LowTideIceRoom_EventScript_2913F4:: @ 82913F4 +ShoalCave_LowTideIceRoom_EventScript_ItemNeverMeltIce:: @ 82913F4 giveitem_std ITEM_NEVER_MELT_ICE, 1, 1 end -SeafloorCavern_Room9_EventScript_291401:: @ 8291401 +SeafloorCavern_Room9_EventScript_ItemTM26:: @ 8291401 giveitem_std ITEM_TM26, 1, 1 end -Route110_TrickHousePuzzle1_EventScript_29140E:: @ 829140E +Route110_TrickHousePuzzle1_EventScript_ItemOrangeMail:: @ 829140E giveitem_std ITEM_ORANGE_MAIL, 1, 1 end -Route110_TrickHousePuzzle2_EventScript_29141B:: @ 829141B +Route110_TrickHousePuzzle2_EventScript_ItemHarborMail:: @ 829141B giveitem_std ITEM_HARBOR_MAIL, 1, 1 end -Route110_TrickHousePuzzle2_EventScript_291428:: @ 8291428 +Route110_TrickHousePuzzle2_EventScript_ItemWaveMail:: @ 8291428 giveitem_std ITEM_WAVE_MAIL, 1, 1 end -Route110_TrickHousePuzzle3_EventScript_291435:: @ 8291435 +Route110_TrickHousePuzzle3_EventScript_ItemShadowMail:: @ 8291435 giveitem_std ITEM_SHADOW_MAIL, 1, 1 end -Route110_TrickHousePuzzle3_EventScript_291442:: @ 8291442 +Route110_TrickHousePuzzle3_EventScript_ItemWoodMail:: @ 8291442 giveitem_std ITEM_WOOD_MAIL, 1, 1 end -Route110_TrickHousePuzzle4_EventScript_29144F:: @ 829144F +Route110_TrickHousePuzzle4_EventScript_ItemMechMail:: @ 829144F giveitem_std ITEM_MECH_MAIL, 1, 1 end -Route110_TrickHousePuzzle6_EventScript_29145C:: @ 829145C +Route110_TrickHousePuzzle6_EventScript_ItemGlitterMail:: @ 829145C giveitem_std ITEM_GLITTER_MAIL, 1, 1 end -Route110_TrickHousePuzzle7_EventScript_291469:: @ 8291469 +Route110_TrickHousePuzzle7_EventScript_ItemTropicMail:: @ 8291469 giveitem_std ITEM_TROPIC_MAIL, 1, 1 end -Route110_TrickHousePuzzle8_EventScript_291476:: @ 8291476 +Route110_TrickHousePuzzle8_EventScript_ItemBeadMail:: @ 8291476 giveitem_std ITEM_BEAD_MAIL, 1, 1 end -VictoryRoad_1F_EventScript_291483:: @ 8291483 +VictoryRoad_1F_EventScript_ItemMaxElixir:: @ 8291483 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -VictoryRoad_1F_EventScript_291490:: @ 8291490 +VictoryRoad_1F_EventScript_ItemPPUp:: @ 8291490 giveitem_std ITEM_PP_UP, 1, 1 end -VictoryRoad_B1F_EventScript_29149D:: @ 829149D +VictoryRoad_B1F_EventScript_ItemTM29:: @ 829149D giveitem_std ITEM_TM29, 1, 1 end -VictoryRoad_B1F_EventScript_2914AA:: @ 82914AA +VictoryRoad_B1F_EventScript_ItemFullRestore:: @ 82914AA giveitem_std ITEM_FULL_RESTORE, 1, 1 end -VictoryRoad_B2F_EventScript_2914B7:: @ 82914B7 +VictoryRoad_B2F_EventScript_ItemFullHeal:: @ 82914B7 giveitem_std ITEM_FULL_HEAL, 1, 1 end -ArtisanCave_B1F_EventScript_2914C4:: @ 82914C4 +ArtisanCave_B1F_EventScript_ItemHPUp:: @ 82914C4 giveitem_std ITEM_HP_UP, 1, 1 end -ArtisanCave_1F_EventScript_2914D1:: @ 82914D1 +ArtisanCave_1F_EventScript_ItemCarbos:: @ 82914D1 giveitem_std ITEM_CARBOS, 1, 1 end -MagmaHideout_1F_EventScript_2914DE:: @ 82914DE +MagmaHideout_1F_EventScript_ItemRareCandy:: @ 82914DE giveitem_std ITEM_RARE_CANDY, 1, 1 end -MagmaHideout_2F_2R_EventScript_2914EB:: @ 82914EB +MagmaHideout_2F_2R_EventScript_MaxElixir:: @ 82914EB giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -MagmaHideout_2F_2R_EventScript_2914F8:: @ 82914F8 +MagmaHideout_2F_2R_EventScript_ItemFullRestore:: @ 82914F8 giveitem_std ITEM_FULL_RESTORE, 1, 1 end -MagmaHideout_3F_1R_EventScript_291505:: @ 8291505 +MagmaHideout_3F_1R_EventScript_ItemNugget:: @ 8291505 giveitem_std ITEM_NUGGET, 1, 1 end -MagmaHideout_3F_2R_EventScript_291512:: @ 8291512 +MagmaHideout_3F_2R_EventScript_ItemPPMax:: @ 8291512 giveitem_std ITEM_PP_MAX, 1, 1 end -MagmaHideout_4F_EventScript_29151F:: @ 829151F +MagmaHideout_4F_EventScript_MaxRevive:: @ 829151F giveitem_std ITEM_MAX_REVIVE, 1, 1 end -MagmaHideout_3F_3R_EventScript_29152C:: @ 829152C +MagmaHideout_3F_3R_EventScript_ItemEscapeRope:: @ 829152C giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end From 8b88ef3e01ea2e574b8326fd46dfc1fc5af575e0 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Wed, 3 Apr 2019 18:04:04 -0400 Subject: [PATCH 41/42] Document berry tree events --- data/scripts/berry_tree.inc | 164 ++++++++++++++++++------------------ 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index 685949006..027633a82 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -2,142 +2,142 @@ BerryTreeScript:: @ 82742F9 special EventObjectInteractionGetBerryTreeData switch VAR_0x8004 case 255, Route102_EventScript_27434F - case 0, Route102_EventScript_274359 - case 1, Route102_EventScript_2743B1 - case 2, Route102_EventScript_2743C1 - case 3, Route102_EventScript_2743D1 - case 4, Route102_EventScript_2743E1 - case 5, Route102_EventScript_274421 + case 0, Route102_EventScript_CheckSoil + case 1, Route102_EventScript_CheckBerryStage1 + case 2, Route102_EventScript_CheckBerryStage2 + case 3, Route102_EventScript_CheckBerryStage3 + case 4, Route102_EventScript_CheckBerryStage4 + case 5, Route102_EventScript_CheckBerryFullyGrown end Route102_EventScript_27434F:: @ 827434F lockall - message Route102_Text_274744 + message Route102_Text_ExclamationPoint waitmessage waitbuttonpress releaseall end -Route102_EventScript_274359:: @ 8274359 +Route102_EventScript_CheckSoil:: @ 8274359 lock faceplayer specialvar VAR_RESULT, PlayerHasBerries compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274374 - message Route102_Text_2744F0 + goto_if_eq Route102_EventScript_WantToPlant + message Route102_Text_ItsSoftLoamySoil waitmessage waitbuttonpress release end -Route102_EventScript_274374:: @ 8274374 - msgbox Route102_Text_274507, MSGBOX_YESNO +Route102_EventScript_WantToPlant:: @ 8274374 + msgbox Route102_Text_WantToPlant, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274393 + goto_if_eq Route102_EventScript_ChooseBerryToPlant compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2743AF + goto_if_eq Route102_EventScript_CancelPlanting end -Route102_EventScript_274393:: @ 8274393 +Route102_EventScript_ChooseBerryToPlant:: @ 8274393 fadescreen 1 closemessage special Bag_ChooseBerry waitstate compare VAR_ITEM_ID, 0 - goto_if_eq Route102_EventScript_2743AF + goto_if_eq Route102_EventScript_CancelPlanting takeitem VAR_ITEM_ID, 1 - call Route102_EventScript_2744DD + call Route102_EventScript_PlantBerry -Route102_EventScript_2743AF:: @ 82743AF +Route102_EventScript_CancelPlanting:: @ 82743AF release end -Route102_EventScript_2743B1:: @ 82743B1 +Route102_EventScript_CheckBerryStage1:: @ 82743B1 lockall special EventObjectInteractionGetBerryCountString - message Route102_Text_274560 + message Route102_Text_BerryGrowthStage1 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743C1:: @ 82743C1 +Route102_EventScript_CheckBerryStage2:: @ 82743C1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_274579 + message Route102_Text_BerryGrowthStage2 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743D1:: @ 82743D1 +Route102_EventScript_CheckBerryStage3:: @ 82743D1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_27458A + message Route102_Text_BerryGrowthStage3 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743E1:: @ 82743E1 - call Route102_EventScript_2743F6 +Route102_EventScript_CheckBerryStage4:: @ 82743E1 + call Route102_EventScript_GetCareAdverb lockall special EventObjectInteractionGetBerryName - message Route102_Text_2745AB + message Route102_Text_BerryGrowthStage4 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743F6:: @ 82743F6 +Route102_EventScript_GetCareAdverb:: @ 82743F6 compare VAR_0x8005, 0 - goto_if_eq Route102_EventScript_27441A + goto_if_eq Route102_EventScript_SetAdverbPoor compare VAR_0x8005, 4 - goto_if_eq Route102_EventScript_274413 - bufferstring 1, Route102_Text_2745E5 + goto_if_eq Route102_EventScript_SetAdverbGreat + bufferstring 1, Route102_Text_CareAdverbGood return -Route102_EventScript_274413:: @ 8274413 - bufferstring 1, Route102_Text_2745CD +Route102_EventScript_SetAdverbGreat:: @ 8274413 + bufferstring 1, Route102_Text_CareAdverbGreat return -Route102_EventScript_27441A:: @ 827441A - bufferstring 1, Route102_Text_2745DE +Route102_EventScript_SetAdverbPoor:: @ 827441A + bufferstring 1, Route102_Text_CareAdverbPoor return -Route102_EventScript_274421:: @ 8274421 +Route102_EventScript_CheckBerryFullyGrown:: @ 8274421 buffernumberstring 1, VAR_0x8006 lock faceplayer special EventObjectInteractionGetBerryCountString - msgbox Route102_Text_2745EE, MSGBOX_YESNO + msgbox Route102_Text_WantToPick, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274448 + goto_if_eq Route102_EventScript_PickBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_274479 + goto_if_eq Route102_EventScript_CancelPickingBerry -Route102_EventScript_274448:: @ 8274448 +Route102_EventScript_PickBerry:: @ 8274448 special EventObjectInteractionPickBerryTree compare VAR_0x8004, 0 - goto_if_eq Route102_EventScript_274470 + goto_if_eq Route102_EventScript_BerryPocketFull special sub_80EED34 special EventObjectInteractionRemoveBerryTree - message Route102_Text_27461B + message Route102_Text_PickedTheBerry playfanfare MUS_ME_KINOMI waitmessage waitfanfare waitbuttonpress - message Route102_Text_274630 + message Route102_Text_PutAwayBerry waitmessage waitbuttonpress release end -Route102_EventScript_274470:: @ 8274470 - message Route102_Text_27468F +Route102_EventScript_BerryPocketFull:: @ 8274470 + message Route102_Text_BerryPocketFull waitmessage waitbuttonpress release end -Route102_EventScript_274479:: @ 8274479 - message Route102_Text_2746CB +Route102_EventScript_CancelPickingBerry:: @ 8274479 + message Route102_Text_BerryLeftUnpicked waitmessage waitbuttonpress release @@ -146,22 +146,22 @@ Route102_EventScript_274479:: @ 8274479 Route102_EventScript_274482:: @ 8274482 lockall special EventObjectInteractionGetBerryTreeData - call Route102_EventScript_2744DD + call Route102_EventScript_PlantBerry releaseall end -Route102_EventScript_27448D:: @ 827448D +Route102_EventScript_WantToWater:: @ 827448D checkitem ITEM_WAILMER_PAIL, 1 compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2744BE + goto_if_eq Route102_EventScript_DontWater special EventObjectInteractionGetBerryName - msgbox Route102_Text_2746E4, MSGBOX_YESNO + msgbox Route102_Text_WantToWater, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_2744C4 + goto_if_eq Route102_EventScript_WaterBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2744BE + goto_if_eq Route102_EventScript_DontWater -Route102_EventScript_2744BE:: @ 82744BE +Route102_EventScript_DontWater:: @ 82744BE releaseall end @@ -169,93 +169,93 @@ Route102_EventScript_2744C0:: @ 82744C0 special EventObjectInteractionGetBerryTreeData lockall -Route102_EventScript_2744C4:: @ 82744C4 +Route102_EventScript_WaterBerry:: @ 82744C4 special EventObjectInteractionGetBerryName - message Route102_Text_274710 + message Route102_Text_WateredTheBerry waitmessage special EventObjectInteractionWaterBerryTree special DoWateringBerryTreeAnim waitstate - message Route102_Text_274723 + message Route102_Text_PlantIsDelighted waitmessage waitbuttonpress releaseall end -Route102_EventScript_2744DD:: @ 82744DD +Route102_EventScript_PlantBerry:: @ 82744DD special EventObjectInteractionPlantBerryTree incrementgamestat 3 special sub_80EED10 special EventObjectInteractionGetBerryCountString - message Route102_Text_274535 + message Route102_Text_PlantedOneBerry waitmessage waitbuttonpress return -Route102_Text_2744F0: @ 82744F0 +Route102_Text_ItsSoftLoamySoil: @ 82744F0 .string "It's soft, loamy soil.$" -Route102_Text_274507: @ 8274507 +Route102_Text_WantToPlant: @ 8274507 .string "It's soft, loamy soil.\n" .string "Want to plant a BERRY?$" -Route102_Text_274535: @ 8274535 +Route102_Text_PlantedOneBerry: @ 8274535 .string "{PLAYER} planted one {STR_VAR_1} in\n" .string "the soft, loamy soil.$" -Route102_Text_274560: @ 8274560 +Route102_Text_BerryGrowthStage1: @ 8274560 .string "One {STR_VAR_1} was planted here.$" -Route102_Text_274579: @ 8274579 +Route102_Text_BerryGrowthStage2: @ 8274579 .string "{STR_VAR_1} has sprouted.$" -Route102_Text_27458A: @ 827458A +Route102_Text_BerryGrowthStage3: @ 827458A .string "This {STR_VAR_1} plant is growing taller.$" -Route102_Text_2745AB: @ 82745AB +Route102_Text_BerryGrowthStage4: @ 82745AB .string "These {STR_VAR_1} flowers are blooming\n" .string "{STR_VAR_2}.$" -Route102_Text_2745CD: @ 82745CD +Route102_Text_CareAdverbGreat: @ 82745CD .string "very beautifully$" -Route102_Text_2745DE: @ 82745DE +Route102_Text_CareAdverbPoor: @ 82745DE .string "cutely$" -Route102_Text_2745E5: @ 82745E5 +Route102_Text_CareAdverbGood: @ 82745E5 .string "prettily$" -Route102_Text_2745EE: @ 82745EE +Route102_Text_WantToPick: @ 82745EE .string "You found {STR_VAR_2} {STR_VAR_1}!\p" .string "Do you want to pick the\n" .string "{STR_VAR_1}?$" -Route102_Text_27461B: @ 827461B +Route102_Text_PickedTheBerry: @ 827461B .string "{PLAYER} picked the {STR_VAR_2} {STR_VAR_1}.$" -Route102_Text_274630: @ 8274630 +Route102_Text_PutAwayBerry: @ 8274630 .string "{PLAYER} put away the {STR_VAR_1}\n" .string "in the BAG's BERRIES POCKET.\p" .string "The soil returned to its soft and\n" .string "loamy state.$" -Route102_Text_27468F: @ 827468F +Route102_Text_BerryPocketFull: @ 827468F .string "The BAG's BERRIES POCKET is full.\p" .string "The {STR_VAR_1} couldn't be taken.$" -Route102_Text_2746CB: @ 82746CB +Route102_Text_BerryLeftUnpicked: @ 82746CB .string "{PLAYER} left the {STR_VAR_1}\n" .string "unpicked.$" -Route102_Text_2746E4: @ 82746E4 +Route102_Text_WantToWater: @ 82746E4 .string "Want to water the {STR_VAR_1} with the\n" .string "WAILMER PAIL?$" -Route102_Text_274710: @ 8274710 +Route102_Text_WateredTheBerry: @ 8274710 .string "{PLAYER} watered the {STR_VAR_1}.$" -Route102_Text_274723: @ 8274723 +Route102_Text_PlantIsDelighted: @ 8274723 .string "The plant seems to be delighted.$" -Route102_Text_274744: @ 8274744 +Route102_Text_ExclamationPoint: @ 8274744 .string "!$" From 9e74409bb2032e25d431dda116462759e5b51fe0 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Thu, 4 Apr 2019 19:28:37 -0400 Subject: [PATCH 42/42] Fix labels, label more scripts --- data/maps/AbandonedShip_Deck/scripts.inc | 4 +- data/maps/AlteringCave/scripts.inc | 4 +- data/maps/AncientTomb/scripts.inc | 4 +- data/maps/ArtisanCave_B1F/scripts.inc | 4 +- .../BattleFrontier_ReceptionGate/scripts.inc | 4 +- data/maps/DesertRuins/scripts.inc | 4 +- data/maps/DesertUnderpass/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/FieryPath/scripts.inc | 4 +- data/maps/IslandCave/scripts.inc | 4 +- data/maps/MirageTower_1F/scripts.inc | 4 +- data/maps/NewMauville_Entrance/scripts.inc | 4 +- data/maps/Route104_MrBrineysHouse/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/Route109_SeashoreHouse/scripts.inc | 4 +- .../Route110_TrickHouseEntrance/scripts.inc | 4 +- .../Route111_OldLadysRestStop/scripts.inc | 4 +- data/maps/Route113_GlassWorkshop/scripts.inc | 4 +- .../Route114_FossilManiacsHouse/scripts.inc | 4 +- data/maps/Route114_LanettesHouse/scripts.inc | 4 +- .../Route116_TunnelersRestHouse/scripts.inc | 4 +- data/maps/Route117_PokemonDayCare/scripts.inc | 4 +- .../Route123_BerryMastersHouse/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/ScorchedSlab/scripts.inc | 4 +- data/maps/SealedChamber_OuterRoom/scripts.inc | 4 +- data/maps/SkyPillar_Entrance/scripts.inc | 4 +- data/maps/SouthernIsland_Exterior/scripts.inc | 4 +- data/maps/TrainerHill_Entrance/scripts.inc | 4 +- data/maps/Underwater_SeafloorCavern/map.json | 8 +- .../Underwater_SeafloorCavern/scripts.inc | 10 +- data/scripts/berry_tree.inc | 172 +++++++++--------- include/bard_music.h | 2 +- src/data/bard_music/pokemon.h | 2 +- src/easy_chat.c | 2 +- src/item_use.c | 8 +- 36 files changed, 160 insertions(+), 160 deletions(-) diff --git a/data/maps/AbandonedShip_Deck/scripts.inc b/data/maps/AbandonedShip_Deck/scripts.inc index f256fe521..b0ecc2a4d 100644 --- a/data/maps/AbandonedShip_Deck/scripts.inc +++ b/data/maps/AbandonedShip_Deck/scripts.inc @@ -1,8 +1,8 @@ AbandonedShip_Deck_MapScripts:: @ 823799A - map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_OnTransition .byte 0 -AbandonedShip_Deck_MapScript1_SetLandmark: @ 82379A0 +AbandonedShip_Deck_OnTransition: @ 82379A0 setflag FLAG_LANDMARK_ABANDONED_SHIP end diff --git a/data/maps/AlteringCave/scripts.inc b/data/maps/AlteringCave/scripts.inc index 19fd1fb0b..601f49217 100644 --- a/data/maps/AlteringCave/scripts.inc +++ b/data/maps/AlteringCave/scripts.inc @@ -1,8 +1,8 @@ AlteringCave_MapScripts:: @ 823B177 - map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_OnTransition .byte 0 -AlteringCave_MapScript1_SetLandmark: @ 823B17D +AlteringCave_OnTransition: @ 823B17D setflag FLAG_LANDMARK_ALTERING_CAVE end diff --git a/data/maps/AncientTomb/scripts.inc b/data/maps/AncientTomb/scripts.inc index 8d1c029c3..ad8e683bb 100644 --- a/data/maps/AncientTomb/scripts.inc +++ b/data/maps/AncientTomb/scripts.inc @@ -1,7 +1,7 @@ AncientTomb_MapScripts:: @ 8238FB3 map_script MAP_SCRIPT_ON_RESUME, AncientTomb_MapScript1_238FC3 map_script MAP_SCRIPT_ON_LOAD, AncientTomb_MapScript1_238FF2 - map_script MAP_SCRIPT_ON_TRANSITION, AncientTomb_MapScript1_238FE1 + map_script MAP_SCRIPT_ON_TRANSITION, AncientTomb_OnTransition .byte 0 AncientTomb_MapScript1_238FC3: @ 8238FC3 @@ -15,7 +15,7 @@ AncientTomb_EventScript_238FCD:: @ 8238FCD removeobject VAR_LAST_TALKED return -AncientTomb_MapScript1_238FE1: @ 8238FE1 +AncientTomb_OnTransition: @ 8238FE1 setflag FLAG_LANDMARK_ANCIENT_TOMB call_if_unset FLAG_DEFEATED_REGISTEEL, AncientTomb_EventScript_238FEE end diff --git a/data/maps/ArtisanCave_B1F/scripts.inc b/data/maps/ArtisanCave_B1F/scripts.inc index a64fe4ab9..4dd850e88 100644 --- a/data/maps/ArtisanCave_B1F/scripts.inc +++ b/data/maps/ArtisanCave_B1F/scripts.inc @@ -1,8 +1,8 @@ ArtisanCave_B1F_MapScripts:: @ 823AFAD - map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_OnTransition .byte 0 -ArtisanCave_B1F_MapScript1_SetLandmark: @ 823AFB3 +ArtisanCave_B1F_OnTransition: @ 823AFB3 setflag FLAG_LANDMARK_ARTISAN_CAVE end diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc index 369c30aca..5f0952cb0 100644 --- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc +++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc @@ -1,9 +1,9 @@ BattleFrontier_ReceptionGate_MapScripts:: @ 82661DA map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_ReceptionGate_MapScript2_2661E9 - map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_OnTransition .byte 0 -BattleFrontier_ReceptionGate_MapScript1_SetLandmark: @ 82661E5 +BattleFrontier_ReceptionGate_OnTransition: @ 82661E5 setflag FLAG_LANDMARK_BATTLE_FRONTIER end diff --git a/data/maps/DesertRuins/scripts.inc b/data/maps/DesertRuins/scripts.inc index 75fcf061c..e796b1668 100644 --- a/data/maps/DesertRuins/scripts.inc +++ b/data/maps/DesertRuins/scripts.inc @@ -1,7 +1,7 @@ DesertRuins_MapScripts:: @ 822D95B map_script MAP_SCRIPT_ON_RESUME, DesertRuins_MapScript1_22D96B map_script MAP_SCRIPT_ON_LOAD, DesertRuins_MapScript1_22D989 - map_script MAP_SCRIPT_ON_TRANSITION, DesertRuins_MapScript1_22D9CA + map_script MAP_SCRIPT_ON_TRANSITION, DesertRuins_OnTransition .byte 0 DesertRuins_MapScript1_22D96B: @ 822D96B @@ -28,7 +28,7 @@ DesertRuins_EventScript_22D993:: @ 822D993 setmetatile 9, 20, 565, 1 return -DesertRuins_MapScript1_22D9CA: @ 822D9CA +DesertRuins_OnTransition: @ 822D9CA setflag FLAG_LANDMARK_DESERT_RUINS call_if_unset FLAG_DEFEATED_REGIROCK, DesertRuins_EventScript_22D9D7 end diff --git a/data/maps/DesertUnderpass/scripts.inc b/data/maps/DesertUnderpass/scripts.inc index 1b8324d8a..8e89075e5 100644 --- a/data/maps/DesertUnderpass/scripts.inc +++ b/data/maps/DesertUnderpass/scripts.inc @@ -1,8 +1,8 @@ DesertUnderpass_MapScripts:: @ 823AF37 - map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_OnTransition .byte 0 -DesertUnderpass_MapScript1_SetLandmark: @ 823AF3D +DesertUnderpass_OnTransition: @ 823AF3D setflag FLAG_LANDMARK_DESERT_UNDERPASS end diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index 95345af5c..959153d8a 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -1,9 +1,9 @@ EverGrandeCity_PokemonLeague_1F_MapScripts:: @ 82295D2 - map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonLeague_1F_MapScript1_2295DD + map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonLeague_1F_OnTransition map_script MAP_SCRIPT_ON_RESUME, EverGrandeCity_PokemonLeague_1F_MapScript1_277C30 .byte 0 -EverGrandeCity_PokemonLeague_1F_MapScript1_2295DD: @ 82295DD +EverGrandeCity_PokemonLeague_1F_OnTransition: @ 82295DD setrespawn HEAL_LOCATION_EVER_GRANDE_CITY_2 setflag FLAG_LANDMARK_POKEMON_LEAGUE call_if_unset FLAG_ENTERED_ELITE_FOUR, EverGrandeCity_PokemonLeague_1F_EventScript_2295ED diff --git a/data/maps/FieryPath/scripts.inc b/data/maps/FieryPath/scripts.inc index ddba0dc0b..0aa5769a0 100644 --- a/data/maps/FieryPath/scripts.inc +++ b/data/maps/FieryPath/scripts.inc @@ -1,8 +1,8 @@ FieryPath_MapScripts:: @ 8230F24 - map_script MAP_SCRIPT_ON_TRANSITION, FieryPath_MapScript1_230F2A + map_script MAP_SCRIPT_ON_TRANSITION, FieryPath_OnTransition .byte 0 -FieryPath_MapScript1_230F2A: @ 8230F2A +FieryPath_OnTransition: @ 8230F2A call_if_unset FLAG_LANDMARK_FIERY_PATH, FieryPath_EventScript_230F37 setflag FLAG_LANDMARK_FIERY_PATH end diff --git a/data/maps/IslandCave/scripts.inc b/data/maps/IslandCave/scripts.inc index cb400e817..4f5339b1a 100644 --- a/data/maps/IslandCave/scripts.inc +++ b/data/maps/IslandCave/scripts.inc @@ -1,7 +1,7 @@ IslandCave_MapScripts:: @ 8238E2A map_script MAP_SCRIPT_ON_RESUME, IslandCave_MapScript1_238E3A map_script MAP_SCRIPT_ON_LOAD, IslandCave_MapScript1_238E58 - map_script MAP_SCRIPT_ON_TRANSITION, IslandCave_MapScript1_238E99 + map_script MAP_SCRIPT_ON_TRANSITION, IslandCave_OnTransition .byte 0 IslandCave_MapScript1_238E3A: @ 8238E3A @@ -28,7 +28,7 @@ IslandCave_EventScript_238E62:: @ 8238E62 setmetatile 9, 20, 565, 1 return -IslandCave_MapScript1_238E99: @ 8238E99 +IslandCave_OnTransition: @ 8238E99 setflag FLAG_LANDMARK_ISLAND_CAVE call IslandCave_EventScript_238F45 call_if_unset FLAG_DEFEATED_REGICE, IslandCave_EventScript_238EAB diff --git a/data/maps/MirageTower_1F/scripts.inc b/data/maps/MirageTower_1F/scripts.inc index 9f6c35a84..74ec749fa 100644 --- a/data/maps/MirageTower_1F/scripts.inc +++ b/data/maps/MirageTower_1F/scripts.inc @@ -1,8 +1,8 @@ MirageTower_1F_MapScripts:: @ 823AD01 - map_script MAP_SCRIPT_ON_TRANSITION, MirageTower_1F_MapScript1_23AD07 + map_script MAP_SCRIPT_ON_TRANSITION, MirageTower_1F_OnTransition .byte 0 -MirageTower_1F_MapScript1_23AD07: @ 823AD07 +MirageTower_1F_OnTransition: @ 823AD07 setflag FLAG_ENTERED_MIRAGE_TOWER setflag FLAG_FORCE_MIRAGE_TOWER_VISIBLE setflag FLAG_LANDMARK_MIRAGE_TOWER diff --git a/data/maps/NewMauville_Entrance/scripts.inc b/data/maps/NewMauville_Entrance/scripts.inc index 1df4c53e4..7adb2d7ce 100644 --- a/data/maps/NewMauville_Entrance/scripts.inc +++ b/data/maps/NewMauville_Entrance/scripts.inc @@ -1,6 +1,6 @@ NewMauville_Entrance_MapScripts:: @ 82372AD map_script MAP_SCRIPT_ON_LOAD, NewMauville_Entrance_MapScript1_2372B8 - map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_OnTransition .byte 0 NewMauville_Entrance_MapScript1_2372B8: @ 82372B8 @@ -17,7 +17,7 @@ NewMauville_Entrance_EventScript_2372C4:: @ 82372C4 setmetatile 5, 1, 798, 1 return -NewMauville_Entrance_MapScript1_SetLandmark: @ 82372FB +NewMauville_Entrance_OnTransition: @ 82372FB setflag FLAG_LANDMARK_NEW_MAUVILLE end diff --git a/data/maps/Route104_MrBrineysHouse/scripts.inc b/data/maps/Route104_MrBrineysHouse/scripts.inc index 8a4af48cd..52fd4b96d 100644 --- a/data/maps/Route104_MrBrineysHouse/scripts.inc +++ b/data/maps/Route104_MrBrineysHouse/scripts.inc @@ -1,8 +1,8 @@ Route104_MrBrineysHouse_MapScripts:: @ 8229D2E - map_script MAP_SCRIPT_ON_TRANSITION, Route104_MrBrineysHouse_MapScript1_229D34 + map_script MAP_SCRIPT_ON_TRANSITION, Route104_MrBrineysHouse_OnTransition .byte 0 -Route104_MrBrineysHouse_MapScript1_229D34: @ 8229D34 +Route104_MrBrineysHouse_OnTransition: @ 8229D34 setflag FLAG_LANDMARK_MR_BRINEY_HOUSE compare VAR_BRINEY_HOUSE_STATE, 1 call_if_eq Route104_MrBrineysHouse_EventScript_229D50 diff --git a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc index 26dfe7f8a..2a8a8b88e 100644 --- a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc +++ b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc @@ -1,8 +1,8 @@ Route104_PrettyPetalFlowerShop_MapScripts:: @ 822A34C - map_script MAP_SCRIPT_ON_TRANSITION, Route104_PrettyPetalFlowerShop_MapScript1_22A352 + map_script MAP_SCRIPT_ON_TRANSITION, Route104_PrettyPetalFlowerShop_OnTransition .byte 0 -Route104_PrettyPetalFlowerShop_MapScript1_22A352: @ 822A352 +Route104_PrettyPetalFlowerShop_OnTransition: @ 822A352 setflag FLAG_LANDMARK_FLOWER_SHOP goto_if_unset FLAG_MET_PRETTY_PETAL_SHOP_OWNER, Route104_PrettyPetalFlowerShop_EventScript_22A36B goto_if_unset FLAG_BADGE03_GET, Route104_PrettyPetalFlowerShop_EventScript_22A36B diff --git a/data/maps/Route109_SeashoreHouse/scripts.inc b/data/maps/Route109_SeashoreHouse/scripts.inc index d33113136..e52ab08f9 100644 --- a/data/maps/Route109_SeashoreHouse/scripts.inc +++ b/data/maps/Route109_SeashoreHouse/scripts.inc @@ -1,8 +1,8 @@ Route109_SeashoreHouse_MapScripts:: @ 82693F4 - map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_OnTransition .byte 0 -Route109_SeashoreHouse_MapScript1_SetLandmark: @ 82693FA +Route109_SeashoreHouse_OnTransition: @ 82693FA setflag FLAG_LANDMARK_SEASHORE_HOUSE end diff --git a/data/maps/Route110_TrickHouseEntrance/scripts.inc b/data/maps/Route110_TrickHouseEntrance/scripts.inc index e1439d8d4..46610937e 100644 --- a/data/maps/Route110_TrickHouseEntrance/scripts.inc +++ b/data/maps/Route110_TrickHouseEntrance/scripts.inc @@ -1,10 +1,10 @@ Route110_TrickHouseEntrance_MapScripts:: @ 8269A50 - map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEntrance_MapScript1_269A60 + map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEntrance_OnTransition map_script MAP_SCRIPT_ON_FRAME_TABLE, Route110_TrickHouseEntrance_MapScript2_269CEE map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, Route110_TrickHouseEntrance_MapScript2_269BD3 .byte 0 -Route110_TrickHouseEntrance_MapScript1_269A60: @ 8269A60 +Route110_TrickHouseEntrance_OnTransition: @ 8269A60 setflag FLAG_LANDMARK_TRICK_HOUSE compare VAR_TRICK_HOUSE_STATE, 1 goto_if_eq Route110_TrickHouseEntrance_EventScript_269AF3 diff --git a/data/maps/Route111_OldLadysRestStop/scripts.inc b/data/maps/Route111_OldLadysRestStop/scripts.inc index 9495c4539..017043eae 100644 --- a/data/maps/Route111_OldLadysRestStop/scripts.inc +++ b/data/maps/Route111_OldLadysRestStop/scripts.inc @@ -1,8 +1,8 @@ Route111_OldLadysRestStop_MapScripts:: @ 822A916 - map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_OnTransition .byte 0 -Route111_OldLadysRestStop_MapScript1_SetLandmark: @ 822A91C +Route111_OldLadysRestStop_OnTransition: @ 822A91C setflag FLAG_LANDMARK_OLD_LADY_REST_SHOP end diff --git a/data/maps/Route113_GlassWorkshop/scripts.inc b/data/maps/Route113_GlassWorkshop/scripts.inc index 46134a3d5..b685389d9 100644 --- a/data/maps/Route113_GlassWorkshop/scripts.inc +++ b/data/maps/Route113_GlassWorkshop/scripts.inc @@ -1,8 +1,8 @@ Route113_GlassWorkshop_MapScripts:: @ 826ED03 - map_script MAP_SCRIPT_ON_TRANSITION, Route113_GlassWorkshop_MapScript1_26ED09 + map_script MAP_SCRIPT_ON_TRANSITION, Route113_GlassWorkshop_OnTransition .byte 0 -Route113_GlassWorkshop_MapScript1_26ED09: @ 826ED09 +Route113_GlassWorkshop_OnTransition: @ 826ED09 setflag FLAG_LANDMARK_GLASS_WORKSHOP compare VAR_GLASS_WORKSHOP_STATE, 1 call_if_eq Route113_GlassWorkshop_EventScript_26ED18 diff --git a/data/maps/Route114_FossilManiacsHouse/scripts.inc b/data/maps/Route114_FossilManiacsHouse/scripts.inc index d41bc0dee..83fade3e6 100644 --- a/data/maps/Route114_FossilManiacsHouse/scripts.inc +++ b/data/maps/Route114_FossilManiacsHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_FossilManiacsHouse_MapScripts:: @ 822AD30 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_OnTransition .byte 0 -Route114_FossilManiacsHouse_MapScript1_SetLandmark: @ 822AD36 +Route114_FossilManiacsHouse_OnTransition: @ 822AD36 setflag FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE end diff --git a/data/maps/Route114_LanettesHouse/scripts.inc b/data/maps/Route114_LanettesHouse/scripts.inc index 5ea42a42a..e24f6ce65 100644 --- a/data/maps/Route114_LanettesHouse/scripts.inc +++ b/data/maps/Route114_LanettesHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_LanettesHouse_MapScripts:: @ 822B2C8 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_OnTransition .byte 0 -Route114_LanettesHouse_MapScript1_SetLandmark: @ 822B2CE +Route114_LanettesHouse_OnTransition: @ 822B2CE setflag FLAG_LANDMARK_LANETTES_HOUSE end diff --git a/data/maps/Route116_TunnelersRestHouse/scripts.inc b/data/maps/Route116_TunnelersRestHouse/scripts.inc index f9ebcc76a..e4e943e61 100644 --- a/data/maps/Route116_TunnelersRestHouse/scripts.inc +++ b/data/maps/Route116_TunnelersRestHouse/scripts.inc @@ -1,8 +1,8 @@ Route116_TunnelersRestHouse_MapScripts:: @ 822B850 - map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_OnTransition .byte 0 -Route116_TunnelersRestHouse_MapScript1_SetLandmark: @ 822B856 +Route116_TunnelersRestHouse_OnTransition: @ 822B856 setflag FLAG_LANDMARK_TUNNELERS_REST_HOUSE end diff --git a/data/maps/Route117_PokemonDayCare/scripts.inc b/data/maps/Route117_PokemonDayCare/scripts.inc index b9ddfaa5a..898935b26 100644 --- a/data/maps/Route117_PokemonDayCare/scripts.inc +++ b/data/maps/Route117_PokemonDayCare/scripts.inc @@ -1,8 +1,8 @@ Route117_PokemonDayCare_MapScripts:: @ 822BBB1 - map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_OnTransition .byte 0 -Route117_PokemonDayCare_MapScript1_SetLandmark: @ 822BBB7 +Route117_PokemonDayCare_OnTransition: @ 822BBB7 setflag FLAG_LANDMARK_POKEMON_DAYCARE end diff --git a/data/maps/Route123_BerryMastersHouse/scripts.inc b/data/maps/Route123_BerryMastersHouse/scripts.inc index 0f0326119..939cfed80 100644 --- a/data/maps/Route123_BerryMastersHouse/scripts.inc +++ b/data/maps/Route123_BerryMastersHouse/scripts.inc @@ -1,8 +1,8 @@ Route123_BerryMastersHouse_MapScripts:: @ 826F83B - map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_OnTransition .byte 0 -Route123_BerryMastersHouse_MapScript1_SetLandmark: @ 826F841 +Route123_BerryMastersHouse_OnTransition: @ 826F841 setflag FLAG_LANDMARK_BERRY_MASTERS_HOUSE end diff --git a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc index a1b7527a1..e1fb3d6f8 100644 --- a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc +++ b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc @@ -1,8 +1,8 @@ Route124_DivingTreasureHuntersHouse_MapScripts:: @ 8270A28 - map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_OnTransition .byte 0 -Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark: @ 8270A2E +Route124_DivingTreasureHuntersHouse_OnTransition: @ 8270A2E setflag FLAG_LANDMARK_HUNTERS_HOUSE end diff --git a/data/maps/ScorchedSlab/scripts.inc b/data/maps/ScorchedSlab/scripts.inc index 3d6aa1cfe..34ad01330 100644 --- a/data/maps/ScorchedSlab/scripts.inc +++ b/data/maps/ScorchedSlab/scripts.inc @@ -1,8 +1,8 @@ ScorchedSlab_MapScripts:: @ 8239291 - map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_OnTransition .byte 0 -ScorchedSlab_MapScript1_SetLandmark: @ 8239297 +ScorchedSlab_OnTransition: @ 8239297 setflag FLAG_LANDMARK_SCORCHED_SLAB end diff --git a/data/maps/SealedChamber_OuterRoom/scripts.inc b/data/maps/SealedChamber_OuterRoom/scripts.inc index f0337548e..30228fda0 100644 --- a/data/maps/SealedChamber_OuterRoom/scripts.inc +++ b/data/maps/SealedChamber_OuterRoom/scripts.inc @@ -1,6 +1,6 @@ SealedChamber_OuterRoom_MapScripts:: @ 8239106 map_script MAP_SCRIPT_ON_RESUME, SealedChamber_OuterRoom_MapScript1_239116 - map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_OnTransition map_script MAP_SCRIPT_ON_LOAD, SealedChamber_OuterRoom_MapScript1_23912B .byte 0 @@ -9,7 +9,7 @@ SealedChamber_OuterRoom_MapScript1_239116: @ 8239116 setescapewarp MAP_UNDERWATER_SEALED_CHAMBER, 255, 12, 44 end -SealedChamber_OuterRoom_MapScript1_SetLandmark: @ 8239127 +SealedChamber_OuterRoom_OnTransition: @ 8239127 setflag FLAG_LANDMARK_SEALED_CHAMBER end diff --git a/data/maps/SkyPillar_Entrance/scripts.inc b/data/maps/SkyPillar_Entrance/scripts.inc index 7b5434eff..bc213d376 100644 --- a/data/maps/SkyPillar_Entrance/scripts.inc +++ b/data/maps/SkyPillar_Entrance/scripts.inc @@ -1,8 +1,8 @@ SkyPillar_Entrance_MapScripts:: @ 823929E - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_OnTransition .byte 0 -SkyPillar_Entrance_MapScript1_SetLandmark: @ 82392A4 +SkyPillar_Entrance_OnTransition: @ 82392A4 setflag FLAG_LANDMARK_SKY_PILLAR end diff --git a/data/maps/SouthernIsland_Exterior/scripts.inc b/data/maps/SouthernIsland_Exterior/scripts.inc index 84406d111..e3ecfa3db 100644 --- a/data/maps/SouthernIsland_Exterior/scripts.inc +++ b/data/maps/SouthernIsland_Exterior/scripts.inc @@ -1,8 +1,8 @@ SouthernIsland_Exterior_MapScripts:: @ 82429C8 - map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_OnTransition .byte 0 -SouthernIsland_Exterior_MapScript1_SetLandmark: @ 82429CE +SouthernIsland_Exterior_OnTransition: @ 82429CE setflag FLAG_LANDMARK_SOUTHERN_ISLAND end diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index 63e067a9a..60dc2149a 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -1,12 +1,12 @@ TrainerHill_Entrance_MapScripts:: @ 82680AC map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Entrance_MapScript1_2680D0 map_script MAP_SCRIPT_ON_RETURN_TO_FIELD, TrainerHill_Entrance_MapScript1_26811B - map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_MapScript1_2680C6 + map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_OnTransition map_script MAP_SCRIPT_ON_LOAD, TrainerHill_Entrance_MapScript1_268128 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Entrance_MapScript2_26813E .byte 0 -TrainerHill_Entrance_MapScript1_2680C6: @ 82680C6 +TrainerHill_Entrance_OnTransition: @ 82680C6 setflag FLAG_LANDMARK_TRAINER_HILL getplayerxy VAR_TEMP_D, VAR_RESULT end diff --git a/data/maps/Underwater_SeafloorCavern/map.json b/data/maps/Underwater_SeafloorCavern/map.json index 8e7d2c554..eedec4500 100644 --- a/data/maps/Underwater_SeafloorCavern/map.json +++ b/data/maps/Underwater_SeafloorCavern/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" } ], diff --git a/data/maps/Underwater_SeafloorCavern/scripts.inc b/data/maps/Underwater_SeafloorCavern/scripts.inc index 9dc5b406a..3e7c1e22c 100644 --- a/data/maps/Underwater_SeafloorCavern/scripts.inc +++ b/data/maps/Underwater_SeafloorCavern/scripts.inc @@ -1,10 +1,10 @@ Underwater_SeafloorCavern_MapScripts:: @ 823433B map_script MAP_SCRIPT_ON_RESUME, Underwater_SeafloorCavern_MapScript1_2343D3 - map_script MAP_SCRIPT_ON_TRANSITION, Underwater_SeafloorCavern_MapScript1_23434B + map_script MAP_SCRIPT_ON_TRANSITION, Underwater_SeafloorCavern_OnTransition map_script MAP_SCRIPT_ON_LOAD, Underwater_SeafloorCavern_MapScript1_23435C .byte 0 -Underwater_SeafloorCavern_MapScript1_23434B: @ 823434B +Underwater_SeafloorCavern_OnTransition: @ 823434B setflag FLAG_LANDMARK_SEAFLOOR_CAVERN goto_if_set FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, Underwater_SeafloorCavern_EventScript_234358 end @@ -36,11 +36,11 @@ Underwater_SeafloorCavern_MapScript1_2343D3: @ 82343D3 setdivewarp MAP_SEAFLOOR_CAVERN_ENTRANCE, 255, 10, 17 end -Underwater_SeafloorCavern_EventScript_2343DC:: @ 82343DC - msgbox Underwater_SeafloorCavern_Text_2343E5, MSGBOX_SIGN +Underwater_SeafloorCavern_EventScript_CheckStolenSub:: @ 82343DC + msgbox Underwater_SeafloorCavern_Text_SubExplorer1, MSGBOX_SIGN end -Underwater_SeafloorCavern_Text_2343E5: @ 82343E5 +Underwater_SeafloorCavern_Text_SubExplorer1: @ 82343E5 .string "“SUBMARINE EXPLORER 1” is painted\n" .string "on the hull.\p" .string "This is the submarine TEAM AQUA\n" diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index 027633a82..2dc016a52 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -1,261 +1,261 @@ BerryTreeScript:: @ 82742F9 special EventObjectInteractionGetBerryTreeData switch VAR_0x8004 - case 255, Route102_EventScript_27434F - case 0, Route102_EventScript_CheckSoil - case 1, Route102_EventScript_CheckBerryStage1 - case 2, Route102_EventScript_CheckBerryStage2 - case 3, Route102_EventScript_CheckBerryStage3 - case 4, Route102_EventScript_CheckBerryStage4 - case 5, Route102_EventScript_CheckBerryFullyGrown + case 255, BerryTree_EventScript_27434F + case 0, BerryTree_EventScript_CheckSoil + case 1, BerryTree_EventScript_CheckBerryStage1 + case 2, BerryTree_EventScript_CheckBerryStage2 + case 3, BerryTree_EventScript_CheckBerryStage3 + case 4, BerryTree_EventScript_CheckBerryStage4 + case 5, BerryTree_EventScript_CheckBerryFullyGrown end -Route102_EventScript_27434F:: @ 827434F +BerryTree_EventScript_27434F:: @ 827434F lockall - message Route102_Text_ExclamationPoint + message BerryTree_Text_ExclamationPoint waitmessage waitbuttonpress releaseall end -Route102_EventScript_CheckSoil:: @ 8274359 +BerryTree_EventScript_CheckSoil:: @ 8274359 lock faceplayer specialvar VAR_RESULT, PlayerHasBerries compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_WantToPlant - message Route102_Text_ItsSoftLoamySoil + goto_if_eq BerryTree_EventScript_WantToPlant + message BerryTree_Text_ItsSoftLoamySoil waitmessage waitbuttonpress release end -Route102_EventScript_WantToPlant:: @ 8274374 - msgbox Route102_Text_WantToPlant, MSGBOX_YESNO +BerryTree_EventScript_WantToPlant:: @ 8274374 + msgbox BerryTree_Text_WantToPlant, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_ChooseBerryToPlant + goto_if_eq BerryTree_EventScript_ChooseBerryToPlant compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_CancelPlanting + goto_if_eq BerryTree_EventScript_CancelPlanting end -Route102_EventScript_ChooseBerryToPlant:: @ 8274393 +BerryTree_EventScript_ChooseBerryToPlant:: @ 8274393 fadescreen 1 closemessage special Bag_ChooseBerry waitstate compare VAR_ITEM_ID, 0 - goto_if_eq Route102_EventScript_CancelPlanting + goto_if_eq BerryTree_EventScript_CancelPlanting takeitem VAR_ITEM_ID, 1 - call Route102_EventScript_PlantBerry + call BerryTree_EventScript_PlantBerry -Route102_EventScript_CancelPlanting:: @ 82743AF +BerryTree_EventScript_CancelPlanting:: @ 82743AF release end -Route102_EventScript_CheckBerryStage1:: @ 82743B1 +BerryTree_EventScript_CheckBerryStage1:: @ 82743B1 lockall special EventObjectInteractionGetBerryCountString - message Route102_Text_BerryGrowthStage1 + message BerryTree_Text_BerryGrowthStage1 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage2:: @ 82743C1 +BerryTree_EventScript_CheckBerryStage2:: @ 82743C1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage2 + message BerryTree_Text_BerryGrowthStage2 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage3:: @ 82743D1 +BerryTree_EventScript_CheckBerryStage3:: @ 82743D1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage3 + message BerryTree_Text_BerryGrowthStage3 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage4:: @ 82743E1 - call Route102_EventScript_GetCareAdverb +BerryTree_EventScript_CheckBerryStage4:: @ 82743E1 + call BerryTree_EventScript_GetCareAdverb lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage4 + message BerryTree_Text_BerryGrowthStage4 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_GetCareAdverb:: @ 82743F6 +BerryTree_EventScript_GetCareAdverb:: @ 82743F6 compare VAR_0x8005, 0 - goto_if_eq Route102_EventScript_SetAdverbPoor + goto_if_eq BerryTree_EventScript_SetAdverbPoor compare VAR_0x8005, 4 - goto_if_eq Route102_EventScript_SetAdverbGreat - bufferstring 1, Route102_Text_CareAdverbGood + goto_if_eq BerryTree_EventScript_SetAdverbGreat + bufferstring 1, BerryTree_Text_CareAdverbGood return -Route102_EventScript_SetAdverbGreat:: @ 8274413 - bufferstring 1, Route102_Text_CareAdverbGreat +BerryTree_EventScript_SetAdverbGreat:: @ 8274413 + bufferstring 1, BerryTree_Text_CareAdverbGreat return -Route102_EventScript_SetAdverbPoor:: @ 827441A - bufferstring 1, Route102_Text_CareAdverbPoor +BerryTree_EventScript_SetAdverbPoor:: @ 827441A + bufferstring 1, BerryTree_Text_CareAdverbPoor return -Route102_EventScript_CheckBerryFullyGrown:: @ 8274421 +BerryTree_EventScript_CheckBerryFullyGrown:: @ 8274421 buffernumberstring 1, VAR_0x8006 lock faceplayer special EventObjectInteractionGetBerryCountString - msgbox Route102_Text_WantToPick, MSGBOX_YESNO + msgbox BerryTree_Text_WantToPick, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_PickBerry + goto_if_eq BerryTree_EventScript_PickBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_CancelPickingBerry + goto_if_eq BerryTree_EventScript_CancelPickingBerry -Route102_EventScript_PickBerry:: @ 8274448 +BerryTree_EventScript_PickBerry:: @ 8274448 special EventObjectInteractionPickBerryTree compare VAR_0x8004, 0 - goto_if_eq Route102_EventScript_BerryPocketFull + goto_if_eq BerryTree_EventScript_BerryPocketFull special sub_80EED34 special EventObjectInteractionRemoveBerryTree - message Route102_Text_PickedTheBerry + message BerryTree_Text_PickedTheBerry playfanfare MUS_ME_KINOMI waitmessage waitfanfare waitbuttonpress - message Route102_Text_PutAwayBerry + message BerryTree_Text_PutAwayBerry waitmessage waitbuttonpress release end -Route102_EventScript_BerryPocketFull:: @ 8274470 - message Route102_Text_BerryPocketFull +BerryTree_EventScript_BerryPocketFull:: @ 8274470 + message BerryTree_Text_BerryPocketFull waitmessage waitbuttonpress release end -Route102_EventScript_CancelPickingBerry:: @ 8274479 - message Route102_Text_BerryLeftUnpicked +BerryTree_EventScript_CancelPickingBerry:: @ 8274479 + message BerryTree_Text_BerryLeftUnpicked waitmessage waitbuttonpress release end -Route102_EventScript_274482:: @ 8274482 +BerryTree_EventScript_274482:: @ 8274482 lockall special EventObjectInteractionGetBerryTreeData - call Route102_EventScript_PlantBerry + call BerryTree_EventScript_PlantBerry releaseall end -Route102_EventScript_WantToWater:: @ 827448D +BerryTree_EventScript_WantToWater:: @ 827448D checkitem ITEM_WAILMER_PAIL, 1 compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_DontWater + goto_if_eq BerryTree_EventScript_DontWater special EventObjectInteractionGetBerryName - msgbox Route102_Text_WantToWater, MSGBOX_YESNO + msgbox BerryTree_Text_WantToWater, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_WaterBerry + goto_if_eq BerryTree_EventScript_WaterBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_DontWater + goto_if_eq BerryTree_EventScript_DontWater -Route102_EventScript_DontWater:: @ 82744BE +BerryTree_EventScript_DontWater:: @ 82744BE releaseall end -Route102_EventScript_2744C0:: @ 82744C0 +BerryTree_EventScript_2744C0:: @ 82744C0 special EventObjectInteractionGetBerryTreeData lockall -Route102_EventScript_WaterBerry:: @ 82744C4 +BerryTree_EventScript_WaterBerry:: @ 82744C4 special EventObjectInteractionGetBerryName - message Route102_Text_WateredTheBerry + message BerryTree_Text_WateredTheBerry waitmessage special EventObjectInteractionWaterBerryTree special DoWateringBerryTreeAnim waitstate - message Route102_Text_PlantIsDelighted + message BerryTree_Text_PlantIsDelighted waitmessage waitbuttonpress releaseall end -Route102_EventScript_PlantBerry:: @ 82744DD +BerryTree_EventScript_PlantBerry:: @ 82744DD special EventObjectInteractionPlantBerryTree incrementgamestat 3 special sub_80EED10 special EventObjectInteractionGetBerryCountString - message Route102_Text_PlantedOneBerry + message BerryTree_Text_PlantedOneBerry waitmessage waitbuttonpress return -Route102_Text_ItsSoftLoamySoil: @ 82744F0 +BerryTree_Text_ItsSoftLoamySoil: @ 82744F0 .string "It's soft, loamy soil.$" -Route102_Text_WantToPlant: @ 8274507 +BerryTree_Text_WantToPlant: @ 8274507 .string "It's soft, loamy soil.\n" .string "Want to plant a BERRY?$" -Route102_Text_PlantedOneBerry: @ 8274535 +BerryTree_Text_PlantedOneBerry: @ 8274535 .string "{PLAYER} planted one {STR_VAR_1} in\n" .string "the soft, loamy soil.$" -Route102_Text_BerryGrowthStage1: @ 8274560 +BerryTree_Text_BerryGrowthStage1: @ 8274560 .string "One {STR_VAR_1} was planted here.$" -Route102_Text_BerryGrowthStage2: @ 8274579 +BerryTree_Text_BerryGrowthStage2: @ 8274579 .string "{STR_VAR_1} has sprouted.$" -Route102_Text_BerryGrowthStage3: @ 827458A +BerryTree_Text_BerryGrowthStage3: @ 827458A .string "This {STR_VAR_1} plant is growing taller.$" -Route102_Text_BerryGrowthStage4: @ 82745AB +BerryTree_Text_BerryGrowthStage4: @ 82745AB .string "These {STR_VAR_1} flowers are blooming\n" .string "{STR_VAR_2}.$" -Route102_Text_CareAdverbGreat: @ 82745CD +BerryTree_Text_CareAdverbGreat: @ 82745CD .string "very beautifully$" -Route102_Text_CareAdverbPoor: @ 82745DE +BerryTree_Text_CareAdverbPoor: @ 82745DE .string "cutely$" -Route102_Text_CareAdverbGood: @ 82745E5 +BerryTree_Text_CareAdverbGood: @ 82745E5 .string "prettily$" -Route102_Text_WantToPick: @ 82745EE +BerryTree_Text_WantToPick: @ 82745EE .string "You found {STR_VAR_2} {STR_VAR_1}!\p" .string "Do you want to pick the\n" .string "{STR_VAR_1}?$" -Route102_Text_PickedTheBerry: @ 827461B +BerryTree_Text_PickedTheBerry: @ 827461B .string "{PLAYER} picked the {STR_VAR_2} {STR_VAR_1}.$" -Route102_Text_PutAwayBerry: @ 8274630 +BerryTree_Text_PutAwayBerry: @ 8274630 .string "{PLAYER} put away the {STR_VAR_1}\n" .string "in the BAG's BERRIES POCKET.\p" .string "The soil returned to its soft and\n" .string "loamy state.$" -Route102_Text_BerryPocketFull: @ 827468F +BerryTree_Text_BerryPocketFull: @ 827468F .string "The BAG's BERRIES POCKET is full.\p" .string "The {STR_VAR_1} couldn't be taken.$" -Route102_Text_BerryLeftUnpicked: @ 82746CB +BerryTree_Text_BerryLeftUnpicked: @ 82746CB .string "{PLAYER} left the {STR_VAR_1}\n" .string "unpicked.$" -Route102_Text_WantToWater: @ 82746E4 +BerryTree_Text_WantToWater: @ 82746E4 .string "Want to water the {STR_VAR_1} with the\n" .string "WAILMER PAIL?$" -Route102_Text_WateredTheBerry: @ 8274710 +BerryTree_Text_WateredTheBerry: @ 8274710 .string "{PLAYER} watered the {STR_VAR_1}.$" -Route102_Text_PlantIsDelighted: @ 8274723 +BerryTree_Text_PlantIsDelighted: @ 8274723 .string "The plant seems to be delighted.$" -Route102_Text_ExclamationPoint: @ 8274744 +BerryTree_Text_ExclamationPoint: @ 8274744 .string "!$" diff --git a/include/bard_music.h b/include/bard_music.h index 488205405..882606b27 100644 --- a/include/bard_music.h +++ b/include/bard_music.h @@ -38,7 +38,7 @@ struct BardSong // Exported ROM declarations -extern const u16 gUnknown_085F5490; +extern const u16 gNumSpeciesNames; extern const u16 gUnknown_085FA1D4; const struct BardSound *GetWordSounds(u16 word); void GetWordPhonemes(struct BardSong *song, u16 word); diff --git a/src/data/bard_music/pokemon.h b/src/data/bard_music/pokemon.h index 693005360..112a5870b 100644 --- a/src/data/bard_music/pokemon.h +++ b/src/data/bard_music/pokemon.h @@ -2,7 +2,7 @@ #define GUARD_DATA_BARD_MUSIC_POKEMON_H #include "constants/species.h" -const u16 gUnknown_085F5490 = NUM_SPECIES; +const u16 gNumSpeciesNames = NUM_SPECIES; const struct BardSound gBardSounds_Pokemon[][6] = { { diff --git a/src/easy_chat.c b/src/easy_chat.c index 1cb7b0fe8..4388592f7 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -4882,7 +4882,7 @@ bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) { case EC_GROUP_POKEMON: case EC_GROUP_POKEMON_2: - numWordsInGroup = gUnknown_085F5490; + numWordsInGroup = gNumSpeciesNames; break; case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: diff --git a/src/item_use.c b/src/item_use.c index 7947964ca..159ece398 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -42,8 +42,8 @@ #include "constants/vars.h" #include "event_obj_lock.h" -extern u8 Route102_EventScript_274482[]; -extern u8 Route102_EventScript_2744C0[]; +extern u8 BerryTree_EventScript_274482[]; +extern u8 BerryTree_EventScript_2744C0[]; extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; void SetUpItemUseCallback(u8 taskId); @@ -669,7 +669,7 @@ void sub_80FDD74(u8 taskId) { RemoveBagItem(gSpecialVar_ItemId, 1); ScriptContext2_Enable(); - ScriptContext1_SetupScript(Route102_EventScript_274482); + ScriptContext1_SetupScript(BerryTree_EventScript_274482); DestroyTask(taskId); } @@ -694,7 +694,7 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId) void sub_80FDE08(u8 taskId) { ScriptContext2_Enable(); - ScriptContext1_SetupScript(Route102_EventScript_2744C0); + ScriptContext1_SetupScript(BerryTree_EventScript_2744C0); DestroyTask(taskId); }