mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-06-30 10:41:34 -04:00
Create functionally equivalent C for handwritten RNG2 functions
This commit is contained in:
@@ -168,7 +168,7 @@
|
||||
build/ROMID/game/sky.o (section); \
|
||||
build/ROMID/game/playermgr.o (section); \
|
||||
build/ROMID/game/crc.o (section); \
|
||||
build/ROMID/game/rng2.o (section); \
|
||||
build/ROMID/game/rng2asm.o (section); \
|
||||
build/ROMID/game/vtxstore.o (section); \
|
||||
build/ROMID/game/explosions.o (section); \
|
||||
build/ROMID/game/smoke.o (section); \
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
build/ROMID/game/sky.o (section); \
|
||||
build/ROMID/game/playermgr.o (section); \
|
||||
build/ROMID/game/crc.o (section); \
|
||||
build/ROMID/game/rng2.o (section); \
|
||||
build/ROMID/game/rng2asm.o (section); \
|
||||
build/ROMID/game/vtxstore.o (section); \
|
||||
build/ROMID/game/explosions.o (section); \
|
||||
build/ROMID/game/smoke.o (section); \
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
build/ROMID/game/sky.o (section); \
|
||||
build/ROMID/game/playermgr.o (section); \
|
||||
build/ROMID/game/crc.o (section); \
|
||||
build/ROMID/game/rng2.o (section); \
|
||||
build/ROMID/game/rng2asm.o (section); \
|
||||
build/ROMID/game/vtxstore.o (section); \
|
||||
build/ROMID/game/explosions.o (section); \
|
||||
build/ROMID/game/smoke.o (section); \
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
build/ROMID/game/sky.o (section); \
|
||||
build/ROMID/game/playermgr.o (section); \
|
||||
build/ROMID/game/crc.o (section); \
|
||||
build/ROMID/game/rng2.o (section); \
|
||||
build/ROMID/game/rng2asm.o (section); \
|
||||
build/ROMID/game/vtxstore.o (section); \
|
||||
build/ROMID/game/explosions.o (section); \
|
||||
build/ROMID/game/smoke.o (section); \
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
build/ROMID/game/sky.o (section); \
|
||||
build/ROMID/game/playermgr.o (section); \
|
||||
build/ROMID/game/crc.o (section); \
|
||||
build/ROMID/game/rng2.o (section); \
|
||||
build/ROMID/game/rng2asm.o (section); \
|
||||
build/ROMID/game/vtxstore.o (section); \
|
||||
build/ROMID/game/explosions.o (section); \
|
||||
build/ROMID/game/smoke.o (section); \
|
||||
|
||||
+3
-1
@@ -20,7 +20,7 @@
|
||||
#include "game/player.h"
|
||||
#include "game/game_0c33f0.h"
|
||||
#include "game/playermgr.h"
|
||||
#include "game/game_1291b0.h"
|
||||
#include "game/rng2.h"
|
||||
#include "game/vtxstore.h"
|
||||
#include "game/gfxmemory.h"
|
||||
#include "game/explosions.h"
|
||||
@@ -48,6 +48,8 @@
|
||||
#include "gbiex.h"
|
||||
#include "types.h"
|
||||
|
||||
void rng2SetSeed(u32 seed);
|
||||
|
||||
void *var8009ccc0[20];
|
||||
s32 g_NumChrs;
|
||||
s16 *g_Chrnums;
|
||||
|
||||
+3
-1
@@ -33,7 +33,7 @@
|
||||
#include "game/menu.h"
|
||||
#include "game/inv.h"
|
||||
#include "game/playermgr.h"
|
||||
#include "game/game_1291b0.h"
|
||||
#include "game/rng2.h"
|
||||
#include "game/vtxstore.h"
|
||||
#include "game/explosions.h"
|
||||
#include "game/smoke.h"
|
||||
@@ -78,6 +78,8 @@
|
||||
#include "types.h"
|
||||
#include "string.h"
|
||||
|
||||
void rng2SetSeed(u32 seed);
|
||||
|
||||
struct weaponobj *g_Proxies[30];
|
||||
f32 g_GasReleaseTimerMax240;
|
||||
bool g_GasEnableDamage;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "game/player.h"
|
||||
#include "game/game_0c33f0.h"
|
||||
#include "game/playermgr.h"
|
||||
#include "game/game_1291b0.h"
|
||||
#include "game/vtxstore.h"
|
||||
#include "game/gfxmemory.h"
|
||||
#include "game/explosions.h"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/rng.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
u64 g_Rng2Seed = 0xab8d9f7781280783;
|
||||
|
||||
/**
|
||||
* Generate a random number between 0 and 4294967295.
|
||||
*/
|
||||
u32 random2(void)
|
||||
{
|
||||
g_Rng2Seed = ((g_Rng2Seed << 63) >> 31 | (g_Rng2Seed << 31) >> 32) ^ (g_Rng2Seed << 44) >> 32;
|
||||
g_Rng2Seed = ((g_Rng2Seed >> 20) & 0xfff) ^ g_Rng2Seed;
|
||||
|
||||
return g_Rng2Seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the given seed as the RNG seed. Add 1 to make sure it isn't 0.
|
||||
*/
|
||||
void rng2SetSeed(u64 seed)
|
||||
{
|
||||
g_Rng2Seed = seed + 1;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ glabel g_Rng2Seed
|
||||
.text
|
||||
|
||||
/**
|
||||
* u32 random(void)
|
||||
* u32 random2(void)
|
||||
*
|
||||
* Generate a random number between 0 and 4294967295.
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ glabel random2
|
||||
dsra32 $v0, $v0, 0
|
||||
|
||||
/**
|
||||
* void rngSetSeed(u32 seed)
|
||||
* void rng2SetSeed(u64 seed)
|
||||
*
|
||||
* Set the given seed as the RNG seed. Add 1 to make sure it isn't 0.
|
||||
*/
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef IN_GAME_GAME_1291B0_H
|
||||
#define IN_GAME_GAME_1291B0_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
u32 random2(void);
|
||||
void rng2SetSeed(u32 seed);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef IN_GAME_RNG2_H
|
||||
#define IN_GAME_RNG2_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
u32 random2(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user