mirror of
https://github.com/risingPhil/PokeMe64.git
synced 2026-03-21 18:04:15 -05:00
Make GS Ball event repeatable
With these changes, libpokemegb will remove an existing GS Ball from the players' inventory and reset all GS ball related event flags before activating the event. This basically fixes up saves which used earlier versions of PokeMe64 that only gave you the item without triggering the event. (By removing the existing GS Ball item, it prevents the need to create a new save in order to unlock the gs ball event for the users who were so nice to test these earlier builds) As an added bonus, this makes the GS Ball event entirely repeatable (which is actually great). You just need to use PokeMe64 everytime to make the event repeat from the start..
This commit is contained in:
parent
4da27db8b8
commit
521a9ae30c
|
|
@ -1 +1 @@
|
|||
Subproject commit 99e495dad99bc63cbb078862de3549d8c69890f1
|
||||
Subproject commit c9257d7e0166b26b3ff472714ce36317196c39fd
|
||||
|
|
@ -317,39 +317,18 @@ void gen2ReceiveGSBall(void* context, const void* param)
|
|||
DialogData* messageData = new DialogData{
|
||||
.shouldDeleteWhenDone = true
|
||||
};
|
||||
bool alreadyHasOne = false;
|
||||
|
||||
tpakManager.setRAMEnabled(true);
|
||||
|
||||
const char* trainerName = gameReader.getTrainerName();
|
||||
Gen2ItemList keyItemPocket = gameReader.getItemList(Gen2ItemListType::GEN2_ITEMLISTTYPE_KEYITEMPOCKET);
|
||||
if(keyItemPocket.getCount() > 0)
|
||||
{
|
||||
uint8_t itemId;
|
||||
uint8_t itemCount;
|
||||
bool gotEntry = keyItemPocket.getEntry(0, itemId, itemCount);
|
||||
|
||||
while(gotEntry)
|
||||
{
|
||||
if(itemId == POKEMON_CRYSTAL_ITEM_ID_GS_BALL)
|
||||
{
|
||||
alreadyHasOne = true;
|
||||
break;
|
||||
}
|
||||
gotEntry = keyItemPocket.getNextEntry(itemId, itemCount);
|
||||
}
|
||||
}
|
||||
|
||||
// the unlockGsBallEvent() function does all the work. It's even repeatable!
|
||||
gameReader.unlockGsBallEvent();
|
||||
gameReader.finishSave();
|
||||
tpakManager.finishWrites();
|
||||
tpakManager.setRAMEnabled(false);
|
||||
|
||||
if(alreadyHasOne)
|
||||
{
|
||||
setDialogDataText(*messageData, "It appears you already have one!");
|
||||
}
|
||||
else
|
||||
{
|
||||
gameReader.unlockGsBallEvent();
|
||||
gameReader.finishSave();
|
||||
tpakManager.finishWrites();
|
||||
setDialogDataText(*messageData, "GS Ball event unlocked! Please go to the Golden Rod Pokémon Center and try to leave!", trainerName);
|
||||
}
|
||||
setDialogDataText(*messageData, "GS Ball event unlocked! Please go to the Golden Rod Pokémon Center and try to leave!", trainerName);
|
||||
|
||||
scene->showDialog(messageData);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user