diff --git a/venom.cpp b/venom.cpp index 2506bb2..ce064d4 100644 --- a/venom.cpp +++ b/venom.cpp @@ -11,6 +11,33 @@ extern u8 gObjFileRegion; extern CBody* EnvironmentalObjectList; +// @Ok +INLINE i32* CVenom::GetNewCommandBlock(u32 a1) +{ + i32* res = static_cast(DCMem_New(4 * a1, 0, 1, 0, 1)); + res[a1 - 1] = 0; + + if (!this->field_35C) + { + this->field_35C = res; + } + else + { + i32* it = this->field_35C; + while (1) + { + if (!it[it[1] - 1]) + break; + + it = reinterpret_cast(it[it[1] - 1]); + } + + it[it[1] - 1] = reinterpret_cast(res); + } + + return res; +} + // @MEDIUMTODO CVenom::CVenom(int*, int) { diff --git a/venom.h b/venom.h index 214f8c0..6d1126c 100644 --- a/venom.h +++ b/venom.h @@ -14,8 +14,11 @@ public: EXPORT CVenom(i32*, i32); EXPORT void Shouldnt_DoPhysics_Be_Virtual(void); EXPORT void DoPhysics(void); + EXPORT i32* KillCommandBlock(i32*); EXPORT void KillAllCommandBlocks(void); + EXPORT i32* GetNewCommandBlock(u32); + EXPORT u8 TugImpulse(CVector *, CVector *, CVector *); EXPORT void PlayNextFootstepSFX(void); EXPORT void GetTargetPosFromNode(CVector *, i32);