mirror of
https://github.com/pret/pokeemerald.git
synced 2026-08-22 18:18:05 -05:00
Fix fakematches in battle pyramid (#2310)
In modern, it also decreases instruction count by 1. Co-authored-by: Mike-Goutokuji <83477269+mike-goutokuji@users.noreply.github.com>
This commit is contained in:
@@ -939,9 +939,7 @@ static void SavePyramidChallenge(void)
|
||||
|
||||
static void SetBattlePyramidPrize(void)
|
||||
{
|
||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > 41)
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[gSaveBlock2Ptr->frontier.lvlMode] > 41)
|
||||
gSaveBlock2Ptr->frontier.pyramidPrize = sLongStreakRewardItems[Random() % ARRAY_COUNT(sLongStreakRewardItems)];
|
||||
else
|
||||
gSaveBlock2Ptr->frontier.pyramidPrize = sShortStreakRewardItems[Random() % ARRAY_COUNT(sShortStreakRewardItems)];
|
||||
@@ -1012,7 +1010,7 @@ static void HidePyramidItem(void)
|
||||
struct ObjectEventTemplate *events = gSaveBlock1Ptr->objectEventTemplates;
|
||||
int i = 0;
|
||||
|
||||
for (;;)
|
||||
do
|
||||
{
|
||||
if (events[i].localId == gSpecialVar_LastTalked)
|
||||
{
|
||||
@@ -1023,9 +1021,7 @@ static void HidePyramidItem(void)
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
if (events[i].localId == LOCALID_NONE)
|
||||
break;
|
||||
}
|
||||
} while (events[i].localId != LOCALID_NONE);
|
||||
}
|
||||
|
||||
static void SetPyramidFacilityTrainers(void)
|
||||
@@ -1235,16 +1231,16 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
|
||||
int x, y;
|
||||
u8 textIndex = 0;
|
||||
u16 *map = gBackupMapLayout.map;
|
||||
map += gBackupMapLayout.width * 7 + MAP_OFFSET;
|
||||
map += gBackupMapLayout.width * MAP_OFFSET + MAP_OFFSET;
|
||||
|
||||
for (y = 0; y < 32; map += 47, y++)
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
for (x = 0; x < 32; x++)
|
||||
{
|
||||
if ((map[x] & MAPGRID_METATILE_ID_MASK) == METATILE_BattlePyramid_Exit)
|
||||
{
|
||||
x += MAP_OFFSET - gObjectEvents[gSelectedObjectEvent].initialCoords.x;
|
||||
y += MAP_OFFSET - gObjectEvents[gSelectedObjectEvent].initialCoords.y;
|
||||
x -= gObjectEvents[gSelectedObjectEvent].initialCoords.x - MAP_OFFSET;
|
||||
y -= gObjectEvents[gSelectedObjectEvent].initialCoords.y - MAP_OFFSET;
|
||||
if (x >= minDistanceForExitHint
|
||||
|| x <= -minDistanceForExitHint
|
||||
|| y >= minDistanceForExitHint
|
||||
@@ -1288,7 +1284,10 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
|
||||
}
|
||||
else
|
||||
{
|
||||
textIndex = (~(x + y) >= 0) ? 0 : 2;
|
||||
if (x + y >= 0)
|
||||
textIndex = 2;
|
||||
else
|
||||
textIndex = 0;
|
||||
}
|
||||
*hintType = HINT_EXIT_DIRECTION;
|
||||
}
|
||||
@@ -1299,6 +1298,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
|
||||
return textIndex;
|
||||
}
|
||||
}
|
||||
map += MAP_OFFSET_W + 32;
|
||||
}
|
||||
|
||||
return textIndex;
|
||||
@@ -1531,17 +1531,14 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
||||
for (i = 0; i < NUM_PYRAMID_FLOOR_SQUARES; i++)
|
||||
{
|
||||
u16 *map;
|
||||
int yOffset, xOffset;
|
||||
const struct MapLayout *mapLayout = gMapLayouts[floorLayoutOffsets[i] + LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_FLOOR];
|
||||
const u16 *layoutMap = mapLayout->map;
|
||||
|
||||
gBackupMapLayout.map = backupMapData;
|
||||
gBackupMapLayout.width = mapLayout->width * PYRAMID_FLOOR_SQUARES_WIDE + MAP_OFFSET_W;
|
||||
gBackupMapLayout.height = mapLayout->height * PYRAMID_FLOOR_SQUARES_HIGH + MAP_OFFSET_H;
|
||||
map = backupMapData;
|
||||
yOffset = ((i / PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->height) + MAP_OFFSET) * gBackupMapLayout.width;
|
||||
xOffset = (i % PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->width) + MAP_OFFSET;
|
||||
map += yOffset + xOffset;
|
||||
map = gBackupMapLayout.map;
|
||||
map += (gBackupMapLayout.width * (MAP_OFFSET + (i / PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->height)) + MAP_OFFSET + (i % PYRAMID_FLOOR_SQUARES_WIDE * mapLayout->width));
|
||||
for (y = 0; y < mapLayout->height; y++)
|
||||
{
|
||||
for (x = 0; x < mapLayout->width; x++)
|
||||
|
||||
Reference in New Issue
Block a user