Fix ice trap particles (#2229)

This commit is contained in:
aMannus 2022-12-21 17:14:00 +01:00 committed by GitHub
parent 9eb190e734
commit 565775a3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -23,7 +23,10 @@ bool ItemTableManager::AddItemEntry(uint16_t tableID, uint16_t getItemID, GetIte
GetItemEntry ItemTableManager::RetrieveItemEntry(uint16_t tableID, uint16_t itemID) {
try {
ItemTable* itemTable = RetrieveItemTable(tableID);
return itemTable->at(itemID);
GetItemEntry getItemEntry = itemTable->at(itemID);
getItemEntry.drawItemId = getItemEntry.itemId;
getItemEntry.drawModIndex = getItemEntry.modIndex;
return getItemEntry;
} catch (std::out_of_range& oor) { return GET_ITEM_NONE; }
}

View File

@ -52,5 +52,7 @@ typedef struct GetItemEntry {
/* 0x0C */ uint16_t collectable; // determines whether the item can be collected on the overworld. Will be true in most cases.
/* 0x0E */ GetItemFrom getItemFrom;
/* 0x0F */ GetItemCategory getItemCategory; // Primarily made and used for chest size/texture matches contents
/* 0x10 */ uint16_t drawItemId; // Will be a copy of itemId unless the item is an ice trap. Needed for particles to function on ice traps.
/* 0x11 */ uint16_t drawModIndex; // Will be a copy of modIndex unless the item is an ice trap. Needed for particles to function on ice traps.
CustomDrawFunc drawFunc;
}; // size = 0x0F
}; // size = 0x11

View File

@ -2608,6 +2608,8 @@ GetItemEntry Randomizer::GetItemEntryFromRGData(RandomizerGetData rgData, GetIte
GetItemEntry fakeGiEntry = ItemTableManager::Instance->RetrieveItemEntry(modIndex, GetItemIdFromRandomizerGet(rgData.fakeRgID, ogItemId));
giEntry.gid = fakeGiEntry.gid;
giEntry.gi = fakeGiEntry.gi;
giEntry.drawItemId = fakeGiEntry.drawItemId;
giEntry.drawModIndex = fakeGiEntry.drawModIndex;
giEntry.drawFunc = fakeGiEntry.drawFunc;
}
return giEntry;

View File

@ -1264,9 +1264,9 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry giEntry) {
s16 color_slot;
switch (giEntry.modIndex) {
switch (giEntry.drawModIndex) {
case MOD_NONE:
switch (giEntry.itemId) {
switch (giEntry.drawItemId) {
case ITEM_SONG_MINUET:
color_slot = 0;
break;
@ -1298,7 +1298,7 @@ void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry
}
break;
case MOD_RANDOMIZER:
switch (giEntry.itemId) {
switch (giEntry.drawItemId) {
case RG_MAGIC_SINGLE:
case RG_MAGIC_DOUBLE:
case RG_MAGIC_BEAN_PACK: