mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-24 09:08:52 -05:00
Renames, relocates, and implements ModIndex enum.
This commit is contained in:
parent
cdd4628d7a
commit
cb81023255
@ -4787,7 +4787,7 @@ void InitRandoItemTable() {
|
|||||||
};
|
};
|
||||||
ItemTableManager::Instance->AddItemTable(MOD_RANDOMIZER);
|
ItemTableManager::Instance->AddItemTable(MOD_RANDOMIZER);
|
||||||
for (int i = 0; i < ARRAY_SIZE(extendedVanillaGetItemTable); i++) {
|
for (int i = 0; i < ARRAY_SIZE(extendedVanillaGetItemTable); i++) {
|
||||||
extendedVanillaGetItemTable[i].modIndex = MOD_VANILLA;
|
extendedVanillaGetItemTable[i].modIndex = MOD_NONE;
|
||||||
// These items should use their RG value as their getItemID.
|
// These items should use their RG value as their getItemID.
|
||||||
// RANDOTODO: Add the getItemID as a member of the GetItemEntry
|
// RANDOTODO: Add the getItemID as a member of the GetItemEntry
|
||||||
// struct, since that value will be useful in other places as well.
|
// struct, since that value will be useful in other places as well.
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
|
||||||
typedef enum { MOD_VANILLA, MOD_RANDOMIZER } ModIndex;
|
|
||||||
|
|
||||||
class Randomizer {
|
class Randomizer {
|
||||||
private:
|
private:
|
||||||
std::unordered_map<RandomizerCheck, RandomizerGet> itemLocations;
|
std::unordered_map<RandomizerCheck, RandomizerGet> itemLocations;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// This should probably go in a less rando-specific location
|
||||||
|
// but the best location will probably be in the modding engine
|
||||||
|
// which doesn't exist yet.
|
||||||
|
typedef enum { MOD_NONE, MOD_RANDOMIZER } ModIndex;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char tex[512];
|
char tex[512];
|
||||||
uint16_t width;
|
uint16_t width;
|
||||||
|
@ -285,10 +285,10 @@ extern "C" void VanillaItemTable_Init() {
|
|||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
GET_ITEM_NONE,
|
GET_ITEM_NONE,
|
||||||
};
|
};
|
||||||
ItemTableManager::Instance->AddItemTable(MOD_VANILLA);
|
ItemTableManager::Instance->AddItemTable(MOD_NONE);
|
||||||
for (uint8_t i = 0; i < ARRAY_SIZE(getItemTable); i++) {
|
for (uint8_t i = 0; i < ARRAY_SIZE(getItemTable); i++) {
|
||||||
getItemTable[i].modIndex = MOD_VANILLA;
|
getItemTable[i].modIndex = MOD_NONE;
|
||||||
ItemTableManager::Instance->AddItemEntry(MOD_VANILLA, i, getItemTable[i]);
|
ItemTableManager::Instance->AddItemEntry(MOD_NONE, i, getItemTable[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,7 +1610,7 @@ extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
||||||
if (OTRGlobals::Instance->getItemModIndex != MOD_VANILLA) {
|
if (OTRGlobals::Instance->getItemModIndex != MOD_NONE) {
|
||||||
getItemID++; // counteracts the - 1 offset used for vanilla table
|
getItemID++; // counteracts the - 1 offset used for vanilla table
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,7 +1618,7 @@ extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 tableID, s16 getItemID) {
|
extern "C" GetItemEntry ItemTable_RetrieveEntry(s16 tableID, s16 getItemID) {
|
||||||
if (tableID == MOD_VANILLA) {
|
if (tableID == MOD_NONE) {
|
||||||
getItemID--; // counteracts the - 1 offset used for vanilla table
|
getItemID--; // counteracts the - 1 offset used for vanilla table
|
||||||
}
|
}
|
||||||
return ItemTableManager::Instance->RetrieveItemEntry(tableID, getItemID);
|
return ItemTableManager::Instance->RetrieveItemEntry(tableID, getItemID);
|
||||||
@ -1628,7 +1628,7 @@ extern "C" s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 a
|
|||||||
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams))) {
|
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams))) {
|
||||||
OTRGlobals::Instance->getItemModIndex = MOD_RANDOMIZER;
|
OTRGlobals::Instance->getItemModIndex = MOD_RANDOMIZER;
|
||||||
} else {
|
} else {
|
||||||
OTRGlobals::Instance->getItemModIndex = MOD_VANILLA;
|
OTRGlobals::Instance->getItemModIndex = MOD_NONE;
|
||||||
}
|
}
|
||||||
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
||||||
}
|
}
|
||||||
@ -1639,7 +1639,7 @@ extern "C" GetItemEntry Randomizer_GetRandomizedItem(GetItemID ogId, s16 actorId
|
|||||||
OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams))) {
|
OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams))) {
|
||||||
getItemModIndex = MOD_RANDOMIZER;
|
getItemModIndex = MOD_RANDOMIZER;
|
||||||
} else {
|
} else {
|
||||||
getItemModIndex = MOD_VANILLA;
|
getItemModIndex = MOD_NONE;
|
||||||
}
|
}
|
||||||
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemId(ogId, actorId, actorParams, sceneNum);
|
||||||
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
||||||
@ -1649,7 +1649,7 @@ extern "C" s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerChec
|
|||||||
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(randomizerCheck)) {
|
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(randomizerCheck)) {
|
||||||
OTRGlobals::Instance->getItemModIndex = MOD_RANDOMIZER;
|
OTRGlobals::Instance->getItemModIndex = MOD_RANDOMIZER;
|
||||||
} else {
|
} else {
|
||||||
OTRGlobals::Instance->getItemModIndex = MOD_VANILLA;
|
OTRGlobals::Instance->getItemModIndex = MOD_NONE;
|
||||||
}
|
}
|
||||||
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
||||||
}
|
}
|
||||||
@ -1659,7 +1659,7 @@ extern "C" GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomi
|
|||||||
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(randomizerCheck)) {
|
if (OTRGlobals::Instance->gRandomizer->CheckContainsRandoItem(randomizerCheck)) {
|
||||||
getItemModIndex = MOD_RANDOMIZER;
|
getItemModIndex = MOD_RANDOMIZER;
|
||||||
} else {
|
} else {
|
||||||
getItemModIndex = MOD_VANILLA;
|
getItemModIndex = MOD_NONE;
|
||||||
}
|
}
|
||||||
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
s16 itemID = OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
|
||||||
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
return ItemTable_RetrieveEntry(getItemModIndex, itemID);
|
||||||
|
@ -1211,7 +1211,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
|||||||
void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetItemEntry giEntry) {
|
void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetItemEntry giEntry) {
|
||||||
s16 color_slot;
|
s16 color_slot;
|
||||||
switch (giEntry.modIndex) {
|
switch (giEntry.modIndex) {
|
||||||
case 0:
|
case MOD_NONE:
|
||||||
switch (giEntry.itemId) {
|
switch (giEntry.itemId) {
|
||||||
case ITEM_SONG_MINUET:
|
case ITEM_SONG_MINUET:
|
||||||
color_slot = 0;
|
color_slot = 0;
|
||||||
@ -1243,7 +1243,7 @@ void EnItem00_CustomItemsParticles(Actor* Parent, GlobalContext* globalCtx, GetI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case MOD_RANDOMIZER:
|
||||||
switch (giEntry.itemId) {
|
switch (giEntry.itemId) {
|
||||||
case RG_MAGIC_SINGLE:
|
case RG_MAGIC_SINGLE:
|
||||||
case RG_MAGIC_DOUBLE:
|
case RG_MAGIC_DOUBLE:
|
||||||
|
@ -12737,16 +12737,15 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Message_StartTextbox(globalCtx, giEntry.textId, &this->actor);
|
Message_StartTextbox(globalCtx, giEntry.textId, &this->actor);
|
||||||
if (giEntry.modIndex == 0) {
|
if (giEntry.modIndex == MOD_NONE) {
|
||||||
Item_Give(globalCtx, giEntry.itemId);
|
Item_Give(globalCtx, giEntry.itemId);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Randomizer_Item_Give(globalCtx, giEntry);
|
Randomizer_Item_Give(globalCtx, giEntry);
|
||||||
}
|
}
|
||||||
Player_SetPendingFlag(this, globalCtx);
|
Player_SetPendingFlag(this, globalCtx);
|
||||||
|
|
||||||
if (this->getItemEntry.objectId != OBJECT_INVALID) {
|
if (this->getItemEntry.objectId != OBJECT_INVALID) {
|
||||||
if (giEntry.modIndex == 0) {
|
if (giEntry.modIndex == MOD_NONE) {
|
||||||
if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) ||
|
if (((this->getItemId >= GI_RUPEE_GREEN) && (this->getItemId <= GI_RUPEE_RED)) ||
|
||||||
((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) ||
|
((this->getItemId >= GI_RUPEE_PURPLE) && (this->getItemId <= GI_RUPEE_GOLD)) ||
|
||||||
((this->getItemId >= GI_RUPEE_GREEN_LOSE) && (this->getItemId <= GI_RUPEE_PURPLE_LOSE)) ||
|
((this->getItemId >= GI_RUPEE_GREEN_LOSE) && (this->getItemId <= GI_RUPEE_PURPLE_LOSE)) ||
|
||||||
@ -12772,7 +12771,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (giEntry.modIndex == 0) {
|
if (giEntry.modIndex == MOD_NONE) {
|
||||||
if (((giEntry.itemId >= ITEM_RUPEE_GREEN) && (giEntry.itemId <= ITEM_RUPEE_RED)) ||
|
if (((giEntry.itemId >= ITEM_RUPEE_GREEN) && (giEntry.itemId <= ITEM_RUPEE_RED)) ||
|
||||||
((giEntry.itemId >= ITEM_RUPEE_PURPLE) && (giEntry.itemId <= ITEM_RUPEE_GOLD)) ||
|
((giEntry.itemId >= ITEM_RUPEE_PURPLE) && (giEntry.itemId <= ITEM_RUPEE_GOLD)) ||
|
||||||
(giEntry.itemId == ITEM_HEART)) {
|
(giEntry.itemId == ITEM_HEART)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user