1
0
Fork 0
forked from fte/fteqw

Meh, I'm just going to commit everything.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1778 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-01-02 23:01:54 +00:00
parent df331445ad
commit 19ab4fd050
19 changed files with 173 additions and 91 deletions

View file

@ -447,7 +447,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
Con_Printf("%s", VM_POINTER(arg[0])); Con_Printf("%s", VM_POINTER(arg[0]));
break; break;
case CG_ERROR: case CG_ERROR:
Host_EndGame("%s", VM_POINTER(arg[0])); Host_EndGame("%s", VM_POINTER(arg[0]));
break; break;
case CG_ARGC: case CG_ARGC:

View file

@ -1451,7 +1451,7 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp)
{ //force our emulated time to as late as we can. { //force our emulated time to as late as we can.
//this will disable all position interpolation //this will disable all position interpolation
*servertime = cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities.servertime; *servertime = cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities.servertime;
Con_DPrintf("No lerp\n"); // Con_DPrintf("No lerp\n");
} }
packnew = NULL; packnew = NULL;
@ -1496,7 +1496,7 @@ packet_entities_t *CL_ProcessPacketEntities(float *servertime, qboolean nolerp)
CL_TransitionPacketEntities(packnew, packold, *servertime); CL_TransitionPacketEntities(packnew, packold, *servertime);
Con_DPrintf("%f %f %f %f %f %f\n", packnew->servertime, *servertime, packold->servertime, cl.gametime, cl.oldgametime, cl.servertime); // Con_DPrintf("%f %f %f %f %f %f\n", packnew->servertime, *servertime, packold->servertime, cl.gametime, cl.oldgametime, cl.servertime);
// if (packold->servertime < oldoldtime) // if (packold->servertime < oldoldtime)
// Con_Printf("Spike screwed up\n"); // Con_Printf("Spike screwed up\n");

View file

@ -829,7 +829,7 @@ void CL_Rcon_f (void)
int i; int i;
netadr_t to; netadr_t to;
if (!rcon_password.string) //FIXME: this is strange... if (!*rcon_password.string) //FIXME: this is strange...
{ {
Con_TPrintf (TLC_NORCONPASSWORD); Con_TPrintf (TLC_NORCONPASSWORD);
return; return;
@ -1038,7 +1038,8 @@ void CL_Disconnect (void)
#ifndef CLIENTONLY #ifndef CLIENTONLY
//running a server, and it's our own //running a server, and it's our own
if (serverrunning && !tolocalserver)SV_UnspawnServer(); if (serverrunning && !tolocalserver)
SV_UnspawnServer();
#endif #endif
} }
Cam_Reset(); Cam_Reset();
@ -1058,7 +1059,7 @@ void CL_Disconnect (void)
cls.downloadmethod = DL_NONE; cls.downloadmethod = DL_NONE;
if (cls.downloadqw) if (cls.downloadqw)
{ {
fclose(cls.downloadqw); VFS_CLOSE(cls.downloadqw);
cls.downloadqw = NULL; cls.downloadqw = NULL;
} }
if (!cls.downloadmethod) if (!cls.downloadmethod)
@ -2733,6 +2734,8 @@ void VARGS Host_EndGame (char *message, ...)
CL_Disconnect (); CL_Disconnect ();
SV_UnspawnServer();
Cvar_Set(&cl_shownet, "0"); Cvar_Set(&cl_shownet, "0");
longjmp (host_abort, 1); longjmp (host_abort, 1);
@ -2789,7 +2792,7 @@ void Host_WriteConfiguration (void)
return; return;
} }
f = FS_OpenVFS(va("%s.cfg",cfg_save_name.string), "w", FS_GAMEONLY); f = FS_OpenVFS(va("%s.cfg",cfg_save_name.string), "wb", FS_GAMEONLY);
if (!f) if (!f)
{ {
Con_TPrintf (TLC_CONFIGCFG_WRITEFAILED); Con_TPrintf (TLC_CONFIGCFG_WRITEFAILED);

View file

@ -13,6 +13,9 @@ static plugin_t *protocolclientplugin;
int VARGS Plug_Menu_Control(void *offset, unsigned int mask, const long *arg) int VARGS Plug_Menu_Control(void *offset, unsigned int mask, const long *arg)
{ {
if (qrenderer <= 0)
return 0;
switch(VM_LONG(arg[0])) switch(VM_LONG(arg[0]))
{ {
case 0: //take away all menus case 0: //take away all menus
@ -53,6 +56,9 @@ int VARGS Plug_Key_GetKeyCode(void *offset, unsigned int mask, const long *arg)
int VARGS Plug_SCR_CenterPrint(void *offset, unsigned int mask, const long *arg) int VARGS Plug_SCR_CenterPrint(void *offset, unsigned int mask, const long *arg)
{ {
if (qrenderer <= 0)
return 0;
SCR_CenterPrint(0, VM_POINTER(arg[0])); SCR_CenterPrint(0, VM_POINTER(arg[0]));
return 0; return 0;
} }
@ -66,6 +72,9 @@ int VARGS Plug_Media_ShowFrameRGBA_32(void *offset, unsigned int mask, const lon
int width = VM_LONG(arg[5]); int width = VM_LONG(arg[5]);
int height = VM_LONG(arg[6]); int height = VM_LONG(arg[6]);
if (qrenderer <= 0)
return 0;
Media_ShowFrameRGBA_32(src, srcwidth, srcheight); Media_ShowFrameRGBA_32(src, srcwidth, srcheight);
return 0; return 0;
} }
@ -110,7 +119,7 @@ int VARGS Plug_Draw_LoadImage(void *offset, unsigned int mask, const long *arg)
if (pluginimagearray[i].pic) if (pluginimagearray[i].pic)
return i; //already loaded. return i; //already loaded.
if (qrenderer) if (qrenderer > 0)
{ {
if (fromwad && Draw_SafePicFromWad) if (fromwad && Draw_SafePicFromWad)
pic = Draw_SafePicFromWad(name); pic = Draw_SafePicFromWad(name);
@ -175,7 +184,7 @@ int VARGS Plug_Draw_Image(void *offset, unsigned int mask, const long *arg)
{ {
mpic_t *pic; mpic_t *pic;
int i; int i;
if (!qrenderer) if (qrenderer <= 0)
return 0; return 0;
if (!Draw_Image) if (!Draw_Image)
return 0; return 0;
@ -211,11 +220,15 @@ int VARGS Plug_Draw_Line(void *offset, unsigned int mask, const long *arg)
qglEnable(GL_TEXTURE_2D); qglEnable(GL_TEXTURE_2D);
break; break;
#endif #endif
default:
return 0;
} }
return 1; return 1;
} }
int VARGS Plug_Draw_Character(void *offset, unsigned int mask, const long *arg) int VARGS Plug_Draw_Character(void *offset, unsigned int mask, const long *arg)
{ {
if (qrenderer <= 0)
return 0;
Draw_Character(arg[0], arg[1], (unsigned int)arg[2]); Draw_Character(arg[0], arg[1], (unsigned int)arg[2]);
return 0; return 0;
} }
@ -223,6 +236,8 @@ int VARGS Plug_Draw_Character(void *offset, unsigned int mask, const long *arg)
int VARGS Plug_Draw_Fill(void *offset, unsigned int mask, const long *arg) int VARGS Plug_Draw_Fill(void *offset, unsigned int mask, const long *arg)
{ {
float x, y, width, height; float x, y, width, height;
if (qrenderer <= 0)
return 0;
x = VM_FLOAT(arg[0]); x = VM_FLOAT(arg[0]);
y = VM_FLOAT(arg[1]); y = VM_FLOAT(arg[1]);
width = VM_FLOAT(arg[2]); width = VM_FLOAT(arg[2]);
@ -289,6 +304,9 @@ int VARGS Plug_Draw_Colour4f(void *offset, unsigned int mask, const long *arg)
int VARGS Plug_LocalSound(void *offset, unsigned int mask, const long *arg) int VARGS Plug_LocalSound(void *offset, unsigned int mask, const long *arg)
{ {
if (qrenderer <= 0)
return false;
S_LocalSound(VM_POINTER(arg[0])); S_LocalSound(VM_POINTER(arg[0]));
return 0; return 0;
} }
@ -306,6 +324,9 @@ int VARGS Plug_CL_GetStats(void *offset, unsigned int mask, const long *arg)
if (VM_OOB(arg[1], arg[2]*4)) if (VM_OOB(arg[1], arg[2]*4))
return 0; return 0;
if (qrenderer <= 0)
return false;
max = pluginstats; max = pluginstats;
if (max > MAX_CL_STATS) if (max > MAX_CL_STATS)
max = MAX_CL_STATS; max = MAX_CL_STATS;
@ -324,6 +345,10 @@ int VARGS Plug_Con_SubPrint(void *offset, unsigned int mask, const long *arg)
char *name = VM_POINTER(arg[0]); char *name = VM_POINTER(arg[0]);
char *text = VM_POINTER(arg[1]); char *text = VM_POINTER(arg[1]);
console_t *con; console_t *con;
if (qrenderer <= 0)
return false;
con = Con_FindConsole(name); con = Con_FindConsole(name);
if (!con) if (!con)
{ {
@ -345,6 +370,8 @@ int VARGS Plug_Con_RenameSub(void *offset, unsigned int mask, const long *arg)
{ {
char *name = VM_POINTER(arg[0]); char *name = VM_POINTER(arg[0]);
console_t *con; console_t *con;
if (qrenderer <= 0)
return false;
con = Con_FindConsole(name); con = Con_FindConsole(name);
if (!con) if (!con)
return 0; return 0;
@ -357,6 +384,8 @@ int VARGS Plug_Con_IsActive(void *offset, unsigned int mask, const long *arg)
{ {
char *name = VM_POINTER(arg[0]); char *name = VM_POINTER(arg[0]);
console_t *con; console_t *con;
if (qrenderer <= 0)
return false;
con = Con_FindConsole(name); con = Con_FindConsole(name);
if (!con) if (!con)
return false; return false;
@ -367,6 +396,8 @@ int VARGS Plug_Con_SetActive(void *offset, unsigned int mask, const long *arg)
{ {
char *name = VM_POINTER(arg[0]); char *name = VM_POINTER(arg[0]);
console_t *con; console_t *con;
if (qrenderer <= 0)
return false;
con = Con_FindConsole(name); con = Con_FindConsole(name);
if (!con) if (!con)
con = Con_Create(name); con = Con_Create(name);
@ -378,6 +409,8 @@ int VARGS Plug_Con_Destroy(void *offset, unsigned int mask, const long *arg)
{ {
char *name = VM_POINTER(arg[0]); char *name = VM_POINTER(arg[0]);
console_t *con; console_t *con;
if (qrenderer <= 0)
return false;
con = Con_FindConsole(name); con = Con_FindConsole(name);
if (!con) if (!con)
return false; return false;
@ -392,6 +425,8 @@ int VARGS Plug_Con_NameForNum(void *offset, unsigned int mask, const long *arg)
int buffersize = VM_LONG(arg[2]); int buffersize = VM_LONG(arg[2]);
if (VM_OOB(arg[1], arg[2]) || buffersize < 1) if (VM_OOB(arg[1], arg[2]) || buffersize < 1)
return false; return false;
if (qrenderer <= 0)
return false;
return Con_NameForNum(num, buffer, buffersize); return Con_NameForNum(num, buffer, buffersize);
} }
@ -400,29 +435,29 @@ int VARGS Plug_Con_NameForNum(void *offset, unsigned int mask, const long *arg)
void Plug_Client_Init(void) void Plug_Client_Init(void)
{ {
Plug_RegisterBuiltin("CL_GetStats", Plug_CL_GetStats, 0); Plug_RegisterBuiltin("CL_GetStats", Plug_CL_GetStats, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Menu_Control", Plug_Menu_Control, 0); Plug_RegisterBuiltin("Menu_Control", Plug_Menu_Control, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Key_GetKeyCode", Plug_Key_GetKeyCode, 0); Plug_RegisterBuiltin("Key_GetKeyCode", Plug_Key_GetKeyCode, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_LoadImage", Plug_Draw_LoadImage, 0); Plug_RegisterBuiltin("Draw_LoadImage", Plug_Draw_LoadImage, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, 0); Plug_RegisterBuiltin("Draw_Image", Plug_Draw_Image, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, 0); Plug_RegisterBuiltin("Draw_Character", Plug_Draw_Character, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, 0); Plug_RegisterBuiltin("Draw_Fill", Plug_Draw_Fill, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Line", Plug_Draw_Line, 0); Plug_RegisterBuiltin("Draw_Line", Plug_Draw_Line, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Colourp", Plug_Draw_ColourP, 0); Plug_RegisterBuiltin("Draw_Colourp", Plug_Draw_ColourP, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Colour3f", Plug_Draw_Colour3f, 0); Plug_RegisterBuiltin("Draw_Colour3f", Plug_Draw_Colour3f, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Draw_Colour4f", Plug_Draw_Colour4f, 0); Plug_RegisterBuiltin("Draw_Colour4f", Plug_Draw_Colour4f, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_SubPrint", Plug_Con_SubPrint, 0); Plug_RegisterBuiltin("Con_SubPrint", Plug_Con_SubPrint, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_RenameSub", Plug_Con_RenameSub, 0); Plug_RegisterBuiltin("Con_RenameSub", Plug_Con_RenameSub, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_IsActive", Plug_Con_IsActive, 0); Plug_RegisterBuiltin("Con_IsActive", Plug_Con_IsActive, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_SetActive", Plug_Con_SetActive, 0); Plug_RegisterBuiltin("Con_SetActive", Plug_Con_SetActive, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_Destroy", Plug_Con_Destroy, 0); Plug_RegisterBuiltin("Con_Destroy", Plug_Con_Destroy, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Con_NameForNum", Plug_Con_NameForNum, 0); Plug_RegisterBuiltin("Con_NameForNum", Plug_Con_NameForNum, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, 0); Plug_RegisterBuiltin("LocalSound", Plug_LocalSound, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("SCR_CenterPrint", Plug_SCR_CenterPrint, 0); Plug_RegisterBuiltin("SCR_CenterPrint", Plug_SCR_CenterPrint, PLUG_BIF_NEEDSRENDERER);
Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, 0); Plug_RegisterBuiltin("Media_ShowFrameRGBA_32", Plug_Media_ShowFrameRGBA_32, PLUG_BIF_NEEDSRENDERER);
} }
void Plug_Client_Close(plugin_t *plug) void Plug_Client_Close(plugin_t *plug)

View file

@ -1576,7 +1576,7 @@ void SCR_ScreenShot_f (void)
pcxname[18] = (i%100)/10 + '0'; pcxname[18] = (i%100)/10 + '0';
pcxname[19] = (i%10) + '0'; pcxname[19] = (i%10) + '0';
sprintf (checkname, "%s/%s", com_gamedir, pcxname); sprintf (checkname, "%s/%s", com_gamedir, pcxname);
if (!(vfs = FS_OpenVFS(pcxname, "r", FS_GAMEONLY))) if (!(vfs = FS_OpenVFS(pcxname, "rb", FS_GAMEONLY)))
break; // file doesn't exist break; // file doesn't exist
VFS_CLOSE(vfs); VFS_CLOSE(vfs);
} }

View file

@ -329,7 +329,7 @@ typedef struct
#endif #endif
enum {DL_NONE, DL_QW, DL_QWCHUNKS, DL_Q3, DL_QWPENDING, DL_HTTP, DL_FTP} downloadmethod; enum {DL_NONE, DL_QW, DL_QWCHUNKS, DL_Q3, DL_QWPENDING, DL_HTTP, DL_FTP} downloadmethod;
FILE *downloadqw; // file transfer from server vfsfile_t *downloadqw; // file transfer from server
char downloadtempname[MAX_OSPATH]; char downloadtempname[MAX_OSPATH];
char downloadname[MAX_OSPATH]; char downloadname[MAX_OSPATH];
int downloadpercent; int downloadpercent;

View file

@ -396,7 +396,7 @@ void CLQ3_ParseDownload(void)
} }
COM_CreatePath(cls.downloadtempname); COM_CreatePath(cls.downloadtempname);
cls.downloadqw = fopen(cls.downloadtempname, "wb"); cls.downloadqw = FS_OpenVFS(cls.downloadtempname, "wb", FS_BASE);
if (!cls.downloadqw) if (!cls.downloadqw)
{ {
Con_Printf("Couldn't write to temporary file %s - stopping download\n", cls.downloadtempname); Con_Printf("Couldn't write to temporary file %s - stopping download\n", cls.downloadtempname);
@ -410,9 +410,9 @@ void CLQ3_ParseDownload(void)
if (!chunksize) if (!chunksize)
{ {
fclose(cls.downloadqw); VFS_CLOSE(cls.downloadqw);
cls.downloadqw = NULL; cls.downloadqw = NULL;
rename(cls.downloadtempname, cls.downloadname); // -> FS_Rename(cls.downloadtempname, cls.downloadname, FS_BASE); // ->
*cls.downloadtempname = *cls.downloadname = 0; *cls.downloadtempname = *cls.downloadname = 0;
cls.downloadmethod = DL_NONE; cls.downloadmethod = DL_NONE;
@ -423,9 +423,9 @@ void CLQ3_ParseDownload(void)
} }
else else
{ {
fwrite(chunkdata, chunksize, 1, cls.downloadqw); VFS_WRITE(cls.downloadqw, chunkdata, chunksize);
chunksize=ftell(cls.downloadqw); chunksize=VFS_TELL(cls.downloadqw);
Con_Printf("Recieved %i\n", chunksize); // Con_Printf("Recieved %i\n", chunksize);
cls.downloadpercent = (100.0 * chunksize) / downloadsize; cls.downloadpercent = (100.0 * chunksize) / downloadsize;
} }
@ -474,14 +474,17 @@ qboolean CLQ3_SystemInfoChanged(char *str)
while(rn) while(rn)
{ {
FILE *f; vfsfile_t *f;
rn = COM_Parse(rn); rn = COM_Parse(rn);
if (!*com_token) if (!*com_token)
break; break;
f = fopen(va("%s.pk3", com_token), "rb"); if (!strchr(com_token, '/')) //don't let some muppet tell us to download quake3.exe
break;
f = FS_OpenVFS(va("%s.pk3", com_token), "rb", FS_BASE);
if (f) if (f)
fclose(f); VFS_CLOSE(f);
else else
{ {
//fixme: request to download it //fixme: request to download it

View file

@ -63,6 +63,8 @@ cvar_t m_threshold_noforce = {"m_threshold_noforce", "0"};
cvar_t cl_keypad = {"cl_keypad", "0"}; cvar_t cl_keypad = {"cl_keypad", "0"};
qboolean CSQC_MouseMove(float xdelta, float ydelta);
typedef struct { typedef struct {
union { union {
struct { // serial mouse struct { // serial mouse
@ -1409,6 +1411,12 @@ static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum)
#endif #endif
} }
if (CSQC_MouseMove(mx, my))
{
mx = 0;
my = 0;
}
if (m_filter.value) if (m_filter.value)
{ {
double fraction = bound(0, m_filter.value, 2) * 0.5; double fraction = bound(0, m_filter.value, 2) * 0.5;

View file

@ -957,7 +957,7 @@ void PF_cl_stringtokeynum(progfuncs_t *prinst, struct globalvars_s *pr_globals)
int modifier; int modifier;
char *s; char *s;
s = PR_GetStringOfs(prinst, OFS_PARM1); s = PR_GetStringOfs(prinst, OFS_PARM0);
i = Key_StringToKeynum(s, &modifier); i = Key_StringToKeynum(s, &modifier);
if (i < 0 || modifier != ~0) if (i < 0 || modifier != ~0)
{ {

View file

@ -184,7 +184,6 @@ extern cvar_t r_drawviewmodel;
extern cvar_t r_speeds; extern cvar_t r_speeds;
extern cvar_t r_waterwarp; extern cvar_t r_waterwarp;
extern cvar_t r_fullbright; extern cvar_t r_fullbright;
extern cvar_t r_lightmap;
extern cvar_t r_shadows; extern cvar_t r_shadows;
extern cvar_t r_mirroralpha; extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha; extern cvar_t r_wateralpha;
@ -253,7 +252,6 @@ void GLRenderer_Init(void)
Cvar_Register (&r_novis, GLRENDEREROPTIONS); Cvar_Register (&r_novis, GLRENDEREROPTIONS);
Cvar_Register (&r_wateralpha, GLRENDEREROPTIONS); Cvar_Register (&r_wateralpha, GLRENDEREROPTIONS);
Cvar_Register (&r_mirroralpha, GLRENDEREROPTIONS); Cvar_Register (&r_mirroralpha, GLRENDEREROPTIONS);
Cvar_Register (&r_lightmap, GLRENDEREROPTIONS);
Cvar_Register (&r_norefresh, GLRENDEREROPTIONS); Cvar_Register (&r_norefresh, GLRENDEREROPTIONS);

View file

@ -1228,7 +1228,10 @@ qboolean Cmd_AddCommand (char *cmd_name, xcommand_t function)
{ {
if (!Q_strcmp (cmd_name, cmd->name)) if (!Q_strcmp (cmd_name, cmd->name))
{ {
Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name); if (cmd->function == function) //happens a lot with q3
Con_DPrintf ("Cmd_AddCommand: %s already defined\n", cmd_name);
else
Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name);
return false; return false;
} }
} }
@ -2740,12 +2743,17 @@ void Cmd_WriteConfig_f(void)
FS_FlushFSHash(); FS_FlushFSHash();
} }
void Cmd_Reset_f(void)
{
}
#ifndef SERVERONLY #ifndef SERVERONLY
// dumps current console contents to a text file // dumps current console contents to a text file
void Cmd_Condump_f(void) void Cmd_Condump_f(void)
{ {
FILE *f; vfsfile_t *f;
char *filename; char *filename;
unsigned char c;
if (!con_current) if (!con_current)
{ {
@ -2760,10 +2768,10 @@ void Cmd_Condump_f(void)
if (!*filename) if (!*filename)
filename = "condump"; filename = "condump";
filename = va("%s/%s", com_gamedir, filename); filename = va("%s", filename);
COM_DefaultExtension(filename, ".txt"); COM_DefaultExtension(filename, ".txt");
f = fopen (filename, "wb"); f = FS_OpenVFS (filename, "wb", FS_GAME);
if (!f) if (!f)
{ {
Con_Printf ("Couldn't write console dump %s\n",filename); Con_Printf ("Couldn't write console dump %s\n",filename);
@ -2791,16 +2799,17 @@ void Cmd_Condump_f(void)
{ {
content = 1; content = 1;
for (; spc > 0; spc--) for (; spc > 0; spc--)
fprintf(f, " "); VFS_WRITE(f, " ", 1);
fprintf(f, "%c", (qbyte)text[x]&255); c = (qbyte)text[x]&255;
VFS_WRITE(f, &c, 1);
} }
} }
if (content) if (content)
fprintf(f, "\n"); VFS_WRITE(f, "\n", 1);
} }
} }
fclose(f); VFS_CLOSE(f);
Con_Printf ("Dumped console to %s\n",filename); Con_Printf ("Dumped console to %s\n",filename);
} }
@ -2819,7 +2828,7 @@ void Cmd_Init (void)
Cmd_AddCommand ("cfg_save",Cmd_WriteConfig_f); Cmd_AddCommand ("cfg_save",Cmd_WriteConfig_f);
Cmd_AddCommand ("cfg_load",Cmd_Exec_f); Cmd_AddCommand ("cfg_load",Cmd_Exec_f);
//Cmd_AddCommand ("cfg_reset",Cmd_Reset_f); Cmd_AddCommand ("cfg_reset",Cmd_Reset_f);
Cmd_AddCommand ("exec",Cmd_Exec_f); Cmd_AddCommand ("exec",Cmd_Exec_f);
Cmd_AddCommand ("echo",Cmd_Echo_f); Cmd_AddCommand ("echo",Cmd_Echo_f);

View file

@ -1942,6 +1942,28 @@ void R_DrawGAliasModel (entity_t *e)
GL_DrawAliasMesh(&mesh, skin->fullbright); GL_DrawAliasMesh(&mesh, skin->fullbright);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
if (fog)
{
meshbuffer_t mb;
shader_t dummyshader = {0};
R_IBrokeTheArrays();
mb.entity = currententity;
mb.shader = &dummyshader;
mb.fog = fog;
mb.mesh = &mesh;
mb.infokey = -1;//currententity->keynum;
mb.dlightbits = 0;
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED | MF_COLORS);
R_RenderMeshBuffer ( &mb, false );
R_ClearArrays();
}
} }
} }

View file

@ -2137,7 +2137,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog )
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
GL_TexEnv(GL_MODULATE); GL_TexEnv(GL_MODULATE);
if ( !shader->numpasses || shader->fog_dist || (shader->flags & SHADER_SKY) ) if ( !shader || !shader->numpasses || shader->fog_dist || (shader->flags & SHADER_SKY) )
{ {
extern int gldepthfunc; extern int gldepthfunc;
qglDepthFunc ( gldepthfunc ); qglDepthFunc ( gldepthfunc );
@ -2152,7 +2152,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog )
// distance to fog // distance to fog
dist = PlaneDiff ( r_origin, fogplane ); dist = PlaneDiff ( r_origin, fogplane );
if ( shader->flags & SHADER_SKY ) if ( shader && shader->flags & SHADER_SKY )
{ {
if ( dist > 0 ) if ( dist > 0 )
VectorMA( r_origin, -dist, fogplane->normal, viewtofog ); VectorMA( r_origin, -dist, fogplane->normal, viewtofog );
@ -2192,7 +2192,7 @@ void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog )
currentCoords[1] = -vdist * fogshader->fog_dist + 1.5f/(float)FOG_TEXTURE_HEIGHT; currentCoords[1] = -vdist * fogshader->fog_dist + 1.5f/(float)FOG_TEXTURE_HEIGHT;
} }
if ( !shader->numpasses ) if ( shader && !shader->numpasses )
{ {
R_LockArrays ( numVerts ); R_LockArrays ( numVerts );
} }

View file

@ -2779,7 +2779,7 @@ void GLDraw_Init15to8(void)
int r1, g1, b1; int r1, g1, b1;
qbyte *pal; qbyte *pal;
float dist, bestdist; float dist, bestdist;
FILE *f; vfsfile_t *f;
qboolean savetable; qboolean savetable;
@ -2793,13 +2793,13 @@ void GLDraw_Init15to8(void)
savetable = COM_CheckParm("-save15to8"); savetable = COM_CheckParm("-save15to8");
if (savetable) if (savetable)
COM_FOpenFile("glquake/15to8.pal", &f); f = FS_OpenVFS("glquake/15to8.pal");
else else
f = NULL; f = NULL;
if (f) if (f)
{ {
fread(d_15to8table, 1<<15, 1, f); VFS_READ(f, d_15to8table, 1<<15);
fclose(f); VFS_CLOSE(f);
} }
else else
{ {
@ -2829,14 +2829,7 @@ void GLDraw_Init15to8(void)
} }
if (savetable) if (savetable)
{ {
char s[256]; FS_WriteFile("glquake/15to8.pal", d_15to8table, 1<<15, FS_GAME);
sprintf(s, "%s/glquake", com_gamedir);
Sys_mkdir (s);
sprintf(s, "%s/glquake/15to8.pal", com_gamedir);
if ((f = fopen(s, "wb")) != NULL) {
fwrite(d_15to8table, 1<<15, 1, f);
fclose(f);
}
} }
} }
} }
@ -3032,7 +3025,7 @@ texels += scaled_width * scaled_height;
} }
if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name&&mipmap) if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name&&mipmap)
{ {
FILE *out; vfsfile_t *out;
int miplevels; int miplevels;
GLint compressed; GLint compressed;
GLint compressed_size; GLint compressed_size;
@ -3044,19 +3037,19 @@ texels += scaled_width * scaled_height;
qglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed); qglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &compressed);
if (compressed == GL_TRUE && !strstr(name, "..")) //is there any point in bothering with the whole endian thing? if (compressed == GL_TRUE && !strstr(name, "..")) //is there any point in bothering with the whole endian thing?
{ {
sprintf(outname, "%s/tex/%s.tex", com_gamedir, name); sprintf(outname, "tex/%s.tex", name);
COM_CreatePath(outname); FS_CreatePath(outname, FS_GAME);
out = fopen(outname, "wb"); out = FS_OpenVFS(outname, "wb", FS_GAME);
if (out) if (out)
{ {
i = LittleLong(miplevels); i = LittleLong(miplevels);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(width); i = LittleLong(width);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(height); i = LittleLong(height);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(mipmap); i = LittleLong(mipmap);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
for (miplevel = 0; miplevel < miplevels; miplevel++) for (miplevel = 0; miplevel < miplevels; miplevel++)
{ {
qglGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_COMPRESSED_ARB, &compressed); qglGetTexLevelParameteriv(GL_TEXTURE_2D, miplevel, GL_TEXTURE_COMPRESSED_ARB, &compressed);
@ -3068,17 +3061,17 @@ texels += scaled_width * scaled_height;
qglGetCompressedTexImageARB(GL_TEXTURE_2D, miplevel, img); qglGetCompressedTexImageARB(GL_TEXTURE_2D, miplevel, img);
i = LittleLong(width); i = LittleLong(width);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(height); i = LittleLong(height);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(compressed_size); i = LittleLong(compressed_size);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
i = LittleLong(internalformat); i = LittleLong(internalformat);
fwrite(&i, 1, sizeof(i), out); VFS_WRITE(out, &i, sizeof(i));
fwrite(img, 1, compressed_size, out); VFS_WRITE(out, img, compressed_size);
BZ_Free(img); BZ_Free(img);
} }
fclose(out); VFS_CLOSE(out);
} }
} }
} }

View file

@ -333,20 +333,19 @@ void GLMod_Think (void)
strcpy(filename, lightmodel->name); strcpy(filename, lightmodel->name);
f = COM_SkipPath(filename); f = COM_SkipPath(filename);
*f = '\0'; *f = '\0';
Sys_mkdir(va("%s/%s", com_gamedir, filename));
if (lightmodel->deluxdata) if (lightmodel->deluxdata)
{ {
COM_StripExtension(lightmodel->name, filename); COM_StripExtension(lightmodel->name, filename);
COM_DefaultExtension(filename, ".lux"); COM_DefaultExtension(filename, ".lux");
COM_WriteFile(filename, lightmodel->deluxdata-8, numlightdata*3+8); FS_WriteFile(filename, lightmodel->deluxdata-8, numlightdata*3+8, FS_GAME);
} }
if (writelitfile) //the user might already have a lit file (don't overwrite it). if (writelitfile) //the user might already have a lit file (don't overwrite it).
{ {
COM_StripExtension(lightmodel->name, filename); COM_StripExtension(lightmodel->name, filename);
COM_DefaultExtension(filename, ".lit"); COM_DefaultExtension(filename, ".lit");
COM_WriteFile(filename, lightmodel->lightdata-8, numlightdata*3+8); FS_WriteFile(filename, lightmodel->lightdata-8, numlightdata*3+8, FS_GAME);
} }
} }
} }
@ -455,9 +454,9 @@ model_t *GLMod_LoadModel (model_t *mod, qboolean crash)
// //
// load the file // load the file
// //
//look for a replacement //look for a replacement, but not for q1 sprites
// ext = COM_FileExtension(mod->name); ext = COM_FileExtension(mod->name);
// if (!Q_strcasecmp(ext, "mdl") || !Q_strcasecmp(ext, "bsp")) if (Q_strcasecmp(ext, "spr") && Q_strcasecmp(ext, "sp2"))
{ {
char mdlbase[MAX_QPATH]; char mdlbase[MAX_QPATH];
COM_StripExtension(mod->name, mdlbase); COM_StripExtension(mod->name, mdlbase);

View file

@ -411,6 +411,8 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex)
vi = -1; vi = -1;
for (; s ; s=s->texturechain) for (; s ; s=s->texturechain)
{ {
if (!s->mesh) //urm.
continue;
if (vi != s->lightmaptexturenum) if (vi != s->lightmaptexturenum)
{ {
if (vi<0) if (vi<0)
@ -2116,6 +2118,9 @@ void PPL_BaseEntTextures(void)
break; break;
case mod_brush: case mod_brush:
qglDepthFunc ( gldepthfunc );
qglEnable(GL_DEPTH_TEST);
qglDepthMask(1);
PPL_BaseBModelTextures (currententity); PPL_BaseBModelTextures (currententity);
break; break;

View file

@ -104,7 +104,6 @@ cvar_t r_norefresh = {"r_norefresh","0"};
//cvar_t r_drawviewmodel = {"r_drawviewmodel","1"}; //cvar_t r_drawviewmodel = {"r_drawviewmodel","1"};
//cvar_t r_speeds = {"r_speeds","0"}; //cvar_t r_speeds = {"r_speeds","0"};
//cvar_t r_fullbright = {"r_fullbright","0"}; //cvar_t r_fullbright = {"r_fullbright","0"};
cvar_t r_lightmap = {"r_lightmap","0", NULL, CVAR_CHEAT};
cvar_t r_mirroralpha = {"r_mirroralpha","1", NULL, CVAR_CHEAT}; cvar_t r_mirroralpha = {"r_mirroralpha","1", NULL, CVAR_CHEAT};
cvar_t r_wateralpha = {"r_wateralpha","1", NULL}; cvar_t r_wateralpha = {"r_wateralpha","1", NULL};
//cvar_t r_waterwarp = {"r_waterwarp", "0"}; //cvar_t r_waterwarp = {"r_waterwarp", "0"};

View file

@ -309,9 +309,7 @@ static qboolean HTTP_CL_Run(http_con_t *con)
VFS_CLOSE(con->file); VFS_CLOSE(con->file);
else else
{ {
snprintf(Location, sizeof(Location)-1, "%s/%s", com_gamedir, con->filename); FS_WriteFile(con->filename, con->buffer, con->bufferused, FS_GAME);
COM_CreatePath(Location);
COM_WriteFile(con->filename, con->buffer, con->bufferused);
} }
if (con->NotifyFunction) if (con->NotifyFunction)
{ {

View file

@ -160,6 +160,16 @@ void GUI_ParseCommandLine(char *args)
{ {
fl_log = true; fl_log = true;
} }
else if (!strnicmp(parameters+paramlen, "-srcfile", 8) || !strnicmp(parameters+paramlen, "/srcfile", 8))
{
while (*next == ' ')
next++;
l = 0;
while (*next != ' ' && *next)
progssrcname[l++] = *next++;
progssrcname[l] = 0;
}
else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target else if (!strnicmp(parameters+paramlen, "-T", 2) || !strnicmp(parameters+paramlen, "/T", 2)) //the target
{ {
if (!strnicmp(parameters+paramlen+2, "h2", 2)) if (!strnicmp(parameters+paramlen+2, "h2", 2))