Files
perfect-dark/src/lib/ailist.c
T
Ryan Dwyer d82a6ba619 Rename a bunch of lib files and functions
* lib_070d0.c to vm.c
* lib_09a80.c to vi.c
* lib_0bfb0.c to fault.c
* lib_0c000.c to crash.c
* lib_11420.c to music.c
* lib_13710.c to pimgr.c
* lib_184d0.c to ailist.c and path.c
* lib_233c0.c to anim.c
* lib_24e40.c to collision.c
* lib_2fa00.c to rmon.c
* lib_34030.c to speaker.c
* lib_37b00.c to mp3.c
2021-10-11 22:46:29 +10:00

59 lines
1005 B
C

#include <ultra64.h>
#include "constants.h"
#include "bss.h"
#include "lib/ailist.h"
#include "data.h"
#include "types.h"
s32 g_NumGlobalAilists = 0;
s32 g_NumLvAilists = 0;
u8 *ailistFindById(s32 ailistid)
{
s32 lower;
s32 upper;
s32 index;
if (ailistid >= 0x401) {
if (g_StageSetup.ailists) {
lower = 0;
upper = g_NumLvAilists;
index;
while (upper >= lower) {
index = (lower + upper) / 2;
if (g_StageSetup.ailists[index].id == ailistid) {
return g_StageSetup.ailists[index].list;
}
if (ailistid < g_StageSetup.ailists[index].id) {
upper = index - 1;
} else {
lower = index + 1;
}
}
}
} else {
lower = 0;
upper = g_NumGlobalAilists;
index;
while (upper >= lower) {
index = (lower + upper) / 2;
if (g_GlobalAilists[index].id == ailistid) {
return g_GlobalAilists[index].list;
}
if (ailistid < g_GlobalAilists[index].id) {
upper = index - 1;
} else {
lower = index + 1;
}
}
}
return NULL;
}