some more documentation

This commit is contained in:
Henny022p 2022-02-09 03:58:04 +01:00
parent 61e780fb2a
commit 3297dc905c
4 changed files with 40 additions and 44 deletions

View File

@ -25,7 +25,6 @@ typedef union {
static_assert(sizeof(Droptable) == 0x20);
extern const Droptable gDroptablesEnemies[];
extern const Droptable gUnk_0800143C[];
extern const Droptable gDroptablesAreas[];
extern const Droptable gDroptablesObjects[];
extern const Droptable gUnk_0800191C[];

View File

@ -206,14 +206,14 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
ITEM_ENEMY_BEETLE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE,
}*/;
int r0, r1, r2, r4, r5;
int r0, r1, rand, summOdds, item;
u32 r3;
const Droptable *ptr2, *ptr3, *ptr4;
Droptable s0;
Droptable droptable;
r3 = arg1;
if (gRoomVars.field_0x2 != 1) {
ptr2 = &gDroptablesModifiers[0];
ptr4 = 0;
ptr2 = &gDroptableModifierNone;
ptr4 = NULL;
switch (r3) {
case 1 ... 12:
ptr4 = &gDroptablesEnemies[r3];
@ -246,24 +246,24 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
ptr3 = &gDroptableModifierNone;
} else {
#ifdef EU
ptr3 = &gUnk_0800143C[r1 + 3];
ptr3 = &gDroptablesEnemies[r1 + 9];
#else
ptr3 = &gUnk_0800143C[r1];
ptr3 = &gDroptablesEnemies[r1+6];
#endif
}
// vector addition, s0 = ptr4 + ptr2 + ptr3
sub_08000F14(s0.a, ptr4->a, ptr2->a, ptr3->a);
sub_08000F14(droptable.a, ptr4->a, ptr2->a, ptr3->a);
if (gSave.stats.health <= 8) {
s0.s.hearts += 5;
droptable.s.hearts += 5;
}
if (gSave.stats.bombCount == 0) {
s0.s.bombs += 3;
droptable.s.bombs += 3;
}
if (gSave.stats.arrowCount == 0) {
s0.s.arrows += 3;
droptable.s.arrows += 3;
}
if (gSave.stats.rupees <= 10) {
s0.s.rupee5 += 1;
droptable.s.rupee5 += 1;
}
ptr2 = &gDroptableModifierNone;
r0 = gSave.stats.hasAllFigurines;
@ -279,20 +279,20 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
// vector addition, s0 = s0 + ptr2 + ptr3
// resulting values are clamped to be >= 0
// returns sum over s0
r4 = sub_08000F2C(s0.a, s0.a, ptr2->a, ptr3->a);
r2 = Random();
r5 = (r2 >> 0x18);
r5 &= 0xF;
r2 = r2 % r4;
summOdds = sub_08000F2C(droptable.a, droptable.a, ptr2->a, ptr3->a);
rand = Random();
item = (rand >> 0x18);
item &= 0xF;
rand = rand % summOdds;
{
u32 r3;
for (r3 = 0, r1 = 0; r3 < 0x10; r3++, r5 = (r5 + 1) & 0xF) {
if ((r1 += s0.a[r5]) > r2) {
for (r3 = 0, r1 = 0; r3 < 0x10; r3++, item = (item + 1) & 0xF) {
if ((r1 += droptable.a[item]) > rand) {
break;
}
}
}
r1 = gUnk_080FE1B4[r5];
r1 = gUnk_080FE1B4[item];
if (r1 != ITEM_NONE) {
return CreateItemDrop(arg0, r1, 0);
}

View File

@ -2,7 +2,7 @@
#include "droptables.h"
const Droptable gDroptablesEnemies[] = {
{ {
[0]={ {
.none = -999,
.rupee1 = -999,
.rupee5 = -999,
@ -20,7 +20,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[1]={ {
.none = 300,
.rupee1 = -999,
.rupee5 = -999,
@ -38,7 +38,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[2]={ {
.none = -999,
.rupee1 = -999,
.rupee5 = -999,
@ -56,7 +56,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[3]={ {
.none = 36,
.rupee1 = 28,
.rupee5 = 20,
@ -74,7 +74,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[4]={ {
.none = 74,
.rupee1 = 10,
.rupee5 = 5,
@ -92,7 +92,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[5]={ {
.none = 100,
.rupee1 = 0,
.rupee5 = 0,
@ -110,10 +110,7 @@ const Droptable gDroptablesEnemies[] = {
.none4 = 0,
.none5 = 0,
} },
};
// not 100% sure
const Droptable gUnk_0800143C[] = {
{ {
[6]={ {
.none = 73,
.rupee1 = 25,
.rupee5 = -999,
@ -131,7 +128,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[7]={ {
.none = 55,
.rupee1 = -999,
.rupee5 = 70,
@ -149,7 +146,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[8]={ {
.none = 50,
.rupee1 = -999,
.rupee5 = 26,
@ -167,7 +164,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[9]={ {
.none = 45,
.rupee1 = -999,
.rupee5 = -999,
@ -185,7 +182,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[10]={ {
.none = 300,
.rupee1 = -999,
.rupee5 = -999,
@ -203,7 +200,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[11]={ {
.none = 60,
.rupee1 = 10,
.rupee5 = -999,
@ -221,7 +218,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[12]={ {
.none = 70,
.rupee1 = 0,
.rupee5 = -999,
@ -239,7 +236,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[13]={ {
.none = 63,
.rupee1 = 10,
.rupee5 = 20,
@ -257,7 +254,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[14]={ {
.none = 50,
.rupee1 = 10,
.rupee5 = 20,
@ -275,7 +272,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[15]={ {
.none = 0,
.rupee1 = 0,
.rupee5 = 0,
@ -293,7 +290,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[16]={ {
.none = 0,
.rupee1 = 0,
.rupee5 = 0,
@ -311,7 +308,7 @@ const Droptable gUnk_0800143C[] = {
.none4 = 0,
.none5 = 0,
} },
{ {
[17]={ {
.none = 0,
.rupee1 = 40,
.rupee5 = 24,
@ -330,7 +327,7 @@ const Droptable gUnk_0800143C[] = {
.none5 = 0,
} },
};
// not 100% sure
const Droptable gDroptablesAreas[] = {
[0] = { {
.none = 920,

View File

@ -113,7 +113,7 @@ void sub_08081790(DeathFxObject* this) {
DeathFx_DropRandom9, DeathFx_DropRandom9, DeathFx_DropRandom9, DeathFx_DropRandom9,
DeathFx_DropRandom9, DeathFx_DropRandom9, DeathFx_DropRandom9, DeathFx_DropFixedItem,
};
static const u8 gUnk_0811EC64[] = {
static const u8 DeathFx_EnemyDroptables[] = {
[OCTOROK] = 6,
[CHUCHU] = 6,
[LEEVER] = 6,
@ -228,7 +228,7 @@ void sub_08081790(DeathFxObject* this) {
6,
};
if (this->parentId < 0xf0) {
CreateRandomItemDrop(super, gUnk_0811EC64[this->parentId]);
CreateRandomItemDrop(super, DeathFx_EnemyDroptables[this->parentId]);
} else {
DeathFx_DropFunctions[this->parentId - 0xf0](this);
}