Commit c22bf0e2 authored by NY00123's avatar NY00123 Committed by Richard Gobeille
Browse files

Engine: Split krand definitions from build.h to a new header, random.h

parent 25afea98
......@@ -468,6 +468,7 @@
<ClInclude Include="..\..\source\build\include\pragmas_x86_msvc.h" />
<ClInclude Include="..\..\source\build\include\print.h" />
<ClInclude Include="..\..\source\build\include\prlights.h" />
<ClInclude Include="..\..\source\build\include\random.h" />
<ClInclude Include="..\..\source\build\include\rawinput.h" />
<ClInclude Include="..\..\source\build\include\renderlayer.h" />
<ClInclude Include="..\..\source\build\include\rev.h" />
......@@ -529,4 +530,4 @@ echo )shader^"; &gt;&gt; $(IntermediateOutputPath)%(Filename)%(Extension).cpp</C
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -346,6 +346,9 @@
<ClInclude Include="..\..\source\build\include\prlights.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\build\include\random.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\source\build\include\rawinput.h">
<Filter>Header Files</Filter>
</ClInclude>
......@@ -468,4 +471,4 @@
<Filter>Source Files</Filter>
</MASM>
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -25,6 +25,7 @@
#include "glbuild.h"
#include "palette.h"
#include "pragmas.h"
#include "random.h"
#include "vfs.h"
#include "cache1d.h"
......@@ -809,7 +810,7 @@ EXTERN int32_t display_mirror;
EXTERN ClockTicks totalclock, totalclocklock;
static inline int32_t BGetTime(void) { return (int32_t) totalclock; }
EXTERN int32_t rotatespritesmoothratio;
EXTERN int32_t numframes, randomseed;
EXTERN int32_t numframes;
EXTERN int16_t sintable[2048];
EXTERN uint8_t palette[768];
......@@ -1319,22 +1320,6 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum);
void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3)));
#if !KRANDDEBUG
static FORCE_INLINE int32_t krand(void)
{
randomseed = (randomseed * 1664525ul) + 221297ul;
return ((uint32_t) randomseed)>>16;
}
#else
int32_t krand(void);
#endif
static FORCE_INLINE int32_t seed_krand(int32_t* seed)
{
*seed = (*seed * 1664525ul) + 221297ul;
return ((uint32_t)*seed) >> 16;
}
int32_t __fastcall ksqrtasm_old(uint32_t n);
int32_t __fastcall ksqrt(uint32_t num);
int32_t __fastcall getangle(int32_t xvect, int32_t yvect);
......
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info.
//
// This file has been modified from Ken Silverman's original release.
/* Routines for generation of pseudo-random integer sequences. */
#pragma once
#ifndef random_h
#define random_h
#include "compat.h"
#ifdef engine_c_
int32_t randomseed;
#else
extern int32_t randomseed;
#endif
#if !KRANDDEBUG
static FORCE_INLINE int32_t krand(void)
{
randomseed = (randomseed * 1664525ul) + 221297ul;
return ((uint32_t) randomseed)>>16;
}
#else
int32_t krand(void);
#endif
static FORCE_INLINE int32_t seed_krand(int32_t* seed)
{
*seed = (*seed * 1664525ul) + 221297ul;
return ((uint32_t)*seed) >> 16;
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment