mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
QSG2 glows almost working. Plus lots of typos killed.
This commit is contained in:
parent
f90f78990a
commit
c8bc5dfb4c
16 changed files with 96 additions and 84 deletions
|
@ -85,8 +85,6 @@ typedef struct entity_s
|
||||||
// found in an active leaf
|
// found in an active leaf
|
||||||
float colormod[4]; // color tint and alpha for model
|
float colormod[4]; // color tint and alpha for model
|
||||||
float scale; // size scaler of the model
|
float scale; // size scaler of the model
|
||||||
float glow_size; // how big the glow is (can be negative)
|
|
||||||
byte glow_color; // color of glow (paletted)
|
|
||||||
|
|
||||||
// FIXME: could turn these into a union
|
// FIXME: could turn these into a union
|
||||||
int trivial_accept;
|
int trivial_accept;
|
||||||
|
|
|
@ -510,7 +510,7 @@ int loadsize;
|
||||||
COM_LoadFile
|
COM_LoadFile
|
||||||
|
|
||||||
Filename are relative to the quake directory.
|
Filename are relative to the quake directory.
|
||||||
Allways appends a 0 byte to the loaded data.
|
Always appends a 0 byte to the loaded data.
|
||||||
*/
|
*/
|
||||||
byte *
|
byte *
|
||||||
COM_LoadFile (const char *path, int usehunk)
|
COM_LoadFile (const char *path, int usehunk)
|
||||||
|
|
|
@ -97,7 +97,7 @@ Con_Printf ();
|
||||||
net
|
net
|
||||||
turn off messages option
|
turn off messages option
|
||||||
|
|
||||||
the refresh is allways rendered, unless the console is full screen
|
the refresh is always rendered, unless the console is full screen
|
||||||
|
|
||||||
|
|
||||||
console is:
|
console is:
|
||||||
|
|
|
@ -43,13 +43,14 @@ static const char rcsid[] =
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
|
|
||||||
/* Software and hardware gamma support */
|
/* Software and hardware gamma support */
|
||||||
byte gammatable[256];
|
byte gammatable[256];
|
||||||
cvar_t *vid_gamma;
|
cvar_t *vid_gamma;
|
||||||
cvar_t *vid_system_gamma;
|
cvar_t *vid_system_gamma;
|
||||||
qboolean vid_gamma_avail; // hardware gamma availability
|
qboolean vid_gamma_avail; // hardware gamma availability
|
||||||
|
|
||||||
|
unsigned int d_8to24table[256];
|
||||||
|
|
||||||
/* Screen size */
|
/* Screen size */
|
||||||
int scr_width, scr_height;
|
int scr_width, scr_height;
|
||||||
cvar_t *vid_width;
|
cvar_t *vid_width;
|
||||||
|
@ -57,6 +58,7 @@ cvar_t *vid_height;
|
||||||
|
|
||||||
cvar_t *vid_fullscreen;
|
cvar_t *vid_fullscreen;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_GetWindowSize (int def_w, int def_h)
|
VID_GetWindowSize (int def_w, int def_h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,6 @@ static const char rcsid[] =
|
||||||
#define WARP_HEIGHT 200
|
#define WARP_HEIGHT 200
|
||||||
|
|
||||||
unsigned char d_15to8table[65536];
|
unsigned char d_15to8table[65536];
|
||||||
unsigned int d_8to24table[256];
|
|
||||||
|
|
||||||
QF_glActiveTextureARB qglActiveTexture = NULL;
|
QF_glActiveTextureARB qglActiveTexture = NULL;
|
||||||
QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL;
|
QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL;
|
||||||
|
|
|
@ -42,7 +42,6 @@ static const char rcsid[] =
|
||||||
|
|
||||||
|
|
||||||
unsigned short d_8to16table[256];
|
unsigned short d_8to16table[256];
|
||||||
unsigned int d_8to24table[256];
|
|
||||||
unsigned char d_15to8table[65536];
|
unsigned char d_15to8table[65536];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -139,8 +139,6 @@ static int VID_highhunkmark;
|
||||||
|
|
||||||
unsigned char vid_curpal[256 * 3];
|
unsigned char vid_curpal[256 * 3];
|
||||||
|
|
||||||
unsigned int d_8to24table[256];
|
|
||||||
|
|
||||||
int driver = grDETECT, mode;
|
int driver = grDETECT, mode;
|
||||||
qboolean useWinDirect = true, useDirectDraw = true;
|
qboolean useWinDirect = true, useDirectDraw = true;
|
||||||
MGLDC *mgldc = NULL, *memdc = NULL, *dibdc = NULL, *windc = NULL;
|
MGLDC *mgldc = NULL, *memdc = NULL, *dibdc = NULL, *windc = NULL;
|
||||||
|
|
|
@ -42,7 +42,6 @@ byte vid_buffer[BASEWIDTH * BASEHEIGHT];
|
||||||
short zbuffer[BASEWIDTH * BASEHEIGHT];
|
short zbuffer[BASEWIDTH * BASEHEIGHT];
|
||||||
byte surfcache[256 * 1024];
|
byte surfcache[256 * 1024];
|
||||||
|
|
||||||
unsigned int d_8to24table[256];
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_SetPalette (unsigned char *palette)
|
VID_SetPalette (unsigned char *palette)
|
||||||
|
|
|
@ -365,13 +365,10 @@ CL_ParseUpdate (int bits)
|
||||||
else
|
else
|
||||||
forcelink = false;
|
forcelink = false;
|
||||||
|
|
||||||
if (forcelink) {
|
if (forcelink) { // FIXME: do this right (ie, protocol support)
|
||||||
// FIXME: do this right (ie, protocol support)
|
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->colormod[3] = 1.0;
|
ent->colormod[3] = 1.0;
|
||||||
ent->scale = 1.0;
|
ent->scale = 1.0;
|
||||||
ent->glow_size = 0.0;
|
|
||||||
ent->glow_color = 254;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state->msgtime = cl.mtime[0];
|
state->msgtime = cl.mtime[0];
|
||||||
|
@ -626,13 +623,10 @@ CL_ParseStatic (void)
|
||||||
ent->frame = state.baseline.frame;
|
ent->frame = state.baseline.frame;
|
||||||
ent->colormap = vid.colormap8;
|
ent->colormap = vid.colormap8;
|
||||||
ent->skinnum = state.baseline.skin;
|
ent->skinnum = state.baseline.skin;
|
||||||
//FIXME ent->effects = state.baseline.effects;
|
// FIXME: need to get colormod from baseline
|
||||||
//FIXME need to get colormod from baseline
|
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
||||||
ent->colormod[3] = state.baseline.alpha / 255.0;
|
ent->colormod[3] = state.baseline.alpha / 255.0;
|
||||||
ent->scale = state.baseline.scale / 16.0;
|
ent->scale = state.baseline.scale / 16.0;
|
||||||
ent->glow_size = state.baseline.glow_size;
|
|
||||||
ent->glow_color = state.baseline.glow_color;
|
|
||||||
|
|
||||||
R_AddEfrags (ent);
|
R_AddEfrags (ent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,8 +133,6 @@ CL_Init_Entity (entity_t *ent)
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->colormod[3] = 1.0;
|
ent->colormod[3] = 1.0;
|
||||||
ent->scale = 1.0;
|
ent->scale = 1.0;
|
||||||
ent->glow_size = 0.0;
|
|
||||||
ent->glow_color = 254;
|
|
||||||
ent->pose1 = ent->pose2 = -1;
|
ent->pose1 = ent->pose2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,13 @@ typedef struct player_state_s {
|
||||||
float waterjumptime;
|
float waterjumptime;
|
||||||
int onground; // -1 = in air, else pmove entity number
|
int onground; // -1 = in air, else pmove entity number
|
||||||
int oldbuttons;
|
int oldbuttons;
|
||||||
|
|
||||||
|
// QSG2
|
||||||
|
byte alpha;
|
||||||
|
byte scale;
|
||||||
|
byte glow_size;
|
||||||
|
byte glow_color;
|
||||||
|
byte colormod;
|
||||||
} player_state_t;
|
} player_state_t;
|
||||||
|
|
||||||
#undef MAX_SCOREBOARDNAME
|
#undef MAX_SCOREBOARDNAME
|
||||||
|
|
|
@ -88,7 +88,8 @@ CL_ClearEnts ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_NewDlight (int key, vec3_t org, int effects)
|
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
||||||
|
byte glow_color)
|
||||||
{
|
{
|
||||||
float radius;
|
float radius;
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
|
@ -97,13 +98,17 @@ CL_NewDlight (int key, vec3_t org, int effects)
|
||||||
static vec3_t blue = {0.05, 0.05, 0.5};
|
static vec3_t blue = {0.05, 0.05, 0.5};
|
||||||
static vec3_t purple = {0.5, 0.05, 0.5};
|
static vec3_t purple = {0.5, 0.05, 0.5};
|
||||||
|
|
||||||
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)))
|
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT))) {
|
||||||
|
if (!glow_size)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dl = R_AllocDlight (key);
|
dl = R_AllocDlight (key);
|
||||||
if (!dl)
|
if (!dl)
|
||||||
return;
|
return;
|
||||||
VectorCopy (org, dl->origin);
|
VectorCopy (org, dl->origin);
|
||||||
|
|
||||||
|
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
||||||
radius = 200 + (rand () & 31);
|
radius = 200 + (rand () & 31);
|
||||||
if (effects & EF_BRIGHTLIGHT) {
|
if (effects & EF_BRIGHTLIGHT) {
|
||||||
radius += 200;
|
radius += 200;
|
||||||
|
@ -113,7 +118,7 @@ CL_NewDlight (int key, vec3_t org, int effects)
|
||||||
if (effects & ~EF_DIMLIGHT)
|
if (effects & ~EF_DIMLIGHT)
|
||||||
radius -= 100;
|
radius -= 100;
|
||||||
dl->radius = radius;
|
dl->radius = radius;
|
||||||
dl->die = cl.time + 0.1;
|
dl->die = cl.time + 0.1; // FIXME: killing a merged dlight is bad?
|
||||||
switch (effects & (EF_RED | EF_BLUE)) {
|
switch (effects & (EF_RED | EF_BLUE)) {
|
||||||
case EF_RED | EF_BLUE:
|
case EF_RED | EF_BLUE:
|
||||||
VectorCopy (purple, dl->color);
|
VectorCopy (purple, dl->color);
|
||||||
|
@ -128,6 +133,24 @@ CL_NewDlight (int key, vec3_t org, int effects)
|
||||||
VectorCopy (normal, dl->color);
|
VectorCopy (normal, dl->color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (glow_size) {
|
||||||
|
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
||||||
|
(glow_size - 256) * 8.0;
|
||||||
|
if (glow_color) {
|
||||||
|
if (glow_color == 255) {
|
||||||
|
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
||||||
|
} else {
|
||||||
|
unsigned char *tempcolor;
|
||||||
|
|
||||||
|
tempcolor = (byte *) &d_8to24table[glow_color];
|
||||||
|
dl->color[0] = tempcolor[0] / 255.0;
|
||||||
|
dl->color[1] = tempcolor[1] / 255.0;
|
||||||
|
dl->color[2] = tempcolor[2] / 255.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PACKET ENTITY PARSING / LINKING */
|
/* PACKET ENTITY PARSING / LINKING */
|
||||||
|
@ -411,7 +434,8 @@ CL_LinkPacketEntities (void)
|
||||||
s1 = &pack->entities[pnum];
|
s1 = &pack->entities[pnum];
|
||||||
|
|
||||||
// spawn light flashes, even ones coming from invisible objects
|
// spawn light flashes, even ones coming from invisible objects
|
||||||
CL_NewDlight (s1->number, s1->origin, s1->effects);
|
CL_NewDlight (s1->number, s1->origin, s1->effects, s1->glow_size,
|
||||||
|
s1->glow_color);
|
||||||
|
|
||||||
// if set to invisible, skip
|
// if set to invisible, skip
|
||||||
if (!s1->modelindex)
|
if (!s1->modelindex)
|
||||||
|
@ -477,9 +501,6 @@ CL_LinkPacketEntities (void)
|
||||||
}
|
}
|
||||||
(*ent)->colormod[3] = s1->alpha / 255.0;
|
(*ent)->colormod[3] = s1->alpha / 255.0;
|
||||||
(*ent)->scale = s1->scale / 16.0;
|
(*ent)->scale = s1->scale / 16.0;
|
||||||
(*ent)->glow_size = s1->glow_size < 128 ? s1->glow_size * 8.0 :
|
|
||||||
(s1->glow_size - 256) * 8.0;
|
|
||||||
(*ent)->glow_color = s1->glow_color;
|
|
||||||
// Ender: Extend (Colormod) [QSG - End]
|
// Ender: Extend (Colormod) [QSG - End]
|
||||||
|
|
||||||
// set skin
|
// set skin
|
||||||
|
@ -516,7 +537,7 @@ CL_LinkPacketEntities (void)
|
||||||
dl = R_AllocDlight (-s1->number);
|
dl = R_AllocDlight (-s1->number);
|
||||||
if (dl) {
|
if (dl) {
|
||||||
VectorCopy ((*ent)->origin, dl->origin);
|
VectorCopy ((*ent)->origin, dl->origin);
|
||||||
dl->radius = 200;
|
dl->radius = 200.0;
|
||||||
dl->die = cl.time + 0.1;
|
dl->die = cl.time + 0.1;
|
||||||
VectorCopy (r_firecolor->vec, dl->color);
|
VectorCopy (r_firecolor->vec, dl->color);
|
||||||
}
|
}
|
||||||
|
@ -742,7 +763,6 @@ CL_LinkPlayers (void)
|
||||||
{
|
{
|
||||||
double playertime;
|
double playertime;
|
||||||
int msec, oldphysent, i, j;
|
int msec, oldphysent, i, j;
|
||||||
//entity_t **_ent;
|
|
||||||
entity_t *ent;
|
entity_t *ent;
|
||||||
frame_t *frame;
|
frame_t *frame;
|
||||||
player_info_t *info;
|
player_info_t *info;
|
||||||
|
@ -767,17 +787,6 @@ CL_LinkPlayers (void)
|
||||||
if (!info->name[0])
|
if (!info->name[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// spawn light flashes, even ones coming from invisible objects
|
|
||||||
if (j == cl.playernum) {
|
|
||||||
VectorCopy (cl.simorg, org);
|
|
||||||
r_player_entity = &cl_player_ents[j];
|
|
||||||
} else
|
|
||||||
VectorCopy (state->origin, org);
|
|
||||||
|
|
||||||
CL_NewDlight (j, org, state->effects); //FIXME:
|
|
||||||
// appearently, this should be j+1, but that seems nasty for some
|
|
||||||
// things (due to lack of lights?), so I'm leaving this as is for now.
|
|
||||||
|
|
||||||
// the player object never gets added
|
// the player object never gets added
|
||||||
if (j == cl.playernum) {
|
if (j == cl.playernum) {
|
||||||
if (!Cam_DrawPlayer (-1)) // XXX
|
if (!Cam_DrawPlayer (-1)) // XXX
|
||||||
|
@ -787,6 +796,14 @@ CL_LinkPlayers (void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// spawn light flashes, even ones coming from invisible objects
|
||||||
|
if (j == cl.playernum) {
|
||||||
|
VectorCopy (cl.simorg, org);
|
||||||
|
r_player_entity = &cl_player_ents[j];
|
||||||
|
} else
|
||||||
|
VectorCopy (state->origin, org);
|
||||||
|
CL_NewDlight (j, org, state->effects, 0, 255);
|
||||||
|
|
||||||
if (!state->modelindex)
|
if (!state->modelindex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -818,9 +835,7 @@ CL_LinkPlayers (void)
|
||||||
{
|
{
|
||||||
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3;
|
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3;
|
||||||
ent->angles[YAW] = cl.viewangles[YAW];
|
ent->angles[YAW] = cl.viewangles[YAW];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ent->angles[PITCH] = -state->viewangles[PITCH] / 3;
|
ent->angles[PITCH] = -state->viewangles[PITCH] / 3;
|
||||||
ent->angles[YAW] = state->viewangles[YAW];
|
ent->angles[YAW] = state->viewangles[YAW];
|
||||||
}
|
}
|
||||||
|
@ -847,13 +862,18 @@ CL_LinkPlayers (void)
|
||||||
ent->skin = NULL;
|
ent->skin = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
|
// QSG2
|
||||||
// extend stuff
|
if (state->colormod == 255) {
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
|
||||||
ent->colormod[3] = 1.0;
|
} else {
|
||||||
ent->scale = 1.0;
|
ent->colormod[0] = (float) ((state->colormod >> 5) & 7) *
|
||||||
ent->glow_size = 0.0;
|
(1.0 / 7.0);
|
||||||
ent->glow_color = 254;
|
ent->colormod[1] = (float) ((state->colormod >> 2) & 7) *
|
||||||
|
(1.0 / 7.0);
|
||||||
|
ent->colormod[2] = (float) (state->colormod & 3) * (1.0 / 3.0);
|
||||||
|
}
|
||||||
|
ent->colormod[3] = state->alpha / 255.0;
|
||||||
|
ent->scale = state->scale / 16.0;
|
||||||
|
|
||||||
if (state->effects & EF_FLAG1)
|
if (state->effects & EF_FLAG1)
|
||||||
CL_AddFlagModels (ent, 0, j);
|
CL_AddFlagModels (ent, 0, j);
|
||||||
|
@ -960,11 +980,11 @@ CL_SetUpPlayerPrediction (qboolean dopred)
|
||||||
msec = 500 * (playertime - state->state_time);
|
msec = 500 * (playertime - state->state_time);
|
||||||
if (msec <= 0 || !dopred) {
|
if (msec <= 0 || !dopred) {
|
||||||
VectorCopy (state->origin, pplayer->origin);
|
VectorCopy (state->origin, pplayer->origin);
|
||||||
// Con_DPrintf ("nopredict\n");
|
// Con_DPrintf ("nopredict\n");
|
||||||
} else {
|
} else {
|
||||||
// predict players movement
|
// predict players movement
|
||||||
state->command.msec = msec = min (msec, 255);
|
state->command.msec = msec = min (msec, 255);
|
||||||
// Con_DPrintf ("predict: %i\n", msec);
|
// Con_DPrintf ("predict: %i\n", msec);
|
||||||
|
|
||||||
CL_PredictUsercmd (state, &exact, &state->command, false);
|
CL_PredictUsercmd (state, &exact, &state->command, false);
|
||||||
VectorCopy (exact.origin, pplayer->origin);
|
VectorCopy (exact.origin, pplayer->origin);
|
||||||
|
|
|
@ -83,7 +83,7 @@ startup (void)
|
||||||
|
|
||||||
// allocate named semaphore on client so front end can tell if it's alive
|
// allocate named semaphore on client so front end can tell if it's alive
|
||||||
|
|
||||||
// mutex will fail if semephore allready exists
|
// mutex will fail if semaphore already exists
|
||||||
qwclsemaphore = CreateMutex (NULL, /* Security attributes */
|
qwclsemaphore = CreateMutex (NULL, /* Security attributes */
|
||||||
0, /* owner */
|
0, /* owner */
|
||||||
"qwcl"); /* Semaphore name */
|
"qwcl"); /* Semaphore name */
|
||||||
|
|
|
@ -138,8 +138,6 @@ CL_Init_Entity (entity_t *ent)
|
||||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
|
||||||
ent->colormod[3] = 1.0;
|
ent->colormod[3] = 1.0;
|
||||||
ent->scale = 1.0;
|
ent->scale = 1.0;
|
||||||
ent->glow_size = 0.0;
|
|
||||||
ent->glow_color = 254;
|
|
||||||
ent->pose1 = ent->pose2 = -1;
|
ent->pose1 = ent->pose2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -812,7 +812,7 @@ SVC_DirectConnect (void)
|
||||||
} else
|
} else
|
||||||
newcl->userinfo = userinfo;
|
newcl->userinfo = userinfo;
|
||||||
|
|
||||||
// if there is allready a slot for this ip, drop it
|
// if there is already a slot for this ip, drop it
|
||||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||||
if (cl->state == cs_free)
|
if (cl->state == cs_free)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -190,7 +190,7 @@ function that has been executed.
|
||||||
|
|
||||||
afunc ( 4, bfunc(1,2,3));
|
afunc ( 4, bfunc(1,2,3));
|
||||||
will fail because there is a shared parameter marshaling area, which will
|
will fail because there is a shared parameter marshaling area, which will
|
||||||
cause the 1 from bfunc to overwrite the 4 allready placed in parm0. When
|
cause the 1 from bfunc to overwrite the 4 already placed in parm0. When
|
||||||
a function is called, it copies the parms from the globals into it's
|
a function is called, it copies the parms from the globals into it's
|
||||||
privately scoped variables, so there is no collision when calling another
|
privately scoped variables, so there is no collision when calling another
|
||||||
function.
|
function.
|
||||||
|
|
Loading…
Reference in a new issue