Changed spikeset.

Some csqc tweeks, bugfixes, additional work (yay - prediction, keyboard input!)
Some teamplay tweeks, supports much more fuhquake-compatable teamplay stuff.
Changed the texture naming scheme a bit.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@979 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-04-26 16:04:12 +00:00
parent d8b6a19487
commit a9d9293fc1
37 changed files with 1845 additions and 1256 deletions

View file

@ -33,6 +33,7 @@ extern cvar_t r_lightflicker;
extern cvar_t cl_r2g; extern cvar_t cl_r2g;
extern cvar_t r_powerupglow; extern cvar_t r_powerupglow;
extern cvar_t v_powerupshell; extern cvar_t v_powerupshell;
extern cvar_t cl_nolerp;
extern cvar_t cl_gibfilter, cl_deadbodyfilter; extern cvar_t cl_gibfilter, cl_deadbodyfilter;
extern int cl_playerindex; extern int cl_playerindex;
@ -367,13 +368,26 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
} }
if (to->frame != from->frame || move[0] || move[1] || move[2]) if (to->frame != from->frame || move[0] || move[1] || move[2])
{ {
cl.lerpents[to->number].origin[0] = from->origin[0]; if (new) //lerp from the new position instead of old, so no lerp
cl.lerpents[to->number].origin[1] = from->origin[1]; {
cl.lerpents[to->number].origin[2] = from->origin[2]; cl.lerpents[to->number].origin[0] = to->origin[0];
cl.lerpents[to->number].origin[1] = to->origin[1];
cl.lerpents[to->number].origin[2] = to->origin[2];
cl.lerpents[to->number].angles[0] = from->angles[0]; cl.lerpents[to->number].angles[0] = to->angles[0];
cl.lerpents[to->number].angles[1] = from->angles[1]; cl.lerpents[to->number].angles[1] = to->angles[1];
cl.lerpents[to->number].angles[2] = from->angles[2]; cl.lerpents[to->number].angles[2] = to->angles[2];
}
else
{
cl.lerpents[to->number].origin[0] = from->origin[0];
cl.lerpents[to->number].origin[1] = from->origin[1];
cl.lerpents[to->number].origin[2] = from->origin[2];
cl.lerpents[to->number].angles[0] = from->angles[0];
cl.lerpents[to->number].angles[1] = from->angles[1];
cl.lerpents[to->number].angles[2] = from->angles[2];
}
//we have three sorts of movement. //we have three sorts of movement.
//1: stepping monsters. These have frames and tick at 10fps. //1: stepping monsters. These have frames and tick at 10fps.
//2: physics. Objects moving acording to gravity. //2: physics. Objects moving acording to gravity.
@ -1376,8 +1390,8 @@ void CL_LinkPacketEntities (void)
ent->lerpfrac=1; ent->lerpfrac=1;
f = 1-ent->lerpfrac; f = 1-ent->lerpfrac;
// if (cl_nolerp.value) if (cl_nolerp.value)
// f = 1; f = 1;
// calculate origin // calculate origin
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
@ -1759,7 +1773,7 @@ static int MVD_TranslateFlags(int src)
CL_ParsePlayerinfo CL_ParsePlayerinfo
=================== ===================
*/ */
extern int parsecountmod; extern int parsecountmod, oldparsecountmod;
extern double parsecounttime; extern double parsecounttime;
int lastplayerinfo; int lastplayerinfo;
void CL_ParsePlayerinfo (void) void CL_ParsePlayerinfo (void)
@ -1767,7 +1781,7 @@ void CL_ParsePlayerinfo (void)
int msec; int msec;
unsigned int flags; unsigned int flags;
player_info_t *info; player_info_t *info;
player_state_t *state; player_state_t *state, *oldstate;
int num; int num;
int i; int i;
int new; int new;
@ -1779,6 +1793,7 @@ void CL_ParsePlayerinfo (void)
info = &cl.players[num]; info = &cl.players[num];
oldstate = &cl.frames[oldparsecountmod].playerstate[num];
state = &cl.frames[parsecountmod].playerstate[num]; state = &cl.frames[parsecountmod].playerstate[num];
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)
@ -1850,6 +1865,7 @@ void CL_ParsePlayerinfo (void)
state->pm_type = PM_NORMAL; state->pm_type = PM_NORMAL;
TP_ParsePlayerInfo(oldstate, state, info);
return; return;
} }
@ -2024,6 +2040,8 @@ guess_pm_type:
state->pm_type = PM_DEAD; state->pm_type = PM_DEAD;
else else
state->pm_type = PM_NORMAL; state->pm_type = PM_NORMAL;
TP_ParsePlayerInfo(oldstate, state, info);
} }
} }
@ -2386,6 +2404,8 @@ void CL_LinkViewModel(void)
if (cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_QUAD) if (cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_QUAD)
ent.flags |= Q2RF_SHELL_BLUE; ent.flags |= Q2RF_SHELL_BLUE;
if (cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_INVULNERABILITY)
ent.flags |= Q2RF_SHELL_RED;
if (!(ent.flags & (Q2RF_SHELL_RED|Q2RF_SHELL_GREEN|Q2RF_SHELL_BLUE))) if (!(ent.flags & (Q2RF_SHELL_RED|Q2RF_SHELL_GREEN|Q2RF_SHELL_BLUE)))
return; return;

View file

@ -52,6 +52,7 @@ cvar_t cl_sbar = {"cl_sbar", "0", NULL, CVAR_ARCHIVE};
cvar_t cl_hudswap = {"cl_hudswap", "0", NULL, CVAR_ARCHIVE}; cvar_t cl_hudswap = {"cl_hudswap", "0", NULL, CVAR_ARCHIVE};
cvar_t cl_maxfps = {"cl_maxfps", "-1", NULL, CVAR_ARCHIVE}; cvar_t cl_maxfps = {"cl_maxfps", "-1", NULL, CVAR_ARCHIVE};
cvar_t cl_nopext = {"cl_nopext", "0", NULL, CVAR_ARCHIVE}; cvar_t cl_nopext = {"cl_nopext", "0", NULL, CVAR_ARCHIVE};
cvar_t cl_nolerp = {"cl_nolerp", "1"};
cvar_t cfg_save_name = {"cfg_save_name", "fte", NULL, CVAR_ARCHIVE}; cvar_t cfg_save_name = {"cfg_save_name", "fte", NULL, CVAR_ARCHIVE};
@ -2310,11 +2311,13 @@ void CL_Init (void)
Cvar_Register (&r_lightflicker, "Item effects"); Cvar_Register (&r_lightflicker, "Item effects");
Cvar_Register (&cl_r2g, "Item effects"); Cvar_Register (&cl_r2g, "Item effects");
Cvar_Register (&r_powerupglow, "Item effects"); Cvar_Register (&r_powerupglow, "Item effects");
Cvar_Register (&r_powerupglow, "v_powerupshell"); Cvar_Register (&v_powerupshell, "Item effects");
Cvar_Register (&cl_gibfilter, "Item effects"); Cvar_Register (&cl_gibfilter, "Item effects");
Cvar_Register (&cl_deadbodyfilter, "Item effects"); Cvar_Register (&cl_deadbodyfilter, "Item effects");
Cvar_Register (&cl_nolerp, "Item effects");
// //
// info mirrors // info mirrors
// //
@ -2421,7 +2424,7 @@ void CL_Init (void)
#ifdef _WINDOWS #ifdef _WINDOWS
Cmd_AddCommand ("windows", CL_Windows_f); Cmd_AddCommand ("windows", CL_Windows_f);
#endif #endif
} }
/* /*
@ -2902,6 +2905,8 @@ void Host_Init (quakeparms_t *parms)
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); // Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_TPrintf (TL_HEAPSIZE, parms->memsize/ (1024*1024.0)); Con_TPrintf (TL_HEAPSIZE, parms->memsize/ (1024*1024.0));
Cbuf_AddText ("cl_warncmd 0\n", RESTRICT_LOCAL);
Cbuf_AddText ("+mlook\n", RESTRICT_LOCAL); //fixme: this is bulky, only exec one of these. Cbuf_AddText ("+mlook\n", RESTRICT_LOCAL); //fixme: this is bulky, only exec one of these.
//who should we imitate? //who should we imitate?
@ -2976,10 +2981,20 @@ void Host_Init (quakeparms_t *parms)
#ifndef NOMEDIA #ifndef NOMEDIA
if (!cls.demofile && !cls.state && !media_filmtype) if (!cls.demofile && !cls.state && !media_filmtype)
{ {
if (COM_FDepthFile("video/idlogo.roq", true) > COM_FDepthFile("video/idlog.cin", true)) int ol_depth;
Media_PlayFilm("video/idlog.cin"); int idcin_depth;
else int idroq_depth;
idcin_depth = COM_FDepthFile("video/idlog.cin", true); //q2
idroq_depth = COM_FDepthFile("video/idlogo.roq", true); //q2
ol_depth = COM_FDepthFile("video/openinglogos.roq", true); //jk2
if (ol_depth <= idroq_depth || ol_depth <= idcin_depth)
Media_PlayFilm("video/openinglogos.roq");
else if (idroq_depth <= idcin_depth)
Media_PlayFilm("video/idlogo.roq"); Media_PlayFilm("video/idlogo.roq");
else if (idcin_depth)
Media_PlayFilm("video/idlog.cin");
} }
#endif #endif

View file

@ -582,8 +582,10 @@ void Model_NextDownload (void)
Mod_NowLoadExternal(); Mod_NowLoadExternal();
} }
// all done // all done
R_NewMap (); R_NewMap ();
Hunk_Check (); // make sure nothing is hurt Hunk_Check (); // make sure nothing is hurt
#ifdef Q2CLIENT #ifdef Q2CLIENT
if (cls.q2server) if (cls.q2server)
@ -2946,7 +2948,7 @@ extern cvar_t cl_chatsound, cl_nofake;
return true; return true;
} }
char printtext[2048]; char printtext[4096];
void CL_ParsePrint(char *msg, int level) void CL_ParsePrint(char *msg, int level)
{ {
if (strlen(printtext) + strlen(msg) >= sizeof(printtext)) if (strlen(printtext) + strlen(msg) >= sizeof(printtext))
@ -3014,13 +3016,10 @@ int getplayerid(char *msg)
return -1; return -1;
} }
int getplayerchatcolour(char *msg) int CL_PlayerChatColour(int id)
{ {
int id; char *msg;
int c; int c;
id = getplayerid(msg);
if (id == -1) //not a user/server
return 1;
//primary override. //primary override.
msg = Info_ValueForKey(cl.players[id].userinfo, "tc"); msg = Info_ValueForKey(cl.players[id].userinfo, "tc");
@ -3045,6 +3044,16 @@ int getplayerchatcolour(char *msg)
return cl.players[id].userid; return cl.players[id].userid;
} }
int getplayerchatcolour(char *msg)
{
int id;
id = getplayerid(msg);
if (id == -1) //not a user/server
return 1;
return CL_PlayerChatColour(id);
}
#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x); #define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
#define SHOWNET2(x, y) if(cl_shownet.value==2)Con_Printf ("%3i:%3i:%s\n", msg_readcount-1, y, x); #define SHOWNET2(x, y) if(cl_shownet.value==2)Con_Printf ("%3i:%3i:%s\n", msg_readcount-1, y, x);
/* /*
@ -3142,6 +3151,9 @@ void CL_ParseServerMessage (void)
s = MSG_ReadString (); s = MSG_ReadString ();
if (i == PRINT_CHAT) if (i == PRINT_CHAT)
{ {
if (TP_SuppressMessage(s))
break; //if this was unseen-sent from us, ignore it.
if (CL_ParseChat(s)) if (CL_ParseChat(s))
{ {
CL_ParsePrint(s, i); CL_ParsePrint(s, i);

View file

@ -1828,6 +1828,7 @@ void SCR_TileClear (void)
void SCR_DrawTwoDimensional(int uimenu, qboolean nohud) void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
{ {
RSpeedMark(); RSpeedMark();
// //
// draw any areas not covered by the refresh // draw any areas not covered by the refresh
// //

View file

@ -1115,6 +1115,7 @@ breakout:
} }
} }
#include "glquake.h"
/* /*
================ ================
Con_DrawConsole Con_DrawConsole
@ -1149,10 +1150,15 @@ void Con_DrawConsole (int lines, qboolean noback)
QT_Update(); QT_Update();
#endif #endif
if (qglGetError())
return;
// draw the background // draw the background
if (!noback) if (!noback)
Draw_ConsoleBackground (lines); Draw_ConsoleBackground (lines);
if (qglGetError())
return;
// draw the text // draw the text
con_current->vislines = lines; con_current->vislines = lines;
@ -1172,6 +1178,9 @@ void Con_DrawConsole (int lines, qboolean noback)
rows--; rows--;
} }
if (qglGetError())
return;
row = curcon->display; row = curcon->display;
for (i=0 ; i<rows ; i++, y-=8, row--) for (i=0 ; i<rows ; i++, y-=8, row--)
{ {
@ -1191,6 +1200,9 @@ void Con_DrawConsole (int lines, qboolean noback)
progresstext = NULL; progresstext = NULL;
progresspercent = 0; progresspercent = 0;
if (qglGetError())
return;
// draw the download bar // draw the download bar
// figure out width // figure out width
@ -1258,9 +1270,16 @@ void Con_DrawConsole (int lines, qboolean noback)
Draw_ColouredCharacter ((n+1+x)*8, y, (unsigned char)'\x83' | M_COLOR_WHITE); Draw_ColouredCharacter ((n+1+x)*8, y, (unsigned char)'\x83' | M_COLOR_WHITE);
} }
if (qglGetError())
return;
// draw the input prompt, user text, and cursor if desired // draw the input prompt, user text, and cursor if desired
Con_DrawInput (); Con_DrawInput ();
if (qglGetError())
return;
} }

View file

@ -1615,7 +1615,7 @@ int GL_LoadTexture8Bump (char *identifier, int width, int height, unsigned char
int image_width, image_height; int image_width, image_height;
qbyte *COM_LoadFile (char *path, int usehunk); qbyte *COM_LoadFile (char *path, int usehunk);
int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean colouradjust) int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean colouradjust)
{ {
qboolean alphaed; qboolean alphaed;
char *buf, *data; char *buf, *data;
@ -1638,11 +1638,9 @@ int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean c
static char *path[] ={ static char *path[] ={
"%s%s", "%s%s",
"textures/%s/%s%s", //this is special... It's special name is Mr Ben Ian Graham Hacksworth. "textures/%s/%s%s", //this is special... It uses the subpath parameter.
"textures/%s%s", "textures/%s%s",
"override/%s%s", "override/%s%s"
"pics/%s%s", //quake2 sort of path.
"progs/%s%s"
}; };
int i, e; int i, e;
@ -1672,14 +1670,9 @@ int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean c
{ {
if (i == 1) if (i == 1)
{ {
char map [MAX_QPATH*2]; if (!subpath)
#ifndef CLIENTONLY continue;
if (*sv.name) //server loads before the client knows what's happening. I suppose we could have some sort of param... _snprintf(fname, sizeof(fname)-1, path[i], subpath, COM_SkipPath(nicename), extensions[e]);
Q_strncpyz(map, sv.name, sizeof(map));
else
#endif
COM_FileBase(cl.model_name[1], map);
_snprintf(fname, sizeof(fname)-1, path[i], map, nicename, extensions[e]);
} }
else else
_snprintf(fname, sizeof(fname)-1, path[i], nicename, extensions[e]); _snprintf(fname, sizeof(fname)-1, path[i], nicename, extensions[e]);
@ -1714,14 +1707,14 @@ int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean c
return GL_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alphaed); return GL_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alphaed);
return 0; return 0;
} }
int Mod_LoadReplacementTexture(char *name, qboolean mipmap, qboolean alpha, qboolean gammaadjust) int Mod_LoadReplacementTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean gammaadjust)
{ {
if (!gl_load24bit.value) if (!gl_load24bit.value)
return 0; return 0;
return Mod_LoadHiResTexture(name, mipmap, alpha, gammaadjust); return Mod_LoadHiResTexture(name, subpath, mipmap, alpha, gammaadjust);
} }
int Mod_LoadBumpmapTexture(char *name) int Mod_LoadBumpmapTexture(char *name, char *subpath)
{ {
char *buf, *data; char *buf, *data;
int len; int len;
@ -1737,9 +1730,7 @@ int Mod_LoadBumpmapTexture(char *name)
"%s%s", "%s%s",
"textures/%s/%s%s", //this is special... It's special name is Mr Ben Ian Graham Hacksworth. "textures/%s/%s%s", //this is special... It's special name is Mr Ben Ian Graham Hacksworth.
"textures/%s%s", "textures/%s%s",
"override/%s%s", "override/%s%s"
"pics/%s%s", //quake2 sort of path.
"progs/%s%s"
}; };
int i, e; int i, e;

View file

@ -1313,6 +1313,11 @@ void Key_Event (int key, qboolean down)
{ {
if (UI_KeyPress(key, down) && down) //UI is allowed to take these keydowns. Keyups are always maintained. if (UI_KeyPress(key, down) && down) //UI is allowed to take these keydowns. Keyups are always maintained.
return; return;
#ifdef CSQC_DAT
if (CSQC_KeyPress(key, down)) //give csqc a chance to handle it.
return;
#endif
} }

View file

@ -6,9 +6,10 @@
#include "glquake.h" //evil to include this #include "glquake.h" //evil to include this
#endif #endif
progfuncs_t *csqcprogs; static progfuncs_t *csqcprogs;
unsigned int csqcchecksum; static unsigned int csqcchecksum;
static qboolean csqcwantskeys;
cvar_t pr_csmaxedicts = {"pr_csmaxedicts", "3072"}; cvar_t pr_csmaxedicts = {"pr_csmaxedicts", "3072"};
cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arrive (so I can tell people not to apply it to players...) cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arrive (so I can tell people not to apply it to players...)
@ -21,6 +22,7 @@ cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arriv
globalfunction(keyup_function, "CSQC_KeyUp"); \ globalfunction(keyup_function, "CSQC_KeyUp"); \
globalfunction(parse_stuffcmd, "CSQC_Parse_StuffCmd"); \ globalfunction(parse_stuffcmd, "CSQC_Parse_StuffCmd"); \
globalfunction(parse_centerprint, "CSQC_Parse_CenterPrint"); \ globalfunction(parse_centerprint, "CSQC_Parse_CenterPrint"); \
globalfunction(input_event, "CSQC_InputEvent"); \
\ \
globalfunction(ent_update, "CSQC_Ent_Update"); \ globalfunction(ent_update, "CSQC_Ent_Update"); \
globalfunction(ent_remove, "CSQC_Ent_Remove"); \ globalfunction(ent_remove, "CSQC_Ent_Remove"); \
@ -29,6 +31,8 @@ cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arriv
globalfloat(time, "time"); /*float Written before entering most qc functions*/ \ globalfloat(time, "time"); /*float Written before entering most qc functions*/ \
globalentity(self, "self"); /*entity Written before entering most qc functions*/ \ globalentity(self, "self"); /*entity Written before entering most qc functions*/ \
\ \
globalfloat(maxclients, "maxclients"); /*float */ \
\
globalvector(forward, "v_forward"); /*vector written by anglevectors*/ \ globalvector(forward, "v_forward"); /*vector written by anglevectors*/ \
globalvector(right, "v_right"); /*vector written by anglevectors*/ \ globalvector(right, "v_right"); /*vector written by anglevectors*/ \
globalvector(up, "v_up"); /*vector written by anglevectors*/ \ globalvector(up, "v_up"); /*vector written by anglevectors*/ \
@ -43,7 +47,30 @@ cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arriv
globalfloat(trace_plane_dist, "trace_plane_dist"); /*float written by traceline*/ \ globalfloat(trace_plane_dist, "trace_plane_dist"); /*float written by traceline*/ \
globalentity(trace_ent, "trace_ent"); /*entity written by traceline*/ \ globalentity(trace_ent, "trace_ent"); /*entity written by traceline*/ \
\ \
globalfloat(player_localentnum, "player_localentnum"); /*float the entity number of the local player*/ \ globalfloat(clientcommandframe, "clientcommandframe"); \
globalfloat(servercommandframe, "servercommandframe"); \
\
globalfloat(player_localentnum, "player_localentnum"); /*float the entity number of the local player*/ \
\
globalvector(pmove_org, "pmove_org"); \
globalvector(pmove_vel, "pmove_vel"); \
globalvector(pmove_mins, "pmove_mins"); \
globalvector(pmove_maxs, "pmove_maxs"); \
globalfloat(input_timelength, "input_timelength"); \
globalvector(input_angles, "input_angles"); \
globalvector(input_movevalues, "input_movevalues"); \
globalfloat(input_buttons, "input_buttons"); \
\
globalfloat(movevar_gravity, "movevar_gravity"); \
globalfloat(movevar_stopspeed, "movevar_stopspeed"); \
globalfloat(movevar_maxspeed, "movevar_maxspeed"); \
globalfloat(movevar_spectatormaxspeed,"movevar_spectatormaxspeed"); \
globalfloat(movevar_accelerate, "movevar_accelerate"); \
globalfloat(movevar_airaccelerate, "movevar_airaccelerate"); \
globalfloat(movevar_wateraccelerate,"movevar_wateraccelerate"); \
globalfloat(movevar_friction, "movevar_friction"); \
globalfloat(movevar_waterfriction, "movevar_waterfriction"); \
globalfloat(movevar_entgravity, "movevar_entgravity"); \
typedef struct { typedef struct {
@ -64,9 +91,10 @@ typedef struct {
} csqcglobals_t; } csqcglobals_t;
static csqcglobals_t csqcg; static csqcglobals_t csqcg;
#define plnum 0
void CSQC_FindGlobals(void) static void CSQC_FindGlobals(void)
{ {
#define globalfloat(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0); #define globalfloat(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0);
#define globalvector(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0); #define globalvector(name,qcname) csqcg.name = (float*)PR_FindGlobal(csqcprogs, qcname, 0);
@ -86,7 +114,10 @@ void CSQC_FindGlobals(void)
*csqcg.time = Sys_DoubleTime(); *csqcg.time = Sys_DoubleTime();
if (csqcg.player_localentnum) if (csqcg.player_localentnum)
*csqcg.player_localentnum = cl.playernum[0]+1; *csqcg.player_localentnum = cl.playernum[plnum]+1;
if (csqcg.maxclients)
*csqcg.maxclients = MAX_CLIENTS;
} }
@ -94,6 +125,7 @@ void CSQC_FindGlobals(void)
//this is the list for all the csqc fields. //this is the list for all the csqc fields.
//(the #define is so the list always matches the ones pulled out) //(the #define is so the list always matches the ones pulled out)
#define csqcfields \ #define csqcfields \
fieldfloat(entnum); \
fieldfloat(modelindex); \ fieldfloat(modelindex); \
fieldvector(origin); \ fieldvector(origin); \
fieldvector(angles); \ fieldvector(angles); \
@ -138,10 +170,10 @@ typedef struct csqcedict_s
//add whatever you wish here //add whatever you wish here
} csqcedict_t; } csqcedict_t;
csqcedict_t *csqc_edicts; //consider this 'world' static csqcedict_t *csqc_edicts; //consider this 'world'
void CSQC_InitFields(void) static void CSQC_InitFields(void)
{ //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t { //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t
#define fieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (int)&((csqcentvars_t*)0)->name, -1) #define fieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (int)&((csqcentvars_t*)0)->name, -1)
#define fieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (int)&((csqcentvars_t*)0)->name, -1) #define fieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (int)&((csqcentvars_t*)0)->name, -1)
@ -156,12 +188,12 @@ csqcfields
#undef fieldfunction #undef fieldfunction
} }
csqcedict_t *csqcent[MAX_EDICTS]; static csqcedict_t *csqcent[MAX_EDICTS];
#define RETURN_SSTRING(s) (*(char **)&((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it. #define RETURN_SSTRING(s) (*(char **)&((int *)pr_globals)[OFS_RETURN] = PR_SetString(prinst, s)) //static - exe will not change it.
char *PF_TempStr(void); char *PF_TempStr(void);
int csqcentsize; static int csqcentsize;
//pr_cmds.c builtins that need to be moved to a common. //pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...); void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...);
@ -218,6 +250,8 @@ void PF_traceon (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_traceoff (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_eprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_registercvar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_strstrofs (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_str2chr (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_chr2str (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -240,6 +274,7 @@ void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals); void PF_CL_drawgetimagesize (progfuncs_t *prinst, struct globalvars_s *pr_globals);
#define MAXTEMPBUFFERLEN 1024 #define MAXTEMPBUFFERLEN 1024
void PF_fclose_progs (progfuncs_t *prinst); void PF_fclose_progs (progfuncs_t *prinst);
@ -415,8 +450,8 @@ static void PF_R_ClearScene (progfuncs_t *prinst, struct globalvars_s *pr_global
CL_SwapEntityLists(); CL_SwapEntityLists();
view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK]; view_frame = NULL;//&cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
view_message = &view_frame->playerstate[cl.playernum[0]]; view_message = NULL;//&view_frame->playerstate[cl.playernum[plnum]];
V_CalcRefdef(0); //set up the defaults (for player 0) V_CalcRefdef(0); //set up the defaults (for player 0)
/* /*
VectorCopy(cl.simangles[0], r_refdef.viewangles); VectorCopy(cl.simangles[0], r_refdef.viewangles);
@ -553,6 +588,12 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
{ {
if (cl.worldmodel) if (cl.worldmodel)
R_PushDlights (); R_PushDlights ();
/*
if (cl_csqcdebug.value)
Con_Printf("%f %f %f\n", r_refdef.vieworg[0],
r_refdef.vieworg[1],
r_refdef.vieworg[2]);
*/
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
@ -562,6 +603,10 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
qglDisable(GL_BLEND); qglDisable(GL_BLEND);
} }
#endif #endif
VectorCopy (r_refdef.vieworg, cl.viewent[0].origin);
CalcGunAngle(0);
R_RenderView(); R_RenderView();
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
@ -587,14 +632,14 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global
static void PF_cs_getstatf(progfuncs_t *prinst, struct globalvars_s *pr_globals) static void PF_cs_getstatf(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
int stnum = G_FLOAT(OFS_PARM0); int stnum = G_FLOAT(OFS_PARM0);
float val = *(float*)&cl.stats[0][stnum]; //copy float into the stat float val = *(float*)&cl.stats[plnum][stnum]; //copy float into the stat
G_FLOAT(OFS_RETURN) = val; G_FLOAT(OFS_RETURN) = val;
} }
static void PF_cs_getstati(progfuncs_t *prinst, struct globalvars_s *pr_globals) static void PF_cs_getstati(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ //convert an int stat into a qc float. { //convert an int stat into a qc float.
int stnum = G_FLOAT(OFS_PARM0); int stnum = G_FLOAT(OFS_PARM0);
int val = cl.stats[0][stnum]; int val = cl.stats[plnum][stnum];
if (*prinst->callargc > 1) if (*prinst->callargc > 1)
{ {
int first, count; int first, count;
@ -911,10 +956,221 @@ static void PF_cs_particlesloaded (progfuncs_t *prinst, struct globalvars_s *pr_
G_FLOAT(OFS_RETURN) = P_DescriptionIsLoaded(effectname); G_FLOAT(OFS_RETURN) = P_DescriptionIsLoaded(effectname);
} }
//get the input commands, and stuff them into some globals.
static void PF_cs_getinputstate (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int f;
usercmd_t *cmd;
f = G_FLOAT(OFS_PARM0);
if (f > cls.netchan.outgoing_sequence)
{
G_FLOAT(OFS_RETURN) = false;
return;
}
if (f < cls.netchan.outgoing_sequence - UPDATE_MASK || f < 0)
{
G_FLOAT(OFS_RETURN) = false;
return;
}
// save this command off for prediction
cmd = &cl.frames[f&UPDATE_MASK].cmd[plnum];
if (csqcg.input_timelength)
*csqcg.input_timelength = cmd->msec/1000.0f;
if (csqcg.input_angles)
{
csqcg.input_angles[0] = SHORT2ANGLE(cmd->angles[0]);
csqcg.input_angles[1] = SHORT2ANGLE(cmd->angles[1]);
csqcg.input_angles[2] = SHORT2ANGLE(cmd->angles[2]);
}
if (csqcg.input_movevalues)
{
csqcg.input_movevalues[0] = cmd->forwardmove;
csqcg.input_movevalues[1] = cmd->sidemove;
csqcg.input_movevalues[2] = cmd->upmove;
}
if (csqcg.input_buttons)
*csqcg.input_buttons = cmd->buttons;
G_FLOAT(OFS_RETURN) = true;
}
#define ANGLE2SHORT(x) ((x/360.0)*65535)
//read lots of globals, run the default player physics, write lots of globals.
static void PF_cs_runplayerphysics (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int msecs;
extern vec3_t player_mins;
extern vec3_t player_maxs;
/*
int sequence; // just for debugging prints
// player state
vec3_t origin;
vec3_t angles;
vec3_t velocity;
qboolean jump_held;
int jump_msec; // msec since last jump
float waterjumptime;
int pm_type;
int hullnum;
// world state
int numphysent;
physent_t physents[MAX_PHYSENTS]; // 0 should be the world
// input
usercmd_t cmd;
qboolean onladder;
// results
int numtouch;
int touchindex[MAX_PHYSENTS];
qboolean onground;
int groundent; // index in physents array, only valid
// when onground is true
int waterlevel;
int watertype;
} playermove_t;
typedef struct {
float gravity;
float stopspeed;
float maxspeed;
float spectatormaxspeed;
float accelerate;
float airaccelerate;
float wateraccelerate;
float friction;
float waterfriction;
float entgravity;
float bunnyspeedcap;
float ktjump;
qboolean slidefix;
qboolean airstep;
qboolean walljump;
*/
pmove.sequence = *csqcg.clientcommandframe;
pmove.pm_type = PM_NORMAL;
//set up the movement command
msecs = *csqcg.input_timelength*1000 + 0.5f;
//precision inaccuracies. :(
pmove.angles[0] = ANGLE2SHORT(csqcg.input_angles[0]);
pmove.angles[1] = ANGLE2SHORT(csqcg.input_angles[1]);
pmove.angles[2] = ANGLE2SHORT(csqcg.input_angles[2]);
pmove.cmd.forwardmove = csqcg.input_movevalues[0];
pmove.cmd.sidemove = csqcg.input_movevalues[1];
pmove.cmd.upmove = csqcg.input_movevalues[2];
VectorCopy(csqcg.pmove_org, pmove.origin);
VectorCopy(csqcg.pmove_vel, pmove.velocity);
VectorCopy(csqcg.pmove_maxs, player_maxs);
VectorCopy(csqcg.pmove_mins, player_mins);
pmove.hullnum = 1;
while(msecs)
{
pmove.cmd.msec = msecs;
if (pmove.cmd.msec > 50)
pmove.cmd.msec = 50;
msecs -= pmove.cmd.msec;
PM_PlayerMove(1);
}
VectorCopy(pmove.origin, csqcg.pmove_org);
VectorCopy(pmove.velocity, csqcg.pmove_vel);
}
static void CheckSendPings(void)
{ //quakeworld sends a 'pings' client command to retrieve the frequently updating stuff
if (realtime - cl.last_ping_request > 2)
{
cl.last_ping_request = realtime;
CL_SendClientCommand(false, "pings");
}
}
//string(float pnum, string keyname)
static void PF_cs_getplayerkey (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *ret;
int pnum = G_FLOAT(OFS_PARM0);
char *keyname = PR_GetStringOfs(prinst, OFS_PARM1);
if (pnum < 0)
{
Sbar_SortFrags(false);
if (pnum >= -scoreboardlines)
{//sort by
pnum = fragsort[-(pnum+1)];
}
}
if (pnum < 0 || pnum >= MAX_CLIENTS)
ret = "";
else if (!*cl.players[pnum].userinfo)
ret = "";
else if (!strcmp(keyname, "ping"))
{
CheckSendPings();
ret = PF_TempStr();
sprintf(ret, "%i", cl.players[pnum].ping);
}
else if (!strcmp(keyname, "frags"))
{
ret = PF_TempStr();
sprintf(ret, "%i", cl.players[pnum].frags);
}
else if (!strcmp(keyname, "pl")) //packet loss
{
CheckSendPings();
ret = PF_TempStr();
sprintf(ret, "%i", cl.players[pnum].pl);
}
else if (!strcmp(keyname, "entertime")) //packet loss
{
ret = PF_TempStr();
sprintf(ret, "%i", cl.players[pnum].entertime);
}
else
{
ret = Info_ValueForKey(cl.players[pnum].userinfo, keyname);
}
if (*ret)
G_INT(OFS_RETURN) = 0;
else
RETURN_SSTRING(ret);
}
extern int mouseusedforgui, mousecursor_x, mousecursor_y;
static void PF_cs_setwantskeys (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
qboolean wants = G_FLOAT(OFS_PARM0);
csqcwantskeys = wants;
mouseusedforgui = wants;
}
static void PF_cs_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
G_FLOAT(OFS_RETURN+0) = mousecursor_x;
G_FLOAT(OFS_RETURN+1) = mousecursor_y;
G_FLOAT(OFS_RETURN+2) = 0;
}
#define PF_FixTen PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme #define PF_FixTen PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme,PF_Fixme
//warning: functions that depend on globals are bad, mkay? //warning: functions that depend on globals are bad, mkay?
builtin_t csqc_builtins[] = { static builtin_t csqc_builtins[] = {
//0 //0
PF_Fixme, PF_Fixme,
PF_makevectors, PF_makevectors,
@ -1025,7 +1281,7 @@ PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_registercvar,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
@ -1111,7 +1367,17 @@ PF_cs_pointparticles,
PF_cs_particlesloaded, PF_cs_particlesloaded,
//160 //160
PF_FixTen, PF_cs_getinputstate,
PF_cs_runplayerphysics,
PF_cs_getplayerkey,
PF_cs_setwantskeys,
PF_cs_getmousepos,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
PF_Fixme,
//170 //170
PF_FixTen, PF_FixTen,
@ -1217,15 +1483,15 @@ PF_Fixme,
PF_Fixme, PF_Fixme,
PF_Fixme, PF_Fixme,
}; };
int csqc_numbuiltins = sizeof(csqc_builtins)/sizeof(csqc_builtins[0]); static int csqc_numbuiltins = sizeof(csqc_builtins)/sizeof(csqc_builtins[0]);
jmp_buf csqc_abort; static jmp_buf csqc_abort;
progparms_t csqcprogparms; static progparms_t csqcprogparms;
int num_csqc_edicts; static int num_csqc_edicts;
@ -1391,6 +1657,11 @@ qboolean CSQC_DrawView(void)
if (cl.worldmodel) if (cl.worldmodel)
R_LessenStains(); R_LessenStains();
if (csqcg.clientcommandframe)
*csqcg.clientcommandframe = cls.netchan.outgoing_sequence;
if (csqcg.servercommandframe)
*csqcg.servercommandframe = cls.netchan.incoming_sequence;
if (csqcg.time) if (csqcg.time)
*csqcg.time = Sys_DoubleTime(); *csqcg.time = Sys_DoubleTime();
@ -1399,6 +1670,23 @@ qboolean CSQC_DrawView(void)
return true; return true;
} }
qboolean CSQC_KeyPress(int key, qboolean down)
{
void *pr_globals;
if (!csqcprogs || !csqcwantskeys)
return false;
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = key;
G_FLOAT(OFS_PARM1) = !down;
G_FLOAT(OFS_PARM2) = 0;
PR_ExecuteProgram (csqcprogs, csqcg.input_event);
return true;
}
qboolean CSQC_StuffCmd(char *cmd) qboolean CSQC_StuffCmd(char *cmd)
{ {
void *pr_globals; void *pr_globals;
@ -1445,13 +1733,15 @@ void CSQC_ParseEntities(void)
if (!csqcprogs) if (!csqcprogs)
Host_EndGame("CSQC needs to be initialized for this server.\n"); Host_EndGame("CSQC needs to be initialized for this server.\n");
if (!csqcg.ent_update) if (!csqcg.ent_update || !csqcg.self)
Host_EndGame("CSQC is unable to parse entities\n"); Host_EndGame("CSQC is unable to parse entities\n");
pr_globals = PR_globals(csqcprogs, PR_CURRENT); pr_globals = PR_globals(csqcprogs, PR_CURRENT);
if (csqcg.time) if (csqcg.time)
*csqcg.time = Sys_DoubleTime(); *csqcg.time = Sys_DoubleTime();
if (csqcg.servercommandframe)
*csqcg.servercommandframe = cls.netchan.incoming_sequence;
for(;;) for(;;)
{ {
@ -1471,13 +1761,13 @@ void CSQC_ParseEntities(void)
Con_Printf("Remove %i\n", entnum); Con_Printf("Remove %i\n", entnum);
ent = csqcent[entnum]; ent = csqcent[entnum];
csqcent[entnum] = NULL;
if (!ent) //hrm. if (!ent) //hrm.
continue; continue;
*csqcg.self = EDICT_TO_PROG(csqcprogs, (void*)ent); *csqcg.self = EDICT_TO_PROG(csqcprogs, (void*)ent);
PR_ExecuteProgram(csqcprogs, csqcg.ent_remove); PR_ExecuteProgram(csqcprogs, csqcg.ent_remove);
csqcent[entnum] = NULL;
//the csqc is expected to call the remove builtin. //the csqc is expected to call the remove builtin.
} }
else else
@ -1496,6 +1786,7 @@ void CSQC_ParseEntities(void)
{ {
ent = (csqcedict_t*)ED_Alloc(csqcprogs); ent = (csqcedict_t*)ED_Alloc(csqcprogs);
csqcent[entnum] = ent; csqcent[entnum] = ent;
ent->v->entnum = entnum;
G_FLOAT(OFS_PARM0) = true; G_FLOAT(OFS_PARM0) = true;
if (cl_csqcdebug.value) if (cl_csqcdebug.value)

View file

@ -214,6 +214,11 @@ typedef struct part_type_s {
particle_t *particles; particle_t *particles;
beamseg_t *beams; beamseg_t *beams;
skytris_t *skytris; skytris_t *skytris;
unsigned int flags;
#define PT_VELOCITY 1
#define PT_FRICTION 2
#define PT_CHANGESCOLOUR 4
} part_type_t; } part_type_t;
int numparticletypes; int numparticletypes;
part_type_t *part_type; part_type_t *part_type;
@ -788,6 +793,14 @@ void P_ParticleEffect_f(void)
if (ptype->clipcount < 1) if (ptype->clipcount < 1)
ptype->clipcount = 1; ptype->clipcount = 1;
ptype->flags = 0;
//if there is a chance that it moves
if (ptype->randomvel || ptype->gravity || ptype->veladd || ptype->offsetspread || ptype->offsetspreadvert)
ptype->flags |= PT_VELOCITY;
//if it has friction
if (ptype->friction)
ptype->flags |= PT_FRICTION;
if (ptype->rampmode && !ptype->ramp) if (ptype->rampmode && !ptype->ramp)
{ {
ptype->rampmode = RAMP_NONE; ptype->rampmode = RAMP_NONE;
@ -803,7 +816,7 @@ void P_ParticleEffect_f(void)
{ {
if (strcmp(ptype->texname, "default")) if (strcmp(ptype->texname, "default"))
{ {
ptype->texturenum = Mod_LoadHiResTexture(ptype->texname, true, true, true); ptype->texturenum = Mod_LoadHiResTexture(ptype->texname, "particles", true, true, true);
if (!ptype->texturenum) if (!ptype->texturenum)
{ {
@ -1151,7 +1164,7 @@ void P_ClearParticles (void)
{ {
if (*part_type[i].texname) if (*part_type[i].texname)
{ {
part_type[i].texturenum = Mod_LoadHiResTexture(part_type[i].texname, true, true, true); part_type[i].texturenum = Mod_LoadHiResTexture(part_type[i].texname, "particles", true, true, true);
if (!part_type[i].texturenum) if (!part_type[i].texturenum)
part_type[i].texturenum = explosiontexture; part_type[i].texturenum = explosiontexture;
} }
@ -3133,9 +3146,8 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
kill_list = kill_first = NULL; kill_list = kill_first = NULL;
for (i = 0; i < numparticletypes; i++) for (i = 0, type = &part_type[i]; i < numparticletypes; i++, type++)
{ {
type = &part_type[i];
if (!type->particles) if (!type->particles)
continue; continue;
@ -3262,13 +3274,19 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
break; break;
} }
VectorCopy(p->org, oldorg); VectorCopy(p->org, oldorg);
p->org[0] += p->vel[0]*pframetime; if (type->flags & PT_VELOCITY)
p->org[1] += p->vel[1]*pframetime; {
p->org[2] += p->vel[2]*pframetime; p->org[0] += p->vel[0]*pframetime;
p->vel[0] -= friction[0]*p->vel[0]; p->org[1] += p->vel[1]*pframetime;
p->vel[1] -= friction[1]*p->vel[1]; p->org[2] += p->vel[2]*pframetime;
p->vel[2] -= friction[2]*p->vel[2]; if (type->flags & PT_FRICTION)
p->vel[2] -= grav; {
p->vel[0] -= friction[0]*p->vel[0];
p->vel[1] -= friction[1]*p->vel[1];
p->vel[2] -= friction[2]*p->vel[2];
}
p->vel[2] -= grav;
}
p->angle += p->rotationspeed*pframetime; p->angle += p->rotationspeed*pframetime;

View file

@ -2,7 +2,79 @@
char *particle_set_spikeset = char *particle_set_spikeset =
#if 0 #if 1
/////////////////////////////////////////////////
//rocket trails (derived from purplehaze's, with only minor tweeks)
"r_part rockettrail\n"
"{\n"
" texture \"particles/smoke.tga\"\n"
" count 0.25\n"
" scale 30\n"
" alpha 0.3\n"
" die 1.4\n"
" diesubrand 0.7\n"
" randomvel 1\n"
" veladd 0\n"
" red 255\n"
" green 50 \n"
" blue 10\n"
" reddelta -255\n"
" greendelta -25\n"
" bluedelta -5\n"
" gravity -25\n"
" scalefactor 1\n"
" assoc rocketsmoke\n"
"}\n"
"r_part t_rocket\n"
"{\n"
" texture \"particles/rfire\"\n"
" count 0.5\n"
" scale 10\n"
" alpha 0.6\n"
" die 0.25\n"
" randomvel 0\n"
" veladd 0\n"
" red 255\n"
" green 192\n"
" blue 128\n"
" reddelta -14\n"
" greendelta -300\n"
" bluedelta -300\n"
" blend add\n"
" assoc rockettrail\n"
" gravity 0\n"
" scalefactor 0.8\n"
" scaledelta -10\n"
"}\n"
"r_part rocketsmoke\n"
"{\n"
" texture \"particles/rtrail\"\n"
" step 8\n"
" scale 7.5\n"
" alpha 0.8\n"
" die 2\n"
" diesubrand 0\n"
" randomvel 3\n"
" veladd 0\n"
" red 10\n"
" green 10\n"
" blue 10\n"
" reddelta 0\n"
" greendelta 0\n"
" reddelta 0\n"
" gravity 1\n"
" blend modulate\n"
" spawnmode spiral\n"
" scalefactor 1\n"
" offsetspread 10\n"
" offsetspreadvert 10\n"
" areaspread 0\n"
" areaspreadvert 0\n"
"}\n"
#elif 0
"r_part rockettail\n" "r_part rockettail\n"
"{\n" "{\n"
" texture \"particles/rtrail\"\n" " texture \"particles/rtrail\"\n"
@ -186,6 +258,110 @@ char *particle_set_spikeset =
"friction 1\n" "friction 1\n"
" stains 1\n" " stains 1\n"
"}\n" "}\n"
#if 1
/////////////////////////////////////////////////
//rocket explosions
"r_part randomspark\n"
"{\n"
" count 1\n"
" texture \"\"\n"
" red 255\n"
" green 128\n"
" blue 76\n"
" gravity 400\n"
" spawnmode ball\n"
" die 2\n"
" blend add\n"
" randomvel 128\n"
" veladd 0\n"
" cliptype randomspark\n"
"}\n"
"r_part insaneshrapnal\n"
"{\n"
" count 24\n"
" texture \"\"\n"
" red 255\n"
" green 128\n"
" blue 76\n"
" gravity 400\n"
" die 2\n"
" blend add\n"
" randomvel 512\n"
" veladd 1\n"
" cliptype randomspark\n"
" clipcount 5\n"
"}\n"
"r_part ember\n"
"{\n"
" count 1\n"
" texture \"particles/explosion\"\n"
" red 255\n"
" green 128\n"
" blue 76\n"
" alpha 0\n"
" scale 15\n"
" scalefactor 1\n"
" friction 8\n"
" gravity 50\n"
" die 1\n"
" blend add\n"
" randomvel 5\n"
" veladd 1\n"
" rampmode delta\n" //fade it in then out.
" ramp 0 0 0 -0.5 0\n"
" ramp 0 0 0 0.1 0\n"
" ramp 0 0 0 0.1 0\n"
" ramp 0 0 0 0.1 0\n"
" ramp 0 0 0 0.1 0\n"
" ramp 0 0 0 0.1 0\n"
"}\n"
//the bits that fly off
"r_part expgib\n"
"{\n"
" cliptype expgib\n"
" texture \"particles/explosion\"\n"
" count 16\n"
" scale 0\n"
" die 1\n"
" randomvel 128\n"
" veladd 64\n"
" veladd 0\n"
" gravity 50\n"
" friction 2\n"
" emit ember\n"
" emitinterval 0.01\n"
" spawnmode circle\n"
" assoc insaneshrapnal\n"
"}\n"
//the heart of the explosion
"r_part te_explosion\n"
"{\n"
" texture \"particles/explosion\"\n"
" count 1\n"
" scale 200\n"
" scalefactor 1\n"
" alpha 1\n"
" die 1\n"
" veladd 0\n"
" red 255\n"
" green 128\n"
" blue 76\n"
" reddelta 0\n"
" greendelta -32\n"
" reddelta -32\n"
" gravity 0\n"
" friction 1\n"
" stains 0\n"
" blend add\n"
" assoc expgib\n"
"}\n"
#else
"r_part sparks\n" "r_part sparks\n"
"{\n" "{\n"
" texture \"\"\n" " texture \"\"\n"
@ -313,7 +489,8 @@ char *particle_set_spikeset =
" assoc shrapnal\n" " assoc shrapnal\n"
" scalefactor 1\n" " scalefactor 1\n"
"}\n" "}\n"
"\n"
#endif
"r_part empcentral\n" "r_part empcentral\n"
"{\n" "{\n"

View file

@ -1176,7 +1176,7 @@ void V_CalcRefdef (int pnum)
view->model = NULL; view->model = NULL;
else else
#endif #endif
if (view_message && view_message->flags & (PF_GIB|PF_DEAD) ) if (!view_message || view_message->flags & (PF_GIB|PF_DEAD) )
view->model = NULL; view->model = NULL;
else else
view->model = cl.model_precache[cl.stats[pnum][STAT_WEAPON]]; view->model = cl.model_precache[cl.stats[pnum][STAT_WEAPON]];

File diff suppressed because it is too large Load diff

View file

@ -2135,7 +2135,7 @@ skipws:
for (ws = end + strlen(end)-1; ws >= end && *ws <= ' '; ws--) //skip trailing for (ws = end + strlen(end)-1; ws >= end && *ws <= ' '; ws--) //skip trailing
*ws = '\0'; *ws = '\0';
if (!strcmp(end, "then")) //sigh... trying to make fuhquake's ifs work. if (!strncmp(end, "then", 4)) //sigh... trying to make fuhquake's ifs work.
{ {
end+=4; end+=4;
goto skipws; goto skipws;

View file

@ -2388,7 +2388,10 @@ typedef struct
#define MAX_FILES_IN_PACK 2048 #define MAX_FILES_IN_PACK 2048
char com_gamedir[MAX_OSPATH]; char com_gamedir[MAX_OSPATH];
char com_basedir[MAX_OSPATH]; char *com_basedir;
char com_quakedir[MAX_OSPATH];
char com_homedir[MAX_OSPATH];
#define ZEXPORT VARGS #define ZEXPORT VARGS
@ -2792,258 +2795,7 @@ Sets com_filesize and one of handle or file
=========== ===========
*/ */
int file_from_pak; // global indicating file came from pack file ZOID int file_from_pak; // global indicating file came from pack file ZOID
#if 0
/*
int COM_FOpenFile2 (char *sensativename, FILE **file, qboolean compressedokay)
{
searchpath_t *search;
char netpath[MAX_OSPATH];
int findtime;
char filename[MAX_QPATH];
Q_strncpyz(filename, sensativename, sizeof(filename));
Q_strlwr(filename);
if (filename[strlen(filename)-1] == '/')
{
*file = NULL;
com_filesize = -1;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return -1;
}
if (com_fs_cache.value && !developer.value)
{
if (com_fschanged)
FS_RebuildFSHash();
if (filesystemhash.numbuckets)
{
void *value;
value = Hash_Get(&filesystemhash, filename);
if (!value) //we don't know about a file by this name
{
Con_DPrintf ("FindFile: don't know %s\n", filename);
*file = NULL;
com_filesize = -1;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return -1;
}
for (search = com_searchpaths ; search ; search = search->next)
{
switch (search->type)
{
case SPT_PACK:
{
pack_t *pak;
packfile_t *pf = value;
pak = search->u.pack;
if (pf >= pak->files && pf < pak->files+pak->numfiles) //is the range right?
{
//is in this pack file
Con_DPrintf ("PackFile: %s : %s\n",pak->filename, filename);
// open a new file on the pakfile
*file = fopen (pak->filename, "rb");
if (!*file)
Sys_Error ("Couldn't reopen %s", pak->filename);
fseek (*file, pf->filepos, SEEK_SET);
com_filesize = pf->filelen;
file_from_pak = 1;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return com_filesize;
}
}
break;
#ifdef ZLIB
case SPT_ZIP:
{
zipfile_t *zip;
packfile_t *pfile = value;
zip = search->u.zip;
if (pfile >= zip->files && pfile < zip->files+zip->numfiles) //is the pointer to within the list?
{
Con_DPrintf ("ZipFile: %s : %s\n",zip->filename, filename);
file_from_pak = 2;
com_filenum = pfile - zip->files;
com_filesize = pfile->filelen ;
if (!compressedokay)
{
unzLocateFileMy (zip->handle, com_filenum, zip->files[com_filenum].filepos);
if ((*file = unzOpenCurrentFileFile(zip->handle, search->filename))) //phew!
{
com_pathforfile = NULL;
return pfile->filelen;
}
Con_TPrintf(TL_COMPRESSEDFILEOPENFAILED, filename);
break;
}
else
{
*file = NULL;
com_pathforfile = search;
return pfile->filelen;
}
}
}
break;
#endif
case SPT_OS:
if (value == search) //hash tables refer to the searchpath.
{
sprintf (netpath, "%s/%s",search->filename, filename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
break;
Con_DPrintf ("FindFile: %s\n",netpath);
*file = fopen (netpath, "rb");
file_from_pak = 0;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return COM_filelength (*file);
}
break;
}
}
Con_Printf ("FindFile: can't find %s\n", filename);
*file = NULL;
com_filesize = -1;
return -1;
}
}
//
// search through the path, one element at a time
//
for (search = com_searchpaths ; search ; search = search->next)
{
// is the element a pak file?
switch (search->type)
{
case SPT_PACK:
{
int i;
pack_t *pak;
// look through all the pak file elements
pak = search->u.pack;
for (i=0 ; i<pak->numfiles ; i++)
{
if (!strcmp (pak->files[i].name, filename))
{ // found it!
Con_DPrintf ("PackFile: %s : %s\n",pak->filename, filename);
// open a new file on the pakfile
*file = fopen (pak->filename, "rb");
if (!*file)
Sys_Error ("Couldn't reopen %s", pak->filename);
fseek (*file, pak->files[i].filepos, SEEK_SET);
com_filesize = pak->files[i].filelen;
file_from_pak = 1;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return com_filesize;
}
}
}
break;
#ifdef ZLIB
case SPT_ZIP:
{
packfile_t *pfile;
zipfile_t *zip = search->u.zip;
if ((pfile = Com_FileInZip(zip, filename)))
{
file_from_pak = 2;
com_filenum = pfile - zip->files;
com_filesize = pfile->filelen ;
if (!compressedokay)
{
unzLocateFileMy (zip->handle, com_filenum, zip->files[com_filenum].filepos);
if ((*file = unzOpenCurrentFileFile(zip->handle, search->filename))) //phew!
{
com_pathforfile = NULL;
return pfile->filelen;
}
//this code copies it to a temp file for ultimate hackage.
{
char *buf;
FILE *f = tmpfile();
buf = BZ_Malloc(pfile->filelen);
Com_ReadFileInZip(zip, buf);
fwrite(buf, 1, pfile->filelen, f);
fseek(f, 0, SEEK_SET);
*file = f;
com_pathforfile = search;
return pfile->filelen;
}
Con_TPrintf(TL_COMPRESSEDFILEOPENFAILED, filename);
continue;
}
*file = NULL;
com_pathforfile = search;
return pfile->filelen;
}
}
break;
#endif
case SPT_OS:
// check a file in the directory tree
if (!static_registered)
{ // if not a registered version, don't ever go beyond base
if ( strchr (filename, '/') || strchr (filename,'\\'))
continue;
}
_snprintf (netpath, sizeof(netpath)-1, "%s/%s",search->filename, filename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
continue;
Con_DPrintf ("FindFile: %s\n",netpath);
*file = fopen (netpath, "rb");
file_from_pak = 0;
#ifdef ZLIB
com_pathforfile=NULL;
#endif
return COM_filelength (*file);
default:
Sys_Error("COM_FOpenFile2: bad searchpath type\n");
break;
}
}
//Con_DPrintf ("FindFile: can't find %s\n", filename);
*file = NULL;
com_filesize = -1;
return -1;
}
*/
#endif
//if loc is valid, loc->search is always filled in, the others are filled on success. //if loc is valid, loc->search is always filled in, the others are filled on success.
//returns -1 if couldn't find. //returns -1 if couldn't find.
int FS_FLocateFile(char *filename, FSLF_ReturnType_e returntype, flocation_t *loc) int FS_FLocateFile(char *filename, FSLF_ReturnType_e returntype, flocation_t *loc)
@ -4265,6 +4017,8 @@ void COM_AddGameDirectory (char *dir)
Sys_EnumerateFiles(com_gamedir, "*.pk3", COM_AddZipsWild, NULL); Sys_EnumerateFiles(com_gamedir, "*.pk3", COM_AddZipsWild, NULL);
//don't do zips. we could, but don't. it's not a great idea. //don't do zips. we could, but don't. it's not a great idea.
#endif #endif
com_fschanged = true;
} }
char *COM_NextPath (char *prevpath) char *COM_NextPath (char *prevpath)
@ -4332,7 +4086,7 @@ Sets the gamedir and path to a different directory.
*/ */
void COM_Gamedir (char *dir) void COM_Gamedir (char *dir)
{ {
searchpath_t *search, *next; searchpath_t *next;
if (strstr(dir, "..") || strstr(dir, "/") if (strstr(dir, "..") || strstr(dir, "/")
|| strstr(dir, "\\") || strstr(dir, ":") ) || strstr(dir, "\\") || strstr(dir, ":") )
@ -4399,46 +4153,10 @@ void COM_Gamedir (char *dir)
// //
Cache_Flush (); Cache_Flush ();
sprintf (com_gamedir, "%s/%s", com_basedir, dir); COM_AddGameDirectory(va("%s/%s", com_quakedir, dir));
if (*com_homedir)
COM_AddGameDirectory(va("%s/%s", com_homedir, dir));
for (search = com_searchpaths; search; search = search->next) //see if it's already loaded (base paths)
{
if (!strcmp(search->filename, com_gamedir))
break;
}
if (!search) //was already part of the basic.
{
//
// add the directory to the search path
//
search = (searchpath_t*)Z_Malloc (sizeof(searchpath_t));
search->type = SPT_OS;
strcpy (search->filename, com_gamedir);
search->next = com_searchpaths;
com_searchpaths = search;
COM_AddPacks("%s/pak%i.pak");
#ifdef ZLIB
COM_AddZips("%s/pak%i.zip");
COM_AddZips("%s/pak%i.pk3");
#endif
#ifdef DOOMWADS
COM_AddWad("doom.wad");
COM_AddWad("doom2.wad");
COM_AddWad("dv.wad");
#endif
Sys_EnumerateFiles(com_gamedir, "*.pak", COM_AddPacksWild, NULL);
#ifdef ZLIB
Sys_EnumerateFiles(com_gamedir, "*.pk3", COM_AddZipsWild, NULL);
//don't do zips. we could, but don't. it's not a great idea.
#endif
com_fschanged = true;
}
#ifndef SERVERONLY #ifndef SERVERONLY
{ {
@ -4452,11 +4170,11 @@ void COM_Gamedir (char *dir)
if ((f = fopen(fn, "r")) != NULL) if ((f = fopen(fn, "r")) != NULL)
{ {
fclose(f); fclose(f);
Cbuf_InsertText("cl_warncmd 1\n", RESTRICT_LOCAL); Cbuf_InsertText("cl_warncmd 0\n"
Cbuf_InsertText("exec frontend.cfg\n", RESTRICT_LOCAL); "exec config.cfg\n"
Cbuf_InsertText("exec fte.cfg\n", RESTRICT_LOCAL); "exec fte.cfg\n"
Cbuf_InsertText("exec config.cfg\n", RESTRICT_LOCAL); "exec frontend.cfg\n"
Cbuf_InsertText("cl_warncmd 0\n", RESTRICT_LOCAL); "cl_warncmd 1\n", RESTRICT_LOCAL);
} }
} }
@ -4474,6 +4192,18 @@ void COM_Gamedir (char *dir)
#endif #endif
} }
typedef struct {
char *file;
char *path;
} potentialgamepath_t;
potentialgamepath_t pgp[] = {
{"%s/id1/pak0.pak", "%s/id1"}, //quake1
{"%s/baseq2/pak0.pak", "%s/baseq2"}, //quake2
{"%s/data1/pak0.pak", "%s/data1"}, //hexen2
{"%s/baseq3/pak0.pk3", "%s/baseq3"}, //quake3
{"%s/base/assets0.pk3", "%s/base"} //jk2
};
/* /*
================ ================
COM_InitFilesystem COM_InitFilesystem
@ -4484,15 +4214,55 @@ void COM_InitFilesystem (void)
FILE *f; FILE *f;
int i; int i;
char *ev;
// //
// -basedir <path> // -basedir <path>
// Overrides the system supplied base directory (under id1) // Overrides the system supplied base directory (under id1)
// //
i = COM_CheckParm ("-basedir"); i = COM_CheckParm ("-basedir");
if (i && i < com_argc-1) if (i && i < com_argc-1)
strcpy (com_basedir, com_argv[i+1]); strcpy (com_quakedir, com_argv[i+1]);
else else
strcpy (com_basedir, host_parms.basedir); strcpy (com_quakedir, host_parms.basedir);
#ifdef _WIN32
{ //win32 sucks.
ev = getenv("HOMEDRIVE");
if (ev)
strcpy(com_homedir, ev);
else
strcpy(com_homedir, "");
ev = getenv("HOMEPATH");
if (ev)
strcat(com_homedir, ev);
else
strcat(com_homedir, "/");
}
#else
if (!ev)
{ //yay for unix!.
ev = getenv("HOME");
if (ev)
Q_strncpyz(com_homedir, ev, sizeof(com_homedir));
else
*com_homedir = *"";
}
#endif
if (!COM_CheckParm("-usehome"))
*com_homedir = '\0';
if (*com_homedir)
{
strcat(com_homedir, "/.fte/");
com_basedir = com_homedir;
}
else
{
com_basedir = com_quakedir;
}
// //
// start up with id1 by default // start up with id1 by default
@ -4502,7 +4272,7 @@ void COM_InitFilesystem (void)
{ {
do //use multiple -basegames do //use multiple -basegames
{ {
COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i+1]) ); COM_AddGameDirectory (va("%s/%s", com_quakedir, com_argv[i+1]) );
i = COM_CheckNextParm ("-basegame", i); i = COM_CheckNextParm ("-basegame", i);
} }
@ -4510,53 +4280,25 @@ void COM_InitFilesystem (void)
} }
else else
{ {
//if there is no pak0.pak file in id1, and baseq2 has one, use that instead. for (i = 0; i < sizeof(pgp)/sizeof(pgp[0]); i++)
f = fopen(va("%s/id1/pak0.pak", com_basedir), "rb");
if (f)
{ {
fclose(f); f = fopen(va(pgp[i].file, com_quakedir), "rb");
COM_AddGameDirectory (va("%s/id1", com_basedir) );
}
else
{
f = fopen(va("%s/baseq2/pak0.pak", com_basedir), "rb");
if (f) if (f)
{ {
fclose(f); fclose(f);
COM_AddGameDirectory (va("%s/baseq2", com_basedir) ); COM_AddGameDirectory (va(pgp[i].path, com_quakedir));
} break;
else
{ //hexen2.
f = fopen(va("%s/data1/pak0.pak", com_basedir), "rb");
if (f)
{
fclose(f);
COM_AddGameDirectory (va("%s/data1", com_basedir) );
}
else
{//quake3, we don't have full support for this, so...
f = fopen(va("%s/baseq3/pak0.pk3", com_basedir), "rb");
if (f)
{
fclose(f);
COM_AddGameDirectory (va("%s/baseq3", com_basedir) );
}
else
{
f = fopen(va("%s/base/assets0.pk3", com_basedir), "rb");
if (f)
{
fclose(f);
COM_AddGameDirectory (va("%s/base", com_basedir) );
}
else
COM_AddGameDirectory (va("%s/id1", com_basedir) ); //ah well, id1 it is, they mustve unpacked it.
}
}
} }
} }
if (i == sizeof(pgp)/sizeof(pgp[0]))
COM_AddGameDirectory (va(pgp[0].path, com_quakedir)); //just use the first. The assumption is that they unpacked thier data and deleted the pak files.
} }
COM_AddGameDirectory (va("%s/qw", com_basedir) );
COM_AddGameDirectory (va("%s/qw", com_quakedir) );
COM_AddGameDirectory (va("%s/fte", com_quakedir) );
if (*com_homedir)
COM_AddGameDirectory (va("%s/fte", com_homedir) );
// any set gamedirs will be freed up to here // any set gamedirs will be freed up to here
com_base_searchpaths = com_searchpaths; com_base_searchpaths = com_searchpaths;
@ -4564,7 +4306,7 @@ void COM_InitFilesystem (void)
i = COM_CheckParm ("-game"); //effectivly replace with +gamedir x (But overridable) i = COM_CheckParm ("-game"); //effectivly replace with +gamedir x (But overridable)
if (i && i < com_argc-1) if (i && i < com_argc-1)
{ {
COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i+1]) ); COM_AddGameDirectory (va("%s/%s", com_quakedir, com_argv[i+1]) );
#ifndef CLIENTONLY #ifndef CLIENTONLY
Info_SetValueForStarKey (svs.info, "*gamedir", com_argv[i+1], MAX_SERVERINFO_STRING); Info_SetValueForStarKey (svs.info, "*gamedir", com_argv[i+1], MAX_SERVERINFO_STRING);

View file

@ -187,6 +187,12 @@ int wildcmp(char *wild, char *string); //1 if match
#define Q_strncpyz(d, s, n) Q_strncpyN(d, s, (n)-1) #define Q_strncpyz(d, s, n) Q_strncpyN(d, s, (n)-1)
#else #else
void Q_strncpyz(char*d, const char*s, int n); void Q_strncpyz(char*d, const char*s, int n);
#define Q_strncatz(dest, src, sizeofdest) \
do { \
strncat(dest, src, sizeofdest - strlen(dest) - 1); \
dest[sizeofdest - 1] = 0; \
} while (0)
#define Q_strncatz2(dest, src) Q_strncatz(dest, src, sizeof(dest))
#endif #endif
//#define Q_strncpy Please remove all strncpys //#define Q_strncpy Please remove all strncpys
/*#ifndef strncpy /*#ifndef strncpy

View file

@ -988,8 +988,9 @@ void *Mod_LoadWall(char *name)
tex->height = height; tex->height = height;
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR; texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(name, true, false, true))) if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(name, loadname, true, false, true)))
tex->gl_texturenum = GL_LoadTexture32 (name, width, height, (unsigned int *)in, true, false); if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(name, "bmodels", true, false, true)))
tex->gl_texturenum = GL_LoadTexture32 (name, width, height, (unsigned int *)in, true, false);
texture_mode = GL_LINEAR; texture_mode = GL_LINEAR;
} }
else else
@ -1070,8 +1071,9 @@ void *Mod_LoadWall(char *name)
tex->height = wal->height; tex->height = wal->height;
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR; texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(wal->name, true, false, true))) if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(wal->name, loadname, true, false, true)))
tex->gl_texturenum = GL_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, true, false); if (!(tex->gl_texturenum = Mod_LoadReplacementTexture(wal->name, "bmodels", true, false, true)))
tex->gl_texturenum = GL_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, true, false);
in = Hunk_TempAllocMore(wal->width*wal->height); in = Hunk_TempAllocMore(wal->width*wal->height);
oin = (qbyte *)wal+wal->offsets[0]; oin = (qbyte *)wal+wal->offsets[0];
@ -1887,12 +1889,16 @@ void CModQ3_LoadShaders (lump_t *l)
loadmodel->texinfo[i].texture = Hunk_Alloc(sizeof(texture_t)); loadmodel->texinfo[i].texture = Hunk_Alloc(sizeof(texture_t));
Q_strncpyz(loadmodel->texinfo[i].texture->name, in->shadername, sizeof(loadmodel->texinfo[i].texture->name)); Q_strncpyz(loadmodel->texinfo[i].texture->name, in->shadername, sizeof(loadmodel->texinfo[i].texture->name));
#ifdef RGLQUAKE #ifdef RGLQUAKE
#ifndef Q3SHADERS
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
loadmodel->texinfo[i].texture->gl_texturenum = Mod_LoadHiResTexture(in->shadername, true, false, true); loadmodel->texinfo[i].texture->gl_texturenum = Mod_LoadHiResTexture(in->shadername, loadname, true, false, true);
if (!loadmodel->texinfo[i].texture->gl_texturenum)
loadmodel->texinfo[i].texture->gl_texturenum = Mod_LoadHiResTexture(in->shadername, "bmodels", true, false, true);
loadmodel->texinfo[i].texture->gl_texturenumfb = 0; loadmodel->texinfo[i].texture->gl_texturenumfb = 0;
loadmodel->texinfo[i].texture->gl_texturenumbumpmap = 0; loadmodel->texinfo[i].texture->gl_texturenumbumpmap = 0;
} }
#endif
#endif #endif
loadmodel->textures[i] = loadmodel->texinfo[i].texture; loadmodel->textures[i] = loadmodel->texinfo[i].texture;
@ -2551,7 +2557,7 @@ continue;
out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name); out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name);
} }
if (in->fognum == -1 || !map_numfogs) if (in->fognum < 0 || in->fognum >= map_numfogs)
out->fog = NULL; out->fog = NULL;
else else
out->fog = map_fogs + in->fognum; out->fog = map_fogs + in->fognum;

View file

@ -345,4 +345,9 @@ trace_t PM_PlayerTrace (vec3_t start, vec3_t end)
return total; return total;
} }
//for use outside the pmove code. lame, but works.
trace_t PM_TraceLine (vec3_t start, vec3_t end)
{
pmove.hullnum = 0;
return PM_PlayerTrace(start, end);
}

View file

@ -1066,7 +1066,7 @@ void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
qglDepthFunc(gldepthfunc); qglDepthFunc(gldepthfunc);
qglDepthMask(1); qglDepthMask(1);
GL_Bind(texnum); GL_Bind(texnum);
if (gldepthmin == 0.5) if (gldepthmin == 0.5)
qglCullFace ( GL_BACK ); qglCullFace ( GL_BACK );
@ -2001,27 +2001,26 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
outskin->skinwidth = pq1inmodel->skinwidth; outskin->skinwidth = pq1inmodel->skinwidth;
outskin->skinheight = pq1inmodel->skinheight; outskin->skinheight = pq1inmodel->skinheight;
sprintf(skinname, "%s_%i", loadname, i); //LH's naming scheme ("models" is likly to be ignored)
texture = Mod_LoadReplacementTexture(skinname, true, false, true); _snprintf(skinname, sizeof(skinname), "%s_%i", loadmodel->name, i);
if (!texture) texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
if (texture)
{ {
sprintf(skinname, "textures/models/%s_%i", loadname, i); _snprintf(skinname, sizeof(skinname), "%s_%i_luma", loadmodel->name, i);
texture = Mod_LoadReplacementTexture(skinname, true, false, true); texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
}
else
{
sprintf(skinname, "%s_%i", loadname, i);
texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
if (texture && r_fb_models.value) if (texture && r_fb_models.value)
{ {
sprintf(skinname, "textures/models/%s_%i_luma", loadname, i); sprintf(skinname, "%s_%i_luma", loadname, i);
fbtexture = Mod_LoadReplacementTexture(skinname, true, true, true); fbtexture = Mod_LoadReplacementTexture(skinname, "models", true, true, true);
} }
else else
fbtexture = 0; fbtexture = 0;
} }
else if (texture && r_fb_models.value)
{
sprintf(skinname, "%s_%i_luma", loadname, i);
fbtexture = Mod_LoadReplacementTexture(skinname, true, true, true);
}
else
fbtexture = 0;
if (!texture) if (!texture)
{ {
@ -2065,18 +2064,34 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
outskin->ofstexels = 0; outskin->ofstexels = 0;
for (t = 0; t < outskin->texnums; t++,data+=s, texnums++) for (t = 0; t < outskin->texnums; t++,data+=s, texnums++)
{ {
sprintf(skinname, "%s_%i%c", loadname, i, t+'a'); texture = 0;
texture = Mod_LoadReplacementTexture(skinname, true, false, true); fbtexture = 0;
if (texture)
//LH naming scheme
if (!texture)
{ {
texnums->base = texture; sprintf(skinname, "%s_%i_%i", loadmodel->name, i, t);
if (r_fb_models.value) texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
{
sprintf(skinname, "%s_%i%c_luma", loadname, i, t+'a');
texnums->fullbright = Mod_LoadReplacementTexture(skinname, true, true, true);
}
} }
else if (!fbtexture && r_fb_models.value)
{
sprintf(skinname, "%s_%i_%i_luma", loadmodel->name, i, t);
fbtexture = Mod_LoadReplacementTexture(skinname, "models", true, true, true);
}
//Fuhquake naming scheme
if (!texture)
{
sprintf(skinname, "%s_%i_%i", loadname, i, t);
texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
}
if (!fbtexture && r_fb_models.value)
{
sprintf(skinname, "%s_%i_%i_luma", loadname, i, t);
fbtexture = Mod_LoadReplacementTexture(skinname, "models", true, true, true);
}
if (!texture || (!fbtexture && r_fb_models.value))
{ {
if (t == 0) if (t == 0)
{ {
@ -2087,47 +2102,24 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
saved = BZ_Malloc(s); saved = BZ_Malloc(s);
memcpy(saved, pskintype+1, s); memcpy(saved, pskintype+1, s);
GLMod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight); GLMod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight);
sprintf(skinname, "%s_%i%c", loadname, i, t+'a'); if (!texture)
texnums->base = GL_LoadTexture(skinname, outskin->skinwidth, outskin->skinheight, saved, true, alpha);
if (gl_bumpmappingpossible)
{ {
char name[MAX_QPATH]; sprintf(skinname, "%s_%i_%i", loadname, i, t);
COM_StripExtension(skinname, name); //go for the normalmap texture = GL_LoadTexture(skinname, outskin->skinwidth, outskin->skinheight, saved, true, alpha);
strcat(name, "_norm");
texnums->bump = Mod_LoadHiResTexture(name, true, true, false);
if (!texnums->bump)
{
strcpy(name, loadmodel->name);
COM_StripExtension(COM_SkipPath(skinname), COM_SkipPath(name));
strcat(name, "_norm");
texnums->bump = Mod_LoadHiResTexture(name, true, true, false);
if (!texnums->bump)
{
COM_StripExtension(skinname, name); //bother, go for heightmap and convert
strcat(name, "_bump");
texnums->bump = Mod_LoadBumpmapTexture(name);
if (!texnums->bump)
{
strcpy(name, loadmodel->name);
strcpy(COM_SkipPath(name), COM_SkipPath(skinname)); //eviile eh?
COM_StripExtension(name, name);
strcat(name, "_bump");
texnums->bump = Mod_LoadBumpmapTexture(name);
}
}
}
} }
if (r_fb_models.value)
if (!fbtexture && r_fb_models.value)
{ {
sprintf(skinname, "%s_%i%c_luma", loadname, i, t+'a'); sprintf(skinname, "%s_%i_%i_luma", loadname, i, t);
texnums->fullbright = GL_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true); fbtexture = GL_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true);
} }
if (t != 0) //only keep the first. if (t != 0) //only keep the first.
BZ_Free(saved); BZ_Free(saved);
} }
texnums->base = texture;
texnums->fullbright = fbtexture;
} }
pskintype = (daliasskintype_t *)data; pskintype = (daliasskintype_t *)data;
break; break;
@ -2360,7 +2352,7 @@ static void Q2_LoadSkins(char *skins)
outskin->texnums=1; outskin->texnums=1;
COM_CleanUpPath(skins); //blooming tanks. COM_CleanUpPath(skins); //blooming tanks.
texnums->base = Mod_LoadReplacementTexture(skins, true, false, true); texnums->base = Mod_LoadReplacementTexture(skins, "models", true, false, true);
outskin->skinwidth = 0; outskin->skinwidth = 0;
outskin->skinheight = 0; outskin->skinheight = 0;
outskin->skinspeed = 0; outskin->skinspeed = 0;
@ -3251,7 +3243,7 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
root[i].numskins = 1; root[i].numskins = 1;
skin->ofstexnums = (char *)texnums - (char *)skin; skin->ofstexnums = (char *)texnums - (char *)skin;
skin->texnums = 1; skin->texnums = 1;
texnums->base = Mod_LoadHiResTexture(shadername, true, true, true); texnums->base = Mod_LoadHiResTexture(shadername, "models", true, true, true);
} }

View file

@ -1516,6 +1516,8 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass )
vec3_t diff, viewtofog, fog_vpn; vec3_t diff, viewtofog, fog_vpn;
fogplane = mb->fog->visibleplane; fogplane = mb->fog->visibleplane;
if (!fogplane)
return;
dist = PlaneDiff ( r_origin, fogplane ); dist = PlaneDiff ( r_origin, fogplane );
if ( shader->flags & SHADER_SKY ) if ( shader->flags & SHADER_SKY )

View file

@ -31,10 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int glx, gly, glwidth, glheight; int glx, gly, glwidth, glheight;
mesh_t draw_mesh; mesh_t draw_mesh;
vec4_t draw_mesh_xyz[4]; vec4_t draw_mesh_xyz[4];
vec3_t draw_mesh_normals[4];
vec2_t draw_mesh_st[4]; vec2_t draw_mesh_st[4];
vec2_t draw_mesh_lmst[4];
byte_vec4_t draw_mesh_colors[4]; byte_vec4_t draw_mesh_colors[4];
qbyte *uploadmemorybuffer; qbyte *uploadmemorybuffer;
@ -236,11 +234,11 @@ qboolean Draw_RealPicFromWad (mpic_t *out, char *name)
} }
//standard names substitution //standard names substitution
texnum = Mod_LoadReplacementTexture(name, false, true, false); texnum = Mod_LoadReplacementTexture(name, "wad", false, true, false);
if (!in && !texnum) //try a q2 texture if (!in && !texnum) //try a q2 texture
{ {
sprintf(name2, "pics/%s", name); sprintf(name2, "pics/%s", name);
texnum = Mod_LoadHiResTexture(name2, false, true, false); texnum = Mod_LoadHiResTexture(name2, NULL, false, true, false);
qglDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
qglEnable(GL_BLEND); //make sure. qglEnable(GL_BLEND); //make sure.
} }
@ -365,7 +363,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
{ {
pic->pic.height = height; pic->pic.height = height;
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, "pics", false, true, false)))
gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false); gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
@ -406,7 +404,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
if (mem) if (mem)
{ {
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, NULL, false, true, false)))
gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, true); gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, true);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
@ -435,7 +433,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
{ {
pic->pic.height = height; pic->pic.height = height;
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, false, true, false))) if (!(gl->texnum = Mod_LoadReplacementTexture(alternatename, NULL, false, true, false)))
gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false); gl->texnum = GL_LoadTexture32(path, pic->pic.width, pic->pic.height, (unsigned *)mem, false, false);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
@ -510,7 +508,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
pic->pic.height = qpic->height; pic->pic.height = qpic->height;
gl = (glpic_t *)pic->pic.data; gl = (glpic_t *)pic->pic.data;
if (!(gl->texnum = Mod_LoadReplacementTexture(path, false, true, false))) if (!(gl->texnum = Mod_LoadReplacementTexture(path, NULL, false, true, false)))
gl->texnum = GL_LoadPicTexture (qpic); gl->texnum = GL_LoadPicTexture (qpic);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
@ -744,12 +742,12 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
image_width = 0; image_width = 0;
image_height = 0; image_height = 0;
TRACE(("dbg: GLDraw_ReInit: looking for conchars\n")); TRACE(("dbg: GLDraw_ReInit: looking for conchars\n"));
if (!(char_texture=Mod_LoadReplacementTexture("gfx/conchars.lmp", false, true, false))) //no high res if (!(char_texture=Mod_LoadReplacementTexture("gfx/conchars.lmp", NULL, false, true, false))) //no high res
{ {
if (!draw_chars) //or low res. if (!draw_chars) //or low res.
{ {
if (!(char_texture=Mod_LoadHiResTexture("pics/conchars.pcx", false, true, false))) //try low res q2 path if (!(char_texture=Mod_LoadHiResTexture("pics/conchars.pcx", NULL, false, true, false))) //try low res q2 path
if (!(char_texture=Mod_LoadHiResTexture("gfx/2d/bigchars.tga", false, true, false))) //try low res q2 path if (!(char_texture=Mod_LoadHiResTexture("gfx/2d/bigchars.tga", NULL, false, true, false))) //try low res q2 path
{ {
//gulp... so it's come to this has it? rework the hexen2 conchars into the q1 system. //gulp... so it's come to this has it? rework the hexen2 conchars into the q1 system.
@ -911,7 +909,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
TRACE(("dbg: GLDraw_ReInit: gfx/conchars2.lmp\n")); TRACE(("dbg: GLDraw_ReInit: gfx/conchars2.lmp\n"));
if (!(char_tex2=Mod_LoadReplacementTexture("gfx/conchars2.lmp", false, true, false))) if (!(char_tex2=Mod_LoadReplacementTexture("gfx/conchars2.lmp", NULL, false, true, false)))
{ {
if (!draw_chars) if (!draw_chars)
char_tex2 = char_texture; char_tex2 = char_texture;
@ -996,13 +994,13 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl = (glpic_t *)conback->data; gl = (glpic_t *)conback->data;
if (!(gl->texnum=Mod_LoadReplacementTexture("gfx/conback.lmp", false, true, false))) if (!(gl->texnum=Mod_LoadReplacementTexture("gfx/conback.lmp", NULL, false, true, false)))
{ {
if (!ncdata) //no fallback if (!ncdata) //no fallback
{ {
if (!(gl->texnum=Mod_LoadHiResTexture("pics/conback.pcx", false, true, false))) if (!(gl->texnum=Mod_LoadHiResTexture("pics/conback.pcx", NULL, false, true, false)))
if (!(gl->texnum=Mod_LoadReplacementTexture("gfx/menu/conback.lmp", false, true, false))) if (!(gl->texnum=Mod_LoadReplacementTexture("gfx/menu/conback.lmp", NULL, false, true, false)))
if (!(gl->texnum=Mod_LoadReplacementTexture("textures/sfx/logo512.jpg", false, false, false))) if (!(gl->texnum=Mod_LoadReplacementTexture("textures/sfx/logo512.jpg", NULL, false, false, false)))
{ {
int data = 0; int data = 0;
gl->texnum = GL_LoadTexture32("gfx/conback.lmp", 1, 1, (unsigned int *)&data, false, false); gl->texnum = GL_LoadTexture32("gfx/conback.lmp", 1, 1, (unsigned int *)&data, false, false);
@ -1054,7 +1052,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
if (!draw_backtile) if (!draw_backtile)
draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp"); draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp");
detailtexture = Mod_LoadReplacementTexture("textures/detail", true, false, false); detailtexture = Mod_LoadReplacementTexture("textures/detail", NULL, true, false, false);
inited15to8 = false; inited15to8 = false;
@ -1087,9 +1085,9 @@ void GLDraw_Init (void)
draw_mesh.numvertexes = 4; draw_mesh.numvertexes = 4;
draw_mesh.xyz_array = draw_mesh_xyz; draw_mesh.xyz_array = draw_mesh_xyz;
draw_mesh.normals_array = draw_mesh_normals; draw_mesh.normals_array = NULL;
draw_mesh.st_array = draw_mesh_st; draw_mesh.st_array = draw_mesh_st;
draw_mesh.lmst_array = draw_mesh_lmst; draw_mesh.lmst_array = NULL;
} }
void GLDraw_DeInit (void) void GLDraw_DeInit (void)
@ -1287,9 +1285,7 @@ void GLDraw_Crosshair(void)
if (crosshairimage.modified) if (crosshairimage.modified)
{ {
crosshairimage.modified = false; crosshairimage.modified = false;
externalhair = Mod_LoadHiResTexture (va("crosshairs/%s", crosshairimage.string), false, true, true); externalhair = Mod_LoadHiResTexture (crosshairimage.string, "crosshairs", false, true, true);
if (!externalhair)
externalhair = Mod_LoadHiResTexture (crosshairimage.string, false, true, true);
} }
GL_Bind (externalhair); GL_Bind (externalhair);
@ -1874,7 +1870,7 @@ void GL_Set2D (void)
if (gl_font.modified) if (gl_font.modified)
{ {
gl_font.modified = 0; gl_font.modified = 0;
if (!*gl_font.string || !(char_texture=Mod_LoadHiResTexture(va("fonts/%s", gl_font.string), false, true, true))) if (!*gl_font.string || !(char_texture=Mod_LoadHiResTexture(gl_font.string, "fonts", false, true, true)))
{ {
char_texture = default_char_texture; char_texture = default_char_texture;
custom_char_instep = default_char_instep; custom_char_instep = default_char_instep;
@ -1889,7 +1885,7 @@ void GL_Set2D (void)
{ {
int newtex = 0; int newtex = 0;
gl_conback.modified = 0; gl_conback.modified = 0;
if (!*gl_conback.string || !(newtex=Mod_LoadHiResTexture(va("conbacks/%s", gl_conback.string), false, true, true))) if (!*gl_conback.string || !(newtex=Mod_LoadHiResTexture(gl_conback.string, "conbacks", false, true, true)))
conback = default_conback; conback = default_conback;
else else
{ {

View file

@ -861,12 +861,12 @@ TRACE(("dbg: GLMod_LoadAdvancedTextureSection: %s\n", name));
*base = 0; *base = 0;
*norm = 0; *norm = 0;
if (!*norm && *normname) if (!*norm && *normname)
*norm = Mod_LoadHiResTexture(normname, true, false, false); *norm = Mod_LoadHiResTexture(normname, NULL, true, false, false);
if (!*norm && *bumpname) if (!*norm && *bumpname)
*norm = Mod_LoadBumpmapTexture(bumpname); *norm = Mod_LoadBumpmapTexture(bumpname, NULL);
if (*norm && *flatname) if (*norm && *flatname)
*base = Mod_LoadHiResTexture(flatname, true, false, true); *base = Mod_LoadHiResTexture(flatname, NULL, true, false, true);
} }
else else
{ {
@ -875,14 +875,14 @@ TRACE(("dbg: GLMod_LoadAdvancedTextureSection: %s\n", name));
*norm = 0; *norm = 0;
} }
if (!*base && *stdname) if (!*base && *stdname)
*base = Mod_LoadHiResTexture(stdname, true, false, true); *base = Mod_LoadHiResTexture(stdname, NULL, true, false, true);
if (!*base && *flatname) if (!*base && *flatname)
*base = Mod_LoadHiResTexture(flatname, true, false, true); *base = Mod_LoadHiResTexture(flatname, NULL, true, false, true);
if (luma && *lumaname) if (luma && *lumaname)
*luma = Mod_LoadHiResTexture(lumaname, true, true, true); *luma = Mod_LoadHiResTexture(lumaname, NULL, true, true, true);
if (*norm && gloss && *glossname && gl_specular.value) if (*norm && gloss && *glossname && gl_specular.value)
*gloss = Mod_LoadHiResTexture(glossname, true, false, true); *gloss = Mod_LoadHiResTexture(glossname, NULL, true, false, true);
} }
void GLMod_LoadAdvancedTexture(char *name, int *base, int *norm, int *luma, int *gloss, int *alphamode, qboolean *cull) //fixme: add gloss void GLMod_LoadAdvancedTexture(char *name, int *base, int *norm, int *luma, int *gloss, int *alphamode, qboolean *cull) //fixme: add gloss
@ -1000,8 +1000,9 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
base = W_ConvertWAD3Texture(mt, &mt->width, &mt->height, &alphaed); //convert texture to 32 bit. base = W_ConvertWAD3Texture(mt, &mt->width, &mt->height, &alphaed); //convert texture to 32 bit.
tx->alphaed = alphaed; tx->alphaed = alphaed;
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR; texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, true, alphaed, true))) if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, loadname, true, alphaed, true)))
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (unsigned int *)base, true, alphaed); if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, "bmodels", true, alphaed, true)))
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (unsigned int *)base, true, alphaed);
*tx->name = *mt->name; *tx->name = *mt->name;
texture_mode = GL_LINEAR; texture_mode = GL_LINEAR;
@ -1009,16 +1010,19 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
else else
{ {
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR; texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, true, false, true))) if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, loadname, true, false, true)))
tx->gl_texturenum = GL_LoadTexture (mt->name, tx->width, tx->height, base, true, false); if (!(tx->gl_texturenum = Mod_LoadReplacementTexture(mt->name, "bmodels", true, false, true)))
tx->gl_texturenum = GL_LoadTexture (mt->name, tx->width, tx->height, base, true, false);
texture_mode = GL_LINEAR; texture_mode = GL_LINEAR;
if (r_fb_bmodels.value) if (r_fb_bmodels.value)
{ {
_snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name); _snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name);
if (gl_load24bit.value && r_fb_bmodels.value) if (gl_load24bit.value)
{ {
tx->gl_texturenumfb = Mod_LoadReplacementTexture(altname, true, false, true); tx->gl_texturenumfb = Mod_LoadReplacementTexture(altname, loadname, true, false, true);
if (!tx->gl_texturenumfb)
tx->gl_texturenumfb = Mod_LoadReplacementTexture(altname, "bmodels", true, false, true);
} }
if (!tx->gl_texturenumfb) //generate one (if possible). if (!tx->gl_texturenumfb) //generate one (if possible).
tx->gl_texturenumfb = GL_LoadTextureFB(altname, tx->width, tx->height, base, true, true); tx->gl_texturenumfb = GL_LoadTextureFB(altname, tx->width, tx->height, base, true, true);
@ -1032,14 +1036,18 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
if (gl_bump.value<2) //set to 2 to have faster loading. if (gl_bump.value<2) //set to 2 to have faster loading.
{ {
_snprintf(altname, sizeof(altname)-1, "%s_norm", mt->name); _snprintf(altname, sizeof(altname)-1, "%s_norm", mt->name);
tx->gl_texturenumbumpmap = Mod_LoadHiResTexture(altname, true, false, false); tx->gl_texturenumbumpmap = Mod_LoadHiResTexture(altname, loadname, true, false, false);
if (!tx->gl_texturenumbumpmap)
tx->gl_texturenumbumpmap = Mod_LoadHiResTexture(altname, "bmodels", true, false, false);
} }
if (!tx->gl_texturenumbumpmap) if (!tx->gl_texturenumbumpmap)
{ {
if (gl_load24bit.value) if (gl_load24bit.value)
{ {
_snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name); _snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(altname); tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(altname, loadname);
if (!tx->gl_texturenumbumpmap)
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(altname, "bmodels");
} }
else else
_snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name); _snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
@ -1058,7 +1066,9 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
if (gl_specular.value && gl_load24bit.value) if (gl_specular.value && gl_load24bit.value)
{ {
_snprintf(altname, sizeof(altname)-1, "%s_gloss", mt->name); _snprintf(altname, sizeof(altname)-1, "%s_gloss", mt->name);
tx->gl_texturenumspec = Mod_LoadHiResTexture(altname, true, false, false); tx->gl_texturenumspec = Mod_LoadHiResTexture(altname, loadname, true, false, false);
if (!tx->gl_texturenumspec)
tx->gl_texturenumspec = Mod_LoadHiResTexture(altname, "bmodels", true, false, false);
} }
} }
} }
@ -1208,14 +1218,17 @@ void GLMod_NowLoadExternal(void)
tx->alphaed = alphaed; tx->alphaed = alphaed;
} }
if (!(tx->gl_texturenum = Mod_LoadHiResTexture(tx->name, true, false, true))) if (!(tx->gl_texturenum = Mod_LoadHiResTexture(tx->name, loadname, true, false, true)))
tx->gl_texturenum = Mod_LoadReplacementTexture("light1_4", true, false, true); if (!(tx->gl_texturenum = Mod_LoadHiResTexture(tx->name, "bmodels", true, false, true)))
tx->gl_texturenum = Mod_LoadReplacementTexture("light1_4", NULL, true, false, true); //a fallback. :/
texture_mode = GL_LINEAR; texture_mode = GL_LINEAR;
} }
} }
if (!tx->gl_texturenumbumpmap && *tx->name != '{' && gl_bumpmappingpossible && cls.allow_bump) if (!tx->gl_texturenumbumpmap && *tx->name != '{' && gl_bumpmappingpossible && cls.allow_bump)
{ {
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(va("%s_bump", tx->name)); tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(va("%s_bump", tx->name), loadname);
if (!tx->gl_texturenumbumpmap)
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(va("%s_bump", tx->name), "bmodels");
if (!tx->gl_texturenumbumpmap) if (!tx->gl_texturenumbumpmap)
{ {
qbyte *data; qbyte *data;
@ -2824,7 +2837,7 @@ void * GLMod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum
COM_StripExtension(loadmodel->name, name); COM_StripExtension(loadmodel->name, name);
strcat(name, va("_%i", framenum)); strcat(name, va("_%i", framenum));
pspriteframe->gl_texturenum = Mod_LoadReplacementTexture(name, true, true, true); pspriteframe->gl_texturenum = Mod_LoadReplacementTexture(name, "sprites", true, true, true);
if (version == SPRITE32_VERSION) if (version == SPRITE32_VERSION)
{ {
size *= 4; size *= 4;
@ -3023,7 +3036,7 @@ void GLMod_LoadSprite2Model (model_t *mod, void *buffer)
frame = psprite->frames[i].frameptr = Hunk_AllocName(sizeof(mspriteframe_t), loadname); frame = psprite->frames[i].frameptr = Hunk_AllocName(sizeof(mspriteframe_t), loadname);
frame->gl_texturenum = Mod_LoadHiResTexture(pframetype->name, true, true, true); frame->gl_texturenum = Mod_LoadHiResTexture(pframetype->name, NULL, true, true, true);
frame->width = LittleLong(pframetype->width); frame->width = LittleLong(pframetype->width);
frame->height = LittleLong(pframetype->height); frame->height = LittleLong(pframetype->height);
origin[0] = LittleLong (pframetype->origin_x); origin[0] = LittleLong (pframetype->origin_x);

View file

@ -990,7 +990,7 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
r_drawflat.modified = false; r_drawflat.modified = false;
for (i = 0; i < sizeof(textures)/sizeof(textures[0]); i++) for (i = 0; i < sizeof(textures)/sizeof(textures[0]); i++)
{ {
textures[i] = Mod_LoadHiResTexture(va("sketch%i", i+1), true, false, false); textures[i] = Mod_LoadHiResTexture(va("sketch%i", i+1), "sketch", true, false, false);
if (!textures[i]) if (!textures[i])
{ {
int data[128*128]; int data[128*128];
@ -1714,7 +1714,7 @@ void PPL_CreateLightTexturesProgram(void)
char *frag = char *frag =
"uniform sampler2D baset;\n" "uniform sampler2D baset;\n"
"#ifdef BUMP\n" "#if defined(BUMP) || defined(SPECULAR)\n"
"uniform sampler2D bumpt;\n" "uniform sampler2D bumpt;\n"
"#endif\n" "#endif\n"
"#ifdef SPECULAR\n" "#ifdef SPECULAR\n"
@ -1736,10 +1736,12 @@ void PPL_CreateLightTexturesProgram(void)
"{\n" "{\n"
"#ifdef BUMP\n" "#ifdef BUMP\n"
" vec3 bases = vec3(texture2D(baset, tcbase));\n" " vec3 bases = vec3(texture2D(baset, tcbase));\n"
" vec3 bumps = vec3(texture2D(bumpt, tcbase)) * 2.0 - 1.0;\n"
"#else\n" "#else\n"
" vec3 diff = vec3(texture2D(baset, tcbase));\n" " vec3 diff = vec3(texture2D(baset, tcbase));\n"
"#endif\n" "#endif\n"
"#if defined(BUMP) || defined(SPECULAR)\n"
" vec3 bumps = vec3(texture2D(bumpt, tcbase)) * 2.0 - 1.0;\n"
"#endif\n"
"#ifdef SPECULAR\n" "#ifdef SPECULAR\n"
" vec3 specs = vec3(texture2D(speculart, tcbase));\n" " vec3 specs = vec3(texture2D(speculart, tcbase));\n"
"#endif\n" "#endif\n"

View file

@ -1532,7 +1532,7 @@ void R_RenderScene (void)
R_Clear R_Clear
============= =============
*/ */
int gldepthfunc; int gldepthfunc = GL_LEQUAL;
void R_Clear (void) void R_Clear (void)
{ {
if (r_mirroralpha.value != 1.0) if (r_mirroralpha.value != 1.0)
@ -1543,7 +1543,7 @@ void R_Clear (void)
qglClear (GL_DEPTH_BUFFER_BIT); qglClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 0.5; gldepthmax = 0.5;
qglDepthFunc (gldepthfunc=GL_LEQUAL); gldepthfunc=GL_LEQUAL;
} }
#ifdef SIDEVIEWS #ifdef SIDEVIEWS
else if (gl_ztrick.value && !gl_ztrickdisabled) else if (gl_ztrick.value && !gl_ztrickdisabled)
@ -1561,13 +1561,13 @@ void R_Clear (void)
{ {
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 0.49999; gldepthmax = 0.49999;
qglDepthFunc (gldepthfunc=GL_LEQUAL); gldepthfunc=GL_LEQUAL;
} }
else else
{ {
gldepthmin = 1; gldepthmin = 1;
gldepthmax = 0.5; gldepthmax = 0.5;
qglDepthFunc (gldepthfunc=GL_GEQUAL); gldepthfunc=GL_GEQUAL;
} }
} }
else else
@ -1578,9 +1578,10 @@ void R_Clear (void)
qglClear (GL_DEPTH_BUFFER_BIT); qglClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 1; gldepthmax = 1;
qglDepthFunc (gldepthfunc=GL_GEQUAL); gldepthfunc=GL_LEQUAL;
} }
qglDepthFunc (gldepthfunc);
qglDepthRange (gldepthmin, gldepthmax); qglDepthRange (gldepthmin, gldepthmax);
} }
@ -1873,6 +1874,9 @@ void GLR_RenderView (void)
extern msurface_t *r_alpha_surfaces; extern msurface_t *r_alpha_surfaces;
double time1 = 0, time2; double time1 = 0, time2;
if (qglGetError())
Con_Printf("GL Error before drawing scene\n");
if (r_norefresh.value || !glwidth || !glheight) if (r_norefresh.value || !glwidth || !glheight)
{ {
GL_DoSwap(); GL_DoSwap();
@ -2004,6 +2008,9 @@ void GLR_RenderView (void)
// Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys); // Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys);
} }
if (qglGetError())
Con_Printf("GL Error drawing scene\n");
if (!scenepp_ww_program) if (!scenepp_ww_program)
return; return;
@ -2024,9 +2031,6 @@ void GLR_RenderView (void)
vheight *= 2; vheight *= 2;
} }
if (qglGetError())
Con_Printf("GL Error before drawing with shaderobjects\n");
// get the maxtexcoords while we're at it // get the maxtexcoords while we're at it
vs = glwidth / vwidth; vs = glwidth / vwidth;
vt = glheight / vheight; vt = glheight / vheight;

View file

@ -942,8 +942,10 @@ R_NewMap
*/ */
void GLR_NewMap (void) void GLR_NewMap (void)
{ {
char namebuf[MAX_QPATH];
extern cvar_t host_mapname; extern cvar_t host_mapname;
int i; int i;
/* /*
if (cl.worldmodel->fromgame == fg_quake3 && cls.netchan.remote_address.type != NA_LOOPBACK) if (cl.worldmodel->fromgame == fg_quake3 && cls.netchan.remote_address.type != NA_LOOPBACK)
{ {
@ -965,7 +967,9 @@ void GLR_NewMap (void)
VectorInverse(r_worldentity.axis[1]); VectorInverse(r_worldentity.axis[1]);
r_worldentity.model = cl.worldmodel; r_worldentity.model = cl.worldmodel;
Cvar_Set(&host_mapname, cl.worldmodel->name);
COM_StripExtension(COM_SkipPath(cl.worldmodel->name), namebuf);
Cvar_Set(&host_mapname, namebuf);
// clear out efrags in case the level hasn't been reloaded // clear out efrags in case the level hasn't been reloaded
// FIXME: is this one short? // FIXME: is this one short?

View file

@ -281,7 +281,7 @@ static void Shader_ParseSkySides ( char **ptr, int *images )
images[i] = 0; images[i] = 0;
} else { } else {
Com_sprintf ( path, sizeof(path), "%s_%s", token, suf[i] ); Com_sprintf ( path, sizeof(path), "%s_%s", token, suf[i] );
images[i] = Mod_LoadHiResTexture ( path, true, false, true);//|IT_SKY ); images[i] = Mod_LoadHiResTexture ( path, NULL, true, false, true);//|IT_SKY );
} }
} }
} }
@ -342,7 +342,7 @@ static int Shader_FindImage ( char *name, int flags )
if ( !Q_stricmp (name, "$whiteimage") ) { if ( !Q_stricmp (name, "$whiteimage") ) {
return 0; return 0;
} else { } else {
return Mod_LoadHiResTexture(name, !!(flags & IT_NOMIPMAP), true, true);//GL_FindImage ( name, flags ); return Mod_LoadHiResTexture(name, NULL, !!(flags & IT_NOMIPMAP), true, true);//GL_FindImage ( name, flags );
} }
} }
@ -896,7 +896,6 @@ static shaderkey_t shaderpasskeys[] =
int Shader_InitCallback (char *name, int size, void *param) int Shader_InitCallback (char *name, int size, void *param)
{ {
name+=8; //skip the scripts/ part
strcpy(shaderbuf+shaderbuflen, name); strcpy(shaderbuf+shaderbuflen, name);
Shader_MakeCache(shaderbuf+shaderbuflen); Shader_MakeCache(shaderbuf+shaderbuflen);
shaderbuflen += strlen(name)+1; shaderbuflen += strlen(name)+1;
@ -947,7 +946,7 @@ static void Shader_MakeCache ( char *path )
shadercache_t *cache; shadercache_t *cache;
int size; int size;
Com_sprintf( filename, sizeof(filename), "scripts/%s", path ); Com_sprintf( filename, sizeof(filename), "%s", path );
Con_DPrintf ( "...loading '%s'\n", filename ); Con_DPrintf ( "...loading '%s'\n", filename );
size = FS_LoadFile ( filename, (void **)&buf ); size = FS_LoadFile ( filename, (void **)&buf );
@ -1722,7 +1721,7 @@ void Shader_DefaultBSP(char *shortname, shader_t *s)
pass = &s->passes[1]; pass = &s->passes[1];
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY; pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_BASE; pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
pass->blendsrc = GL_ZERO; pass->blendsrc = GL_ZERO;
pass->blenddst = GL_SRC_COLOR; pass->blenddst = GL_SRC_COLOR;
pass->blendmode = GL_MODULATE; pass->blendmode = GL_MODULATE;
@ -1751,7 +1750,7 @@ void Shader_DefaultBSPVertex(char *shortname, shader_t *s)
shaderpass_t *pass; shaderpass_t *pass;
pass = &s->passes[0]; pass = &s->passes[0];
pass->tcgen = TC_GEN_BASE; pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, false, true);//GL_FindImage (shortname, 0); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
pass->depthfunc = GL_LEQUAL; pass->depthfunc = GL_LEQUAL;
pass->flags = SHADER_PASS_DEPTHWRITE; pass->flags = SHADER_PASS_DEPTHWRITE;
pass->rgbgen = RGB_GEN_VERTEX; pass->rgbgen = RGB_GEN_VERTEX;
@ -1780,7 +1779,7 @@ void Shader_DefaultBSPFlare(char *shortname, shader_t *s)
pass->blendsrc = GL_ONE; pass->blendsrc = GL_ONE;
pass->blenddst = GL_ONE; pass->blenddst = GL_ONE;
pass->blendmode = GL_MODULATE; pass->blendmode = GL_MODULATE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
pass->depthfunc = GL_LEQUAL; pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_VERTEX; pass->rgbgen = RGB_GEN_VERTEX;
pass->alphagen = ALPHA_GEN_IDENTITY; pass->alphagen = ALPHA_GEN_IDENTITY;
@ -1806,7 +1805,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
shaderpass_t *pass; shaderpass_t *pass;
pass = &s->passes[0]; pass = &s->passes[0];
pass->flags = SHADER_PASS_DEPTHWRITE; pass->flags = SHADER_PASS_DEPTHWRITE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
pass->depthfunc = GL_LEQUAL; pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE; pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE;
pass->numtcmods = 0; pass->numtcmods = 0;
@ -1832,7 +1831,7 @@ void Shader_DefaultSkinShell(char *shortname, shader_t *s)
shaderpass_t *pass; shaderpass_t *pass;
pass = &s->passes[0]; pass = &s->passes[0];
pass->flags = SHADER_PASS_DEPTHWRITE | SHADER_PASS_BLEND; pass->flags = SHADER_PASS_DEPTHWRITE | SHADER_PASS_BLEND;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, true, true, true);//GL_FindImage (shortname, 0); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
pass->depthfunc = GL_LEQUAL; pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_ENTITY; pass->rgbgen = RGB_GEN_ENTITY;
pass->alphagen = ALPHA_GEN_ENTITY; pass->alphagen = ALPHA_GEN_ENTITY;
@ -1864,7 +1863,7 @@ void Shader_Default2D(char *shortname, shader_t *s)
pass->blendsrc = GL_SRC_ALPHA; pass->blendsrc = GL_SRC_ALPHA;
pass->blenddst = GL_ONE_MINUS_SRC_ALPHA; pass->blenddst = GL_ONE_MINUS_SRC_ALPHA;
pass->blendmode = GL_MODULATE; pass->blendmode = GL_MODULATE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, false, true, true);//GL_FindImage (shortname, IT_NOPICMIP|IT_NOMIPMAP); pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, false, true, true);//GL_FindImage (shortname, IT_NOPICMIP|IT_NOMIPMAP);
pass->depthfunc = GL_LEQUAL; pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_VERTEX; pass->rgbgen = RGB_GEN_VERTEX;
pass->alphagen = ALPHA_GEN_VERTEX; pass->alphagen = ALPHA_GEN_VERTEX;
@ -1927,7 +1926,7 @@ int R_LoadShader ( char *name, void(*defaultgen)(char *name, shader_t*))
Shader_GetPathAndOffset( shortname, &ts, &offset ); Shader_GetPathAndOffset( shortname, &ts, &offset );
if ( ts ) { if ( ts ) {
Com_sprintf ( path, sizeof(path), "scripts/%s", ts ); Com_sprintf ( path, sizeof(path), "%s", ts );
length = FS_LoadFile ( path, (void **)&buf ); length = FS_LoadFile ( path, (void **)&buf );
} }

View file

@ -209,16 +209,36 @@ qboolean GLInitialise (char *renderer)
strcpy(opengldllname, renderer); strcpy(opengldllname, renderer);
Con_Printf ("Loading renderer dll %s\n", renderer); if (*renderer)
hInstGL = LoadLibrary(opengldllname); {
Con_DPrintf ("Loading renderer dll \"%s\"", renderer);
hInstGL = LoadLibrary(opengldllname);
if (hInstGL)
Con_DPrintf (" Success\n");
else
Con_DPrintf (" Failed\n");
}
else
hInstGL = NULL;
if (!hInstGL) if (!hInstGL)
{ {
hInstGL = LoadLibrary("opengl32"); strcpy(opengldllname, "opengl32");
Con_DPrintf ("Loading renderer dll \"%s\"", opengldllname);
hInstGL = LoadLibrary(opengldllname);
if (hInstGL)
Con_DPrintf (" Success\n");
else
Con_DPrintf (" Failed\n");
} }
if (!hInstGL) if (!hInstGL)
{ {
Con_Printf ("Couldn't load %s\n", opengldllname); if (*renderer)
Con_Printf ("Couldn't load %s or %s\n", renderer, opengldllname);
else
Con_Printf ("Couldn't load %s\n", opengldllname);
return false; return false;
} }

View file

@ -265,13 +265,26 @@ void R_DrawSkyChain (msurface_t *s)
R_LoadSkys R_LoadSkys
================== ==================
*/ */
static char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; static char *skyname_suffix[][6] = {
{"px", "py", "nx", "ny", "pz", "nz"},
{"posx", "posy", "negx", "negy", "posz", "negz"},
{"rt", "bk", "lf", "ft", "up", "dn"}
};
static char *skyname_pattern[] = {
"%s_%s",
"%s%s",
"env/%s%s",
"gfx/env/%s%s"
};
int skyboxtex[6]; int skyboxtex[6];
void R_LoadSkys (void) void R_LoadSkys (void)
{ {
int i; int i;
char name[MAX_QPATH]; char name[MAX_QPATH];
char *boxname; char *boxname;
int p, s;
if (*gl_skyboxname.string) if (*gl_skyboxname.string)
boxname = gl_skyboxname.string; //user forced boxname = gl_skyboxname.string; //user forced
@ -288,10 +301,15 @@ void R_LoadSkys (void)
for(;;) for(;;)
{ {
for (i=0 ; i<6 ; i++) for (i=0 ; i<6 ; i++)
{ {
_snprintf (name, sizeof(name), "env/%s%s.tga", boxname, suf[i]); for (p = 0; p < sizeof(skyname_pattern)/sizeof(skyname_pattern[0]); p++)
{
skyboxtex[i] = Mod_LoadHiResTexture(name, false, false, true); for (s = 0; s < sizeof(skyname_suffix)/sizeof(skyname_suffix[0]); s++)
{
_snprintf (name, sizeof(name), skyname_pattern[p], boxname, skyname_suffix[s][i]);
skyboxtex[i] = Mod_LoadHiResTexture(name, NULL, false, false, true);
}
}
if (!skyboxtex[i]) if (!skyboxtex[i])
break; break;
@ -876,7 +894,7 @@ void GLR_InitSky (texture_t *mt)
sprintf(name, "%s_solid", mt->name); sprintf(name, "%s_solid", mt->name);
Q_strlwr(name); Q_strlwr(name);
solidskytexture = Mod_LoadReplacementTexture(name, true, false, true); solidskytexture = Mod_LoadReplacementTexture(name, NULL, true, false, true);
if (!solidskytexture) if (!solidskytexture)
solidskytexture = GL_LoadTexture32(name, 128, 128, trans, true, false); solidskytexture = GL_LoadTexture32(name, 128, 128, trans, true, false);
/* /*
@ -901,7 +919,7 @@ void GLR_InitSky (texture_t *mt)
sprintf(name, "%s_trans", mt->name); sprintf(name, "%s_trans", mt->name);
Q_strlwr(name); Q_strlwr(name);
alphaskytexture = Mod_LoadReplacementTexture(name, true, true, true); alphaskytexture = Mod_LoadReplacementTexture(name, NULL, true, true, true);
if (!alphaskytexture) if (!alphaskytexture)
alphaskytexture = GL_LoadTexture32(name, 128, 128, trans, true, true); alphaskytexture = GL_LoadTexture32(name, 128, 128, trans, true, true);
/* /*

View file

@ -275,7 +275,7 @@ int Doom_LoadFlat(char *name)
sprintf(texname, "flat-%-.8s", name); sprintf(texname, "flat-%-.8s", name);
Q_strlwr(texname); Q_strlwr(texname);
tex = Mod_LoadReplacementTexture(texname, true, false, true); tex = Mod_LoadReplacementTexture(texname, "flats", true, false, true);
if (tex) if (tex)
return tex; return tex;
@ -1173,7 +1173,7 @@ static int Doom_LoadPatch(char *name)
return texnum; return texnum;
} }
//all else failed. //all else failed.
gldoomtextures[texnum].gltexture = Mod_LoadHiResTexture(name, true, false, true); gldoomtextures[texnum].gltexture = Mod_LoadHiResTexture(name, "patches", true, false, true);
gldoomtextures[texnum].width = image_width; gldoomtextures[texnum].width = image_width;
gldoomtextures[texnum].height = image_height; gldoomtextures[texnum].height = image_height;
return texnum; return texnum;

View file

@ -321,10 +321,10 @@ void R_DrawWorld (void);
void GL_BuildLightmaps (void); void GL_BuildLightmaps (void);
void GL_LoadShaders(void); void GL_LoadShaders(void);
int Mod_LoadReplacementTexture(char *name, qboolean mipmap, qboolean alpha, qboolean gammaadjust); int Mod_LoadReplacementTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean gammaadjust);
extern int image_width, image_height; extern int image_width, image_height;
int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean gammaadjust); int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean gammaadjust);
int Mod_LoadBumpmapTexture(char *name); int Mod_LoadBumpmapTexture(char *name, char *subpath);
#define LMBLOCK_WIDTH 128 #define LMBLOCK_WIDTH 128
#define LMBLOCK_HEIGHT 128 #define LMBLOCK_HEIGHT 128

View file

@ -1,338 +0,0 @@
libmad - MPEG audio decoder library
Copyright (C) 2000-2004 Underbit Technologies, Inc.
$Id$
===============================================================================
Version 0.15.1 (beta)
* Updated to autoconf 2.59, automake 1.8.2, libtool 1.5.2.
* Replaced Layer III IMDCT routine with one based on a faster algorithm,
improving both speed and accuracy.
* Improved portability of the Huffman table initialization.
* Fixed a problem that could result in an assertion failure in layer3.c
due to an invalid Layer III free format bitrate.
* Improved the robustness of Layer II bitrate/mode combinations, and added
a new MAD_ERROR_BADMODE error enum. The allowability of low-bitrate
stereo streams is influenced by the --enable-strict-iso option to
`configure'.
Version 0.15.0 (beta)
* Updated to autoconf 2.57, automake 1.7.5, libtool 1.4.3.
* Added new mad_f_div() API routine.
* Added a 64th entry to the Layer I/Layer II scalefactor table, for better
compatibility with existing streams. The --enable-strict-iso option to
`configure' can be used to disable use of this entry.
* Modified the header decoding routine to allow the reserved emphasis
value, for better compatibility with existing streams. The
--enable-strict-iso option to `configure' can be used to restore the
previous behavior of reporting this value as an error.
* Added new MAD_EMPHASIS_RESERVED enumeration constant.
* Fixed a bug in the ARM version of mad_f_scale64() discovered by Andre
McCurdy.
* Rewrote PowerPC assembly for minor gains.
* Modified mad_timer_fraction() to avoid the possibility of division by
zero when 0 is passed as the second argument.
* Fixed a non-fatal problem caused by attempting to designate ancillary
bits in Layer III after a decoding error.
* Changed to build a shared library by default.
* Changed to use native Cygwin build by default; give --host=mingw32 to
`configure' to use MinGW (and avoid a dependency on the Cygwin DLL).
Version 0.14.2 (beta)
* Changed Cygwin builds to use MinGW; resulting Win32 executables no
longer have a dependency on Cygwin DLLs.
* Added a new mad_stream_errorstr() API function to libmad for retrieving
a string description of the current error condition.
Version 0.14.1 (beta)
* Updated config.guess and config.sub to latest upstream versions.
* Enabled libtool versioning rather than release numbering.
* Improved the documentation in minimad.c.
* Several other small fixes.
Version 0.14.0 (beta)
* Added a 64-bit FPM negation operation to improve performance of subband
synthesis on some platforms.
* Improved MSVC++ portability and added MSVC++ project files.
* Added rounding to Layer III requantization for slightly better accuracy.
Version 0.13.0 (beta)
* Ancillary data is now properly extracted from Layer III streams.
* Rewrote the Layer III joint stereo decoding routine to correct a major
MPEG-2 problem and a minor MPEG-1 problem decoding intensity stereo.
* Eliminated the dependency on sign-extending right shifts for Layer I and
Layer II.
* Renamed `private' field to `private_bits' for better C++ compatibility.
* Gratuitously renamed `sfreq' field to `samplerate' and
MAD_ERROR_BADSAMPLEFREQ constant to MAD_ERROR_BADSAMPLERATE.
* Added `samplerate' and `channels' fields to synth.pcm struct to allow
these to be different from the decoded frame, and for simpler access.
* Added new mad_stream_options() and mad_decoder_options() API entries for
special runtime decoding options.
* Added new MAD_OPTION_IGNORECRC and MAD_OPTION_HALFSAMPLERATE options.
* Added new MAD_FLAG_FREEFORMAT indicator flag.
* Fixed some bugs in the async decoder.
* Added a new mad_timer_multiply() API routine.
* Eliminated `+' from asm constraints under Intel for better compatibility
with some compilers.
* Fixed a PIC-related problem in imdct_l_arm.S.
* Eliminated a static variable to make libmad thread-safe.
Version 0.12.5 (beta)
* Modified Layer III requantization to occur during Huffman decoding for
significant performance gains.
* Optimized short block IMDCT by eliminating redundant calculations.
* Made several other Layer III performance improvements; added
ASO_INTERLEAVE1, ASO_INTERLEAVE2, and ASO_ZEROCHECK
architecture-specific options for best performance on various
architectures.
* Optimized synthesis DCT to store result values as soon as they are
calculated.
Version 0.12.4 (beta)
* New PowerPC fixed-point assembly courtesy of David Blythe.
* Reorganized fixed-point assembly routines for easier maintenance and
better performance.
* Improved performance of subband synthesis through better indexing and
fewer local variables.
* Added alias reduction for the lower two subbands of mixed short blocks,
per a report of ambiguity with ISO/IEC 11172-3 and for uniformity with
most other implementations. Also improved alias reduction performance
using multiply/accumulate.
* Added --enable-strict-iso option to `configure' to override best
accepted practices such as the alias reduction for mixed short blocks.
* Improved performance of Layer III IMDCT by using longer
multiply/accumulate runs where possible.
Version 0.12.3 (beta)
* Added MPEG 2.5 support.
* Added preliminary support for parameterizing the binary point position
in the fixed-point representation.
* Added multiply/accumulate optimization to the Layer III IMDCT for long
blocks.
* Fixed a bug in the handling of Layer III mixed_block_flag.
* Fixed a configure problem when multiple -O CFLAGS are present.
Version 0.12.2 (beta)
* Rearranged the synthesis polyphase filterbank memory vector for better
locality of reference, and rewrote mad_synth_frame() to accommodate,
resulting in improved performance.
* Discovered a combination of compiler optimization flags that further
improve performance.
* Changed some array references in layer3.c to pointer derefs.
Version 0.12.1 (beta)
* Resolved the intensity + MS joint stereo issue (a simple bug).
OPT_ISKLUGE is no longer considered to be a kluge.
* Fixed another, hopefully last main_data memory bug.
* Split part of struct mad_frame into struct mad_header for convenience
and size.
Version 0.12.0 (alpha)
* Changed the build environment to use automake and libtool. A libmad
shared library can now be built using the --enable-shared option to
`configure'.
* Added another callback to MAD's high-level decoder API after the frame
header has been read but before the frame's audio data is decoded.
* Streamlined header processing so that mad_frame_decode() can be called
with or without having already called mad_frame_header().
* Fixed some other header reading miscellany, including CRC handling and
free bitrate detection, and frame length verification with free
bitrates.
* Fixed a problem with Layer III free bitrates > 320 kbps. The main_data
buffer size should now be large enough to handle any size frame, by
virtue of the maximum possible part2_3_length.
* Further developed the async API; arbitrary messages can now be passed to
the subsidiary decoding process.
* Streamlined timer.c and extended its interface. It now has support for
video frame/field lengths, including output support for drop-frame
encoding.
* Replaced many constant integer preprocessor defines with enums.
Version 0.11.4 (beta)
* Fixed free format bitrate discovery.
* Changed the timer implementation and extended its interface.
* Integrated Nicolas Pitre's patch for pre-shifting at compile-time and
for better multiply/accumulate code output.
* Applied Simon Burge's patch to imdct_l_arm.S for a.out compatibility.
* Added -mtune=strongarm for all ARM targets.
Version 0.11.3 (beta)
* Added new --enable-speed and --enable-accuracy options for `configure'
to automatically select appropriate SSO/ASO options, et al.
* Modified subband synthesis to use multiply/accumulate optimization (if
available) for better speed and/or accuracy.
* Incorporated Andre McCurdy's changes for further rounding optimizations
in the rest of his code.
Version 0.11.2 (beta)
* Incorporated Nicolas Pitre's ARM assembly and parameterized scaling
changes.
* Incorporated Andre McCurdy's ARM assembly optimization (used only if
--enable-aso is given to `configure' to enable architecture-specific
optimizations.)
* Reduced FPM_INTEL assembly to two instructions.
* Fixed accuracy problems with certain FPM modes in synth.c.
* Improved the accuracy of FPM_APPROX.
* Improved the accuracy of SSO.
* Improved sync discovery by checking for a sync word in the following
frame.
* Minor code clean-up.
* Added experimental rules for generating a libmad.so shared library.
Version 0.11.1 (beta)
* Moved libmad code into a separate directory.
* Changed SSO to be disabled by default, as output accuracy is deemed to
be more important than speed in the general case.
* Fixed a bug in Layer III sanity checking that could cause a crash on
certain random data input.
* Extended the Layer III requantization table from 8191 to 8206 as some
encoders are known to use these values, even though ISO/IEC 11172-3
suggests the maximum should be 8191.
Version 0.11.0 (beta)
* Implemented MPEG-2 extension to Lower Sampling Frequencies.
* Improved Layer III performance by avoiding IMDCT calculation when all
input samples are zero.
* Significantly reduced size of Layer II tables.
Version 0.10.3 (beta)
* Improved SSO output quality.
* Made portable to cygwin.
* Localized memory references in III_huffdecode() for better performance.
Version 0.10.2 (beta)
* Rewrote Layer III long block 36-point IMDCT routine for better
performance.
* Improved subband synthesis fixed-point games somewhat.
Version 0.10.1 (beta)
* Added a subband synthesis optimization (SSO) which involves modifying
the fixed-point multiplication method during windowing. This produces
subtle differences in the output but improves performance greatly.
* Added I_STEREO and MS_STEREO flags to frame struct.
* Eliminated privately-used CRCFAILED flag.
* Fixed a bug where Layer III decoding could crash on some badly-formatted
(e.g. non-MPEG) bitstreams.
* Miscellaneous code clean-up.
Version 0.10.0 (beta)
* Added SPARC fixed-point math support.
* Revamped libmad API for better high- and low-level support.
* Documented more of the code.
* Changed sync semantics such that new stream buffers are assumed to be
sync-aligned.
* Changed Layer III to dynamically allocate static memory so as not to
waste it (about 6.4K) when only decoding Layer I or Layer II.
===============================================================================

View file

@ -1503,7 +1503,7 @@ static LONG CALLBACK MainWndProc(HWND hWnd,UINT message,
if (projecttree) if (projecttree)
{ {
gotodefbox = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", (LPCTSTR) NULL, gotodefbox = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", (LPCTSTR) NULL,
WS_CHILD | WS_CLIPCHILDREN | ES_WANTRETURN, WS_CHILD | WS_CLIPCHILDREN,
0, 0, 320, 200, hWnd, (HMENU) 0xCAC, ghInstance, (LPSTR) NULL); 0, 0, 320, 200, hWnd, (HMENU) 0xCAC, ghInstance, (LPSTR) NULL);
ShowWindow(gotodefbox, SW_SHOW); ShowWindow(gotodefbox, SW_SHOW);

View file

@ -1783,10 +1783,13 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (m[0] == '*' || (*m&&progstype == PROG_H2)) if (m[0] == '*' || (*m&&progstype == PROG_H2))
{ {
mod = Mod_ForName (m, true); mod = Mod_ForName (m, true);
VectorCopy (mod->mins, e->v->mins); if (mod)
VectorCopy (mod->maxs, e->v->maxs); {
VectorSubtract (mod->maxs, mod->mins, e->v->size); VectorCopy (mod->mins, e->v->mins);
SV_LinkEdict (e, false); VectorCopy (mod->maxs, e->v->maxs);
VectorSubtract (mod->maxs, mod->mins, e->v->size);
SV_LinkEdict (e, false);
}
return; return;
} }
@ -1815,10 +1818,13 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (mod) if (mod)
{ {
mod = Mod_ForName (m, false); mod = Mod_ForName (m, false);
VectorCopy (mod->mins, e->v->mins); if (mod)
VectorCopy (mod->maxs, e->v->maxs); {
VectorSubtract (mod->maxs, mod->mins, e->v->size); VectorCopy (mod->mins, e->v->mins);
SV_LinkEdict (e, false); VectorCopy (mod->maxs, e->v->maxs);
VectorSubtract (mod->maxs, mod->mins, e->v->size);
SV_LinkEdict (e, false);
}
} }
else else
{ {
@ -1841,10 +1847,13 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (sv.models[i]) if (sv.models[i])
{ {
mod = Mod_ForName (m, false); mod = Mod_ForName (m, false);
VectorCopy (mod->mins, e->v->mins); if (mod)
VectorCopy (mod->maxs, e->v->maxs); {
VectorSubtract (mod->maxs, mod->mins, e->v->size); VectorCopy (mod->mins, e->v->mins);
SV_LinkEdict (e, false); VectorCopy (mod->maxs, e->v->maxs);
VectorSubtract (mod->maxs, mod->mins, e->v->size);
SV_LinkEdict (e, false);
}
} }
//qw was fixed - it never sets the size of an alias model. //qw was fixed - it never sets the size of an alias model.
} }
@ -3002,9 +3011,9 @@ void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
str = PR_GetStringOfs(prinst, OFS_PARM0); str = PR_GetStringOfs(prinst, OFS_PARM0);
if (!strcmp(str, "host_framerate 0\n")) if (!strcmp(str, "host_framerate 0\n"))
Cbuf_AddText ("sv_mintic 0\n", RESTRICT_SERVER); //hmm... do this better... Cbuf_AddText ("sv_mintic 0\n", RESTRICT_INSECURE); //hmm... do this better...
else else
Cbuf_AddText (str, RESTRICT_SERVER); Cbuf_AddText (str, RESTRICT_INSECURE);
} }
/* /*

View file

@ -111,8 +111,8 @@ int numlight;
extern int sv_lightningmodel; extern int sv_lightningmodel;
#endif #endif
edict_t *csqcent[MAX_EDICTS]; static edict_t *csqcent[MAX_EDICTS];
int csqcnuments; static int csqcnuments;
qboolean SV_AddNailUpdate (edict_t *ent) qboolean SV_AddNailUpdate (edict_t *ent)
{ {

View file

@ -47,9 +47,14 @@ netadr_t master_adr[MAX_MASTERS]; // address of group servers
client_t *host_client; // current client client_t *host_client; // current client
cvar_t sv_mintic = {"sv_mintic","0.03"}; // bound the size of the // bound the size of the physics time tic
cvar_t sv_maxtic = {"sv_maxtic","0.1"}; // physics time tic #ifdef SERVERONLY
cvar_t sv_nailhack = {"sv_nailhack","0"}; // physics time tic cvar_t sv_mintic = {"sv_mintic","0.03"};
#else
cvar_t sv_mintic = {"sv_mintic","0"}; //client builds can think as often as they want.
#endif
cvar_t sv_maxtic = {"sv_maxtic","0.1"};
cvar_t sv_nailhack = {"sv_nailhack","0"};
cvar_t timeout = {"timeout","65"}; // seconds without any message cvar_t timeout = {"timeout","65"}; // seconds without any message

View file

@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef CLIENTONLY #ifndef CLIENTONLY
#include "winquake.h" #include "winquake.h"
#define Q_strncatz strncat
void SV_MVDStop_f (void); void SV_MVDStop_f (void);
#define demo_size_padding 0x1000 #define demo_size_padding 0x1000
@ -1931,9 +1929,7 @@ void SV_MVDEasyRecord_f (void)
int MVD_StreamStartListening(int port) int MVD_StreamStartListening(int port)
{ {
char name[256];
int sock; int sock;
struct hostent *hent;
struct sockaddr_in address; struct sockaddr_in address;
// int fromlen; // int fromlen;

View file

@ -637,7 +637,7 @@ void StartQuakeServer(void)
parms.argc = com_argc; parms.argc = com_argc;
parms.argv = com_argv; parms.argv = com_argv;
parms.memsize = 12*1024*1024; parms.memsize = 32*1024*1024;
if ((t = COM_CheckParm ("-heapsize")) != 0 && if ((t = COM_CheckParm ("-heapsize")) != 0 &&
t + 1 < com_argc) t + 1 < com_argc)

View file

@ -3826,6 +3826,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
if (progstype == PROG_H2) if (progstype == PROG_H2)
sv_player->v->light_level = 128; //hmm... HACK!!! sv_player->v->light_level = 128; //hmm... HACK!!!
sv_player->v->Version++;
sv_player->v->button0 = ucmd->buttons & 1; sv_player->v->button0 = ucmd->buttons & 1;
sv_player->v->button2 = (ucmd->buttons >> 1) & 1; sv_player->v->button2 = (ucmd->buttons >> 1) & 1;
if (pr_allowbutton1.value) //many mods use button1 - it's just a wasted field to many mods. So only work it if the cvar allows. if (pr_allowbutton1.value) //many mods use button1 - it's just a wasted field to many mods. So only work it if the cvar allows.