diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2018-01-15 18:59:30 -0500 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2018-01-15 18:59:30 -0500 |
commit | ce391ed0696c22e8fa1f33430b4025a08a3bc360 (patch) | |
tree | dbdd06262cd738bb682d8a9304293ac5d944a071 /src/field | |
parent | bdb0628c913fe7f2e77598d6390f8f7d951b1703 (diff) | |
parent | ed152b1566fa5c39ee72ca190c49fbfe30708036 (diff) |
Merge branch 'master' of https://github.com/pret/pokeruby into fixes
Diffstat (limited to 'src/field')
-rw-r--r-- | src/field/daycare.c | 2 | ||||
-rw-r--r-- | src/field/field_weather.c | 2 | ||||
-rw-r--r-- | src/field/fieldmap.c | 18 | ||||
-rw-r--r-- | src/field/item_use.c | 2 | ||||
-rw-r--r-- | src/field/party_menu.c | 2 | ||||
-rw-r--r-- | src/field/player_pc.c | 2 |
6 files changed, 15 insertions, 13 deletions
diff --git a/src/field/daycare.c b/src/field/daycare.c index 7e4530906..36dd7ec03 100644 --- a/src/field/daycare.c +++ b/src/field/daycare.c @@ -557,7 +557,7 @@ void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, struct BoxP { for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++) { - if (gHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01 + j) && CanMonLearnTMHM(egg, j)) + if (gHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j) && CanMonLearnTMHM(egg, j)) { if (GiveMoveToMon(egg, gHatchedEggFatherMoves[i]) == 0xffff) DeleteFirstMoveAndGiveMoveToMon(egg, gHatchedEggFatherMoves[i]); diff --git a/src/field/field_weather.c b/src/field/field_weather.c index c954242a1..48d7da7f7 100644 --- a/src/field/field_weather.c +++ b/src/field/field_weather.c @@ -843,7 +843,7 @@ void fade_screen(u8 a, u8 delay) bool8 sub_807D770(void) { - return gWeatherPtr->unknown_6C6 ^ 1 ? TRUE : FALSE; + return (gWeatherPtr->unknown_6C6 != 1); } void sub_807D78C(u8 a) diff --git a/src/field/fieldmap.c b/src/field/fieldmap.c index 7a31ae720..7383bb174 100644 --- a/src/field/fieldmap.c +++ b/src/field/fieldmap.c @@ -86,18 +86,20 @@ void map_copy_with_padding(u16 *map, u16 width, u16 height) void sub_80560AC(struct MapHeader *mapHeader) { + // BUG: This results in a null pointer dereference when mapHeader->connections + // is NULL, causing count to be assigned a garbage value. This garbage value + // just so happens to have the most significant bit set, so it is treated as + // negative and the loop below thankfully never executes in this scenario. + int count = mapHeader->connections->count; + struct MapConnection *connection = mapHeader->connections->connections; int i; - struct MapConnection *connection; - struct MapHeader *cMap; - u32 offset; - int count; - count = mapHeader->connections->count; - connection = mapHeader->connections->connections; + gUnknown_0202E850 = sDummyConnectionFlags; for (i = 0; i < count; i++, connection++) { - cMap = mapconnection_get_mapheader(connection); - offset = connection->offset; + struct MapHeader *cMap = mapconnection_get_mapheader(connection); + u32 offset = connection->offset; + switch (connection->direction) { case CONNECTION_SOUTH: diff --git a/src/field/item_use.c b/src/field/item_use.c index bd76db77e..55fb21814 100644 --- a/src/field/item_use.c +++ b/src/field/item_use.c @@ -877,7 +877,7 @@ void ItemUseOutOfBattle_TMHM(u8 taskId) { Menu_EraseWindowRect(0, 0xD, 0xD, 0x14); - if (gSpecialVar_ItemId >= ITEM_HM01) + if (gSpecialVar_ItemId >= ITEM_HM01_CUT) DisplayItemMessageOnField(taskId, gOtherText_BootedHM, sub_80C9EE4, 1); // HM else DisplayItemMessageOnField(taskId, gOtherText_BootedTM, sub_80C9EE4, 1); // TM diff --git a/src/field/party_menu.c b/src/field/party_menu.c index 7d243f569..48275435e 100644 --- a/src/field/party_menu.c +++ b/src/field/party_menu.c @@ -3998,7 +3998,7 @@ void Task_ConfirmTakeHeldMail(u8 taskId) u16 ItemIdToBattleMoveId(u16 item) { - u16 machineNumber = item - ITEM_TM01; + u16 machineNumber = item - ITEM_TM01_FOCUS_PUNCH; return TMHMMoves[machineNumber]; } diff --git a/src/field/player_pc.c b/src/field/player_pc.c index c6813b955..3719b7c7a 100644 --- a/src/field/player_pc.c +++ b/src/field/player_pc.c @@ -853,7 +853,7 @@ static void ItemStorage_DrawTMHMEntry(struct ItemSlot *itemSlot, u8 var, int var { ItemStorage_DrawItemName(itemSlot, var, var2); - if(itemSlot->itemId < ITEM_HM01) + if(itemSlot->itemId < ITEM_HM01_CUT) ItemStorage_DrawItemQuantity(itemSlot->quantity, STR_CONV_MODE_RIGHT_ALIGN, var, 3, var2); else ItemStorage_DrawItemVoidQuantity(var); // HMs do not have a quantity. |