moved gCurrentAreaDroptable into gRoomVars properly

also rename globals
This commit is contained in:
Henny022p
2022-02-10 01:29:15 +01:00
parent 5145c4776d
commit d64fea8164
7 changed files with 33 additions and 38 deletions
+12 -13
View File
@@ -46,7 +46,6 @@ extern u8 gUnk_080FE1C6[];
0x8u,
};
*/
extern Droptable gCurrentAreaDroptable;
extern void (*const gUnk_080FE2A0[])(void);
void ForceEquipItem(u32, u8);
@@ -184,7 +183,7 @@ NONMATCH("asm/non_matching/sub_08054524.inc", void sub_08054524(void)) {
bVar1 = 0;
}
MemCopy(&gDroptablesAreas[0] + gUnk_080FE1C6[bVar1] * 0x8, &gCurrentAreaDroptable, 0x20);
MemCopy(&gAreaDroptables[0] + gUnk_080FE1C6[bVar1] * 0x8, &gRoomVars.currentAreaDroptable, 0x20);
}
END_NONMATCH
@@ -212,11 +211,11 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
Droptable droptable;
r3 = arg1;
if (gRoomVars.field_0x2 != 1) {
ptr2 = &gDroptableModifierNone;
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
ptr4 = NULL;
switch (r3) {
case 1 ... 12:
ptr4 = &gDroptablesEnemies[r3];
ptr4 = &gEnemyDroptables[r3];
break;
#ifndef EU
case 24:
@@ -232,9 +231,9 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
#ifdef EU
case 24:
#endif
ptr2 = &gDroptablesObjects[r3 - 16];
ptr2 = &gObjectDroptables[r3 - 16];
case 15:
ptr4 = &gCurrentAreaDroptable;
ptr4 = &gRoomVars.currentAreaDroptable;
break;
case 0:
default:
@@ -243,12 +242,12 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
if (ptr4 != 0) {
if ((r1 = gSave.stats.unkB) == 0) {
// nop
ptr3 = &gDroptableModifierNone;
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
} else {
#ifdef EU
ptr3 = &gDroptablesEnemies[r1 + 9];
ptr3 = &gEnemyDroptables[r1 + 9];
#else
ptr3 = &gDroptablesEnemies[r1 + 6];
ptr3 = &gEnemyDroptables[r1 + 6];
#endif
}
// vector addition, s0 = ptr4 + ptr2 + ptr3
@@ -265,16 +264,16 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
if (gSave.stats.rupees <= 10) {
droptable.s.rupee5 += 1;
}
ptr2 = &gDroptableModifierNone;
ptr2 = &gDroptableModifiers[DROPTABLE_NONE];
r0 = gSave.stats.hasAllFigurines;
ptr3 = &gDroptableModifierNone;
ptr3 = &gDroptableModifiers[DROPTABLE_NONE];
// don't drop shells anymore
if (r0 != 0) {
ptr2 = &gDroptableModifierNoShells;
ptr2 = &gDroptableModifiers[DROPTABLE_NO_SHELLS];
}
// don't drop kinstones anymore
if (gSave.didAllFusions != 0) {
ptr3 = &gDroptableModifierNoKinstones;
ptr3 = &gDroptableModifiers[DROPTABLE_NO_KINSTONES];
}
// vector addition, s0 = s0 + ptr2 + ptr3
// resulting values are clamped to be >= 0
+4 -4
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "droptables.h"
const Droptable gDroptablesEnemies[] = {
const Droptable gEnemyDroptables[] = {
[0] = { {
.none = -999,
.rupee1 = -999,
@@ -328,7 +328,7 @@ const Droptable gDroptablesEnemies[] = {
} },
};
const Droptable gDroptablesAreas[] = {
const Droptable gAreaDroptables[] = {
[0] = { {
.none = 920,
.rupee1 = 15,
@@ -676,7 +676,7 @@ const Droptable gDroptablesAreas[] = {
.none5 = 0,
} },
};
const Droptable gDroptablesObjects[] = {
const Droptable gObjectDroptables[] = {
[0] = { {
.none = 0,
.rupee1 = 10,
@@ -1065,7 +1065,7 @@ const Droptable gUnk_0800191C[] = {
};
// special treatment for shells and kinstones after finishing figurines/fusions
const Droptable gDroptablesModifiers[] = {
const Droptable gDroptableModifiers[] = {
// nop
{ {
.none = 0,
+1 -6
View File
@@ -39,11 +39,6 @@ static void LoadDestructibleTile(TileEntity*);
static void LoadGrassDropTile(TileEntity*);
static void LoadLocationTile(TileEntity*);
typedef struct {
u8 filler[0x20];
} VarStruct;
extern VarStruct gDroptablesAreas[];
void LoadRoomEntityList(EntityData* listPtr) {
if (listPtr != NULL) {
while (listPtr->kind != 0xFF) {
@@ -302,7 +297,7 @@ void LoadRoomTileEntities(TileEntity* list) {
}
static void LoadGrassDropTile(TileEntity* tile) {
MemCopy(&gDroptablesAreas[tile->_1], &gRoomVars.filler4[44], 0x20);
MemCopy(&gAreaDroptables[tile->_1], &gRoomVars.currentAreaDroptable, 0x20);
}
static void LoadLocationTile(TileEntity* tile) {