QSG2 glows almost working. Plus lots of typos killed.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-06-18 21:41:24 +00:00
parent f90f78990a
commit c8bc5dfb4c
16 changed files with 96 additions and 84 deletions

View file

@ -85,8 +85,6 @@ typedef struct entity_s
// found in an active leaf
float colormod[4]; // color tint and alpha for 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
int trivial_accept;

View file

@ -510,7 +510,7 @@ int loadsize;
COM_LoadFile
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 *
COM_LoadFile (const char *path, int usehunk)

View file

@ -97,7 +97,7 @@ Con_Printf ();
net
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:

View file

@ -43,20 +43,22 @@ static const char rcsid[] =
#include "compat.h"
#include "view.h"
/* Software and hardware gamma support */
byte gammatable[256];
cvar_t *vid_gamma;
cvar_t *vid_system_gamma;
cvar_t *vid_gamma;
cvar_t *vid_system_gamma;
qboolean vid_gamma_avail; // hardware gamma availability
unsigned int d_8to24table[256];
/* Screen size */
int scr_width, scr_height;
cvar_t *vid_width;
cvar_t *vid_height;
cvar_t *vid_width;
cvar_t *vid_height;
cvar_t *vid_fullscreen;
void
VID_GetWindowSize (int def_w, int def_h)
{

View file

@ -59,7 +59,6 @@ static const char rcsid[] =
#define WARP_HEIGHT 200
unsigned char d_15to8table[65536];
unsigned int d_8to24table[256];
QF_glActiveTextureARB qglActiveTexture = NULL;
QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL;

View file

@ -42,7 +42,6 @@ static const char rcsid[] =
unsigned short d_8to16table[256];
unsigned int d_8to24table[256];
unsigned char d_15to8table[65536];

View file

@ -139,8 +139,6 @@ static int VID_highhunkmark;
unsigned char vid_curpal[256 * 3];
unsigned int d_8to24table[256];
int driver = grDETECT, mode;
qboolean useWinDirect = true, useDirectDraw = true;
MGLDC *mgldc = NULL, *memdc = NULL, *dibdc = NULL, *windc = NULL;

View file

@ -42,7 +42,6 @@ byte vid_buffer[BASEWIDTH * BASEHEIGHT];
short zbuffer[BASEWIDTH * BASEHEIGHT];
byte surfcache[256 * 1024];
unsigned int d_8to24table[256];
void
VID_SetPalette (unsigned char *palette)

View file

@ -365,13 +365,10 @@ CL_ParseUpdate (int bits)
else
forcelink = false;
if (forcelink) {
// FIXME: do this right (ie, protocol support)
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
if (forcelink) { // FIXME: do this right (ie, protocol support)
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
ent->colormod[3] = 1.0;
ent->scale = 1.0;
ent->glow_size = 0.0;
ent->glow_color = 254;
}
state->msgtime = cl.mtime[0];
@ -626,13 +623,10 @@ CL_ParseStatic (void)
ent->frame = state.baseline.frame;
ent->colormap = vid.colormap8;
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[3] = state.baseline.alpha / 255.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);
}

View file

@ -133,8 +133,6 @@ CL_Init_Entity (entity_t *ent)
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
ent->colormod[3] = 1.0;
ent->scale = 1.0;
ent->glow_size = 0.0;
ent->glow_color = 254;
ent->pose1 = ent->pose2 = -1;
}

View file

@ -67,6 +67,13 @@ typedef struct player_state_s {
float waterjumptime;
int onground; // -1 = in air, else pmove entity number
int oldbuttons;
// QSG2
byte alpha;
byte scale;
byte glow_size;
byte glow_color;
byte colormod;
} player_state_t;
#undef MAX_SCOREBOARDNAME

View file

@ -88,7 +88,8 @@ CL_ClearEnts ()
}
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;
dlight_t *dl;
@ -97,36 +98,58 @@ CL_NewDlight (int key, vec3_t org, int effects)
static vec3_t blue = {0.05, 0.05, 0.5};
static vec3_t purple = {0.5, 0.05, 0.5};
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)))
return;
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT))) {
if (!glow_size)
return;
}
dl = R_AllocDlight (key);
if (!dl)
return;
VectorCopy (org, dl->origin);
radius = 200 + (rand () & 31);
if (effects & EF_BRIGHTLIGHT) {
radius += 200;
dl->origin[2] += 16;
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
radius = 200 + (rand () & 31);
if (effects & EF_BRIGHTLIGHT) {
radius += 200;
dl->origin[2] += 16;
}
if (effects & EF_DIMLIGHT)
if (effects & ~EF_DIMLIGHT)
radius -= 100;
dl->radius = radius;
dl->die = cl.time + 0.1; // FIXME: killing a merged dlight is bad?
switch (effects & (EF_RED | EF_BLUE)) {
case EF_RED | EF_BLUE:
VectorCopy (purple, dl->color);
break;
case EF_RED:
VectorCopy (red, dl->color);
break;
case EF_BLUE:
VectorCopy (blue, dl->color);
break;
default:
VectorCopy (normal, dl->color);
break;
}
}
if (effects & EF_DIMLIGHT)
if (effects & ~EF_DIMLIGHT)
radius -= 100;
dl->radius = radius;
dl->die = cl.time + 0.1;
switch (effects & (EF_RED | EF_BLUE)) {
case EF_RED | EF_BLUE:
VectorCopy (purple, dl->color);
break;
case EF_RED:
VectorCopy (red, dl->color);
break;
case EF_BLUE:
VectorCopy (blue, dl->color);
break;
default:
VectorCopy (normal, dl->color);
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;
}
}
}
}
@ -411,7 +434,8 @@ CL_LinkPacketEntities (void)
s1 = &pack->entities[pnum];
// 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 (!s1->modelindex)
@ -477,9 +501,6 @@ CL_LinkPacketEntities (void)
}
(*ent)->colormod[3] = s1->alpha / 255.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]
// set skin
@ -516,7 +537,7 @@ CL_LinkPacketEntities (void)
dl = R_AllocDlight (-s1->number);
if (dl) {
VectorCopy ((*ent)->origin, dl->origin);
dl->radius = 200;
dl->radius = 200.0;
dl->die = cl.time + 0.1;
VectorCopy (r_firecolor->vec, dl->color);
}
@ -742,7 +763,6 @@ CL_LinkPlayers (void)
{
double playertime;
int msec, oldphysent, i, j;
//entity_t **_ent;
entity_t *ent;
frame_t *frame;
player_info_t *info;
@ -767,17 +787,6 @@ CL_LinkPlayers (void)
if (!info->name[0])
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
if (j == cl.playernum) {
if (!Cam_DrawPlayer (-1)) // XXX
@ -787,6 +796,14 @@ CL_LinkPlayers (void)
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)
continue;
@ -818,9 +835,7 @@ CL_LinkPlayers (void)
{
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3;
ent->angles[YAW] = cl.viewangles[YAW];
}
else
{
} else {
ent->angles[PITCH] = -state->viewangles[PITCH] / 3;
ent->angles[YAW] = state->viewangles[YAW];
}
@ -847,13 +862,18 @@ CL_LinkPlayers (void)
ent->skin = NULL;
}
// LordHavoc: more QSG VERSION 2 stuff, FIXME: players don't have
// extend stuff
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
ent->colormod[3] = 1.0;
ent->scale = 1.0;
ent->glow_size = 0.0;
ent->glow_color = 254;
// QSG2
if (state->colormod == 255) {
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0;
} else {
ent->colormod[0] = (float) ((state->colormod >> 5) & 7) *
(1.0 / 7.0);
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)
CL_AddFlagModels (ent, 0, j);
@ -960,11 +980,11 @@ CL_SetUpPlayerPrediction (qboolean dopred)
msec = 500 * (playertime - state->state_time);
if (msec <= 0 || !dopred) {
VectorCopy (state->origin, pplayer->origin);
// Con_DPrintf ("nopredict\n");
// Con_DPrintf ("nopredict\n");
} else {
// predict players movement
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);
VectorCopy (exact.origin, pplayer->origin);

View file

@ -83,7 +83,7 @@ startup (void)
// 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 */
0, /* owner */
"qwcl"); /* Semaphore name */

View file

@ -138,8 +138,6 @@ CL_Init_Entity (entity_t *ent)
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] =
ent->colormod[3] = 1.0;
ent->scale = 1.0;
ent->glow_size = 0.0;
ent->glow_color = 254;
ent->pose1 = ent->pose2 = -1;
}

View file

@ -812,7 +812,7 @@ SVC_DirectConnect (void)
} else
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++) {
if (cl->state == cs_free)
continue;

View file

@ -190,7 +190,7 @@ function that has been executed.
afunc ( 4, bfunc(1,2,3));
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
privately scoped variables, so there is no collision when calling another
function.