removed hunk memory (as well as -mem argument).
removed cache memory. added fallback normalmap texture. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4421 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
902a5adb26
commit
4a1416a5d2
80 changed files with 1519 additions and 3440 deletions
|
@ -940,7 +940,7 @@ static qintptr_t CG_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
break;
|
||||
|
||||
case CG_MEMORY_REMAINING:
|
||||
VM_LONG(ret) = Hunk_LowMemAvailable();
|
||||
VM_LONG(ret) = 1024*1024*8;//Hunk_LowMemAvailable();
|
||||
break;
|
||||
|
||||
case CG_MILLISECONDS:
|
||||
|
|
|
@ -1837,22 +1837,6 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
}
|
||||
}
|
||||
|
||||
static char *VARGS vahunk(char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
char *ret;
|
||||
|
||||
va_start (argptr, format);
|
||||
Q_vsnprintfz (string,sizeof(string), format,argptr);
|
||||
va_end (argptr);
|
||||
|
||||
ret = Hunk_Alloc(strlen(string)+1);
|
||||
strcpy(ret, string);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CL_SendCvar_f (void)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
@ -1876,6 +1860,7 @@ CL_InitInput
|
|||
*/
|
||||
void CL_InitInput (void)
|
||||
{
|
||||
static char pcmd[MAX_SPLITS][3][5];
|
||||
int sp;
|
||||
#define inputnetworkcvargroup "client networking options"
|
||||
cl.splitclients = 1;
|
||||
|
@ -1903,9 +1888,12 @@ void CL_InitInput (void)
|
|||
|
||||
for (sp = 0; sp < MAX_SPLITS; sp++)
|
||||
{
|
||||
Cmd_AddCommand (vahunk("p%i", sp+1), CL_Split_f);
|
||||
Cmd_AddCommand (vahunk("+p%i", sp+1), CL_Split_f);
|
||||
Cmd_AddCommand (vahunk("-p%i", sp+1), CL_Split_f);
|
||||
Q_snprintfz(pcmd[sp][0], sizeof(pcmd[sp][0]), "p%i", sp+1);
|
||||
Q_snprintfz(pcmd[sp][1], sizeof(pcmd[sp][1]), "+p%i", sp+1);
|
||||
Q_snprintfz(pcmd[sp][2], sizeof(pcmd[sp][2]), "-p%i", sp+1);
|
||||
Cmd_AddCommand (pcmd[sp][0], CL_Split_f);
|
||||
Cmd_AddCommand (pcmd[sp][1], CL_Split_f);
|
||||
Cmd_AddCommand (pcmd[sp][2], CL_Split_f);
|
||||
|
||||
/*default mlook to pressed, (on android we split the two sides of the screen)*/
|
||||
in_mlook.state[sp] = 1;
|
||||
|
|
|
@ -232,8 +232,6 @@ double realtime; // without any filtering or bounding
|
|||
double oldrealtime; // last frame run
|
||||
int host_framecount;
|
||||
|
||||
int host_hunklevel;
|
||||
|
||||
qbyte *host_basepal;
|
||||
qbyte *h2playertranslations;
|
||||
|
||||
|
@ -302,6 +300,8 @@ void CL_MakeActive(char *gamename)
|
|||
|
||||
SCR_EndLoadingPlaque();
|
||||
|
||||
Mod_Flush(false);
|
||||
|
||||
TP_ExecTrigger("f_spawn");
|
||||
}
|
||||
/*
|
||||
|
@ -1100,9 +1100,6 @@ void CL_ClearState (void)
|
|||
SV_UnspawnServer();
|
||||
Mod_ClearAll ();
|
||||
|
||||
if (host_hunklevel) // FIXME: check this...
|
||||
Hunk_FreeToLowMark (host_hunklevel);
|
||||
|
||||
Cvar_ApplyLatches(CVAR_LATCH);
|
||||
}
|
||||
|
||||
|
@ -4450,16 +4447,11 @@ void Host_Init (quakeparms_t *parms)
|
|||
if (setjmp (host_abort) )
|
||||
Sys_Error("Host_Init: An error occured. Try the -condebug commandline parameter\n");
|
||||
|
||||
if (COM_CheckParm ("-minmemory"))
|
||||
parms->memsize = MINIMUM_MEMORY;
|
||||
|
||||
host_parms = *parms;
|
||||
|
||||
if (parms->memsize < MINIMUM_MEMORY)
|
||||
Sys_Error ("Only %4.1f megs of memory reported, can't execute game", parms->memsize / (float)0x100000);
|
||||
|
||||
Cvar_Init();
|
||||
Memory_Init (parms->membase, parms->memsize);
|
||||
Memory_Init ();
|
||||
|
||||
/*memory is working, its safe to printf*/
|
||||
Con_Init ();
|
||||
|
@ -4523,9 +4515,6 @@ void Host_Init (quakeparms_t *parms)
|
|||
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
||||
//Con_TPrintf (TL_HEAPSIZE, parms->memsize/ (1024*1024.0));
|
||||
|
||||
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
||||
host_hunklevel = Hunk_LowMark ();
|
||||
|
||||
R_SetRenderer(NULL);//set the renderer stuff to unset...
|
||||
|
||||
host_initialized = true;
|
||||
|
|
|
@ -1128,7 +1128,6 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
|
|||
else
|
||||
#endif
|
||||
cl.model_precache[i] = Mod_ForName (cl.model_name[i], false);
|
||||
Hunk_Check();
|
||||
|
||||
S_ExtraUpdate();
|
||||
|
||||
|
@ -1189,7 +1188,6 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
|
|||
CSQC_LoadResource(cl.model_csqcname[i], "model");
|
||||
#endif
|
||||
cl.model_csqcprecache[i] = Mod_ForName (cl.model_csqcname[i], false);
|
||||
Hunk_Check();
|
||||
|
||||
S_ExtraUpdate();
|
||||
|
||||
|
@ -2999,7 +2997,6 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
|
|||
|
||||
case 3:
|
||||
CL_SendClientCommand(true, "begin");
|
||||
Cache_Report (); // print remaining memory
|
||||
#ifdef VM_CG
|
||||
CG_Start();
|
||||
#endif
|
||||
|
@ -3213,8 +3210,6 @@ void CL_ParseSoundlist (qboolean lots)
|
|||
{
|
||||
CL_AllowIndependantSendCmd(false); //stop it now, the indep stuff *could* require model tracing.
|
||||
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
cl.sendprespawn = true;
|
||||
}
|
||||
else
|
||||
|
@ -3308,8 +3303,6 @@ void CL_ParseModellist (qboolean lots)
|
|||
|
||||
CL_AllowIndependantSendCmd(false); //stop it now, the indep stuff *could* require model tracing.
|
||||
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
//set the flag to load models and send prespawn
|
||||
cl.sendprespawn = true;
|
||||
}
|
||||
|
|
|
@ -767,7 +767,7 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
|
|||
if (etype >= 0)
|
||||
{
|
||||
P_RunParticleEffectState (impact, normal, 1, etype, &(b->emitstate));
|
||||
if (cl_legacystains.ival) R_AddStain(end, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(end, -10, -10, -10, 20);
|
||||
}
|
||||
}
|
||||
void CL_ParseBeam (int tent)
|
||||
|
@ -848,7 +848,7 @@ void CL_ParseStream (int type)
|
|||
b->model = Mod_ForName("models/stice.mdl", true);
|
||||
b->flags |= 2;
|
||||
b->particleeffect = P_FindParticleType("te_stream_icechunks");
|
||||
if (cl_legacystains.ival) R_AddStain(end, -10, -10, 0, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(end, -10, -10, 0, 20);
|
||||
break;
|
||||
case TEH2_STREAM_SUNSTAFF1:
|
||||
b->model = Mod_ForName("models/stsunsf1.mdl", true);
|
||||
|
@ -867,7 +867,7 @@ void CL_ParseStream (int type)
|
|||
case TEH2_STREAM_SUNSTAFF2:
|
||||
b->model = Mod_ForName("models/stsunsf1.mdl", true);
|
||||
b->particleeffect = P_FindParticleType("te_stream_sunstaff2");
|
||||
if (cl_legacystains.ival) R_AddStain(end, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(end, -10, -10, -10, 20);
|
||||
break;
|
||||
case TEH2_STREAM_COLORBEAM:
|
||||
b->model = Mod_ForName("models/stclrbm.mdl", true);
|
||||
|
@ -943,7 +943,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, 0, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, 0, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_wizspike))
|
||||
P_RunParticleEffect (pos, vec3_origin, 20, 30);
|
||||
|
@ -956,7 +956,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_knightspike))
|
||||
P_RunParticleEffect (pos, vec3_origin, 226, 20);
|
||||
|
@ -969,7 +969,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_spikequad))
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_spike))
|
||||
|
@ -994,7 +994,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_spike))
|
||||
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
|
||||
|
@ -1018,7 +1018,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_superspikequad))
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike))
|
||||
|
@ -1044,7 +1044,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_superspike))
|
||||
if (P_RunParticleEffectType(pos, NULL, 2, pt_spike))
|
||||
|
@ -1073,7 +1073,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_bullet))
|
||||
if (P_RunParticleEffectType(pos, NULL, 10, pt_gunshot))
|
||||
|
@ -1097,7 +1097,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptfte_superbullet))
|
||||
if (P_RunParticleEffectType(pos, NULL, 2, ptfte_bullet))
|
||||
|
@ -1128,7 +1128,7 @@ void CL_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value)
|
||||
|
@ -1168,7 +1168,7 @@ void CL_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value)
|
||||
|
@ -1231,7 +1231,7 @@ void CL_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
|
||||
// light
|
||||
|
@ -1262,7 +1262,7 @@ void CL_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value)
|
||||
|
@ -1321,7 +1321,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptdp_gunshotquad))
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, pt_gunshot))
|
||||
|
@ -1337,7 +1337,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, cnt, pt_gunshot))
|
||||
P_RunParticleEffect (pos, vec3_origin, 0, 20*cnt);
|
||||
|
@ -1350,7 +1350,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, 0, -10, -10, 40);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, 0, -10, -10, 40);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, cnt, ptqw_blood))
|
||||
if (P_RunParticleEffectType(pos, NULL, cnt, ptdp_blood))
|
||||
|
@ -1363,7 +1363,7 @@ void CL_ParseTEnt (void)
|
|||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, 1, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, 1, -10, -10, 20);
|
||||
|
||||
if (P_RunParticleEffectType(pos, NULL, 1, ptqw_lightningblood))
|
||||
P_RunParticleEffect (pos, vec3_origin, 225, 50);
|
||||
|
@ -1519,7 +1519,7 @@ void CL_ParseTEnt (void)
|
|||
dl->color[2] = 1.0;
|
||||
|
||||
// stain (Hopefully this is close to how DP does it)
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 30);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 30);
|
||||
|
||||
if (P_ParticleTrail(pos, pos2, P_FindParticleType("te_plasmaburn"), 0, NULL))
|
||||
P_ParticleTrailIndex(pos, pos2, 15, 0, NULL);
|
||||
|
@ -1731,7 +1731,7 @@ void CL_SpawnCustomTEnd(custtentinst_t *info)
|
|||
|
||||
if (t->netstyle & CTE_STAINS)
|
||||
{ //added at pos2 - end of trail
|
||||
R_AddStain(info->pos2, t->stain[0], t->stain[1], t->stain[2], 40);
|
||||
Surf_AddStain(info->pos2, t->stain[0], t->stain[1], t->stain[2], 40);
|
||||
}
|
||||
if (t->netstyle & CTE_GLOWS)
|
||||
{ //added at pos1 firer's end.
|
||||
|
@ -2234,7 +2234,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blood))
|
||||
if (P_RunParticleEffectType(pos, dir, 1, ptqw_blood))
|
||||
P_RunParticleEffect(pos, dir, 0xe8, 60);
|
||||
if (cl_legacystains.ival) R_AddStain(pos, 0, -10, -10, 40);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, 0, -10, -10, 40);
|
||||
break;
|
||||
|
||||
case Q2TE_GUNSHOT: // bullet hitting wall
|
||||
|
@ -2247,7 +2247,7 @@ void CLQ2_ParseTEnt (void)
|
|||
else
|
||||
P_RunParticleEffect (pos, dir, 0xe0, 6);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
|
||||
if (type != Q2TE_SPARKS)
|
||||
{
|
||||
|
@ -2282,7 +2282,7 @@ void CLQ2_ParseTEnt (void)
|
|||
MSG_ReadDir (dir);
|
||||
P_RunParticleEffect (pos, dir, 0, 20);
|
||||
CL_SmokeAndFlash(pos);
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -10, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -10, -10, 20);
|
||||
break;
|
||||
|
||||
case Q2TE_SPLASH: // bullet hitting water
|
||||
|
@ -2342,7 +2342,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
||||
P_RunParticleEffect (pos, dir, 0xe0, 40);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, 0, -5, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, 0, -5, -10, 20);
|
||||
|
||||
ex = CL_AllocExplosion ();
|
||||
VectorCopy (pos, ex->origin);
|
||||
|
@ -2402,7 +2402,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 0xe0, 256);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value)
|
||||
|
@ -2497,7 +2497,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 0xe0, 256);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -1, -1, -1, 100);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
}
|
||||
|
||||
// light
|
||||
|
@ -2673,7 +2673,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
||||
P_RunParticleEffect (pos, dir, 0xd0, 40);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, 0, -10, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, 0, -10, 20);
|
||||
|
||||
ex = CL_AllocExplosion ();
|
||||
VectorCopy (pos, ex->origin);
|
||||
|
@ -2723,7 +2723,7 @@ void CLQ2_ParseTEnt (void)
|
|||
if (P_RunParticleEffectType(pos, dir, 1, ptq2_blasterparticles))
|
||||
P_RunParticleEffect (pos, dir, 0x6f, 40);
|
||||
|
||||
if (cl_legacystains.ival) R_AddStain(pos, -10, -2, 0, 20);
|
||||
if (cl_legacystains.ival) Surf_AddStain(pos, -10, -2, 0, 20);
|
||||
|
||||
ex = CL_AllocExplosion ();
|
||||
VectorCopy (pos, ex->origin);
|
||||
|
|
|
@ -401,7 +401,7 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
|
|||
ent.rotation = q3->rotation;
|
||||
|
||||
if (q3->customSkin)
|
||||
ent.skinnum = Mod_SkinForName(ent.model, VM_FROMSTRCACHE(q3->customSkin));
|
||||
ent.skinnum = Mod_SkinNumForName(ent.model, VM_FROMSTRCACHE(q3->customSkin));
|
||||
|
||||
ent.shaderRGBAf[0] = q3->shaderRGBA[0]/255.0f;
|
||||
ent.shaderRGBAf[1] = q3->shaderRGBA[1]/255.0f;
|
||||
|
@ -1086,7 +1086,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
return VMQ3_Cvar_Update(VM_POINTER(arg[0]));
|
||||
|
||||
case UI_MEMORY_REMAINING:
|
||||
VM_LONG(ret) = Hunk_LowMemAvailable();
|
||||
VM_LONG(ret) = 1024*1024*8;//Hunk_LowMemAvailable();
|
||||
break;
|
||||
|
||||
case UI_GET_CDKEY: //get cd key
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef struct
|
|||
texnums_t textures;
|
||||
|
||||
qboolean failedload; // the name isn't a valid skin
|
||||
cache_user_t cache;
|
||||
void *skindata;
|
||||
} skin_t;
|
||||
|
||||
// player_state_t is the information needed by a player entity
|
||||
|
|
|
@ -606,8 +606,6 @@ void CLQ3_ParseGameState(void)
|
|||
|
||||
SCR_EndLoadingPlaque();
|
||||
|
||||
Hunk_Check (); // make sure nothing is hurt
|
||||
|
||||
CL_MakeActive("Quake3Arena");
|
||||
|
||||
cl.splitclients = 1;
|
||||
|
|
|
@ -877,7 +877,10 @@ void VARGS Con_DPrintf (const char *fmt, ...)
|
|||
if (!developer.value)
|
||||
Con_Log(msg);
|
||||
else
|
||||
{
|
||||
Sys_Printf ("%s", msg); // also echo to debugging console
|
||||
Con_PrintCon(&con_main, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*description text at the bottom of the console*/
|
||||
|
|
|
@ -74,7 +74,7 @@ void M_Menu_Options_f (void)
|
|||
menubulk_t bulk[] = {
|
||||
MB_CONSOLECMD("Customize controls", "menu_keys\n", "Modify keyboard and mouse inputs."),
|
||||
MB_CONSOLECMD("Go to console", "toggleconsole\nplay misc/menu2.wav\n", "Open up the engine console."),
|
||||
MB_CONSOLECMD("Reset to defaults", "exec default.cfg\nplay misc/menu2.wav\n", "Reloads the default configuration."),
|
||||
MB_CONSOLECMD("Reset to defaults", "cvarreset *\nexec default.cfg\nplay misc/menu2.wav\n", "Reloads the default configuration."),
|
||||
MB_CONSOLECMD("Save all settings", "cfg_save\n", "Writes changed settings out to a config file."),
|
||||
MB_SPACING(4),
|
||||
MB_SLIDER("Mouse Speed", sensitivity, 1, 10, 0.2, NULL),
|
||||
|
|
|
@ -50,10 +50,6 @@ typedef struct {
|
|||
#define qrenderer QR_NONE
|
||||
#define FNC(n) (n) //FNC is defined as 'pointer if client build, direct if dedicated server'
|
||||
|
||||
#define Mod_SkinForName Mod_SkinNumForName
|
||||
#define Mod_FrameForName Mod_FrameNumForName
|
||||
#define Mod_GetFrameDuration Mod_FrameDuration
|
||||
|
||||
#else
|
||||
#define FNC(n) (*n)
|
||||
extern r_qrenderer_t qrenderer;
|
||||
|
@ -78,8 +74,6 @@ void R2D_ImagePaletteColour(unsigned int i, float a);
|
|||
void R2D_FillBlock(int x, int y, int w, int h);
|
||||
|
||||
extern void (*Draw_Init) (void);
|
||||
extern void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
|
||||
extern qboolean (*Draw_IsCached) (char *picname); //can be null
|
||||
|
||||
extern void (*R_Init) (void);
|
||||
extern void (*R_DeInit) (void);
|
||||
|
@ -88,9 +82,6 @@ extern void (*R_RenderView) (void); // must set r_refdef first
|
|||
extern void (*R_NewMap) (void);
|
||||
extern void (*R_PreNewMap) (void);
|
||||
|
||||
extern void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
|
||||
extern void (*R_LessenStains) (void);
|
||||
|
||||
extern qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
extern void (*VID_DeInit) (void);
|
||||
extern char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
|
||||
|
@ -119,19 +110,20 @@ void R_DrawTextField(int x, int y, int w, int h, char *text, unsigned int defaul
|
|||
|
||||
#endif
|
||||
|
||||
extern void FNC(Mod_Init) (void);
|
||||
extern void FNC(Mod_ClearAll) (void);
|
||||
extern struct model_s *FNC(Mod_ForName) (char *name, qboolean crash);
|
||||
extern struct model_s *FNC(Mod_FindName) (char *name);
|
||||
extern void *FNC(Mod_Extradata) (struct model_s *mod); // handles caching
|
||||
extern void FNC(Mod_TouchModel) (char *name);
|
||||
extern void Mod_Init (void);
|
||||
extern void Mod_ClearAll (void);
|
||||
extern void Mod_Flush (qboolean force);
|
||||
extern struct model_s *Mod_ForName (char *name, qboolean crash);
|
||||
extern struct model_s *Mod_FindName (char *name);
|
||||
extern void *Mod_Extradata (struct model_s *mod); // handles caching
|
||||
extern void Mod_TouchModel (char *name);
|
||||
|
||||
extern void FNC(Mod_NowLoadExternal) (void);
|
||||
extern void Mod_NowLoadExternal (void);
|
||||
|
||||
extern void FNC(Mod_Think) (void);
|
||||
extern int FNC(Mod_SkinForName) (struct model_s *model, char *name);
|
||||
extern int FNC(Mod_FrameForName) (struct model_s *model, char *name);
|
||||
extern float FNC(Mod_GetFrameDuration) (struct model_s *model, int framenum);
|
||||
extern void Mod_Think (void);
|
||||
extern int Mod_SkinNumForName (struct model_s *model, char *name);
|
||||
extern int Mod_FrameNumForName (struct model_s *model, char *name);
|
||||
extern float Mod_GetFrameDuration (struct model_s *model, int framenum);
|
||||
|
||||
#undef FNC
|
||||
|
||||
|
@ -295,32 +287,12 @@ typedef struct rendererinfo_s {
|
|||
void (*IMG_Upload) (texid_t tex, char *name, uploadfmt_t fmt, void *data, void *palette, int width, int height, unsigned int flags);
|
||||
void (*IMG_DestroyTexture) (texid_t tex);
|
||||
|
||||
void (*R_Init) (void);
|
||||
void (*R_DeInit) (void);
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
||||
void (*R_NewMap) (void);
|
||||
void (*R_PreNewMap) (void);
|
||||
|
||||
void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
|
||||
void (*R_LessenStains) (void);
|
||||
|
||||
void (*Mod_Init) (void);
|
||||
void (*Mod_Shutdown) (void);
|
||||
void (*Mod_ClearAll) (void);
|
||||
struct model_s *(*Mod_ForName) (char *name, qboolean crash);
|
||||
struct model_s *(*Mod_FindName) (char *name);
|
||||
void *(*Mod_Extradata) (struct model_s *mod); // handles caching
|
||||
void (*Mod_TouchModel) (char *name);
|
||||
|
||||
void (*Mod_NowLoadExternal) (void);
|
||||
void (*Mod_Think) (void);
|
||||
qboolean (*Mod_GetTag) (struct model_s *model, int tagnum, framestate_t *fstate, float *result);
|
||||
int (*Mod_TagNumForName) (struct model_s *model, char *name);
|
||||
int (*Mod_SkinForName) (struct model_s *model, char *name);
|
||||
int (*Mod_FrameForName) (struct model_s *model, char *name);
|
||||
float (*Mod_GetFrameDuration) (struct model_s *model, int frame);
|
||||
void (*R_Init) (void); //FIXME - merge implementations
|
||||
void (*R_DeInit) (void); //FIXME - merge implementations
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
||||
void (*R_NewMap) (void); //FIXME - merge implementations
|
||||
void (*R_PreNewMap) (void); //FIXME - merge implementations
|
||||
|
||||
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
void (*VID_DeInit) (void);
|
||||
|
|
|
@ -2729,7 +2729,9 @@ static void R_Part_SkyTri(float *v1, float *v2, float *v3, msurface_t *surf, int
|
|||
|
||||
skytris_t *st;
|
||||
|
||||
st = Hunk_Alloc(sizeof(skytris_t));
|
||||
st = NULL;//Hunk_Alloc(sizeof(skytris_t));
|
||||
if (!st)
|
||||
return;
|
||||
st->next = part_type[ptype].skytris;
|
||||
VectorCopy(v1, st->org);
|
||||
VectorSubtract(v2, st->org, st->x);
|
||||
|
@ -3138,7 +3140,7 @@ static void PScript_EffectSpawned(part_type_t *ptype, vec3_t org, vec3_t dir, in
|
|||
S_StartSound(0, 0, S_PrecacheSound(ptype->soundname), org, ptype->soundvol, ptype->soundattn, ptype->sounddelay, ptype->soundpitch);
|
||||
}
|
||||
if (ptype->stain_radius)
|
||||
R_AddStain(org, ptype->stain_rgb[0], ptype->stain_rgb[1], ptype->stain_rgb[2], ptype->stain_radius);
|
||||
Surf_AddStain(org, ptype->stain_rgb[0], ptype->stain_rgb[1], ptype->stain_rgb[2], ptype->stain_radius);
|
||||
}
|
||||
|
||||
int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent, vec3_t tangent2, float size, float **out);
|
||||
|
@ -5330,7 +5332,7 @@ static void PScript_DrawParticleTypes (void)
|
|||
{
|
||||
if (traces-->0&&tr(oldorg, p->org, stop, normal))
|
||||
{
|
||||
R_AddStain(stop, (p->rgba[1]*-10+p->rgba[2]*-10),
|
||||
Surf_AddStain(stop, (p->rgba[1]*-10+p->rgba[2]*-10),
|
||||
(p->rgba[0]*-10+p->rgba[2]*-10),
|
||||
(p->rgba[0]*-10+p->rgba[1]*-10),
|
||||
30*p->rgba[3]*type->stainonimpact);
|
||||
|
@ -5554,7 +5556,7 @@ static void PScript_DrawParticleTypes (void)
|
|||
if (traces-->0&&tr(oldorg, p->org, stop, normal))
|
||||
{
|
||||
if (type->stainonimpact && r_bloodstains.ival)
|
||||
R_AddStain(stop, p->rgba[1]*-10+p->rgba[2]*-10,
|
||||
Surf_AddStain(stop, p->rgba[1]*-10+p->rgba[2]*-10,
|
||||
p->rgba[0]*-10+p->rgba[2]*-10,
|
||||
p->rgba[0]*-10+p->rgba[1]*-10,
|
||||
30*p->rgba[3]);
|
||||
|
@ -5595,12 +5597,12 @@ static void PScript_DrawParticleTypes (void)
|
|||
if (traces-->0&&tr(oldorg, p->org, stop, normal))
|
||||
{
|
||||
if (type->stainonimpact < 0)
|
||||
R_AddStain(stop, (p->rgba[0]*-1),
|
||||
Surf_AddStain(stop, (p->rgba[0]*-1),
|
||||
(p->rgba[1]*-1),
|
||||
(p->rgba[2]*-1),
|
||||
p->scale*-type->stainonimpact);
|
||||
else
|
||||
R_AddStain(stop, (p->rgba[1]*-10+p->rgba[2]*-10),
|
||||
Surf_AddStain(stop, (p->rgba[1]*-10+p->rgba[2]*-10),
|
||||
(p->rgba[0]*-10+p->rgba[2]*-10),
|
||||
(p->rgba[0]*-10+p->rgba[1]*-10),
|
||||
30*p->rgba[3]*type->stainonimpact);
|
||||
|
|
|
@ -3071,7 +3071,7 @@ static void QCBUILTIN PF_cl_te_explosion (pubprogfuncs_t *prinst, struct globalv
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
R_AddStain(pos, -1, -1, -1, 100);
|
||||
Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1, 0, 0);
|
||||
}
|
||||
|
@ -3139,7 +3139,7 @@ static void QCBUILTIN PF_cl_te_explosionquad (pubprogfuncs_t *prinst, struct glo
|
|||
if (P_RunParticleEffectType(pos, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(pos, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
R_AddStain(pos, -1, -1, -1, 100);
|
||||
Surf_AddStain(pos, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value) {
|
||||
|
@ -3251,7 +3251,7 @@ static void QCBUILTIN PF_cl_te_explosionrgb (pubprogfuncs_t *prinst, struct glob
|
|||
if (P_RunParticleEffectType(org, NULL, 1, pt_explosion))
|
||||
P_RunParticleEffect(org, NULL, 107, 1024); // should be 97-111
|
||||
|
||||
R_AddStain(org, -1, -1, -1, 100);
|
||||
Surf_AddStain(org, -1, -1, -1, 100);
|
||||
|
||||
// light
|
||||
if (r_explosionlight.value)
|
||||
|
@ -5647,7 +5647,7 @@ qboolean CSQC_DrawView(void)
|
|||
|
||||
DropPunchAngle (csqc_playerview);
|
||||
if (cl.worldmodel)
|
||||
R_LessenStains();
|
||||
Surf_LessenStains();
|
||||
|
||||
if (!cl.paused)
|
||||
{
|
||||
|
|
|
@ -269,8 +269,8 @@ static void bonematident_toqcvectors(float vx[3], float vy[3], float vz[3], floa
|
|||
|
||||
static qboolean pendingkill; /*states that there is a skel waiting to be killed*/
|
||||
#ifdef RAGDOLL
|
||||
void rag_uninstanciate(skelobject_t *sko);
|
||||
int rag_finddollbody(doll_t *d, char *bodyname)
|
||||
static void rag_uninstanciate(skelobject_t *sko);
|
||||
static int rag_finddollbody(doll_t *d, char *bodyname)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < d->numbodies; i++)
|
||||
|
@ -280,7 +280,7 @@ int rag_finddollbody(doll_t *d, char *bodyname)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
int rag_finddolljoint(doll_t *d, char *name)
|
||||
static int rag_finddolljoint(doll_t *d, char *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < d->numjoints; i++)
|
||||
|
@ -303,7 +303,7 @@ typedef struct {
|
|||
odebodyinfo_t defbody;
|
||||
odejointinfo_t defjoint;
|
||||
} dollcreatectx_t;
|
||||
dollcreatectx_t *rag_createdoll(model_t *mod, char *fname, int numbones)
|
||||
static dollcreatectx_t *rag_createdoll(model_t *mod, char *fname, int numbones)
|
||||
{
|
||||
int i;
|
||||
dollcreatectx_t *ctx;
|
||||
|
@ -351,7 +351,7 @@ dollcreatectx_t *rag_createdoll(model_t *mod, char *fname, int numbones)
|
|||
return ctx;
|
||||
}
|
||||
//returns true if the command was recognised. false if the command is for something else.
|
||||
qboolean rag_dollline(dollcreatectx_t *ctx, int linenum)
|
||||
static qboolean rag_dollline(dollcreatectx_t *ctx, int linenum)
|
||||
{
|
||||
int i;
|
||||
int argc;
|
||||
|
@ -569,7 +569,7 @@ qboolean rag_dollline(dollcreatectx_t *ctx, int linenum)
|
|||
|
||||
return true;
|
||||
};
|
||||
doll_t *rag_finishdoll(dollcreatectx_t *ctx)
|
||||
static doll_t *rag_finishdoll(dollcreatectx_t *ctx)
|
||||
{
|
||||
doll_t *d = ctx->d;
|
||||
int i;
|
||||
|
@ -700,9 +700,9 @@ void rag_flushdolls(qboolean force)
|
|||
}
|
||||
}
|
||||
|
||||
void skel_integrate(pubprogfuncs_t *prinst, skelobject_t *sko, skelobject_t *skelobjsrc, float ft, float mmat[12])
|
||||
{
|
||||
#if 0
|
||||
static void skel_integrate(pubprogfuncs_t *prinst, skelobject_t *sko, skelobject_t *skelobjsrc, float ft, float mmat[12])
|
||||
{
|
||||
trace_t t;
|
||||
vec3_t npos, opos, wnpos, wopos;
|
||||
vec3_t move;
|
||||
|
@ -803,7 +803,6 @@ void skel_integrate(pubprogfuncs_t *prinst, skelobject_t *sko, skelobject_t *ske
|
|||
/*FIXME*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*debugging*/
|
||||
#if 0
|
||||
/*draw points*/
|
||||
|
@ -818,8 +817,9 @@ void skel_integrate(pubprogfuncs_t *prinst, skelobject_t *sko, skelobject_t *ske
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void skel_generateragdoll_f_bones(vfsfile_t *f, galiasbone_t *bones, int numbones, int parent, int indent)
|
||||
static void skel_generateragdoll_f_bones(vfsfile_t *f, galiasbone_t *bones, int numbones, int parent, int indent)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < numbones; i++)
|
||||
|
@ -952,6 +952,7 @@ void skel_info_f(void)
|
|||
Con_Printf(" type: %s\n", (skelobjects[i].type == SKOT_RELATIVE)?"parentspace":"modelspace");
|
||||
Con_Printf(" model: %s\n", skelobjects[i].model->name);
|
||||
Con_Printf(" bone count: %i\n", skelobjects[i].numbones);
|
||||
#ifdef RAGDOLL
|
||||
if (skelobjects[i].doll)
|
||||
{
|
||||
Con_Printf(" ragdoll: %s%s\n", skelobjects[i].doll->name, ((skelobjects[i].doll == skelobjects[i].model->dollinfo)?" (model default)":""));
|
||||
|
@ -959,6 +960,7 @@ void skel_info_f(void)
|
|||
}
|
||||
if (skelobjects[i].entity)
|
||||
Con_Printf(" entity: %i (%s)\n", skelobjects[i].entity->entnum, skelobjects[i].world->progs->StringToNative(skelobjects[i].world->progs, skelobjects[i].entity->v->classname));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -972,7 +974,9 @@ void skel_reset(pubprogfuncs_t *prinst)
|
|||
{
|
||||
if (skelobjects[i].world == prinst->parms->user)
|
||||
{
|
||||
#ifdef RAGDOLL
|
||||
rag_uninstanciate(&skelobjects[i]);
|
||||
#endif
|
||||
skelobjects[i].numbones = 0;
|
||||
skelobjects[i].inuse = false;
|
||||
skelobjects[i].bonematrix = NULL;
|
||||
|
@ -981,7 +985,9 @@ void skel_reset(pubprogfuncs_t *prinst)
|
|||
|
||||
while (numskelobjectsused && !skelobjects[numskelobjectsused-1].inuse)
|
||||
numskelobjectsused--;
|
||||
#ifdef RAGDOLL
|
||||
rag_flushdolls(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*deletes any skeletons marked for deletion*/
|
||||
|
@ -996,7 +1002,9 @@ void skel_dodelete(pubprogfuncs_t *prinst)
|
|||
{
|
||||
if (skelobjects[skelidx].inuse == 2)
|
||||
{
|
||||
#ifdef RAGDOLL
|
||||
rag_uninstanciate(&skelobjects[skelidx]);
|
||||
#endif
|
||||
skelobjects[skelidx].inuse = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1005,7 +1013,7 @@ void skel_dodelete(pubprogfuncs_t *prinst)
|
|||
numskelobjectsused--;
|
||||
}
|
||||
|
||||
skelobject_t *skel_create(pubprogfuncs_t *prinst, int bonecount)
|
||||
static skelobject_t *skel_create(pubprogfuncs_t *prinst, int bonecount)
|
||||
{
|
||||
unsigned int skelidx;
|
||||
//invalid if the bonecount is not set...
|
||||
|
@ -1043,7 +1051,7 @@ skelobject_t *skel_create(pubprogfuncs_t *prinst, int bonecount)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
skelobject_t *skel_get(pubprogfuncs_t *prinst, int skelidx)
|
||||
static skelobject_t *skel_get(pubprogfuncs_t *prinst, int skelidx)
|
||||
{
|
||||
skelidx--;
|
||||
if ((unsigned int)skelidx >= numskelobjectsused)
|
||||
|
@ -1074,8 +1082,9 @@ void QCBUILTIN PF_skel_mmap(pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
G_INT(OFS_RETURN) = (char*)sko->bonematrix - prinst->stringtable;
|
||||
}
|
||||
|
||||
#ifdef RAGDOLL
|
||||
//may not poke the skeletal object bone data.
|
||||
void rag_uninstanciate(skelobject_t *sko)
|
||||
static void rag_uninstanciate(skelobject_t *sko)
|
||||
{
|
||||
int i;
|
||||
if (!sko->doll)
|
||||
|
@ -1462,6 +1471,7 @@ void rag_updatedeltaent(entity_t *ent, lerpents_t *le)
|
|||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SKELETALOBJECTS
|
||||
//update a skeletal object to track its ragdoll/apply a ragdoll to a skeletal object.
|
||||
|
@ -2218,8 +2228,8 @@ void QCBUILTIN PF_frameforname (pubprogfuncs_t *prinst, struct globalvars_s *pr_
|
|||
char *str = PF_VarString(prinst, 1, pr_globals);
|
||||
model_t *mod = w->Get_CModel(w, modelindex);
|
||||
|
||||
if (mod && Mod_FrameForName)
|
||||
G_FLOAT(OFS_RETURN) = Mod_FrameForName(mod, str);
|
||||
if (mod)
|
||||
G_FLOAT(OFS_RETURN) = Mod_FrameNumForName(mod, str);
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = -1;
|
||||
}
|
||||
|
@ -2230,7 +2240,7 @@ void QCBUILTIN PF_frameduration (pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
unsigned int framenum = G_FLOAT(OFS_PARM1);
|
||||
model_t *mod = w->Get_CModel(w, modelindex);
|
||||
|
||||
if (mod && Mod_GetFrameDuration)
|
||||
if (mod)
|
||||
G_FLOAT(OFS_RETURN) = Mod_GetFrameDuration(mod, framenum);
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
|
@ -2243,8 +2253,8 @@ void QCBUILTIN PF_skinforname (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
char *str = PF_VarString(prinst, 1, pr_globals);
|
||||
model_t *mod = w->Get_CModel(w, modelindex);
|
||||
|
||||
if (mod && Mod_SkinForName)
|
||||
G_FLOAT(OFS_RETURN) = Mod_SkinForName(mod, str);
|
||||
if (mod)
|
||||
G_FLOAT(OFS_RETURN) = Mod_SkinNumForName(mod, str);
|
||||
else
|
||||
#endif
|
||||
G_FLOAT(OFS_RETURN) = -1;
|
||||
|
|
|
@ -229,8 +229,6 @@ typedef struct quakeparms_s
|
|||
char *binarydir; //exe directory
|
||||
int argc;
|
||||
const char **argv;
|
||||
void *membase;
|
||||
unsigned int memsize;
|
||||
} quakeparms_t;
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
qboolean r2d_noshadergamma; //says the video code has successfully activated hardware gamma
|
||||
texid_t missing_texture;
|
||||
texid_t missing_texture_gloss;
|
||||
texid_t missing_texture_normal;
|
||||
|
||||
texid_t translate_texture;
|
||||
shader_t *translate_shader;
|
||||
|
@ -128,9 +129,11 @@ Image loading code must be ready for use at this point.
|
|||
*/
|
||||
void R2D_Init(void)
|
||||
{
|
||||
unsigned int nonorm[4*4];
|
||||
unsigned int nogloss[4*4];
|
||||
int i;
|
||||
unsigned int glossval;
|
||||
unsigned int normval;
|
||||
extern cvar_t gl_specular_fallback;
|
||||
conback = NULL;
|
||||
|
||||
|
@ -156,10 +159,16 @@ void R2D_Init(void)
|
|||
glossval *= 0x10101;
|
||||
glossval |= 0xff000000;
|
||||
glossval = LittleLong(glossval);
|
||||
normval = 0xffff8080;
|
||||
normval = LittleLong(normval);
|
||||
for (i = 0; i < 4*4; i++)
|
||||
{
|
||||
nogloss[i] = glossval;
|
||||
nonorm[i] = normval;
|
||||
}
|
||||
missing_texture = R_LoadTexture8("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], IF_NOALPHA|IF_NOGAMMA, 0);
|
||||
missing_texture_gloss = R_LoadTexture("no_texture_gloss", 4, 4, TF_RGBA32, (unsigned char*)nogloss, IF_NOGAMMA);
|
||||
missing_texture_normal = R_LoadTexture("no_texture_normal", 4, 4, TF_RGBA32, (unsigned char*)nonorm, IF_NOGAMMA);
|
||||
translate_texture = r_nulltex;
|
||||
ch_int_texture = r_nulltex;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "shader.h"
|
||||
#endif
|
||||
|
||||
void RMod_SetParent (mnode_t *node, mnode_t *parent);
|
||||
void Mod_SetParent (mnode_t *node, mnode_t *parent);
|
||||
int D3_LeafnumForPoint (struct model_s *model, vec3_t point);
|
||||
|
||||
#ifndef SERVERONLY
|
||||
|
@ -61,8 +61,8 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
numsurfs = atoi(token);
|
||||
if (numsurfs < 0 || numsurfs > 10000)
|
||||
return false;
|
||||
b = Hunk_Alloc(sizeof(*b) * numsurfs);
|
||||
m = Hunk_Alloc(sizeof(*m) * numsurfs);
|
||||
b = ZG_Malloc(&model->memgroup, sizeof(*b) * numsurfs);
|
||||
m = ZG_Malloc(&model->memgroup, sizeof(*m) * numsurfs);
|
||||
sub->numsurfaces = numsurfs;
|
||||
|
||||
sub->batches[0] = b;
|
||||
|
@ -104,7 +104,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
|
||||
m[surf].numvertexes = numverts;
|
||||
m[surf].numindexes = numindicies;
|
||||
vdata = Hunk_Alloc(numverts * (sizeof(vecV_t) + sizeof(vec2_t) + sizeof(vec3_t) + sizeof(vec4_t)) + numindicies * sizeof(index_t));
|
||||
vdata = ZG_Malloc(&model->memgroup, numverts * (sizeof(vecV_t) + sizeof(vec2_t) + sizeof(vec3_t) + sizeof(vec4_t)) + numindicies * sizeof(index_t));
|
||||
|
||||
m[surf].colors4f_array = (vec4_t*)vdata;vdata += sizeof(vec4_t)*numverts;
|
||||
m[surf].xyz_array = (vecV_t*)vdata;vdata += sizeof(vecV_t)*numverts;
|
||||
|
@ -239,8 +239,8 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
|
||||
data = COM_ParseOut(data, token, sizeof(token));
|
||||
numnodes = atoi(token);
|
||||
model->nodes = Hunk_Alloc(sizeof(*model->nodes)*numnodes);
|
||||
model->planes = Hunk_Alloc(sizeof(*model->planes)*numnodes);
|
||||
model->nodes = ZG_Malloc(&model->memgroup, sizeof(*model->nodes)*numnodes);
|
||||
model->planes = ZG_Malloc(&model->memgroup, sizeof(*model->planes)*numnodes);
|
||||
|
||||
for (n = 0; n < numnodes; n++)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
if (strcmp(token, "}"))
|
||||
return false;
|
||||
|
||||
RMod_SetParent(model->nodes, NULL);
|
||||
Mod_SetParent(model->nodes, NULL);
|
||||
}
|
||||
else if (!strcmp(token, "interAreaPortals"))
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
data = COM_ParseOut(data, token, sizeof(token));
|
||||
model->numportals = atoi(token);
|
||||
|
||||
model->portal = p = Hunk_Alloc(sizeof(*p) * model->numportals);
|
||||
model->portal = p = ZG_Malloc(&model->memgroup, sizeof(*p) * model->numportals);
|
||||
|
||||
for (pno = 0; pno < model->numportals; pno++, p++)
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data)
|
|||
data = COM_ParseOut(data, token, sizeof(token));
|
||||
p->area[1] = atoi(token);
|
||||
|
||||
p->points = Hunk_Alloc(sizeof(*p->points) * p->numpoints);
|
||||
p->points = ZG_Malloc(&model->memgroup, sizeof(*p->points) * p->numpoints);
|
||||
|
||||
ClearBounds(p->min, p->max);
|
||||
for (v = 0; v < p->numpoints; v++)
|
||||
|
@ -1074,7 +1074,7 @@ qboolean D3_LoadMap_CollisionMap(model_t *mod, char *buf)
|
|||
ensurenewtoken("}");
|
||||
ensurenewtoken("nodes");
|
||||
ensurenewtoken("{");
|
||||
cmod->cnodes = Hunk_Alloc(sizeof(cm_node_t));
|
||||
cmod->cnodes = ZG_Malloc(&mod->memgroup, sizeof(cm_node_t));
|
||||
for (;;)
|
||||
{
|
||||
buf = COM_ParseOut(buf, token, sizeof(token));
|
||||
|
@ -1110,7 +1110,7 @@ qboolean D3_LoadMap_CollisionMap(model_t *mod, char *buf)
|
|||
break;
|
||||
|
||||
numpedges = atoi(token);
|
||||
surf = Hunk_Alloc(sizeof(*surf) + sizeof(vec4_t)*numpedges);
|
||||
surf = ZG_Malloc(&mod->memgroup, sizeof(*surf) + sizeof(vec4_t)*numpedges);
|
||||
surf->numedges = numpedges;
|
||||
surf->edge = (vec4_t*)(surf+1);
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ qboolean D3_LoadMap_CollisionMap(model_t *mod, char *buf)
|
|||
if (!strcmp(token, "}"))
|
||||
break;
|
||||
j = atoi(token);
|
||||
brush = Hunk_Alloc(j*sizeof(vec4_t) + sizeof(*brush));
|
||||
brush = ZG_Malloc(&mod->memgroup, j*sizeof(vec4_t) + sizeof(*brush));
|
||||
brush->numplanes = j;
|
||||
brush->plane = (vec4_t*)(brush+1);
|
||||
ensurenewtoken("{");
|
||||
|
|
|
@ -1937,9 +1937,9 @@ void Surf_SetupFrame(void)
|
|||
r_oldviewcluster = r_viewcluster;
|
||||
r_oldviewcluster2 = r_viewcluster2;
|
||||
if (r_refdef.recurse)
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, r_refdef.pvsorigin);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, r_refdef.pvsorigin);
|
||||
else
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, r_origin);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, r_origin);
|
||||
r_viewcluster = r_viewcluster2 = leaf->cluster;
|
||||
|
||||
r_viewcontents = leaf->contents & (FTECONTENTS_LAVA|FTECONTENTS_SLIME|FTECONTENTS_WATER);
|
||||
|
@ -1951,7 +1951,7 @@ void Surf_SetupFrame(void)
|
|||
|
||||
VectorCopy (r_origin, temp);
|
||||
temp[2] -= 16;
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, temp);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, temp);
|
||||
if ( !(leaf->contents & Q2CONTENTS_SOLID) &&
|
||||
(leaf->cluster != r_viewcluster2) )
|
||||
r_viewcluster2 = leaf->cluster;
|
||||
|
@ -1962,7 +1962,7 @@ void Surf_SetupFrame(void)
|
|||
|
||||
VectorCopy (r_origin, temp);
|
||||
temp[2] += 16;
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, temp);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, temp);
|
||||
if ( !(leaf->contents & Q2CONTENTS_SOLID) &&
|
||||
(leaf->cluster != r_viewcluster2) )
|
||||
r_viewcluster2 = leaf->cluster;
|
||||
|
@ -1985,7 +1985,7 @@ void Surf_SetupFrame(void)
|
|||
VectorCopy(r_origin, pvsorg);
|
||||
}
|
||||
|
||||
r_viewleaf = RMod_PointInLeaf (cl.worldmodel, pvsorg);
|
||||
r_viewleaf = Mod_PointInLeaf (cl.worldmodel, pvsorg);
|
||||
|
||||
if (!r_viewleaf)
|
||||
{
|
||||
|
@ -1994,7 +1994,7 @@ void Surf_SetupFrame(void)
|
|||
{ //look down a bit
|
||||
VectorCopy (pvsorg, temp);
|
||||
temp[2] -= 16;
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, temp);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, temp);
|
||||
if (leaf->contents <= Q1CONTENTS_WATER && leaf->contents >= Q1CONTENTS_LAVA)
|
||||
r_viewleaf2 = leaf;
|
||||
else
|
||||
|
@ -2005,7 +2005,7 @@ void Surf_SetupFrame(void)
|
|||
|
||||
VectorCopy (pvsorg, temp);
|
||||
temp[2] += 16;
|
||||
leaf = RMod_PointInLeaf (cl.worldmodel, temp);
|
||||
leaf = Mod_PointInLeaf (cl.worldmodel, temp);
|
||||
if (leaf->contents == Q1CONTENTS_EMPTY)
|
||||
r_viewleaf2 = leaf;
|
||||
else
|
||||
|
|
|
@ -335,30 +335,27 @@ extern texid_t balltexture;
|
|||
extern texid_t beamtexture;
|
||||
extern texid_t ptritexture;
|
||||
|
||||
#if defined(GLQUAKE) || defined(D3DQUAKE)
|
||||
|
||||
void RMod_Init (void);
|
||||
void RMod_Shutdown (void);
|
||||
void Mod_Init (void);
|
||||
void Mod_Shutdown (void);
|
||||
int Mod_TagNumForName(struct model_s *model, char *name);
|
||||
int Mod_SkinNumForName(struct model_s *model, char *name);
|
||||
int Mod_FrameNumForName(struct model_s *model, char *name);
|
||||
float Mod_FrameDuration(struct model_s *model, int frameno);
|
||||
float Mod_GetFrameDuration(struct model_s *model, int frameno);
|
||||
|
||||
void RMod_ResortShaders(void);
|
||||
void RMod_ClearAll (void);
|
||||
struct model_s *RMod_ForName (char *name, qboolean crash);
|
||||
struct model_s *RMod_FindName (char *name);
|
||||
void *RMod_Extradata (struct model_s *mod); // handles caching
|
||||
void RMod_TouchModel (char *name);
|
||||
void Mod_ResortShaders(void);
|
||||
void Mod_ClearAll (void);
|
||||
struct model_s *Mod_ForName (char *name, qboolean crash);
|
||||
struct model_s *Mod_FindName (char *name);
|
||||
void *Mod_Extradata (struct model_s *mod); // handles caching
|
||||
void Mod_TouchModel (char *name);
|
||||
void Mod_RebuildLightmaps (void);
|
||||
|
||||
struct mleaf_s *RMod_PointInLeaf (struct model_s *model, float *p);
|
||||
struct mleaf_s *Mod_PointInLeaf (struct model_s *model, float *p);
|
||||
|
||||
void RMod_Think (void);
|
||||
void RMod_NowLoadExternal(void);
|
||||
void Mod_Think (void);
|
||||
void Mod_NowLoadExternal(void);
|
||||
void GLR_LoadSkys (void);
|
||||
void R_BloomRegister(void);
|
||||
#endif
|
||||
|
||||
#ifdef RUNTIMELIGHTING
|
||||
void LightFace (int surfnum);
|
||||
|
|
|
@ -757,8 +757,6 @@ void Renderer_Start(void)
|
|||
void (*Draw_Init) (void);
|
||||
void (*Draw_Shutdown) (void);
|
||||
|
||||
//void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
|
||||
|
||||
void (*R_Init) (void);
|
||||
void (*R_DeInit) (void);
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
@ -766,25 +764,6 @@ void (*R_RenderView) (void); // must set r_refdef first
|
|||
void (*R_NewMap) (void);
|
||||
void (*R_PreNewMap) (void);
|
||||
|
||||
void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
|
||||
void (*R_LessenStains) (void);
|
||||
|
||||
void (*Mod_Init) (void);
|
||||
void (*Mod_Shutdown) (void);
|
||||
void (*Mod_ClearAll) (void);
|
||||
struct model_s *(*Mod_ForName) (char *name, qboolean crash);
|
||||
struct model_s *(*Mod_FindName) (char *name);
|
||||
void *(*Mod_Extradata) (struct model_s *mod); // handles caching
|
||||
void (*Mod_TouchModel) (char *name);
|
||||
|
||||
void (*Mod_NowLoadExternal) (void);
|
||||
void (*Mod_Think) (void);
|
||||
//qboolean (*Mod_GetTag) (struct model_s *model, int tagnum, int frame, int frame2, float f2ness, float f1time, float f2time, float *transforms);
|
||||
//int (*Mod_TagNumForName) (struct model_s *model, char *name);
|
||||
int (*Mod_SkinForName) (struct model_s *model, char *name);
|
||||
int (*Mod_FrameForName) (struct model_s *model, char *name);
|
||||
float (*Mod_GetFrameDuration) (struct model_s *model, int framenum);
|
||||
|
||||
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
|
||||
void (*VID_DeInit) (void);
|
||||
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
|
||||
|
@ -827,32 +806,6 @@ rendererinfo_t dedicatedrendererinfo = {
|
|||
NULL, //R_NewMap;
|
||||
NULL, //R_PreNewMap
|
||||
|
||||
|
||||
NULL, //R_AddStain;
|
||||
NULL, //R_LessenStains;
|
||||
|
||||
#if defined(GLQUAKE) || defined(D3DQUAKE)
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
|
||||
NULL, //Mod_GetTag
|
||||
NULL, //fixme: server will need this one at some point.
|
||||
NULL,
|
||||
NULL,
|
||||
Mod_FrameDuration,
|
||||
|
||||
#else
|
||||
#error "Need logic here!"
|
||||
#endif
|
||||
|
||||
NULL, //VID_Init,
|
||||
NULL, //VID_DeInit,
|
||||
NULL, //VID_ApplyGammaRamps,
|
||||
|
@ -936,31 +889,11 @@ void R_SetRenderer(rendererinfo_t *ri)
|
|||
R_NewMap = ri->R_NewMap;
|
||||
R_PreNewMap = ri->R_PreNewMap;
|
||||
|
||||
R_AddStain = ri->R_AddStain;
|
||||
R_LessenStains = ri->R_LessenStains;
|
||||
|
||||
VID_Init = ri->VID_Init;
|
||||
VID_DeInit = ri->VID_DeInit;
|
||||
VID_GetRGBInfo = ri->VID_GetRGBInfo;
|
||||
VID_SetWindowCaption = ri->VID_SetWindowCaption;
|
||||
|
||||
Mod_Init = ri->Mod_Init;
|
||||
Mod_Shutdown = ri->Mod_Shutdown;
|
||||
Mod_Think = ri->Mod_Think;
|
||||
Mod_ClearAll = ri->Mod_ClearAll;
|
||||
Mod_ForName = ri->Mod_ForName;
|
||||
Mod_FindName = ri->Mod_FindName;
|
||||
Mod_Extradata = ri->Mod_Extradata;
|
||||
Mod_TouchModel = ri->Mod_TouchModel;
|
||||
|
||||
Mod_NowLoadExternal = ri->Mod_NowLoadExternal;
|
||||
|
||||
// Mod_GetTag = ri->Mod_GetTag;
|
||||
// Mod_TagNumForName = ri->Mod_TagNumForName;
|
||||
Mod_SkinForName = ri->Mod_SkinForName;
|
||||
Mod_FrameForName = ri->Mod_FrameForName;
|
||||
Mod_GetFrameDuration = ri->Mod_GetFrameDuration;
|
||||
|
||||
SCR_UpdateScreen = ri->SCR_UpdateScreen;
|
||||
}
|
||||
|
||||
|
@ -993,8 +926,7 @@ void R_ShutdownRenderer(void)
|
|||
CL_AllowIndependantSendCmd(false); //FIXME: figure out exactly which parts are going to affect the model loading.
|
||||
|
||||
P_Shutdown();
|
||||
if (Mod_Shutdown)
|
||||
Mod_Shutdown();
|
||||
Mod_Shutdown();
|
||||
|
||||
IN_Shutdown();
|
||||
|
||||
|
@ -1073,12 +1005,9 @@ qboolean R_ApplyRenderer_Load (rendererstate_t *newr)
|
|||
{
|
||||
int i, j;
|
||||
extern model_t *loadmodel;
|
||||
extern int host_hunklevel;
|
||||
|
||||
Cache_Flush();
|
||||
|
||||
Hunk_FreeToLowMark(host_hunklevel); //is this a good idea?
|
||||
|
||||
TRACE(("dbg: R_ApplyRenderer: old renderer closed\n"));
|
||||
|
||||
pmove.numphysent = 0;
|
||||
|
@ -1702,7 +1631,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
|
|||
int i, numframes, frame;
|
||||
float *pintervals, fullinterval, targettime, time;
|
||||
|
||||
psprite = currententity->model->cache.data;
|
||||
psprite = currententity->model->meshinfo;
|
||||
frame = currententity->framestate.g[FS_REG].frame[0];
|
||||
|
||||
if ((frame >= psprite->numframes) || (frame < 0))
|
||||
|
|
|
@ -56,7 +56,6 @@ void RSpeedShow(void);
|
|||
|
||||
void SCR_CrosshairPosition(playerview_t *pview, int *x, int *y);
|
||||
void SCR_DrawLoading (void);
|
||||
void SCR_CalcRefdef (void);
|
||||
void SCR_TileClear (void);
|
||||
void SCR_DrawNotifyString (void);
|
||||
void SCR_CheckDrawCenterString (void);
|
||||
|
|
|
@ -228,7 +228,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
TEXASSIGN(skin->textures.loweroverlay, r_nulltex);
|
||||
TEXASSIGN(skin->textures.upperoverlay, r_nulltex);
|
||||
|
||||
out = Cache_Check (&skin->cache);
|
||||
out = skin->skindata;
|
||||
if (out)
|
||||
return out;
|
||||
|
||||
|
@ -257,7 +257,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
skin->width = 320;
|
||||
skin->height = 200;
|
||||
|
||||
out = Cache_Alloc (&skin->cache, 320*200, skin->name);
|
||||
skin->skindata = out = BZ_Malloc(320*200);
|
||||
|
||||
memset (out, bv, 320*200);
|
||||
|
||||
|
@ -368,7 +368,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
skin->width = srcw;
|
||||
skin->height = srch;
|
||||
|
||||
out = Cache_Alloc (&skin->cache, skin->width*skin->height, skin->name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height);
|
||||
if (!out)
|
||||
Sys_Error ("Skin_Cache: couldn't allocate");
|
||||
|
||||
|
@ -382,7 +382,8 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
{
|
||||
if (raw - (qbyte*)pcx > com_filesize)
|
||||
{
|
||||
Cache_Free (&skin->cache);
|
||||
BZ_Free(skin->skindata);
|
||||
skin->skindata = NULL;
|
||||
skin->failedload = true;
|
||||
Con_Printf ("Skin %s was malformed. You should delete it.\n", name);
|
||||
return NULL;
|
||||
|
@ -394,7 +395,8 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
runLength = dataByte & 0x3F;
|
||||
if (raw - (qbyte*)pcx > com_filesize)
|
||||
{
|
||||
Cache_Free (&skin->cache);
|
||||
BZ_Free(skin->skindata);
|
||||
skin->skindata = NULL;
|
||||
skin->failedload = true;
|
||||
Con_Printf ("Skin %s was malformed. You should delete it.\n", name);
|
||||
return NULL;
|
||||
|
@ -406,7 +408,8 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
|
||||
// skin sanity check
|
||||
if (runLength + x > pcx->xmax + 2) {
|
||||
Cache_Free (&skin->cache);
|
||||
BZ_Free(skin->skindata);
|
||||
skin->skindata = NULL;
|
||||
skin->failedload = true;
|
||||
Con_Printf ("Skin %s was malformed. You should delete it.\n", name);
|
||||
return NULL;
|
||||
|
@ -431,7 +434,8 @@ qbyte *Skin_Cache8 (skin_t *skin)
|
|||
|
||||
if ( raw - (qbyte *)pcx > com_filesize)
|
||||
{
|
||||
Cache_Free (&skin->cache);
|
||||
BZ_Free(skin->skindata);
|
||||
skin->skindata = NULL;
|
||||
skin->failedload = true;
|
||||
Con_Printf ("Skin %s was malformed. You should delete it.\n", name);
|
||||
return NULL;
|
||||
|
@ -456,7 +460,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
if (skin->failedload)
|
||||
return NULL;
|
||||
|
||||
out = Cache_Check (&skin->cache);
|
||||
out = skin->skindata;
|
||||
if (out)
|
||||
return out;
|
||||
|
||||
|
@ -475,7 +479,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
pix = ReadTargaFile(raw, com_filesize, &skin->width, &skin->height, &hasalpha, false);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height*4);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
|
@ -488,7 +492,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
pix = ReadPCXFile(raw, com_filesize, &skin->width, &skin->height);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height*4);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
|
@ -502,7 +506,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
pix = ReadPNGFile(raw, com_filesize, &skin->width, &skin->height, name);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height*4);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
|
@ -517,7 +521,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
pix = ReadJPEGFile(raw, com_filesize, &skin->width, &skin->height);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height*4);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
|
@ -530,7 +534,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
pix = ReadJPEGFile(raw, com_filesize, &skin->width, &skin->height);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
skin->skindata = out = BZ_Malloc(skin->width*skin->height*4);
|
||||
memcpy(out, pix, skin->width*skin->height*4);
|
||||
BZ_Free(pix);
|
||||
return out;
|
||||
|
@ -629,8 +633,8 @@ void Skin_FlushAll(void)
|
|||
int i;
|
||||
for (i=0 ; i<numskins ; i++)
|
||||
{
|
||||
if (skins[i].cache.data)
|
||||
Cache_Free (&skins[i].cache);
|
||||
if (skins[i].skindata)
|
||||
BZ_Free(skins[i].skindata);
|
||||
}
|
||||
numskins = 0;
|
||||
|
||||
|
@ -657,8 +661,8 @@ void Skin_Skins_f (void)
|
|||
GL_GAliasFlushSkinCache();
|
||||
for (i=0 ; i<numskins ; i++)
|
||||
{
|
||||
if (skins[i].cache.data)
|
||||
Cache_Free (&skins[i].cache);
|
||||
if (skins[i].skindata)
|
||||
BZ_Free(skins[i].skindata);
|
||||
}
|
||||
numskins = 0;
|
||||
|
||||
|
@ -670,7 +674,6 @@ void Skin_Skins_f (void)
|
|||
SCR_SetLoadingStage(LS_NONE);
|
||||
|
||||
CL_SendClientCommand(true, "begin %i", cl.servercount);
|
||||
Cache_Report (); // print remaining memory
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1441,6 +1441,10 @@ void S_Startup (void)
|
|||
|
||||
S_ClearRaw();
|
||||
|
||||
if (!known_sfx)
|
||||
known_sfx = Z_Malloc(MAX_SFX*sizeof(sfx_t));
|
||||
num_sfx = 0;
|
||||
|
||||
CL_InitTEntSounds();
|
||||
|
||||
ambient_sfx[AMBIENT_WATER] = S_PrecacheSound ("ambience/water1.wav");
|
||||
|
@ -1689,16 +1693,9 @@ void S_Init (void)
|
|||
if (COM_CheckParm ("-multisound"))
|
||||
Cvar_SetValue(&snd_usemultipledevices, 1);
|
||||
|
||||
|
||||
if (host_parms.memsize < 0x800000)
|
||||
{
|
||||
Cvar_Set (&loadas8bit, "1");
|
||||
Con_Printf ("loading all sounds as 8bit\n");
|
||||
}
|
||||
|
||||
snd_initialized = true;
|
||||
|
||||
known_sfx = Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t");
|
||||
known_sfx = Z_Malloc(MAX_SFX*sizeof(sfx_t));
|
||||
num_sfx = 0;
|
||||
}
|
||||
|
||||
|
@ -1740,6 +1737,8 @@ void S_Shutdown(void)
|
|||
sound_started = 0;
|
||||
S_Purge(false);
|
||||
|
||||
Z_Free(known_sfx);
|
||||
known_sfx = NULL;
|
||||
num_sfx = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ static void *sys_memheap;
|
|||
static unsigned int sys_lastframe;
|
||||
static unsigned int vibrateduration;
|
||||
static char errormessage[256];
|
||||
static char sys_basedir[MAX_OSPATH];
|
||||
static char sys_basepak[MAX_OSPATH];
|
||||
extern jmp_buf host_abort;
|
||||
|
||||
cvar_t sys_vibrate = CVARD("sys_vibrate", "1", "Enables the system vibrator for damage events and such things. The value provided is a duration scaler.");
|
||||
|
@ -200,7 +202,7 @@ JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_init(JNIEnv *env, jobject o
|
|||
{
|
||||
"ftedroid",
|
||||
"-basepack",
|
||||
NULL, /*filled in later*/
|
||||
sys_basepak, /*filled in later*/
|
||||
"",
|
||||
""
|
||||
};
|
||||
|
@ -211,42 +213,17 @@ JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_init(JNIEnv *env, jobject o
|
|||
if (sys_memheap)
|
||||
free(sys_memheap);
|
||||
memset(&parms, 0, sizeof(parms));
|
||||
parms.basedir = NULL; /*filled in later*/
|
||||
parms.basedir = sys_basedir; /*filled in later*/
|
||||
parms.argc = 3;
|
||||
parms.argv = args;
|
||||
parms.memsize = 512*1024*1024;
|
||||
parms.membase = sys_memheap = malloc(parms.memsize);
|
||||
if (!parms.membase)
|
||||
{
|
||||
Sys_Printf("Unable to alloc heap\n");
|
||||
Q_strncpyz(errormessage, "Unable to alloc heap\n", sizeof(errormessage));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
basepack = parms.membase;
|
||||
tmp = (*env)->GetStringUTFChars(env, japkpath, NULL);
|
||||
strcpy(basepack, tmp);
|
||||
Q_strncpyz(sys_basepak, tmp, sizeof(sys_basedir));
|
||||
(*env)->ReleaseStringUTFChars(env, japkpath, tmp);
|
||||
parms.membase += strlen(basepack)+1;
|
||||
parms.memsize -= strlen(basepack)+1;
|
||||
|
||||
parms.basedir = parms.membase;
|
||||
tmp = (*env)->GetStringUTFChars(env, jusrpath, NULL);
|
||||
strcpy(parms.basedir, tmp);
|
||||
Q_strncpyz(sys_basedir, tmp, sizeof(sys_basedir));
|
||||
(*env)->ReleaseStringUTFChars(env, jusrpath, tmp);
|
||||
parms.membase += strlen(parms.basedir)+1;
|
||||
parms.memsize -= strlen(parms.basedir)+1;
|
||||
|
||||
align = (int)parms.membase & 15;
|
||||
if (align)
|
||||
{
|
||||
align = 16-align;
|
||||
parms.membase += align;
|
||||
parms.memsize -= align;
|
||||
}
|
||||
|
||||
args[2] = basepack;
|
||||
|
||||
|
||||
Sys_Printf("Starting up (apk=%s, usr=%s)\n", args[2], parms.basedir);
|
||||
|
|
|
@ -697,14 +697,6 @@ int main (int c, const char **v)
|
|||
}
|
||||
#endif
|
||||
|
||||
parms.memsize = 64*1024*1024;
|
||||
|
||||
j = COM_CheckParm("-mem");
|
||||
if (j && j+1 < com_argc)
|
||||
parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024);
|
||||
|
||||
parms.membase = malloc (parms.memsize);
|
||||
|
||||
parms.basedir = basedir;
|
||||
#ifdef __linux__
|
||||
//attempt to figure out where the exe is located
|
||||
|
|
|
@ -345,19 +345,9 @@ int main(int argc, char **argv)
|
|||
COM_InitArgv(argc, argv);
|
||||
TL_InitLanguages();
|
||||
|
||||
i = COM_CheckParm("-mem");
|
||||
if (i && i < com_argc)
|
||||
parms.memsize = atoi(com_argv[i+1])*1024*1024;
|
||||
else
|
||||
parms.memsize = 16*1024*1024;
|
||||
|
||||
parms.basedir = "";
|
||||
parms.argc = argc;
|
||||
parms.argv = argv;
|
||||
parms.membase = malloc(parms.memsize);
|
||||
|
||||
if (parms.membase == 0)
|
||||
Sys_Error("Can't allocated %d bytes\n", parms.memsize);
|
||||
|
||||
DynLoadBase = OpenLibrary("dynload.library", 0);
|
||||
|
||||
|
|
|
@ -475,34 +475,6 @@ int QDECL main(int argc, char **argv)
|
|||
|
||||
TL_InitLanguages();
|
||||
|
||||
parms.memsize = 0x2000000;
|
||||
|
||||
if (parms.memsize < 0x0800000)
|
||||
parms.memsize = 0x0800000;
|
||||
|
||||
|
||||
if (COM_CheckParm ("-heapsize"))
|
||||
{
|
||||
t = COM_CheckParm("-heapsize") + 1;
|
||||
|
||||
if (t < com_argc)
|
||||
parms.memsize = Q_atoi (com_argv[t]) * 1024;
|
||||
}
|
||||
else if (COM_CheckParm ("-mem"))
|
||||
{
|
||||
t = COM_CheckParm("-mem") + 1;
|
||||
|
||||
if (t < com_argc)
|
||||
parms.memsize = Q_atoi (com_argv[t]) * 1024*1024;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
parms.membase = VirtualAlloc (NULL, parms.memsize, MEM_RESERVE, PAGE_NOACCESS);
|
||||
#else
|
||||
parms.membase = malloc (parms.memsize);
|
||||
#endif
|
||||
|
||||
Sys_Printf ("Host_Init\n");
|
||||
Host_Init (&parms);
|
||||
|
||||
|
|
|
@ -780,12 +780,6 @@ void Sys_Init (void)
|
|||
|
||||
void Sys_Shutdown(void)
|
||||
{
|
||||
if (host_parms.membase)
|
||||
{
|
||||
VirtualFree(host_parms.membase, 0, MEM_RELEASE);
|
||||
host_parms.membase = 0;
|
||||
}
|
||||
|
||||
if (tevent)
|
||||
CloseHandle (tevent);
|
||||
tevent = NULL;
|
||||
|
@ -1415,45 +1409,6 @@ void SleepUntilInput (int time)
|
|||
|
||||
qboolean Sys_Startup_CheckMem(quakeparms_t *parms)
|
||||
{
|
||||
int t;
|
||||
MEMORYSTATUS lpBuffer;
|
||||
lpBuffer.dwLength = sizeof(MEMORYSTATUS);
|
||||
GlobalMemoryStatus (&lpBuffer);
|
||||
|
||||
// take the greater of all the available memory or half the total memory,
|
||||
// but at least 8 Mb and no more than 16 Mb, unless they explicitly
|
||||
// request otherwise
|
||||
parms->memsize = lpBuffer.dwAvailPhys;
|
||||
|
||||
if (parms->memsize < MINIMUM_WIN_MEMORY)
|
||||
parms->memsize = MINIMUM_WIN_MEMORY;
|
||||
|
||||
if (parms->memsize < (lpBuffer.dwTotalPhys >> 1))
|
||||
parms->memsize = lpBuffer.dwTotalPhys >> 1;
|
||||
|
||||
if (parms->memsize > MAXIMUM_WIN_MEMORY)
|
||||
parms->memsize = MAXIMUM_WIN_MEMORY;
|
||||
|
||||
if (COM_CheckParm ("-heapsize"))
|
||||
{
|
||||
t = COM_CheckParm("-heapsize") + 1;
|
||||
|
||||
if (t < com_argc)
|
||||
parms->memsize = Q_atoi (com_argv[t]) * 1024;
|
||||
}
|
||||
else if (COM_CheckParm ("-mem"))
|
||||
{
|
||||
t = COM_CheckParm("-mem") + 1;
|
||||
|
||||
if (t < com_argc)
|
||||
parms->memsize = Q_atoi (com_argv[t]) * 1024*1024;
|
||||
}
|
||||
|
||||
parms->membase = VirtualAlloc (NULL, parms->memsize, MEM_RESERVE, PAGE_NOACCESS);
|
||||
// parms->membase = malloc (parms.memsize);
|
||||
|
||||
if (!parms->membase)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1646,7 +1646,7 @@ void V_RenderView (void)
|
|||
{
|
||||
int viewnum;
|
||||
|
||||
R_LessenStains();
|
||||
Surf_LessenStains();
|
||||
|
||||
if (cls.state != ca_active)
|
||||
return;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,27 +9,14 @@
|
|||
int HLMod_BoneForName(model_t *mod, char *name);
|
||||
int HLMod_FrameForName(model_t *mod, char *name);
|
||||
|
||||
//frame is an index into this
|
||||
//a single pose within an animation (note: always refered to via a framegroup, even if there's only one frame in that group).
|
||||
typedef struct
|
||||
{
|
||||
#ifdef SKELETALMODELS
|
||||
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from their parent.
|
||||
//this is actually bad, and can result in bones shortening as they interpolate.
|
||||
#endif
|
||||
qboolean loop;
|
||||
int numposes;
|
||||
float rate;
|
||||
int poseofs;
|
||||
char name[64];
|
||||
} galiasgroup_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ofsverts;
|
||||
vecV_t *ofsverts;
|
||||
#ifndef SERVERONLY
|
||||
int ofsnormals;
|
||||
int ofstvector;
|
||||
int ofssvector;
|
||||
vec3_t *ofsnormals;
|
||||
vec3_t *ofstvector;
|
||||
vec3_t *ofssvector;
|
||||
|
||||
vboarray_t vboverts;
|
||||
vboarray_t vbonormals;
|
||||
|
@ -41,6 +28,21 @@ typedef struct
|
|||
vec3_t scale_origin;
|
||||
} galiaspose_t;
|
||||
|
||||
//a frame group (aka: animation)
|
||||
typedef struct
|
||||
{
|
||||
#ifdef SKELETALMODELS
|
||||
qboolean isheirachical; //for models with transforms, states that bones need to be transformed from their parent.
|
||||
//this is actually bad, and can result in bones shortening as they interpolate.
|
||||
#endif
|
||||
qboolean loop;
|
||||
int numposes;
|
||||
float rate;
|
||||
galiaspose_t *poseofs;
|
||||
float *boneofs; //numposes*12*numbones
|
||||
char name[64];
|
||||
} galiasgroup_t;
|
||||
|
||||
typedef struct galiasbone_s galiasbone_t;
|
||||
#ifdef SKELETALMODELS
|
||||
struct galiasbone_s
|
||||
|
@ -65,17 +67,19 @@ typedef struct
|
|||
//we can't be bothered with animating skins.
|
||||
//We'll load up to four of them but after that you're on your own
|
||||
#ifndef SERVERONLY
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int ofstexels; //this is 8bit for frame 0 only. only valid in q1 models without replacement textures, used for colourising player skins.
|
||||
qbyte **ofstexels; //this is 8bit for frame 0 only. only valid in q1 models without replacement textures, used for colourising player skins.
|
||||
float skinspeed;
|
||||
int numshaders;
|
||||
int ofsshaders;
|
||||
char name [MAX_QPATH];
|
||||
shader_t **ofsshaders;
|
||||
char name[MAX_QPATH];
|
||||
} galiasskin_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
texnums_t texnum;
|
||||
unsigned int tcolour;
|
||||
|
@ -87,16 +91,23 @@ typedef struct {
|
|||
} galiascolourmapped_t;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
vec3_t org;
|
||||
float ang[3][3];
|
||||
} md3tag_t;
|
||||
|
||||
typedef struct {
|
||||
int ofs_indexes;
|
||||
typedef struct galiasinfo_s
|
||||
{
|
||||
index_t *ofs_indexes;
|
||||
int numindexes;
|
||||
|
||||
int ofs_trineighbours;
|
||||
int *ofs_trineighbours;
|
||||
|
||||
int numskins;
|
||||
#ifndef SERVERONLY
|
||||
int ofsskins;
|
||||
galiasskin_t *ofsskins;
|
||||
#endif
|
||||
|
||||
int shares_verts; //used with models with two shaders using the same vertex. set to the surface number to inherit from (or itself).
|
||||
|
@ -105,27 +116,27 @@ typedef struct {
|
|||
int numverts;
|
||||
|
||||
#ifndef SERVERONLY
|
||||
int ofs_st_array;
|
||||
vec2_t *ofs_st_array;
|
||||
#endif
|
||||
|
||||
int groups;
|
||||
int groupofs;
|
||||
int baseframeofs; /*non-heirachical*/
|
||||
galiasgroup_t *groupofs;
|
||||
|
||||
int nextsurf;
|
||||
struct galiasinfo_s *nextsurf;
|
||||
|
||||
#ifdef SKELETALMODELS
|
||||
float *baseframeofs; /*non-heirachical*/
|
||||
int numbones;
|
||||
int ofsbones;
|
||||
galiasbone_t *ofsbones;
|
||||
int numswtransforms;
|
||||
int ofsswtransforms;
|
||||
galisskeletaltransforms_t *ofsswtransforms;
|
||||
|
||||
int ofs_skel_xyz;
|
||||
int ofs_skel_norm;
|
||||
int ofs_skel_svect;
|
||||
int ofs_skel_tvect;
|
||||
int ofs_skel_idx;
|
||||
int ofs_skel_weight;
|
||||
vecV_t *ofs_skel_xyz;
|
||||
vec3_t *ofs_skel_norm;
|
||||
vec3_t *ofs_skel_svect;
|
||||
vec3_t *ofs_skel_tvect;
|
||||
byte_vec4_t *ofs_skel_idx;
|
||||
vec4_t *ofs_skel_weight;
|
||||
|
||||
vboarray_t vbo_skel_verts;
|
||||
vboarray_t vbo_skel_normals;
|
||||
|
@ -140,7 +151,7 @@ typedef struct {
|
|||
//these exist only in the root mesh.
|
||||
int numtagframes;
|
||||
int numtags;
|
||||
int ofstags;
|
||||
md3tag_t *ofstags;
|
||||
} galiasinfo_t;
|
||||
|
||||
float *Alias_GetBonePositions(galiasinfo_t *inf, framestate_t *fstate, float *buffer, int buffersize, qboolean renderable);
|
||||
|
|
|
@ -1513,7 +1513,7 @@ void MSG_ReadDir (vec3_t dir)
|
|||
VectorCopy (bytedirs[b], dir);
|
||||
}
|
||||
#endif
|
||||
#ifdef Q2SERVER
|
||||
#if 1//def Q2SERVER
|
||||
void MSG_WriteDir (sizebuf_t *sb, vec3_t dir)
|
||||
{
|
||||
int i, best;
|
||||
|
|
|
@ -433,9 +433,8 @@ void FS_PureMode(int mode, char *packagelist, char *crclist, int seed); //implie
|
|||
qbyte *QDECL COM_LoadStackFile (const char *path, void *buffer, int bufsize);
|
||||
qbyte *COM_LoadTempFile (const char *path);
|
||||
qbyte *COM_LoadTempMoreFile (const char *path); //allocates a little bit more without freeing old temp
|
||||
qbyte *COM_LoadHunkFile (const char *path);
|
||||
//qbyte *COM_LoadHunkFile (const char *path);
|
||||
qbyte *COM_LoadMallocFile (const char *path);
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
||||
|
||||
searchpathfuncs_t *COM_IteratePaths (void **iterator, char *buffer, int buffersize);
|
||||
void COM_FlushFSCache(void); //a file was written using fopen
|
||||
|
@ -472,6 +471,8 @@ void COM_Gamedir (const char *dir);
|
|||
char *FS_GetGamedir(void);
|
||||
char *FS_GetBasedir(void);
|
||||
|
||||
struct zonegroup_s;
|
||||
void *FS_LoadMallocGroupFile(struct zonegroup_s *ctx, char *path);
|
||||
qbyte *FS_LoadMallocFile (const char *path);
|
||||
int FS_LoadFile(char *name, void **file);
|
||||
void FS_FreeFile(void *file);
|
||||
|
|
|
@ -1387,8 +1387,6 @@ qboolean FS_Copy(const char *source, const char *dest, enum fs_relative relative
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
static cache_user_t *loadcache;
|
||||
static qbyte *loadbuf;
|
||||
static int loadsize;
|
||||
|
||||
|
@ -1423,12 +1421,8 @@ qbyte *COM_LoadFile (const char *path, int usehunk)
|
|||
|
||||
if (usehunk == 0)
|
||||
buf = (qbyte*)Z_Malloc (len+1);
|
||||
else if (usehunk == 1)
|
||||
buf = (qbyte*)Hunk_AllocName (len+1, base);
|
||||
else if (usehunk == 2)
|
||||
buf = (qbyte*)Hunk_TempAlloc (len+1);
|
||||
else if (usehunk == 3)
|
||||
buf = (qbyte*)Cache_Alloc (loadcache, len+1, base);
|
||||
else if (usehunk == 4)
|
||||
{
|
||||
if (len+1 > loadsize)
|
||||
|
@ -1462,9 +1456,26 @@ qbyte *FS_LoadMallocFile (const char *path)
|
|||
return COM_LoadFile (path, 5);
|
||||
}
|
||||
|
||||
qbyte *COM_LoadHunkFile (const char *path)
|
||||
void *FS_LoadMallocGroupFile(zonegroup_t *ctx, char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 1);
|
||||
char *mem = NULL;
|
||||
vfsfile_t *f = FS_OpenVFS(path, "rb", FS_GAME);
|
||||
if (f)
|
||||
{
|
||||
int len = VFS_GETLEN(f);
|
||||
mem = ZG_Malloc(ctx, len+1);
|
||||
if (mem)
|
||||
{
|
||||
mem[len] = 0;
|
||||
if (VFS_READ(f, mem, len) == len)
|
||||
com_filesize = len;
|
||||
else
|
||||
mem = NULL;
|
||||
}
|
||||
|
||||
VFS_CLOSE(f);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
qbyte *COM_LoadTempFile (const char *path)
|
||||
|
@ -1476,12 +1487,6 @@ qbyte *COM_LoadTempMoreFile (const char *path)
|
|||
return COM_LoadFile (path, 6);
|
||||
}
|
||||
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu)
|
||||
{
|
||||
loadcache = cu;
|
||||
COM_LoadFile (path, 3);
|
||||
}
|
||||
|
||||
// uses temp hunk if larger than bufsize
|
||||
qbyte *QDECL COM_LoadStackFile (const char *path, void *buffer, int bufsize)
|
||||
{
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
extern cvar_t r_shadow_bumpscale_basetexture;
|
||||
|
||||
//these are in model.c (or gl_model.c)
|
||||
qboolean RMod_LoadVertexes (lump_t *l);
|
||||
qboolean RMod_LoadEdges (lump_t *l, qboolean lm);
|
||||
qboolean RMod_LoadMarksurfaces (lump_t *l, qboolean lm);
|
||||
qboolean RMod_LoadSurfedges (lump_t *l);
|
||||
void RMod_LoadLighting (lump_t *l);
|
||||
qboolean Mod_LoadVertexes (lump_t *l);
|
||||
qboolean Mod_LoadEdges (lump_t *l, qboolean lm);
|
||||
qboolean Mod_LoadMarksurfaces (lump_t *l, qboolean lm);
|
||||
qboolean Mod_LoadSurfedges (lump_t *l);
|
||||
void Mod_LoadLighting (lump_t *l);
|
||||
|
||||
|
||||
qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace);
|
||||
|
@ -47,7 +47,7 @@ unsigned int Q2BSP_PointContents(model_t *mod, vec3_t axis[3], vec3_t p);
|
|||
|
||||
extern char loadname[32];
|
||||
extern model_t *loadmodel;
|
||||
void RMod_Batches_Build(mesh_t *meshlist, model_t *mod, void (*build)(model_t *mod, msurface_t *surf, void *cookie), void *buildcookie);
|
||||
void Mod_Batches_Build(mesh_t *meshlist, model_t *mod, void (*build)(model_t *mod, msurface_t *surf, void *cookie), void *buildcookie);
|
||||
float RadiusFromBounds (vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
int i;
|
||||
|
@ -873,7 +873,7 @@ static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const
|
|||
{
|
||||
qbyte *data;
|
||||
|
||||
data = Hunk_AllocName( patch->numfacets * sizeof( q2cbrush_t ) + totalsides * ( sizeof( q2cbrushside_t ) + sizeof( mplane_t ) ), "patch");
|
||||
data = ZG_Malloc(&loadmodel->memgroup, patch->numfacets * sizeof( q2cbrush_t ) + totalsides * ( sizeof( q2cbrushside_t ) + sizeof( mplane_t ) ));
|
||||
|
||||
patch->facets = ( q2cbrush_t * )data; data += patch->numfacets * sizeof( q2cbrush_t );
|
||||
memcpy( patch->facets, facets, patch->numfacets * sizeof( q2cbrush_t ) );
|
||||
|
@ -1102,7 +1102,7 @@ qboolean CMod_LoadSurfaces (lump_t *l)
|
|||
// Host_Error ("Map has too many surfaces");
|
||||
|
||||
numtexinfo = count;
|
||||
out = map_surfaces = Hunk_AllocName(count * sizeof(*map_surfaces), "surfaces");
|
||||
out = map_surfaces = ZG_Malloc(&loadmodel->memgroup, count * sizeof(*map_surfaces));
|
||||
|
||||
for ( i=0 ; i<count ; i++, in++, out++)
|
||||
{
|
||||
|
@ -1154,7 +1154,7 @@ texture_t *Mod_LoadWall(char *name, char *sname)
|
|||
wal->contents = LittleLong(wal->contents);
|
||||
wal->value = LittleLong(wal->value);
|
||||
|
||||
tex = Hunk_AllocName(sizeof(texture_t), ln);
|
||||
tex = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t));
|
||||
|
||||
tex->offsets[0] = wal->offsets[0];
|
||||
tex->width = wal->width;
|
||||
|
@ -1210,9 +1210,9 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
loadmodel->textures = Hunk_AllocName(sizeof(texture_t *)*count, loadname);
|
||||
loadmodel->textures = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t *)*count);
|
||||
texcount = 0;
|
||||
|
||||
loadmodel->texinfo = out;
|
||||
|
@ -1266,7 +1266,7 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
|
|||
out->texture = Mod_LoadWall (name, sname);
|
||||
if (!out->texture || !out->texture->width || !out->texture->height)
|
||||
{
|
||||
out->texture = Hunk_AllocName(sizeof(texture_t) + 16*16+8*8+4*4+2*2, in->texture);
|
||||
out->texture = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t) + 16*16+8*8+4*4+2*2);
|
||||
|
||||
Con_Printf (CON_WARNING "Couldn't load %s\n", name);
|
||||
memcpy(out->texture, r_notexture_mip, sizeof(texture_t) + 16*16+8*8+4*4+2*2);
|
||||
|
@ -1354,7 +1354,7 @@ qboolean CMod_LoadFaces (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( (count+6)*sizeof(*out), loadname); //spare for skybox
|
||||
out = ZG_Malloc(&loadmodel->memgroup, (count+6)*sizeof(*out)); //spare for skybox
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
|
@ -1462,7 +1462,7 @@ qboolean CMod_LoadNodes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
out = Hunk_AllocName(sizeof(mnode_t)*count, "nodes");
|
||||
out = ZG_Malloc(&loadmodel->memgroup, sizeof(mnode_t)*count);
|
||||
|
||||
loadmodel->nodes = out;
|
||||
loadmodel->numnodes = count;
|
||||
|
@ -1525,7 +1525,7 @@ qboolean CMod_LoadBrushes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
map_brushes = Hunk_AllocName(sizeof(*out) * (count+1), "brushes");
|
||||
map_brushes = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * (count+1));
|
||||
|
||||
out = map_brushes;
|
||||
|
||||
|
@ -1871,7 +1871,7 @@ qboolean CMod_LoadVisibility (lump_t *l)
|
|||
// return false;
|
||||
// }
|
||||
|
||||
map_q2vis = Hunk_AllocName(l->filelen, "vis");
|
||||
map_q2vis = ZG_Malloc(&loadmodel->memgroup, l->filelen);
|
||||
memcpy (map_q2vis, cmod_base + l->fileofs, l->filelen);
|
||||
|
||||
loadmodel->vis = map_q2vis;
|
||||
|
@ -1897,7 +1897,7 @@ void CMod_LoadEntityString (lump_t *l)
|
|||
// if (l->filelen > MAX_Q2MAP_ENTSTRING)
|
||||
// Host_Error ("Map has too large entity lump");
|
||||
|
||||
map_entitystring = Hunk_AllocName(l->filelen+1, "ents");
|
||||
map_entitystring = ZG_Malloc(&loadmodel->memgroup, l->filelen+1);
|
||||
memcpy (map_entitystring, cmod_base + l->fileofs, l->filelen);
|
||||
|
||||
loadmodel->entities = map_entitystring;
|
||||
|
@ -1919,7 +1919,7 @@ qboolean CModQ3_LoadMarksurfaces (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
loadmodel->marksurfaces = out;
|
||||
loadmodel->nummarksurfaces = count;
|
||||
|
@ -2036,15 +2036,15 @@ qboolean CModQ3_LoadShaders (lump_t *l)
|
|||
// Host_Error ("Map has too many shaders");
|
||||
|
||||
numtexinfo = count;
|
||||
out = map_surfaces = Hunk_AllocName(count*sizeof(*out), "tsurfaces");
|
||||
out = map_surfaces = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
loadmodel->texinfo = Hunk_AllocName(sizeof(mtexinfo_t)*count, "texinfo");
|
||||
loadmodel->texinfo = ZG_Malloc(&loadmodel->memgroup, sizeof(mtexinfo_t)*count);
|
||||
loadmodel->numtextures = count;
|
||||
loadmodel->textures = Hunk_AllocName(sizeof(texture_t*)*count, "textures");
|
||||
loadmodel->textures = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t*)*count);
|
||||
|
||||
for ( i=0 ; i<count ; i++, in++, out++ )
|
||||
{
|
||||
loadmodel->texinfo[i].texture = Hunk_AllocName(sizeof(texture_t), in->shadername);
|
||||
loadmodel->texinfo[i].texture = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t));
|
||||
Q_strncpyz(loadmodel->texinfo[i].texture->name, in->shadername, sizeof(loadmodel->texinfo[i].texture->name));
|
||||
loadmodel->textures[i] = loadmodel->texinfo[i].texture;
|
||||
|
||||
|
@ -2078,13 +2078,13 @@ qboolean CModQ3_LoadVertexes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
out = Hunk_AllocName ( count*sizeof(*out), "vert_v");
|
||||
stout = Hunk_AllocName ( count*sizeof(*stout), "vert_st");
|
||||
lmout = Hunk_AllocName ( count*sizeof(*lmout), "vert_lm1");
|
||||
cout = Hunk_AllocName ( count*sizeof(*cout), "vert_c");
|
||||
nout = Hunk_AllocName ( count*sizeof(*nout), "vert_n");
|
||||
sout = Hunk_AllocName ( count*sizeof(*nout), "vert_s");
|
||||
tout = Hunk_AllocName ( count*sizeof(*nout), "vert_t");
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
stout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*stout));
|
||||
lmout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*lmout));
|
||||
cout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*cout));
|
||||
nout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*nout));
|
||||
sout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*nout));
|
||||
tout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*nout));
|
||||
map_verts = out;
|
||||
map_vertstmexcoords = stout;
|
||||
map_vertlstmexcoords[0] = lmout;
|
||||
|
@ -2142,13 +2142,13 @@ qboolean CModRBSP_LoadVertexes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
out = Hunk_AllocName ( count*sizeof(*out), "vert_v");
|
||||
stout = Hunk_AllocName ( count*sizeof(*stout), "vert_st");
|
||||
lmout = Hunk_AllocName ( MAXLIGHTMAPS*count*sizeof(*lmout), "vert_lm4");
|
||||
cout = Hunk_AllocName ( count*sizeof(*cout), "vert_c");
|
||||
nout = Hunk_AllocName ( count*sizeof(*nout), "vert_n");
|
||||
sout = Hunk_AllocName ( count*sizeof(*sout), "vert_s");
|
||||
tout = Hunk_AllocName ( count*sizeof(*tout), "vert_t");
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
stout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*stout));
|
||||
lmout = ZG_Malloc(&loadmodel->memgroup, MAXLIGHTMAPS*count*sizeof(*lmout));
|
||||
cout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*cout));
|
||||
nout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*nout));
|
||||
sout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*sout));
|
||||
tout = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*tout));
|
||||
map_verts = out;
|
||||
map_vertstmexcoords = stout;
|
||||
for (sty = 0; sty < MAXLIGHTMAPS; sty++)
|
||||
|
@ -2191,7 +2191,7 @@ qboolean CModQ3_LoadIndexes (lump_t *l)
|
|||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
{
|
||||
Con_Printf (CON_ERROR "MOD_LoadBmodel: funny lump size in %s\n",loadmodel->name);
|
||||
Con_Printf (CON_ERROR "MOD_LoadBmodel: funny lump size in %s\n", loadmodel->name);
|
||||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
|
@ -2202,7 +2202,7 @@ qboolean CModQ3_LoadIndexes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name );
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
map_surfindexes = out;
|
||||
map_numsurfindexes = count;
|
||||
|
@ -2321,7 +2321,7 @@ qboolean CModQ3_LoadFogs (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), "fogs");
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
map_fogs = out;
|
||||
map_numfogs = count;
|
||||
|
@ -2341,7 +2341,7 @@ qboolean CModQ3_LoadFogs (lump_t *l)
|
|||
out->shader = R_RegisterShader_Lightmap ( in->shader );
|
||||
R_BuildDefaultTexnums(&out->shader->defaulttextures, out->shader);
|
||||
out->numplanes = brush->numsides;
|
||||
out->planes = Hunk_AllocName ( out->numplanes*sizeof(cplane_t *), "fogplane");
|
||||
out->planes = ZG_Malloc(&loadmodel->memgroup, out->numplanes*sizeof(cplane_t *));
|
||||
|
||||
for ( j = 0; j < out->numplanes; j++ )
|
||||
{
|
||||
|
@ -2686,9 +2686,9 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name );
|
||||
pl = Hunk_AllocName (count*sizeof(*pl), loadmodel->name);//create a new array of planes for speed.
|
||||
mesh = Hunk_AllocName (count*sizeof(*mesh), loadmodel->name);
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
pl = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*pl));//create a new array of planes for speed.
|
||||
mesh = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*mesh));
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
|
@ -2802,9 +2802,9 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name );
|
||||
pl = Hunk_AllocName (count*sizeof(*pl), loadmodel->name);//create a new array of planes for speed.
|
||||
mesh = Hunk_AllocName (count*sizeof(*mesh), loadmodel->name);
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
pl = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*pl));//create a new array of planes for speed.
|
||||
mesh = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*mesh));
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
|
@ -2950,7 +2950,7 @@ qboolean CModQ3_LoadNodes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = ZG_Malloc(&loadmodel->memgroup, count*sizeof(*out));
|
||||
|
||||
if (count > SANITY_MAX_MAP_NODES)
|
||||
{
|
||||
|
@ -3018,7 +3018,7 @@ qboolean CModQ3_LoadBrushes (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
|
||||
map_brushes = Hunk_AllocName(sizeof(*out) * (count+1), "brushes");
|
||||
map_brushes = ZG_Malloc(&loadmodel->memgroup, sizeof(*out) * (count+1));
|
||||
|
||||
out = map_brushes;
|
||||
|
||||
|
@ -3307,7 +3307,7 @@ qboolean CModQ3_LoadVisibility (lump_t *l)
|
|||
|
||||
numclusters++;
|
||||
|
||||
map_q3pvs = Hunk_AllocName(sizeof(*map_q3pvs) + (numclusters+7)/8 * numclusters, "pvs");
|
||||
map_q3pvs = ZG_Malloc(&loadmodel->memgroup, sizeof(*map_q3pvs) + (numclusters+7)/8 * numclusters);
|
||||
memset (map_q3pvs, 0xff, sizeof(*map_q3pvs) + (numclusters+7)/8 * numclusters);
|
||||
map_q3pvs->numclusters = numclusters;
|
||||
numvisibility = 0;
|
||||
|
@ -3317,7 +3317,7 @@ qboolean CModQ3_LoadVisibility (lump_t *l)
|
|||
{
|
||||
numvisibility = l->filelen;
|
||||
|
||||
map_q3pvs = Hunk_AllocName(l->filelen, "pvs");
|
||||
map_q3pvs = ZG_Malloc(&loadmodel->memgroup, l->filelen);
|
||||
loadmodel->vis = (q2dvis_t *)map_q3pvs;
|
||||
memcpy (map_q3pvs, cmod_base + l->fileofs, l->filelen);
|
||||
|
||||
|
@ -3352,7 +3352,7 @@ void CModQ3_LoadLighting (lump_t *l)
|
|||
BuildLightMapGammaTable(1, (1<<(2-gl_overbright.ival)));
|
||||
|
||||
loadmodel->engineflags |= MDLF_RGBLIGHTING;
|
||||
loadmodel->lightdata = out = Hunk_AllocName(samples, "lit data");
|
||||
loadmodel->lightdata = out = ZG_Malloc(&loadmodel->memgroup, samples);
|
||||
|
||||
//be careful here, q3bsp deluxemapping is done using interleaving. we want to unoverbright ONLY lightmaps and not deluxemaps.
|
||||
for (m = 0; m < maps; m++)
|
||||
|
@ -3395,7 +3395,7 @@ qboolean CModQ3_LoadLightgrid (lump_t *l)
|
|||
return false;
|
||||
}
|
||||
count = l->filelen / sizeof(*in);
|
||||
grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + count*sizeof(*out), loadmodel->name );
|
||||
grid = ZG_Malloc(&loadmodel->memgroup, sizeof(q3lightgridinfo_t) + count*sizeof(*out));
|
||||
grid->lightgrid = (dq3gridlight_t*)(grid+1);
|
||||
out = grid->lightgrid;
|
||||
|
||||
|
@ -3429,7 +3429,7 @@ qboolean CModRBSP_LoadLightgrid (lump_t *elements, lump_t *indexes)
|
|||
icount = indexes->filelen / sizeof(*iin);
|
||||
ecount = elements->filelen / sizeof(*ein);
|
||||
|
||||
grid = Hunk_AllocName (sizeof(q3lightgridinfo_t) + ecount*sizeof(*eout) + icount*sizeof(*iout), loadmodel->name );
|
||||
grid = ZG_Malloc(&loadmodel->memgroup, sizeof(q3lightgridinfo_t) + ecount*sizeof(*eout) + icount*sizeof(*iout));
|
||||
grid->rbspelements = (rbspgridlight_t*)((char *)grid + sizeof(q3lightgridinfo_t));
|
||||
grid->rbspindexes = (unsigned short*)((char *)grid + sizeof(q3lightgridinfo_t) + ecount*sizeof(*eout));
|
||||
eout = grid->rbspelements;
|
||||
|
@ -3559,7 +3559,7 @@ void CMQ3_CalcPHS (void)
|
|||
|
||||
Con_DPrintf ("Building PHS...\n");
|
||||
|
||||
map_q3phs = Hunk_AllocName(sizeof(*map_q3phs) + map_q3pvs->rowsize * map_q3pvs->numclusters, "phs");
|
||||
map_q3phs = ZG_Malloc(&loadmodel->memgroup, sizeof(*map_q3phs) + map_q3pvs->rowsize * map_q3pvs->numclusters);
|
||||
|
||||
rowwords = map_q3pvs->rowsize / sizeof(int);
|
||||
rowbytes = map_q3pvs->rowsize;
|
||||
|
@ -3752,7 +3752,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
int length;
|
||||
static unsigned last_checksum;
|
||||
qboolean noerrors = true;
|
||||
int start;
|
||||
model_t *im = loadmodel;
|
||||
|
||||
void (*buildmeshes)(model_t *mod, msurface_t *surf, void *cookie) = NULL;
|
||||
|
@ -3796,7 +3795,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
header.version = LittleLong(header.version);
|
||||
|
||||
cmod_base = mod_base = (qbyte *)buf;
|
||||
start = Hunk_LowMark();
|
||||
|
||||
if (header.ident == (('F'<<0)+('B'<<8)+('S'<<16)+('P'<<24)))
|
||||
{
|
||||
|
@ -3962,8 +3960,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
BZ_Free(map_faces);
|
||||
if (map_leaffaces)
|
||||
BZ_Free(map_leaffaces);
|
||||
|
||||
Hunk_FreeToLowMark(start);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -4012,7 +4008,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
{
|
||||
BZ_Free(map_faces);
|
||||
BZ_Free(map_leaffaces);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return NULL;
|
||||
}
|
||||
#ifndef CLIENTONLY
|
||||
|
@ -4077,11 +4072,11 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
case QR_OPENGL:
|
||||
// load into heap
|
||||
#ifndef SERVERONLY
|
||||
noerrors = noerrors && RMod_LoadVertexes (&header.lumps[Q2LUMP_VERTEXES]);
|
||||
noerrors = noerrors && RMod_LoadEdges (&header.lumps[Q2LUMP_EDGES], false);
|
||||
noerrors = noerrors && RMod_LoadSurfedges (&header.lumps[Q2LUMP_SURFEDGES]);
|
||||
noerrors = noerrors && Mod_LoadVertexes (&header.lumps[Q2LUMP_VERTEXES]);
|
||||
noerrors = noerrors && Mod_LoadEdges (&header.lumps[Q2LUMP_EDGES], false);
|
||||
noerrors = noerrors && Mod_LoadSurfedges (&header.lumps[Q2LUMP_SURFEDGES]);
|
||||
if (noerrors)
|
||||
RMod_LoadLighting (&header.lumps[Q2LUMP_LIGHTING]);
|
||||
Mod_LoadLighting (&header.lumps[Q2LUMP_LIGHTING]);
|
||||
#endif
|
||||
noerrors = noerrors && CMod_LoadSurfaces (&header.lumps[Q2LUMP_TEXINFO]);
|
||||
noerrors = noerrors && CMod_LoadLeafBrushes (&header.lumps[Q2LUMP_LEAFBRUSHES]);
|
||||
|
@ -4089,7 +4084,7 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
#ifndef SERVERONLY
|
||||
noerrors = noerrors && CMod_LoadTexInfo (&header.lumps[Q2LUMP_TEXINFO]);
|
||||
noerrors = noerrors && CMod_LoadFaces (&header.lumps[Q2LUMP_FACES]);
|
||||
noerrors = noerrors && RMod_LoadMarksurfaces (&header.lumps[Q2LUMP_LEAFFACES], false);
|
||||
noerrors = noerrors && Mod_LoadMarksurfaces (&header.lumps[Q2LUMP_LEAFFACES], false);
|
||||
#endif
|
||||
noerrors = noerrors && CMod_LoadVisibility (&header.lumps[Q2LUMP_VISIBILITY]);
|
||||
noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]);
|
||||
|
@ -4104,7 +4099,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
|
||||
if (!noerrors)
|
||||
{
|
||||
Hunk_FreeToLowMark(start);
|
||||
return NULL;
|
||||
}
|
||||
#ifndef CLIENTONLY
|
||||
|
@ -4123,7 +4117,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
Hunk_FreeToLowMark(start);
|
||||
return NULL;
|
||||
Sys_Error("Bad internal renderer on q2 map load\n");
|
||||
}
|
||||
|
@ -4148,7 +4141,7 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
loadmodel->vbos = NULL;
|
||||
#ifndef SERVERONLY
|
||||
if (qrenderer != QR_NONE)
|
||||
RMod_Batches_Build(NULL, loadmodel, buildmeshes, buildcookie);
|
||||
Mod_Batches_Build(NULL, loadmodel, buildmeshes, buildcookie);
|
||||
#endif
|
||||
|
||||
loadmodel->numsubmodels = CM_NumInlineModels(loadmodel);
|
||||
|
@ -4177,6 +4170,7 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
*loadmodel = *mod;
|
||||
strcpy (loadmodel->name, name);
|
||||
mod = loadmodel;
|
||||
memset(&mod->memgroup, 0, sizeof(mod->memgroup));
|
||||
|
||||
bm = CM_InlineModel (name);
|
||||
|
||||
|
@ -4196,7 +4190,7 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
|||
mod->vbos = NULL;
|
||||
#ifndef SERVERONLY
|
||||
if (qrenderer != QR_NONE)
|
||||
RMod_Batches_Build(NULL, mod, buildmeshes, buildcookie);
|
||||
Mod_Batches_Build(NULL, mod, buildmeshes, buildcookie);
|
||||
#endif
|
||||
|
||||
VectorCopy (bm->maxs, mod->maxs);
|
||||
|
@ -4321,7 +4315,7 @@ void CM_InitBoxHull (void)
|
|||
|
||||
box_model.hulls[0].available = true;
|
||||
|
||||
box_model.nodes = Hunk_Alloc(sizeof(mnode_t)*6);
|
||||
box_model.nodes = ZG_Malloc(&loadmodel->memgroup, sizeof(mnode_t)*6);
|
||||
box_planes = &map_planes[numplanes];
|
||||
if (numbrushes+1 > SANITY_MAX_MAP_BRUSHES
|
||||
|| numleafbrushes+1 > MAX_Q2MAP_LEAFBRUSHES
|
||||
|
|
|
@ -95,6 +95,7 @@ extern vec3_t vec3_origin;
|
|||
#define Vector4Scale(in,scale,out) ((out)[0]=(in)[0]*scale,(out)[1]=(in)[1]*scale,(out)[2]=(in)[2]*scale,(out)[3]=(in)[3]*scale)
|
||||
#define Vector4Add(a,b,c) ((c)[0]=(((a[0])+(b[0]))),(c)[1]=(((a[1])+(b[1]))),(c)[2]=(((a[2])+(b[2]))),(c)[3]=(((a[3])+(b[3]))))
|
||||
#define Vector4Set(r,x,y,z,w) {(r)[0] = x; (r)[1] = y;(r)[2] = z;(r)[3]=w;}
|
||||
#define Vector4Interpolate(a, bness, b, c) FloatInterpolate((a)[0], bness, (b)[0], (c)[0]),FloatInterpolate((a)[1], bness, (b)[1], (c)[1]),FloatInterpolate((a)[2], bness, (b)[2], (c)[2]),FloatInterpolate((a)[3], bness, (b)[3], (c)[3])
|
||||
|
||||
typedef float matrix3x4[3][4];
|
||||
typedef float matrix3x3[3][3];
|
||||
|
|
|
@ -1216,7 +1216,7 @@ void Plug_Load_f(void)
|
|||
}
|
||||
if (!Plug_Load(plugin, PLUG_EITHER))
|
||||
{
|
||||
if (!Plug_Load(va("plugins/%s", plugin), PLUG_EITHER))
|
||||
if (!Plug_Load(va("plugins/%s", plugin), PLUG_QVM))
|
||||
Con_Printf("Couldn't load plugin %s\n", Cmd_Argv(1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,8 +27,10 @@ void PF_Common_RegisterCvars(void)
|
|||
Cvar_Register (&pr_tempstringsize, cvargroup_progs);
|
||||
Cvar_Register (&pr_enable_uriget, cvargroup_progs);
|
||||
|
||||
#ifdef RAGDOLL
|
||||
Cmd_AddCommand("skel_info", skel_info_f);
|
||||
Cmd_AddCommand("skel_generateragdoll", skel_generateragdoll_f);
|
||||
#endif
|
||||
|
||||
WPhys_Init();
|
||||
}
|
||||
|
|
|
@ -809,7 +809,7 @@ void Q1BSP_LoadBrushes(model_t *model)
|
|||
if (permodel->modelnum)
|
||||
rootnode += model->submodels[permodel->modelnum-1].headnode[0];
|
||||
|
||||
brush = Hunk_Alloc((sizeof(*brush) - sizeof(brush->planes[0]))*permodel->numbrushes + sizeof(brush->planes[0])*(permodel->numbrushes*6+permodel->numplanes));
|
||||
brush = ZG_Malloc(&model->memgroup, (sizeof(*brush) - sizeof(brush->planes[0]))*permodel->numbrushes + sizeof(brush->planes[0])*(permodel->numbrushes*6+permodel->numplanes));
|
||||
remainingplanes = permodel->numplanes;
|
||||
perbrush = (void*)(permodel+1);
|
||||
for (br = 0; br < permodel->numbrushes; br++)
|
||||
|
|
|
@ -134,7 +134,6 @@
|
|||
"TL_NETBINDINTERFACE \"Binding to IP Interface Address of %s\\n\"\n"
|
||||
"TL_IPADDRESSIS \"IP address %s\\n\"\n"
|
||||
"TL_UDPINITED \"UDP Initialized\\n\"\n"
|
||||
"TL_SERVERPORTINITED \"Server port Initialized\\n\"\n"
|
||||
"TL_CLIENTPORTINITED \"Client port Initialized\\n\"\n"
|
||||
"TL_OUTMESSAGEOVERFLOW \"%s:Outgoing message overflow\\n\"\n"
|
||||
"TL_OUTOFORDERPACKET \"%s:Out of order packet %i at %i\\n\"\n"
|
||||
|
|
|
@ -138,7 +138,6 @@ static char *defaultlanguagetext =
|
|||
"TL_NETSENDERROR \"NET_SendPacket ERROR: %i\\n\"\n"
|
||||
"TL_NETBINDINTERFACE \"Binding to IP Interface Address of %s\\n\"\n"
|
||||
"TL_IPADDRESSIS \"IP address %s\\n\"\n"
|
||||
"TL_SERVERPORTINITED \"Server port Initialized\\n\"\n"
|
||||
"TL_CLIENTPORTINITED \"Client port Initialized\\n\"\n"
|
||||
"TL_OUTMESSAGEOVERFLOW \"%s:Outgoing message overflow\\n\"\n"
|
||||
"TL_OUTOFORDERPACKET \"%s:Out of order packet %i at %i\\n\"\n"
|
||||
|
|
|
@ -170,7 +170,6 @@
|
|||
NAME(TL_NETSENDERROR)
|
||||
NAME(TL_NETBINDINTERFACE)
|
||||
NAME(TL_IPADDRESSIS)
|
||||
NAME(TL_SERVERPORTINITED)
|
||||
NAME(TL_CLIENTPORTINITED)
|
||||
|
||||
NAME(TL_OUTMESSAGEOVERFLOW)
|
||||
|
|
|
@ -269,11 +269,11 @@ void VARGS WorldQ2_UnlinkEdict(world_t *w, q2edict_t *ent);
|
|||
int VARGS WorldQ2_AreaEdicts (world_t *w, vec3_t mins, vec3_t maxs, q2edict_t **list,
|
||||
int maxcount, int areatype);
|
||||
trace_t WorldQ2_Move (world_t *w, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int hitcontentsmask, q2edict_t *passedict);
|
||||
|
||||
#endif
|
||||
#ifdef Q2BSPS
|
||||
unsigned int Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *buffer, unsigned int buffersize, qboolean add);
|
||||
qboolean Q2BSP_EdictInFatPVS(model_t *mod, struct pvscache_s *ent, qbyte *pvs);
|
||||
void Q2BSP_FindTouchedLeafs(model_t *mod, struct pvscache_s *ent, float *mins, float *maxs);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
1590
engine/common/zone.c
1590
engine/common/zone.c
File diff suppressed because it is too large
Load diff
|
@ -83,7 +83,7 @@ Zone block
|
|||
|
||||
*/
|
||||
|
||||
void Memory_Init (void *buf, int size);
|
||||
void Memory_Init (void);
|
||||
void Memory_DeInit(void);
|
||||
|
||||
void VARGS Z_Free (void *ptr);
|
||||
|
@ -109,6 +109,16 @@ void *BZF_Realloc(void *data, int newsize);
|
|||
void *BZF_ReallocNamed(void *data, int newsize, char *file, int line);
|
||||
void BZ_Free(void *ptr);
|
||||
|
||||
//ctx should start off as void*ctx=NULL
|
||||
typedef struct zonegroup_s
|
||||
{
|
||||
void *first;
|
||||
int bytes;
|
||||
} zonegroup_t;
|
||||
void *ZG_Malloc(zonegroup_t *ctx, int size);
|
||||
void *ZG_MallocNamed(zonegroup_t *ctx, int size, char *file, int line);
|
||||
void ZG_FreeGroup(zonegroup_t *ctx);
|
||||
|
||||
#ifdef USE_MSVCRT_DEBUG
|
||||
#define BZ_Malloc(size) BZ_MallocNamed(size, __FILE__, __LINE__)
|
||||
#define Z_Malloc(size) Z_MallocNamed(size, __FILE__, __LINE__)
|
||||
|
@ -116,30 +126,27 @@ void BZ_Free(void *ptr);
|
|||
#define BZF_Malloc(size) BZF_MallocNamed(size, __FILE__, __LINE__)
|
||||
#define ZF_Malloc(size) ZF_MallocNamed(size, __FILE__, __LINE__)
|
||||
#define BZF_Realloc(ptr, size) BZF_ReallocNamed(ptr, size, __FILE__, __LINE__)
|
||||
#define ZG_Malloc(ctx, size) ZG_MallocNamed(ctx, size, __FILE__, __LINE__)
|
||||
#endif
|
||||
|
||||
#define Z_StrDup(s) strcpy(Z_Malloc(strlen(s)+1), s)
|
||||
|
||||
/*
|
||||
void *Hunk_Alloc (int size); // returns 0 filled memory
|
||||
void *Hunk_AllocName (int size, char *name);
|
||||
|
||||
int Hunk_LowMark (void);
|
||||
void Hunk_FreeToLowMark (int mark);
|
||||
int Hunk_LowMemAvailable(void);
|
||||
*/
|
||||
|
||||
void *Hunk_TempAlloc (int size);
|
||||
void *Hunk_TempAllocMore (int size); //Don't clear old temp
|
||||
|
||||
void Hunk_Check (void);
|
||||
|
||||
/*
|
||||
typedef struct cache_user_s
|
||||
{
|
||||
void *data;
|
||||
qboolean fake;
|
||||
} cache_user_t;
|
||||
|
||||
*/
|
||||
void Cache_Flush (void);
|
||||
|
||||
/*
|
||||
void *Cache_Check (cache_user_t *c);
|
||||
// returns the cached data, and moves to the head of the LRU list
|
||||
// if present, otherwise returns NULL
|
||||
|
@ -151,4 +158,4 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name);
|
|||
// wasn't enough room.
|
||||
|
||||
void Cache_Report (void);
|
||||
|
||||
*/
|
||||
|
|
|
@ -2654,7 +2654,7 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
|||
VectorScale((m+8), mod->clampscale, (m+8));
|
||||
}
|
||||
|
||||
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
|
||||
if (e->flags & Q2RF_WEAPONMODEL)
|
||||
{
|
||||
/*FIXME: no bob*/
|
||||
float iv[16];
|
||||
|
|
|
@ -708,7 +708,6 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
|
|||
// pD3DX->lpVtbl->GetBufferSize((void*)pD3DX, &width, &height);
|
||||
vid.pixelwidth = width;
|
||||
vid.pixelheight = height;
|
||||
vid.recalc_refdef = true;
|
||||
|
||||
vid.width = width;
|
||||
vid.height = height;
|
||||
|
@ -1026,12 +1025,6 @@ static void (D3D9_SCR_UpdateScreen) (void)
|
|||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// determine size of refresh window
|
||||
//
|
||||
if (vid.recalc_refdef)
|
||||
SCR_CalcRefdef ();
|
||||
|
||||
//
|
||||
// do 3D refresh drawing, and then update the screen
|
||||
//
|
||||
|
@ -1259,26 +1252,6 @@ rendererinfo_t d3d9rendererinfo =
|
|||
D3D9_R_NewMap,
|
||||
D3D9_R_PreNewMap,
|
||||
|
||||
Surf_AddStain,
|
||||
Surf_LessenStains,
|
||||
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
Mod_GetTag,
|
||||
Mod_TagNumForName,
|
||||
Mod_SkinNumForName,
|
||||
Mod_FrameNumForName,
|
||||
Mod_FrameDuration,
|
||||
|
||||
|
||||
D3D9_VID_Init,
|
||||
D3D9_VID_DeInit,
|
||||
D3D9_VID_ApplyGammaRamps,
|
||||
|
|
|
@ -1085,12 +1085,6 @@ static void (D3D11_SCR_UpdateScreen) (void)
|
|||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// determine size of refresh window
|
||||
//
|
||||
if (vid.recalc_refdef)
|
||||
SCR_CalcRefdef ();
|
||||
|
||||
//
|
||||
// do 3D refresh drawing, and then update the screen
|
||||
//
|
||||
|
@ -1329,26 +1323,6 @@ rendererinfo_t d3d11rendererinfo =
|
|||
D3D11_R_NewMap,
|
||||
D3D11_R_PreNewMap,
|
||||
|
||||
Surf_AddStain,
|
||||
Surf_LessenStains,
|
||||
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
Mod_GetTag,
|
||||
Mod_TagNumForName,
|
||||
Mod_SkinNumForName,
|
||||
Mod_FrameNumForName,
|
||||
Mod_FrameDuration,
|
||||
|
||||
|
||||
D3D11_VID_Init,
|
||||
D3D11_VID_DeInit,
|
||||
D3D11_VID_ApplyGammaRamps,
|
||||
|
|
|
@ -2,7 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
|||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9767E236-8454-44E9-8999-CD5BDAFBE9BA} = {9767E236-8454-44E9-8999-CD5BDAFBE9BA}
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080} = {0018E098-B12A-4E4D-9B22-6772DA287080}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -159,7 +158,7 @@ Global
|
|||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.ActiveCfg = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.ActiveCfg = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.ActiveCfg = GLDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = GLDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.ActiveCfg = GLDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.ActiveCfg = GLDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.ActiveCfg = GLRelease|Win32
|
||||
|
@ -189,7 +188,8 @@ Global
|
|||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.GLRelease|Win32.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.GLRelease|x64.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MDebug|Win32.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MDebug|x64.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MDebug|x64.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MDebug|x64.Build.0 = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLDebug|Win32.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLDebug|x64.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.MinGLRelease|Win32.ActiveCfg = Release
|
||||
|
@ -220,7 +220,7 @@ Global
|
|||
{0018E098-B12A-4E4D-9B22-6772DA287080}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -251,7 +251,7 @@ Global
|
|||
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MinGLDebug|Win32.Build.0 = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
|
@ -282,7 +282,7 @@ Global
|
|||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -310,7 +310,7 @@ Global
|
|||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -335,7 +335,7 @@ Global
|
|||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -366,7 +366,7 @@ Global
|
|||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -398,7 +398,7 @@ Global
|
|||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{32B12987-DF8C-4E40-B07C-B18586A4CA65}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -428,7 +428,7 @@ Global
|
|||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|Win32.ActiveCfg = Release|Win32
|
||||
|
|
|
@ -347,7 +347,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="_DEBUG;D3DQUAKE;WIN32;_WINDOWS"
|
||||
PreprocessorDefinitions="_DEBUG;D3DQUAKE;WIN32;_WINDOWS;MULTITHREAD"
|
||||
RuntimeLibrary="1"
|
||||
EnableFunctionLevelLinking="true"
|
||||
FloatingPointModel="2"
|
||||
|
@ -766,7 +766,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD"
|
||||
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD;USE_MSVCRT_DEBUG"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
@ -1174,7 +1174,7 @@
|
|||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE;MULTITHREAD"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
@ -1373,7 +1373,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;SERVERONLY"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;SERVERONLY;MULTITHREAD"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="0"
|
||||
FloatingPointModel="2"
|
||||
|
@ -1576,7 +1576,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE;SWQUAKE;MULTITHREAD"
|
||||
RuntimeLibrary="1"
|
||||
FloatingPointModel="2"
|
||||
UsePrecompiledHeader="2"
|
||||
|
@ -1585,7 +1585,7 @@
|
|||
AssemblerListingLocation=".\MDebug/"
|
||||
ObjectFile=".\MDebug/"
|
||||
ProgramDataBaseFileName=".\MDebug/"
|
||||
BrowseInformation="2"
|
||||
BrowseInformation="1"
|
||||
BrowseInformationFile=".\MDebug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
|
@ -1794,7 +1794,7 @@
|
|||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="NDEBUG;GLQUAKE;WIN32;_WINDOWS"
|
||||
PreprocessorDefinitions="NDEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
|
@ -2010,7 +2010,7 @@
|
|||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
|
||||
PreprocessorDefinitions="_DEBUG;D3D9QUAKE;D3D11QUAKE;WIN32;_WINDOWS"
|
||||
PreprocessorDefinitions="_DEBUG;D3D9QUAKE;D3D11QUAKE;WIN32;_WINDOWS;MULTITHREAD"
|
||||
RuntimeLibrary="1"
|
||||
EnableFunctionLevelLinking="true"
|
||||
FloatingPointModel="2"
|
||||
|
|
|
@ -292,7 +292,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
}
|
||||
else
|
||||
{
|
||||
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
|
||||
skins = inf->ofsskins;
|
||||
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
|
||||
skins += e->skinnum;
|
||||
|
||||
|
@ -308,7 +308,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
subframe = cl.time*skins->skinspeed;
|
||||
subframe = subframe%skins->numshaders;
|
||||
|
||||
shader = *(shader_t**)((char *)skins + skins->ofsshaders + subframe*sizeof(shader_t*));
|
||||
shader = skins->ofsshaders[subframe];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,9 +413,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
{
|
||||
if (skins->ofstexels)
|
||||
{
|
||||
int *offsets;
|
||||
offsets = (int*)((qbyte *)skins + skins->ofstexels);
|
||||
original = (qbyte*)offsets + offsets[subframe];
|
||||
original = skins->ofstexels[subframe];
|
||||
inwidth = skins->skinwidth;
|
||||
inheight = skins->skinheight;
|
||||
}
|
||||
|
@ -601,7 +599,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
if (!inf->numskins)
|
||||
return NULL;
|
||||
|
||||
skins = (galiasskin_t*)((char *)inf + inf->ofsskins);
|
||||
skins = inf->ofsskins;
|
||||
if (e->skinnum >= 0 && e->skinnum < inf->numskins)
|
||||
skins += e->skinnum;
|
||||
else
|
||||
|
@ -616,7 +614,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
|
||||
frame = cl.time*skins->skinspeed;
|
||||
frame = frame%skins->numshaders;
|
||||
return *(shader_t**)((char *)skins + skins->ofsshaders + frame*sizeof(shader_t*));
|
||||
return skins->ofsshaders[frame];
|
||||
}
|
||||
|
||||
#if defined(RTLIGHTS)
|
||||
|
@ -960,11 +958,11 @@ void R_GAlias_DrawBatch(batch_t *batch)
|
|||
currententity = e;
|
||||
/*nolightdir =*/ R_CalcModelLighting(e, clmodel);
|
||||
|
||||
inf = RMod_Extradata (clmodel);
|
||||
inf = Mod_Extradata (clmodel);
|
||||
if (inf)
|
||||
{
|
||||
memset(&mesh, 0, sizeof(mesh));
|
||||
for(surfnum=0; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)), surfnum++)
|
||||
for(surfnum=0; inf; inf=inf->nextsurf, surfnum++)
|
||||
{
|
||||
if (batch->surf_first == surfnum)
|
||||
{
|
||||
|
@ -1027,9 +1025,9 @@ void R_GAlias_GenerateBatches(entity_t *e, batch_t **batches)
|
|||
return;
|
||||
}
|
||||
|
||||
inf = RMod_Extradata (clmodel);
|
||||
inf = Mod_Extradata (clmodel);
|
||||
|
||||
for(surfnum=0; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)), surfnum++)
|
||||
for(surfnum=0; inf; inf=inf->nextsurf, surfnum++)
|
||||
{
|
||||
regshader = GL_ChooseSkin(inf, clmodel, surfnum, e, &skin);
|
||||
if (!regshader)
|
||||
|
@ -1382,7 +1380,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
|
||||
BE_SelectEntity(e);
|
||||
|
||||
inf = RMod_Extradata (clmodel);
|
||||
inf = Mod_Extradata (clmodel);
|
||||
while(inf)
|
||||
{
|
||||
if (inf->ofs_trineighbours)
|
||||
|
@ -1393,10 +1391,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
R_DrawShadowVolume(&mesh);
|
||||
}
|
||||
|
||||
if (inf->nextsurf)
|
||||
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
|
||||
else
|
||||
inf = NULL;
|
||||
inf = inf->nextsurf;
|
||||
|
||||
surfnum++;
|
||||
}
|
||||
|
@ -1736,7 +1731,7 @@ static void R_DB_Sprite(batch_t *batch)
|
|||
// don't even bother culling, because it's just a single
|
||||
// polygon without a surface cache
|
||||
frame = R_GetSpriteFrame (e);
|
||||
psprite = e->model->cache.data;
|
||||
psprite = e->model->meshinfo;
|
||||
sprtype = psprite->type;
|
||||
}
|
||||
if (!frame->shader)
|
||||
|
|
|
@ -1006,6 +1006,7 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
|
|||
{
|
||||
extern texid_t missing_texture;
|
||||
extern texid_t missing_texture_gloss;
|
||||
extern texid_t missing_texture_normal;
|
||||
extern texid_t scenepp_postproc_cube;
|
||||
extern texid_t r_whiteimage;
|
||||
|
||||
|
@ -1029,7 +1030,7 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
|
|||
{
|
||||
int lmi = shaderstate.curbatch->lightmap[0];
|
||||
if (lmi < 0 || !lightmap[lmi]->hasdeluxe)
|
||||
t = r_nulltex; //fixme
|
||||
t = missing_texture_normal;
|
||||
else
|
||||
t = lightmap[lmi+1]->lightmap_texture;
|
||||
}
|
||||
|
@ -1041,7 +1042,7 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
|
|||
t = missing_texture;
|
||||
break;
|
||||
case T_GEN_NORMALMAP:
|
||||
t = shaderstate.curtexnums?shaderstate.curtexnums->bump:r_nulltex; /*FIXME: nulltex is not correct*/
|
||||
t = (shaderstate.curtexnums && TEXVALID(shaderstate.curtexnums->bump))?shaderstate.curtexnums->bump:missing_texture_normal;
|
||||
break;
|
||||
case T_GEN_SPECULAR:
|
||||
if (TEXVALID(shaderstate.curtexnums->specular))
|
||||
|
|
|
@ -460,23 +460,9 @@ void GLDraw_Init (void)
|
|||
|
||||
maxtexsize = gl_max_size.value;
|
||||
|
||||
if (gl_config.gles)
|
||||
{
|
||||
if (maxtexsize < 512) //this needs to be able to hold the image in unscaled form.
|
||||
sizeofuploadmemorybufferintermediate = 512*512*4; //make sure we can load 512*512 images whatever happens.
|
||||
else
|
||||
sizeofuploadmemorybufferintermediate = maxtexsize*maxtexsize*4; //gl supports huge images, so so shall we.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (maxtexsize < 2048) //this needs to be able to hold the image in unscaled form.
|
||||
sizeofuploadmemorybufferintermediate = 2048*2048*4; //make sure we can load 2048*2048 images whatever happens.
|
||||
else
|
||||
sizeofuploadmemorybufferintermediate = maxtexsize*maxtexsize*4; //gl supports huge images, so so shall we.
|
||||
}
|
||||
|
||||
//required to hold the image after scaling has occured
|
||||
sizeofuploadmemorybuffer = maxtexsize*maxtexsize*4;
|
||||
sizeofuploadmemorybuffer = 1;
|
||||
sizeofuploadmemorybufferintermediate = 1;
|
||||
TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
|
||||
uploadmemorybuffer = BZ_Realloc(uploadmemorybuffer, sizeofuploadmemorybuffer);
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
|
@ -1132,7 +1118,7 @@ void GL_Upload32_Int (char *name, unsigned *data, int width, int height, unsigne
|
|||
{
|
||||
int miplevel=0;
|
||||
int samples;
|
||||
unsigned *scaled = (unsigned *)uploadmemorybuffer;
|
||||
unsigned *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
int type;
|
||||
int targ, targface;
|
||||
|
@ -1173,8 +1159,12 @@ void GL_Upload32_Int (char *name, unsigned *data, int width, int height, unsigne
|
|||
|
||||
TRACE(("dbg: GL_Upload32: %i %i\n", scaled_width, scaled_height));
|
||||
|
||||
if (scaled_width * scaled_height > sizeofuploadmemorybuffer/4)
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
if (scaled_width * scaled_height*4 > sizeofuploadmemorybuffer)
|
||||
{
|
||||
sizeofuploadmemorybuffer = scaled_width * scaled_height * 4;
|
||||
uploadmemorybuffer = BZ_Realloc(uploadmemorybuffer, sizeofuploadmemorybuffer);
|
||||
}
|
||||
scaled = (unsigned *)uploadmemorybuffer;
|
||||
|
||||
if (gl_config.gles)
|
||||
{
|
||||
|
@ -1386,15 +1376,18 @@ void GL_Upload24BGR (char *name, qbyte *framedata, int inwidth, int inheight, un
|
|||
int v;
|
||||
unsigned int f, fstep;
|
||||
qbyte *src, *dest;
|
||||
dest = uploadmemorybufferintermediate;
|
||||
//change from bgr bottomup to rgba topdown
|
||||
|
||||
outwidth = inwidth;
|
||||
outheight = inheight;
|
||||
GL_RoundDimensions(&outwidth, &outheight, !(flags&IF_NOMIPMAP));
|
||||
|
||||
if (outwidth*outheight > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload24BGR: image too big (%i*%i)", inwidth, inheight);
|
||||
if (outwidth*outheight*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = outwidth*outheight*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
dest = uploadmemorybufferintermediate;
|
||||
|
||||
for (y=0 ; y<outheight ; y++)
|
||||
{
|
||||
|
@ -1453,15 +1446,18 @@ void GL_Upload24BGR_Flip (char *name, qbyte *framedata, int inwidth, int inheigh
|
|||
int v;
|
||||
unsigned int f, fstep;
|
||||
qbyte *src, *dest;
|
||||
dest = uploadmemorybufferintermediate;
|
||||
//change from bgr bottomup to rgba topdown
|
||||
|
||||
outwidth = inwidth;
|
||||
outheight = inheight;
|
||||
GL_RoundDimensions(&outwidth, &outheight, !(flags&IF_NOMIPMAP));
|
||||
|
||||
if (outwidth*outheight > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload24BGR_Flip: image too big (%i*%i)", inwidth, inheight);
|
||||
if (outwidth*outheight*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = outwidth*outheight*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
dest = uploadmemorybufferintermediate;
|
||||
|
||||
for (y=1 ; y<=outheight ; y++)
|
||||
{
|
||||
|
@ -1517,15 +1513,19 @@ void GL_Upload24BGR_Flip (char *name, qbyte *framedata, int inwidth, int inheigh
|
|||
void GL_Upload8Grey (unsigned char*data, int width, int height, unsigned int flags)
|
||||
{
|
||||
int samples;
|
||||
unsigned char *scaled = uploadmemorybuffer;
|
||||
unsigned char *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
scaled_width = width;
|
||||
scaled_height = height;
|
||||
GL_RoundDimensions(&scaled_width, &scaled_height, !(flags&IF_NOMIPMAP));
|
||||
|
||||
if (scaled_width * scaled_height > sizeofuploadmemorybuffer/4)
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
if (scaled_width * scaled_height*4 > sizeofuploadmemorybuffer)
|
||||
{
|
||||
sizeofuploadmemorybuffer = scaled_width * scaled_height * 4;
|
||||
uploadmemorybuffer = BZ_Realloc(uploadmemorybuffer, sizeofuploadmemorybuffer);
|
||||
}
|
||||
scaled = uploadmemorybuffer;
|
||||
|
||||
samples = 1;//alpha ? gl_alpha_format : gl_solid_format;
|
||||
|
||||
|
@ -1639,57 +1639,66 @@ void GL_MipMapNormal (qbyte *in, int width, int height)
|
|||
//PENTA
|
||||
|
||||
//sizeofuploadmemorybufferintermediate is guarenteed to be bigger or equal to the normal uploadbuffer size
|
||||
unsigned int * genNormalMap(qbyte *pixels, int w, int h, float scale)
|
||||
static unsigned int * genNormalMap(qbyte *pixels, int w, int h, float scale)
|
||||
{
|
||||
int i, j, wr, hr;
|
||||
unsigned char r, g, b;
|
||||
unsigned *nmap = (unsigned *)uploadmemorybufferintermediate;
|
||||
float sqlen, reciplen, nx, ny, nz;
|
||||
int i, j, wr, hr;
|
||||
unsigned char r, g, b;
|
||||
unsigned *nmap;
|
||||
float sqlen, reciplen, nx, ny, nz;
|
||||
|
||||
const float oneOver255 = 1.0f/255.0f;
|
||||
const float oneOver255 = 1.0f/255.0f;
|
||||
|
||||
float c, cx, cy, dcx, dcy;
|
||||
float c, cx, cy, dcx, dcy;
|
||||
|
||||
wr = w;
|
||||
hr = h;
|
||||
if (w*h*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = w*h*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
nmap = (unsigned *)uploadmemorybufferintermediate;
|
||||
|
||||
for (i=0; i<h; i++) {
|
||||
for (j=0; j<w; j++) {
|
||||
/* Expand [0,255] texel values to the [0,1] range. */
|
||||
c = pixels[i*wr + j] * oneOver255;
|
||||
/* Expand the texel to its right. */
|
||||
cx = pixels[i*wr + (j+1)%wr] * oneOver255;
|
||||
/* Expand the texel one up. */
|
||||
cy = pixels[((i+1)%hr)*wr + j] * oneOver255;
|
||||
dcx = scale * (c - cx);
|
||||
dcy = scale * (c - cy);
|
||||
wr = w;
|
||||
hr = h;
|
||||
|
||||
/* Normalize the vector. */
|
||||
sqlen = dcx*dcx + dcy*dcy + 1;
|
||||
reciplen = 1.0f/(float)sqrt(sqlen);
|
||||
nx = dcx*reciplen;
|
||||
ny = -dcy*reciplen;
|
||||
nz = reciplen;
|
||||
for (i=0; i<h; i++)
|
||||
{
|
||||
for (j=0; j<w; j++)
|
||||
{
|
||||
/* Expand [0,255] texel values to the [0,1] range. */
|
||||
c = pixels[i*wr + j] * oneOver255;
|
||||
/* Expand the texel to its right. */
|
||||
cx = pixels[i*wr + (j+1)%wr] * oneOver255;
|
||||
/* Expand the texel one up. */
|
||||
cy = pixels[((i+1)%hr)*wr + j] * oneOver255;
|
||||
dcx = scale * (c - cx);
|
||||
dcy = scale * (c - cy);
|
||||
|
||||
/* Repack the normalized vector into an RGB unsigned qbyte
|
||||
vector in the normal map image. */
|
||||
r = (qbyte) (128 + 127*nx);
|
||||
g = (qbyte) (128 + 127*ny);
|
||||
b = (qbyte) (128 + 127*nz);
|
||||
/* Normalize the vector. */
|
||||
sqlen = dcx*dcx + dcy*dcy + 1;
|
||||
reciplen = 1.0f/(float)sqrt(sqlen);
|
||||
nx = dcx*reciplen;
|
||||
ny = -dcy*reciplen;
|
||||
nz = reciplen;
|
||||
|
||||
/* The highest resolution mipmap level always has a
|
||||
unit length magnitude. */
|
||||
nmap[i*w+j] = LittleLong ((pixels[i*wr + j] << 24)|(b << 16)|(g << 8)|(r)); // <AWE> Added support for big endian.
|
||||
}
|
||||
}
|
||||
/* Repack the normalized vector into an RGB unsigned qbyte
|
||||
vector in the normal map image. */
|
||||
r = (qbyte) (128 + 127*nx);
|
||||
g = (qbyte) (128 + 127*ny);
|
||||
b = (qbyte) (128 + 127*nz);
|
||||
|
||||
return &nmap[0];
|
||||
/* The highest resolution mipmap level always has a
|
||||
unit length magnitude. */
|
||||
nmap[i*w+j] = LittleLong ((pixels[i*wr + j] << 24)|(b << 16)|(g << 8)|(r)); // <AWE> Added support for big endian.
|
||||
}
|
||||
}
|
||||
|
||||
return &nmap[0];
|
||||
}
|
||||
|
||||
//PENTA
|
||||
void GL_UploadBump(qbyte *data, int width, int height, unsigned int mipmap, float bumpscale)
|
||||
{
|
||||
unsigned char *scaled = uploadmemorybuffer;
|
||||
unsigned char *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
qbyte *nmap;
|
||||
|
||||
|
@ -1699,8 +1708,12 @@ void GL_UploadBump(qbyte *data, int width, int height, unsigned int mipmap, floa
|
|||
scaled_height = height;
|
||||
GL_RoundDimensions(&scaled_width, &scaled_height, mipmap);
|
||||
|
||||
if (scaled_width * scaled_height > sizeofuploadmemorybuffer/4)
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
if (scaled_width*scaled_height*4 > sizeofuploadmemorybuffer)
|
||||
{
|
||||
sizeofuploadmemorybuffer = scaled_width*scaled_height*4;
|
||||
uploadmemorybuffer = BZ_Realloc(uploadmemorybuffer, sizeofuploadmemorybuffer);
|
||||
}
|
||||
scaled = uploadmemorybuffer;
|
||||
|
||||
//To resize or not to resize
|
||||
if (scaled_width == width && scaled_height == height)
|
||||
|
@ -1779,7 +1792,7 @@ void GL_Upload8_EXT (qbyte *data, int width, int height, qboolean mipmap, qbool
|
|||
int i, s;
|
||||
qboolean noalpha;
|
||||
int samples;
|
||||
unsigned char *scaled = uploadmemorybuffer;
|
||||
unsigned char *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
GLDraw_Init15to8();
|
||||
|
@ -1804,8 +1817,12 @@ void GL_Upload8_EXT (qbyte *data, int width, int height, qboolean mipmap, qbool
|
|||
scaled_height = height;
|
||||
GL_RoundDimensions(&scaled_width, &scaled_height, mipmap);
|
||||
|
||||
if (scaled_width * scaled_height > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
if (scaled_width*scaled_height*4 > sizeofuploadmemorybuffer)
|
||||
{
|
||||
sizeofuploadmemorybuffer = scaled_width*scaled_height*4;
|
||||
uploadmemorybuffer = BZ_Realloc(uploadmemorybuffer, sizeofuploadmemorybuffer);
|
||||
}
|
||||
scaled = uploadmemorybuffer;
|
||||
|
||||
samples = 1; // alpha ? gl_alpha_format : gl_solid_format;
|
||||
|
||||
|
@ -1879,13 +1896,17 @@ unsigned ColorPercent[16] =
|
|||
|
||||
void GL_Upload8 (char *name, qbyte *data, int width, int height, unsigned int flags, unsigned int alpha)
|
||||
{
|
||||
unsigned *trans = (unsigned *)uploadmemorybufferintermediate;
|
||||
unsigned *trans;
|
||||
int i, s;
|
||||
qboolean noalpha;
|
||||
int p;
|
||||
|
||||
if (width*height > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload8: image too big (%i*%i)", width, height);
|
||||
if (width*height*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = width*height*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
trans = (unsigned *)uploadmemorybufferintermediate;
|
||||
|
||||
s = width*height;
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
|
@ -1981,13 +2002,18 @@ void GL_Upload8 (char *name, qbyte *data, int width, int height, unsigned int fl
|
|||
|
||||
void GL_Upload8FB (qbyte *data, int width, int height, unsigned flags)
|
||||
{
|
||||
unsigned *trans = (unsigned *)uploadmemorybufferintermediate;
|
||||
unsigned *trans;
|
||||
int i, s;
|
||||
int p;
|
||||
|
||||
s = width*height;
|
||||
if (s > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload8FB: image too big (%i*%i)", width, height);
|
||||
if (s*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = s*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
trans = (unsigned *)uploadmemorybufferintermediate;
|
||||
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
// texture even if it was specified as otherwise
|
||||
for (i=0 ; i<s ; i++)
|
||||
|
@ -2004,7 +2030,7 @@ void GL_Upload8FB (qbyte *data, int width, int height, unsigned flags)
|
|||
|
||||
void GL_Upload8Pal24 (qbyte *data, qbyte *pal, int width, int height, unsigned int flags)
|
||||
{
|
||||
qbyte *trans = uploadmemorybufferintermediate;
|
||||
qbyte *trans;
|
||||
int i, s;
|
||||
qboolean noalpha;
|
||||
int p;
|
||||
|
@ -2012,8 +2038,12 @@ void GL_Upload8Pal24 (qbyte *data, qbyte *pal, int width, int height, unsigned i
|
|||
extern qboolean gammaworks;
|
||||
|
||||
s = width*height;
|
||||
if (s > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload8Pal24: image too big (%i*%i)", width, height);
|
||||
if (s*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = s*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
trans = uploadmemorybufferintermediate;
|
||||
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
// texture even if it was specified as otherwise
|
||||
|
@ -2086,13 +2116,17 @@ void GL_Upload8Pal24 (qbyte *data, qbyte *pal, int width, int height, unsigned i
|
|||
}
|
||||
static void GL_Upload8Pal32 (qbyte *data, qbyte *pal, int width, int height, unsigned int flags)
|
||||
{
|
||||
qbyte *trans = uploadmemorybufferintermediate;
|
||||
qbyte *trans;
|
||||
int i, s;
|
||||
extern qbyte gammatable[256];
|
||||
|
||||
s = width*height;
|
||||
if (s > sizeofuploadmemorybufferintermediate/4)
|
||||
Sys_Error("GL_Upload8Pal32: image too big (%i*%i)", width, height);
|
||||
if (s*4 > sizeofuploadmemorybufferintermediate)
|
||||
{
|
||||
sizeofuploadmemorybufferintermediate = s*4;
|
||||
uploadmemorybufferintermediate = BZ_Realloc(uploadmemorybufferintermediate, sizeofuploadmemorybufferintermediate);
|
||||
}
|
||||
trans = uploadmemorybufferintermediate;
|
||||
|
||||
if (s&3)
|
||||
Sys_Error ("GL_Upload8: s&3");
|
||||
|
|
|
@ -3314,12 +3314,12 @@ qboolean Terr_LoadTerrainModel (model_t *mod, void *buffer)
|
|||
|
||||
mod->type = mod_heightmap;
|
||||
|
||||
hm = Hunk_Alloc(sizeof(*hm));
|
||||
hm = ZG_Malloc(&mod->memgroup, sizeof(*hm));
|
||||
memset(hm, 0, sizeof(*hm));
|
||||
ClearLink(&hm->recycle);
|
||||
COM_FileBase(mod->name, hm->path, sizeof(hm->path));
|
||||
|
||||
mod->entities = Hunk_AllocName(strlen(buffer)+1, mod->name);
|
||||
mod->entities = ZG_Malloc(&mod->memgroup, strlen(buffer)+1);
|
||||
strcpy(mod->entities, buffer);
|
||||
|
||||
hm->sectionsize = sectsize;
|
||||
|
|
|
@ -84,8 +84,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
hlmdl_bone_t *bones;
|
||||
hlmdl_bonecontroller_t *bonectls;
|
||||
shader_t **shaders;
|
||||
|
||||
int start, end, total;
|
||||
void *texmem = NULL;
|
||||
/*~~*/
|
||||
|
||||
|
||||
|
@ -115,13 +114,10 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
}
|
||||
}
|
||||
|
||||
start = Hunk_LowMark ();
|
||||
|
||||
|
||||
//load the model into hunk
|
||||
model = Hunk_Alloc(sizeof(hlmodelcache_t));
|
||||
model = ZG_Malloc(&mod->memgroup, sizeof(hlmodelcache_t));
|
||||
|
||||
header = Hunk_Alloc(com_filesize);
|
||||
header = ZG_Malloc(&mod->memgroup, com_filesize);
|
||||
memcpy(header, buffer, com_filesize);
|
||||
|
||||
#if defined(HLSERVER) && (defined(__powerpc__) || defined(__ppc__))
|
||||
|
@ -136,20 +132,17 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
if (header->version != 10)
|
||||
{
|
||||
Con_Printf(CON_ERROR "Cannot load model %s - unknown version %i\n", mod->name, header->version);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header->numcontrollers > MAX_BONE_CONTROLLERS)
|
||||
{
|
||||
Con_Printf(CON_ERROR "Cannot load model %s - too many controllers %i\n", mod->name, header->numcontrollers);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
if (header->numbones > MAX_BONES)
|
||||
{
|
||||
Con_Printf(CON_ERROR "Cannot load model %s - too many bones %i\n", mod->name, header->numbones);
|
||||
Hunk_FreeToLowMark(start);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -159,7 +152,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
char texmodelname[MAX_QPATH];
|
||||
COM_StripExtension(mod->name, texmodelname, sizeof(texmodelname));
|
||||
//no textures? eesh. They must be stored externally.
|
||||
texheader = (hlmdl_header_t*)COM_LoadHunkFile(va("%st.mdl", texmodelname));
|
||||
texheader = texmem = (hlmdl_header_t*)FS_LoadMallocFile(va("%st.mdl", texmodelname));
|
||||
if (texheader)
|
||||
{
|
||||
if (texheader->version != 10)
|
||||
|
@ -198,7 +191,7 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
model->bones = (char *)bones - (char *)model;
|
||||
model->bonectls = (char *)bonectls - (char *)model;
|
||||
|
||||
shaders = Hunk_Alloc(texheader->numtextures*sizeof(shader_t));
|
||||
shaders = ZG_Malloc(&mod->memgroup, texheader->numtextures*sizeof(shader_t));
|
||||
model->shaders = (char *)shaders - (char *)model;
|
||||
for(i = 0; i < texheader->numtextures; i++)
|
||||
{
|
||||
|
@ -206,21 +199,11 @@ qboolean Mod_LoadHLModel (model_t *mod, void *buffer)
|
|||
shaders[i]->defaulttextures.base = R_LoadTexture8Pal24("", tex[i].w, tex[i].h, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, IF_NOALPHA|IF_NOGAMMA);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// move the complete, relocatable alias model to the cache
|
||||
//
|
||||
end = Hunk_LowMark ();
|
||||
total = end - start;
|
||||
if (texmem)
|
||||
Z_Free(texmem);
|
||||
|
||||
mod->type = mod_halflife;
|
||||
|
||||
Cache_Alloc (&mod->cache, total, mod->name);
|
||||
if (!mod->cache.data)
|
||||
return false;
|
||||
memcpy (mod->cache.data, model, total);
|
||||
|
||||
Hunk_FreeToLowMark (start);
|
||||
mod->meshinfo = model;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -434,7 +434,7 @@ typedef struct mnode_s
|
|||
// node specific
|
||||
mplane_t *plane;
|
||||
struct mnode_s *children[2];
|
||||
#ifdef Q2BSPS
|
||||
#if defined(Q2BSPS) || defined(MAP_PROC)
|
||||
int childnum[2];
|
||||
#endif
|
||||
|
||||
|
@ -851,6 +851,7 @@ typedef struct
|
|||
typedef struct model_s
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
int datasequence;
|
||||
qboolean needload; // bmodels and sprites don't cache normally
|
||||
qboolean tainted;
|
||||
qboolean pushdepth; // bsp submodels have this flag set so you don't get z fighting on co-planar surfaces.
|
||||
|
@ -961,8 +962,8 @@ typedef struct model_s
|
|||
//
|
||||
// additional model data
|
||||
//
|
||||
cache_user_t cache; // only access through Mod_Extradata
|
||||
|
||||
void *meshinfo; //data allocated within the memgroup allocations, will be nulled out when the model is flushed
|
||||
zonegroup_t memgroup;
|
||||
} model_t;
|
||||
|
||||
#define MDLF_ENGULPHS 0x001 // particle effect engulphs model (don't draw)
|
||||
|
@ -1056,20 +1057,3 @@ void CMQ3_SetAreaPortalState (int area1, int area2, qboolean open);
|
|||
|
||||
|
||||
#endif //Q2BSPS
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
aliasskintype_t type;
|
||||
void *pcachespot;
|
||||
int skin;
|
||||
} maliasskindesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numskins;
|
||||
int intervals;
|
||||
maliasskindesc_t skindescs[1];
|
||||
} maliasskingroup_t;
|
||||
|
|
|
@ -507,6 +507,7 @@ void GLR_NewMap (void)
|
|||
Surf_DeInit();
|
||||
|
||||
r_viewleaf = NULL;
|
||||
r_oldviewleaf = NULL;
|
||||
r_viewcluster = -1;
|
||||
r_oldviewcluster = 0;
|
||||
r_viewcluster2 = -1;
|
||||
|
@ -536,12 +537,6 @@ TRACE(("dbg: GLR_NewMap: tp\n"));
|
|||
#endif
|
||||
|
||||
#ifdef RTLIGHTS
|
||||
if (r_shadow_realtime_dlight.ival || r_shadow_realtime_world.ival)
|
||||
{
|
||||
R_LoadRTLights();
|
||||
if (rtlights_first == rtlights_max)
|
||||
R_ImportRTLights(cl.worldmodel->entities);
|
||||
}
|
||||
Sh_PreGenerateLights();
|
||||
#endif
|
||||
}
|
||||
|
@ -549,6 +544,10 @@ TRACE(("dbg: GLR_NewMap: tp\n"));
|
|||
void GLR_PreNewMap(void)
|
||||
{
|
||||
r_loadbumpmapping = r_deluxemapping.ival || r_shadow_realtime_world.ival || r_shadow_realtime_dlight.ival || r_glsl_offsetmapping.ival;
|
||||
r_viewleaf = NULL;
|
||||
r_oldviewleaf = NULL;
|
||||
r_viewleaf2 = NULL;
|
||||
r_oldviewleaf2 = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5062,7 +5062,7 @@ void Shader_DoReload(void)
|
|||
|
||||
if (resort)
|
||||
{
|
||||
RMod_ResortShaders();
|
||||
Mod_ResortShaders();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2955,6 +2955,13 @@ void Sh_PreGenerateLights(void)
|
|||
qbyte lvisb[MAX_MAP_LEAFS/8];
|
||||
int i;
|
||||
|
||||
if (r_shadow_realtime_dlight.ival || r_shadow_realtime_world.ival)
|
||||
{
|
||||
R_LoadRTLights();
|
||||
if (rtlights_first == rtlights_max)
|
||||
R_ImportRTLights(cl.worldmodel->entities);
|
||||
}
|
||||
|
||||
ignoreflags = (r_shadow_realtime_world.value?LFLAG_REALTIMEMODE:LFLAG_NORMALMODE);
|
||||
|
||||
for (dl = cl_dlights+rtlights_first, i=rtlights_first; i<rtlights_max; i++, dl++)
|
||||
|
@ -3007,6 +3014,22 @@ void Sh_DrawLights(qbyte *vis)
|
|||
return;
|
||||
}
|
||||
|
||||
if (r_shadow_realtime_world.modified ||
|
||||
r_shadow_realtime_dlight_shadows.modified ||
|
||||
r_shadow_realtime_dlight.modified ||
|
||||
r_shadow_realtime_dlight_shadows.modified ||
|
||||
r_shadow_shadowmapping.modified)
|
||||
{
|
||||
r_shadow_realtime_world.modified =
|
||||
r_shadow_realtime_dlight_shadows.modified =
|
||||
r_shadow_realtime_dlight.modified =
|
||||
r_shadow_realtime_dlight_shadows.modified =
|
||||
r_shadow_shadowmapping.modified =
|
||||
false;
|
||||
//make sure the lighting is reloaded
|
||||
Sh_PreGenerateLights();
|
||||
}
|
||||
|
||||
switch(qrenderer)
|
||||
{
|
||||
#ifdef GLQUAKE
|
||||
|
|
|
@ -1688,7 +1688,7 @@ void GL_Init(void *(*getglfunction) (char *name))
|
|||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
|
||||
char *DecodeGLEnum(GLenum num)
|
||||
static char *DecodeGLEnum(GLenum num)
|
||||
{
|
||||
switch(num)
|
||||
{
|
||||
|
@ -1875,26 +1875,6 @@ rendererinfo_t openglrendererinfo = {
|
|||
GLR_NewMap,
|
||||
GLR_PreNewMap,
|
||||
|
||||
Surf_AddStain,
|
||||
Surf_LessenStains,
|
||||
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
|
||||
Mod_GetTag,
|
||||
Mod_TagNumForName,
|
||||
Mod_SkinNumForName,
|
||||
Mod_FrameNumForName,
|
||||
Mod_FrameDuration,
|
||||
|
||||
GLVID_Init,
|
||||
GLVID_DeInit,
|
||||
GLVID_ApplyGammaRamps,
|
||||
|
|
|
@ -1877,23 +1877,6 @@ rendererinfo_t eglrendererinfo =
|
|||
Surf_AddStain,
|
||||
Surf_LessenStains,
|
||||
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
|
||||
Mod_GetTag,
|
||||
Mod_TagNumForName,
|
||||
Mod_SkinNumForName,
|
||||
Mod_FrameNumForName,
|
||||
Mod_FrameDuration,
|
||||
|
||||
EGLVID_Init,
|
||||
GLVID_DeInit,
|
||||
GLVID_SetPalette,
|
||||
|
|
|
@ -921,7 +921,6 @@ extern char localmodels[MAX_MODELS][5]; // inline model names for precache
|
|||
|
||||
extern char localinfo[MAX_LOCALINFO_STRING+1];
|
||||
|
||||
extern int host_hunklevel;
|
||||
extern vfsfile_t *sv_fraglogfile;
|
||||
|
||||
//===========================================================
|
||||
|
|
|
@ -685,6 +685,10 @@ void SV_Map_f (void)
|
|||
{
|
||||
SV_Savegame("s0");
|
||||
}
|
||||
|
||||
|
||||
if (isDedicated)
|
||||
Mod_Flush(false);
|
||||
}
|
||||
|
||||
void SV_KillServer_f(void)
|
||||
|
|
|
@ -395,7 +395,7 @@ void SV_CalcPHS (void)
|
|||
|
||||
if (!sv_calcphs.ival || (sv_calcphs.ival == 2 && (rowbytes*num >= 0x100000 || (!deathmatch.ival && !coop.ival))))
|
||||
{
|
||||
sv.pvs = Hunk_AllocName (rowbytes*num, "pvs vis");
|
||||
sv.pvs = ZG_Malloc(&sv.world.worldmodel->memgroup, rowbytes*num);
|
||||
scan = sv.pvs;
|
||||
for (i=0 ; i<num ; i++, scan+=rowbytes)
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ void SV_CalcPHS (void)
|
|||
return;
|
||||
}
|
||||
|
||||
sv.pvs = Hunk_AllocName (rowbytes*num, "phs vis");
|
||||
sv.pvs = ZG_Malloc(&sv.world.worldmodel->memgroup, rowbytes*num);
|
||||
scan = sv.pvs;
|
||||
vcount = 0;
|
||||
for (i=0 ; i<num ; i++, scan+=rowbytes)
|
||||
|
@ -430,21 +430,29 @@ void SV_CalcPHS (void)
|
|||
if (developer.value)
|
||||
Con_TPrintf (STL_BUILDINGPHS);
|
||||
|
||||
sv.phs = ZG_Malloc (&sv.world.worldmodel->memgroup, rowbytes*num);
|
||||
|
||||
/*this routine takes an exponential amount of time, so cache it if its too big*/
|
||||
if (rowbytes*num >= 0x100000)
|
||||
{
|
||||
sv.phs = COM_LoadHunkFile(va("maps/%s.phs", sv.name));
|
||||
if (sv.phs && com_filesize == rowbytes*num + 8 && ((unsigned*)sv.phs)[0] == *(unsigned*)"QPHS" && ((unsigned*)sv.phs)[1] == *(unsigned*)"\1\0\0\0")
|
||||
char hdr[8];
|
||||
vfsfile_t *f = FS_OpenVFS(va("maps/%s.phs", sv.name), "rb", FS_GAME);
|
||||
if (f)
|
||||
{
|
||||
sv.phs += 8;
|
||||
Con_DPrintf("Loaded cached PHS\n");
|
||||
return;
|
||||
VFS_READ(f, hdr, sizeof(hdr));
|
||||
if (memcmp(hdr, "QPHS\1\0\0\0", 8) || VFS_GETLEN(f) != rowbytes*num + 8)
|
||||
{
|
||||
VFS_READ(f, sv.phs, rowbytes*num);
|
||||
VFS_CLOSE(f);
|
||||
Con_DPrintf("Loaded cached PHS\n");
|
||||
return;
|
||||
}
|
||||
else
|
||||
Con_DPrintf("Stale cached PHS\n");
|
||||
VFS_CLOSE(f);
|
||||
}
|
||||
else
|
||||
Con_DPrintf("Stale cached PHS\n");
|
||||
}
|
||||
|
||||
sv.phs = Hunk_AllocName (rowbytes*num, "phs hear");
|
||||
count = 0;
|
||||
scan = sv.pvs;
|
||||
dest = (unsigned *)sv.phs;
|
||||
|
@ -683,7 +691,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
#endif
|
||||
|
||||
Mod_ClearAll ();
|
||||
Hunk_FreeToLowMark (host_hunklevel);
|
||||
|
||||
PR_Deinit();
|
||||
|
||||
|
@ -790,6 +797,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
|
||||
|
||||
sv.state = ss_loading;
|
||||
#if defined(Q2BSPS)
|
||||
if (usecinematic)
|
||||
{
|
||||
qboolean Mod_LoadQ2BrushModel (model_t *mod, void *buffer);
|
||||
|
@ -802,6 +810,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
loadmodel->needload = !Mod_LoadQ2BrushModel (sv.world.worldmodel, NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
char *exts[] = {"maps/%s.bsp", "maps/%s.cm", "maps/%s.hmp", NULL};
|
||||
strcpy (sv.name, server);
|
||||
|
|
|
@ -825,8 +825,10 @@ int SV_CalcPing (client_t *cl, qboolean forcecalc)
|
|||
|
||||
switch (cl->protocol)
|
||||
{
|
||||
default:
|
||||
case SCP_BAD:
|
||||
break;
|
||||
#ifdef Q2SERVER
|
||||
case SCP_QUAKE2:
|
||||
{
|
||||
q2client_frame_t *frame;
|
||||
|
@ -846,6 +848,7 @@ int SV_CalcPing (client_t *cl, qboolean forcecalc)
|
|||
|
||||
}
|
||||
return ping;
|
||||
#endif
|
||||
case SCP_QUAKE3:
|
||||
break;
|
||||
case SCP_DARKPLACES6:
|
||||
|
@ -4928,17 +4931,12 @@ void SV_Init (quakeparms_t *parms)
|
|||
{
|
||||
COM_InitArgv (parms->argc, parms->argv);
|
||||
|
||||
if (COM_CheckParm ("-minmemory"))
|
||||
parms->memsize = MINIMUM_MEMORY;
|
||||
|
||||
host_parms = *parms;
|
||||
|
||||
// if (parms->memsize < MINIMUM_MEMORY)
|
||||
// SV_Error ("Only %4.1f megs of memory reported, can't execute game", parms->memsize / (float)0x100000);
|
||||
|
||||
Cvar_Init();
|
||||
|
||||
Memory_Init (parms->membase, parms->memsize);
|
||||
Memory_Init();
|
||||
|
||||
Sys_Init();
|
||||
|
||||
|
@ -5001,21 +4999,16 @@ void SV_Init (quakeparms_t *parms)
|
|||
Plug_Initialise(true);
|
||||
#endif
|
||||
|
||||
Hunk_AllocName (0, "-HOST_HUNKLEVEL-");
|
||||
host_hunklevel = Hunk_LowMark ();
|
||||
|
||||
host_initialized = true;
|
||||
|
||||
|
||||
FS_ChangeGame(NULL, true);
|
||||
|
||||
|
||||
Cmd_StuffCmds();
|
||||
Cbuf_Execute ();
|
||||
|
||||
|
||||
Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__);
|
||||
Con_TPrintf (TL_HEAPSIZE,parms->memsize/ (1024*1024.0));
|
||||
|
||||
Con_Printf ("%s\n", version_string());
|
||||
|
||||
|
|
|
@ -1609,7 +1609,13 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
}
|
||||
|
||||
//pointless extensions that are redundant with mvds
|
||||
demo.recorder.fteprotocolextensions &= ~PEXT_ACCURATETIMINGS | PEXT_HLBSP|PEXT_Q2BSP|PEXT_Q3BSP;
|
||||
demo.recorder.fteprotocolextensions &= ~PEXT_ACCURATETIMINGS | PEXT_HLBSP;
|
||||
#ifdef PEXT_Q2BSP
|
||||
demo.recorder.fteprotocolextensions &= ~PEXT_Q2BSP;
|
||||
#endif
|
||||
#ifdef PEXT_Q3BSP
|
||||
demo.recorder.fteprotocolextensions &= ~PEXT_Q3BSP;
|
||||
#endif
|
||||
}
|
||||
// else
|
||||
// SV_WriteRecordMVDMessage(&buf, dem_read);
|
||||
|
|
|
@ -1880,6 +1880,7 @@ qboolean SV_SendClientDatagram (client_t *client)
|
|||
|
||||
if (sv.world.worldmodel && !client->controller)
|
||||
{
|
||||
#ifdef Q2SERVER
|
||||
if (ISQ2CLIENT(client))
|
||||
{
|
||||
SVQ2_BuildClientFrame (client);
|
||||
|
@ -1889,6 +1890,7 @@ qboolean SV_SendClientDatagram (client_t *client)
|
|||
SVQ2_WriteFrameToClient (client, &msg);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// add the client specific data to the datagram
|
||||
SV_WriteClientdataToMessage (client, &msg);
|
||||
|
|
|
@ -711,14 +711,6 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
parms.memsize = 64*1024*1024;
|
||||
|
||||
j = COM_CheckParm("-mem");
|
||||
if (j)
|
||||
parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024);
|
||||
if ((parms.membase = malloc (parms.memsize)) == NULL)
|
||||
Sys_Error("Can't allocate %u\n", parms.memsize);
|
||||
|
||||
parms.basedir = ".";
|
||||
|
||||
SV_Init (&parms);
|
||||
|
|
|
@ -408,8 +408,7 @@ void Sys_Error (const char *error, ...)
|
|||
#ifndef MINGW
|
||||
fcloseall(); //make sure all files are written.
|
||||
#endif
|
||||
VirtualFree (host_parms.membase, 0, MEM_RELEASE);
|
||||
// free(host_parms.membase); //get rid of the mem. We don't need it now.
|
||||
|
||||
// system("dqwsv.exe"); //spawn a new server to take over. This way, if debugging, then any key will quit, otherwise the server will just spawn a new one.
|
||||
|
||||
memset(&startupinfo, 0, sizeof(startupinfo));
|
||||
|
@ -927,22 +926,6 @@ void StartQuakeServer(void)
|
|||
parms.argc = com_argc;
|
||||
parms.argv = com_argv;
|
||||
|
||||
parms.memsize = 32*1024*1024;
|
||||
|
||||
if ((t = COM_CheckParm ("-heapsize")) != 0 &&
|
||||
t + 1 < com_argc)
|
||||
parms.memsize = Q_atoi (com_argv[t + 1]) * 1024;
|
||||
|
||||
if ((t = COM_CheckParm ("-mem")) != 0 &&
|
||||
t + 1 < com_argc)
|
||||
parms.memsize = Q_atoi (com_argv[t + 1]) * 1024 * 1024;
|
||||
|
||||
parms.membase = VirtualAlloc(NULL, parms.memsize, MEM_RESERVE, PAGE_NOACCESS);
|
||||
// parms.membase = malloc (parms.memsize);
|
||||
|
||||
if (!parms.membase)
|
||||
Sys_Error("Insufficient memory.\n");
|
||||
|
||||
GetModuleFileName(NULL, bindir, sizeof(bindir)-1);
|
||||
*COM_SkipPath(bindir) = 0;
|
||||
parms.binarydir = bindir;
|
||||
|
|
|
@ -364,6 +364,8 @@ model_t *Mod_FindName (char *name)
|
|||
mod_numknown++;
|
||||
}
|
||||
|
||||
//mark it as active, so it doesn't get flushed prematurely
|
||||
mod->datasequence = mod_datasequence;
|
||||
return mod;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@ void *SVQ2_GetGameAPI (void *parms)
|
|||
|
||||
void *ret;
|
||||
|
||||
Con_DPrintf("Searching for %s\n", "game" ARCH_CPU_POSTFIX ARCH_DL_POSTFIX);
|
||||
#ifdef _DEBUG
|
||||
Con_DPrintf("Searching for %s\n", gamename[1]);
|
||||
#else
|
||||
Con_DPrintf("Searching for %s\n", gamename[0]);
|
||||
#endif
|
||||
|
||||
iterator = NULL;
|
||||
while(COM_IteratePaths(&iterator, searchpath, sizeof(searchpath)))
|
||||
|
|
|
@ -4,12 +4,20 @@ typedef struct
|
|||
texcom_t com;
|
||||
|
||||
char name[64];
|
||||
int width;
|
||||
int height;
|
||||
int pwidth;
|
||||
int pheight;
|
||||
int pwidthmask;
|
||||
int pheightmask;
|
||||
int pitch;
|
||||
unsigned int data[1];
|
||||
} swimage_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float matrix[16];
|
||||
vec4_t viewplane;
|
||||
} swuniforms_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile unsigned int readpoint; //the command queue point its reading from
|
||||
|
@ -27,6 +35,7 @@ typedef struct
|
|||
unsigned int *vpcbuf;
|
||||
unsigned int vpwidth;
|
||||
unsigned int vpheight;
|
||||
swuniforms_t u;
|
||||
qintptr_t vpcstride;
|
||||
struct workqueue_s *wq;
|
||||
} swthread_t;
|
||||
|
@ -64,7 +73,8 @@ enum wqcmd_e
|
|||
WTC_VIEWPORT,
|
||||
WTC_TRIFAN,
|
||||
WTC_TRISOUP,
|
||||
WTC_SPANS
|
||||
WTC_SPANS,
|
||||
WTC_UNIFORMS
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -73,7 +83,8 @@ enum
|
|||
CLIP_RIGHT_FLAG = 2,
|
||||
CLIP_TOP_FLAG = 4,
|
||||
CLIP_BOTTOM_FLAG = 8,
|
||||
CLIP_NEAR_FLAG = 16
|
||||
CLIP_NEAR_FLAG = 16,
|
||||
CLIP_FAR_FLAG = 32
|
||||
};
|
||||
|
||||
typedef union
|
||||
|
@ -105,6 +116,7 @@ typedef union
|
|||
struct
|
||||
{
|
||||
struct wqcom_s com;
|
||||
|
||||
unsigned int *cbuf;
|
||||
unsigned int *dbuf;
|
||||
unsigned int width;
|
||||
|
@ -117,6 +129,11 @@ typedef union
|
|||
qboolean clearcolour;
|
||||
} viewport;
|
||||
struct
|
||||
{
|
||||
struct wqcom_s com;
|
||||
swuniforms_t u;
|
||||
} uniforms;
|
||||
struct
|
||||
{
|
||||
int foo;
|
||||
} spans;
|
||||
|
|
|
@ -14,6 +14,7 @@ static struct
|
|||
backendmode_t mode;
|
||||
|
||||
float m_mvp[16];
|
||||
vec4_t viewplane;
|
||||
|
||||
entity_t *curentity;
|
||||
shader_t *curshader;
|
||||
|
@ -410,31 +411,7 @@ void SWBE_TransformVerticies(swvert_t *v, mesh_t *mesh)
|
|||
|
||||
for (i = 0; i < mesh->numvertexes; i++, v++)
|
||||
{
|
||||
Matrix4x4_CM_Transform34(shaderstate.m_mvp, xyz[i], v->vcoord);
|
||||
|
||||
if (v->vcoord[3] != 1)
|
||||
{
|
||||
v->vcoord[0] /= v->vcoord[3];
|
||||
v->vcoord[1] /= v->vcoord[3];
|
||||
v->vcoord[2] /= v->vcoord[3];
|
||||
}
|
||||
v->vcoord[0] = (v->vcoord[0]+1)/2 * vid.pixelwidth;
|
||||
if (v->vcoord[0] < 0)
|
||||
v->clipflags = CLIP_LEFT_FLAG;
|
||||
else
|
||||
v->clipflags = 0;
|
||||
if (v->vcoord[0] > vid.pixelwidth-1)
|
||||
v->clipflags |= CLIP_RIGHT_FLAG;
|
||||
v->vcoord[1] = (v->vcoord[1]+1)/2 * vid.pixelheight;
|
||||
if (v->vcoord[1] < temp1.value)
|
||||
v->clipflags |= CLIP_TOP_FLAG;
|
||||
if (v->vcoord[1] > vid.pixelheight-1)
|
||||
v->clipflags |= CLIP_BOTTOM_FLAG;
|
||||
v->vcoord[2] = (v->vcoord[2]+1)/2;
|
||||
if (v->vcoord[3] < 0)
|
||||
v->clipflags |= CLIP_NEAR_FLAG;
|
||||
if (v->vcoord[2] >= 1)
|
||||
v->vcoord[2] = 1;
|
||||
VectorCopy(xyz[i], v->vcoord);
|
||||
|
||||
Vector2Copy(mesh->st_array[i], v->tccoord);
|
||||
|
||||
|
@ -561,6 +538,17 @@ void SWBE_SubmitMeshes (qboolean drawworld, batch_t **blist, int start, int stop
|
|||
SWBE_SubmitMeshesSortList(blist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void SWBE_UpdateUniforms(void)
|
||||
{
|
||||
wqcom_t *com;
|
||||
com = SWRast_BeginCommand(&commandqueue, WTC_UNIFORMS, sizeof(com->uniforms));
|
||||
|
||||
memcpy(com->uniforms.u.matrix, shaderstate.m_mvp, sizeof(com->uniforms.u.matrix));
|
||||
Vector4Copy(shaderstate.viewplane, com->uniforms.u.viewplane);
|
||||
|
||||
SWRast_EndCommand(&commandqueue, com);
|
||||
}
|
||||
void SWBE_Set2D(void)
|
||||
{
|
||||
extern cvar_t gl_screenangle;
|
||||
|
@ -592,6 +580,15 @@ void SWBE_Set2D(void)
|
|||
}
|
||||
|
||||
memcpy(shaderstate.m_mvp, r_refdef.m_projection, sizeof(shaderstate.m_mvp));
|
||||
|
||||
shaderstate.viewplane[0] = -r_refdef.m_view[0*4+2];
|
||||
shaderstate.viewplane[1] = -r_refdef.m_view[1*4+2];
|
||||
shaderstate.viewplane[2] = -r_refdef.m_view[2*4+2];
|
||||
VectorNormalize(shaderstate.viewplane);
|
||||
VectorScale(shaderstate.viewplane, 1.0/99999, shaderstate.viewplane);
|
||||
shaderstate.viewplane[3] = DotProduct(vec3_origin, shaderstate.viewplane);// - 0.5;
|
||||
|
||||
SWBE_UpdateUniforms();
|
||||
}
|
||||
void SWBE_DrawWorld(qboolean drawworld, qbyte *vis)
|
||||
{
|
||||
|
@ -636,6 +633,7 @@ void SWBE_SelectEntity(struct entity_s *ent)
|
|||
{
|
||||
float modelmatrix[16];
|
||||
float modelviewmatrix[16];
|
||||
vec3_t vieworg;
|
||||
|
||||
if (shaderstate.curentity == ent)
|
||||
return;
|
||||
|
@ -643,6 +641,18 @@ void SWBE_SelectEntity(struct entity_s *ent)
|
|||
|
||||
R_RotateForEntity(modelmatrix, modelviewmatrix, shaderstate.curentity, shaderstate.curentity->model);
|
||||
Matrix4_Multiply(r_refdef.m_projection, modelviewmatrix, shaderstate.m_mvp);
|
||||
shaderstate.viewplane[0] = vpn[0];//-modelviewmatrix[0];//0*4+2];
|
||||
shaderstate.viewplane[1] = vpn[1];//-modelviewmatrix[1];//1*4+2];
|
||||
shaderstate.viewplane[2] = vpn[2];//-modelviewmatrix[2];//2*4+2];
|
||||
VectorNormalize(shaderstate.viewplane);
|
||||
VectorScale(shaderstate.viewplane, 1.0/8192, shaderstate.viewplane);
|
||||
vieworg[0] = modelviewmatrix[3*4+0];
|
||||
vieworg[1] = modelviewmatrix[3*4+1];
|
||||
vieworg[2] = modelviewmatrix[3*4+2];
|
||||
VectorMA(r_refdef.vieworg, 256, shaderstate.viewplane, vieworg);
|
||||
shaderstate.viewplane[3] = DotProduct(vieworg, shaderstate.viewplane);
|
||||
|
||||
SWBE_UpdateUniforms();
|
||||
}
|
||||
void SWBE_SelectDLight(struct dlight_s *dl, vec3_t colour)
|
||||
{
|
||||
|
|
|
@ -2,20 +2,44 @@
|
|||
#ifdef SWQUAKE
|
||||
#include "sw.h"
|
||||
|
||||
void SW_RoundDimensions(int width, int height, int *scaled_width, int *scaled_height, qboolean mipmap)
|
||||
{
|
||||
for (*scaled_width = 1 ; *scaled_width < width ; *scaled_width<<=1)
|
||||
;
|
||||
for (*scaled_height = 1 ; *scaled_height < height ; *scaled_height<<=1)
|
||||
;
|
||||
|
||||
if (*scaled_width != width)
|
||||
*scaled_width >>= 1;
|
||||
if (*scaled_height != height)
|
||||
*scaled_height >>= 1;
|
||||
|
||||
if (*scaled_width > 256)
|
||||
*scaled_width = 256;
|
||||
if (*scaled_height > 256)
|
||||
*scaled_height = 256;
|
||||
}
|
||||
|
||||
texid_tf SW_AllocNewTexture(char *identifier, int w, int h, unsigned int flags)
|
||||
{
|
||||
int nw, nh;
|
||||
texid_t n;
|
||||
swimage_t *img;
|
||||
if (w & 3)
|
||||
return r_nulltex;
|
||||
img = BZ_Malloc(sizeof(*img) - sizeof(img->data) + (w * h * 4));
|
||||
|
||||
SW_RoundDimensions(w, h, &nw, &nh, false);
|
||||
img = BZ_Malloc(sizeof(*img) - sizeof(img->data) + (nw * nh * 4));
|
||||
|
||||
Q_strncpy(img->name, identifier, sizeof(img->name));
|
||||
img->width = w;
|
||||
img->height = h;
|
||||
img->pitch = w;
|
||||
img->com.width = w;
|
||||
img->com.height = h;
|
||||
img->pwidth = nw;
|
||||
img->pheight = nh;
|
||||
img->pitch = nw;
|
||||
|
||||
img->pwidthmask = nw-1;
|
||||
img->pheightmask = nh-1;
|
||||
|
||||
n.ptr = img;
|
||||
n.ref = &img->com;
|
||||
|
@ -30,41 +54,60 @@ void SW_RGBToBGR(swimage_t *img)
|
|||
{
|
||||
int x, y;
|
||||
unsigned int *d = img->data;
|
||||
for (y = 0; y < img->height; y++)
|
||||
for (y = 0; y < img->pheight; y++)
|
||||
{
|
||||
for (x = 0; x < img->width; x++)
|
||||
for (x = 0; x < img->pwidth; x++)
|
||||
{
|
||||
d[x] = (d[x]&0xff00ff00) | ((d[x]&0xff)<<16) | ((d[x]&0xff0000)>>16);
|
||||
}
|
||||
d += img->pitch;
|
||||
}
|
||||
}
|
||||
void SW_Upload32(swimage_t *img, int w, int h, unsigned int *data)
|
||||
void SW_Upload32(swimage_t *img, int iw, int ih, unsigned int *data)
|
||||
{
|
||||
//rescale the input to the output.
|
||||
//just use nearest-sample, cos we're lazy.
|
||||
int x, y;
|
||||
unsigned int *out = img->data;
|
||||
for (y = 0; y < h; y++)
|
||||
unsigned int *in;
|
||||
int sx, sy, stx, sty;
|
||||
int ow = img->pwidth, oh = img->pheight;
|
||||
stx = (iw<<16) / ow;
|
||||
sty = (ih<<16) / oh;
|
||||
|
||||
for (y = 0, sy = 0; y < oh; y++, sy += sty)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
in = data + iw*(sy>>16);
|
||||
for (x = 0, sx = 0; x < ow; x++, sx += stx)
|
||||
{
|
||||
out[x] = *data++;
|
||||
out[x] = in[sx>>16];
|
||||
}
|
||||
out += img->pitch;
|
||||
}
|
||||
SW_RGBToBGR(img);
|
||||
}
|
||||
void SW_Upload8(swimage_t *img, int w, int h, unsigned char *data)
|
||||
void SW_Upload8(swimage_t *img, int iw, int ih, unsigned char *data)
|
||||
{
|
||||
//rescale the input to the output.
|
||||
//just use nearest-sample, cos we're lazy.
|
||||
int x, y;
|
||||
unsigned int *out = img->data;
|
||||
for (y = 0; y < h; y++)
|
||||
unsigned char *in;
|
||||
int sx, sy, stx, sty;
|
||||
int ow = img->pwidth, oh = img->pheight;
|
||||
stx = (iw<<16) / ow;
|
||||
sty = (ih<<16) / oh;
|
||||
|
||||
for (y = 0, sy = 0; y < oh; y++, sy += sty)
|
||||
{
|
||||
for (x = 0; x < w; x++)
|
||||
in = data + iw*(sy>>16);
|
||||
for (x = 0, sx = 0; x < ow; x++, sx += stx)
|
||||
{
|
||||
out[x] = d_8to24rgbtable[*data++];
|
||||
out[x] = d_8to24rgbtable[in[sx>>16]];
|
||||
}
|
||||
out += img->pitch;
|
||||
}
|
||||
|
||||
SW_RGBToBGR(img);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ static void WT_Triangle(swthread_t *th, swimage_t *img, swvert_t *v1, swvert_t *
|
|||
{ \
|
||||
*zb = z; \
|
||||
tpix = img->data[ \
|
||||
((unsigned)(s*img->width)%img->width) \
|
||||
+ (((unsigned)(t*img->height)%img->height) * img->width) \
|
||||
((unsigned)(s>>16)&img->pwidthmask) \
|
||||
+ (((unsigned)(t>>16)&img->pheightmask) * img->pitch) \
|
||||
]; \
|
||||
if (tpix&0xff000000) \
|
||||
o = tpix; \
|
||||
|
@ -76,11 +76,11 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
int secondhalf;
|
||||
int xl,xld, xr,xrd;
|
||||
#ifdef SPAN_ST
|
||||
float sl,sld, sd;
|
||||
float tl,tld, td;
|
||||
int sl,sld, sd;
|
||||
int tl,tld, td;
|
||||
#endif
|
||||
#ifdef SPAN_Z
|
||||
unsigned int zl,zld, zd;
|
||||
int zl,zld, zd;
|
||||
#endif
|
||||
unsigned int *restrict outbuf;
|
||||
unsigned int *restrict ti;
|
||||
|
@ -136,8 +136,8 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
return;
|
||||
if (v[i]->vcoord[1] < 0 || v[i]->vcoord[1] >= th->vpheight)
|
||||
return;
|
||||
if (v[i]->vcoord[2] < 0)
|
||||
return;
|
||||
// if (v[i]->vcoord[3] < 0)
|
||||
// return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
|
@ -168,19 +168,19 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
fdy2 *= fz;
|
||||
|
||||
#ifdef SPAN_ST //affine
|
||||
d1 = v2->tccoord[0] - v1->tccoord[0];
|
||||
d2 = v3->tccoord[0] - v1->tccoord[0];
|
||||
d1 = (v2->tccoord[0] - v1->tccoord[0])*(img->pwidth<<16);
|
||||
d2 = (v3->tccoord[0] - v1->tccoord[0])*(img->pwidth<<16);
|
||||
sld = fdx1*d2 - fdx2*d1;
|
||||
sd = fdy2*d1 - fdy1*d2;
|
||||
|
||||
d1 = v2->tccoord[1] - v1->tccoord[1];
|
||||
d2 = v3->tccoord[1] - v1->tccoord[1];
|
||||
d1 = (v2->tccoord[1] - v1->tccoord[1])*(img->pheight<<16);
|
||||
d2 = (v3->tccoord[1] - v1->tccoord[1])*(img->pheight<<16);
|
||||
tld = fdx1*d2 - fdx2*d1;
|
||||
td = fdy2*d1 - fdy1*d2;
|
||||
#endif
|
||||
#ifdef SPAN_Z
|
||||
d1 = (v2->vcoord[2] - v1->vcoord[2])*UINT_MAX;
|
||||
d2 = (v3->vcoord[2] - v1->vcoord[2])*UINT_MAX;
|
||||
d1 = (v2->vcoord[3] - v1->vcoord[3])*(1<<16);
|
||||
d2 = (v3->vcoord[3] - v1->vcoord[3])*(1<<16);
|
||||
zld = fdx1*d2 - fdx2*d1;
|
||||
zd = fdy2*d1 - fdy1*d2;
|
||||
#endif
|
||||
|
@ -223,11 +223,11 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
recalcside = 1;
|
||||
|
||||
#ifdef SPAN_ST
|
||||
sld -= sd*xld/(float)(1<<16);
|
||||
tld -= td*xld/(float)(1<<16);
|
||||
sld -= (((long long)sd*xld)>>16);
|
||||
tld -= (((long long)td*xld)>>16);
|
||||
#endif
|
||||
#ifdef SPAN_Z
|
||||
zld -= zd*xld/(float)(1<<16);
|
||||
zld -= (((long long)zd*xld)>>16);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -275,14 +275,14 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
xl = (int)vlt->vcoord[0]<<16;
|
||||
|
||||
#ifdef SPAN_ST
|
||||
sl = vlt->tccoord[0];
|
||||
sld = sld + sd*xld/(float)(1<<16);
|
||||
tl = vlt->tccoord[1];
|
||||
tld = tld + td*xld/(float)(1<<16);
|
||||
sl = vlt->tccoord[0] * (img->pwidth<<16);
|
||||
sld = sld + (((long long)sd*xld)>>16);
|
||||
tl = vlt->tccoord[1] * (img->pheight<<16);
|
||||
tld = tld + (((long long)td*xld)>>16);
|
||||
#endif
|
||||
#ifdef SPAN_Z
|
||||
zl = vlt->vcoord[2]*UINT_MAX;
|
||||
zld = zld + zd*xld/(float)(1<<16);
|
||||
zl = vlt->vcoord[3] * (1<<16);
|
||||
zld = zld + (((long long)zd*xld)>>16);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -351,8 +351,8 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
)
|
||||
{
|
||||
#ifdef SPAN_ST
|
||||
float s = sl;
|
||||
float t = tl;
|
||||
unsigned int s = sl;
|
||||
unsigned int t = tl;
|
||||
#endif
|
||||
#ifdef SPAN_Z
|
||||
unsigned int z = zl;
|
||||
|
@ -386,54 +386,65 @@ SPAN_ST - interpolates S+T across the span. access with 'sc' and 'tc'
|
|||
|
||||
}
|
||||
|
||||
static void WT_Clip_Top(swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
static void WT_Clip_Top(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
float frac;
|
||||
frac = (0 - in->vcoord[1]) /
|
||||
frac = (1 - in->vcoord[1]) /
|
||||
(out->vcoord[1] - in->vcoord[1]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[1] = 0;
|
||||
Vector4Interpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
// result->vcoord[1] = 0;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
static void WT_Clip_Bottom(swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
static void WT_Clip_Bottom(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
float frac;
|
||||
frac = (vid.pixelheight-1 - in->vcoord[1]) /
|
||||
frac = ((th->vpheight-2) - in->vcoord[1]) /
|
||||
(out->vcoord[1] - in->vcoord[1]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[1] = vid.pixelheight-1;
|
||||
Vector4Interpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
// result->vcoord[1] = vid.pixelheight-1;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
static void WT_Clip_Left(swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
static void WT_Clip_Left(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
float frac;
|
||||
frac = (0 - in->vcoord[0]) /
|
||||
frac = (1 - in->vcoord[0]) /
|
||||
(out->vcoord[0] - in->vcoord[0]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[0] = 0;
|
||||
Vector4Interpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
// result->vcoord[0] = 0;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
static void WT_Clip_Right(swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
static void WT_Clip_Right(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
float frac;
|
||||
frac = (vid.pixelwidth-1 - in->vcoord[0]) /
|
||||
frac = ((th->vpwidth-2) - in->vcoord[0]) /
|
||||
(out->vcoord[0] - in->vcoord[0]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[0] = vid.pixelwidth-1;
|
||||
Vector4Interpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
// result->vcoord[0] = vid.pixelwidth-1;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
static void WT_Clip_Near(swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
static void WT_Clip_Near(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
extern cvar_t temp1;
|
||||
float nearclip = 0;
|
||||
double frac;
|
||||
frac = (temp1.value - in->vcoord[2]) /
|
||||
(out->vcoord[2] - in->vcoord[2]);
|
||||
frac = (nearclip - in->vcoord[3]) /
|
||||
(out->vcoord[3] - in->vcoord[3]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[2] = temp1.value;
|
||||
result->vcoord[3] = nearclip;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
|
||||
static int WT_ClipPoly(int incount, swvert_t *inv, swvert_t *outv, int flag, void (*clip)(swvert_t *out, swvert_t *in, swvert_t *result))
|
||||
static void WT_Clip_Far(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result)
|
||||
{
|
||||
float farclip = 1;
|
||||
double frac;
|
||||
frac = (farclip - in->vcoord[3]) /
|
||||
(out->vcoord[3] - in->vcoord[3]);
|
||||
VectorInterpolate(in->vcoord, frac, out->vcoord, result->vcoord);
|
||||
result->vcoord[3] = farclip;
|
||||
Vector2Interpolate(in->tccoord, frac, out->tccoord, result->tccoord);
|
||||
}
|
||||
|
||||
static int WT_ClipPoly(swthread_t *th, int incount, swvert_t *inv, swvert_t *outv, int flag, void (*clip)(swthread_t *th, swvert_t *out, swvert_t *in, swvert_t *result))
|
||||
{
|
||||
int p, c;
|
||||
int result = 0;
|
||||
|
@ -452,20 +463,25 @@ static int WT_ClipPoly(int incount, swvert_t *inv, swvert_t *outv, int flag, voi
|
|||
{
|
||||
//crossed... emit a new vertex on the boundary
|
||||
if (cf) //new is offscreen
|
||||
clip(&inv[c], &inv[p], &outv[result]);
|
||||
clip(th, &inv[c], &inv[p], &outv[result]);
|
||||
else
|
||||
clip(&inv[p], &inv[c], &outv[result]);
|
||||
clip(th, &inv[p], &inv[c], &outv[result]);
|
||||
outv[result].clipflags = 0;
|
||||
|
||||
if (outv[result].vcoord[0] < 0)
|
||||
outv[result].clipflags = CLIP_LEFT_FLAG;
|
||||
if (outv[result].vcoord[0] > vid.pixelwidth-1)
|
||||
outv[result].clipflags |= CLIP_LEFT_FLAG;
|
||||
if (outv[result].vcoord[0] >= th->vpwidth)
|
||||
outv[result].clipflags |= CLIP_RIGHT_FLAG;
|
||||
if (outv[result].vcoord[1] < 0)
|
||||
outv[result].clipflags |= CLIP_TOP_FLAG;
|
||||
if (outv[result].vcoord[1] > vid.pixelheight-1)
|
||||
if (outv[result].vcoord[1] >= th->vpheight)
|
||||
outv[result].clipflags |= CLIP_BOTTOM_FLAG;
|
||||
|
||||
if (outv[result].vcoord[3] < 0)
|
||||
outv[result].clipflags |= CLIP_NEAR_FLAG;
|
||||
if (outv[result].vcoord[3] > 1)
|
||||
outv[result].clipflags |= CLIP_FAR_FLAG;
|
||||
|
||||
result++;
|
||||
}
|
||||
if (!cf)
|
||||
|
@ -477,6 +493,35 @@ static int WT_ClipPoly(int incount, swvert_t *inv, swvert_t *outv, int flag, voi
|
|||
return result;
|
||||
}
|
||||
|
||||
//transform the vertex and calculate its final position.
|
||||
static int WT_TransformVertXY(swthread_t *th, swvert_t *v)
|
||||
{
|
||||
int result = 0;
|
||||
vec4_t tr;
|
||||
Matrix4x4_CM_Transform34(th->u.matrix, v->vcoord, tr);
|
||||
if (tr[3] != 1)
|
||||
{
|
||||
tr[0] /= tr[3];
|
||||
tr[1] /= tr[3];
|
||||
tr[2] /= tr[3];
|
||||
}
|
||||
|
||||
v->vcoord[0] = (tr[0]+1)/2 * th->vpwidth;
|
||||
if (v->vcoord[0] < 0)
|
||||
result |= CLIP_LEFT_FLAG;
|
||||
if (v->vcoord[0] >= th->vpwidth)
|
||||
result |= CLIP_RIGHT_FLAG;
|
||||
|
||||
v->vcoord[1] = (tr[1]+1)/2 * th->vpheight;
|
||||
if (v->vcoord[1] < 0)
|
||||
result |= CLIP_TOP_FLAG;
|
||||
if (v->vcoord[1] >= th->vpheight)
|
||||
result |= CLIP_BOTTOM_FLAG;
|
||||
v->clipflags = result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void WT_ClipTriangle(swthread_t *th, swimage_t *img, swvert_t *v1, swvert_t *v2, swvert_t *v3)
|
||||
{
|
||||
unsigned int cflags;
|
||||
|
@ -485,49 +530,74 @@ static void WT_ClipTriangle(swthread_t *th, swimage_t *img, swvert_t *v1, swvert
|
|||
int i;
|
||||
int count;
|
||||
|
||||
//check the near/far planes.
|
||||
v1->vcoord[3] = DotProduct(v1->vcoord, th->u.viewplane) - th->u.viewplane[3];
|
||||
if (v1->vcoord[3] < 0) v1->clipflags = CLIP_NEAR_FLAG; else if (v1->vcoord[3] > 1) v1->clipflags = CLIP_FAR_FLAG; else v1->clipflags = 0;
|
||||
v2->vcoord[3] = DotProduct(v2->vcoord, th->u.viewplane) - th->u.viewplane[3];
|
||||
if (v2->vcoord[3] < 0) v2->clipflags = CLIP_NEAR_FLAG; else if (v2->vcoord[3] > 1) v2->clipflags = CLIP_FAR_FLAG; else v2->clipflags = 0;
|
||||
v3->vcoord[3] = DotProduct(v3->vcoord, th->u.viewplane) - th->u.viewplane[3];
|
||||
if (v3->vcoord[3] < 0) v3->clipflags = CLIP_NEAR_FLAG; else if (v3->vcoord[3] > 1) v3->clipflags = CLIP_FAR_FLAG; else v3->clipflags = 0;
|
||||
|
||||
if (v1->clipflags & v2->clipflags & v3->clipflags)
|
||||
return; //all verticies are off at least one single side
|
||||
|
||||
return; //all verticies are off at least one plane
|
||||
cflags = v1->clipflags | v2->clipflags | v3->clipflags;
|
||||
|
||||
if (!cflags)
|
||||
if (0)//!cflags)
|
||||
{
|
||||
//no clipping to be done
|
||||
WT_Triangle(th, img, v1, v2, v3);
|
||||
return;
|
||||
//figure out the final 2d positions
|
||||
cflags = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
cflags |= WT_TransformVertXY(th, &final[list][i]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
final[list][0] = *v1;
|
||||
final[list][1] = *v2;
|
||||
final[list][2] = *v3;
|
||||
count = 3;
|
||||
|
||||
//clip to the screen
|
||||
if (cflags & CLIP_NEAR_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_NEAR_FLAG, WT_Clip_Near);
|
||||
list ^= 1;
|
||||
}
|
||||
if (cflags & CLIP_FAR_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_FAR_FLAG, WT_Clip_Far);
|
||||
list ^= 1;
|
||||
}
|
||||
|
||||
//figure out the final 2d positions
|
||||
cflags = 0;
|
||||
for (i = 0; i < count; i++)
|
||||
cflags |= WT_TransformVertXY(th, &final[list][i]);
|
||||
}
|
||||
|
||||
final[list][0] = *v1;
|
||||
final[list][1] = *v2;
|
||||
final[list][2] = *v3;
|
||||
count = 3;
|
||||
|
||||
if (cflags & CLIP_NEAR_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(count, final[list], final[list^1], CLIP_NEAR_FLAG, WT_Clip_Near);
|
||||
list ^= 1;
|
||||
}
|
||||
//and clip those by the screen (instead of by plane, to try to prevent crashes)
|
||||
if (cflags & CLIP_TOP_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(count, final[list], final[list^1], CLIP_TOP_FLAG, WT_Clip_Top);
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_TOP_FLAG, WT_Clip_Top);
|
||||
list ^= 1;
|
||||
}
|
||||
if (cflags & CLIP_BOTTOM_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(count, final[list], final[list^1], CLIP_BOTTOM_FLAG, WT_Clip_Bottom);
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_BOTTOM_FLAG, WT_Clip_Bottom);
|
||||
list ^= 1;
|
||||
}
|
||||
if (cflags & CLIP_LEFT_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(count, final[list], final[list^1], CLIP_LEFT_FLAG, WT_Clip_Left);
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_LEFT_FLAG, WT_Clip_Left);
|
||||
list ^= 1;
|
||||
}
|
||||
if (cflags & CLIP_RIGHT_FLAG)
|
||||
{
|
||||
count = WT_ClipPoly(count, final[list], final[list^1], CLIP_RIGHT_FLAG, WT_Clip_Right);
|
||||
count = WT_ClipPoly(th, count, final[list], final[list^1], CLIP_RIGHT_FLAG, WT_Clip_Right);
|
||||
list ^= 1;
|
||||
}
|
||||
|
||||
//draw the damn thing. FIXME: generate spans and push to a fragment thread.
|
||||
for (i = 2; i < count; i++)
|
||||
{
|
||||
WT_Triangle(th, img, &final[list][0], &final[list][i-1], &final[list][i]);
|
||||
|
@ -580,6 +650,9 @@ qboolean WT_HandleCommand(swthread_t *t, wqcom_t *com)
|
|||
break;
|
||||
case WTC_NEWFRAME:
|
||||
break;
|
||||
case WTC_UNIFORMS:
|
||||
memcpy(&t->u, &com->uniforms.u, sizeof(t->u));
|
||||
break;
|
||||
case WTC_VIEWPORT:
|
||||
t->vpcbuf = com->viewport.cbuf;
|
||||
t->vpdbuf = com->viewport.dbuf;
|
||||
|
@ -858,17 +931,15 @@ void SW_R_NewMap(void)
|
|||
#endif
|
||||
|
||||
#ifdef RTLIGHTS
|
||||
if (r_shadow_realtime_dlight.ival || r_shadow_realtime_world.ival)
|
||||
{
|
||||
R_LoadRTLights();
|
||||
if (rtlights_first == rtlights_max)
|
||||
R_ImportRTLights(cl.worldmodel->entities);
|
||||
}
|
||||
Sh_PreGenerateLights();
|
||||
#endif
|
||||
}
|
||||
void SW_R_PreNewMap(void)
|
||||
{
|
||||
r_viewleaf = NULL;
|
||||
r_oldviewleaf = NULL;
|
||||
r_viewleaf2 = NULL;
|
||||
r_oldviewleaf2 = NULL;
|
||||
}
|
||||
void SW_SCR_UpdateScreen(void)
|
||||
{
|
||||
|
@ -907,8 +978,6 @@ void SW_SCR_UpdateScreen(void)
|
|||
Shader_DoReload();
|
||||
|
||||
//FIXME: playfilm/editor+q3ui
|
||||
if (vid.recalc_refdef)
|
||||
SCR_CalcRefdef ();
|
||||
SCR_SetUpToDrawConsole ();
|
||||
|
||||
if (cls.state == ca_active)
|
||||
|
@ -925,6 +994,22 @@ void SW_SCR_UpdateScreen(void)
|
|||
V_UpdatePalette (false);
|
||||
}
|
||||
|
||||
void SW_VBO_Begin(vbobctx_t *ctx, unsigned int maxsize)
|
||||
{
|
||||
}
|
||||
void SW_VBO_Data(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t *varray)
|
||||
{
|
||||
}
|
||||
void SW_VBO_Finish(vbobctx_t *ctx, void *edata, unsigned int esize, vboarray_t *earray)
|
||||
{
|
||||
}
|
||||
void SW_VBO_Destroy(vboarray_t *vearray)
|
||||
{
|
||||
}
|
||||
void SWBE_Scissor(srect_t *rect)
|
||||
{
|
||||
}
|
||||
|
||||
rendererinfo_t swrendererinfo =
|
||||
{
|
||||
"Software Renderer",
|
||||
|
@ -954,26 +1039,6 @@ rendererinfo_t swrendererinfo =
|
|||
SW_R_NewMap,
|
||||
SW_R_PreNewMap,
|
||||
|
||||
Surf_AddStain,
|
||||
Surf_LessenStains,
|
||||
|
||||
RMod_Init,
|
||||
RMod_Shutdown,
|
||||
RMod_ClearAll,
|
||||
RMod_ForName,
|
||||
RMod_FindName,
|
||||
RMod_Extradata,
|
||||
RMod_TouchModel,
|
||||
|
||||
RMod_NowLoadExternal,
|
||||
RMod_Think,
|
||||
Mod_GetTag,
|
||||
Mod_TagNumForName,
|
||||
Mod_SkinNumForName,
|
||||
Mod_FrameNumForName,
|
||||
Mod_FrameDuration,
|
||||
|
||||
|
||||
SW_VID_Init,
|
||||
SW_VID_DeInit,
|
||||
SW_VID_ApplyGammaRamps,
|
||||
|
@ -994,12 +1059,13 @@ rendererinfo_t swrendererinfo =
|
|||
SWBE_UploadAllLightmaps,
|
||||
SWBE_SelectEntity,
|
||||
SWBE_SelectDLight,
|
||||
SWBE_Scissor,
|
||||
SWBE_LightCullModel,
|
||||
|
||||
NULL,//void (*BE_VBO_Begin)(vbobctx_t *ctx, unsigned int maxsize);
|
||||
NULL,//void (*BE_VBO_Data)(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t *varray);
|
||||
NULL,//void (*BE_VBO_Finish)(vbobctx_t *ctx, void *edata, unsigned int esize, vboarray_t *earray);
|
||||
NULL,//void (*BE_VBO_Destroy)(vboarray_t *vearray);
|
||||
SW_VBO_Begin,
|
||||
SW_VBO_Data,
|
||||
SW_VBO_Finish,
|
||||
SW_VBO_Destroy,
|
||||
|
||||
"no more"
|
||||
};
|
||||
|
|
|
@ -697,12 +697,6 @@ void SW_VID_UpdateViewport(wqcom_t *com)
|
|||
com->viewport.height = vid.pixelheight;
|
||||
com->viewport.stride = screenpitch;
|
||||
com->viewport.framenum = framenumber;
|
||||
|
||||
/* com->viewport.buf = pDIBBase;
|
||||
com->viewport.width = vid.pixelwidth;
|
||||
com->viewport.height = vid.pixelheight;
|
||||
com->viewport.stride = vid.pixelwidth;
|
||||
com->viewport.framenum = framenumber;*/
|
||||
}
|
||||
|
||||
void SW_VID_SwapBuffers(void)
|
||||
|
@ -733,7 +727,33 @@ qboolean SW_VID_Init(rendererstate_t *info, unsigned char *palette)
|
|||
vid.pixelwidth = info->width;
|
||||
vid.pixelheight = info->height;
|
||||
|
||||
VID_CreateWindow(vid.pixelwidth, vid.pixelheight, false);
|
||||
if (info->fullscreen) //don't do this with d3d - d3d should set it's own video mode.
|
||||
{ //make windows change res.
|
||||
DEVMODE gdevmode;
|
||||
gdevmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
if (info->bpp)
|
||||
gdevmode.dmFields |= DM_BITSPERPEL;
|
||||
if (info->rate)
|
||||
gdevmode.dmFields |= DM_DISPLAYFREQUENCY;
|
||||
gdevmode.dmBitsPerPel = info->bpp;
|
||||
if (info->bpp && (gdevmode.dmBitsPerPel < 15))
|
||||
{
|
||||
Con_Printf("Forcing at least 16bpp\n");
|
||||
gdevmode.dmBitsPerPel = 16;
|
||||
}
|
||||
gdevmode.dmDisplayFrequency = info->rate;
|
||||
gdevmode.dmPelsWidth = info->width;
|
||||
gdevmode.dmPelsHeight = info->height;
|
||||
gdevmode.dmSize = sizeof (gdevmode);
|
||||
|
||||
if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
Con_SafePrintf((gdevmode.dmFields&DM_DISPLAYFREQUENCY)?"Windows rejected mode %i*%i*%i*%i\n":"Windows rejected mode %i*%i*%i\n", (int)gdevmode.dmPelsWidth, (int)gdevmode.dmPelsHeight, (int)gdevmode.dmBitsPerPel, (int)gdevmode.dmDisplayFrequency);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
VID_CreateWindow(vid.pixelwidth, vid.pixelheight, info->fullscreen);
|
||||
|
||||
if (!DIB_Init())
|
||||
return false;
|
||||
|
@ -744,6 +764,8 @@ void SW_VID_DeInit(void)
|
|||
{
|
||||
DIB_Shutdown();
|
||||
DestroyWindow(mainwindow);
|
||||
|
||||
ChangeDisplaySettings (NULL, 0);
|
||||
}
|
||||
qboolean SW_VID_ApplyGammaRamps (unsigned short *ramps)
|
||||
{
|
||||
|
|
|
@ -90,7 +90,8 @@
|
|||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
ConfigurationType="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
|
@ -109,6 +110,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../engine/server;../../engine/gl;../../engine/qclib;../../engine/client;../../engine/common"
|
||||
PreprocessorDefinitions="FTEPLUGIN"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -121,6 +124,9 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="../../fteplug_$(ProjectName)x86.dll"
|
||||
GenerateManifest="false"
|
||||
ModuleDefinitionFile="..\plugin.def"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
|
|
|
@ -2320,7 +2320,7 @@ qboolean JCL_Reconnect(jclient_t *jcl)
|
|||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("XMPP: Unable to determine server. Check internet connection.\n");
|
||||
Con_Printf("XMPP: Unable to determine service (%s). Check internet connection.\n", jcl->domain);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2554,7 +2554,7 @@ jclient_t *JCL_Connect(int accnum, char *server, int forcetls, char *account, ch
|
|||
|
||||
x = XML_CreateNode(NULL, "account", "", "");
|
||||
XML_AddParameteri(x, "id", accnum);
|
||||
XML_CreateNode(x, "server", "", server);
|
||||
XML_CreateNode(x, "serveraddr", "", server);
|
||||
XML_CreateNode(x, "username", "", account);
|
||||
XML_CreateNode(x, "domain", "", domain);
|
||||
XML_CreateNode(x, "resource", "", res);
|
||||
|
@ -4239,7 +4239,7 @@ void JCL_LoadConfig(void)
|
|||
char buf[8192];
|
||||
qboolean oldtls;
|
||||
len = pFS_Open("**plugconfig", &config, 1);
|
||||
if (config >= 0)
|
||||
if (len >= 0)
|
||||
{
|
||||
if (len >= sizeof(buf))
|
||||
len = sizeof(buf)-1;
|
||||
|
@ -4247,7 +4247,7 @@ void JCL_LoadConfig(void)
|
|||
pFS_Read(config, buf, len);
|
||||
pFS_Close(config);
|
||||
|
||||
if (*buf != '<')
|
||||
if (len && *buf != '<')
|
||||
{//legacy code, to be removed
|
||||
char *line = buf;
|
||||
char tls[256];
|
||||
|
@ -4261,6 +4261,7 @@ void JCL_LoadConfig(void)
|
|||
|
||||
oldtls = atoi(tls);
|
||||
|
||||
Con_Printf("Legacy config: %s (%i)\n", buf, len);
|
||||
jclients[0] = JCL_Connect(0, server, oldtls, account, password);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -5,7 +5,7 @@ REM I guess we should include our own copy of them.
|
|||
|
||||
set QuakeDir=h:\quake
|
||||
set Q3SrcDir=h:\quakestuff\quake3
|
||||
set Path=%Q3SrcDir%\quake3-1.32b\lcc\bin;%Q3SrcDir%\quake3-1.32b\q3asm\debug;..\..\..\lcc;..\..\..\q3asm2
|
||||
set Path=%Q3SrcDir%\quake3-1.32b\lcc\bin;%Q3SrcDir%\quake3-1.32b\q3asm\debug;..\..\..\lcc;..\..\..\q3asm2;..\..
|
||||
|
||||
set PluginsDir=%QuakeDir%\fte\plugins
|
||||
|
||||
|
|
Loading…
Reference in a new issue