test synced pole
Build libsm64 / Build libsm64 for linux (push) Successful in 33s
Build libsm64 / Build libsm64 for web (push) Successful in 33s
Build libsm64 / Build libsm64 for windows (push) Successful in 25s

This commit is contained in:
2026-06-01 14:54:23 -05:00
parent 40bee0f224
commit 42132a5646
7 changed files with 123 additions and 50 deletions
+47
View File
@@ -14,6 +14,53 @@
#include "libsm64.h"
#include <stdint.h>
#include <stdbool.h>
#include "decomp/shim.h"
#define o gCurrentObject
struct Object *cur_obj_find_nearest_pole(void)
{
struct Object *closestObj = NULL;
struct Object *obj;
f32 minDist = 0x20000;
for (s32 i = 0; i < s_fakeobj_instance_pool.size; i++)
{
obj = s_fakeobj_instance_pool.objects[i];
if (obj == NULL)
continue;
if (obj->activeFlags == ACTIVE_FLAG_DEACTIVATED)
continue;
if (!(obj->oInteractType & INTERACT_POLE))
continue;
if (obj == o)
continue;
f32 objDist = dist_between_objects(o, obj);
if (objDist < minDist)
{
closestObj = obj;
minDist = objDist;
}
}
return closestObj;
}
f32 dist_between_objects(struct Object *obj1, struct Object *obj2)
{
if (obj1 == NULL || obj2 == NULL) { return 0; }
f32 dx = obj1->oPosX - obj2->oPosX;
f32 dy = obj1->oPosY - obj2->oPosY;
f32 dz = obj1->oPosZ - obj2->oPosZ;
return sqrtf(dx * dx + dy * dy + dz * dz);
}
void fake_object_init(struct FakeObject *fake, float x, float y, float z)
{