DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
quakedef.h File Reference
#include "darkplaces.h"
#include "vid.h"
#include "r_textures.h"
#include "crypto.h"
#include "draw.h"
#include "screen.h"
#include "netconn.h"
#include "protocol.h"
#include "sbar.h"
#include "sound.h"
#include "model_shared.h"
#include "world.h"
#include "client.h"
#include "render.h"
#include "progs.h"
#include "progsvm.h"
#include "server.h"
#include "phys.h"
#include "input.h"
#include "keys.h"
#include "csprogs.h"
#include "glquake.h"
#include "palette.h"
+ Include dependency graph for quakedef.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONFIGFILENAME   "config.cfg"
 
#define DEMOMSG_CLIENT_TO_SERVER   0x80000000
 
#define GAMENAME   "id1"
 
#define HIT_EMPATHY_SHIELDS   (1<<(23+3))
 
#define HIT_LASER_CANNON   (1<<HIT_LASER_CANNON_BIT)
 
#define HIT_LASER_CANNON_BIT   23
 
#define HIT_MJOLNIR   (1<<HIT_MJOLNIR_BIT)
 
#define HIT_MJOLNIR_BIT   7
 
#define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
 
#define HIT_PROXIMITY_GUN_BIT   16
 
#define HIT_WETSUIT   (1<<(23+2))
 
#define IT_ARMOR1   8192
 
#define IT_ARMOR2   16384
 
#define IT_ARMOR3   32768
 
#define IT_AXE   4096
 
#define IT_CELLS   2048
 
#define IT_GRENADE_LAUNCHER   16
 
#define IT_INVISIBILITY   524288
 
#define IT_INVULNERABILITY   1048576
 
#define IT_KEY1   131072
 
#define IT_KEY2   262144
 
#define IT_LIGHTNING   64
 
#define IT_NAILGUN   4
 
#define IT_NAILS   512
 
#define IT_QUAD   4194304
 
#define IT_ROCKET_LAUNCHER   32
 
#define IT_ROCKETS   1024
 
#define IT_SHELLS   256
 
#define IT_SHOTGUN   1
 
#define IT_SIGIL1   (1u<<28)
 
#define IT_SIGIL2   (1u<<29)
 
#define IT_SIGIL3   (1u<<30)
 
#define IT_SIGIL4   (1u<<31)
 
#define IT_SUIT   2097152
 
#define IT_SUPER_LIGHTNING   128
 
#define IT_SUPER_NAILGUN   8
 
#define IT_SUPER_SHOTGUN   2
 
#define IT_SUPERHEALTH   65536
 
#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE   0x00000004
 
#define MOVEFLAG_NOGRAVITYONGROUND   0x00000002
 
#define MOVEFLAG_Q2AIRACCELERATE   0x00000001
 
#define MOVEFLAG_VALID   0x80000000
 
#define NEX_IT_BULLETS   512
 
#define NEX_IT_CELLS   2048
 
#define NEX_IT_CRYLINK   16
 
#define NEX_IT_ELECTRO   8
 
#define NEX_IT_GRENADE_LAUNCHER   4
 
#define NEX_IT_HAGAR   64
 
#define NEX_IT_INVINCIBLE   16384
 
#define NEX_IT_LASER   4094
 
#define NEX_IT_NEX   32
 
#define NEX_IT_ROCKET_LAUNCHER   128
 
#define NEX_IT_ROCKETS   1024
 
#define NEX_IT_SHELLS   256
 
#define NEX_IT_SHOTGUN   2
 
#define NEX_IT_SLOWMO   65536
 
#define NEX_IT_SPEED   32768
 
#define NEX_IT_STRENGTH   8192
 
#define NEX_IT_UZI   1
 
#define RIT_ANTIGRAV   1073741824
 
#define RIT_ARMOR1   8388608
 
#define RIT_ARMOR2   16777216
 
#define RIT_ARMOR3   33554432
 
#define RIT_AXE   2048
 
#define RIT_CELLS   1024
 
#define RIT_LAVA_NAILGUN   4096
 
#define RIT_LAVA_NAILS   67108864
 
#define RIT_LAVA_SUPER_NAILGUN   8192
 
#define RIT_MULTI_GRENADE   16384
 
#define RIT_MULTI_ROCKET   32768
 
#define RIT_MULTI_ROCKETS   268435456
 
#define RIT_NAILS   256
 
#define RIT_PLASMA_AMMO   134217728
 
#define RIT_PLASMA_GUN   65536
 
#define RIT_ROCKETS   512
 
#define RIT_SHELLS   128
 
#define RIT_SHIELD   536870912
 
#define RIT_SUPERHEALTH   2147483648
 
#define STARTCONFIGFILENAME   "quake.rc"
 

Functions

void Chase_Init (void)
 
void Chase_Reset (void)
 
void Chase_Update (void)
 
void fractalnoise (unsigned char *noise, int size, int startgrid)
 
void fractalnoisequick (unsigned char *noise, int size, int startgrid)
 
float noise4f (float x, float y, float z, float w)
 
void Sys_Shared_Init (void)
 

Variables

cvar_t chase_active
 
cvar_t cl_viewmodel_scale
 
int current_skill
 skill level for currently loaded level (in case the user changes the cvar while the level is running, this reflects the level actually in use)
 
qbool noclip_anglehack
 

Macro Definition Documentation

◆ CONFIGFILENAME

#define CONFIGFILENAME   "config.cfg"

◆ DEMOMSG_CLIENT_TO_SERVER

#define DEMOMSG_CLIENT_TO_SERVER   0x80000000

Definition at line 178 of file quakedef.h.

Referenced by CL_ReadDemoMessage(), and SV_WriteDemoMessage().

◆ GAMENAME

#define GAMENAME   "id1"

Definition at line 27 of file quakedef.h.

◆ HIT_EMPATHY_SHIELDS

#define HIT_EMPATHY_SHIELDS   (1<<(23+3))

Definition at line 121 of file quakedef.h.

◆ HIT_LASER_CANNON

#define HIT_LASER_CANNON   (1<<HIT_LASER_CANNON_BIT)

Definition at line 119 of file quakedef.h.

Referenced by IN_BestWeapon_ResetData(), and SV_Give_f().

◆ HIT_LASER_CANNON_BIT

#define HIT_LASER_CANNON_BIT   23

Definition at line 116 of file quakedef.h.

◆ HIT_MJOLNIR

#define HIT_MJOLNIR   (1<<HIT_MJOLNIR_BIT)

Definition at line 118 of file quakedef.h.

Referenced by IN_BestWeapon_ResetData(), and SV_Give_f().

◆ HIT_MJOLNIR_BIT

#define HIT_MJOLNIR_BIT   7

Definition at line 115 of file quakedef.h.

◆ HIT_PROXIMITY_GUN

#define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)

Definition at line 117 of file quakedef.h.

Referenced by Sbar_DrawInventory(), and SV_Give_f().

◆ HIT_PROXIMITY_GUN_BIT

#define HIT_PROXIMITY_GUN_BIT   16

Definition at line 114 of file quakedef.h.

◆ HIT_WETSUIT

#define HIT_WETSUIT   (1<<(23+2))

Definition at line 120 of file quakedef.h.

◆ IT_ARMOR1

#define IT_ARMOR1   8192

Definition at line 51 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ IT_ARMOR2

#define IT_ARMOR2   16384

Definition at line 52 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ IT_ARMOR3

#define IT_ARMOR3   32768

Definition at line 53 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ IT_AXE

#define IT_AXE   4096

Definition at line 50 of file quakedef.h.

Referenced by IN_BestWeapon_ResetData().

◆ IT_CELLS

#define IT_CELLS   2048

Definition at line 49 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_GRENADE_LAUNCHER

#define IT_GRENADE_LAUNCHER   16

Definition at line 42 of file quakedef.h.

Referenced by CL_ForwardToServer(), IN_BestWeapon_ResetData(), and SV_Give_f().

◆ IT_INVISIBILITY

#define IT_INVISIBILITY   524288

Definition at line 57 of file quakedef.h.

Referenced by CL_ForwardToServer(), CL_UpdateViewModel(), Sbar_DrawFace(), and V_CalcViewBlend().

◆ IT_INVULNERABILITY

#define IT_INVULNERABILITY   1048576

Definition at line 58 of file quakedef.h.

Referenced by CL_ForwardToServer(), Sbar_Draw(), Sbar_DrawFace(), and V_CalcViewBlend().

◆ IT_KEY1

#define IT_KEY1   131072

Definition at line 55 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_KEY2

#define IT_KEY2   262144

Definition at line 56 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_LIGHTNING

#define IT_LIGHTNING   64

Definition at line 44 of file quakedef.h.

Referenced by CL_ForwardToServer(), IN_BestWeapon_ResetData(), and SV_Give_f().

◆ IT_NAILGUN

#define IT_NAILGUN   4

Definition at line 40 of file quakedef.h.

Referenced by CL_ForwardToServer(), and IN_BestWeapon_ResetData().

◆ IT_NAILS

#define IT_NAILS   512

Definition at line 47 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_QUAD

#define IT_QUAD   4194304

Definition at line 60 of file quakedef.h.

Referenced by CL_ForwardToServer(), Sbar_DrawFace(), and V_CalcViewBlend().

◆ IT_ROCKET_LAUNCHER

#define IT_ROCKET_LAUNCHER   32

Definition at line 43 of file quakedef.h.

Referenced by CL_ForwardToServer(), and IN_BestWeapon_ResetData().

◆ IT_ROCKETS

#define IT_ROCKETS   1024

Definition at line 48 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_SHELLS

#define IT_SHELLS   256

Definition at line 46 of file quakedef.h.

Referenced by Sbar_Draw().

◆ IT_SHOTGUN

#define IT_SHOTGUN   1

Definition at line 38 of file quakedef.h.

Referenced by IN_BestWeapon_ResetData(), Sbar_DrawInventory(), and SV_Give_f().

◆ IT_SIGIL1

#define IT_SIGIL1   (1u<<28)

Definition at line 61 of file quakedef.h.

◆ IT_SIGIL2

#define IT_SIGIL2   (1u<<29)

Definition at line 62 of file quakedef.h.

◆ IT_SIGIL3

#define IT_SIGIL3   (1u<<30)

Definition at line 63 of file quakedef.h.

◆ IT_SIGIL4

#define IT_SIGIL4   (1u<<31)

Definition at line 64 of file quakedef.h.

◆ IT_SUIT

#define IT_SUIT   2097152

Definition at line 59 of file quakedef.h.

Referenced by V_CalcViewBlend().

◆ IT_SUPER_LIGHTNING

#define IT_SUPER_LIGHTNING   128

Definition at line 45 of file quakedef.h.

◆ IT_SUPER_NAILGUN

#define IT_SUPER_NAILGUN   8

Definition at line 41 of file quakedef.h.

Referenced by CL_ForwardToServer(), and IN_BestWeapon_ResetData().

◆ IT_SUPER_SHOTGUN

#define IT_SUPER_SHOTGUN   2

Definition at line 39 of file quakedef.h.

Referenced by CL_ForwardToServer(), and IN_BestWeapon_ResetData().

◆ IT_SUPERHEALTH

#define IT_SUPERHEALTH   65536

Definition at line 54 of file quakedef.h.

◆ MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE

#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE   0x00000004

Definition at line 35 of file quakedef.h.

Referenced by CL_ClientMovement_Physics_Walk(), and SV_WriteClientdataToMessage().

◆ MOVEFLAG_NOGRAVITYONGROUND

#define MOVEFLAG_NOGRAVITYONGROUND   0x00000002

Definition at line 34 of file quakedef.h.

Referenced by CL_ClientMovement_Physics_Walk(), and SV_WriteClientdataToMessage().

◆ MOVEFLAG_Q2AIRACCELERATE

#define MOVEFLAG_Q2AIRACCELERATE   0x00000001

◆ MOVEFLAG_VALID

#define MOVEFLAG_VALID   0x80000000

Definition at line 32 of file quakedef.h.

Referenced by CL_UpdateMoveVars(), and SV_WriteClientdataToMessage().

◆ NEX_IT_BULLETS

#define NEX_IT_BULLETS   512

Definition at line 79 of file quakedef.h.

Referenced by Sbar_Draw().

◆ NEX_IT_CELLS

#define NEX_IT_CELLS   2048

Definition at line 81 of file quakedef.h.

Referenced by Sbar_Draw().

◆ NEX_IT_CRYLINK

#define NEX_IT_CRYLINK   16

Definition at line 74 of file quakedef.h.

◆ NEX_IT_ELECTRO

#define NEX_IT_ELECTRO   8

Definition at line 73 of file quakedef.h.

◆ NEX_IT_GRENADE_LAUNCHER

#define NEX_IT_GRENADE_LAUNCHER   4

Definition at line 72 of file quakedef.h.

◆ NEX_IT_HAGAR

#define NEX_IT_HAGAR   64

Definition at line 76 of file quakedef.h.

◆ NEX_IT_INVINCIBLE

#define NEX_IT_INVINCIBLE   16384

Definition at line 84 of file quakedef.h.

◆ NEX_IT_LASER

#define NEX_IT_LASER   4094

Definition at line 82 of file quakedef.h.

◆ NEX_IT_NEX

#define NEX_IT_NEX   32

Definition at line 75 of file quakedef.h.

◆ NEX_IT_ROCKET_LAUNCHER

#define NEX_IT_ROCKET_LAUNCHER   128

Definition at line 77 of file quakedef.h.

◆ NEX_IT_ROCKETS

#define NEX_IT_ROCKETS   1024

Definition at line 80 of file quakedef.h.

Referenced by Sbar_Draw().

◆ NEX_IT_SHELLS

#define NEX_IT_SHELLS   256

Definition at line 78 of file quakedef.h.

Referenced by Sbar_Draw().

◆ NEX_IT_SHOTGUN

#define NEX_IT_SHOTGUN   2

Definition at line 71 of file quakedef.h.

◆ NEX_IT_SLOWMO

#define NEX_IT_SLOWMO   65536

Definition at line 86 of file quakedef.h.

◆ NEX_IT_SPEED

#define NEX_IT_SPEED   32768

Definition at line 85 of file quakedef.h.

◆ NEX_IT_STRENGTH

#define NEX_IT_STRENGTH   8192

Definition at line 83 of file quakedef.h.

◆ NEX_IT_UZI

#define NEX_IT_UZI   1

Definition at line 70 of file quakedef.h.

◆ RIT_ANTIGRAV

#define RIT_ANTIGRAV   1073741824

Definition at line 108 of file quakedef.h.

◆ RIT_ARMOR1

#define RIT_ARMOR1   8388608

Definition at line 101 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ RIT_ARMOR2

#define RIT_ARMOR2   16777216

Definition at line 102 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ RIT_ARMOR3

#define RIT_ARMOR3   33554432

Definition at line 103 of file quakedef.h.

Referenced by Sbar_Draw(), and SV_Give_f().

◆ RIT_AXE

#define RIT_AXE   2048

Definition at line 95 of file quakedef.h.

◆ RIT_CELLS

#define RIT_CELLS   1024

Definition at line 94 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_LAVA_NAILGUN

#define RIT_LAVA_NAILGUN   4096

Definition at line 96 of file quakedef.h.

Referenced by Sbar_DrawInventory().

◆ RIT_LAVA_NAILS

#define RIT_LAVA_NAILS   67108864

Definition at line 104 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_LAVA_SUPER_NAILGUN

#define RIT_LAVA_SUPER_NAILGUN   8192

Definition at line 97 of file quakedef.h.

◆ RIT_MULTI_GRENADE

#define RIT_MULTI_GRENADE   16384

Definition at line 98 of file quakedef.h.

◆ RIT_MULTI_ROCKET

#define RIT_MULTI_ROCKET   32768

Definition at line 99 of file quakedef.h.

◆ RIT_MULTI_ROCKETS

#define RIT_MULTI_ROCKETS   268435456

Definition at line 106 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_NAILS

#define RIT_NAILS   256

Definition at line 92 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_PLASMA_AMMO

#define RIT_PLASMA_AMMO   134217728

Definition at line 105 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_PLASMA_GUN

#define RIT_PLASMA_GUN   65536

Definition at line 100 of file quakedef.h.

◆ RIT_ROCKETS

#define RIT_ROCKETS   512

Definition at line 93 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_SHELLS

#define RIT_SHELLS   128

Definition at line 91 of file quakedef.h.

Referenced by Sbar_Draw().

◆ RIT_SHIELD

#define RIT_SHIELD   536870912

Definition at line 107 of file quakedef.h.

◆ RIT_SUPERHEALTH

#define RIT_SUPERHEALTH   2147483648

Definition at line 109 of file quakedef.h.

◆ STARTCONFIGFILENAME

#define STARTCONFIGFILENAME   "quake.rc"

Definition at line 28 of file quakedef.h.

Referenced by Host_AddConfigText().

Function Documentation

◆ Chase_Init()

void Chase_Init ( void )

◆ Chase_Reset()

void Chase_Reset ( void )

◆ Chase_Update()

void Chase_Update ( void )

◆ fractalnoise()

void fractalnoise ( unsigned char * noise,
int size,
int startgrid )

Definition at line 4 of file fractalnoise.c.

5{
6 int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower;
7 int *noisebuf;
8#define n(x,y) noisebuf[((y)&size1)*size+((x)&size1)]
9
10 for (sizepower = 0;(1 << sizepower) < size;sizepower++);
11 if (size != (1 << sizepower))
12 {
13 Con_Printf("fractalnoise: size must be power of 2\n");
14 return;
15 }
16
17 for (gridpower = 0;(1 << gridpower) < startgrid;gridpower++);
18 if (startgrid != (1 << gridpower))
19 {
20 Con_Printf("fractalnoise: grid must be power of 2\n");
21 return;
22 }
23
24 startgrid = bound(0, startgrid, size);
25
26 amplitude = 0xFFFF; // this gets halved before use
27 noisebuf = (int *)Mem_Alloc(tempmempool, size*size*sizeof(int));
28 memset(noisebuf, 0, size*size*sizeof(int));
29
30 for (g2 = startgrid;g2;g2 >>= 1)
31 {
32 // brownian motion (at every smaller level there is random behavior)
33 amplitude >>= 1;
34 for (y = 0;y < size;y += g2)
35 for (x = 0;x < size;x += g2)
36 n(x,y) += (rand()&amplitude);
37
38 g = g2 >> 1;
39 if (g)
40 {
41 // subdivide, diamond-square algorithm (really this has little to do with squares)
42 // diamond
43 for (y = 0;y < size;y += g2)
44 for (x = 0;x < size;x += g2)
45 n(x+g,y+g) = (n(x,y) + n(x+g2,y) + n(x,y+g2) + n(x+g2,y+g2)) >> 2;
46 // square
47 for (y = 0;y < size;y += g2)
48 for (x = 0;x < size;x += g2)
49 {
50 n(x+g,y) = (n(x,y) + n(x+g2,y) + n(x+g,y-g) + n(x+g,y+g)) >> 2;
51 n(x,y+g) = (n(x,y) + n(x,y+g2) + n(x-g,y+g) + n(x+g,y+g)) >> 2;
52 }
53 }
54 }
55 // find range of noise values
56 min = max = 0;
57 for (y = 0;y < size;y++)
58 for (x = 0;x < size;x++)
59 {
60 if (n(x,y) < min) min = n(x,y);
61 if (n(x,y) > max) max = n(x,y);
62 }
63 max -= min;
64 max++;
65 // normalize noise and copy to output
66 for (y = 0;y < size;y++)
67 for (x = 0;x < size;x++)
68 *noise++ = (unsigned char) (((n(x,y) - min) * 256) / max);
69 Mem_Free(noisebuf);
70#undef n
71}
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
vector size
#define n(x, y)
GLint GLenum GLint GLint y
Definition glquake.h:651
GLint GLenum GLint x
Definition glquake.h:651
#define max(A, B)
Definition mathlib.h:38
#define min(A, B)
Definition mathlib.h:37
#define bound(min, num, max)
Definition mathlib.h:34
string noise
Definition progsdefs.qc:209
dp_FragColor g
mempool_t * tempmempool
Definition zone.c:794
#define Mem_Free(mem)
Definition zone.h:96
#define Mem_Alloc(pool, size)
Definition zone.h:92

References bound, Con_Printf(), g, max, Mem_Alloc, Mem_Free, min, n, noise, size, tempmempool, x, and y.

Referenced by r_explosion_start(), and R_InitParticleTexture().

◆ fractalnoisequick()

void fractalnoisequick ( unsigned char * noise,
int size,
int startgrid )

Definition at line 74 of file fractalnoise.c.

75{
76 int x, y, g, g2, amplitude, size1 = size - 1, sizepower, gridpower;
77#define n(x,y) noise[((y)&size1)*size+((x)&size1)]
78
79 for (sizepower = 0;(1 << sizepower) < size;sizepower++);
80 if (size != (1 << sizepower))
81 {
82 Con_Printf("fractalnoise: size must be power of 2\n");
83 return;
84 }
85
86 for (gridpower = 0;(1 << gridpower) < startgrid;gridpower++);
87 if (startgrid != (1 << gridpower))
88 {
89 Con_Printf("fractalnoise: grid must be power of 2\n");
90 return;
91 }
92
93 startgrid = bound(0, startgrid, size);
94
95 amplitude = 255; // this gets halved before use
96 memset(noise, 0, size*size);
97
98 for (g2 = startgrid;g2;g2 >>= 1)
99 {
100 // brownian motion (at every smaller level there is random behavior)
101 amplitude >>= 1;
102 for (y = 0;y < size;y += g2)
103 for (x = 0;x < size;x += g2)
104 n(x,y) += (rand()&amplitude);
105
106 g = g2 >> 1;
107 if (g)
108 {
109 // subdivide, diamond-square algorithm (really this has little to do with squares)
110 // diamond
111 for (y = 0;y < size;y += g2)
112 for (x = 0;x < size;x += g2)
113 n(x+g,y+g) = (unsigned char) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x,y+g2) + (int) n(x+g2,y+g2)) >> 2);
114 // square
115 for (y = 0;y < size;y += g2)
116 for (x = 0;x < size;x += g2)
117 {
118 n(x+g,y) = (unsigned char) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x+g,y-g) + (int) n(x+g,y+g)) >> 2);
119 n(x,y+g) = (unsigned char) (((int) n(x,y) + (int) n(x,y+g2) + (int) n(x-g,y+g) + (int) n(x+g,y+g)) >> 2);
120 }
121 }
122 }
123#undef n
124}

References bound, Con_Printf(), g, n, noise, size, x, and y.

Referenced by R_NewExplosion().

◆ noise4f()

float noise4f ( float x,
float y,
float z,
float w )

Definition at line 128 of file fractalnoise.c.

129{
130 int i;
131 int index[4][2];
132 float frac[4][2];
133 float v[4];
134 static float noisetable[NOISE_SIZE];
135 static int r[NOISE_SIZE];
136 // LadyHavoc: this is inspired by code I saw in Quake3, however I think my
137 // version is much cleaner and substantially faster as well
138 //
139 // the following changes were made:
140 // 1. for the permutation indexing (r[] array in this code) I substituted
141 // the ^ operator (which never overflows) for the original addition and
142 // masking code, this should not have any effect on quality.
143 // 2. removed the outermost randomization array lookup.
144 // (it really wasn't necessary, it's fine if X indexes the array
145 // directly without permutation indexing)
146 // 3. reimplemented the blending using frac[] arrays rather than a macro.
147 // (the original macro read one parameter twice - not good)
148 // 4. cleaned up the code by using 4 nested loops to make it read nicer
149 // (but then I unrolled it completely for speed, it still looks nicer).
150 if (!noisetable[0])
151 {
152 // noisetable is a random-ish series of float values in +/- 1 range
153 for (i = 0;i < NOISE_SIZE;i++)
154 noisetable[i] = (rand() / (double)RAND_MAX) * 2 - 1;
155 // r is a remapping table to make each dimension of the index have different indexing behavior
156 for (i = 0;i < NOISE_SIZE;i++)
157 r[i] = (int)(rand() * (double)NOISE_SIZE / ((double)RAND_MAX + 1)) & NOISE_MASK;
158 // that & is only needed if RAND_MAX is > the range of double, which isn't the case on most platforms
159 }
160 frac[0][1] = x - floor(x);index[0][0] = ((int)floor(x)) & NOISE_MASK;
161 frac[1][1] = y - floor(y);index[1][0] = ((int)floor(y)) & NOISE_MASK;
162 frac[2][1] = z - floor(z);index[2][0] = ((int)floor(z)) & NOISE_MASK;
163 frac[3][1] = w - floor(w);index[3][0] = ((int)floor(w)) & NOISE_MASK;
164 for (i = 0;i < 4;i++)
165 frac[i][0] = 1 - frac[i][1];
166 for (i = 0;i < 4;i++)
167 index[i][1] = (index[i][0] < NOISE_SIZE - 1) ? (index[i][0] + 1) : 0;
168#if 1
169 // short version
170 v[0] = frac[1][0] * (frac[0][0] * noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][0]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][0]] ^ index[0][1]]) + frac[1][1] * (frac[0][0] * noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][1]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][1]] ^ index[0][1]]);
171 v[1] = frac[1][0] * (frac[0][0] * noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][0]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][0]] ^ index[0][1]]) + frac[1][1] * (frac[0][0] * noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][1]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][1]] ^ index[0][1]]);
172 v[2] = frac[1][0] * (frac[0][0] * noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][0]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][0]] ^ index[0][1]]) + frac[1][1] * (frac[0][0] * noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][1]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][1]] ^ index[0][1]]);
173 v[3] = frac[1][0] * (frac[0][0] * noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][0]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][0]] ^ index[0][1]]) + frac[1][1] * (frac[0][0] * noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][1]] ^ index[0][0]] + frac[0][1] * noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][1]] ^ index[0][1]]);
174 return frac[3][0] * (frac[2][0] * v[0] + frac[2][1] * v[1]) + frac[3][1] * (frac[2][0] * v[2] + frac[2][1] * v[3]);
175#elif 1
176 // longer version
177 v[ 0] = noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][0]] ^ index[0][0]];
178 v[ 1] = noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][0]] ^ index[0][1]];
179 v[ 2] = noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][1]] ^ index[0][0]];
180 v[ 3] = noisetable[r[r[r[index[3][0]] ^ index[2][0]] ^ index[1][1]] ^ index[0][1]];
181 v[ 4] = noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][0]] ^ index[0][0]];
182 v[ 5] = noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][0]] ^ index[0][1]];
183 v[ 6] = noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][1]] ^ index[0][0]];
184 v[ 7] = noisetable[r[r[r[index[3][0]] ^ index[2][1]] ^ index[1][1]] ^ index[0][1]];
185 v[ 8] = noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][0]] ^ index[0][0]];
186 v[ 9] = noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][0]] ^ index[0][1]];
187 v[10] = noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][1]] ^ index[0][0]];
188 v[11] = noisetable[r[r[r[index[3][1]] ^ index[2][0]] ^ index[1][1]] ^ index[0][1]];
189 v[12] = noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][0]] ^ index[0][0]];
190 v[13] = noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][0]] ^ index[0][1]];
191 v[14] = noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][1]] ^ index[0][0]];
192 v[15] = noisetable[r[r[r[index[3][1]] ^ index[2][1]] ^ index[1][1]] ^ index[0][1]];
193 v[16] = frac[0][0] * v[ 0] + frac[0][1] * v[ 1];
194 v[17] = frac[0][0] * v[ 2] + frac[0][1] * v[ 3];
195 v[18] = frac[0][0] * v[ 4] + frac[0][1] * v[ 5];
196 v[19] = frac[0][0] * v[ 6] + frac[0][1] * v[ 7];
197 v[20] = frac[0][0] * v[ 8] + frac[0][1] * v[ 9];
198 v[21] = frac[0][0] * v[10] + frac[0][1] * v[11];
199 v[22] = frac[0][0] * v[12] + frac[0][1] * v[13];
200 v[23] = frac[0][0] * v[14] + frac[0][1] * v[15];
201 v[24] = frac[1][0] * v[16] + frac[1][1] * v[17];
202 v[25] = frac[1][0] * v[18] + frac[1][1] * v[19];
203 v[26] = frac[1][0] * v[20] + frac[1][1] * v[21];
204 v[27] = frac[1][0] * v[22] + frac[1][1] * v[23];
205 v[28] = frac[2][0] * v[24] + frac[2][1] * v[25];
206 v[29] = frac[2][0] * v[26] + frac[2][1] * v[27];
207 return frac[3][0] * v[28] + frac[3][1] * v[29];
208#else
209 // the algorithm...
210 for (l = 0;l < 2;l++)
211 {
212 for (k = 0;k < 2;k++)
213 {
214 for (j = 0;j < 2;j++)
215 {
216 for (i = 0;i < 2;i++)
217 v[l][k][j][i] = noisetable[r[r[r[index[l][3]] ^ index[k][2]] ^ index[j][1]] ^ index[i][0]];
218 v[l][k][j][2] = frac[0][0] * v[l][k][j][0] + frac[0][1] * v[l][k][j][1];
219 }
220 v[l][k][2][2] = frac[1][0] * v[l][k][0][2] + frac[1][1] * v[l][k][1][2];
221 }
222 v[l][2][2][2] = frac[2][0] * v[l][0][2][2] + frac[2][1] * v[l][1][2][2];
223 }
224 v[2][2][2][2] = frac[3][0] * v[0][2][2][2] + frac[3][1] * v[1][2][2][2];
225#endif
226}
#define NOISE_SIZE
#define NOISE_MASK
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLubyte GLubyte GLubyte z
Definition glquake.h:782
GLubyte GLubyte GLubyte GLubyte w
Definition glquake.h:782
const GLdouble * v
Definition glquake.h:762
GLuint index
Definition glquake.h:629
float floor(float f)
int i
dp_FragColor r

References floor(), i, index, int(), NOISE_MASK, NOISE_SIZE, r, v, w, x, y, and z.

Referenced by RSurf_PrepareVerticesForBatch().

◆ Sys_Shared_Init()

void Sys_Shared_Init ( void )

Variable Documentation

◆ chase_active

cvar_t chase_active
extern

Definition at line 132 of file view.c.

132{CF_CLIENT | CF_ARCHIVE, "chase_active", "0", "enables chase cam"};
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53

Referenced by CL_Beam_CalculatePositions(), CL_SelectTraceLine(), CL_UpdatePrydonCursor(), R_View_UpdateEntityVisible(), R_Water_ProcessPlanes(), V_CalcRefdefUsing(), and V_Init().

◆ cl_viewmodel_scale

cvar_t cl_viewmodel_scale
extern

Definition at line 82 of file view.c.

82{CF_CLIENT, "cl_viewmodel_scale", "1", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"};

Referenced by CSQC_R_RecalcView(), SV_GetEntityMatrix(), V_CalcIntermissionRefdef(), V_CalcRefdefUsing(), and V_Init().

◆ current_skill

int current_skill
extern

skill level for currently loaded level (in case the user changes the cvar while the level is running, this reflects the level actually in use)

Definition at line 27 of file sv_ccmds.c.

Referenced by SV_Loadgame_f(), SV_Savegame_to(), SV_SpawnServer(), and SVVM_load_edict().

◆ noclip_anglehack

qbool noclip_anglehack
extern

Definition at line 190 of file sv_ccmds.c.

Referenced by CL_ClearState(), CL_Input(), SV_DisableCheats_c(), SV_Noclip_f(), and V_DriftPitch().