diff --git a/include/QF/render.h b/include/QF/render.h index f2223194f..73e5d1226 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -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; diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index bc28c4b5d..b92d719d9 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -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) diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index b48ab0023..76bba1730 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -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: diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index bab88139a..e62ca8e2d 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -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) { diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index d21021c9e..2a966bfbb 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -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; diff --git a/libs/video/targets/vid_common_sw32.c b/libs/video/targets/vid_common_sw32.c index afeeb68c7..fe58cf32f 100644 --- a/libs/video/targets/vid_common_sw32.c +++ b/libs/video/targets/vid_common_sw32.c @@ -42,7 +42,6 @@ static const char rcsid[] = unsigned short d_8to16table[256]; -unsigned int d_8to24table[256]; unsigned char d_15to8table[65536]; diff --git a/libs/video/targets/vid_mgl.c b/libs/video/targets/vid_mgl.c index 7fa4bd871..2b285fcb4 100644 --- a/libs/video/targets/vid_mgl.c +++ b/libs/video/targets/vid_mgl.c @@ -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; diff --git a/libs/video/targets/vid_null.c b/libs/video/targets/vid_null.c index ddec95e43..af71b4e93 100644 --- a/libs/video/targets/vid_null.c +++ b/libs/video/targets/vid_null.c @@ -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) diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 81cb15b58..b23604c49 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -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); } diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index bd6ae20dd..f9619ea2b 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -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; } diff --git a/qw/include/client.h b/qw/include/client.h index 90ce75469..1c16ade18 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -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 diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index 83fbd45f1..935a08a45 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -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); diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index 8a96ab11b..45d6bd6ad 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -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 */ diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index 61c56f921..ef1db122e 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -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; } diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index b480456f2..fd5813738 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -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; diff --git a/tools/qfcc/doc/qcc.txt b/tools/qfcc/doc/qcc.txt index 60a858061..3d3a62535 100644 --- a/tools/qfcc/doc/qcc.txt +++ b/tools/qfcc/doc/qcc.txt @@ -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.