I committed too much last time, so here goes for a big commit.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@774 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-01-13 16:29:20 +00:00
parent 9d24482f9a
commit c2988990c2
23 changed files with 619 additions and 406 deletions

View file

@ -1158,6 +1158,7 @@ void CL_PlayDemo_f (void)
else else
cls.demoplayback = DPB_QUAKEWORLD; cls.demoplayback = DPB_QUAKEWORLD;
cls.state = ca_demostart; cls.state = ca_demostart;
net_message.packing = SZ_RAWBYTES;
Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, 0); Netchan_Setup (NS_CLIENT, &cls.netchan, net_from, 0);
realtime = 0; realtime = 0;
cl.gametime = 0; cl.gametime = 0;

View file

@ -200,6 +200,9 @@ void IN_Button7Up(void) {KeyUp(&in_button7);}
void IN_Button8Down(void) {KeyDown(&in_button8);} void IN_Button8Down(void) {KeyDown(&in_button8);}
void IN_Button8Up(void) {KeyUp(&in_button8);} void IN_Button8Up(void) {KeyUp(&in_button8);}
float in_rotate;
void IN_Rotate_f (void) {in_rotate += atoi(Cmd_Argv(1));}
//is this useful? //is this useful?
@ -361,7 +364,7 @@ Moves the local angle positions
*/ */
void CL_AdjustAngles (int pnum) void CL_AdjustAngles (int pnum)
{ {
float speed; float speed, quant;
float up, down; float up, down;
if (in_speed.state[pnum] & 1) if (in_speed.state[pnum] & 1)
@ -369,6 +372,18 @@ void CL_AdjustAngles (int pnum)
else else
speed = host_frametime; speed = host_frametime;
if (in_rotate && pnum==0)
{
quant = in_rotate;
// if (quant < -800)
// quant = -800;
// else if (quant > 800)
// quant = 800;
quant *= speed;
in_rotate -= quant;
cl.viewangles[pnum][YAW] += quant;
}
if (!(in_strafe.state[pnum] & 1)) if (!(in_strafe.state[pnum] & 1))
{ {
cl.viewangles[pnum][YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right, pnum); cl.viewangles[pnum][YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right, pnum);
@ -1298,6 +1313,8 @@ void CL_InitInput (void)
Cmd_AddCommand (vahunk("-button8%s", spn), IN_Button8Up); Cmd_AddCommand (vahunk("-button8%s", spn), IN_Button8Up);
} }
Cmd_AddCommand("rotate", IN_Rotate_f);
Cvar_Register (&cl_nodelta, inputnetworkcvargroup); Cvar_Register (&cl_nodelta, inputnetworkcvargroup);
Cvar_Register (&cl_c2sImpulseBackup, inputnetworkcvargroup); Cvar_Register (&cl_c2sImpulseBackup, inputnetworkcvargroup);

View file

@ -71,6 +71,8 @@ cvar_t lookspring = {"lookspring","0", NULL, CVAR_ARCHIVE};
cvar_t lookstrafe = {"lookstrafe","0", NULL, CVAR_ARCHIVE}; cvar_t lookstrafe = {"lookstrafe","0", NULL, CVAR_ARCHIVE};
cvar_t sensitivity = {"sensitivity","3", NULL, CVAR_ARCHIVE}; cvar_t sensitivity = {"sensitivity","3", NULL, CVAR_ARCHIVE};
cvar_t cl_staticsounds = {"cl_staticsounds", "1"};
cvar_t m_pitch = {"m_pitch","0.022", NULL, CVAR_ARCHIVE}; cvar_t m_pitch = {"m_pitch","0.022", NULL, CVAR_ARCHIVE};
cvar_t m_yaw = {"m_yaw","0.022"}; cvar_t m_yaw = {"m_yaw","0.022"};
cvar_t m_forward = {"m_forward","1"}; cvar_t m_forward = {"m_forward","1"};
@ -104,6 +106,8 @@ cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t cl_nofake = {"cl_nofake", "2"}; cvar_t cl_nofake = {"cl_nofake", "2"};
cvar_t cl_chatsound = {"cl_chatsound", "1"}; cvar_t cl_chatsound = {"cl_chatsound", "1"};
cvar_t cl_muzzleflash = {"cl_muzzleflash", "1"};
cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"}; cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"};
cvar_t requiredownloads = {"requiredownloads","1", NULL, CVAR_ARCHIVE}; cvar_t requiredownloads = {"requiredownloads","1", NULL, CVAR_ARCHIVE};
@ -1118,7 +1122,7 @@ void CL_CheckServerInfo(void)
cl.bunnyspeedcap = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_bunnyspeedcap")); cl.bunnyspeedcap = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_bunnyspeedcap"));
movevars.slidefix = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_slidefix")) != 0); movevars.slidefix = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_slidefix")) != 0);
movevars.airstep = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_airstep")) != 0); movevars.airstep = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_airstep")) != 0);
movevars.walljump = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_walljump")) != 0); movevars.walljump = (Q_atof(Info_ValueForKey(cl.serverinfo, "pm_walljump")));
movevars.ktjump = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_ktjump")); movevars.ktjump = Q_atof(Info_ValueForKey(cl.serverinfo, "pm_ktjump"));
// Initialize cl.maxpitch & cl.minpitch // Initialize cl.maxpitch & cl.minpitch
@ -2110,6 +2114,7 @@ void CL_POP3Poll_f(void)
} }
#endif #endif
void SCR_ShowPic_Script_f(void);
/* /*
================= =================
CL_Init CL_Init
@ -2189,11 +2194,15 @@ void CL_Init (void)
Cvar_Register (&localid, cl_controlgroup); Cvar_Register (&localid, cl_controlgroup);
Cvar_Register (&cl_muzzleflash, cl_controlgroup);
Cvar_Register (&baseskin, "Teamplay"); Cvar_Register (&baseskin, "Teamplay");
Cvar_Register (&noskins, "Teamplay"); Cvar_Register (&noskins, "Teamplay");
Cvar_Register (&cl_item_bobbing, "Item effects"); Cvar_Register (&cl_item_bobbing, "Item effects");
Cvar_Register (&cl_staticsounds, "Item effects");
// //
// info mirrors // info mirrors
// //
@ -2244,6 +2253,8 @@ void CL_Init (void)
Cmd_AddCommand ("playdemo", CL_PlayDemo_f); Cmd_AddCommand ("playdemo", CL_PlayDemo_f);
Cmd_AddCommand ("timedemo", CL_TimeDemo_f); Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
Cmd_AddCommand ("showpic", SCR_ShowPic_Script_f);
Cmd_AddCommand ("startdemos", CL_Startdemos_f); Cmd_AddCommand ("startdemos", CL_Startdemos_f);
Cmd_AddCommand ("demos", CL_Demos_f); Cmd_AddCommand ("demos", CL_Demos_f);
Cmd_AddCommand ("stopdemo", CL_Stopdemo_f); Cmd_AddCommand ("stopdemo", CL_Stopdemo_f);

View file

@ -511,6 +511,104 @@ int CL_CalcNet (void)
//============================================================================= //=============================================================================
//note: this will overwrite existing files.
//returns true if the download is going to be downloaded after the call.
qboolean CL_EnqueDownload(char *filename, qboolean verbose, qboolean ignorefailedlist)
{
downloadlist_t *dl;
if (strchr(filename, '\\') || strchr(filename, ':') || strstr(filename, ".."))
{
Con_Printf("Denying download of \"%s\"\n", filename);
return false;
}
if (cls.demoplayback)
return false;
if (!ignorefailedlist)
{
for (dl = cl.faileddownloads; dl; dl = dl->next) //yeah, so it failed... Ignore it.
{
if (!strcmp(dl->name, filename))
{
if (verbose)
Con_Printf("We've failed to download \"%s\" already\n", filename);
return false;
}
}
}
for (dl = cl.downloadlist; dl; dl = dl->next) //It's already on our list. Ignore it.
{
if (!strcmp(dl->name, filename))
{
if (verbose)
Con_Printf("Already waiting for \"%s\"\n", filename);
return true;
}
}
if (!strcmp(cls.downloadname, filename))
{
if (verbose)
Con_Printf("Already downloading \"%s\"\n", filename);
return true;
}
dl = Z_Malloc(sizeof(downloadlist_t));
strcpy(dl->name, filename);
dl->next = cl.downloadlist;
cl.downloadlist = dl;
if (verbose)
Con_Printf("Enqued download of \"%s\"\n", filename);
return true;
}
void CL_SendDownloadRequest(char *filename)
{
downloadlist_t *dl, *nxt;
if(cl.downloadlist) //remove from enqued download list
{
if (!strcmp(cl.downloadlist->name, filename))
{
dl = cl.downloadlist;
cl.downloadlist = cl.downloadlist->next;
Z_Free(dl);
}
else
{
for (dl = cl.downloadlist->next; dl->next; dl = dl->next)
{
if (!strcmp(dl->next->name, filename))
{
nxt = dl->next->next;
Z_Free(dl->next);
dl->next = nxt;
break;
}
}
}
}
strcpy (cls.downloadname, filename);
Con_TPrintf (TL_DOWNLOADINGFILE, cls.downloadname);
// download to a temp name, and only rename
// to the real name when done, so if interrupted
// a runt file wont be left
COM_StripExtension (cls.downloadname, cls.downloadtempname);
strcat (cls.downloadtempname, ".tmp");
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, va("download %s", cls.downloadname));
//prevent ftp/http from changing stuff
cls.downloadtype = DL_QWPENDING;
cls.downloadpercent = 0;
}
/* /*
=============== ===============
CL_CheckOrDownloadFile CL_CheckOrDownloadFile
@ -535,7 +633,8 @@ qboolean CL_CheckOrDownloadFile (char *filename, int nodelay)
} }
//ZOID - can't download when recording //ZOID - can't download when recording
if (cls.demorecording) { if (cls.demorecording)
{
Con_TPrintf (TL_NODOWNLOADINDEMO, filename); Con_TPrintf (TL_NODOWNLOADINDEMO, filename);
return true; return true;
} }
@ -543,43 +642,10 @@ qboolean CL_CheckOrDownloadFile (char *filename, int nodelay)
if (cls.demoplayback) if (cls.demoplayback)
return true; return true;
if (cl.faileddownloads) if (!nodelay)
{ return !CL_EnqueDownload(filename, false, false);
for (failed = cl.faileddownloads; failed; failed = failed->next) //yeah, so it failed... Ignore it.
{
if (!strcmp(failed->name, filename))
return true;
}
}
for (failed = cl.downloadlist; failed; failed = failed->next) //It's already on our list. Ignore it. CL_SendDownloadRequest(filename);
{
if (!strcmp(failed->name, filename))
return true;
}
if ((!requiredownloads.value && !nodelay) || nodelay==-1)
{
downloadlist_t *new;
new = Z_Malloc(sizeof(downloadlist_t));
strcpy(new->name, filename);
new->next = cl.downloadlist;
cl.downloadlist = new;
return true;
}
strcpy (cls.downloadname, filename);
Con_TPrintf (TL_DOWNLOADINGFILE, cls.downloadname);
// download to a temp name, and only rename
// to the real name when done, so if interrupted
// a runt file wont be left
COM_StripExtension (cls.downloadname, cls.downloadtempname);
strcat (cls.downloadtempname, ".tmp");
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, va("download %s", cls.downloadname));
SCR_EndLoadingPlaque(); //release console. SCR_EndLoadingPlaque(); //release console.
@ -693,8 +759,9 @@ void Model_NextDownload (void)
if (!CL_CheckOrDownloadFile(s, cls.downloadnumber==1)) //world is required to be loaded. if (!CL_CheckOrDownloadFile(s, cls.downloadnumber==1)) //world is required to be loaded.
return; // started a download return; // started a download
if (CL_CheckMD2Skins(s)) if (strstr(s, ".md2"))
return; if (CL_CheckMD2Skins(s))
return;
} }
if (cl.playernum[0] == -1) if (cl.playernum[0] == -1)
@ -928,6 +995,58 @@ char *ZLibDownloadDecode(int *messagesize, char *input, int finalsize)
} }
#endif #endif
void CL_DownloadFailed(void);
#ifdef PEXT_CHUNKEDDOWNLOADS
void CL_ParseChunkedDownload(void)
{
qbyte *name;
int totalsize;
int chunknum;
chunknum = MSG_ReadLong();
if (chunknum < 0)
{
totalsize = MSG_ReadLong();
name = MSG_ReadString();
if (cls.demoplayback)
return;
if (totalsize < 0)
{
if (totalsize == -2)
Con_Printf("Server permissions deny downloading file %s\n", name);
else
Con_Printf("Couldn't find file %s on the server\n", name);
CL_DownloadFailed();
CL_RequestNextDownload();
return;
}
if (cls.downloadmethod == DL_QWCHUNKS)
Host_EndGame("Received second download - \"%s\"\n", name);
//start the new download
cls.downloadmethod = DL_QWCHUNKS;
cls.downloadpercent = 0;
strcpy(cls.downloadname, name);
COM_StripExtension(name, cls.downloadtempname);
COM_DefaultExtension(cls.downloadtempname, ".tmp");
return;
}
if (cls.demoplayback)
{
return;
}
}
#endif
/* /*
===================== =====================
CL_ParseDownload CL_ParseDownload
@ -941,6 +1060,15 @@ void CL_ParseDownload (void)
qbyte name[1024]; qbyte name[1024];
int r; int r;
#ifdef PEXT_CHUNKEDDOWNLOADS
#pragma message fixme
if (cls.fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS)
{
CL_ParseChunkedDownload();
return;
}
#endif
// read the data // read the data
size = MSG_ReadShort (); size = MSG_ReadShort ();
percent = MSG_ReadByte (); percent = MSG_ReadByte ();
@ -959,7 +1087,7 @@ void CL_ParseDownload (void)
strcpy(cls.downloadtempname, "unknown.tmp"); strcpy(cls.downloadtempname, "unknown.tmp");
} }
if (size == -1) if (size < 0)
{ {
Con_TPrintf (TL_FILENOTFOUND); Con_TPrintf (TL_FILENOTFOUND);
if (cls.downloadqw) if (cls.downloadqw)
@ -2097,6 +2225,7 @@ CL_ParseStaticSound
*/ */
void CL_ParseStaticSound (void) void CL_ParseStaticSound (void)
{ {
extern cvar_t cl_staticsounds;
vec3_t org; vec3_t org;
int sound_num, vol, atten; int sound_num, vol, atten;
int i; int i;
@ -2106,6 +2235,9 @@ void CL_ParseStaticSound (void)
sound_num = MSG_ReadByte (); sound_num = MSG_ReadByte ();
vol = MSG_ReadByte (); vol = MSG_ReadByte ();
atten = MSG_ReadByte (); atten = MSG_ReadByte ();
if (!cl_staticsounds.value)
return;
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
} }
@ -2572,8 +2704,16 @@ void CL_MuzzleFlash (void)
entity_state_t *s1; entity_state_t *s1;
int pnum; int pnum;
extern cvar_t cl_muzzleflash;
i = MSG_ReadShort (); i = MSG_ReadShort ();
//was it us?
if (i == cl.playernum[0])
{
if (!cl_muzzleflash.value)
return;
}
pack = &cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities; pack = &cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities;

View file

@ -580,6 +580,33 @@ void SCR_ShowPic_Update(void)
CL_CheckOrDownloadFile(sp->picname, false); CL_CheckOrDownloadFile(sp->picname, false);
} }
void SCR_ShowPic_Script_f(void)
{
char *imgname;
char *name;
int x, y;
int zone;
showpic_t *sp;
imgname = Cmd_Argv(1);
name = Cmd_Argv(2);
x = atoi(Cmd_Argv(3));
y = atoi(Cmd_Argv(4));
zone = atoi(Cmd_Argv(5));
sp = SCR_ShowPic_Find(name);
Z_Free(sp->picname);
sp->picname = Z_Malloc(strlen(imgname)+1);
strcpy(sp->picname, imgname);
sp->zone = zone;
sp->x = x;
sp->y = y;
}
//============================================================================= //=============================================================================
/* /*
@ -735,13 +762,14 @@ void SCR_CalcRefdef (void)
void SCR_CrosshairPosition(int pnum, int *x, int *y) void SCR_CrosshairPosition(int pnum, int *x, int *y)
{ {
extern cvar_t cl_crossx, cl_crossy, crosshaircorrect; extern cvar_t cl_crossx, cl_crossy, crosshaircorrect, v_viewheight;
vrect_t rect; vrect_t rect;
SCR_VRectForPlayer(&rect, pnum); SCR_VRectForPlayer(&rect, pnum);
if (cl.worldmodel && crosshaircorrect.value) if (cl.worldmodel && crosshaircorrect.value)
{ {
float adj;
trace_t tr; trace_t tr;
vec3_t end; vec3_t end;
vec3_t start; vec3_t start;
@ -764,7 +792,14 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y)
} }
else else
{ {
start[2]+=cl.viewheight[pnum]/4; adj=cl.viewheight[pnum];
if (v_viewheight.value < -7)
adj+=-7;
else if (v_viewheight.value > 4)
adj+=4;
else
adj+=v_viewheight.value;
start[2]+=adj/4;
ML_Project(tr.endpos, end, cl.simangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y); ML_Project(tr.endpos, end, cl.simangles[pnum], start, (float)rect.width/rect.height, r_refdef.fov_y);
*x = rect.x+rect.width*end[0]; *x = rect.x+rect.width*end[0];
*y = rect.y+rect.height*(1-end[1]); *y = rect.y+rect.height*(1-end[1]);

View file

@ -1828,7 +1828,7 @@ void CL_UpdateBeams (void)
float yaw, pitch; float yaw, pitch;
float forward, offset; float forward, offset;
extern cvar_t cl_truelightning; extern cvar_t cl_truelightning, v_viewheight;
// update lightning // update lightning
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++) for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
@ -1842,7 +1842,17 @@ void CL_UpdateBeams (void)
// VectorSubtract(cl.simorg, b->start, org); // VectorSubtract(cl.simorg, b->start, org);
// VectorAdd(b->end, org, b->end); //move the end point by simorg-start // VectorAdd(b->end, org, b->end); //move the end point by simorg-start
VectorCopy (cl.simorg[0], b->start); //move the start point to player origin VectorCopy (cl.simorg[0], b->start); //move the start point to view origin
b->start[2] += cl.crouch[0];
if (v_viewheight.value)
{
if (v_viewheight.value <= -7)
b->start[2] += -7;
else if (v_viewheight.value >= 4)
b->start[2] += 4;
else
b->start[2] += v_viewheight.value;
}
//rotate the end point to face in the view direction. This gives a smoother shafting. turning looks great. //rotate the end point to face in the view direction. This gives a smoother shafting. turning looks great.

View file

@ -474,8 +474,8 @@ void VQ3_RenderView(const q3refdef_t *ref)
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
gl_ztrickdisabled|=16; gl_ztrickdisabled|=16;
glDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND); qglDisable(GL_BLEND);
} }
#endif #endif
R_RenderView(); R_RenderView();
@ -484,7 +484,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
{ {
gl_ztrickdisabled&=~16; gl_ztrickdisabled&=~16;
GL_Set2D (); GL_Set2D ();
glBlendFunc (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);
} }
#endif #endif
@ -492,8 +492,8 @@ void VQ3_RenderView(const q3refdef_t *ref)
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
glDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND); qglEnable(GL_BLEND);
} }
#endif #endif

View file

@ -289,7 +289,7 @@ typedef struct
int socketip6; int socketip6;
int socketipx; int socketipx;
enum {DL_NONE, DL_QW, DL_HTTP, DL_FTP} downloadmethod; enum {DL_NONE, DL_QW, DL_QWCHUNKS, DL_QWPENDING, DL_HTTP, DL_FTP} downloadmethod;
FILE *downloadqw; // file transfer from server FILE *downloadqw; // file transfer from server
char downloadtempname[MAX_OSPATH]; char downloadtempname[MAX_OSPATH];
char downloadname[MAX_OSPATH]; char downloadname[MAX_OSPATH];

View file

@ -1000,6 +1000,11 @@ void V_AddEntity(entity_t *in)
cl_numvisedicts++; cl_numvisedicts++;
*ent = *in; *ent = *in;
ent->angles[0]*=-1;
AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]);
VectorInverse(ent->axis[1]);
ent->angles[0]*=-1;
} }
void V_AddLight (vec3_t org, float quant, float r, float g, float b) void V_AddLight (vec3_t org, float quant, float r, float g, float b)

View file

@ -36,13 +36,13 @@ consolecolours_t consolecolours[] = {
int con_ormask; int con_ormask;
console_t con_main; console_t con_main;
console_t *con; // point to either con_main console_t *con_current; // point to either con_main
#ifdef QTERM #ifdef QTERM
#include <windows.h> #include <windows.h>
typedef struct qterm_s { typedef struct qterm_s {
console_t console; console_t *console;
qboolean running; qboolean running;
HANDLE process; HANDLE process;
HANDLE pipein; HANDLE pipein;
@ -85,15 +85,58 @@ extern int key_linepos;
qboolean con_initialized; qboolean con_initialized;
void Con_ResizeCon (console_t *con);
void Con_Resize (console_t *con); qboolean Con_IsActive (console_t *con)
{
return (con == con_current);
}
void Con_Destroy (console_t *con)
{
console_t *prev;
for (prev = &con_main; prev->next; prev = prev->next)
{
if (prev->next == con)
{
prev->next = con->next;
break;
}
}
BZ_Free(con);
}
console_t *Con_FindConsole(char *name)
{
console_t *con;
for (con = &con_main; con; con = con->next)
{
if (!strcmp(con->name, name))
return con;
}
return NULL;
}
console_t *Con_Create(char *name)
{
console_t *con;
con = BZ_Malloc(sizeof(console_t));
Q_strncpyz(con->name, name, sizeof(con->name));
Con_ResizeCon(con);
con->next = con_main.next;
con_main.next = con;
return con;
}
void Con_SetVisible (console_t *con)
{
con_current = con;
}
void Con_PrintCon (console_t *con, char *txt);
#ifdef QTERM #ifdef QTERM
void Con_PrintCon (char *txt, console_t *con);
void QT_Update(void) void QT_Update(void)
{ {
char buffer[2048]; char buffer[2048];
@ -104,8 +147,11 @@ void QT_Update(void)
{ {
if (!qt->running) if (!qt->running)
{ {
if (con == &qt->console) if (Con_IsActive(qt->console))
continue; continue;
Con_Destroy(qt->console);
if (prev) if (prev)
prev->next = qt->next; prev->next = qt->next;
else else
@ -129,48 +175,44 @@ void QT_Update(void)
{ {
ReadFile(qt->pipeout, buffer, sizeof(buffer)-32, &ret, NULL); ReadFile(qt->pipeout, buffer, sizeof(buffer)-32, &ret, NULL);
buffer[ret] = '\0'; buffer[ret] = '\0';
Con_PrintCon(buffer, &qt->console); Con_PrintCon(qt->console, buffer);
} }
} }
} }
else else
{ {
Con_PrintCon("Process ended\n", &qt->console); Con_PrintCon(qt->console, "Process ended\n");
qt->running = false; qt->running = false;
} }
} }
} }
void QT_KeyPress(int key) void QT_KeyPress(void *user, int key)
{ {
qbyte k[2]; qbyte k[2];
qterm_t *qt; qterm_t *qt = user;
DWORD send = key; //get around a gcc warning DWORD send = key; //get around a gcc warning
for (qt = qterms; qt; qt = qt->next)
{
if (&qt->console == con)
{
k[0] = key;
k[1] = '\0';
if (qt->running)
{ k[0] = key;
if (*k == '\r') k[1] = '\0';
{
if (qt->running)
{
if (*k == '\r')
{
// *k = '\r'; // *k = '\r';
// WriteFile(qt->pipein, k, 1, &key, NULL); // WriteFile(qt->pipein, k, 1, &key, NULL);
// Con_PrintCon(k, &qt->console); // Con_PrintCon(k, &qt->console);
*k = '\n'; *k = '\n';
} }
if (GetFileSize(qt->pipein, NULL)<512) if (GetFileSize(qt->pipein, NULL)<512)
{ {
WriteFile(qt->pipein, k, 1, &send, NULL); WriteFile(qt->pipein, k, 1, &send, NULL);
Con_PrintCon(k, &qt->console); Con_PrintCon(qt->console, k);
}
}
return;
} }
} }
return;
} }
void QT_Create(char *command) void QT_Create(char *command)
@ -236,15 +278,14 @@ void QT_Create(char *command)
CloseHandle(ProcInfo.hThread); CloseHandle(ProcInfo.hThread);
qt->running = true; qt->running = true;
qt->console.redirect = QT_KeyPress;
Con_Resize(&qt->console); qt->console = Con_Create("QTerm");
Con_PrintCon("Started Process\n", &qt->console); qt->console->redirect = QT_KeyPress;
Con_PrintCon(qt->console, "Started Process\n");
Con_SetVisible(qt->console);
qt->next = qterms; qt->next = qterms;
qterms = activeqterm = qt; qterms = activeqterm = qt;
con = &qt->console;
} }
void Con_QTerm_f(void) void Con_QTerm_f(void)
@ -365,7 +406,7 @@ Con_Resize
================ ================
*/ */
void Con_Resize (console_t *con) void Con_ResizeCon (console_t *con)
{ {
int i, j, width, oldwidth, oldtotallines, numlines, numchars; int i, j, width, oldwidth, oldtotallines, numlines, numchars;
unsigned short tbuf[CON_TEXTSIZE]; unsigned short tbuf[CON_TEXTSIZE];
@ -421,7 +462,6 @@ void Con_Resize (console_t *con)
con->current = con->totallines - 1; con->current = con->totallines - 1;
con->display = con->current; con->display = con->current;
} }
/* /*
================ ================
@ -432,12 +472,9 @@ If the line width has changed, reformat the buffer.
*/ */
void Con_CheckResize (void) void Con_CheckResize (void)
{ {
#ifdef QTERM console_t *c;
qterm_t *qt; for (c = &con_main; c; c = c->next)
for (qt = qterms; qt; qt=qt->next) Con_ResizeCon (c);
Con_Resize(&qt->console);
#endif
Con_Resize (&con_main);
} }
@ -455,8 +492,8 @@ void Con_Init (void)
TRACE(("dbg: Con_Init: con_debuglog forced\n")); TRACE(("dbg: Con_Init: con_debuglog forced\n"));
#endif #endif
con = &con_main; con_current = &con_main;
con->linewidth = -1; con_main.linewidth = -1;
Con_CheckResize (); Con_CheckResize ();
Con_Printf ("Console initialized.\n"); Con_Printf ("Console initialized.\n");
@ -516,7 +553,7 @@ If no console is visible, the notify window will pop up.
#define INVIS_CHAR2 (char)138 //green #define INVIS_CHAR2 (char)138 //green
#define INVIS_CHAR3 (char)160 //blue #define INVIS_CHAR3 (char)160 //blue
void Con_PrintCon (char *txt, console_t *con) void Con_PrintCon (console_t *con, char *txt)
{ {
int y; int y;
int c, l; int c, l;
@ -630,35 +667,14 @@ void Con_PrintCon (char *txt, console_t *con)
} }
void Con_Print (char *txt) void Con_Print (char *txt)
{ {
Con_PrintCon(txt, &con_main); //client console Con_PrintCon(&con_main, txt); //client console
} }
void Con_CycleConsole(void) void Con_CycleConsole(void)
{ {
console_t *old = con; con_current = con_current->next;
#ifdef QTERM if (!con_current)
qterm_t *qt; con_current = &con_main;
for (qt = qterms; qt; qt=qt->next)
{
if (old == &qt->console)
{
if (qt->next)
{
con = &qt->next->console;
return;
}
}
}
if (old == &con_main)
{
if (qterms)
{
con = &qterms->console;
return;
}
}
#endif
con = &con_main;
} }
/* /*
@ -830,7 +846,7 @@ void Con_DrawInput (void)
if (key_dest != key_console && cls.state == ca_active) if (key_dest != key_console && cls.state == ca_active)
return; // don't draw anything (allways draw if not active) return; // don't draw anything (allways draw if not active)
if (con != &con_main) if (con_current != &con_main)
return; return;
@ -867,14 +883,14 @@ void Con_DrawInput (void)
i = strlen(text); i = strlen(text);
if (i >= con->linewidth) //work out the start point if (i >= con_current->linewidth) //work out the start point
si = i - con->linewidth; si = i - con_current->linewidth;
else else
si = 0; si = 0;
y = con->vislines-22; y = con_current->vislines-22;
for (i=0,p=0,x=8; x<=con->linewidth*8 ; p++) //draw it for (i=0,p=0,x=8; x<=con_current->linewidth*8 ; p++) //draw it
{ {
if (text[p] == '^') if (text[p] == '^')
{ {
@ -905,7 +921,7 @@ void Con_DrawInput (void)
break; break;
if (si <= i) if (si <= i)
{ {
Draw_ColouredCharacter ( x, con->vislines - 22, text[p]|mask); Draw_ColouredCharacter ( x, con_current->vislines - 22, text[p]|mask);
x+=8; x+=8;
} }
i++; i++;
@ -1064,23 +1080,21 @@ void Con_PrintToSys(void) //send all the stuff that was con_printed to sys_print
{ {
int line, row, x; int line, row, x;
short *text; short *text;
console_t *curcon = con; console_t *curcon = &con_main;
if (!con)
return;
row = curcon->current - con->totallines+1; row = curcon->current - curcon->totallines+1;
for (line = 0; line < con->totallines-1; line++, row++) //skip empty lines. for (line = 0; line < curcon->totallines-1; line++, row++) //skip empty lines.
{ {
text = curcon->text + (row % con->totallines)*con->linewidth; text = curcon->text + (row % curcon->totallines)*curcon->linewidth;
for (x = 0; x < con->linewidth; x++) for (x = 0; x < curcon->linewidth; x++)
if (((qbyte)(text[x])&255) != ' ') if (((qbyte)(text[x])&255) != ' ')
goto breakout; goto breakout;
} }
breakout: breakout:
for (; line < con->totallines-1; line++, row++) for (; line < curcon->totallines-1; line++, row++)
{ {
text = curcon->text + (row % con->totallines)*con->linewidth; text = curcon->text + (row % curcon->totallines)*curcon->linewidth;
for (x = 0; x < con->linewidth; x++) for (x = 0; x < curcon->linewidth; x++)
Sys_Printf("%c", (qbyte)text[x]&255); Sys_Printf("%c", (qbyte)text[x]&255);
Sys_Printf("\n"); Sys_Printf("\n");
} }
@ -1110,7 +1124,7 @@ void Con_DrawConsole (int lines, qboolean noback)
extern int relitsurface; extern int relitsurface;
#endif #endif
console_t *curcon = con; console_t *curcon = con_current;
if (lines <= 0) if (lines <= 0)
return; return;
@ -1125,7 +1139,7 @@ void Con_DrawConsole (int lines, qboolean noback)
Draw_ConsoleBackground (lines); Draw_ConsoleBackground (lines);
// draw the text // draw the text
con->vislines = lines; con_current->vislines = lines;
// changed to line things up better // changed to line things up better
rows = (lines-22)>>3; // rows of text to draw rows = (lines-22)>>3; // rows of text to draw
@ -1136,7 +1150,7 @@ void Con_DrawConsole (int lines, qboolean noback)
if (curcon->display != curcon->current) if (curcon->display != curcon->current)
{ {
// draw arrows to show the buffer is backscrolled // draw arrows to show the buffer is backscrolled
for (x=0 ; x<con->linewidth ; x+=4) for (x=0 ; x<curcon->linewidth ; x+=4)
Draw_Character ( (x+1)<<3, y, '^'); Draw_Character ( (x+1)<<3, y, '^');
y -= 8; y -= 8;
@ -1148,14 +1162,15 @@ void Con_DrawConsole (int lines, qboolean noback)
{ {
if (row < 0) if (row < 0)
break; break;
if (curcon->current - row >= con->totallines) if (curcon->current - row >= curcon->totallines)
break; // past scrollback wrap point break; // past scrollback wrap point
text = curcon->text + (row % con->totallines)*con->linewidth; text = curcon->text + (row % curcon->totallines)*curcon->linewidth;
for (x=0 ; x<con->linewidth ; x++) for (x=0 ; x<curcon->linewidth ; x++)
{ {
Draw_ColouredCharacter ( (x+1)<<3, y, text[x]); if (text[x])
Draw_ColouredCharacter ( (x+1)<<3, y, text[x]);
} }
} }
@ -1188,9 +1203,9 @@ void Con_DrawConsole (int lines, qboolean noback)
else else
txt = progresstext; txt = progresstext;
x = con->linewidth - ((con->linewidth * 7) / 40); x = curcon->linewidth - ((curcon->linewidth * 7) / 40);
y = x - strlen(txt) - 8; y = x - strlen(txt) - 8;
i = con->linewidth/3; i = curcon->linewidth/3;
if (strlen(txt) > i) if (strlen(txt) > i)
{ {
y = x - i - 11; y = x - i - 11;
@ -1222,7 +1237,7 @@ void Con_DrawConsole (int lines, qboolean noback)
sprintf(dlbar + strlen(dlbar), " %02d%%", (int)progresspercent); sprintf(dlbar + strlen(dlbar), " %02d%%", (int)progresspercent);
// draw it // draw it
y = con->vislines-22 + 8; y = curcon->vislines-22 + 8;
for (i = 0; i < strlen(dlbar); i++) for (i = 0; i < strlen(dlbar); i++)
Draw_ColouredCharacter ( (i+1)<<3, y, (unsigned char)dlbar[i] | M_COLOR_WHITE); Draw_ColouredCharacter ( (i+1)<<3, y, (unsigned char)dlbar[i] | M_COLOR_WHITE);

View file

@ -243,8 +243,8 @@ int PaddedPrint (char *s, int x)
if (x) if (x)
nextcolx = (int)((x + COLUMNWIDTH)/COLUMNWIDTH)*COLUMNWIDTH; nextcolx = (int)((x + COLUMNWIDTH)/COLUMNWIDTH)*COLUMNWIDTH;
if (nextcolx > con->linewidth - MINCOLUMNWIDTH if (nextcolx > con_main.linewidth - MINCOLUMNWIDTH
|| (x && nextcolx + strlen(s) >= con->linewidth)) || (x && nextcolx + strlen(s) >= con_main.linewidth))
{ {
Con_Printf ("\n"); Con_Printf ("\n");
x=0; x=0;
@ -356,7 +356,7 @@ void Key_Console (int key)
char *clipText; char *clipText;
#endif #endif
if (con->redirect) if (con_current->redirect)
{ {
if (key == K_TAB) if (key == K_TAB)
{ // command completion { // command completion
@ -366,7 +366,7 @@ void Key_Console (int key)
return; return;
} }
} }
con->redirect(key); con_current->redirect(con_current, key);
return; return;
} }
@ -513,27 +513,27 @@ void Key_Console (int key)
if (key == K_PGUP || key==K_MWHEELUP) if (key == K_PGUP || key==K_MWHEELUP)
{ {
con->display -= 2; con_current->display -= 2;
return; return;
} }
if (key == K_PGDN || key==K_MWHEELDOWN) if (key == K_PGDN || key==K_MWHEELDOWN)
{ {
con->display += 2; con_current->display += 2;
if (con->display > con->current) if (con_current->display > con_current->current)
con->display = con->current; con_current->display = con_current->current;
return; return;
} }
if (key == K_HOME) if (key == K_HOME)
{ {
con->display = con->current - con->totallines + 10; con_current->display = con_current->current - con_current->totallines + 10;
return; return;
} }
if (key == K_END) if (key == K_END)
{ {
con->display = con->current; con_current->display = con_current->current;
return; return;
} }

View file

@ -1324,16 +1324,16 @@ void M_Menu_Main_f (void)
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key; mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 0, 4, "m_main_plaque"); MC_AddPicture(mainm, 0, 4, "pics/m_main_plaque");
p = Draw_SafeCachePic("m_main_logo"); p = Draw_SafeCachePic("pics/m_main_logo");
if (!p) if (!p)
return; return;
MC_AddPicture(mainm, 0, 173, "m_main_logo"); MC_AddPicture(mainm, 0, 173, "pics/m_main_logo");
MC_AddPicture(mainm, 68, 13, "m_main_game"); MC_AddPicture(mainm, 68, 13, "pics/m_main_game");
MC_AddPicture(mainm, 68, 53, "m_main_multiplayer"); MC_AddPicture(mainm, 68, 53, "pics/m_main_multiplayer");
MC_AddPicture(mainm, 68, 93, "m_main_options"); MC_AddPicture(mainm, 68, 93, "pics/m_main_options");
MC_AddPicture(mainm, 68, 133, "m_main_video"); MC_AddPicture(mainm, 68, 133, "pics/m_main_video");
MC_AddPicture(mainm, 68, 173, "m_main_quit"); MC_AddPicture(mainm, 68, 173, "pics/m_main_quit");
mainm->selecteditem = (menuoption_t *) mainm->selecteditem = (menuoption_t *)
MC_AddConsoleCommand (mainm, 68, 13, "", "menu_single\n"); MC_AddConsoleCommand (mainm, 68, 13, "", "menu_single\n");
@ -1386,16 +1386,22 @@ void M_Menu_Main_f (void)
m_state = m_complex; m_state = m_complex;
key_dest = key_menu; key_dest = key_menu;
m_entersound = true; m_entersound = true;
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 4, "gfx/qplaque.lmp");
p = Draw_SafeCachePic("gfx/ttl_main.lmp"); p = Draw_SafeCachePic("gfx/ttl_main.lmp");
if (!p) if (!p)
{ {
Con_ToggleConsole_f(); MC_AddRedText(mainm, 16, 0, "MAIN MENU", false);
mainm->selecteditem = (menuoption_t *)
MC_AddConsoleCommand (mainm, 64, 32, "Join server", "menu_servers\n");
MC_AddConsoleCommand (mainm, 64, 40, "Options", "menu_options\n");
MC_AddConsoleCommand (mainm, 64, 48, "Quit", "menu_quit\n");
return; return;
} }
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 4, "gfx/qplaque.lmp");
MC_AddPicture(mainm, (320-p->width)/2, 4, "gfx/ttl_main.lmp"); MC_AddPicture(mainm, (320-p->width)/2, 4, "gfx/ttl_main.lmp");
MC_AddPicture(mainm, 72, 32, "gfx/mainmenu.lmp"); MC_AddPicture(mainm, 72, 32, "gfx/mainmenu.lmp");

View file

@ -748,7 +748,7 @@ char *Media_NextTrack(void)
//Avi files are specific to windows. Bit of a bummer really. //Avi files are specific to windows. Bit of a bummer really.
#if defined(_WIN32) && !defined(MINGW) #if defined(_WIN32) && !defined(__GNUC__)
#define WINAVI #define WINAVI
#endif #endif
@ -1318,7 +1318,7 @@ void Media_RecordFrame (void)
{ {
case CT_AVI: case CT_AVI:
//ask gl for it //ask gl for it
glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer ); qglReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer );
// swap rgb to bgr // swap rgb to bgr
c = glwidth*glheight*3; c = glwidth*glheight*3;
@ -1351,11 +1351,11 @@ skipframe:
if (y < scr_con_current) y = scr_con_current; if (y < scr_con_current) y = scr_con_current;
if (y > vid.height-8) if (y > vid.height-8)
y = vid.height-8; y = vid.height-8;
glColor4f(1, 0, 0, sin(realtime*4)/4+0.75); qglColor4f(1, 0, 0, sin(realtime*4)/4+0.75);
glEnable(GL_BLEND); qglEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
GL_TexEnv(GL_MODULATE); GL_TexEnv(GL_MODULATE);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Draw_String((strlen(capturemessage.string)+1)*8, y, "RECORDING"); Draw_String((strlen(capturemessage.string)+1)*8, y, "RECORDING");
} }
} }

View file

@ -112,6 +112,7 @@ typedef struct {
qboolean M_Audio_Key (int key, struct menu_s *menu) qboolean M_Audio_Key (int key, struct menu_s *menu)
{ {
int i, x, y;
audiomenuinfo_t *info = menu->data; audiomenuinfo_t *info = menu->data;
soundcardinfo_t *sc; soundcardinfo_t *sc;
for (sc = sndcardinfo; sc; sc = sc->next) for (sc = sndcardinfo; sc; sc = sc->next)
@ -142,6 +143,15 @@ qboolean M_Audio_Key (int key, struct menu_s *menu)
{ {
info->testsoundsource->common.posx-=10; info->testsoundsource->common.posx-=10;
} }
if (key >= '0' && key <= '5')
{
i = key - '0';
x = info->testsoundsource->common.posx - 320/2;
y = info->testsoundsource->common.posy - 200/2;
sc->yaw[i] = (-atan2 (y,x)*180/M_PI) - 90;
sc->dist[i] = 50/sqrt(x*x+y*y);
}
menu->selecteditem = NULL; menu->selecteditem = NULL;
@ -170,17 +180,19 @@ void M_Audio_StartSound (struct menu_s *menu)
for (i = 0; i < sc->sn.numchannels; i++) for (i = 0; i < sc->sn.numchannels; i++)
{ {
info->speaker[i]->common.posx = 320/2 - sin(sc->yaw[i]*M_PI/180) * 50; info->speaker[i]->common.posx = 320/2 - sin(sc->yaw[i]*M_PI/180) * 50/sc->dist[i];
info->speaker[i]->common.posy = 200/2 - cos(sc->yaw[i]*M_PI/180) * 50; info->speaker[i]->common.posy = 200/2 - cos(sc->yaw[i]*M_PI/180) * 50/sc->dist[i];
} }
for (; i < 6; i++)
info->speaker[i]->common.posy = -100;
if (lasttime+0.5 < Sys_DoubleTime()) if (lasttime+0.5 < Sys_DoubleTime())
{ {
lasttime = Sys_DoubleTime(); lasttime = Sys_DoubleTime();
org[0] = listener_origin[0] + listener_right[0]*(info->testsoundsource->common.posx-320/2) + listener_forward[0]*(info->testsoundsource->common.posy-200/2); org[0] = listener_origin[0] + 2*(listener_right[0]*(info->testsoundsource->common.posx-320/2) + listener_forward[0]*(info->testsoundsource->common.posy-200/2));
org[1] = listener_origin[1] + listener_right[1]*(info->testsoundsource->common.posx-320/2) + listener_forward[1]*(info->testsoundsource->common.posy-200/2); org[1] = listener_origin[1] + 2*(listener_right[1]*(info->testsoundsource->common.posx-320/2) + listener_forward[1]*(info->testsoundsource->common.posy-200/2));
org[2] = listener_origin[2] + listener_right[2]*(info->testsoundsource->common.posx-320/2) + listener_forward[2]*(info->testsoundsource->common.posy-200/2); org[2] = listener_origin[2] + 2*(listener_right[2]*(info->testsoundsource->common.posx-320/2) + listener_forward[2]*(info->testsoundsource->common.posy-200/2));
S_StartSound(-1, 0, S_PrecacheSound("misc/menu1.wav"), org, 1, 4); S_StartSound(-2, 0, S_PrecacheSound("player/pain3.wav"), org, 1, 4);
} }
} }

View file

@ -16,9 +16,7 @@ qboolean M_Script_Key (int key, menu_t *menu)
if (key >= '0' && key <= '9') if (key >= '0' && key <= '9')
{ {
if (key == '0') //specal case so that "hello" < "0"... (plus matches impulses) if (key == '0') //specal case so that "hello" < "0"... (plus matches impulses)
Cbuf_AddText(va("set option 10\n%s\n", menualias.string), RESTRICT_LOCAL); Cbuf_AddText(va("set option %i\n%s\n", key-'0'+1, menualias.string), RESTRICT_LOCAL);
else
Cbuf_AddText(va("set option %c\n%s\n", key, menualias.string), RESTRICT_LOCAL);
return true; return true;
} }
return false; return false;

View file

@ -796,6 +796,7 @@ void M_Menu_Quit_f (void)
void M_Menu_MediaFiles_f (void); void M_Menu_MediaFiles_f (void);
void M_Menu_FPS_f (void); void M_Menu_FPS_f (void);
void M_Menu_Particles_f (void); void M_Menu_Particles_f (void);
void M_Menu_Audio_Speakers_f (void);
static qboolean internalmenusregistered; static qboolean internalmenusregistered;
void M_Init_Internal (void) void M_Init_Internal (void)
{ {
@ -834,6 +835,7 @@ void M_Init_Internal (void)
Cmd_AddRemCommand ("menu_options", M_Menu_Options_f); Cmd_AddRemCommand ("menu_options", M_Menu_Options_f);
Cmd_AddRemCommand ("menu_video", M_Menu_Video_f); Cmd_AddRemCommand ("menu_video", M_Menu_Video_f);
Cmd_AddRemCommand ("menu_audio", M_Menu_Audio_f); Cmd_AddRemCommand ("menu_audio", M_Menu_Audio_f);
Cmd_AddRemCommand ("menu_speakers", M_Menu_Audio_Speakers_f);
Cmd_AddRemCommand ("menu_fps", M_Menu_FPS_f); Cmd_AddRemCommand ("menu_fps", M_Menu_FPS_f);
Cmd_AddRemCommand ("menu_particles", M_Menu_Particles_f); Cmd_AddRemCommand ("menu_particles", M_Menu_Particles_f);
} }

View file

@ -612,18 +612,18 @@ void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
glColor4f(rgb[0], rgb[1], rgb[2], alpha); qglColor4f(rgb[0], rgb[1], rgb[2], alpha);
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
glBegin(GL_QUADS); qglBegin(GL_QUADS);
glVertex2f(pos[0], pos[1]); qglVertex2f(pos[0], pos[1]);
glVertex2f(pos[0]+size[0], pos[1]); qglVertex2f(pos[0]+size[0], pos[1]);
glVertex2f(pos[0]+size[0], pos[1]+size[1]); qglVertex2f(pos[0]+size[0], pos[1]+size[1]);
glVertex2f(pos[0], pos[1]+size[1]); qglVertex2f(pos[0], pos[1]+size[1]);
glEnd(); qglEnd();
glEnable(GL_TEXTURE_2D); qglEnable(GL_TEXTURE_2D);
} }
#endif #endif
G_FLOAT(OFS_RETURN) = 1; G_FLOAT(OFS_RETURN) = 1;
@ -1267,8 +1267,8 @@ void MP_Draw(void)
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
GL_TexEnv(GL_MODULATE); GL_TexEnv(GL_MODULATE);
glDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
glEnable(GL_BLEND); qglEnable(GL_BLEND);
} }
#endif #endif

View file

@ -2418,17 +2418,17 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
} }
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glEnable(GL_TEXTURE_2D); qglEnable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_FLAT); qglShadeModel(GL_FLAT);
glBegin(GL_QUADS); qglBegin(GL_QUADS);
} }
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1] scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
@ -2439,7 +2439,7 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
else else
scale = 0.25 + scale * 0.001; scale = 0.25 + scale * 0.001;
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
@ -2454,14 +2454,14 @@ void GL_DrawTexturedParticle(particle_t *p, part_type_t *type)
x = 0; x = 0;
y = scale; y = scale;
} }
glTexCoord2f(0,0); qglTexCoord2f(0,0);
glVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]); qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
glTexCoord2f(0,1); qglTexCoord2f(0,1);
glVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]); qglVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]);
glTexCoord2f(1,1); qglTexCoord2f(1,1);
glVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]); qglVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]);
glTexCoord2f(1,0); qglTexCoord2f(1,0);
glVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]); qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
} }
@ -2475,17 +2475,17 @@ void GL_DrawSketchParticle(particle_t *p, part_type_t *type)
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
// if (type->blendmode == BM_ADD) //addative // if (type->blendmode == BM_ADD) //addative
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // glBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// else // else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
glBegin(GL_LINES); qglBegin(GL_LINES);
} }
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1] scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
@ -2496,7 +2496,7 @@ void GL_DrawSketchParticle(particle_t *p, part_type_t *type)
else else
scale = 0.25 + scale * 0.001; scale = 0.25 + scale * 0.001;
glColor4f ( p->rgb[0]/2, qglColor4f (p->rgb[0]/2,
p->rgb[1]/2, p->rgb[1]/2,
p->rgb[2]/2, p->rgb[2]/2,
p->alpha*2); p->alpha*2);
@ -2513,10 +2513,10 @@ void GL_DrawSketchParticle(particle_t *p, part_type_t *type)
x = 0; x = 0;
y = scale; y = scale;
} }
glVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]); qglVertex3f (p->org[0] - x*pright[0] - y*pup[0], p->org[1] - x*pright[1] - y*pup[1], p->org[2] - x*pright[2] - y*pup[2]);
glVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]); qglVertex3f (p->org[0] + x*pright[0] + y*pup[0], p->org[1] + x*pright[1] + y*pup[1], p->org[2] + x*pright[2] + y*pup[2]);
glVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]); qglVertex3f (p->org[0] + y*pright[0] - x*pup[0], p->org[1] + y*pright[1] - x*pup[1], p->org[2] + y*pright[2] - x*pup[2]);
glVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]); qglVertex3f (p->org[0] - y*pright[0] + x*pup[0], p->org[1] - y*pright[1] + x*pup[1], p->org[2] - y*pright[2] + x*pup[2]);
} }
void GL_DrawTrifanParticle(particle_t *p, part_type_t *type) void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
@ -2525,19 +2525,19 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
vec3_t v; vec3_t v;
float scale; float scale;
glEnd(); qglEnd();
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
} }
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1] scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
@ -2551,13 +2551,13 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
if ((p->vel[0]*p->vel[0]+p->vel[1]*p->vel[1]+p->vel[2]*p->vel[2])*2*scale > 30*30) if ((p->vel[0]*p->vel[0]+p->vel[1]*p->vel[1]+p->vel[2]*p->vel[2])*2*scale > 30*30)
scale = 1+1/30/Length(p->vel)*2;*/ scale = 1+1/30/Length(p->vel)*2;*/
glBegin (GL_TRIANGLE_FAN); qglBegin (GL_TRIANGLE_FAN);
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
glVertex3fv (p->org); qglVertex3fv (p->org);
glColor4f ( p->rgb[0]/2, qglColor4f (p->rgb[0]/2,
p->rgb[1]/2, p->rgb[1]/2,
p->rgb[2]/2, p->rgb[2]/2,
0); 0);
@ -2566,10 +2566,10 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type)
v[0] = p->org[0] - p->vel[0]*scale + vright[0]*cost[i%7]*p->scale + vup[0]*sint[i%7]*p->scale; v[0] = p->org[0] - p->vel[0]*scale + vright[0]*cost[i%7]*p->scale + vup[0]*sint[i%7]*p->scale;
v[1] = p->org[1] - p->vel[1]*scale + vright[1]*cost[i%7]*p->scale + vup[1]*sint[i%7]*p->scale; v[1] = p->org[1] - p->vel[1]*scale + vright[1]*cost[i%7]*p->scale + vup[1]*sint[i%7]*p->scale;
v[2] = p->org[2] - p->vel[2]*scale + vright[2]*cost[i%7]*p->scale + vup[2]*sint[i%7]*p->scale; v[2] = p->org[2] - p->vel[2]*scale + vright[2]*cost[i%7]*p->scale + vup[2]*sint[i%7]*p->scale;
glVertex3fv (v); qglVertex3fv (v);
} }
glEnd (); qglEnd ();
glBegin (GL_LINES); qglBegin (GL_LINES);
} }
void GL_DrawSparkedParticle(particle_t *p, part_type_t *type) void GL_DrawSparkedParticle(particle_t *p, part_type_t *type)
@ -2577,30 +2577,30 @@ void GL_DrawSparkedParticle(particle_t *p, part_type_t *type)
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
glBegin(GL_LINES); qglBegin(GL_LINES);
} }
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
glVertex3f (p->org[0], p->org[1], p->org[2]); qglVertex3f (p->org[0], p->org[1], p->org[2]);
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
0); 0);
glVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10); qglVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10);
} }
@ -2609,30 +2609,30 @@ void GL_DrawSketchSparkParticle(particle_t *p, part_type_t *type)
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
glBegin(GL_LINES); qglBegin(GL_LINES);
} }
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
glVertex3f (p->org[0], p->org[1], p->org[2]); qglVertex3f (p->org[0], p->org[1], p->org[2]);
glColor4f ( p->rgb[0], qglColor4f (p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
0); 0);
glVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10); qglVertex3f (p->org[0]-p->vel[0]/10, p->org[1]-p->vel[1]/10, p->org[2]-p->vel[2]/10);
} }
void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type) void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
@ -2660,36 +2660,36 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glEnable(GL_TEXTURE_2D); qglEnable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
glBegin(GL_QUADS); qglBegin(GL_QUADS);
} }
glColor4f(q->rgb[0], qglColor4f(q->rgb[0],
q->rgb[1], q->rgb[1],
q->rgb[2], q->rgb[2],
q->alpha); q->alpha);
// glBegin(GL_LINE_LOOP); // qglBegin(GL_LINE_LOOP);
VectorSubtract(r_refdef.vieworg, q->org, v); VectorSubtract(r_refdef.vieworg, q->org, v);
VectorNormalize(v); VectorNormalize(v);
CrossProduct(c->dir, v, cr); CrossProduct(c->dir, v, cr);
ts = (c->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754; ts = (c->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754;
VectorMA(q->org, -q->scale, cr, point); VectorMA(q->org, -q->scale, cr, point);
glTexCoord2f(ts, 0); qglTexCoord2f(ts, 0);
glVertex3fv(point); qglVertex3fv(point);
VectorMA(q->org, q->scale, cr, point); VectorMA(q->org, q->scale, cr, point);
glTexCoord2f(ts, 1); qglTexCoord2f(ts, 1);
glVertex3fv(point); qglVertex3fv(point);
glColor4f(p->rgb[0], qglColor4f(p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
@ -2700,12 +2700,12 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
ts = (b->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754; ts = (b->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754;
VectorMA(p->org, p->scale, cr, point); VectorMA(p->org, p->scale, cr, point);
glTexCoord2f(ts, 1); qglTexCoord2f(ts, 1);
glVertex3fv(point); qglVertex3fv(point);
VectorMA(p->org, -p->scale, cr, point); VectorMA(p->org, -p->scale, cr, point);
glTexCoord2f(ts, 0); qglTexCoord2f(ts, 0);
glVertex3fv(point); qglVertex3fv(point);
// glEnd(); // qglEnd();
} }
void GL_DrawParticleBeam_Untextured(beamseg_t *b, part_type_t *type) void GL_DrawParticleBeam_Untextured(beamseg_t *b, part_type_t *type)
@ -2734,20 +2734,20 @@ void GL_DrawParticleBeam_Untextured(beamseg_t *b, part_type_t *type)
if (lasttype != type) if (lasttype != type)
{ {
lasttype = type; lasttype = type;
glEnd(); qglEnd();
glDisable(GL_TEXTURE_2D); qglDisable(GL_TEXTURE_2D);
GL_Bind(type->texturenum); GL_Bind(type->texturenum);
if (type->blendmode == BM_ADD) //addative if (type->blendmode == BM_ADD) //addative
glBlendFunc(GL_SRC_ALPHA, GL_ONE); qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
// else if (type->blendmode == BM_SUBTRACT) //subtractive // else if (type->blendmode == BM_SUBTRACT) //subtractive
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else else
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glShadeModel(GL_SMOOTH); qglShadeModel(GL_SMOOTH);
glBegin(GL_QUADS); qglBegin(GL_QUADS);
} }
// glBegin(GL_LINE_LOOP); // qglBegin(GL_LINE_LOOP);
VectorSubtract(r_refdef.vieworg, q->org, v); VectorSubtract(r_refdef.vieworg, q->org, v);
VectorNormalize(v); VectorNormalize(v);
CrossProduct(c->dir, v, cr); CrossProduct(c->dir, v, cr);
@ -2769,55 +2769,55 @@ void GL_DrawParticleBeam_Untextured(beamseg_t *b, part_type_t *type)
//back in //back in
//front in //front in
//front out //front out
glColor4f(q->rgb[0], qglColor4f(q->rgb[0],
q->rgb[1], q->rgb[1],
q->rgb[2], q->rgb[2],
0); 0);
glVertex3fv(point[0]); qglVertex3fv(point[0]);
glColor4f(q->rgb[0], qglColor4f(q->rgb[0],
q->rgb[1], q->rgb[1],
q->rgb[2], q->rgb[2],
q->alpha); q->alpha);
glVertex3fv(q->org); qglVertex3fv(q->org);
glColor4f(p->rgb[0], qglColor4f(p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
glVertex3fv(p->org); qglVertex3fv(p->org);
glColor4f(p->rgb[0], qglColor4f(p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
0); 0);
glVertex3fv(point[3]); qglVertex3fv(point[3]);
//front out //front out
//front in //front in
//back in //back in
//back out //back out
glColor4f(p->rgb[0], qglColor4f(p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
0); 0);
glVertex3fv(point[2]); qglVertex3fv(point[2]);
glColor4f(p->rgb[0], qglColor4f(p->rgb[0],
p->rgb[1], p->rgb[1],
p->rgb[2], p->rgb[2],
p->alpha); p->alpha);
glVertex3fv(p->org); qglVertex3fv(p->org);
glColor4f(q->rgb[0], qglColor4f(q->rgb[0],
q->rgb[1], q->rgb[1],
q->rgb[2], q->rgb[2],
q->alpha); q->alpha);
glVertex3fv(q->org); qglVertex3fv(q->org);
glColor4f(q->rgb[0], qglColor4f(q->rgb[0],
q->rgb[1], q->rgb[1],
q->rgb[2], q->rgb[2],
0); 0);
glVertex3fv(point[1]); qglVertex3fv(point[1]);
// glEnd(); // qglEnd();
} }
#endif #endif
@ -3240,14 +3240,14 @@ void R_DrawParticles (void)
if (qrenderer == QR_OPENGL) if (qrenderer == QR_OPENGL)
{ {
extern cvar_t r_drawflat; extern cvar_t r_drawflat;
glDepthMask(0); qglDepthMask(0);
glDisable(GL_ALPHA_TEST); qglDisable(GL_ALPHA_TEST);
glEnable (GL_BLEND); qglEnable (GL_BLEND);
GL_TexEnv(GL_MODULATE); GL_TexEnv(GL_MODULATE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS); qglBegin(GL_QUADS);
if (r_drawflat.value == 2) if (r_drawflat.value == 2)
DrawParticleTypes(GL_DrawSketchParticle, GL_DrawSketchSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);//GL_DrawParticleBeam_Sketched, GL_DrawParticleBeam_Sketched); DrawParticleTypes(GL_DrawSketchParticle, GL_DrawSketchSparkParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);//GL_DrawParticleBeam_Sketched, GL_DrawParticleBeam_Sketched);
@ -3256,10 +3256,10 @@ void R_DrawParticles (void)
else else
DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawSparkedParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured); DrawParticleTypes(GL_DrawTexturedParticle, GL_DrawSparkedParticle, GL_DrawParticleBeam_Textured, GL_DrawParticleBeam_Untextured);
glEnd(); qglEnd();
glEnable(GL_TEXTURE_2D); qglEnable(GL_TEXTURE_2D);
glDepthMask(1); qglDepthMask(1);
return; return;
} }
#endif #endif

View file

@ -177,6 +177,8 @@ cvar_t scr_chatmodecvar = {"scr_chatmode", "0"};
#ifdef Q3SHADERS #ifdef Q3SHADERS
extern cvar_t r_vertexlight; extern cvar_t r_vertexlight;
cvar_t gl_shadeq1 = {"gl_shadeq1", "0", NULL, CVAR_CHEAT}; //FIXME: :(
cvar_t gl_shadeq1_name = {"gl_shadeq1_name", "*"};
#endif #endif
cvar_t r_bloodstains = {"r_bloodstains", "1"}; cvar_t r_bloodstains = {"r_bloodstains", "1"};
@ -335,6 +337,8 @@ void GLRenderer_Init(void)
Cvar_Register (&gl_schematics, GLRENDEREROPTIONS); Cvar_Register (&gl_schematics, GLRENDEREROPTIONS);
#ifdef Q3SHADERS #ifdef Q3SHADERS
Cvar_Register (&r_vertexlight, GLRENDEREROPTIONS); Cvar_Register (&r_vertexlight, GLRENDEREROPTIONS);
Cvar_Register (&gl_shadeq1, GLRENDEREROPTIONS);
Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS);
#endif #endif
} }
#endif #endif

View file

@ -344,7 +344,9 @@ void S_Control_f (void)
soundcardinfo_t *sc; soundcardinfo_t *sc;
card = atoi(command+4); card = atoi(command+4);
for (i = 0, sc = sndcardinfo; i < card && sc; i++,sc=sc->next); for (i = 0, sc = sndcardinfo; i < card && sc; i++,sc=sc->next)
;
if (!sc) if (!sc)
{ {
Con_Printf("Sound card %i is invalid (try resetting first)\n", card); Con_Printf("Sound card %i is invalid (try resetting first)\n", card);
@ -700,28 +702,21 @@ SND_Spatialize
*/ */
void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch) void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
{ {
vec_t dot, dotforward, dotup; vec_t dotright, dotforward, dotup;
vec_t dist; vec_t dist;
vec_t scale[MAXSOUNDCHANNELS]; vec_t scale;
vec3_t source_vec; vec3_t source_vec;
sfx_t *snd; sfx_t *snd;
int i;
// anything coming from the view entity will allways be full volume // anything coming from the view entity will allways be full volume
if (ch->entnum == -1 || ch->entnum == cl.playernum[0]+1) if (ch->entnum == -1 || ch->entnum == cl.playernum[0]+1)
{ {
ch->vol[0] = ch->master_vol; for (i = 0; i < sc->sn.numchannels; i++)
ch->vol[1] = ch->master_vol; {
ch->vol[2] = ch->master_vol; ch->vol[i] = ch->master_vol;
ch->vol[3] = ch->master_vol; ch->delay[i] = 0;
ch->vol[4] = ch->master_vol; }
ch->vol[5] = ch->master_vol;
ch->delay[0] = 0;
ch->delay[1] = 0;
ch->delay[2] = 0;
ch->delay[3] = 0;
ch->delay[4] = 0;
ch->delay[5] = 0;
return; return;
} }
@ -731,71 +726,22 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
dist = VectorNormalize(source_vec) * ch->dist_mult; dist = VectorNormalize(source_vec) * ch->dist_mult;
dot = DotProduct(listener_right, source_vec); dotright = DotProduct(listener_right, source_vec);
dotforward = -DotProduct(listener_forward, source_vec); dotforward = DotProduct(listener_forward, source_vec);
dotup = DotProduct(listener_up, source_vec); dotup = DotProduct(listener_up, source_vec);
if (sc->sn.numchannels == 1) for (i = 0; i < sc->sn.numchannels; i++)
{ {
scale[0] = 1.0; scale = 1 + (dotright*sin(sc->yaw[i]*M_PI/180) + dotforward*cos(sc->yaw[i]*M_PI/180));// - dotup*cos(sc->pitch[0])*2;
scale[1] = 1.0; scale = (1.0 - dist) * scale * sc->dist[i];
scale[2] = 1.0; // if (scale < 0.5)
scale[3] = 1.0; // scale = 0.5;
scale[4] = 1.0; ch->vol[i] = (int) (ch->master_vol * scale);
scale[5] = 1.0; if (ch->vol[i] < 0)
ch->delay[0] = 0; ch->vol[i] = 0;
ch->delay[1] = 0;
ch->delay[2] = 0; ch->delay[i] = 0;//(scale[0]-1)*1024;
ch->delay[3] = 0;
ch->delay[4] = 0;
ch->delay[5] = 0;
} }
else
{
scale[0] = 2.0 + dot*sin(sc->yaw[0]*M_PI/180) + dotforward*cos(sc->yaw[0]*M_PI/180);// - dotup*cos(sc->pitch[0])*2;
scale[1] = 2.0 + dot*sin(sc->yaw[1]*M_PI/180) + dotforward*cos(sc->yaw[1]*M_PI/180);// - dotup*cos(sc->pitch[1])*2;
scale[2] = 2.0 + dot*sin(sc->yaw[2]*M_PI/180) + dotforward*cos(sc->yaw[2]*M_PI/180);// - dotup*cos(sc->pitch[2])*2;
scale[3] = 2.0 + dot*sin(sc->yaw[3]*M_PI/180) + dotforward*cos(sc->yaw[3]*M_PI/180);// - dotup*cos(sc->pitch[3])*2;
scale[4] = 2.0 + dot*sin(sc->yaw[4]*M_PI/180) + dotforward*cos(sc->yaw[4]*M_PI/180);// - dotup*cos(sc->pitch[4])*2;
scale[5] = 2.0 + dot*sin(sc->yaw[5]*M_PI/180) + dotforward*cos(sc->yaw[5]*M_PI/180);// - dotup*cos(sc->pitch[5])*2;
ch->delay[0] = 0;//(scale[0]-1)*1024;
ch->delay[1] = 0;//(scale[1]-1)*1024;
ch->delay[2] = 0;//(scale[2]-1)*1024;
ch->delay[3] = 0;//(scale[3]-1)*1024;
ch->delay[4] = 0;//(scale[4]-1)*1024;
ch->delay[5] = 0;//(scale[5]-1)*1024;
}
// add in distance effect
scale[0] = (1.0 - dist) * scale[0] * sc->dist[0]; //default fl
ch->vol[0] = (int) (ch->master_vol * scale[0]);
if (ch->vol[0] < 0)
ch->vol[0] = 0;
scale[1] = (1.0 - dist) * scale[1] * sc->dist[1]; //fr
ch->vol[1] = (int) (ch->master_vol * scale[1]);
if (ch->vol[1] < 0)
ch->vol[1] = 0;
scale[2] = (1.0 - dist) * scale[2] * sc->dist[2]; //rl
ch->vol[2] = (int) (ch->master_vol * scale[2]);
if (ch->vol[2] < 0)
ch->vol[2] = 0;
scale[3] = (1.0 - dist) * scale[3] * sc->dist[3]; //rr
ch->vol[3] = (int) (ch->master_vol * scale[3]);
if (ch->vol[3] < 0)
ch->vol[3] = 0;
scale[4] = (1.0 - dist) * scale[4] * sc->dist[4];
ch->vol[4] = (int) (ch->master_vol * scale[4]);
if (ch->vol[4] < 0)
ch->vol[4] = 0;
scale[5] = (1.0 - dist) * scale[5] * sc->dist[5];
ch->vol[5] = (int) (ch->master_vol * scale[5]);
if (ch->vol[5] < 0)
ch->vol[5] = 0;
} }
// ======================================================================= // =======================================================================

View file

@ -200,7 +200,7 @@ void VARGS Sys_DebugLog(char *file, char *fmt, ...)
send(sock, data, strlen(data), 0); send(sock, data, strlen(data), 0);
} }
#endif #endif
fd = fopen(file, "wb"); fd = fopen(file, "ab");
fprintf(fd, "%s", data); fprintf(fd, "%s", data);
fclose(fd); fclose(fd);
}; };

View file

@ -79,6 +79,8 @@ cvar_t crosshairsize = {"crosshairsize", "8", NULL, CVAR_ARCHIVE};
cvar_t cl_crossx = {"cl_crossx", "0", NULL, CVAR_ARCHIVE}; cvar_t cl_crossx = {"cl_crossx", "0", NULL, CVAR_ARCHIVE};
cvar_t cl_crossy = {"cl_crossy", "0", NULL, CVAR_ARCHIVE}; cvar_t cl_crossy = {"cl_crossy", "0", NULL, CVAR_ARCHIVE};
cvar_t crosshaircorrect = {"crosshaircorrect", "0", NULL, CVAR_SEMICHEAT}; cvar_t crosshaircorrect = {"crosshaircorrect", "0", NULL, CVAR_SEMICHEAT};
cvar_t crosshairimage = {"crosshairimage", ""};
cvar_t crosshairalpha = {"crosshairalpha", ""};
cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100"}; cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100"};
@ -91,6 +93,8 @@ cvar_t v_suitcshift = {"v_suitcshift", "0"};
cvar_t v_ringcshift = {"v_ringcshift", "0"}; cvar_t v_ringcshift = {"v_ringcshift", "0"};
cvar_t v_pentcshift = {"v_pentcshift", "0"}; cvar_t v_pentcshift = {"v_pentcshift", "0"};
cvar_t v_viewheight = {"v_viewheight", "0"};
extern cvar_t cl_chasecam; extern cvar_t cl_chasecam;
float v_dmg_time[MAX_SPLITS], v_dmg_roll[MAX_SPLITS], v_dmg_pitch[MAX_SPLITS]; float v_dmg_time[MAX_SPLITS], v_dmg_roll[MAX_SPLITS], v_dmg_pitch[MAX_SPLITS];
@ -1059,7 +1063,14 @@ void V_CalcRefdef (int pnum)
// view is the weapon model (only visible from inside body) // view is the weapon model (only visible from inside body)
view = &cl.viewent[pnum]; view = &cl.viewent[pnum];
bob = V_CalcBob (pnum); if (v_viewheight.value < -7)
bob=-7;
else if (v_viewheight.value > 4)
bob=4;
else if (v_viewheight.value)
bob=v_viewheight.value;
else
bob = V_CalcBob (pnum);
// refresh position from simulated origin // refresh position from simulated origin
VectorCopy (cl.simorg[pnum], r_refdef.vieworg); VectorCopy (cl.simorg[pnum], r_refdef.vieworg);
@ -1106,17 +1117,14 @@ void V_CalcRefdef (int pnum)
CalcGunAngle (pnum); CalcGunAngle (pnum);
VectorCopy (cl.simorg[pnum], view->origin); VectorCopy (r_refdef.vieworg, view->origin);
view->origin[2] += cl.viewheight[pnum];
view->origin[2] += cl.crouch[pnum];
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
view->origin[i] += forward[i]*bob*0.4; view->origin[i] += forward[i]*bob*0.4;
// view->origin[i] += right[i]*bob*0.4; // view->origin[i] += right[i]*sin(cl.time*5.5342452354235)*0.1;
// view->origin[i] += up[i]*bob*0.8; // view->origin[i] += up[i]*bob*0.8;
} }
view->origin[2] += bob;
// fudge position around to keep amount of weapon visible // fudge position around to keep amount of weapon visible
// roughly equal with different FOV // roughly equal with different FOV
@ -1455,10 +1463,14 @@ void V_Init (void)
Cvar_Register (&v_bonusflash, VIEWVARS); Cvar_Register (&v_bonusflash, VIEWVARS);
Cvar_Register (&v_viewheight, VIEWVARS);
Cvar_Register (&crosshaircolor, VIEWVARS); Cvar_Register (&crosshaircolor, VIEWVARS);
Cvar_Register (&crosshair, VIEWVARS); Cvar_Register (&crosshair, VIEWVARS);
Cvar_Register (&crosshairsize, VIEWVARS); Cvar_Register (&crosshairsize, VIEWVARS);
Cvar_Register (&crosshaircorrect, VIEWVARS); Cvar_Register (&crosshaircorrect, VIEWVARS);
Cvar_Register (&crosshairimage, VIEWVARS);
Cvar_Register (&crosshairalpha, VIEWVARS);
Cvar_Register (&cl_crossx, VIEWVARS); Cvar_Register (&cl_crossx, VIEWVARS);
Cvar_Register (&cl_crossy, VIEWVARS); Cvar_Register (&cl_crossy, VIEWVARS);
Cvar_Register (&gl_cshiftpercent, VIEWVARS); Cvar_Register (&gl_cshiftpercent, VIEWVARS);

View file

@ -824,21 +824,20 @@ static void TP_InitMacros(void)
//ones added by Spike, for fuhquake compatability //ones added by Spike, for fuhquake compatability
Cmd_AddMacro("connectiontype", Macro_ConnectionType); Cmd_AddMacro("connectiontype", Macro_ConnectionType);
Cmd_AddMacro("demoplayback", Macro_demoplayback); Cmd_AddMacro("demoplayback", Macro_demoplayback);
/* Cmd_AddMacro("need", Macro_Need);
$droploc Cmd_AddMacro("point", Macro_PointName);
$droptime Cmd_AddMacro("pointatloc", Macro_PointNameAtLocation);
$ledpoint Cmd_AddMacro("pointloc", Macro_PointLocation);
$ledstatus
$matchname // Cmd_AddMacro("droploc", Macro_LastDrop);
$matchstatus // Cmd_AddMacro("droptime", Macro_LastDropTime);
$matchtype // Cmd_AddMacro("ledpoint", Macro_Point_LED);
$mp3info // Cmd_AddMacro("ledstatus", Macro_MyStatus_LED);
$need // Cmd_AddMacro("matchname", Macro_Match_Name);
$point // Cmd_AddMacro("matchstatus", Macro_Match_Status);
$pointatloc // Cmd_AddMacro("matchtype", Macro_Match_Type);
$pointloc // Cmd_AddMacro("mp3info", );
$triggermatch // Cmd_AddMacro("triggermatch", Macro_LastTrigger_Match);
*/
} }
#define MAX_MACRO_STRING 1024 #define MAX_MACRO_STRING 1024