|
1 | 1 | #include "PDS.h" |
| 2 | +#include "items.h" |
2 | 3 |
|
3 | 4 | p_workArea createLCSSelectedTask(s_LCSTask* r4, sLCSTarget* r5); |
4 | 5 | void DrawLCSTarget(s_LCSTask* r14, sVec2_S16* r5, s32 r6); |
@@ -27,7 +28,7 @@ void LCSTaskDrawSub1Sub2Sub6(void*) |
27 | 28 | PDS_unimplemented("LCSTaskDrawSub1Sub2Sub6"); |
28 | 29 | } |
29 | 30 |
|
30 | | -void createLCSTarget(sLCSTarget* r4, s_workArea* r5, void (*r6)(p_workArea, sLCSTarget*), const sVec3_FP* r7, const sVec3_FP* optionalRotation, s16 flags, s16 argA, s16 receivedItemId, s32 receivedItemQuantity, s32 arg14) |
| 31 | +void createLCSTarget(sLCSTarget* r4, s_workArea* r5, void (*r6)(p_workArea, sLCSTarget*), const sVec3_FP* r7, const sVec3_FP* optionalRotation, s16 flags, s16 argA, eItems receivedItemId, s32 receivedItemQuantity, s32 arg14) |
31 | 32 | { |
32 | 33 | r4->m0 = r5; |
33 | 34 | r4->m4_callback = r6; |
@@ -792,54 +793,19 @@ s32 LCSTaskDrawSub1Sub2Sub2(s_LCSTask* r4) |
792 | 793 | return 1; |
793 | 794 | } |
794 | 795 |
|
795 | | -sObjectListEntry* getObjectListEntry(s32 entry) |
796 | | -{ |
797 | | - static std::unordered_map<s32, sObjectListEntry*> cache; |
798 | | - |
799 | | - std::unordered_map<s32, sObjectListEntry*>::iterator cacheEntry = cache.find(entry); |
800 | | - if (cacheEntry != cache.end()) |
801 | | - { |
802 | | - return cacheEntry->second; |
803 | | - } |
804 | | - |
805 | | - sSaturnPtr EA = gCommonFile.getSaturnPtr(0x20C3F4); |
806 | | - EA += 3 * 4 * entry; |
807 | | - |
808 | | - sObjectListEntry* pNewObjectEntry = new sObjectListEntry; |
809 | | - |
810 | | - pNewObjectEntry->m0 = readSaturnS8(EA + 0); |
811 | | - pNewObjectEntry->m1 = readSaturnS8(EA + 1); |
812 | | - pNewObjectEntry->m2 = readSaturnS8(EA + 2); |
813 | | - pNewObjectEntry->m3 = readSaturnS8(EA + 3); |
814 | | - pNewObjectEntry->m4_name = readSaturnString(readSaturnEA(EA + 4)); |
815 | | - pNewObjectEntry->m8_description = readSaturnString(readSaturnEA(EA + 8)); |
816 | | - |
817 | | - cache.insert_or_assign(entry, pNewObjectEntry); |
818 | | - |
819 | | - return pNewObjectEntry; |
820 | | -} |
821 | | - |
822 | | -s32 getObjectIcon(s32 objectID) |
823 | | -{ |
824 | | - sObjectListEntry* pObject = getObjectListEntry(objectID); |
825 | | - |
826 | | - static const std::array<s32, 10> objectTypeLookupTable = |
827 | | - { 0,1,2,3,4,5,6,7,8,9 }; |
828 | | - |
829 | | - return objectTypeLookupTable[pObject->m1]; |
830 | | -} |
831 | | - |
832 | 796 | static const std::array<s8, 10> LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0Data1 = |
833 | 797 | { |
834 | 798 | 2,1,0,2,1,0,2,1,0,3 |
835 | 799 | }; |
836 | 800 |
|
837 | 801 | s8 LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0(sLCSTarget* r4) |
838 | 802 | { |
839 | | - if (r4->m14_receivedItemId < 0) |
840 | | - return r4->m14_receivedItemId; |
| 803 | + if (r4->m14_receivedItemId > -1) |
| 804 | + { |
| 805 | + return LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0Data1[getObjectListEntry(r4->m14_receivedItemId)->m1_type]; |
| 806 | + } |
841 | 807 |
|
842 | | - return LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0Data1[getObjectListEntry(r4->m14_receivedItemId)->m1]; |
| 808 | + return r4->m14_receivedItemId; |
843 | 809 | } |
844 | 810 |
|
845 | 811 | void LCSTaskDrawSub1Sub2Sub0Sub1Sub0(s_LCSTask* r4, sLCSTarget* r5, s32 r6) |
|
0 commit comments