1
0
Fork 0
forked from fte/fteqw

csqc is now working in some ways. Hash tables use renamed functions, and a few other changes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@871 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-02-09 19:32:09 +00:00
parent ae4a835df1
commit cb487034e9
17 changed files with 232 additions and 121 deletions

View file

@ -1288,7 +1288,7 @@ void CL_LinkPacketEntities (void)
s1 = &pack->entities[pnum];
//bots or powerup glows. Bots always glow, powerups can be disabled
if (s1->modelindex == cl_playerindex || r_powerupglow.value);
if (s1->modelindex != cl_playerindex && r_powerupglow.value);
{
flicker = r_lightflicker.value?(rand()&31):0;
// spawn light flashes, even ones coming from invisible objects
@ -2065,7 +2065,7 @@ void CL_LinkPlayers (void)
continue; // not present this frame
// spawn light flashes, even ones coming from invisible objects
if (!r_flashblend.value || j != cl.playernum[0])
if ((!r_flashblend.value || j != cl.playernum[0]) && r_powerupglow.value)
{
if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED))
CL_NewDlight (j+1, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 3)->noppl = (j != cl.playernum[0]);

View file

@ -344,7 +344,9 @@ void CL_SendConnectPacket (
fteprotextsupported |= PEXT_FLOATCOORDS;
#endif
fteprotextsupported |= PEXT_SPAWNSTATIC2;
#ifdef PEXT_SEEF1
fteprotextsupported |= PEXT_SEEF1;
#endif
fteprotextsupported |= PEXT_SPLITSCREEN;
fteprotextsupported |= PEXT_HEXEN2;
fteprotextsupported |= PEXT_CUSTOMTEMPEFFECTS;
@ -848,8 +850,10 @@ void CL_Disconnect (void)
#ifdef VM_CG
CG_Stop();
#endif
// if running a local server, shut it down
#ifdef CSQC_DAT
CSQC_Shutdown();
#endif
// if running a local server, shut it down
if (cls.demoplayback != DPB_NONE)
CL_StopPlayback ();
else if (cls.state != ca_disconnected)

View file

@ -791,8 +791,6 @@ void Model_NextDownload (void)
}
#endif
Hunk_Check();
cls.downloadtype = dl_model;
for (
@ -819,8 +817,6 @@ Hunk_Check();
return;
}
Hunk_Check();
if (cl.playernum[0] == -1)
{ //q2 cinematic - don't load the models.
cl.worldmodel = cl.model_precache[1] = Mod_ForName ("", false);
@ -1624,6 +1620,9 @@ void CL_ParseServerData (void)
#ifdef VM_CG
CG_Stop();
#endif
#ifdef CSQC_DAT
CSQC_Shutdown();
#endif
}
void CLQ2_ParseServerData (void)
@ -1882,6 +1881,9 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
Cache_Report (); // print remaining memory
#ifdef VM_CG
CG_Start();
#endif
#ifdef CSQC_DAT
CSQC_Init();
#endif
break;

View file

@ -344,7 +344,9 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
ent.lerpfrac = ent.lerptime = q3->backlerp;
ent.alpha = 1;
ent.scale = 1;
ent.forcedshader = q3->customShader;
*(int*)ent.shaderRGBA = *(int*)q3->shaderRGBA;
ent.shaderTime = q3->shaderTime;
if (q3->renderfx & Q3RF_DEPTHHACK)
ent.flags |= Q2RF_DEPTHHACK;
if (q3->renderfx & Q3RF_THIRD_PERSON)
@ -468,6 +470,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
r_refdef.vrect.y = ref->y;
r_refdef.vrect.width = ref->width;
r_refdef.vrect.height = ref->height;
r_refdef.time = ref->time/1000.0f;
memcpy(cl.q2frame.areabits, ref->areamask, sizeof(cl.q2frame.areabits));
#ifdef RGLQUAKE
@ -498,6 +501,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
#endif
vid.recalc_refdef = 1;
r_refdef.time = 0;
}

View file

@ -8,6 +8,7 @@
progfuncs_t *csqcprogs;
//note: doesn't even have to match the clprogs.dat :)
typedef struct {
//CHANGING THIS STRUCTURE REQUIRES CHANGES IN CSQC_InitFields
//fields the client will pull out of the edict for rendering.
@ -22,9 +23,11 @@ typedef struct {
float frame;
float oldframe;
float lerpfrac;
float drawmask; //drawentities uses this mask for it.
} csqcentvars_t;
typedef struct menuedict_s
typedef struct csqcedict_s
{
qboolean isfree;
float freetime; // sv.time when the object was freed
@ -54,6 +57,7 @@ void CSQC_InitFields(void)
fieldfloat(oldframe);
fieldfloat(lerpfrac);
fieldfloat(drawmask);
}
#define RETURN_SSTRING(s) (*(char **)&((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
@ -115,6 +119,18 @@ void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
//these functions are from pr_menu.dat
void PF_CL_is_cached_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_precache_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_free_pic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_fclose_progs (progfuncs_t *prinst);
char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_globals);
@ -181,20 +197,57 @@ static void PF_R_AddEntity(progfuncs_t *prinst, struct globalvars_s *pr_globals)
V_AddEntity(&ent);
}
#define MASK_ENGINE 1
static void PF_R_AddEntityMask(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int mask = G_FLOAT(OFS_PARM0);
csqcedict_t *ent;
int e;
for (e=1; e < *prinst->parms->sv_num_edicts; e++)
{
ent = (void*)EDICT_NUM(prinst, e);
if (ent->isfree)
continue;
if ((int)ent->v.drawmask & mask)
{
G_INT(OFS_PARM0) = EDICT_TO_PROG(prinst, (void*)ent);
PF_R_AddEntity(prinst, pr_globals);
}
}
if (mask & MASK_ENGINE)
{
CL_EmitEntities();
}
}
float CalcFov (float fov_x, float width, float height);
//clear scene, and set up the default stuff.
static void PF_R_ClearScene (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
extern frame_t *view_frame;
extern player_state_t *view_message;
cl_numvisedicts = 0;
view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
view_message = &view_frame->playerstate[cl.playernum[0]];
V_CalcRefdef(0); //set up the defaults (for player 0)
/*
VectorCopy(cl.simangles[0], r_refdef.viewangles);
VectorCopy(cl.simorg[0], r_refdef.vieworg);
r_refdef.flags = 0;
r_refdef.fov_x = 90;
r_refdef.fov_y = 90;
r_refdef.vrect.x = 0;
r_refdef.vrect.y = 0;
r_refdef.vrect.width = vid.width;
r_refdef.vrect.height = vid.height;
r_refdef.fov_x = scr_fov.value;
r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
*/
}
static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -315,6 +368,8 @@ static void PF_R_SetViewFlag(progfuncs_t *prinst, struct globalvars_s *pr_global
static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
R_PushDlights ();
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
@ -491,8 +546,45 @@ PF_Fixme,
PF_Fixme,
//120
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme};
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
//130
PF_R_ClearScene,
PF_R_AddEntityMask,
PF_R_AddEntity,
PF_R_SetViewFlag,
PF_R_RenderScene,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
//140
PF_CL_is_cached_pic,//0
PF_CL_precache_pic,//1
PF_CL_free_pic,//2
PF_CL_drawcharacter,//3
PF_CL_drawstring,//4
PF_CL_drawpic,//5
PF_CL_drawfill,//6
PF_CL_drawsetcliparea,//7
PF_CL_drawresetcliparea,//8
PF_CL_drawgetimagesize,//9
};
int csqc_numbuiltins = sizeof(csqc_builtins)/sizeof(csqc_builtins[0]);
@ -522,7 +614,7 @@ void *VARGS PR_Malloc(int size); //these functions should be tracked by the libr
void VARGS PR_Free(void *mem);
//Any menu builtin error or anything like that will come here.
void VARGS CSQC_Abort (char *format, ...)
void VARGS CSQC_Abort (char *format, ...) //an error occured.
{
va_list argptr;
char string[1024];
@ -544,6 +636,16 @@ void VARGS CSQC_Abort (char *format, ...)
Host_EndGame("csqc error");
}
void CSQC_Shutdown(void)
{
if (csqcprogs)
{
CloseProgs(csqcprogs);
Con_Printf("Closed csqc\n");
}
csqcprogs = NULL;
}
void CSQC_FindGlobals(void)
{
csqc_time = (float*)PR_FindGlobal(csqcprogs, "time", 0);
@ -551,23 +653,23 @@ void CSQC_FindGlobals(void)
*csqc_time = Sys_DoubleTime();
csqc_init_function = PR_FindFunction(csqcprogs, "csqc_init", PR_ANY);
csqc_shutdown_function = PR_FindFunction(csqcprogs, "csqc_shutdown", PR_ANY);
csqc_draw_function = PR_FindFunction(csqcprogs, "csqc_draw", PR_ANY);
csqc_keydown_function = PR_FindFunction(csqcprogs, "csqc_keydown", PR_ANY);
csqc_keyup_function = PR_FindFunction(csqcprogs, "csqc_keyup", PR_ANY);
csqc_toggle_function = PR_FindFunction(csqcprogs, "csqc_toggle", PR_ANY);
csqc_init_function = PR_FindFunction(csqcprogs, "CSQC_Init", PR_ANY);
csqc_shutdown_function = PR_FindFunction(csqcprogs, "CSQC_Shutdown", PR_ANY);
csqc_draw_function = PR_FindFunction(csqcprogs, "CSQC_UpdateView", PR_ANY);
csqc_keydown_function = PR_FindFunction(csqcprogs, "CSQC_KeyDown", PR_ANY);
csqc_keyup_function = PR_FindFunction(csqcprogs, "CSQC_KeyUp", PR_ANY);
}
double csqctime;
void CSQC_Init (void)
{
CSQC_Shutdown();
if (!qrenderer)
{
return;
}
csqcprogparms.progsversion = PROGSTRUCT_VERSION;
csqcprogparms.ReadFile = COM_LoadStackFile;//char *(*ReadFile) (char *fname, void *buffer, int *len);
csqcprogparms.FileSize = COM_FileSize;//int (*FileSize) (char *fname); //-1 if file does not exist
@ -614,11 +716,13 @@ void CSQC_Init (void)
if (PR_LoadProgs(csqcprogs, "csprogs.dat", 0, NULL, 0) < 0) //no per-progs builtins.
{
CSQC_Shutdown();
//failed to load or something
return;
}
if (setjmp(csqc_abort))
{
CSQC_Shutdown();
return;
}
@ -632,6 +736,8 @@ void CSQC_Init (void)
if (csqc_init_function)
PR_ExecuteProgram(csqcprogs, csqc_init_function);
Con_Printf("Loaded csqc\n");
}
}
@ -640,9 +746,15 @@ qboolean CSQC_DrawView(void)
if (!csqc_draw_function || !csqcprogs)
return false;
R_LessenStains();
PR_ExecuteProgram(csqcprogs, csqc_draw_function);
return true;
}
void CSQC_ParseEntities(void)
{
}
#endif

View file

@ -44,6 +44,7 @@ typedef struct entity_s
vec3_t axis[3];
byte_vec4_t shaderRGBA;
float shaderTime;
vec3_t oldorigin;
vec3_t oldangles;
@ -73,6 +74,10 @@ typedef struct entity_s
int flags;
#ifdef Q3SHADERS
struct shader_s *forcedshader;
#endif
#ifdef PEXT_SCALE
float scale;
#endif
@ -124,6 +129,8 @@ typedef struct
int flags;
int currentplayernum;
float time;
} refdef_t;

View file

@ -94,9 +94,6 @@ cvar_t r_stainfadetime = {"r_stainfadetime", "1"};
cvar_t r_stainfadeammount = {"r_stainfadeammount", "1"};
cvar_t _windowed_mouse = {"_windowed_mouse","1"};
cvar_t _vid_default_mode = {"_vid_default_mode","0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
// Note that 3 is MODE_FULLSCREEN_DEFAULT
cvar_t _vid_default_mode_win = {"_vid_default_mode_win","3", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
cvar_t vid_wait = {"vid_wait","0"};
cvar_t vid_nopageflip = {"vid_nopageflip","0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
cvar_t _vid_wait_override = {"_vid_wait_override", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
@ -113,6 +110,7 @@ static cvar_t vid_width = {"vid_width", "640", NULL, CVAR_ARCHIVE|CVAR_RENDERERL
static cvar_t vid_height = {"vid_height", "480", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
static cvar_t vid_refreshrate = {"vid_displayfrequency", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH};
cvar_t gl_fontedgeclamp = {"gl_fontedgeclamp", "0"}; //gl blends. Set this to 1 to stop the outside of your conchars from being visible
cvar_t gl_font = {"gl_font", ""};
cvar_t gl_conback = {"gl_conback", ""};
cvar_t gl_smoothfont = {"gl_smoothfont", "1"};
@ -295,6 +293,7 @@ void GLRenderer_Init(void)
Cvar_Register (&vid_conwidth, GLRENDEREROPTIONS);
Cvar_Register (&vid_conheight, GLRENDEREROPTIONS);
Cvar_Register (&gl_fontedgeclamp, GRAPHICALNICETIES);
Cvar_Register (&gl_font, GRAPHICALNICETIES);
Cvar_Register (&gl_conback, GRAPHICALNICETIES);
Cvar_Register (&gl_smoothfont, GRAPHICALNICETIES);
@ -444,8 +443,6 @@ void Renderer_Init(void)
Cvar_Register (&vid_wait, VIDCOMMANDGROUP);
Cvar_Register (&vid_nopageflip, VIDCOMMANDGROUP);
Cvar_Register (&_vid_wait_override, VIDCOMMANDGROUP);
Cvar_Register (&_vid_default_mode, VIDCOMMANDGROUP);
Cvar_Register (&_vid_default_mode_win, VIDCOMMANDGROUP);
Cvar_Register (&vid_stretch, VIDCOMMANDGROUP);
Cvar_Register (&_windowed_mouse, VIDCOMMANDGROUP);
Cvar_Register (&vid_renderer, VIDCOMMANDGROUP);

View file

@ -491,6 +491,9 @@ void Skin_NextDownload (void)
if (cls.state != ca_active)
{ // get next signon phase
#ifdef CSQC_DAT
CSQC_Init();
#endif
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message,
va("begin %i", cl.servercount));

View file

@ -68,7 +68,7 @@ int SNDDMA_Init(soundcardinfo_t *sc)
}
Con_Printf("SDL AUDIO INITING\n");
if(SDL_InitSubSystem(SDL_INIT_AUDIO))
if(SDL_InitSubSystem(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE))
{
Con_Print("Couldn't initialize SDL audio subsystem\n");
return false;

View file

@ -1099,9 +1099,9 @@ void V_CalcRefdef (int pnum)
if (!cls.q2server)
#endif
{
if (view_message->flags & PF_GIB)
if (view_message && view_message->flags & PF_GIB)
r_refdef.vieworg[2] += 8; // gib view height
else if (view_message->flags & PF_DEAD)
else if (view_message && view_message->flags & PF_DEAD)
r_refdef.vieworg[2] -= 16; // corpse view height
else
r_refdef.vieworg[2] += cl.viewheight[pnum];
@ -1109,7 +1109,7 @@ void V_CalcRefdef (int pnum)
r_refdef.vieworg[2] += cl.crouch[pnum];
}
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
if (view_message && view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
{
if (!cl.spectator || !cl_chasecam.value)
r_refdef.viewangles[ROLL] = 80; // dead view angle
@ -1149,16 +1149,18 @@ void V_CalcRefdef (int pnum)
view->model = NULL;
else
#endif
if (view_message->flags & (PF_GIB|PF_DEAD) )
if (view_message && view_message->flags & (PF_GIB|PF_DEAD) )
view->model = NULL;
else
view->model = cl.model_precache[cl.stats[pnum][STAT_WEAPON]];
view->frame = view_message->weaponframe;
view->frame = view_message?view_message->weaponframe:0;
view->colormap = vid.colormap;
// set up the refresh position
r_refdef.viewangles[PITCH] += cl.punchangle[pnum];
r_refdef.time = realtime;
// smooth out stair step ups

View file

@ -2651,7 +2651,7 @@ static void CL_Say (qboolean team, char *extra)
#ifdef Q3CLIENT
if (cls.q2server==2)
{
CL_SendClientCommand("%s %s%s", team ? "say_team " : "say ", extra?extra:"", sendtext);
CLQ3_SendClientCommand("%s %s%s", team ? "say_team " : "say ", extra?extra:"", sendtext);
return;
}
#endif

View file

@ -1550,7 +1550,7 @@ void Cmd_ForwardToServer (void)
#ifdef Q3CLIENT
if (cls.q2server == 2)
{
CL_SendClientCommand("%s %s", Cmd_Argv(0), Cmd_Args());
CLQ3_SendClientCommand("%s %s", Cmd_Argv(0), Cmd_Args());
return;
}
#endif
@ -1588,7 +1588,7 @@ void Cmd_ForwardToServer_f (void)
#ifdef Q3CLIENT
if (cls.q2server == 2)
{
CL_SendClientCommand("%s", Cmd_Args());
CLQ3_SendClientCommand("%s", Cmd_Args());
return;
}
#endif

View file

@ -45,33 +45,8 @@
char *MD5_GetPop3APOPString(char *timestamp, char *secrit);
#define HASH_FILESYSTEM
#ifdef HASH_FILESYSTEM
//#include "hash.h"
#define Hash_BytesForBuckets(b) (sizeof(bucket_t)*b)
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
typedef struct bucket_s {
void *data;
char *keystring;
struct bucket_s *next;
} bucket_t;
typedef struct hashtable_s {
int numbuckets;
bucket_t **bucket;
} hashtable_t;
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
int Hash_Key(char *name, int modulus);
void *Hash_Get(hashtable_t *table, char *name);
void *Hash_GetKey(hashtable_t *table, int key);
void *Hash_GetNext(hashtable_t *table, char *name, void *old);
void *Hash_Add(hashtable_t *table, char *name, void *data);
void *Hash_Add2(hashtable_t *table, char *name, void *data, bucket_t *buck);
void *Hash_AddKey(hashtable_t *table, int key, void *data);
void Hash_Remove(hashtable_t *table, char *name);
#endif
#include "hash.h"
@ -100,7 +75,7 @@ qboolean POP3_IsMessageUnique(char *hash)
buf = Z_Malloc(sizeof(bucket_t) + strlen(hash)+1);
strcpy(buf+sizeof(bucket_t), hash);
hash = buf+sizeof(bucket_t);
Hash_Add2(&pop3msghash, hash, hash, (bucket_t *)buf);
Hash_Add(&pop3msghash, hash, hash, (bucket_t *)buf);
return true;
}

View file

@ -17,33 +17,8 @@ char *MD5_GetPop3APOPString(char *timestamp, char *secrit);
#define HASH_FILESYSTEM
#ifdef HASH_FILESYSTEM
//#include "hash.h"
#define Hash_BytesForBuckets(b) (sizeof(bucket_t)*b)
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
typedef struct bucket_s {
void *data;
char *keystring;
struct bucket_s *next;
} bucket_t;
typedef struct hashtable_s {
int numbuckets;
bucket_t **bucket;
} hashtable_t;
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
int Hash_Key(char *name, int modulus);
void *Hash_Get(hashtable_t *table, char *name);
void *Hash_GetKey(hashtable_t *table, int key);
void *Hash_GetNext(hashtable_t *table, char *name, void *old);
void *Hash_Add(hashtable_t *table, char *name, void *data);
void *Hash_Add2(hashtable_t *table, char *name, void *data, bucket_t *buck);
void *Hash_AddKey(hashtable_t *table, int key, void *data);
void Hash_Remove(hashtable_t *table, char *name);
#endif
#include "hash.h"
@ -247,7 +222,7 @@ static int SV_POP3_AddMessage(char *filename, int flags, void *incl)
cl->totalsize+=msg->size;
cl->nummessages++;
Hash_Add2(&cl->emails, va("%i", ++cl->nummessages), msg, &msg->bucket);
Hash_Add(&cl->emails, va("%i", ++cl->nummessages), msg, &msg->bucket);
return true;
}

View file

@ -669,7 +669,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_
//colourmap isn't present yet.
cm = BZ_Malloc(sizeof(*cm));
Q_strncpyz(cm->name, skinname, sizeof(cm->name));
Hash_Add2(&skincolourmapped, cm->name, cm, &cm->bucket);
Hash_Add(&skincolourmapped, cm->name, cm, &cm->bucket);
cm->colour = cc;
cm->skinnum = e->skinnum;
cm->texnum.fullbright = 0;
@ -945,7 +945,7 @@ static void R_DrawShadowVolume(mesh_t *mesh)
qglEnd();
}
void GL_DrawAliasMesh_Sketch (mesh_t *mesh, int texnum)
void GL_DrawAliasMesh_Sketch (mesh_t *mesh)
{
int i;
extern int gldepthfunc;
@ -1402,19 +1402,46 @@ void R_DrawGAliasModel (entity_t *e)
qglEnable(GL_PN_TRIANGLES_ATI);
memset(&mesh, 0, sizeof(mesh));
while(inf)
for(; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)))
{
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha) && r_vertexdlights.value)
R_GAliasAddDlights(&mesh, e->origin, e->angles);
skin = GL_ChooseSkin(inf, clmodel->name, e);
c_alias_polys += mesh.numindexes/3;
if (r_drawflat.value == 2)
GL_DrawAliasMesh_Sketch(&mesh, skin->base);
else if (!skin)
{
GL_DrawAliasMesh_Sketch(&mesh);
continue;
}
#ifdef Q3SHADERS
else if (currententity->forcedshader)
{
meshbuffer_t mb;
R_IBrokeTheArrays();
mb.entity = &r_worldentity;
mb.shader = currententity->forcedshader;
mb.fog = NULL;
mb.mesh = &mesh;
mb.infokey = currententity->keynum;
mb.dlightbits = 0;
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED | MF_COLORS);
R_RenderMeshBuffer ( &mb, false );
continue;
}
#endif
skin = GL_ChooseSkin(inf, clmodel->name, e);
if (!skin)
{
qglEnable(GL_TEXTURE_2D);
GL_DrawAliasMesh_Sketch(&mesh, 1);
GL_DrawAliasMesh_Sketch(&mesh);
}
#ifdef Q3SHADERS
else if (skin->shader)
@ -1452,10 +1479,6 @@ void R_DrawGAliasModel (entity_t *e)
GL_DrawAliasMesh(&mesh, skin->fullbright);
}
}
if (inf->nextsurf)
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
else
inf = NULL;
}
if (qglPNTrianglesfATI && gl_ati_truform.value)

View file

@ -2593,15 +2593,11 @@ void R_RenderMeshBuffer ( meshbuffer_t *mb, qboolean shadowpass )
shader = mb->shader;
r_lmtex = mb->infokey;
#ifdef FIZME
if ( currententity && !gl_state.in2d ) {
r_localShaderTime = r_refdef.time * 0.001f - currententity->shaderTime;
r_localShaderTime = r_refdef.time - currententity->shaderTime;
} else {
r_localShaderTime = Sys_Milliseconds() * 0.001f;
r_localShaderTime = realtime;
}
#else
r_localShaderTime = realtime;
#endif
R_SetShaderState ( shader );

View file

@ -35,7 +35,7 @@ vec4_t draw_mesh_xyz[4];
vec3_t draw_mesh_normals[4];
vec2_t draw_mesh_st[4];
vec2_t draw_mesh_lmst[4];
//byte_vec4_t draw_mesh_colors[4];
byte_vec4_t draw_mesh_colors[4];
qbyte *uploadmemorybuffer;
int sizeofuploadmemorybuffer;
@ -59,7 +59,7 @@ extern cvar_t gl_lerpimages;
extern cvar_t gl_picmip2d;
extern cvar_t r_drawdisk;
extern cvar_t gl_compress;
extern cvar_t gl_font, gl_conback, gl_smoothfont;
extern cvar_t gl_font, gl_conback, gl_smoothfont, gl_fontedgeclamp;
extern cvar_t gl_savecompressedtex;
@ -74,7 +74,8 @@ int char_texture, char_tex2, default_char_texture;
int cs_texture; // crosshair texture
extern int detailtexture;
float char_instep, default_char_instep; //to avoid blending issues
float custom_char_instep, default_char_instep; //to avoid blending issues
float char_instep;
static unsigned cs_data[16*16];
@ -827,9 +828,9 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
default_char_texture=char_texture;
//half a pixel
if (image_width)
char_instep = default_char_instep = 0.5f/((image_width+image_height)/2); //you're an idiot if you use non-square conchars
custom_char_instep = default_char_instep = 0.5f/((image_width+image_height)/2); //you're an idiot if you use non-square conchars
else
char_instep = default_char_instep = 0.5f/(128);
custom_char_instep = default_char_instep = 0.5f/(128);
TRACE(("dbg: GLDraw_ReInit: loaded charset\n"));
@ -1912,12 +1913,13 @@ void GL_Set2D (void)
if (!*gl_font.string || !(char_texture=Mod_LoadHiResTexture(va("fonts/%s", gl_font.string), false, true, true)))
{
char_texture = default_char_texture;
char_instep = default_char_instep;
custom_char_instep = default_char_instep;
}
else
char_instep = 0.5f/((image_width+image_height)/2);
custom_char_instep = 0.5f/((image_width+image_height)/2);
gl_smoothfont.modified = 1;
gl_smoothfont.modified = true;
gl_fontedgeclamp.modified = true;
}
if (gl_conback.modified)
{
@ -1932,6 +1934,15 @@ void GL_Set2D (void)
}
}
if (gl_fontedgeclamp.modified)
{
if (gl_fontedgeclamp.value)
char_instep = custom_char_instep;
else
char_instep = 0;
gl_fontedgeclamp.modified = false;
}
if (gl_smoothfont.modified)
{
gl_smoothfont.modified = false;
@ -3308,7 +3319,7 @@ TRACE(("dbg: GL_LoadTexture: new %s\n", identifier));
glt->bpp = 8;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
GL_Bind(texture_extension_number );
@ -3350,7 +3361,7 @@ int GL_LoadTextureFB (char *identifier, int width, int height, qbyte *data, qboo
glt->bpp = 8;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
GL_Bind(texture_extension_number );
@ -3385,7 +3396,7 @@ int GL_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data,
glt->bpp = 24;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
GL_Bind(texture_extension_number );
@ -3421,7 +3432,7 @@ int GL_LoadTexture32 (char *identifier, int width, int height, unsigned *data, q
glt->bpp = 32;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
// if (!isDedicated)
{
@ -3470,7 +3481,7 @@ int GL_LoadCompressed(char *name)
glt->texnum = texture_extension_number;
glt->bpp = 32;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
GL_Bind(texture_extension_number );
@ -3507,7 +3518,7 @@ int GL_LoadTexture8Grey (char *identifier, int width, int height, unsigned char
glt->bpp = 8;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
// if (!isDedicated)
{
@ -3551,7 +3562,7 @@ int GL_LoadTexture8Bump (char *identifier, int width, int height, unsigned char
glt->bpp = 8;
glt->mipmap = mipmap;
Hash_Add2(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
Hash_Add(&gltexturetable, glt->identifier, glt, (bucket_t*)(glt+1));
// if (!isDedicated)
{