Clarify ql event data
This commit is contained in:
+1
-1
@@ -444,7 +444,7 @@ struct BattleStruct
|
|||||||
u16 castformPalette[MAX_BATTLERS_COUNT][16];
|
u16 castformPalette[MAX_BATTLERS_COUNT][16];
|
||||||
u8 wishPerishSongState;
|
u8 wishPerishSongState;
|
||||||
u8 wishPerishSongBattlerId;
|
u8 wishPerishSongBattlerId;
|
||||||
u8 field_182;
|
u8 lastAttackerToFaintOpponent;
|
||||||
// align 4
|
// align 4
|
||||||
union {
|
union {
|
||||||
struct LinkBattlerHeader linkBattlerHeader;
|
struct LinkBattlerHeader linkBattlerHeader;
|
||||||
|
|||||||
@@ -62,11 +62,11 @@
|
|||||||
#define QL_EVENT_BOUGHT_ITEM 37
|
#define QL_EVENT_BOUGHT_ITEM 37
|
||||||
#define QL_EVENT_SOLD_ITEM 38
|
#define QL_EVENT_SOLD_ITEM 38
|
||||||
#define QL_EVENT_39 39 // Null
|
#define QL_EVENT_39 39 // Null
|
||||||
#define QL_EVENT_OBTAINED_ITEM 40
|
#define QL_EVENT_OBTAINED_STORY_ITEM 40
|
||||||
#define QL_EVENT_41 41 // Null
|
#define QL_EVENT_41 41 // Null
|
||||||
#define QL_EVENT_ARRIVED 42
|
#define QL_EVENT_ARRIVED 42
|
||||||
|
|
||||||
#define QL_EVENT_USED_POKEMART QL_EVENT_BOUGHT_ITEM - 1 // Used as a start pos for QL_EVENT_BOUGHT_ITEM / QL_EVENT_SOLD_ITEM
|
#define QL_EVENT_USED_POKEMART (QL_EVENT_BOUGHT_ITEM - 1) // Used as a start pos for QL_EVENT_BOUGHT_ITEM / QL_EVENT_SOLD_ITEM
|
||||||
|
|
||||||
#define IS_LINK_QL_EVENT(event)((event) >= QL_EVENT_LINK_TRADED && (event) <= QL_EVENT_LINK_BATTLED_UNION)
|
#define IS_LINK_QL_EVENT(event)((event) >= QL_EVENT_LINK_TRADED && (event) <= QL_EVENT_LINK_BATTLED_UNION)
|
||||||
#define IS_VALID_QL_EVENT(event)((event) >= QL_EVENT_SWITCHED_PARTY_ORDER && (event) <= QL_EVENT_ARRIVED)
|
#define IS_VALID_QL_EVENT(event)((event) >= QL_EVENT_SWITCHED_PARTY_ORDER && (event) <= QL_EVENT_ARRIVED)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "pokemon_storage_system.h"
|
#include "pokemon_storage_system.h"
|
||||||
#include "mon_markings.h"
|
#include "mon_markings.h"
|
||||||
|
#include "quest_log.h"
|
||||||
|
|
||||||
// The maximum number of Pokémon icons that can appear on-screen.
|
// The maximum number of Pokémon icons that can appear on-screen.
|
||||||
// By default the limit is 40 (though in practice only 37 can be).
|
// By default the limit is 40 (though in practice only 37 can be).
|
||||||
@@ -273,14 +274,6 @@ struct PokeStorageItemIcon
|
|||||||
u8 active;
|
u8 active;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PokeStorageQuestLogData
|
|
||||||
{
|
|
||||||
u16 species1;
|
|
||||||
u16 species2;
|
|
||||||
u8 box1;
|
|
||||||
u8 box2;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PokemonStorageSystemData
|
struct PokemonStorageSystemData
|
||||||
{
|
{
|
||||||
u8 state;
|
u8 state;
|
||||||
@@ -426,7 +419,7 @@ struct PokemonStorageSystemData
|
|||||||
struct PokeStorageItemIcon itemIcons[MAX_ITEM_ICONS];
|
struct PokeStorageItemIcon itemIcons[MAX_ITEM_ICONS];
|
||||||
u16 movingItemId;
|
u16 movingItemId;
|
||||||
u16 itemInfoWindowOffset;
|
u16 itemInfoWindowOffset;
|
||||||
struct PokeStorageQuestLogData pokeStorageQuestLogData;
|
struct QuestLogEvent_MovedBoxMon questLogData;
|
||||||
u16 unusedField2;
|
u16 unusedField2;
|
||||||
u16 displayMonPalOffset;
|
u16 displayMonPalOffset;
|
||||||
u16 *displayMonTilePtr;
|
u16 *displayMonTilePtr;
|
||||||
|
|||||||
+129
-2
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "quest_log_battle.h"
|
#include "quest_log_battle.h"
|
||||||
#include "constants/quest_log.h"
|
|
||||||
#include "field_control_avatar.h"
|
#include "field_control_avatar.h"
|
||||||
|
#include "constants/quest_log.h"
|
||||||
|
#include "constants/battle.h"
|
||||||
|
|
||||||
// Parameter to QuestLog_OnEscalatorWarp
|
// Parameter to QuestLog_OnEscalatorWarp
|
||||||
#define QL_ESCALATOR_OUT 1
|
#define QL_ESCALATOR_OUT 1
|
||||||
@@ -48,6 +49,132 @@ struct UnkStruct_203B044
|
|||||||
u16 unk_2;
|
u16 unk_2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Event data structs
|
||||||
|
|
||||||
|
// QL_EVENT_SWITCHED_PARTY_ORDER
|
||||||
|
struct QuestLogEvent_SwitchedPartyOrder
|
||||||
|
{
|
||||||
|
u16 species1;
|
||||||
|
u16 species2;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_USED_ITEM
|
||||||
|
// QL_EVENT_GAVE_HELD_ITEM
|
||||||
|
// QL_EVENT_GAVE_HELD_ITEM_BAG
|
||||||
|
// QL_EVENT_GAVE_HELD_ITEM_PC
|
||||||
|
// QL_EVENT_TOOK_HELD_ITEM
|
||||||
|
// QL_EVENT_DEPOSITED_ITEM_PC
|
||||||
|
// QL_EVENT_WITHDREW_ITEM_PC
|
||||||
|
struct QuestLogEvent_Item
|
||||||
|
{
|
||||||
|
u16 itemId;
|
||||||
|
u16 unused;
|
||||||
|
u16 species;
|
||||||
|
u16 itemParam;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_SWAPPED_HELD_ITEM
|
||||||
|
// QL_EVENT_SWAPPED_HELD_ITEM_PC
|
||||||
|
struct QuestLogEvent_SwappedHeldItem
|
||||||
|
{
|
||||||
|
u16 takenItemId;
|
||||||
|
u16 givenItemId;
|
||||||
|
u16 species;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_LINK_TRADED
|
||||||
|
// QL_EVENT_LINK_TRADED_UNION
|
||||||
|
struct QuestLogEvent_Traded
|
||||||
|
{
|
||||||
|
u16 speciesSent;
|
||||||
|
u16 speciesReceived;
|
||||||
|
u8 partnerName[PLAYER_NAME_LENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_LINK_BATTLED_SINGLE
|
||||||
|
// QL_EVENT_LINK_BATTLED_DOUBLE
|
||||||
|
// QL_EVENT_LINK_BATTLED_MULTI
|
||||||
|
// QL_EVENT_LINK_BATTLED_UNION
|
||||||
|
struct QuestLogEvent_LinkBattle
|
||||||
|
{
|
||||||
|
u8 outcome;
|
||||||
|
u8 playerNames[MAX_BATTLERS_COUNT - 1][PLAYER_NAME_LENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_SWITCHED_MONS_BETWEEN_BOXES
|
||||||
|
// QL_EVENT_SWITCHED_MONS_WITHIN_BOX
|
||||||
|
// QL_EVENT_SWITCHED_PARTY_MON_FOR_PC_MON
|
||||||
|
// QL_EVENT_MOVED_MON_BETWEEN_BOXES
|
||||||
|
// QL_EVENT_MOVED_MON_WITHIN_BOX
|
||||||
|
// QL_EVENT_WITHDREW_MON_PC
|
||||||
|
// QL_EVENT_DEPOSITED_MON_PC
|
||||||
|
// QL_EVENT_SWITCHED_MULTIPLE_MONS
|
||||||
|
struct QuestLogEvent_MovedBoxMon
|
||||||
|
{
|
||||||
|
u16 species1;
|
||||||
|
u16 species2;
|
||||||
|
u8 box1;
|
||||||
|
u8 box2;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_DEFEATED_TRAINER
|
||||||
|
// QL_EVENT_DEFEATED_GYM_LEADER
|
||||||
|
// QL_EVENT_DEFEATED_E4_MEMBER
|
||||||
|
// QL_EVENT_DEFEATED_CHAMPION
|
||||||
|
struct QuestLogEvent_TrainerBattle
|
||||||
|
{
|
||||||
|
u16 trainerId;
|
||||||
|
u16 speciesOpponent;
|
||||||
|
u16 speciesPlayer;
|
||||||
|
u8 hpFractionId;
|
||||||
|
u8 mapSec;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_DEFEATED_WILD_MON
|
||||||
|
struct QuestLogEvent_WildBattle
|
||||||
|
{
|
||||||
|
u16 defeatedSpecies;
|
||||||
|
u16 caughtSpecies;
|
||||||
|
u8 mapSec;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_DEPARTED
|
||||||
|
struct QuestLogEvent_Departed
|
||||||
|
{
|
||||||
|
u8 mapSec;
|
||||||
|
u8 locationId;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_USED_FIELD_MOVE
|
||||||
|
struct QuestLogEvent_FieldMove
|
||||||
|
{
|
||||||
|
u16 species;
|
||||||
|
u8 fieldMove;
|
||||||
|
u8 mapSec;
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_BOUGHT_ITEM
|
||||||
|
// QL_EVENT_SOLD_ITEM
|
||||||
|
struct QuestLogEvent_Shop
|
||||||
|
{
|
||||||
|
u32 totalMoney; // Total amount of money spent buying or earned selling
|
||||||
|
u16 lastItemId;
|
||||||
|
u16 itemQuantity; // Total number of items bought or sold
|
||||||
|
u8 mapSec;
|
||||||
|
bool8 hasMultipleTransactions;
|
||||||
|
u8 logEventId; // Either 0 (empty), 1 (bought) or 2 (sold)
|
||||||
|
};
|
||||||
|
|
||||||
|
// QL_EVENT_OBTAINED_STORY_ITEM
|
||||||
|
struct QuestLogEvent_StoryItem
|
||||||
|
{
|
||||||
|
u16 itemId;
|
||||||
|
u8 mapSec;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
extern u8 gQuestLogState;
|
extern u8 gQuestLogState;
|
||||||
extern u8 gQuestLogPlaybackState;
|
extern u8 gQuestLogPlaybackState;
|
||||||
extern struct FieldInput gQuestLogFieldInput;
|
extern struct FieldInput gQuestLogFieldInput;
|
||||||
@@ -94,7 +221,7 @@ void sub_8112B3C(void);
|
|||||||
void RunQuestLogCB(void);
|
void RunQuestLogCB(void);
|
||||||
void sub_8111C68(void);
|
void sub_8111C68(void);
|
||||||
bool8 QuestLogScenePlaybackIsEnding(void);
|
bool8 QuestLogScenePlaybackIsEnding(void);
|
||||||
void sub_8115798(void);
|
void SetQuestLogEvent_Arrived(void);
|
||||||
bool8 QuestLog_ShouldEndSceneOnMapChange(void);
|
bool8 QuestLog_ShouldEndSceneOnMapChange(void);
|
||||||
void QuestLog_AdvancePlayhead_(void);
|
void QuestLog_AdvancePlayhead_(void);
|
||||||
void QuestLog_InitPalettesBackup(void);
|
void QuestLog_InitPalettesBackup(void);
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ void CreatePokemartMenu(const u16 *itemsForSale);
|
|||||||
void CreateDecorationShop1Menu(const u16 *);
|
void CreateDecorationShop1Menu(const u16 *);
|
||||||
void CreateDecorationShop2Menu(const u16 *);
|
void CreateDecorationShop2Menu(const u16 *);
|
||||||
u8 GetMartFontId(void);
|
u8 GetMartFontId(void);
|
||||||
void RecordItemPurchase(u16 a0, u16 a1, u8 a2);
|
void RecordItemTransaction(u16 itemId, u16 quantity, u8 logEventId);
|
||||||
|
|
||||||
// buy_menu_helper
|
// buy_menu_helper
|
||||||
void BuyMenuInitWindows(bool32 isSellingTM);
|
void BuyMenuInitWindows(bool32 isSellingTM);
|
||||||
|
|||||||
@@ -2882,7 +2882,7 @@ static void Cmd_tryfaintmon(void)
|
|||||||
if (gBattleResults.opponentFaintCounter < 255)
|
if (gBattleResults.opponentFaintCounter < 255)
|
||||||
gBattleResults.opponentFaintCounter++;
|
gBattleResults.opponentFaintCounter++;
|
||||||
gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||||
*(u8 *)(&gBattleStruct->field_182) = gBattlerAttacker;
|
*(u8 *)(&gBattleStruct->lastAttackerToFaintOpponent) = gBattlerAttacker;
|
||||||
}
|
}
|
||||||
if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0)
|
if ((gHitMarker & HITMARKER_DESTINYBOND) && gBattleMons[gBattlerAttacker].hp != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -29,6 +29,7 @@
|
|||||||
#include "pokemon_storage_system.h"
|
#include "pokemon_storage_system.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
#include "constants/quest_log.h"
|
||||||
|
|
||||||
struct BerryPouchStruct_203F36C
|
struct BerryPouchStruct_203F36C
|
||||||
{
|
{
|
||||||
@@ -1384,7 +1385,7 @@ static void Task_SellBerries_PlaySfxAndRemoveBerries(u8 taskId)
|
|||||||
PlaySE(SE_SHOP);
|
PlaySE(SE_SHOP);
|
||||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||||
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
||||||
RecordItemPurchase(gSpecialVar_ItemId, data[8], 2);
|
RecordItemTransaction(gSpecialVar_ItemId, data[8], QL_EVENT_SOLD_ITEM - QL_EVENT_USED_POKEMART);
|
||||||
DestroyListMenuTask(data[0], &sStaticCnt.listMenuScrollOffset, &sStaticCnt.listMenuSelectedRow);
|
DestroyListMenuTask(data[0], &sStaticCnt.listMenuScrollOffset, &sStaticCnt.listMenuSelectedRow);
|
||||||
SortAndCountBerries();
|
SortAndCountBerries();
|
||||||
SanitizeListMenuSelectionParams();
|
SanitizeListMenuSelectionParams();
|
||||||
|
|||||||
+31
-31
@@ -1810,7 +1810,7 @@ static const struct {
|
|||||||
u16 inside_num;
|
u16 inside_num;
|
||||||
u16 outside_grp;
|
u16 outside_grp;
|
||||||
u16 outside_num;
|
u16 outside_num;
|
||||||
} sInsideOutsidePairs[51] = {
|
} sInsideOutsidePairs[] = {
|
||||||
[QL_LOCATION_HOME] = {MAP(PALLET_TOWN_PLAYERS_HOUSE_1F), MAP(PALLET_TOWN)},
|
[QL_LOCATION_HOME] = {MAP(PALLET_TOWN_PLAYERS_HOUSE_1F), MAP(PALLET_TOWN)},
|
||||||
[QL_LOCATION_OAKS_LAB] = {MAP(PALLET_TOWN_PROFESSOR_OAKS_LAB), MAP(PALLET_TOWN)},
|
[QL_LOCATION_OAKS_LAB] = {MAP(PALLET_TOWN_PROFESSOR_OAKS_LAB), MAP(PALLET_TOWN)},
|
||||||
[QL_LOCATION_VIRIDIAN_GYM] = {MAP(VIRIDIAN_CITY_GYM), MAP(VIRIDIAN_CITY)},
|
[QL_LOCATION_VIRIDIAN_GYM] = {MAP(VIRIDIAN_CITY_GYM), MAP(VIRIDIAN_CITY)},
|
||||||
@@ -1881,67 +1881,67 @@ void QuestLog_CheckDepartingIndoorsMap(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QuestLogDepartedData {
|
|
||||||
u8 map_section_id;
|
|
||||||
u8 entrance_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
void QuestLog_TryRecordDepartedLocation(void)
|
void QuestLog_TryRecordDepartedLocation(void)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
struct QuestLogDepartedData event_buffer;
|
struct QuestLogEvent_Departed data;
|
||||||
u16 ql_entrance_id = VarGet(VAR_QL_ENTRANCE);
|
u16 locationId = VarGet(VAR_QL_ENTRANCE);
|
||||||
event_buffer.map_section_id = 0;
|
data.mapSec = 0;
|
||||||
event_buffer.entrance_id = 0;
|
data.locationId = 0;
|
||||||
if (FlagGet(FLAG_SYS_QL_DEPARTED))
|
if (FlagGet(FLAG_SYS_QL_DEPARTED))
|
||||||
{
|
{
|
||||||
if (ql_entrance_id == QL_LOCATION_VIRIDIAN_FOREST_1)
|
if (locationId == QL_LOCATION_VIRIDIAN_FOREST_1)
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE) && (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE) || gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_NORTH_ENTRANCE)))
|
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE)
|
||||||
|
&& (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE)
|
||||||
|
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_NORTH_ENTRANCE)))
|
||||||
{
|
{
|
||||||
event_buffer.map_section_id = MAPSEC_ROUTE_2;
|
data.mapSec = MAPSEC_ROUTE_2;
|
||||||
if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE))
|
if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE2_VIRIDIAN_FOREST_SOUTH_ENTRANCE))
|
||||||
event_buffer.entrance_id = ql_entrance_id;
|
data.locationId = locationId;
|
||||||
else
|
else
|
||||||
event_buffer.entrance_id = ql_entrance_id + 1;
|
data.locationId = locationId + 1;
|
||||||
SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer);
|
SetQuestLogEvent(QL_EVENT_DEPARTED, (const u16 *)&data);
|
||||||
FlagClear(FLAG_SYS_QL_DEPARTED);
|
FlagClear(FLAG_SYS_QL_DEPARTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ql_entrance_id == QL_LOCATION_LEAGUE_GATE_1)
|
else if (locationId == QL_LOCATION_LEAGUE_GATE_1)
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE22) && (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE22) || gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE23)))
|
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE22) &&
|
||||||
|
(gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE22)
|
||||||
|
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE23)))
|
||||||
{
|
{
|
||||||
event_buffer.map_section_id = Overworld_GetMapHeaderByGroupAndId(sInsideOutsidePairs[ql_entrance_id].inside_grp, sInsideOutsidePairs[ql_entrance_id].inside_num)->regionMapSectionId;
|
data.mapSec = Overworld_GetMapHeaderByGroupAndId(sInsideOutsidePairs[locationId].inside_grp, sInsideOutsidePairs[locationId].inside_num)->regionMapSectionId;
|
||||||
if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE22))
|
if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE22))
|
||||||
event_buffer.entrance_id = ql_entrance_id;
|
data.locationId = locationId;
|
||||||
else
|
else
|
||||||
event_buffer.entrance_id = ql_entrance_id + 1;
|
data.locationId = locationId + 1;
|
||||||
SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer);
|
SetQuestLogEvent(QL_EVENT_DEPARTED, (const u16 *)&data);
|
||||||
FlagClear(FLAG_SYS_QL_DEPARTED);
|
FlagClear(FLAG_SYS_QL_DEPARTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == sInsideOutsidePairs[ql_entrance_id].outside_grp && gSaveBlock1Ptr->location.mapNum == sInsideOutsidePairs[ql_entrance_id].outside_num)
|
if (gSaveBlock1Ptr->location.mapGroup == sInsideOutsidePairs[locationId].outside_grp
|
||||||
|
&& gSaveBlock1Ptr->location.mapNum == sInsideOutsidePairs[locationId].outside_num)
|
||||||
{
|
{
|
||||||
event_buffer.map_section_id = Overworld_GetMapHeaderByGroupAndId(sInsideOutsidePairs[ql_entrance_id].inside_grp, sInsideOutsidePairs[ql_entrance_id].inside_num)->regionMapSectionId;
|
data.mapSec = Overworld_GetMapHeaderByGroupAndId(sInsideOutsidePairs[locationId].inside_grp, sInsideOutsidePairs[locationId].inside_num)->regionMapSectionId;
|
||||||
event_buffer.entrance_id = ql_entrance_id;
|
data.locationId = locationId;
|
||||||
if (ql_entrance_id == QL_LOCATION_ROCK_TUNNEL_1)
|
if (locationId == QL_LOCATION_ROCK_TUNNEL_1)
|
||||||
{
|
{
|
||||||
PlayerGetDestCoords(&x, &y);
|
PlayerGetDestCoords(&x, &y);
|
||||||
if (x != 15 || y != 26)
|
if (x != 15 || y != 26)
|
||||||
event_buffer.entrance_id++;
|
data.locationId++;
|
||||||
}
|
}
|
||||||
else if (ql_entrance_id == QL_LOCATION_SEAFOAM_ISLANDS_1)
|
else if (locationId == QL_LOCATION_SEAFOAM_ISLANDS_1)
|
||||||
{
|
{
|
||||||
PlayerGetDestCoords(&x, &y);
|
PlayerGetDestCoords(&x, &y);
|
||||||
if (x != 67 || y != 15)
|
if (x != 67 || y != 15)
|
||||||
event_buffer.entrance_id++;
|
data.locationId++;
|
||||||
}
|
}
|
||||||
SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer);
|
SetQuestLogEvent(QL_EVENT_DEPARTED, (const u16 *)&data);
|
||||||
FlagClear(FLAG_SYS_QL_DEPARTED);
|
FlagClear(FLAG_SYS_QL_DEPARTED);
|
||||||
if (ql_entrance_id == QL_LOCATION_ROCKET_HIDEOUT)
|
if (locationId == QL_LOCATION_ROCKET_HIDEOUT)
|
||||||
{
|
{
|
||||||
VarSet(VAR_QL_ENTRANCE, QL_LOCATION_GAME_CORNER);
|
VarSet(VAR_QL_ENTRANCE, QL_LOCATION_GAME_CORNER);
|
||||||
FlagSet(FLAG_SYS_QL_DEPARTED);
|
FlagSet(FLAG_SYS_QL_DEPARTED);
|
||||||
|
|||||||
+7
-16
@@ -567,16 +567,8 @@ u16 BagGetQuantityByItemId(u16 itemId)
|
|||||||
|
|
||||||
void TrySetObtainedItemQuestLogEvent(u16 itemId)
|
void TrySetObtainedItemQuestLogEvent(u16 itemId)
|
||||||
{
|
{
|
||||||
struct QuestLogStruct_809A824
|
|
||||||
{
|
|
||||||
u16 itemId;
|
|
||||||
u8 mapSectionId;
|
|
||||||
} * ptr;
|
|
||||||
|
|
||||||
// Only some key items trigger this event
|
// Only some key items trigger this event
|
||||||
if
|
if (itemId == ITEM_OAKS_PARCEL
|
||||||
(
|
|
||||||
itemId == ITEM_OAKS_PARCEL
|
|
||||||
|| itemId == ITEM_POKE_FLUTE
|
|| itemId == ITEM_POKE_FLUTE
|
||||||
|| itemId == ITEM_SECRET_KEY
|
|| itemId == ITEM_SECRET_KEY
|
||||||
|| itemId == ITEM_BIKE_VOUCHER
|
|| itemId == ITEM_BIKE_VOUCHER
|
||||||
@@ -595,16 +587,15 @@ void TrySetObtainedItemQuestLogEvent(u16 itemId)
|
|||||||
|| itemId == ITEM_TEA
|
|| itemId == ITEM_TEA
|
||||||
|| itemId == ITEM_POWDER_JAR
|
|| itemId == ITEM_POWDER_JAR
|
||||||
|| itemId == ITEM_RUBY
|
|| itemId == ITEM_RUBY
|
||||||
|| itemId == ITEM_SAPPHIRE
|
|| itemId == ITEM_SAPPHIRE)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (itemId != ITEM_TOWN_MAP || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_RIVALS_HOUSE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_RIVALS_HOUSE)))
|
if (itemId != ITEM_TOWN_MAP || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_RIVALS_HOUSE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_RIVALS_HOUSE)))
|
||||||
{
|
{
|
||||||
ptr = malloc(sizeof(*ptr));
|
struct QuestLogEvent_StoryItem * data = malloc(sizeof(*data));
|
||||||
ptr->itemId = itemId;
|
data->itemId = itemId;
|
||||||
ptr->mapSectionId = gMapHeader.regionMapSectionId;
|
data->mapSec = gMapHeader.regionMapSectionId;
|
||||||
SetQuestLogEvent(QL_EVENT_OBTAINED_ITEM, (void *)ptr);
|
SetQuestLogEvent(QL_EVENT_OBTAINED_STORY_ITEM, (const u16 *)data);
|
||||||
free(ptr);
|
free(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -33,6 +33,7 @@
|
|||||||
#include "tm_case.h"
|
#include "tm_case.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
#include "constants/quest_log.h"
|
||||||
|
|
||||||
#define FREE_IF_SET(ptr) ({ if (ptr) Free(ptr); })
|
#define FREE_IF_SET(ptr) ({ if (ptr) Free(ptr); })
|
||||||
|
|
||||||
@@ -1934,7 +1935,7 @@ static void Task_FinalizeSaleToShop(u8 taskId)
|
|||||||
PlaySE(SE_SHOP);
|
PlaySE(SE_SHOP);
|
||||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||||
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
||||||
RecordItemPurchase(gSpecialVar_ItemId, data[8], 2);
|
RecordItemTransaction(gSpecialVar_ItemId, data[8], QL_EVENT_SOLD_ITEM - QL_EVENT_USED_POKEMART);
|
||||||
DestroyListMenuTask(data[0], &gBagMenuState.cursorPos[gBagMenuState.pocket], &gBagMenuState.itemsAbove[gBagMenuState.pocket]);
|
DestroyListMenuTask(data[0], &gBagMenuState.cursorPos[gBagMenuState.pocket], &gBagMenuState.itemsAbove[gBagMenuState.pocket]);
|
||||||
Pocket_CalculateNItemsAndMaxShowed(gBagMenuState.pocket);
|
Pocket_CalculateNItemsAndMaxShowed(gBagMenuState.pocket);
|
||||||
PocketCalculateInitialCursorPosAndItemsAbove(gBagMenuState.pocket);
|
PocketCalculateInitialCursorPosAndItemsAbove(gBagMenuState.pocket);
|
||||||
@@ -2009,7 +2010,7 @@ static void Task_TryDoItemDeposit(u8 taskId)
|
|||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE)
|
if (AddPCItem(gSpecialVar_ItemId, data[8]) == TRUE)
|
||||||
{
|
{
|
||||||
ItemUse_SetQuestLogEvent(28, 0, gSpecialVar_ItemId, 0xFFFF);
|
ItemUse_SetQuestLogEvent(QL_EVENT_DEPOSITED_ITEM_PC, 0, gSpecialVar_ItemId, 0xFFFF);
|
||||||
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
CopyItemName(gSpecialVar_ItemId, gStringVar1);
|
||||||
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3);
|
ConvertIntToDecimalStringN(gStringVar2, data[8], STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_DepositedStrVar2StrVar1s);
|
StringExpandPlaceholders(gStringVar4, gText_DepositedStrVar2StrVar1s);
|
||||||
|
|||||||
+7
-13
@@ -912,20 +912,14 @@ void FieldUseFunc_OakStopsYou(u8 taskId)
|
|||||||
|
|
||||||
void ItemUse_SetQuestLogEvent(u8 eventId, struct Pokemon *pokemon, u16 itemId, u16 param)
|
void ItemUse_SetQuestLogEvent(u8 eventId, struct Pokemon *pokemon, u16 itemId, u16 param)
|
||||||
{
|
{
|
||||||
struct UnkStruct_ItemUseQuestLog
|
struct QuestLogEvent_Item *data = Alloc(sizeof(*data));
|
||||||
{
|
|
||||||
u16 itemId;
|
|
||||||
u16 unk2;
|
|
||||||
u16 species;
|
|
||||||
u16 param;
|
|
||||||
} *questLog = Alloc(sizeof(*questLog));
|
|
||||||
|
|
||||||
questLog->itemId = itemId;
|
data->itemId = itemId;
|
||||||
questLog->param = param;
|
data->itemParam = param;
|
||||||
if (pokemon != NULL)
|
if (pokemon != NULL)
|
||||||
questLog->species = GetMonData(pokemon, MON_DATA_SPECIES2);
|
data->species = GetMonData(pokemon, MON_DATA_SPECIES2);
|
||||||
else
|
else
|
||||||
questLog->species = 0xFFFF;
|
data->species = 0xFFFF;
|
||||||
SetQuestLogEvent(eventId, (void *)questLog);
|
SetQuestLogEvent(eventId, (void *)data);
|
||||||
Free(questLog);
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1458,7 +1458,7 @@ static void OverworldBasic(void)
|
|||||||
RunTasks();
|
RunTasks();
|
||||||
AnimateSprites();
|
AnimateSprites();
|
||||||
CameraUpdate();
|
CameraUpdate();
|
||||||
sub_8115798();
|
SetQuestLogEvent_Arrived();
|
||||||
UpdateCameraPanning();
|
UpdateCameraPanning();
|
||||||
BuildOamBuffer();
|
BuildOamBuffer();
|
||||||
UpdatePaletteFade();
|
UpdatePaletteFade();
|
||||||
|
|||||||
+37
-43
@@ -3355,12 +3355,12 @@ static void SwitchPartyMon(void)
|
|||||||
|
|
||||||
static void SetSwitchedPartyOrderQuestLogEvent(void)
|
static void SetSwitchedPartyOrderQuestLogEvent(void)
|
||||||
{
|
{
|
||||||
u16 *buffer = Alloc(2 * sizeof(u16));
|
struct QuestLogEvent_SwitchedPartyOrder * data = Alloc(sizeof(*data));
|
||||||
|
|
||||||
buffer[0] = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
data->species1 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||||
buffer[1] = GetMonData(&gPlayerParty[gPartyMenu.slotId2], MON_DATA_SPECIES2);
|
data->species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId2], MON_DATA_SPECIES2);
|
||||||
SetQuestLogEvent(QL_EVENT_SWITCHED_PARTY_ORDER, buffer);
|
SetQuestLogEvent(QL_EVENT_SWITCHED_PARTY_ORDER, (const u16 *)data);
|
||||||
Free(buffer);
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish switching mons or using Softboiled
|
// Finish switching mons or using Softboiled
|
||||||
@@ -4131,67 +4131,61 @@ static bool8 SetUpFieldMove_Waterfall(void)
|
|||||||
|
|
||||||
static void SetSwappedHeldItemQuestLogEvent(struct Pokemon *mon, u16 item, u16 item2)
|
static void SetSwappedHeldItemQuestLogEvent(struct Pokemon *mon, u16 item, u16 item2)
|
||||||
{
|
{
|
||||||
u16 *ptr = Alloc(4 * sizeof(u16));
|
struct QuestLogEvent_SwappedHeldItem *data = Alloc(sizeof(*data));
|
||||||
|
|
||||||
ptr[2] = GetMonData(mon, MON_DATA_SPECIES2);
|
data->species = GetMonData(mon, MON_DATA_SPECIES2);
|
||||||
ptr[0] = item;
|
data->takenItemId = item;
|
||||||
ptr[1] = item2;
|
data->givenItemId = item2;
|
||||||
if (gPartyMenu.action == PARTY_ACTION_GIVE_PC_ITEM)
|
if (gPartyMenu.action == PARTY_ACTION_GIVE_PC_ITEM)
|
||||||
SetQuestLogEvent(QL_EVENT_SWAPPED_HELD_ITEM_PC, ptr);
|
SetQuestLogEvent(QL_EVENT_SWAPPED_HELD_ITEM_PC, (void *)data);
|
||||||
else
|
else
|
||||||
SetQuestLogEvent(QL_EVENT_SWAPPED_HELD_ITEM, ptr);
|
SetQuestLogEvent(QL_EVENT_SWAPPED_HELD_ITEM, (void *)data);
|
||||||
Free(ptr);
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FieldMoveWarpParams
|
|
||||||
{
|
|
||||||
u16 species;
|
|
||||||
u8 fieldMove;
|
|
||||||
u8 regionMapSectionId;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void SetUsedFieldMoveQuestLogEvent(struct Pokemon *mon, u8 fieldMove)
|
static void SetUsedFieldMoveQuestLogEvent(struct Pokemon *mon, u8 fieldMove)
|
||||||
{
|
{
|
||||||
struct FieldMoveWarpParams *ptr = Alloc(sizeof(*ptr));
|
struct QuestLogEvent_FieldMove *data = Alloc(sizeof(*data));
|
||||||
|
|
||||||
ptr->species = GetMonData(mon, MON_DATA_SPECIES2);
|
data->species = GetMonData(mon, MON_DATA_SPECIES2);
|
||||||
ptr->fieldMove = fieldMove;
|
data->fieldMove = fieldMove;
|
||||||
switch (ptr->fieldMove)
|
switch (data->fieldMove)
|
||||||
{
|
{
|
||||||
case FIELD_MOVE_TELEPORT:
|
case FIELD_MOVE_TELEPORT:
|
||||||
ptr->regionMapSectionId = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->lastHealLocation.mapGroup, gSaveBlock1Ptr->lastHealLocation.mapNum)->regionMapSectionId;
|
data->mapSec = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->lastHealLocation.mapGroup, gSaveBlock1Ptr->lastHealLocation.mapNum)->regionMapSectionId;
|
||||||
break;
|
break;
|
||||||
case FIELD_MOVE_DIG:
|
case FIELD_MOVE_DIG:
|
||||||
ptr->regionMapSectionId = gMapHeader.regionMapSectionId;
|
data->mapSec = gMapHeader.regionMapSectionId;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ptr->regionMapSectionId = 0xFF;
|
data->mapSec = 0xFF;
|
||||||
}
|
}
|
||||||
SetQuestLogEvent(QL_EVENT_USED_FIELD_MOVE, (u16 *)ptr);
|
SetQuestLogEvent(QL_EVENT_USED_FIELD_MOVE, (const u16 *)data);
|
||||||
Free(ptr);
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUsedFlyQuestLogEvent(const u8 *healLocCtrlData)
|
void SetUsedFlyQuestLogEvent(const u8 *healLocCtrlData)
|
||||||
{
|
{
|
||||||
const struct MapHeader *mapHeader;
|
const struct MapHeader *mapHeader;
|
||||||
struct FieldMoveWarpParams *ptr2;
|
struct QuestLogEvent_FieldMove *data;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
s8 mapGroup;
|
s8 group;
|
||||||
s8 mapNum;
|
s8 num;
|
||||||
u32 unk_4;
|
u32 unused;
|
||||||
} *ptr = Alloc(sizeof(*ptr));
|
} *map = Alloc(sizeof(*map));
|
||||||
|
|
||||||
ptr->mapGroup = healLocCtrlData[0];
|
map->group = healLocCtrlData[0];
|
||||||
ptr->mapNum = healLocCtrlData[1];
|
map->num = healLocCtrlData[1];
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(ptr->mapGroup, ptr->mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(map->group, map->num);
|
||||||
Free(ptr);
|
Free(map);
|
||||||
ptr2 = Alloc(4);
|
|
||||||
ptr2->species = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_SPECIES2);
|
data = Alloc(sizeof(*data));
|
||||||
ptr2->fieldMove = FIELD_MOVE_FLY;
|
data->species = GetMonData(&gPlayerParty[GetCursorSelectionMonId()], MON_DATA_SPECIES2);
|
||||||
ptr2->regionMapSectionId = mapHeader->regionMapSectionId;
|
data->fieldMove = FIELD_MOVE_FLY;
|
||||||
SetQuestLogEvent(QL_EVENT_USED_FIELD_MOVE, (u16 *)ptr2);
|
data->mapSec = mapHeader->regionMapSectionId;
|
||||||
Free(ptr2);
|
SetQuestLogEvent(QL_EVENT_USED_FIELD_MOVE, (const u16 *)data);
|
||||||
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CB2_ShowPartyMenuForItemUse(void)
|
void CB2_ShowPartyMenuForItemUse(void)
|
||||||
|
|||||||
@@ -2672,7 +2672,7 @@ static void InitCursorItemIcon(void)
|
|||||||
static void SetPokeStorageQuestLogEvent(u8 action)
|
static void SetPokeStorageQuestLogEvent(u8 action)
|
||||||
{
|
{
|
||||||
u16 event;
|
u16 event;
|
||||||
struct PokeStorageQuestLogData *questLogData;
|
struct QuestLogEvent_MovedBoxMon *questLogData;
|
||||||
u8 box1 = GetMovingMonOriginalBoxId();
|
u8 box1 = GetMovingMonOriginalBoxId();
|
||||||
u16 species1 = gStorage->displayMonSpecies;
|
u16 species1 = gStorage->displayMonSpecies;
|
||||||
u16 species2;
|
u16 species2;
|
||||||
@@ -2687,7 +2687,7 @@ static void SetPokeStorageQuestLogEvent(u8 action)
|
|||||||
box2 = StorageGetCurrentBox();
|
box2 = StorageGetCurrentBox();
|
||||||
species2 = GetCurrentBoxMonData(GetBoxCursorPosition(), MON_DATA_SPECIES2);
|
species2 = GetCurrentBoxMonData(GetBoxCursorPosition(), MON_DATA_SPECIES2);
|
||||||
}
|
}
|
||||||
questLogData = &gStorage->pokeStorageQuestLogData;
|
questLogData = &gStorage->questLogData;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -46,12 +46,14 @@
|
|||||||
All the data stored for each scene is in 'struct QuestLogScene', defined in include/global.h.
|
All the data stored for each scene is in 'struct QuestLogScene', defined in include/global.h.
|
||||||
The entirety of the Quest Log's save data is represented by an array of these scenes in SaveBlock1.
|
The entirety of the Quest Log's save data is represented by an array of these scenes in SaveBlock1.
|
||||||
|
|
||||||
- "Event":
|
|
||||||
|
|
||||||
- "Action": TODO: Copy from quest_log.h
|
- "Action": TODO: Copy from quest_log.h
|
||||||
|
|
||||||
|
- "Event":
|
||||||
|
|
||||||
- "Command":
|
- "Command":
|
||||||
|
|
||||||
|
- "Script":
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
+48
-64
@@ -7,30 +7,15 @@
|
|||||||
#include "quest_log.h"
|
#include "quest_log.h"
|
||||||
#include "constants/trainers.h"
|
#include "constants/trainers.h"
|
||||||
|
|
||||||
struct QuestLogStruct_TrainerBattleRecord
|
|
||||||
{
|
|
||||||
u16 v0;
|
|
||||||
u16 v2;
|
|
||||||
u16 v4;
|
|
||||||
u8 v6;
|
|
||||||
u8 v7;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QuestLogStruct_WildBattleRecord
|
|
||||||
{
|
|
||||||
u16 defeatedSpecies;
|
|
||||||
u16 caughtSpecies;
|
|
||||||
u8 mapSec;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void sub_812C334(s32 *, s32 *);
|
static void sub_812C334(s32 *, s32 *);
|
||||||
|
|
||||||
void TrySetQuestLogBattleEvent(void)
|
void TrySetQuestLogBattleEvent(void)
|
||||||
{
|
{
|
||||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_OLD_MAN_TUTORIAL | BATTLE_TYPE_POKEDUDE)) && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT))
|
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_OLD_MAN_TUTORIAL | BATTLE_TYPE_POKEDUDE)) && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT))
|
||||||
{
|
{
|
||||||
struct QuestLogStruct_TrainerBattleRecord * questLogTrainerBattleRecord = Alloc(sizeof(struct QuestLogStruct_TrainerBattleRecord));
|
// Why allocate both of these? Only one will ever be used at a time
|
||||||
struct QuestLogStruct_WildBattleRecord * questLogWildBattleRecord = Alloc(sizeof(struct QuestLogStruct_WildBattleRecord));
|
struct QuestLogEvent_TrainerBattle * trainerData = Alloc(sizeof(*trainerData));
|
||||||
|
struct QuestLogEvent_WildBattle * wildData = Alloc(sizeof(*wildData));
|
||||||
u16 eventId;
|
u16 eventId;
|
||||||
u16 playerEndingHP;
|
u16 playerEndingHP;
|
||||||
u16 playerMaxHP;
|
u16 playerMaxHP;
|
||||||
@@ -52,81 +37,81 @@ void TrySetQuestLogBattleEvent(void)
|
|||||||
eventId = QL_EVENT_DEFEATED_TRAINER;
|
eventId = QL_EVENT_DEFEATED_TRAINER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
questLogTrainerBattleRecord->v0 = gTrainerBattleOpponent_A;
|
trainerData->trainerId = gTrainerBattleOpponent_A;
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
{
|
{
|
||||||
questLogTrainerBattleRecord->v2 = gBattleResults.lastOpponentSpecies;
|
trainerData->speciesOpponent = gBattleResults.lastOpponentSpecies;
|
||||||
if (GetBattlerSide(gBattleStruct->field_182) == B_SIDE_PLAYER)
|
|
||||||
questLogTrainerBattleRecord->v4 = gBattleMons[gBattleStruct->field_182].species;
|
// Decide which of the pokemon on the player's side to mention as the victor
|
||||||
|
if (GetBattlerSide(gBattleStruct->lastAttackerToFaintOpponent) == B_SIDE_PLAYER)
|
||||||
|
trainerData->speciesPlayer = gBattleMons[gBattleStruct->lastAttackerToFaintOpponent].species;
|
||||||
else if (gBattleMons[GetBattlerAtPosition(0)].hp != 0)
|
else if (gBattleMons[GetBattlerAtPosition(0)].hp != 0)
|
||||||
questLogTrainerBattleRecord->v4 = gBattleMons[GetBattlerAtPosition(0)].species;
|
trainerData->speciesPlayer = gBattleMons[GetBattlerAtPosition(0)].species;
|
||||||
else
|
else
|
||||||
questLogTrainerBattleRecord->v4 = gBattleMons[GetBattlerAtPosition(2)].species;
|
trainerData->speciesPlayer = gBattleMons[GetBattlerAtPosition(2)].species;
|
||||||
|
|
||||||
playerEndingHP = gBattleMons[GetBattlerAtPosition(0)].hp + gBattleMons[GetBattlerAtPosition(2)].hp;
|
playerEndingHP = gBattleMons[GetBattlerAtPosition(0)].hp + gBattleMons[GetBattlerAtPosition(2)].hp;
|
||||||
playerMaxHP = gBattleMons[GetBattlerAtPosition(0)].maxHP + gBattleMons[GetBattlerAtPosition(2)].maxHP;
|
playerMaxHP = gBattleMons[GetBattlerAtPosition(0)].maxHP + gBattleMons[GetBattlerAtPosition(2)].maxHP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
questLogTrainerBattleRecord->v2 = gBattleResults.lastOpponentSpecies;
|
trainerData->speciesOpponent = gBattleResults.lastOpponentSpecies;
|
||||||
questLogTrainerBattleRecord->v4 = gBattleMons[GetBattlerAtPosition(0)].species;
|
trainerData->speciesPlayer = gBattleMons[GetBattlerAtPosition(0)].species;
|
||||||
playerEndingHP = gBattleMons[GetBattlerAtPosition(0)].hp;
|
playerEndingHP = gBattleMons[GetBattlerAtPosition(0)].hp;
|
||||||
playerMaxHP = gBattleMons[GetBattlerAtPosition(0)].maxHP;
|
playerMaxHP = gBattleMons[GetBattlerAtPosition(0)].maxHP;
|
||||||
}
|
}
|
||||||
questLogTrainerBattleRecord->v7 = GetCurrentRegionMapSectionId();
|
trainerData->mapSec = GetCurrentRegionMapSectionId();
|
||||||
questLogTrainerBattleRecord->v6 = 0;
|
|
||||||
|
// Calculate fractional HP loss (determines flavor text, e.g. "handily" vs "somehow" defeated trainer)
|
||||||
|
trainerData->hpFractionId = 0;
|
||||||
if (playerEndingHP < playerMaxHP / 3 * 2)
|
if (playerEndingHP < playerMaxHP / 3 * 2)
|
||||||
questLogTrainerBattleRecord->v6 = 1;
|
trainerData->hpFractionId++;
|
||||||
if (playerEndingHP < playerMaxHP / 3)
|
if (playerEndingHP < playerMaxHP / 3)
|
||||||
questLogTrainerBattleRecord->v6++;
|
trainerData->hpFractionId++;
|
||||||
SetQuestLogEvent(eventId, (const u16 *)questLogTrainerBattleRecord);
|
|
||||||
|
SetQuestLogEvent(eventId, (const u16 *)trainerData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gBattleOutcome == B_OUTCOME_WON)
|
if (gBattleOutcome == B_OUTCOME_WON)
|
||||||
{
|
{
|
||||||
questLogWildBattleRecord->defeatedSpecies = GetMonData(gEnemyParty, MON_DATA_SPECIES);
|
wildData->defeatedSpecies = GetMonData(gEnemyParty, MON_DATA_SPECIES);
|
||||||
questLogWildBattleRecord->caughtSpecies = SPECIES_NONE;
|
wildData->caughtSpecies = SPECIES_NONE;
|
||||||
}
|
}
|
||||||
else // gBattleOutcome == B_OUTCOME_CAUGHT
|
else // gBattleOutcome == B_OUTCOME_CAUGHT
|
||||||
{
|
{
|
||||||
questLogWildBattleRecord->defeatedSpecies = SPECIES_NONE;
|
wildData->defeatedSpecies = SPECIES_NONE;
|
||||||
questLogWildBattleRecord->caughtSpecies = GetMonData(gEnemyParty, MON_DATA_SPECIES);
|
wildData->caughtSpecies = GetMonData(gEnemyParty, MON_DATA_SPECIES);
|
||||||
}
|
}
|
||||||
questLogWildBattleRecord->mapSec = GetCurrentRegionMapSectionId();
|
wildData->mapSec = GetCurrentRegionMapSectionId();
|
||||||
SetQuestLogEvent(QL_EVENT_DEFEATED_WILD_MON, (const u16 *)questLogWildBattleRecord);
|
SetQuestLogEvent(QL_EVENT_DEFEATED_WILD_MON, (const u16 *)wildData);
|
||||||
}
|
}
|
||||||
Free(questLogTrainerBattleRecord);
|
Free(trainerData);
|
||||||
Free(questLogWildBattleRecord);
|
Free(wildData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QuestLogStruct_LinkBattleRecord
|
|
||||||
{
|
|
||||||
u8 v0;
|
|
||||||
u8 v1[3][7];
|
|
||||||
};
|
|
||||||
|
|
||||||
void TrySetQuestLogLinkBattleEvent(void)
|
void TrySetQuestLogLinkBattleEvent(void)
|
||||||
{
|
{
|
||||||
s32 sp0;
|
s32 sp0;
|
||||||
s32 sp4[2];
|
s32 sp4[2];
|
||||||
u16 eventId;
|
u16 eventId;
|
||||||
s32 r3;
|
s32 i;
|
||||||
bool32 inUnionRoom;
|
bool32 inUnionRoom;
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
{
|
{
|
||||||
struct QuestLogStruct_LinkBattleRecord * r5 = Alloc(sizeof(struct QuestLogStruct_LinkBattleRecord));
|
struct QuestLogEvent_LinkBattle * data = Alloc(sizeof(*data));
|
||||||
r5->v0 = gBattleOutcome - 1; // 0 = won, 1 = lost, 2 = drew
|
data->outcome = gBattleOutcome - 1; // 0 = won, 1 = lost, 2 = drew
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||||
{
|
{
|
||||||
eventId = QL_EVENT_LINK_BATTLED_MULTI;
|
eventId = QL_EVENT_LINK_BATTLED_MULTI;
|
||||||
sub_812C334(&sp0, sp4);
|
sub_812C334(&sp0, sp4);
|
||||||
for (r3 = 0; r3 < 7; r3++)
|
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||||
{
|
{
|
||||||
r5->v1[0][r3] = gLinkPlayers[sp0].name[r3];
|
data->playerNames[0][i] = gLinkPlayers[sp0].name[i];
|
||||||
r5->v1[1][r3] = gLinkPlayers[sp4[0]].name[r3];
|
data->playerNames[1][i] = gLinkPlayers[sp4[0]].name[i];
|
||||||
r5->v1[2][r3] = gLinkPlayers[sp4[1]].name[r3];
|
data->playerNames[2][i] = gLinkPlayers[sp4[1]].name[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -141,26 +126,25 @@ void TrySetQuestLogLinkBattleEvent(void)
|
|||||||
if (inUnionRoom == TRUE)
|
if (inUnionRoom == TRUE)
|
||||||
eventId = QL_EVENT_LINK_BATTLED_UNION;
|
eventId = QL_EVENT_LINK_BATTLED_UNION;
|
||||||
}
|
}
|
||||||
for (r3 = 0; r3 < 7; r3++)
|
|
||||||
{
|
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||||
r5->v1[0][r3] = gLinkPlayers[gBattleStruct->multiplayerId ^ 1].name[r3];
|
data->playerNames[0][i] = gLinkPlayers[gBattleStruct->multiplayerId ^ 1].name[i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SetQuestLogEvent(eventId, (const u16 *)r5);
|
SetQuestLogEvent(eventId, (const u16 *)data);
|
||||||
Free(r5);
|
Free(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_812C334(s32 * a0, s32 * a1)
|
static void sub_812C334(s32 * a0, s32 * a1)
|
||||||
{
|
{
|
||||||
s32 r5;
|
s32 i;
|
||||||
s32 _optimized_out = 0;
|
s32 _optimized_out = 0;
|
||||||
u8 r2 = gLinkPlayers[gBattleStruct->multiplayerId].id ^ 2;
|
u8 r2 = gLinkPlayers[gBattleStruct->multiplayerId].id ^ 2;
|
||||||
for (r5 = 0; r5 < 4; r5++)
|
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (r2 == gLinkPlayers[r5].id)
|
if (r2 == gLinkPlayers[i].id)
|
||||||
a0[0] = r5;
|
a0[0] = i;
|
||||||
else if (r5 != gBattleStruct->multiplayerId)
|
else if (i != gBattleStruct->multiplayerId)
|
||||||
a1[_optimized_out++] = r5;
|
a1[_optimized_out++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+900
-821
File diff suppressed because it is too large
Load Diff
+48
-51
@@ -69,17 +69,6 @@ struct ShopData
|
|||||||
/*0x18*/ u16 unk18;
|
/*0x18*/ u16 unk18;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MartHistory
|
|
||||||
{
|
|
||||||
/*0x00*/ u32 unk0;
|
|
||||||
/*0x04*/ u16 unk4;
|
|
||||||
/*0x06*/ u16 unk6;
|
|
||||||
/*0x08*/ u8 unk8;
|
|
||||||
/*0x09*/ u8 unk9;
|
|
||||||
/*0x0A*/ u8 unkA;
|
|
||||||
/*0x0B*/ u8 unkB;
|
|
||||||
}; /* size = 12 */
|
|
||||||
|
|
||||||
static EWRAM_DATA s16 sViewportObjectEvents[OBJECT_EVENTS_COUNT][4] = {0};
|
static EWRAM_DATA s16 sViewportObjectEvents[OBJECT_EVENTS_COUNT][4] = {0};
|
||||||
EWRAM_DATA struct ShopData gShopData = {0};
|
EWRAM_DATA struct ShopData gShopData = {0};
|
||||||
static EWRAM_DATA u8 sShopMenuWindowId = 0;
|
static EWRAM_DATA u8 sShopMenuWindowId = 0;
|
||||||
@@ -89,7 +78,7 @@ EWRAM_DATA u16 (*gShopTilemapBuffer3)[0x400] = {0};
|
|||||||
EWRAM_DATA u16 (*gShopTilemapBuffer4)[0x400] = {0};
|
EWRAM_DATA u16 (*gShopTilemapBuffer4)[0x400] = {0};
|
||||||
EWRAM_DATA struct ListMenuItem *sShopMenuListMenu = {0};
|
EWRAM_DATA struct ListMenuItem *sShopMenuListMenu = {0};
|
||||||
static EWRAM_DATA u8 (*sShopMenuItemStrings)[13] = {0};
|
static EWRAM_DATA u8 (*sShopMenuItemStrings)[13] = {0};
|
||||||
EWRAM_DATA struct MartHistory gShopMenuHistory[2] = {0};
|
EWRAM_DATA struct QuestLogEvent_Shop sHistory[2] = {0};
|
||||||
|
|
||||||
//Function Declarations
|
//Function Declarations
|
||||||
static u8 CreateShopMenu(u8 a0);
|
static u8 CreateShopMenu(u8 a0);
|
||||||
@@ -146,7 +135,7 @@ static void ExitBuyMenu(u8 taskId);
|
|||||||
static void Task_ExitBuyMenu(u8 taskId);
|
static void Task_ExitBuyMenu(u8 taskId);
|
||||||
static void DebugFunc_PrintPurchaseDetails(u8 taskId);
|
static void DebugFunc_PrintPurchaseDetails(u8 taskId);
|
||||||
static void DebugFunc_PrintShopMenuHistoryBeforeClearMaybe(void);
|
static void DebugFunc_PrintShopMenuHistoryBeforeClearMaybe(void);
|
||||||
static void RecordQuestLogItemPurchase(void);
|
static void RecordTransactionForQuestLog(void);
|
||||||
|
|
||||||
static const struct MenuAction sShopMenuActions_BuySellQuit[] =
|
static const struct MenuAction sShopMenuActions_BuySellQuit[] =
|
||||||
{
|
{
|
||||||
@@ -305,7 +294,7 @@ static void CB2_GoToSellMenu(void)
|
|||||||
static void Task_HandleShopMenuQuit(u8 taskId)
|
static void Task_HandleShopMenuQuit(u8 taskId)
|
||||||
{
|
{
|
||||||
ClearShopMenuWindow();
|
ClearShopMenuWindow();
|
||||||
RecordQuestLogItemPurchase();
|
RecordTransactionForQuestLog();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
if (gShopData.callback != NULL)
|
if (gShopData.callback != NULL)
|
||||||
gShopData.callback();
|
gShopData.callback();
|
||||||
@@ -995,7 +984,7 @@ static void BuyMenuTryMakePurchase(u8 taskId)
|
|||||||
{
|
{
|
||||||
BuyMenuDisplayMessage(taskId, gText_HereYouGoThankYou, BuyMenuSubtractMoney);
|
BuyMenuDisplayMessage(taskId, gText_HereYouGoThankYou, BuyMenuSubtractMoney);
|
||||||
DebugFunc_PrintPurchaseDetails(taskId);
|
DebugFunc_PrintPurchaseDetails(taskId);
|
||||||
RecordItemPurchase(tItemId, tItemCount, 1);
|
RecordItemTransaction(tItemId, tItemCount, QL_EVENT_BOUGHT_ITEM - QL_EVENT_USED_POKEMART);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1066,59 +1055,67 @@ static void DebugFunc_PrintShopMenuHistoryBeforeClearMaybe(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordItemPurchase(u16 item, u16 quantity, u8 a2)
|
// Records a transaction during a single shopping session.
|
||||||
|
// This is for the Quest Log to save infomration about the player's purchases/sales when they finish.
|
||||||
|
void RecordItemTransaction(u16 itemId, u16 quantity, u8 logEventId)
|
||||||
{
|
{
|
||||||
struct MartHistory *history;
|
struct QuestLogEvent_Shop *history;
|
||||||
|
|
||||||
if (gShopMenuHistory[0].unkA == a2)
|
// There should only be a single entry for buying/selling respectively,
|
||||||
|
// so if one has already been created then get it first.
|
||||||
|
if (sHistory[0].logEventId == logEventId)
|
||||||
{
|
{
|
||||||
history = &gShopMenuHistory[0];
|
history = &sHistory[0];
|
||||||
}
|
}
|
||||||
else if (gShopMenuHistory[1].unkA == a2)
|
else if (sHistory[1].logEventId == logEventId)
|
||||||
{
|
{
|
||||||
history = &gShopMenuHistory[1];
|
history = &sHistory[1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gShopMenuHistory[0].unkA == 0)
|
// First transaction of this type, save it in an empty slot
|
||||||
history = &gShopMenuHistory[0];
|
if (sHistory[0].logEventId == 0)
|
||||||
|
history = &sHistory[0];
|
||||||
else
|
else
|
||||||
history = &gShopMenuHistory[1];
|
history = &sHistory[1];
|
||||||
history->unkA = a2;
|
history->logEventId = logEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (history->unk4 != 0)
|
// Set flag if this isn't the first time we've bought/sold in this session
|
||||||
|
if (history->lastItemId != ITEM_NONE)
|
||||||
|
history->hasMultipleTransactions = TRUE;
|
||||||
|
|
||||||
|
history->lastItemId = itemId;
|
||||||
|
|
||||||
|
// Add to number of items bought/sold
|
||||||
|
if (history->itemQuantity < 999)
|
||||||
{
|
{
|
||||||
history->unk9 = 1;
|
history->itemQuantity += quantity;
|
||||||
|
if (history->itemQuantity > 999)
|
||||||
|
history->itemQuantity = 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
history->unk4 = item;
|
// Add to amount of money spent buying or earned selling
|
||||||
if (history->unk6 < 999)
|
if (history->totalMoney < 999999)
|
||||||
{
|
{
|
||||||
history->unk6 += quantity;
|
// logEventId will either be 1 (bought) or 2 (sold)
|
||||||
if (history->unk6 > 999)
|
// so for buying it will add the full price and selling will add half price
|
||||||
history->unk6 = 999;
|
history->totalMoney += (itemid_get_market_price(itemId) >> (logEventId - 1)) * quantity;
|
||||||
}
|
if (history->totalMoney > 999999)
|
||||||
|
history->totalMoney = 999999;
|
||||||
if (history->unk0 < 999999)
|
|
||||||
{
|
|
||||||
history->unk0 += (itemid_get_market_price(item) >> (a2 - 1)) * quantity;
|
|
||||||
if (history->unk0 > 999999)
|
|
||||||
history->unk0 = 999999;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RecordQuestLogItemPurchase(void)
|
// Will record QL_EVENT_BOUGHT_ITEM and/or QL_EVENT_SOLD_ITEM, or nothing.
|
||||||
|
static void RecordTransactionForQuestLog(void)
|
||||||
{
|
{
|
||||||
u16 v;
|
u16 eventId = sHistory[0].logEventId;
|
||||||
|
if (eventId != 0)
|
||||||
|
SetQuestLogEvent(eventId + QL_EVENT_USED_POKEMART, (const u16 *)&sHistory[0]);
|
||||||
|
|
||||||
v = gShopMenuHistory[0].unkA;
|
eventId = sHistory[1].logEventId;
|
||||||
if (v != 0)
|
if (eventId != 0)
|
||||||
SetQuestLogEvent(v + QL_EVENT_USED_POKEMART, (const u16 *)&gShopMenuHistory[0]);
|
SetQuestLogEvent(eventId + QL_EVENT_USED_POKEMART, (const u16 *)&sHistory[1]);
|
||||||
|
|
||||||
v = gShopMenuHistory[1].unkA;
|
|
||||||
if (v != 0)
|
|
||||||
SetQuestLogEvent(v + QL_EVENT_USED_POKEMART, (const u16 *)&gShopMenuHistory[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePokemartMenu(const u16 *itemsForSale)
|
void CreatePokemartMenu(const u16 *itemsForSale)
|
||||||
@@ -1127,9 +1124,9 @@ void CreatePokemartMenu(const u16 *itemsForSale)
|
|||||||
CreateShopMenu(MART_TYPE_REGULAR);
|
CreateShopMenu(MART_TYPE_REGULAR);
|
||||||
SetShopMenuCallback(ScriptContext_Enable);
|
SetShopMenuCallback(ScriptContext_Enable);
|
||||||
DebugFunc_PrintShopMenuHistoryBeforeClearMaybe();
|
DebugFunc_PrintShopMenuHistoryBeforeClearMaybe();
|
||||||
memset(&gShopMenuHistory, 0, sizeof(gShopMenuHistory));
|
memset(&sHistory, 0, sizeof(sHistory));
|
||||||
gShopMenuHistory[0].unk8 = gMapHeader.regionMapSectionId;
|
sHistory[0].mapSec = gMapHeader.regionMapSectionId;
|
||||||
gShopMenuHistory[1].unk8 = gMapHeader.regionMapSectionId;
|
sHistory[1].mapSec = gMapHeader.regionMapSectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateDecorationShop1Menu(const u16 *itemsForSale)
|
void CreateDecorationShop1Menu(const u16 *itemsForSale)
|
||||||
|
|||||||
+2
-1
@@ -22,6 +22,7 @@
|
|||||||
#include "menu_indicators.h"
|
#include "menu_indicators.h"
|
||||||
#include "constants/items.h"
|
#include "constants/items.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
#include "constants/quest_log.h"
|
||||||
|
|
||||||
#define TM_CASE_TM_TAG 400
|
#define TM_CASE_TM_TAG 400
|
||||||
|
|
||||||
@@ -1100,7 +1101,7 @@ static void Task_DoSaleOfTMs(u8 taskId)
|
|||||||
PlaySE(SE_SHOP);
|
PlaySE(SE_SHOP);
|
||||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||||
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
AddMoney(&gSaveBlock1Ptr->money, itemid_get_market_price(gSpecialVar_ItemId) / 2 * data[8]);
|
||||||
RecordItemPurchase(gSpecialVar_ItemId, data[8], 2);
|
RecordItemTransaction(gSpecialVar_ItemId, data[8], QL_EVENT_SOLD_ITEM - QL_EVENT_USED_POKEMART);
|
||||||
DestroyListMenuTask(data[0], &sTMCaseStaticResources.scrollOffset, &sTMCaseStaticResources.selectedRow);
|
DestroyListMenuTask(data[0], &sTMCaseStaticResources.scrollOffset, &sTMCaseStaticResources.selectedRow);
|
||||||
TMCaseSetup_GetTMCount();
|
TMCaseSetup_GetTMCount();
|
||||||
TMCaseSetup_InitListMenuPositions();
|
TMCaseSetup_InitListMenuPositions();
|
||||||
|
|||||||
+6
-8
@@ -98,9 +98,7 @@ struct TradeAnimationResources {
|
|||||||
/*0xF0*/ u16 tradeSpecies[2];
|
/*0xF0*/ u16 tradeSpecies[2];
|
||||||
/*0xF4*/ u16 cachedMapMusic;
|
/*0xF4*/ u16 cachedMapMusic;
|
||||||
/*0xF6*/ u8 unk_F6;
|
/*0xF6*/ u8 unk_F6;
|
||||||
/*0xF8*/ u16 monSpecies[2];
|
/*0xF8*/ struct QuestLogEvent_Traded questLogData;
|
||||||
/*0xFC*/ u8 linkPartnerName[7];
|
|
||||||
/*0x103*/ u8 filler_103[1];
|
|
||||||
/*0x104*/ u8 textColor[3];
|
/*0x104*/ u8 textColor[3];
|
||||||
/*0x107*/ u8 filler_107[1];
|
/*0x107*/ u8 filler_107[1];
|
||||||
/*0x108*/ bool8 isCableTrade;
|
/*0x108*/ bool8 isCableTrade;
|
||||||
@@ -883,9 +881,9 @@ void CB2_InitTradeAnim_LinkTrade(void)
|
|||||||
case 10:
|
case 10:
|
||||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
|
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
sTradeData->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedTradeMonPositions[0]], MON_DATA_SPECIES2);
|
sTradeData->questLogData.speciesSent = GetMonData(&gPlayerParty[gSelectedTradeMonPositions[0]], MON_DATA_SPECIES2);
|
||||||
sTradeData->monSpecies[1] = GetMonData(&gEnemyParty[gSelectedTradeMonPositions[1] % 6], MON_DATA_SPECIES2);
|
sTradeData->questLogData.speciesReceived = GetMonData(&gEnemyParty[gSelectedTradeMonPositions[1] % PARTY_SIZE], MON_DATA_SPECIES2);
|
||||||
memcpy(sTradeData->linkPartnerName, gLinkPlayers[GetMultiplayerId() ^ 1].name, 7);
|
memcpy(sTradeData->questLogData.partnerName, gLinkPlayers[GetMultiplayerId() ^ 1].name, PLAYER_NAME_LENGTH);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
@@ -2575,11 +2573,11 @@ static void CB2_HandleTradeEnded(void)
|
|||||||
case 50:
|
case 50:
|
||||||
if (InUnionRoom())
|
if (InUnionRoom())
|
||||||
{
|
{
|
||||||
SetQuestLogEvent(QL_EVENT_LINK_TRADED_UNION, sTradeData->monSpecies);
|
SetQuestLogEvent(QL_EVENT_LINK_TRADED_UNION, (void *)&sTradeData->questLogData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetQuestLogEvent(QL_EVENT_LINK_TRADED, sTradeData->monSpecies);
|
SetQuestLogEvent(QL_EVENT_LINK_TRADED, (void *)&sTradeData->questLogData);
|
||||||
IncrementGameStat(GAME_STAT_POKEMON_TRADES);
|
IncrementGameStat(GAME_STAT_POKEMON_TRADES);
|
||||||
}
|
}
|
||||||
if (gWirelessCommType)
|
if (gWirelessCommType)
|
||||||
|
|||||||
Reference in New Issue
Block a user