Skip to content

Commit 9cc5c88

Browse files
committed
Cleanup
1 parent 3994b2f commit 9cc5c88

27 files changed

+629
-168
lines changed

AzelLib/LCS.cpp

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "PDS.h"
2+
#include "items.h"
23

34
p_workArea createLCSSelectedTask(s_LCSTask* r4, sLCSTarget* r5);
45
void DrawLCSTarget(s_LCSTask* r14, sVec2_S16* r5, s32 r6);
@@ -27,7 +28,7 @@ void LCSTaskDrawSub1Sub2Sub6(void*)
2728
PDS_unimplemented("LCSTaskDrawSub1Sub2Sub6");
2829
}
2930

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)
3132
{
3233
r4->m0 = r5;
3334
r4->m4_callback = r6;
@@ -792,54 +793,19 @@ s32 LCSTaskDrawSub1Sub2Sub2(s_LCSTask* r4)
792793
return 1;
793794
}
794795

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-
832796
static const std::array<s8, 10> LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0Data1 =
833797
{
834798
2,1,0,2,1,0,2,1,0,3
835799
};
836800

837801
s8 LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0(sLCSTarget* r4)
838802
{
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+
}
841807

842-
return LCSTaskDrawSub1Sub2Sub0Sub1Sub0Sub0Data1[getObjectListEntry(r4->m14_receivedItemId)->m1];
808+
return r4->m14_receivedItemId;
843809
}
844810

845811
void LCSTaskDrawSub1Sub2Sub0Sub1Sub0(s_LCSTask* r4, sLCSTarget* r5, s32 r6)

AzelLib/LCS.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct sLCSTarget
3535
const sVec3_FP* mC_optionalRotation;
3636
s16 m10_flags;
3737
s16 m12;
38-
s16 m14_receivedItemId;
38+
eItems m14_receivedItemId;
3939
s8 m16_receivedItemQuantity;
4040
s8 m17;
4141
s8 m18_diableFlags; // 1: disabled, 4: not visible/facing away?
@@ -141,7 +141,7 @@ struct s_LCSTask340Sub : public s_workAreaTemplateWithArg<s_LCSTask340Sub, sLase
141141
sVec3_FP* m18;
142142
sLCSTarget* m1C;
143143
struct s_LCSTask340* m20;
144-
s16 m24_receivedItemId;
144+
eItems m24_receivedItemId;
145145
s8 m26_receivedItemQuantity;
146146
s8 m27;
147147
void (*m28_laserInit)(s_LCSTask340Sub*);
@@ -269,20 +269,7 @@ struct sLCSSelected : public s_workAreaTemplate<sLCSSelected>
269269
//size 0x30
270270
};
271271

272-
struct sObjectListEntry
273-
{
274-
s8 m0;
275-
s8 m1;
276-
s8 m2;
277-
s8 m3;
278-
std::string m4_name;
279-
std::string m8_description;
280-
};
281-
282-
sObjectListEntry* getObjectListEntry(s32 entry);
283-
s32 getObjectIcon(s32 objectID);
284-
285-
void createLCSTarget(sLCSTarget* r4, s_workArea* r5, void (*r6)(p_workArea, sLCSTarget*), const sVec3_FP* r7, const sVec3_FP* arg0, s16 flags, s16 argA, s16 receivedItemId, s32 receivedItemQuantity, s32 arg14);
272+
void createLCSTarget(sLCSTarget* r4, s_workArea* r5, void (*r6)(p_workArea, sLCSTarget*), const sVec3_FP* r7, const sVec3_FP* arg0, s16 flags, s16 argA, eItems receivedItemId, s32 receivedItemQuantity, s32 arg14);
286273
void updateLCSTarget(sLCSTarget* r14);
287274
void LCSTaskDrawSub();
288275
void allocateLCSEntry(s_visibilityGridWorkArea* r4, sProcessed3dModel* r5, fixedPoint r6);

AzelLib/battle/BTL_A3/BTL_A3_map6.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,6 @@ void BTL_A3_Env_DrawSub8(s_BTL_A3_Env* pThis)
682682
sVec3_FP cameraRotation = pThis->m18_cameraRotation;
683683
if (pThis->m18_cameraRotation[0] == 0)
684684
{
685-
assert(0);
686685
cameraRotation[0] = -0x12345; // was that a debug piece of code left over?
687686
}
688687

0 commit comments

Comments
 (0)