mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-14 07:28:15 -05:00
Fixes Switch/Wii U crashes with Wonder Rupees and Bottleable Entities (#1360)
* Reorders switch statement to prevent some code that shouldn't execute. * Potentially fixes bottleable entities crash * Solves lack of ItemEntry for GI_MAX * Adds comment clarifying new GetItemEntry
This commit is contained in:
parent
584a4ad818
commit
64aca78450
@ -289,6 +289,7 @@ extern "C" void VanillaItemTable_Init() {
|
|||||||
GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG, MOD_NONE, GI_BULLET_BAG_50),
|
GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG, MOD_NONE, GI_BULLET_BAG_50),
|
||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
|
GET_ITEM_NONE // GI_MAX - if you need to add to this table insert it before this entry.
|
||||||
};
|
};
|
||||||
ItemTableManager::Instance->AddItemTable(MOD_NONE);
|
ItemTableManager::Instance->AddItemTable(MOD_NONE);
|
||||||
for (uint8_t i = 0; i < ARRAY_COUNT(getItemTable); i++) {
|
for (uint8_t i = 0; i < ARRAY_COUNT(getItemTable); i++) {
|
||||||
@ -1613,7 +1614,7 @@ extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
||||||
GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(OTRGlobals::Instance->getItemModIndex, getItemID);
|
GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, getItemID);
|
||||||
return giEntry;
|
return giEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ public:
|
|||||||
std::shared_ptr<Ship::Window> context;
|
std::shared_ptr<Ship::Window> context;
|
||||||
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
|
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
|
||||||
std::shared_ptr<Randomizer> gRandomizer;
|
std::shared_ptr<Randomizer> gRandomizer;
|
||||||
uint16_t getItemModIndex;
|
|
||||||
|
|
||||||
OTRGlobals();
|
OTRGlobals();
|
||||||
~OTRGlobals();
|
~OTRGlobals();
|
||||||
|
@ -60,7 +60,6 @@ void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) {
|
|||||||
globalCtx->cUpElfMsgs = nullptr;
|
globalCtx->cUpElfMsgs = nullptr;
|
||||||
globalCtx->setupPathList = nullptr;
|
globalCtx->setupPathList = nullptr;
|
||||||
globalCtx->numSetupActors = 0;
|
globalCtx->numSetupActors = 0;
|
||||||
OTRGlobals::Instance->getItemModIndex = MOD_NONE;
|
|
||||||
Object_InitBank(globalCtx, &globalCtx->objectCtx);
|
Object_InitBank(globalCtx, &globalCtx->objectCtx);
|
||||||
LightContext_Init(globalCtx, &globalCtx->lightCtx);
|
LightContext_Init(globalCtx, &globalCtx->lightCtx);
|
||||||
TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx);
|
TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx);
|
||||||
|
@ -515,15 +515,15 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Actor_HasParent(&this->actor, globalCtx)) {
|
if (!Actor_HasParent(&this->actor, globalCtx)) {
|
||||||
if (!gSaveContext.n64ddFlag) {
|
|
||||||
if (getItemId != GI_NONE) {
|
if (getItemId != GI_NONE) {
|
||||||
|
if (!gSaveContext.n64ddFlag) {
|
||||||
func_8002F554(&this->actor, globalCtx, getItemId);
|
func_8002F554(&this->actor, globalCtx, getItemId);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
getItem = Randomizer_GetRandomizedItem(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
getItem = Randomizer_GetRandomizedItem(getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum);
|
||||||
GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, getItem);
|
GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, getItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EnItem00_SetupAction(this, func_8001E5C8);
|
EnItem00_SetupAction(this, func_8001E5C8);
|
||||||
this->actionFunc(this, globalCtx);
|
this->actionFunc(this, globalCtx);
|
||||||
|
Loading…
Reference in New Issue
Block a user