Made sin/cos tables const.

Made the sin/cos/arcsin/arccos tables const and removed the redundant
externs that were scattered about.
This commit is contained in:
Steven Fuller 2008-04-27 01:45:21 -07:00 committed by Patryk Obara
parent d5830bb440
commit c3cc5eb878
27 changed files with 13 additions and 86 deletions

View file

@ -92,8 +92,6 @@ int AlienBiteAttackInProgress;
/* phase for cloaked objects */ /* phase for cloaked objects */
int CloakingPhase; int CloakingPhase;
extern int NormalFrameTime; extern int NormalFrameTime;
extern int cosine[];
extern int sine[];
int LeanScale; int LeanScale;
EULER deathTargetOrientation={0,0,0}; EULER deathTargetOrientation={0,0,0};

View file

@ -891,8 +891,6 @@ int NPCSetVelocity(STRATEGYBLOCK *sbPtr, VECTORCH* targetDirn, int in_speed)
-----------------------------------------------------------------------*/ -----------------------------------------------------------------------*/
int NPCOrientateToVector(STRATEGYBLOCK *sbPtr, VECTORCH *zAxisVector,int turnspeed, VECTORCH *offset) int NPCOrientateToVector(STRATEGYBLOCK *sbPtr, VECTORCH *zAxisVector,int turnspeed, VECTORCH *offset)
{ {
extern int cosine[], sine[];
int maxTurnThisFrame; int maxTurnThisFrame;
int turnThisFrame; int turnThisFrame;
VECTORCH localZAxisVector; VECTORCH localZAxisVector;

View file

@ -1065,8 +1065,6 @@ AIMODULE *FarNPC_GetTargetAIModuleForHunt(STRATEGYBLOCK *sbPtr, int alien)
/* Patrick 2/7/96: this function returns a module for wandering to */ /* Patrick 2/7/96: this function returns a module for wandering to */
AIMODULE *FarNPC_GetTargetAIModuleForWander(STRATEGYBLOCK *sbPtr, AIMODULE *exception, int alien) AIMODULE *FarNPC_GetTargetAIModuleForWander(STRATEGYBLOCK *sbPtr, AIMODULE *exception, int alien)
{ {
extern int cosine[], sine[];
AIMODULE **AdjModuleRefPtr; AIMODULE **AdjModuleRefPtr;
DYNAMICSBLOCK *dynPtr; DYNAMICSBLOCK *dynPtr;
AIMODULE* targetModule = (AIMODULE *)0; AIMODULE* targetModule = (AIMODULE *)0;

View file

@ -33,7 +33,6 @@
extern int ModuleArraySize; extern int ModuleArraySize;
extern char *ModuleCurrVisArray; extern char *ModuleCurrVisArray;
extern int NormalFrameTime; extern int NormalFrameTime;
extern int cosine[], sine[];
extern ACTIVESOUNDSAMPLE ActiveSounds[]; extern ACTIVESOUNDSAMPLE ActiveSounds[];

View file

@ -32,7 +32,6 @@
#include "particle.h" #include "particle.h"
#include "scream.h" #include "scream.h"
extern int cosine[], sine[];
extern int NormalFrameTime; extern int NormalFrameTime;
extern int ShowHiveState; extern int ShowHiveState;
extern ACTIVESOUNDSAMPLE ActiveSounds[]; extern ACTIVESOUNDSAMPLE ActiveSounds[];

View file

@ -619,7 +619,6 @@ void AddDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *positionPtr,
DECAL *decalPtr; DECAL *decalPtr;
MATRIXCH orientation; MATRIXCH orientation;
int decalSize; int decalSize;
extern int sine[],cosine[];
int theta = FastRandom()&4095; int theta = FastRandom()&4095;
int sin = GetSin(theta); int sin = GetSin(theta);
int cos = GetCos(theta); int cos = GetCos(theta);
@ -958,7 +957,6 @@ void AddDecalToHModel(VECTORCH *normalPtr, VECTORCH *positionPtr, SECTION_DATA *
VECTORCH v; VECTORCH v;
int decalSize; int decalSize;
extern int sine[],cosine[];
int theta,sin,cos; int theta,sin,cos;
if (!LocalDetailLevels.DrawHierarchicalDecals) return; if (!LocalDetailLevels.DrawHierarchicalDecals) return;

View file

@ -59,8 +59,6 @@ void Budge_HModel(HMODELCONTROLLER *controller,VECTORCH *offset);
/* external globals */ /* external globals */
extern int NormalFrameTime; extern int NormalFrameTime;
extern int sine[];
extern int cosine[];
extern int GlobalFrameCounter; extern int GlobalFrameCounter;
extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr; extern VIEWDESCRIPTORBLOCK *Global_VDB_Ptr;

View file

@ -66,8 +66,6 @@ extern int ScanDrawMode;
extern DISPLAYBLOCK* Player; extern DISPLAYBLOCK* Player;
extern int sine[], cosine[]; /* these externs should be with the GetCos GetSin macros!! */
extern int NumActiveBlocks; extern int NumActiveBlocks;
extern DISPLAYBLOCK *ActiveBlockList[]; extern DISPLAYBLOCK *ActiveBlockList[];
extern int NumOnScreenBlocks; extern int NumOnScreenBlocks;
@ -1947,7 +1945,6 @@ void DrawWristDisplay(void)
} }
void RotateVertex(VECTOR2D *vertexPtr, int theta) void RotateVertex(VECTOR2D *vertexPtr, int theta)
{ {
extern int sine[],cosine[];
int vx,vy; int vx,vy;
int sin = GetSin(theta); int sin = GetSin(theta);
int cos = GetCos(theta); int cos = GetCos(theta);

View file

@ -35,7 +35,6 @@ extern void PaintBallMode_DrawCurrentDecalAtTarget(void)
extern DECAL_DESC DecalDescription[]; extern DECAL_DESC DecalDescription[];
DECAL_DESC *decalDescPtr = &DecalDescription[PaintBallMode.CurrentDecalID]; DECAL_DESC *decalDescPtr = &DecalDescription[PaintBallMode.CurrentDecalID];
extern void MakeMatrixFromDirection(VECTORCH *directionPtr, MATRIXCH *matrixPtr); extern void MakeMatrixFromDirection(VECTORCH *directionPtr, MATRIXCH *matrixPtr);
extern int sine[],cosine[];
extern MODULE *playerPherModule; extern MODULE *playerPherModule;
MATRIXCH orientation; MATRIXCH orientation;

View file

@ -3799,7 +3799,6 @@ void HandleRipples(void)
int EffectOfRipples(VECTORCH *point) int EffectOfRipples(VECTORCH *point)
{ {
extern int sine[];
int offset; int offset;
int i; int i;
offset = GetSin((point->vx+point->vz+CloakingPhase)&4095)>>11; offset = GetSin((point->vx+point->vz+CloakingPhase)&4095)>>11;

View file

@ -93,7 +93,6 @@ int executeDemo;
/* Global Externs */ /* Global Externs */
extern DISPLAYBLOCK* Player; extern DISPLAYBLOCK* Player;
extern int NormalFrameTime; extern int NormalFrameTime;
extern int cosine[], sine[];
extern int predHUDSoundHandle; extern int predHUDSoundHandle;
extern int predOVision_SoundHandle; extern int predOVision_SoundHandle;
extern int TauntSoundPlayed; extern int TauntSoundPlayed;

View file

@ -38,10 +38,6 @@ static STRATEGYBLOCK **ActiveStBlockListPtr = &ActiveStBlockList[0];
unsigned int IncrementalSBname; unsigned int IncrementalSBname;
/**** improted globals ************/
extern int cosine[], sine[];
/* /*
Support functions for Strategy Blocks Support functions for Strategy Blocks

View file

@ -22,13 +22,9 @@ static void LnQuat(QUAT *q);
static void ExpPurelyImaginaryQuat(QUAT *q); static void ExpPurelyImaginaryQuat(QUAT *q);
extern void MulQuat(QUAT *q1, QUAT *q2, QUAT *output); extern void MulQuat(QUAT *q1, QUAT *q2, QUAT *output);
extern int NormalFrameTime; extern int NormalFrameTime;
extern void QNormalise(QUAT*); extern void QNormalise(QUAT*);
extern int QDot(QUAT *, QUAT *); extern int QDot(QUAT *, QUAT *);
extern int sine[];
extern int cosine[];
static void TrackSlerp(TRACK_SECTION_DATA* tsd,int lerp,MATRIXCH* output_mat) static void TrackSlerp(TRACK_SECTION_DATA* tsd,int lerp,MATRIXCH* output_mat)
{ {

View file

@ -3011,7 +3011,6 @@ void PositionPlayersWeaponMuzzleFlash(void)
/* rotate flash around in random multiples of 60 degrees */ /* rotate flash around in random multiples of 60 degrees */
{ {
MATRIXCH mat; MATRIXCH mat;
extern int cosine[], sine[];
int angle = (FastRandom()%6)*683; int angle = (FastRandom()%6)*683;
int cos = GetCos(angle); int cos = GetCos(angle);
int sin = GetSin(angle); int sin = GetSin(angle);

View file

@ -70,7 +70,6 @@ extern void YClipMotionTrackerVertices(struct VertexTag *v1, struct VertexTag *v
extern void XClipMotionTrackerVertices(struct VertexTag *v1, struct VertexTag *v2); extern void XClipMotionTrackerVertices(struct VertexTag *v1, struct VertexTag *v2);
/* HUD globals */ /* HUD globals */
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
extern int sine[],cosine[];
extern enum HUD_RES_ID HUDResolution; extern enum HUD_RES_ID HUDResolution;

View file

@ -44,7 +44,6 @@ extern "C++"
extern int ScanDrawMode; extern int ScanDrawMode;
extern int ZBufferMode; extern int ZBufferMode;
extern int sine[],cosine[];
extern IMAGEHEADER ImageHeaderArray[]; extern IMAGEHEADER ImageHeaderArray[];
int BackdropImage; int BackdropImage;
//#define UseLocalAssert Yes //#define UseLocalAssert Yes

View file

@ -61,7 +61,6 @@
extern "C" { extern "C" {
#include "3dc.h" #include "3dc.h"
extern int cosine[];
extern MAPSETVDB chnk_playcam_vdb; extern MAPSETVDB chnk_playcam_vdb;
extern int GlobalAmbience; extern int GlobalAmbience;
extern VIEWDESCRIPTORBLOCK *ActiveVDBList[]; extern VIEWDESCRIPTORBLOCK *ActiveVDBList[];

View file

@ -40,7 +40,6 @@
----------------------------------------------------------------------*/ ----------------------------------------------------------------------*/
extern int NormalFrameTime; extern int NormalFrameTime;
extern int GlobalFrameCounter; extern int GlobalFrameCounter;
extern int cosine[], sine[];
extern ACTIVESOUNDSAMPLE ActiveSounds[]; extern ACTIVESOUNDSAMPLE ActiveSounds[];
extern DEATH_DATA Alien_Deaths[]; extern DEATH_DATA Alien_Deaths[];
extern HITLOCATIONTABLE *GetThisHitLocationTable(char *id); extern HITLOCATIONTABLE *GetThisHitLocationTable(char *id);

View file

@ -59,9 +59,8 @@ extern int ScanDrawMode;
extern int ZBufferMode; extern int ZBufferMode;
extern unsigned char *PaletteRemapTable; extern unsigned char *PaletteRemapTable;
extern unsigned char **PaletteShadingTableArray; extern unsigned char **PaletteShadingTableArray;
extern int cosine[];
extern int HWAccel; extern int HWAccel;
#define remap_table_size (1 << (remap_table_rgb_bits * 3))
extern VECTORCH PlayerStartLocation; extern VECTORCH PlayerStartLocation;
extern MATRIXCH PlayerStartMat; extern MATRIXCH PlayerStartMat;

View file

@ -29,13 +29,8 @@
*/ */
extern const int sine[4096];
extern const int cosine[4096];
/* Grrr!! That's the last time these will be missing! */
/* Oh, CDF 18/12/97 */
extern int sine[];
extern int cosine[];
typedef struct vectorch { typedef struct vectorch {

View file

@ -133,14 +133,6 @@ void FindZFromXYIntersection(VECTORCH *startPtr, VECTORCH *directionPtr, VECTORC
void AddToTranslucentPolyList(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr); void AddToTranslucentPolyList(POLYHEADER *inputPolyPtr,RENDERVERTEX *renderVerticesPtr);
void DrawWaterFallPoly(VECTORCH *v); void DrawWaterFallPoly(VECTORCH *v);
#if platform_pc
extern int sine[];
extern int cosine[];
#endif
//extern int ItemCount;
/*KJL************************************************************************************ /*KJL************************************************************************************
* N.B. All the following global variables have their first elements initialised so that * * N.B. All the following global variables have their first elements initialised so that *

View file

@ -10,12 +10,12 @@
*/ */
extern int sine[]; extern const int sine[4096];
extern int cosine[]; extern const int cosine[4096];
extern short ArcCosTable[]; extern const short ArcCosTable[4096];
extern short ArcSineTable[]; extern const short ArcSineTable[4096];
extern short ArcTanTable[]; extern const short ArcTanTable[256];
extern LONGLONGCH ll_zero; extern LONGLONGCH ll_zero;

View file

@ -2536,8 +2536,6 @@ void BltImage(RECT *dest, DDSurface *image, RECT *src)
/* Hacked in special effects */ /* Hacked in special effects */
extern int sine[];
extern int cosine[];
extern int NormalFrameTime; extern int NormalFrameTime;
void UpdateForceField(void); void UpdateForceField(void);

View file

@ -10,13 +10,9 @@
*/ */
#if PSX
int sine[]={};
int cosine[]={};
#else
int oneoversin[4096]; int oneoversin[4096];
int sine[]={ const int sine[4096]={
0, 0,
100, 100,
@ -4117,7 +4113,7 @@ int sine[]={
}; };
int cosine[]={ const int cosine[4096]={
65536, 65536,
65535, 65535,
@ -8218,9 +8214,7 @@ int cosine[]={
}; };
#endif const short ArcCosTable[4096]={
short ArcCosTable[]={
2047, 2047,
2027, 2027,
@ -12321,7 +12315,7 @@ short ArcCosTable[]={
}; };
short ArcSineTable[]={ const short ArcSineTable[4096]={
-1023, -1023,
-1004, -1004,
@ -16422,7 +16416,7 @@ short ArcSineTable[]={
}; };
short ArcTanTable[]={ const short ArcTanTable[256]={
0,2,5,7,10,12,15,17, 0,2,5,7,10,12,15,17,
20,22,25,27,30,33,35,38, 20,22,25,27,30,33,35,38,

View file

@ -10,11 +10,6 @@
*/ */
#if platform_pc
extern int sine[];
extern int cosine[];
#endif
#if SupportWindows95 #if SupportWindows95
extern int ScanDrawMode; extern int ScanDrawMode;
#endif #endif

View file

@ -61,9 +61,6 @@
extern SHAPEHEADER **mainshapelist; extern SHAPEHEADER **mainshapelist;
extern SHAPEHEADER *testpaletteshapelist[]; extern SHAPEHEADER *testpaletteshapelist[];
extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock; extern SCREENDESCRIPTORBLOCK ScreenDescriptorBlock;
extern int sine[];
extern int cosine[];
extern int AdaptiveHazingFlag;
extern int *Global_ShapeNormals; extern int *Global_ShapeNormals;
extern int *Global_ShapePoints; extern int *Global_ShapePoints;
extern int *ItemPointers[]; extern int *ItemPointers[];
@ -391,15 +388,6 @@ int CompareFilenameCH(char *string1, char *string2)
*/ */
#define remap_table_size (1 << (remap_table_rgb_bits * 3))
#define cprt_info No
#define cprt_cnt No
int NearestColour(int rs, int gs, int bs, unsigned char *palette) int NearestColour(int rs, int gs, int bs, unsigned char *palette)
{ {

View file

@ -37,9 +37,6 @@ typedef struct LONGLONGCH {
*/ */
extern int sine[];
extern int cosine[];
#define GetSin(a) sine[a] #define GetSin(a) sine[a]
#define GetCos(a) cosine[a] #define GetCos(a) cosine[a]