mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-17 21:03:21 -04:00
95 lines
1.6 KiB
C
95 lines
1.6 KiB
C
#include <ultra64.h>
|
|
#include "lib/sched.h"
|
|
#include "constants.h"
|
|
#include "game/camera.h"
|
|
#include "game/dlights.h"
|
|
#include "game/env.h"
|
|
#include "game/game_0b2150.h"
|
|
#include "game/tex.h"
|
|
#include "game/sky.h"
|
|
#include "game/game_13c510.h"
|
|
#include "game/bg.h"
|
|
#include "game/stagetable.h"
|
|
#include "game/room.h"
|
|
#include "bss.h"
|
|
#include "lib/vi.h"
|
|
#include "lib/mtx.h"
|
|
#include "data.h"
|
|
#include "types.h"
|
|
|
|
u8 *var800a41a0;
|
|
u32 var800a41a4;
|
|
u32 var800a41a8;
|
|
u32 var800a41ac;
|
|
|
|
u16 func0f13c574(f32 arg0)
|
|
{
|
|
u32 value = arg0 * 8.0f;
|
|
u32 left;
|
|
u32 right = value;
|
|
|
|
if (value > 0x3f800) {
|
|
right = value & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 7;
|
|
} else if (value > 0x3f000) {
|
|
right = value & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 6;
|
|
} else if (value > 0x3e000) {
|
|
right = (value >> 1) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 5;
|
|
} else if (value > 0x3c000) {
|
|
right = (value >> 2) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 4;
|
|
} else if (value > 0x38000) {
|
|
right = (value >> 3) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 3;
|
|
} else if (value > 0x30000) {
|
|
right = (value >> 4) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 2;
|
|
} else if (value > 0x20000) {
|
|
right = (value >> 5) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 1;
|
|
} else {
|
|
right = (value >> 6) & 0x7ff;
|
|
right &= 0x7ff;
|
|
left = 0;
|
|
}
|
|
|
|
return left << 13 | (right << 2);
|
|
}
|
|
|
|
s32 func0f13c710(f32 arg0)
|
|
{
|
|
if (arg0 > 0.0f) {
|
|
if (arg0 > 2147483520.0f) {
|
|
arg0 = 2147483520;
|
|
}
|
|
} else {
|
|
if (arg0 < -2147483520) {
|
|
arg0 = -2147483520;
|
|
}
|
|
}
|
|
|
|
return arg0;
|
|
}
|
|
|
|
u8 func0f13d3c4(u8 arg0, u8 arg1)
|
|
{
|
|
if (arg1 >= arg0 + 7) {
|
|
return arg0 + 7;
|
|
}
|
|
|
|
if (arg1 <= arg0 - 7) {
|
|
return arg0 - 7;
|
|
}
|
|
|
|
return arg1;
|
|
}
|