Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/maps/MtSilver_MountainSide/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WALK_UP_AND_DOWN",
"movement_range_x": 6,
"movement_range_y": 20,
"movement_range_y": 15,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "NULL",
Expand All @@ -268,7 +268,7 @@
"elevation": 0,
"movement_type": "MOVEMENT_TYPE_WALK_UP_AND_DOWN",
"movement_range_x": 6,
"movement_range_y": 20,
"movement_range_y": 15,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "NULL",
Expand Down
1 change: 0 additions & 1 deletion data/scripts/mom_savings.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ Mom_Text_GiftCall_Decoration:
.string "for your room!\p"
.string "Check your DECORATIONS when you\n"
.string "come home. Take care!$"

3 changes: 3 additions & 0 deletions include/rtc_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#ifndef RTC_INCLUDE_H
#define RTC_INCLUDE_H

#include "siirtc.h"
#include "rtc.h"

void RtcGetInfoFake(struct SiiRtcInfo *rtc);
void RtcCalcTimeDifferenceFake(struct SiiRtcInfo *rtc, struct Time *result, struct Time *t);
void RtcAdvanceTime(int hours, int minutes, int seconds);
Expand Down
83 changes: 42 additions & 41 deletions src/battle_dome.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,8 @@ static void InitDomeTrainers(void)
ivs = GetDomeTrainerMonIvs(DOME_TRAINERS[i].trainerId);
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
{
CalcDomeMonStats(gFacilityTrainerMons[DOME_MONS[i][j]].species,
species[j] = gFacilityTrainerMons[DOME_MONS[i][j]].species;
CalcDomeMonStats(species[j],
monLevel, ivs,
gFacilityTrainerMons[DOME_MONS[i][j]].evSpread,
gFacilityTrainerMons[DOME_MONS[i][j]].nature,
Expand All @@ -2427,56 +2428,56 @@ static void InitDomeTrainers(void)
rankingScores[i] += statValues[STAT_SPEED];
rankingScores[i] += statValues[STAT_HP];
if ((gSaveBlock1Ptr->tx_Mode_Modern_Types == 0)
&& (species == SPECIES_ARBOK
|| species == SPECIES_PARASECT
|| species == SPECIES_GOLDUCK
|| species == SPECIES_KINGLER
|| species == SPECIES_MEGANIUM
|| species == SPECIES_TYPHLOSION
|| species == SPECIES_FERALIGATR
|| species == SPECIES_NOCTOWL
|| species == SPECIES_SUNFLORA
|| species == SPECIES_STANTLER
|| species == SPECIES_GROVYLE
|| species == SPECIES_SCEPTILE
|| species == SPECIES_MASQUERAIN
|| species == SPECIES_DELCATTY
|| species == SPECIES_GULPIN
|| species == SPECIES_SWALOT
|| species == SPECIES_LUVDISC
|| species == SPECIES_ELECTIVIRE))
&& (species[j] == SPECIES_ARBOK
|| species[j] == SPECIES_PARASECT
|| species[j] == SPECIES_GOLDUCK
|| species[j] == SPECIES_KINGLER
|| species[j] == SPECIES_MEGANIUM
|| species[j] == SPECIES_TYPHLOSION
|| species[j] == SPECIES_FERALIGATR
|| species[j] == SPECIES_NOCTOWL
|| species[j] == SPECIES_SUNFLORA
|| species[j] == SPECIES_STANTLER
|| species[j] == SPECIES_GROVYLE
|| species[j] == SPECIES_SCEPTILE
|| species[j] == SPECIES_MASQUERAIN
|| species[j] == SPECIES_DELCATTY
|| species[j] == SPECIES_GULPIN
|| species[j] == SPECIES_SWALOT
|| species[j] == SPECIES_LUVDISC
|| species[j] == SPECIES_ELECTIVIRE))
{
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_old[0]];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_old[1]];
}
else if ((gSaveBlock1Ptr->tx_Mode_Fairy_Types == 0)
&& (species == SPECIES_JIGGLYPUFF
|| species == SPECIES_WIGGLYTUFF
|| species == SPECIES_CLEFAIRY
|| species == SPECIES_CLEFABLE
|| species == SPECIES_MR_MIME
|| species == SPECIES_CLEFFA
|| species == SPECIES_IGGLYBUFF
|| species == SPECIES_TOGEPI
|| species == SPECIES_TOGETIC
|| species == SPECIES_MARILL
|| species == SPECIES_AZUMARILL
|| species == SPECIES_SNUBBULL
|| species == SPECIES_GRANBULL
|| species == SPECIES_RALTS
|| species == SPECIES_KIRLIA
|| species == SPECIES_GARDEVOIR
|| species == SPECIES_AZURILL
|| species == SPECIES_MAWILE
|| species == SPECIES_MIME_JR
|| species == SPECIES_TOGEKISS))
&& (species[j] == SPECIES_JIGGLYPUFF
|| species[j] == SPECIES_WIGGLYTUFF
|| species[j] == SPECIES_CLEFAIRY
|| species[j] == SPECIES_CLEFABLE
|| species[j] == SPECIES_MR_MIME
|| species[j] == SPECIES_CLEFFA
|| species[j] == SPECIES_IGGLYBUFF
|| species[j] == SPECIES_TOGEPI
|| species[j] == SPECIES_TOGETIC
|| species[j] == SPECIES_MARILL
|| species[j] == SPECIES_AZUMARILL
|| species[j] == SPECIES_SNUBBULL
|| species[j] == SPECIES_GRANBULL
|| species[j] == SPECIES_RALTS
|| species[j] == SPECIES_KIRLIA
|| species[j] == SPECIES_GARDEVOIR
|| species[j] == SPECIES_AZURILL
|| species[j] == SPECIES_MAWILE
|| species[j] == SPECIES_MIME_JR
|| species[j] == SPECIES_TOGEKISS))
{
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_old[0]];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_old[1]];
}
else if ((gSaveBlock1Ptr->tx_Mode_Fairy_Types == 1)
&& (species == SPECIES_SNUBBULL
|| species == SPECIES_GRANBULL))
&& (species[j] == SPECIES_SNUBBULL
|| species[j] == SPECIES_GRANBULL))
{
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_new[0]];
monTypesBits |= gBitTable[gSpeciesInfo[gFacilityTrainerMons[DOME_MONS[i][j]].species].types_new[1]];
Expand Down
15 changes: 8 additions & 7 deletions src/decoration_inventory.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ EWRAM_DATA struct DecorationInventory gDecorationInventories[DECORCAT_COUNT] = {

void SetDecorationInventoriesPointers(void)
{
SET_DECOR_INV(DECORCAT_DESK, gSaveBlock1Ptr->decorationDesks);
SET_DECOR_INV(DECORCAT_CHAIR, gSaveBlock1Ptr->decorationChairs);
SET_DECOR_INV(DECORCAT_PLANT, gSaveBlock1Ptr->decorationPlants);
SET_DECOR_INV(DECORCAT_ORNAMENT, gSaveBlock1Ptr->decorationOrnaments);
SET_DECOR_INV(DECORCAT_MAT, gSaveBlock1Ptr->decorationMats);
SET_DECOR_INV(DECORCAT_POSTER, gSaveBlock1Ptr->decorationPosters);
// Not used in HnS, but left in for compatibility with vanilla and potential future use.
// SET_DECOR_INV(DECORCAT_DESK, gSaveBlock1Ptr->decorationDesks);
// SET_DECOR_INV(DECORCAT_CHAIR, gSaveBlock1Ptr->decorationChairs);
// SET_DECOR_INV(DECORCAT_PLANT, gSaveBlock1Ptr->decorationPlants);
// SET_DECOR_INV(DECORCAT_ORNAMENT, gSaveBlock1Ptr->decorationOrnaments);
// SET_DECOR_INV(DECORCAT_MAT, gSaveBlock1Ptr->decorationMats);
// SET_DECOR_INV(DECORCAT_POSTER, gSaveBlock1Ptr->decorationPosters);
SET_DECOR_INV(DECORCAT_DOLL, gSaveBlock1Ptr->decorationDolls);
SET_DECOR_INV(DECORCAT_CUSHION, gSaveBlock1Ptr->decorationCushions);
// SET_DECOR_INV(DECORCAT_CUSHION, gSaveBlock1Ptr->decorationCushions);
InitDecorationContextItems();
}

Expand Down
4 changes: 2 additions & 2 deletions src/frontier_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ static u8 AppendCaughtBannedMonSpeciesName(u16 species, u8 count, s32 numBannedM
static void AppendIfValid(u16 species, u16 heldItem, u16 hp, u8 lvlMode, u8 monLevel, u16 *speciesArray, u16 *itemsArray, u8 *count)
{
s32 i = 0;
u16* gFrontierBannedSpecies;
const u16* gFrontierBannedSpecies;
if (gSaveBlock1Ptr->tx_Features_FrontierBans == 0)
gFrontierBannedSpecies = gFrontierBannedSpeciesNormal;
else if (gSaveBlock1Ptr->tx_Features_FrontierBans == 1)
Expand Down Expand Up @@ -2129,7 +2129,7 @@ static void CheckPartyIneligibility(void)
{
s32 i;
s32 caughtBannedMons = 0;
u16* gFrontierBannedSpecies;
const u16* gFrontierBannedSpecies;
if (gSaveBlock1Ptr->tx_Features_FrontierBans == 0)
gFrontierBannedSpecies = gFrontierBannedSpeciesNormal;
else if (gSaveBlock1Ptr->tx_Features_FrontierBans == 1)
Expand Down
22 changes: 13 additions & 9 deletions src/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count)
return FALSE;
}

#define MAX_PYRAMID_BAG_ITEM_QUANTITY 255

bool8 AddPyramidBagItem(u16 itemId, u16 count)
{
u16 i;
Expand All @@ -801,16 +803,17 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)

for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
if (newItems[i] == itemId && newQuantities[i] < MAX_BAG_ITEM_CAPACITY)
if (newItems[i] == itemId && newQuantities[i] < MAX_PYRAMID_BAG_ITEM_QUANTITY)
{
newQuantities[i] += count;
if (newQuantities[i] > MAX_BAG_ITEM_CAPACITY)
u16 newVal = newQuantities[i] + count;
if (newVal > MAX_PYRAMID_BAG_ITEM_QUANTITY)
{
count = newQuantities[i] - MAX_BAG_ITEM_CAPACITY;
newQuantities[i] = MAX_BAG_ITEM_CAPACITY;
count = newVal - MAX_PYRAMID_BAG_ITEM_QUANTITY;
newQuantities[i] = MAX_PYRAMID_BAG_ITEM_QUANTITY;
}
else
{
newQuantities[i] = newVal;
count = 0;
}

Expand All @@ -825,15 +828,16 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count)
{
if (newItems[i] == ITEM_NONE)
{
u16 newVal = count;
newItems[i] = itemId;
newQuantities[i] = count;
if (newQuantities[i] > MAX_BAG_ITEM_CAPACITY)
if (newVal > 255)
{
count = newQuantities[i] - MAX_BAG_ITEM_CAPACITY;
newQuantities[i] = MAX_BAG_ITEM_CAPACITY;
count = newVal - 255;
newQuantities[i] = 255;
}
else
{
newQuantities[i] = newVal;
count = 0;
}

Expand Down
8 changes: 7 additions & 1 deletion src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -7395,7 +7395,10 @@ u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data)
return ret;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattribute-alias="
u32 GetMonData2(struct Pokemon *mon, s32 field) __attribute__((alias("GetMonData3")));
#pragma GCC diagnostic pop

/* GameFreak called GetBoxMonData with either 2 or 3 arguments, for type
* safety we have a GetBoxMonData macro (in include/pokemon.h) which
Expand Down Expand Up @@ -7772,7 +7775,10 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
return retVal;
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattribute-alias="
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("GetBoxMonData3")));
#pragma GCC diagnostic pop

#define SET8(lhs) (lhs) = *data
#define SET16(lhs) (lhs) = data[0] + (data[1] << 8)
Expand Down Expand Up @@ -7927,7 +7933,7 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
case MON_DATA_PP2:
case MON_DATA_PP3:
case MON_DATA_PP4:
SET8(substruct1->pp[field - MON_DATA_PP1]);
SET8(substruct1->pp[(field - MON_DATA_PP1) & (MAX_MON_MOVES - 1)]);
break;
case MON_DATA_HP_EV:
SET8(substruct2->hpEV);
Expand Down
16 changes: 8 additions & 8 deletions tools/mapjson/json11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class Value : public JsonValue {

// Constructors
explicit Value(const T &value) : m_value(value) {}
explicit Value(T &&value) : m_value(move(value)) {}
explicit Value(T &&value) : m_value(std::move(value)) {}

// Get type tag
Json::Type type() const override {
Expand Down Expand Up @@ -197,23 +197,23 @@ class JsonString final : public Value<Json::STRING, string> {
const string &string_value() const override { return m_value; }
public:
explicit JsonString(const string &value) : Value(value) {}
explicit JsonString(string &&value) : Value(move(value)) {}
explicit JsonString(string &&value) : Value(std::move(value)) {}
};

class JsonArray final : public Value<Json::ARRAY, Json::array> {
const Json::array &array_items() const override { return m_value; }
const Json & operator[](size_t i) const override;
public:
explicit JsonArray(const Json::array &value) : Value(value) {}
explicit JsonArray(Json::array &&value) : Value(move(value)) {}
explicit JsonArray(Json::array &&value) : Value(std::move(value)) {}
};

class JsonObject final : public Value<Json::OBJECT, Json::object> {
const Json::object &object_items() const override { return m_value; }
const Json & operator[](const string &key) const override;
public:
explicit JsonObject(const Json::object &value) : Value(value) {}
explicit JsonObject(Json::object &&value) : Value(move(value)) {}
explicit JsonObject(Json::object &&value) : Value(std::move(value)) {}
};

class JsonNull final : public Value<Json::NUL, NullStruct> {
Expand Down Expand Up @@ -255,12 +255,12 @@ Json::Json(double value) : m_ptr(make_shared<JsonDouble>(value)) {
Json::Json(int value) : m_ptr(make_shared<JsonInt>(value)) {}
Json::Json(bool value) : m_ptr(value ? statics().t : statics().f) {}
Json::Json(const string &value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(move(value))) {}
Json::Json(string &&value) : m_ptr(make_shared<JsonString>(std::move(value))) {}
Json::Json(const char * value) : m_ptr(make_shared<JsonString>(value)) {}
Json::Json(const Json::array &values) : m_ptr(make_shared<JsonArray>(values)) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(move(values))) {}
Json::Json(Json::array &&values) : m_ptr(make_shared<JsonArray>(std::move(values))) {}
Json::Json(const Json::object &values) : m_ptr(make_shared<JsonObject>(values)) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(move(values))) {}
Json::Json(Json::object &&values) : m_ptr(make_shared<JsonObject>(std::move(values))) {}

/* * * * * * * * * * * * * * * * * * * *
* Accessors
Expand Down Expand Up @@ -358,7 +358,7 @@ struct JsonParser final {
* Mark this parse as failed.
*/
Json fail(string &&msg) {
return fail(move(msg), Json());
return fail(std::move(msg), Json());
}

template <typename T>
Expand Down