#include "game_types.h"

/* Float_FromInt @ 0x0801A074 (real 48B) -- dispatches an int id through the bounce/object tables. Mirrors src/matched/Float_FromInt.c. */
/* Resolves an id through BounceReflect/Object_Find; unless the slot is 20,
   stamps -1 into table[idx*8], then runs SVC 0xAB service 2 on the slot. */
extern int Physics_BounceReflect(void);
extern int Object_Find(void);
extern int SWI_AB(int service, void *slot); /* swi #0xab */

int Float_FromInt(void)
{
    int idx;
    int *tab = (int *)0x02001518;
    Physics_BounceReflect();
    idx = Object_Find();
    if (idx != 20)
        tab[idx * 2] = -1;
    return SWI_AB(2, &tab[0]);
}
