mirror of
https://github.com/CTR-tools/CTR-ModSDK.git
synced 2024-11-27 07:20:46 +00:00
minepool add and remove
This commit is contained in:
parent
b21d1438c0
commit
3d49d7dc7c
@ -0,0 +1,27 @@
|
||||
#include <common.h>
|
||||
|
||||
void DECOMP_RB_MinePool_Add(struct MineWeapon* mw)
|
||||
{
|
||||
struct WeaponSlot231* ws;
|
||||
|
||||
// if no more items on free list
|
||||
// (800b2ea8 + 8 = 800b2eb0)
|
||||
if (*(int*)0x800b2ea8 == 0)
|
||||
{
|
||||
// remove oldest mine
|
||||
|
||||
// RB_MinePool_Remove
|
||||
// (800b2e9c + 4 = 800b2ea0) (taken->last)
|
||||
// (*(int*)800b2ea0 + 8) (taken->last->mineWeapon)
|
||||
RB_MinePool_Remove(*(int*)(*(int*)0x800b2ea0 + 8)
|
||||
}
|
||||
|
||||
// LIST_RemoveBack free list, AddFront to taken list
|
||||
ws = LIST_RemoveBack(0x800b2ea8);
|
||||
LIST_AddFront(0x800b2e9c, ws);
|
||||
|
||||
// link together
|
||||
ws->mineWeapon = mw;
|
||||
mw->weaponSlot231 = ws;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
#include <common.h>
|
||||
|
||||
void DECOMP_RB_MinePool_Remove(struct MineWeapon* mw)
|
||||
{
|
||||
struct WeaponSlot231* ws = mw->weaponSlot231;
|
||||
|
||||
// useless check?
|
||||
if(ws == 0) return;
|
||||
|
||||
// remove from taken, add to free
|
||||
LIST_RemoveMember(0x800b2e9c, ws);
|
||||
LIST_AddFront(0x800b2ea8, ws);
|
||||
|
||||
mw->boolDestroyed = 1;
|
||||
mw->weaponSlot231 = 0;
|
||||
}
|
@ -461,6 +461,8 @@ void FUN_800ac13c(int param_1)
|
||||
// remove oldest mine
|
||||
|
||||
// RB_MinePool_Remove
|
||||
// (800b2e9c + 4 = 800b2ea0) (taken->last)
|
||||
// (*(int*)800b2ea0 + 8) (taken->last->mineWeapon)
|
||||
FUN_800ac0e4(*(undefined4 *)(DAT_800b2ea0 + 8));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user