Skip to content

Commit 565775a

Browse files
authored
Fix ice trap particles (#2229)
1 parent 9eb190e commit 565775a

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

soh/soh/Enhancements/item-tables/ItemTableManager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ bool ItemTableManager::AddItemEntry(uint16_t tableID, uint16_t getItemID, GetIte
2323
GetItemEntry ItemTableManager::RetrieveItemEntry(uint16_t tableID, uint16_t itemID) {
2424
try {
2525
ItemTable* itemTable = RetrieveItemTable(tableID);
26-
return itemTable->at(itemID);
26+
GetItemEntry getItemEntry = itemTable->at(itemID);
27+
getItemEntry.drawItemId = getItemEntry.itemId;
28+
getItemEntry.drawModIndex = getItemEntry.modIndex;
29+
return getItemEntry;
2730
} catch (std::out_of_range& oor) { return GET_ITEM_NONE; }
2831
}
2932

soh/soh/Enhancements/item-tables/ItemTableTypes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,7 @@ typedef struct GetItemEntry {
5252
/* 0x0C */ uint16_t collectable; // determines whether the item can be collected on the overworld. Will be true in most cases.
5353
/* 0x0E */ GetItemFrom getItemFrom;
5454
/* 0x0F */ GetItemCategory getItemCategory; // Primarily made and used for chest size/texture matches contents
55+
/* 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.
56+
/* 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.
5557
CustomDrawFunc drawFunc;
56-
}; // size = 0x0F
58+
}; // size = 0x11

soh/soh/Enhancements/randomizer/randomizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,8 @@ GetItemEntry Randomizer::GetItemEntryFromRGData(RandomizerGetData rgData, GetIte
26082608
GetItemEntry fakeGiEntry = ItemTableManager::Instance->RetrieveItemEntry(modIndex, GetItemIdFromRandomizerGet(rgData.fakeRgID, ogItemId));
26092609
giEntry.gid = fakeGiEntry.gid;
26102610
giEntry.gi = fakeGiEntry.gi;
2611+
giEntry.drawItemId = fakeGiEntry.drawItemId;
2612+
giEntry.drawModIndex = fakeGiEntry.drawModIndex;
26112613
giEntry.drawFunc = fakeGiEntry.drawFunc;
26122614
}
26132615
return giEntry;

soh/src/code/z_en_item00.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,9 +1264,9 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
12641264

12651265
void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry giEntry) {
12661266
s16 color_slot;
1267-
switch (giEntry.modIndex) {
1267+
switch (giEntry.drawModIndex) {
12681268
case MOD_NONE:
1269-
switch (giEntry.itemId) {
1269+
switch (giEntry.drawItemId) {
12701270
case ITEM_SONG_MINUET:
12711271
color_slot = 0;
12721272
break;
@@ -1298,7 +1298,7 @@ void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry
12981298
}
12991299
break;
13001300
case MOD_RANDOMIZER:
1301-
switch (giEntry.itemId) {
1301+
switch (giEntry.drawItemId) {
13021302
case RG_MAGIC_SINGLE:
13031303
case RG_MAGIC_DOUBLE:
13041304
case RG_MAGIC_BEAN_PACK:

0 commit comments

Comments
 (0)