Tweeks to the d3d renderer. Supports various shader features now. Other changes/fixes/breakages also.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3531 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-05-01 22:47:47 +00:00
parent 02c692bb0e
commit e6f90bea14
53 changed files with 4783 additions and 3787 deletions

View File

@ -2,8 +2,6 @@
//#include "cg_public.h"
#ifdef VM_CG
#ifdef GLQUAKE
#include "shader.h"
#if 1
@ -31,7 +29,6 @@ extern int mod_numknown;
#define VM_FROMMHANDLE(a) ((a&&((unsigned int)a)<=mod_numknown)?mod_known+a-1:NULL)
#define VM_TOMHANDLE(a) (a?a-mod_known+1:0)
extern shader_t r_shaders[];
#define VM_FROMSHANDLE(a) (a?r_shaders+a-1:NULL)
#define VM_TOSHANDLE(a) (a?a-r_shaders+1:0)
@ -771,18 +768,14 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
case CG_R_REGISTERSHADER:
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else if (qrenderer == QR_OPENGL)
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
//FIXME: 64bit else
// VM_LONG(ret) = VM_TOHANDLE(Draw_SafeCachePic(VM_POINTER(arg[0])));
break;
case CG_R_REGISTERSHADERNOMIP:
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else if (qrenderer == QR_OPENGL)
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
//FIXME: 64bit else
// VM_LONG(ret) = VM_TOHANDLE(Draw_SafeCachePic(VM_POINTER(arg[0])));
break;
case CG_R_CLEARSCENE: //clear scene (not rtlights, only dynamic ones)
@ -806,7 +799,7 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
}
break;
case CG_R_RENDERSCENE: //render scene
GLR_PushDlights();
R_PushDlights();
VQ3_RenderView(VM_POINTER(arg[0]));
break;
@ -1085,11 +1078,8 @@ static int EXPORT_FN CG_SystemCalls(int arg, ...)
return CG_SystemCallsEx(NULL, (unsigned)~0, arg, args);
}
#endif
int CG_Refresh(void)
{
#ifdef GLQUAKE
int time;
if (!cgvm)
return false;
@ -1100,16 +1090,12 @@ int CG_Refresh(void)
Draw_ImageColours(1, 1, 1, 1);
return true;
#else
return false;
#endif
}
void CG_Stop (void)
{
#ifdef GLQUAKE
keycatcher &= ~2;
if (cgvm)
{
@ -1118,7 +1104,6 @@ void CG_Stop (void)
VM_fcloseall(1);
cgvm = NULL;
}
#endif
}
void CG_Start (void)
@ -1130,7 +1115,6 @@ void CG_Start (void)
return;
}
#if defined(GLQUAKE) || defined(DIRECT3D)
if (!Draw_SafeCachePic) //no renderer loaded
{
CG_Stop();
@ -1158,21 +1142,14 @@ void CG_Start (void)
SCR_EndLoadingPlaque();
Host_EndGame("Failed to initialise cgame module\n");
}
#else
Host_EndGame("Unable to connect to q3 servers without opengl.\n");
#endif
}
qboolean CG_Command(void)
{
#ifdef GLQUAKE
if (!cgvm)
return false;
Con_DPrintf("CG_Command: %s %s\n", Cmd_Argv(0), Cmd_Args());
return VM_Call(cgvm, CG_CONSOLE_COMMAND);
#else
return false;
#endif
}
void CG_Command_f(void)

View File

@ -3574,26 +3574,12 @@ void Host_Init (quakeparms_t *parms)
Key_Init ();
Con_Init ();
M_Init ();
//fixme: this difference needs to go.
#ifndef _WIN32
IN_Init ();
CDAudio_Init ();
S_Init ();
cls.state = ca_disconnected;
Sbar_Init ();
CL_Init ();
#else
S_Init ();
cls.state = ca_disconnected;
CDAudio_Init ();
Sbar_Init ();
CL_Init ();
IN_Init ();
#endif
TranslateInit();
#ifndef CLIENTONLY
@ -3634,7 +3620,6 @@ void Host_FinishInit(void)
int qrc, hrc, def;
#endif
Cbuf_AddText ("cl_warncmd 0\n", RESTRICT_LOCAL);
Cbuf_AddText ("+mlook\n", RESTRICT_LOCAL); //fixme: this is bulky, only exec one of these.
@ -3660,7 +3645,10 @@ void Host_FinishInit(void)
Cbuf_AddText ("exec fte.cfg\n", RESTRICT_LOCAL);
Cbuf_AddText ("cl_warncmd 1\n", RESTRICT_LOCAL); //and then it's allowed to start moaning.
{
extern cvar_t com_parseutf8;
com_parseutf8.ival = com_parseutf8.value;
}
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to

View File

@ -297,7 +297,6 @@ extern model_t mod_known[];
#define VM_FROMMHANDLE(a) (a?mod_known+a-1:NULL)
#define VM_TOMHANDLE(a) (a?a-mod_known+1:0)
extern shader_t r_shaders[];
#define VM_FROMSHANDLE(a) (a?r_shaders+a-1:NULL)
#define VM_TOSHANDLE(a) (a?a-r_shaders+1:0)
@ -454,7 +453,7 @@ void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts)
if (cl_maxstrisvert < cl_numstrisvert+num)
{
cl_maxstrisvert = cl_numstrisvert+num + 64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(vec3_t)*cl_maxstrisvert);
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
@ -565,7 +564,7 @@ struct q3refdef_s {
// text messages for deform text shaders
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
};
void D3D9_Set2D (void);
void VQ3_RenderView(const q3refdef_t *ref)
{
extern cvar_t r_torch;
@ -615,16 +614,15 @@ void VQ3_RenderView(const q3refdef_t *ref)
GL_Set2D ();
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_TexEnv(GL_MODULATE);
}
#endif
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
qglDisable(GL_ALPHA_TEST);
qglEnable(GL_BLEND);
}
#endif
#ifdef D3DQUAKE
if (qrenderer == QR_DIRECT3D)
D3D9_Set2D();
#endif
vid.recalc_refdef = 1;
r_refdef.time = 0;
@ -878,10 +876,8 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
case UI_R_REGISTERSHADERNOMIP:
if (!*(char*)VM_POINTER(arg[0]))
VM_LONG(ret) = 0;
else if (qrenderer == QR_OPENGL)
else
VM_LONG(ret) = VM_TOSHANDLE(R_RegisterPic(VM_POINTER(arg[0])));
//FIXME: 64bit else
// VM_LONG(ret) = (long)Draw_SafeCachePic(VM_POINTER(arg[0]));
break;
case UI_R_CLEARSCENE: //clear scene
@ -1198,22 +1194,6 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
VM_FLOAT(ret)=(float)ceil(VM_FLOAT(arg[0]));
break;
/*
case UI_CACHE_PIC:
if (!Draw_SafeCachePic)
VM_LONG(ret) = 0;
else
{
VM_LONG(ret) = 0;//FIXME: 64bit (long)R_RegisterPic(VM_POINTER(arg[0]));
}
break;
case UI_PICFROMWAD:
if (!Draw_SafePicFromWad)
VM_LONG(ret) = 0;
else
{
VM_LONG(ret) = 0;//FIXME: 64bit (long)R_RegisterPic(VM_POINTER(arg[0]));
}
break;
case UI_GETPLAYERINFO:
if (arg[1] + sizeof(vmuiclientinfo_t) >= mask || VM_POINTER(arg[1]) < offset)
break; //out of bounds.
@ -1450,7 +1430,7 @@ void UI_Reset(void)
{
keycatcher &= ~2;
if (!Draw_SafeCachePic || qrenderer != QR_OPENGL) //no renderer loaded
if (qrenderer == QR_NONE) //no renderer loaded
UI_Stop();
else if (uivm)
VM_Call(uivm, UI_INIT);
@ -1541,9 +1521,6 @@ void UI_Stop (void)
void UI_Start (void)
{
int apiversion;
if (!Draw_SafeCachePic) //no renderer loaded
return;
if (qrenderer != QR_OPENGL && qrenderer != QR_DIRECT3D)
return;

View File

@ -1199,7 +1199,6 @@ texid_t Media_UpdateForShader(cin_t *cin);
void Media_ShutdownCin(cin_t *cin);
//these accept NULL for cin to mean the current fullscreen video
void Media_Gecko_KeyPress (struct cin_s *cin, int code, int event);
void Media_Send_Command(cin_t *cin, char *command);
void Media_Send_MouseMove(cin_t *cin, float x, float y);
void Media_Send_Resize(cin_t *cin, int x, int y);

View File

@ -803,6 +803,9 @@ void Con_DrawInput (int left, int right, int y)
extern int con_commandmatch;
conchar_t maskedtext[MAXCMDLINE];
conchar_t *endmtext;
conchar_t *cursor;
conchar_t *cchar;
qboolean cursorframe;
int x;
@ -819,13 +822,12 @@ void Con_DrawInput (int left, int right, int y)
//if it's not a command, and the cursor is at the end of the line, leave it as is,
// but add to the end to show what the compleation will be.
i = text[key_linepos];
text[key_linepos] = 0;
cursor = COM_ParseFunString(CON_WHITEMASK, text, maskedtext, sizeof(maskedtext)-1*sizeof(conchar_t), true);
text[key_linepos] = i;
endmtext = COM_ParseFunString(CON_WHITEMASK, text, maskedtext, sizeof(maskedtext)-1*sizeof(conchar_t), true);
//FIXME: key_linepos is not corrected for multibyte codes.
if (endmtext < maskedtext+key_linepos)
key_linepos = endmtext-maskedtext;
endmtext[1] = 0;
i = 0;
@ -841,7 +843,7 @@ void Con_DrawInput (int left, int right, int y)
// else
// Plug_SpellCheckMaskedText(maskedtext+1, i-1, x, y, 8, si, con_current->linewidth);
if (!text[key_linepos]) //cursor is at end
if (cursor == endmtext) //cursor is at end
{
int cmdstart;
cmdstart = text[1] == '/'?2:1;
@ -858,12 +860,11 @@ void Con_DrawInput (int left, int right, int y)
// Plug_SpellCheckMaskedText(maskedtext+1, i-1, x, y, 8, si, con_current->linewidth);
#ifdef _WIN32
if (ActiveApp)
if (!ActiveApp)
cursorframe = 0;
else
#endif
if (((int)(realtime*con_cursorspeed)&1))
{
maskedtext[key_linepos] = 0xe000|11|CON_WHITEMASK; //make it blink
}
cursorframe = ((int)(realtime*con_cursorspeed)&1);
for (lhs = 0, i = key_linepos-1; i >= 0; i--)
{
@ -884,14 +885,25 @@ void Con_DrawInput (int left, int right, int y)
x = lhs;
lhs = x - lhs + left;
for (i = 0; i < key_linepos; i++)
for (cchar = maskedtext; cchar < cursor; cchar++)
{
lhs = Font_DrawChar(lhs, y, maskedtext[i]);
lhs = Font_DrawChar(lhs, y, *cchar);
}
rhs = x + left;
for (i = key_linepos; maskedtext[i]; i++)
if (cursorframe)
{
rhs = Font_DrawChar(rhs, y, maskedtext[i]);
extern cvar_t com_parseutf8;
if (com_parseutf8.ival)
Font_DrawChar(rhs, y, (*cursor&~(CON_BGMASK|CON_FGMASK)) | (COLOR_BLUE<<CON_BGSHIFT) | CON_NONCLEARBG | CON_WHITEMASK);
else
Font_DrawChar(rhs, y, 0xe000|11|CON_WHITEMASK);
}
else if (*cursor)
Font_DrawChar(rhs, y, *cursor);
rhs += Font_CharWidth(*cursor);
for (cchar = cursor+1; *cchar; cchar++)
{
rhs = Font_DrawChar(rhs, y, *cchar);
}
}

View File

@ -1346,8 +1346,6 @@ void IN_Init (void)
Cvar_Register (&in_rawinput_combine, "Input Controls");
Cvar_Register (&in_rawinput_rdp, "Input Controls");
#endif
IN_ReInit();
}
/*

View File

@ -253,26 +253,6 @@ int PaddedPrint (char *s, int x)
{
int nextcolx = 0;
/* if (x)
nextcolx = (int)((x + COLUMNWIDTH)/COLUMNWIDTH)*COLUMNWIDTH;
if (nextcolx > con_main.linewidth - MINCOLUMNWIDTH
|| (x && nextcolx + strlen(s) >= con_main.linewidth))
{
Con_Printf ("\n");
x=0;
}
if (x)
{
Con_Printf (" ");
x++;
}
while (x % COLUMNWIDTH)
{
Con_Printf (" ");
x++;
}*/
Con_Printf ("%s\t", s);
x+=strlen(s);
@ -420,20 +400,6 @@ void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue)
SCR_StringToRGB(var->string, sccolor, 1);
}
/*
// TODO: fix this to be used as the common coord function for selection logic
void GetSelectionCoords(int *selectcoords)
{
extern cvar_t vid_conwidth, vid_conheight;
extern int mousecursor_x, mousecursor_y;
int xpos, ypos;
// convert to console coords
xpos = (int)(mousecursor_x*vid_conwidth.value)/vid.width;
ypos = (int)(mousecursor_y*vid_conheight.value)/vid.height;
}
*/
qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey)
{
extern int mousecursor_x, mousecursor_y;
@ -478,6 +444,7 @@ Interactive line editing and console scrollback
*/
void Key_Console (unsigned int unicode, int key)
{
extern cvar_t com_parseutf8;
char *clipText;
if (con_current->redirect)
@ -590,9 +557,17 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_DEL)
{
if (strlen(key_lines[edit_line]+key_linepos))
if (key_lines[edit_line][key_linepos])
{
memmove(key_lines[edit_line]+key_linepos, key_lines[edit_line]+key_linepos+1, strlen(key_lines[edit_line]+key_linepos+1)+1);
int charlen = 1;
if (com_parseutf8.ival &&
(key_lines[edit_line][key_linepos] & 0xc0) != 0x80)
{
while((key_lines[edit_line][key_linepos+charlen] & 0xc0) == 0x80)
charlen++;
}
memmove(key_lines[edit_line]+key_linepos, key_lines[edit_line]+key_linepos+charlen, strlen(key_lines[edit_line]+key_linepos+charlen)+charlen);
return;
}
else
@ -603,8 +578,14 @@ void Key_Console (unsigned int unicode, int key)
{
if (key_linepos > 1)
{
memmove(key_lines[edit_line]+key_linepos-1, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+1);
key_linepos--;
int charlen = 1;
if (com_parseutf8.ival)
{
while (key_linepos > charlen && (key_lines[edit_line][key_linepos-charlen] & 0xc0) == 0x80)
charlen++;
}
memmove(key_lines[edit_line]+key_linepos-charlen, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+charlen);
key_linepos -= charlen;
}
return;
}
@ -745,65 +726,89 @@ void Key_Console (unsigned int unicode, int key)
{
unsigned char c1;
unsigned char c2;
unsigned char c3;
if (unicode > 127)
{
extern cvar_t com_parseutf8;
if (com_parseutf8.value)
if (com_parseutf8.ival)
{
c1 = 0xc0 | ((unicode>>6)&0x1f);
c2 = 0x80 | (unicode&0x3f);
if (key_linepos < MAXCMDLINE-2)
if (unicode > 0xffff)
{
memmove(key_lines[edit_line]+key_linepos+2, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+1);
key_lines[edit_line][key_linepos] = c1;
key_linepos++;
key_lines[edit_line][key_linepos] = c2;
key_linepos++;
// key_lines[edit_line][key_linepos] = 0;
}
return;
else if (unicode > 0x7ff)
{
c1 = 0xe0 | ((unicode>>12)&0x0f);
c2 = 0x80 | ((unicode>> 6)&0x3f);
c3 = 0x80 | ((unicode>> 0)&0x3f);
if (key_linepos < MAXCMDLINE-3)
{
memmove(key_lines[edit_line]+key_linepos+2, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+1);
key_lines[edit_line][key_linepos] = c1;
key_linepos++;
key_lines[edit_line][key_linepos] = c2;
key_linepos++;
key_lines[edit_line][key_linepos] = c3;
key_linepos++;
}
return;
}
else
{
c1 = 0xc0 | ((unicode>>6)&0x1f);
c2 = 0x80 | ((unicode>>0)&0x3f);
if (key_linepos < MAXCMDLINE-2)
{
memmove(key_lines[edit_line]+key_linepos+2, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+1);
key_lines[edit_line][key_linepos] = c1;
key_linepos++;
key_lines[edit_line][key_linepos] = c2;
key_linepos++;
}
return;
}
}
unicode = '?'; //sorry
}
}
if (keydown[K_CTRL]) {
if (key >= '0' && key <= '9')
key = key - '0' + 0x12; // yellow number
else switch (key) {
case '[': key = 0x10; break;
case ']': key = 0x11; break;
case 'g': key = 0x86; break;
case 'r': key = 0x87; break;
case 'y': key = 0x88; break;
case 'b': key = 0x89; break;
case '(': key = 0x80; break;
case '=': key = 0x81; break;
case ')': key = 0x82; break;
case 'a': key = 0x83; break;
case '<': key = 0x1d; break;
case '-': key = 0x1e; break;
case '>': key = 0x1f; break;
case ',': key = 0x1c; break;
case '.': key = 0x9c; break;
case 'B': key = 0x8b; break;
case 'C': key = 0x8d; break;
case 'n': key = '\r'; break;
if (!com_parseutf8.ival)
{
if (keydown[K_CTRL]) {
if (key >= '0' && key <= '9')
key = key - '0' + 0x12; // yellow number
else switch (key) {
case '[': key = 0x10; break;
case ']': key = 0x11; break;
case 'g': key = 0x86; break;
case 'r': key = 0x87; break;
case 'y': key = 0x88; break;
case 'b': key = 0x89; break;
case '(': key = 0x80; break;
case '=': key = 0x81; break;
case ')': key = 0x82; break;
case 'a': key = 0x83; break;
case '<': key = 0x1d; break;
case '-': key = 0x1e; break;
case '>': key = 0x1f; break;
case ',': key = 0x1c; break;
case '.': key = 0x9c; break;
case 'B': key = 0x8b; break;
case 'C': key = 0x8d; break;
case 'n': key = '\r'; break;
}
}
if (keydown[K_ALT])
key |= 128; // red char
}
if (keydown[K_ALT])
key |= 128; // red char
if (strlen(key_lines[edit_line])+1 < MAXCMDLINE-1)
{
memmove(key_lines[edit_line]+key_linepos+1, key_lines[edit_line]+key_linepos, strlen(key_lines[edit_line]+key_linepos)+1);
key_lines[edit_line][key_linepos] = key;
key_linepos++;
// key_lines[edit_line][key_linepos] = 0;
}
}

View File

@ -1316,22 +1316,22 @@ cin_t *Media_Cin_TryLoad(char *name)
#ifdef OFFSCREENGECKO
int (*posgk_release) (OSGK_BaseObject* obj);
int (VARGS *posgk_release) (OSGK_BaseObject* obj);
OSGK_Browser* (*posgk_browser_create) (OSGK_Embedding* embedding, int width, int height);
void (*posgk_browser_resize) (OSGK_Browser* browser, int width, int height);
void (*posgk_browser_navigate) (OSGK_Browser* browser, const char* uri);
const unsigned char* (*posgk_browser_lock_data) (OSGK_Browser* browser, int* isDirty);
void (*posgk_browser_unlock_data) (OSGK_Browser* browser, const unsigned char* data);
OSGK_Browser* (VARGS *posgk_browser_create) (OSGK_Embedding* embedding, int width, int height);
void (VARGS *posgk_browser_resize) (OSGK_Browser* browser, int width, int height);
void (VARGS *posgk_browser_navigate) (OSGK_Browser* browser, const char* uri);
const unsigned char* (VARGS *posgk_browser_lock_data) (OSGK_Browser* browser, int* isDirty);
void (VARGS *posgk_browser_unlock_data) (OSGK_Browser* browser, const unsigned char* data);
void (*posgk_browser_event_mouse_move) (OSGK_Browser* browser, int x, int y);
void (*posgk_browser_event_mouse_button) (OSGK_Browser* browser, OSGK_MouseButton button, OSGK_MouseButtonEventType eventType);
int (*posgk_browser_event_key) (OSGK_Browser* browser, unsigned int key, OSGK_KeyboardEventType eventType);
void (VARGS *posgk_browser_event_mouse_move) (OSGK_Browser* browser, int x, int y);
void (VARGS *posgk_browser_event_mouse_button) (OSGK_Browser* browser, OSGK_MouseButton button, OSGK_MouseButtonEventType eventType);
int (VARGS *posgk_browser_event_key) (OSGK_Browser* browser, unsigned int key, OSGK_KeyboardEventType eventType);
OSGK_EmbeddingOptions* (*posgk_embedding_options_create) (void);
OSGK_Embedding* (*posgk_embedding_create2) (unsigned int apiVer, OSGK_EmbeddingOptions* options, OSGK_GeckoResult* geckoResult);
void (*posgk_embedding_options_set_profile_dir) (OSGK_EmbeddingOptions* options, const char* profileDir, const char* localProfileDir);
void (*posgk_embedding_options_add_search_path) (OSGK_EmbeddingOptions* options, const char* path);
OSGK_EmbeddingOptions* (VARGS *posgk_embedding_options_create) (void);
OSGK_Embedding* (VARGS *posgk_embedding_create2) (unsigned int apiVer, OSGK_EmbeddingOptions* options, OSGK_GeckoResult* geckoResult);
void (VARGS *posgk_embedding_options_set_profile_dir) (OSGK_EmbeddingOptions* options, const char* profileDir, const char* localProfileDir);
void (VARGS *posgk_embedding_options_add_search_path) (OSGK_EmbeddingOptions* options, const char* path);
dllhandle_t geckodll;
dllfunction_t gecko_functions[] =
@ -1367,7 +1367,7 @@ qboolean Media_Gecko_DecodeFrame(cin_t *cin, qboolean nosound)
cin->outdata = (char*)posgk_browser_lock_data(cin->gecko.gbrowser, &cin->outunchanged);
cin->outwidth = cin->gecko.bwidth;
cin->outheight = cin->gecko.bheight;
cin->outtype = MOT_BGRA;
cin->outtype = TF_BGRA32;
return !!cin->gecko.gbrowser;
}
@ -1382,7 +1382,7 @@ void Media_Gecko_MoveCursor (struct cin_s *cin, float posx, float posy)
posgk_browser_event_mouse_move(cin->gecko.gbrowser, posx*cin->gecko.bwidth, posy*cin->gecko.bheight);
}
void Media_Gecko_KeyPress (struct cin_s *cin, int code, int event)
void Media_Gecko_KeyPress (struct cin_s *cin, int code, int unicode, int event)
{
if (code >= K_MOUSE1 && code < K_MOUSE10)
{
@ -1494,8 +1494,10 @@ void Media_Gecko_KeyPress (struct cin_s *cin, int code, int event)
case K_LWIN:
code = OSGKKey_Meta;
break;
default:
code = unicode;
break;
}
Con_Printf("Sending %c\n", code);
posgk_browser_event_key(cin->gecko.gbrowser, code, kePress);
//posgk_browser_event_key(cin->gecko.gbrowser, code, event);
}
@ -1548,7 +1550,7 @@ cin_t *Media_Gecko_TryLoad(char *name)
return NULL;
posgk_embedding_options_add_search_path(opts, "./xulrunner/");
if (FS_NativePath("xulrunner_profile/", FS_GAMEONLY, xulprofiledir, sizeof(xulprofiledir));
if (FS_NativePath("xulrunner_profile/", FS_ROOT, xulprofiledir, sizeof(xulprofiledir)))
posgk_embedding_options_set_profile_dir(opts, xulprofiledir, 0);
gecko_embedding = posgk_embedding_create2(OSGK_API_VERSION, opts, &result);
@ -1575,6 +1577,7 @@ cin_t *Media_Gecko_TryLoad(char *name)
cin->gecko.gbrowser = posgk_browser_create(gecko_embedding, cin->gecko.bwidth, cin->gecko.bheight);
if (!cin->gecko.gbrowser)
{
Con_Printf("osgk_browser_create failed, your version of xulrunner is likely unsupported\n");
Z_Free(cin);
return NULL;
}
@ -1688,7 +1691,8 @@ qboolean Media_ShowFilm(void)
switch(fullscreenvid->outtype)
{
case TF_RGBA32:
Media_ShowFrameRGBA_32(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
if (Media_ShowFrameRGBA_32)
Media_ShowFrameRGBA_32(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
break;
case TF_TRANS8:
case TF_SOLID8:
@ -1710,7 +1714,7 @@ qboolean Media_ShowFilm(void)
return true;
}
#ifdef GLQUAKE
#if defined(GLQUAKE) || defined(D3DQUAKE)
texid_t Media_UpdateForShader(cin_t *cin)
{
if (!cin)

View File

@ -75,16 +75,16 @@ void M_Menu_Options_f (void)
MC_AddSlider(menu, 16, y, " Mouse Speed", &sensitivity, 1, 10, 0.5); y+=8;
MC_AddSlider(menu, 16, y, " Crosshair", &crosshair, 0, 22, 1); y+=8;
MC_AddCheckBox(menu, 16, y, " Always Run", NULL,0)->func = M_Options_AlwaysRun; y+=8;
MC_AddCheckBox(menu, 16, y, " Invert Mouse", NULL,0)->func = M_Options_InvertMouse; y+=8;
MC_AddCheckBox(menu, 16, y, " Lookspring", &lookspring,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Lookstrafe", &lookstrafe,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Use old status bar", &cl_sbar,0); y+=8;
MC_AddCheckBox(menu, 16, y, " HUD on left side", &cl_hudswap,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style chatting", &cl_standardchat,0);y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style messages", &cl_standardmsg,0);y+=8;
y+=4;MC_AddEditCvar(menu, 16, y," Imitate FPS", "cl_netfps"); y+=8+4;
y+=4;MC_AddEditCvar(menu, 16, y," Auto status format", "tp_autostatus"); y+=8+4;
MC_AddCheckBox(menu, 16, y, " Always Run", NULL,0)->func = M_Options_AlwaysRun; y+=8;
MC_AddCheckBox(menu, 16, y, " Invert Mouse", NULL,0)->func = M_Options_InvertMouse; y+=8;
MC_AddCheckBox(menu, 16, y, " Lookspring", &lookspring,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Lookstrafe", &lookstrafe,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Use old status bar", &cl_sbar,0); y+=8;
MC_AddCheckBox(menu, 16, y, " HUD on left side", &cl_hudswap,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style chatting", &cl_standardchat,0);y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style messages", &cl_standardmsg,0);y+=8;
y+=4;MC_AddEditCvar(menu, 16, y, " Imitate FPS", "cl_netfps"); y+=8+4;
y+=4;MC_AddEditCvar(menu, 16, y, " Auto status format", "tp_autostatus"); y+=8+4;
MC_AddConsoleCommand(menu, 16, y, " Video Options", "menu_video\n"); y+=8;
MC_AddConsoleCommand(menu, 16, y, " FPS Options", "menu_fps\n"); y+=8;

View File

@ -273,8 +273,16 @@ static void PClassic_DrawParticles(void)
vec3_t up, right;
float dist, scale, r_partscale=0;
union c usecolours;
unsigned int *palette;
RSpeedMark();
/*#ifdef D3DQUAKE
if (qrenderer == QR_DIRECT3D)
palette = d_8to24bgrtable;
else
#endif*/
palette = d_8to24rgbtable;
//make sure all ents are pushed through first
RQ_RenderBatchClear();
@ -336,7 +344,7 @@ static void PClassic_DrawParticles(void)
scale = 1 + dist * r_partscale;
usecolours.i = d_8to24rgbtable[(int)p->color];
usecolours.i = palette[(int)p->color];
if (p->type == pt_fire)
usecolours.b[3] = 255 * (6 - p->ramp) / 6;
else

View File

@ -3704,53 +3704,63 @@ static void PF_skel_find_bone (progfuncs_t *prinst, struct globalvars_s *pr_glob
G_FLOAT(OFS_RETURN) = Mod_TagNumForName(skelobj->model, bname);
}
static void bonemat_fromqcvectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
{
out[0] = vx[0];
out[1] = -vy[0];
out[2] = vz[0];
out[3] = t[0];
out[4] = vx[1];
out[5] = -vy[1];
out[6] = vz[1];
out[7] = t[1];
out[8] = vx[2];
out[9] = -vy[2];
out[10] = vz[2];
out[11] = t[2];
}
void bonemat_toqcvectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
{
vx[0] = in[0];
vx[1] = in[4];
vx[2] = in[8];
vy[0] = -in[1];
vy[1] = -in[5];
vy[2] = -in[9];
vz[0] = in[2];
vz[1] = in[6];
vz[2] = in[10];
t [0] = in[3];
t [1] = in[7];
t [2] = in[11];
}
void bonematident_toqcvectors(float vx[3], float vy[3], float vz[3], float t[3])
{
vx[0] = 1;
vx[1] = 0;
vx[2] = 0;
vy[0] = -0;
vy[1] = -1;
vy[2] = -0;
vz[0] = 0;
vz[1] = 0;
vz[2] = 1;
t [0] = 0;
t [1] = 0;
t [2] = 0;
}
//vector(float skel, float bonenum) skel_get_bonerel (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
static void PF_skel_get_bonerel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int skelidx = G_FLOAT(OFS_PARM0);
int boneidx = G_FLOAT(OFS_PARM1)-1;
float *matrix[4];
skelobject_t *skelobj;
matrix[0] = csqcg.forward;
matrix[1] = csqcg.right;
matrix[2] = csqcg.up;
matrix[3] = G_VECTOR(OFS_RETURN);
skelobj = skel_get(prinst, skelidx, 0);
skelobject_t *skelobj = skel_get(prinst, skelidx, 0);
if (!skelobj || skelobj->absolute || (unsigned int)boneidx >= skelobj->numbones)
{
matrix[0][0] = 1;
matrix[1][0] = 0;
matrix[2][0] = 0;
matrix[0][1] = 0;
matrix[1][1] = 1;
matrix[2][1] = 0;
matrix[0][2] = 0;
matrix[1][2] = 0;
matrix[2][2] = 1;
matrix[3][0] = 0;
matrix[3][1] = 0;
matrix[3][2] = 0;
}
bonematident_toqcvectors(csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_RETURN));
else
{
float *bone = skelobj->bonematrix+12*boneidx;
matrix[0][0] = bone[0];
matrix[1][0] = bone[1];
matrix[2][0] = bone[2];
matrix[3][0] = bone[3];
matrix[0][1] = bone[4];
matrix[1][1] = bone[5];
matrix[2][1] = bone[6];
matrix[3][1] = bone[7];
matrix[0][2] = bone[8];
matrix[1][2] = bone[9];
matrix[2][2] = bone[10];
matrix[3][2] = bone[11];
}
bonemat_toqcvectors(skelobj->bonematrix+12*boneidx, csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_RETURN));
}
//vector(float skel, float bonenum) skel_get_boneabs (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
@ -3758,42 +3768,16 @@ static void PF_skel_get_boneabs (progfuncs_t *prinst, struct globalvars_s *pr_gl
{
int skelidx = G_FLOAT(OFS_PARM0);
int boneidx = G_FLOAT(OFS_PARM1)-1;
float *rmatrix[4];
float workingm[12], tempmatrix[3][4];
skelobject_t *skelobj;
int i;
rmatrix[0] = csqcg.forward;
rmatrix[1] = csqcg.right;
rmatrix[2] = csqcg.up;
rmatrix[3] = G_VECTOR(OFS_RETURN);
skelobj = skel_get(prinst, skelidx, 0);
skelobject_t *skelobj = skel_get(prinst, skelidx, 0);
if (!skelobj || (unsigned int)boneidx >= skelobj->numbones)
{
rmatrix[0][0] = 1;
rmatrix[0][1] = 0;
rmatrix[0][2] = 0;
rmatrix[1][0] = 0;
rmatrix[1][1] = 1;
rmatrix[1][2] = 0;
rmatrix[2][0] = 0;
rmatrix[2][1] = 0;
rmatrix[2][2] = 1;
rmatrix[3][0] = 0;
rmatrix[3][1] = 0;
rmatrix[3][2] = 0;
}
bonematident_toqcvectors(csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_RETURN));
else if (skelobj->absolute)
{
//can just copy it out
memcpy(rmatrix[0], skelobj->bonematrix + boneidx*12 + 0, sizeof(vec3_t));
memcpy(rmatrix[1], skelobj->bonematrix + boneidx*12 + 3, sizeof(vec3_t));
memcpy(rmatrix[2], skelobj->bonematrix + boneidx*12 + 6, sizeof(vec3_t));
memcpy(rmatrix[3], skelobj->bonematrix + boneidx*12 + 9, sizeof(vec3_t));
bonemat_toqcvectors(skelobj->bonematrix + boneidx*12, csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_RETURN));
}
else
{
@ -3816,10 +3800,7 @@ static void PF_skel_get_boneabs (progfuncs_t *prinst, struct globalvars_s *pr_gl
boneidx = Mod_GetBoneParent(skelobj->model, boneidx+1)-1;
}
memcpy(rmatrix[0], (workingm+0), sizeof(vec3_t));
memcpy(rmatrix[1], (workingm+3), sizeof(vec3_t));
memcpy(rmatrix[2], (workingm+6), sizeof(vec3_t));
memcpy(rmatrix[3], (workingm+9), sizeof(vec3_t));
bonemat_toqcvectors(workingm, csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_RETURN));
}
}
@ -3828,13 +3809,12 @@ static void PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s *pr_globa
{
int skelidx = G_FLOAT(OFS_PARM0);
unsigned int boneidx = G_FLOAT(OFS_PARM1)-1;
float *matrix[4];
float *matrix[3];
skelobject_t *skelobj;
float *bone;
if (*prinst->callargc > 5)
{
matrix[3] = G_VECTOR(OFS_PARM2);
matrix[0] = G_VECTOR(OFS_PARM3);
matrix[1] = G_VECTOR(OFS_PARM4);
matrix[2] = G_VECTOR(OFS_PARM5);
@ -3844,26 +3824,14 @@ static void PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s *pr_globa
matrix[0] = csqcg.forward;
matrix[1] = csqcg.right;
matrix[2] = csqcg.up;
matrix[3] = G_VECTOR(OFS_PARM2);
}
skelobj = skel_get(prinst, skelidx, 0);
if (!skelobj || boneidx >= skelobj->numbones)
return;
//testme
bone = skelobj->bonematrix+12*boneidx;
bone[0] = matrix[0][0];
bone[1] = matrix[1][0];
bone[2] = matrix[2][0];
bone[3] = matrix[3][0];
bone[4] = matrix[0][1];
bone[5] = matrix[1][1];
bone[6] = matrix[2][1];
bone[7] = matrix[3][1];
bone[8] = matrix[0][2];
bone[9] = matrix[1][2];
bone[10]= matrix[2][2];
bone[11]= matrix[3][2];
bonemat_fromqcvectors(skelobj->bonematrix+12*boneidx, matrix[0], matrix[1], matrix[2], G_VECTOR(OFS_PARM2));
}
//void(float skel, float bonenum, vector org) skel_mul_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
@ -3875,28 +3843,17 @@ static void PF_skel_mul_bone (progfuncs_t *prinst, struct globalvars_s *pr_globa
float mult[3][4];
skelobject_t *skelobj;
if (*prinst->callargc > 5)
{
VectorCopy(G_VECTOR(OFS_PARM2), mult[3]);
VectorCopy(G_VECTOR(OFS_PARM3), mult[0]);
VectorCopy(G_VECTOR(OFS_PARM4), mult[1]);
VectorCopy(G_VECTOR(OFS_PARM5), mult[2]);
}
bonemat_fromqcvectors((float*)mult, G_VECTOR(OFS_PARM3), G_VECTOR(OFS_PARM4), G_VECTOR(OFS_PARM5), G_VECTOR(OFS_PARM2));
else
{
VectorCopy(csqcg.forward, mult[0]);
VectorCopy(csqcg.right, mult[1]);
VectorCopy(csqcg.up, mult[2]);
VectorCopy(G_VECTOR(OFS_PARM2), mult[3]);
}
bonemat_fromqcvectors((float*)mult, csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_PARM2));
skelobj = skel_get(prinst, skelidx, 0);
if (!skelobj || boneidx >= skelobj->numbones)
return;
//testme
VectorCopy(skelobj->bonematrix+12*boneidx+0, temp[0]);
VectorCopy(skelobj->bonematrix+12*boneidx+3, temp[1]);
VectorCopy(skelobj->bonematrix+12*boneidx+6, temp[2]);
VectorCopy(skelobj->bonematrix+12*boneidx+9, temp[3]);
Vector4Copy(skelobj->bonematrix+12*boneidx+0, temp[0]);
Vector4Copy(skelobj->bonematrix+12*boneidx+4, temp[1]);
Vector4Copy(skelobj->bonematrix+12*boneidx+8, temp[2]);
R_ConcatTransforms(mult, temp, (float(*)[4])(skelobj->bonematrix+12*boneidx));
}
@ -3910,19 +3867,9 @@ static void PF_skel_mul_bones (progfuncs_t *prinst, struct globalvars_s *pr_glob
float mult[3][4];
skelobject_t *skelobj;
if (*prinst->callargc > 6)
{
VectorCopy(G_VECTOR(OFS_PARM3), mult[3]);
VectorCopy(G_VECTOR(OFS_PARM4), mult[0]);
VectorCopy(G_VECTOR(OFS_PARM5), mult[1]);
VectorCopy(G_VECTOR(OFS_PARM6), mult[2]);
}
bonemat_fromqcvectors((float*)mult, G_VECTOR(OFS_PARM4), G_VECTOR(OFS_PARM5), G_VECTOR(OFS_PARM6), G_VECTOR(OFS_PARM3));
else
{
VectorCopy(csqcg.forward, mult[0]);
VectorCopy(csqcg.right, mult[1]);
VectorCopy(csqcg.up, mult[2]);
VectorCopy(G_VECTOR(OFS_PARM3), mult[3]);
}
bonemat_fromqcvectors((float*)mult, csqcg.forward, csqcg.right, csqcg.up, G_VECTOR(OFS_PARM3));
skelobj = skel_get(prinst, skelidx, 0);
if (!skelobj)
@ -3933,10 +3880,9 @@ static void PF_skel_mul_bones (progfuncs_t *prinst, struct globalvars_s *pr_glob
//testme
while(startbone < endbone && startbone < skelobj->numbones)
{
VectorCopy(skelobj->bonematrix+12*startbone+0, temp[0]);
VectorCopy(skelobj->bonematrix+12*startbone+3, temp[1]);
VectorCopy(skelobj->bonematrix+12*startbone+6, temp[2]);
VectorCopy(skelobj->bonematrix+12*startbone+9, temp[3]);
Vector4Copy(skelobj->bonematrix+12*startbone+0, temp[0]);
Vector4Copy(skelobj->bonematrix+12*startbone+4, temp[1]);
Vector4Copy(skelobj->bonematrix+12*startbone+8, temp[2]);
R_ConcatTransforms(mult, temp, (float(*)[4])(skelobj->bonematrix+12*startbone));
}
}
@ -3964,10 +3910,9 @@ static void PF_skel_copybones (progfuncs_t *prinst, struct globalvars_s *pr_glob
//testme
while(startbone < endbone && startbone < skelobjdst->numbones && startbone < skelobjsrc->numbones)
{
VectorCopy(skelobjsrc->bonematrix+12*startbone+0, skelobjdst->bonematrix+12*startbone+0);
VectorCopy(skelobjsrc->bonematrix+12*startbone+3, skelobjdst->bonematrix+12*startbone+3);
VectorCopy(skelobjsrc->bonematrix+12*startbone+6, skelobjdst->bonematrix+12*startbone+6);
VectorCopy(skelobjsrc->bonematrix+12*startbone+9, skelobjdst->bonematrix+12*startbone+9);
Vector4Copy(skelobjsrc->bonematrix+12*startbone+0, skelobjdst->bonematrix+12*startbone+0);
Vector4Copy(skelobjsrc->bonematrix+12*startbone+4, skelobjdst->bonematrix+12*startbone+4);
Vector4Copy(skelobjsrc->bonematrix+12*startbone+8, skelobjdst->bonematrix+12*startbone+8);
}
}

View File

@ -271,11 +271,6 @@ extern qboolean isDedicated;
void FTE_DEPRECATED R_RenderMeshBuffer(struct meshbuffer_s *mb, qboolean shadowpass);
#ifdef __cplusplus
}
#endif

View File

@ -9,15 +9,19 @@ static mpic_t *draw_backtile;
static mpic_t *draw_fill, *draw_fill_trans;
mpic_t *draw_disc;
shader_t *shader_brighten;
shader_t *shader_polyblend;
static mesh_t draw_mesh;
static vecV_t draw_mesh_xyz[4];
static vec2_t draw_mesh_st[4];
static avec4_t draw_mesh_colors[4];
static index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
index_t r_quad_indexes[6] = {0, 1, 2, 2, 3, 0};
extern cvar_t scr_conalpha;
extern cvar_t gl_conback;
extern cvar_t gl_font;
extern cvar_t gl_contrast;
void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue);
@ -57,7 +61,10 @@ Image loading code must be ready for use at this point.
*/
void R2D_Init(void)
{
Shader_Init();
BE_Init();
draw_mesh.istrifan = true;
draw_mesh.numvertexes = 4;
draw_mesh.numindexes = 6;
draw_mesh.xyz_array = draw_mesh_xyz;
@ -99,6 +106,26 @@ void R2D_Init(void)
"blendfunc blend\n"
"}\n"
"}\n");
shader_brighten = R_RegisterShader("constrastshader",
"{\n"
"{\n"
"map $whiteimage\n"
"blendfunc gl_dst_color gl_one\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}\n"
);
shader_polyblend = R_RegisterShader("polyblendshader",
"{\n"
"{\n"
"map $whiteimage\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}\n"
);
Cvar_Hook(&gl_conback, R2D_Conback_Callback);
}
@ -318,10 +345,57 @@ void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
{
if (*var->string)
conback = R_RegisterPic(var->string);
if (!conback || !conback->width)
if (!conback)
conback = R_RegisterCustom("console", NULL, NULL);
if (!conback || !conback->width)
if (!conback)
conback = R_RegisterPic("gfx/conback.lmp");
}
/*
============
R_PolyBlend
============
*/
//bright flashes and stuff
void R2D_PolyBlend (void)
{
if (!sw_blend[3])
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
R2D_ImageColours (sw_blend[0], sw_blend[1], sw_blend[2], sw_blend[3]);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_polyblend);
}
//for lack of hardware gamma
void R2D_BrightenScreen (void)
{
float f;
RSpeedMark();
if (gl_contrast.value <= 1.0)
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
f = gl_contrast.value;
f = min (f, 3);
while (f > 1)
{
if (f >= 2)
R2D_ImageColours (1, 1, 1, 1);
else
R2D_ImageColours (f - 1, f - 1, f - 1, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_brighten);
f *= 0.5;
}
RSpeedEnd(RSPEED_PALETTEFLASHES);
}
#endif

View File

@ -79,21 +79,24 @@ void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
if (pe)
pe->ShutdownParticles();
pe = NULL;
for (i = 0; particlesystem[i]; i++)
if (!qrenderer)
pe = &pe_null;
else
{
if ( (particlesystem[i]->name1 && !stricmp(var->string, particlesystem[i]->name1))
|| (particlesystem[i]->name2 && !stricmp(var->string, particlesystem[i]->name2)))
pe = NULL;
for (i = 0; particlesystem[i]; i++)
{
pe = particlesystem[i];
break;
}
if (!pe)
if (particlesystem[i]->name1)
if ( (particlesystem[i]->name1 && !stricmp(var->string, particlesystem[i]->name1))
|| (particlesystem[i]->name2 && !stricmp(var->string, particlesystem[i]->name2)))
{
pe = particlesystem[i];
break;
}
if (!pe)
if (particlesystem[i]->name1)
pe = particlesystem[i];
}
}
if (!pe)
Sys_Error("No particle system available. Please recompile.");

View File

@ -32,9 +32,10 @@ static vec3_t modelorg; /*set before recursively entering the visible surface
static qbyte areabits[MAX_Q2MAP_AREAS/8];
model_t *currentmodel;
mesh_t nullmesh;
int lightmap_bytes; // 1, 3 or 4
qboolean lightmap_bgra;
texid_t *lightmap_textures;
texid_t *deluxmap_textures;
@ -768,24 +769,30 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
{
if (currentmodel->fromgame == fg_quake3) //rgb
{
/* for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++) //no light styles in q3 apparently.
if (lightmap_bgra)
{
scale = d_lightstylevalue[surf->styles[maps]];
surf->cached_light[maps] = scale; // 8.8 fraction
surf->cached_colour[maps] = cl_lightstyle[surf->styles[maps]].colour;
}
*/
for (i = 0; i < tmax; i++) //q3 maps store their light in a block fashion, q1/q2/hl store it in a linear fashion.
{
for (j = 0; j < smax; j++)
for (i = 0; i < tmax; i++) //q3 maps store their light in a block fashion, q1/q2/hl store it in a linear fashion.
{
blocklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3];
greenblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+1];
blueblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+2];
for (j = 0; j < smax; j++)
{
blocklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+2];
greenblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+1];
blueblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3 ];
}
}
}
else
{
for (i = 0; i < tmax; i++) //q3 maps store their light in a block fashion, q1/q2/hl store it in a linear fashion.
{
for (j = 0; j < smax; j++)
{
blocklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3];
greenblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+1];
blueblklights[i*smax+j] = 255*lightmap[(i*LMBLOCK_WIDTH+j)*3+2];
}
}
}
// memset(blocklights, 255, sizeof(blocklights));
}
else if (currentmodel->engineflags & MDLF_RGBLIGHTING) //rgb
{
@ -796,27 +803,53 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
surf->cached_light[maps] = scale; // 8.8 fraction
surf->cached_colour[maps] = cl_lightstyle[surf->styles[maps]].colour;
if (cl_lightstyle[surf->styles[maps]].colour == 7) //hopefully a faster alternative.
if (lightmap_bgra)
{
for (i=0 ; i<size ; i++)
if (cl_lightstyle[surf->styles[maps]].colour == 7) //hopefully a faster alternative.
{
blocklights[i] += lightmap[i*3 ] * scale;
greenblklights[i] += lightmap[i*3+1] * scale;
blueblklights[i] += lightmap[i*3+2] * scale;
for (i=0 ; i<size ; i++)
{
blocklights[i] += lightmap[i*3+2] * scale;
greenblklights[i] += lightmap[i*3+1] * scale;
blueblklights[i] += lightmap[i*3 ] * scale;
}
}
else
{
if (cl_lightstyle[surf->styles[maps]].colour & 1)
for (i=0 ; i<size ; i++)
blocklights[i] += lightmap[i*3+2] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 2)
for (i=0 ; i<size ; i++)
greenblklights[i] += lightmap[i*3+1] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 4)
for (i=0 ; i<size ; i++)
blueblklights[i] += lightmap[i*3 ] * scale;
}
}
else
{
if (cl_lightstyle[surf->styles[maps]].colour & 1)
if (cl_lightstyle[surf->styles[maps]].colour == 7) //hopefully a faster alternative.
{
for (i=0 ; i<size ; i++)
{
blocklights[i] += lightmap[i*3 ] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 2)
for (i=0 ; i<size ; i++)
greenblklights[i] += lightmap[i*3+1] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 4)
for (i=0 ; i<size ; i++)
blueblklights[i] += lightmap[i*3+2] * scale;
}
}
else
{
if (cl_lightstyle[surf->styles[maps]].colour & 1)
for (i=0 ; i<size ; i++)
blocklights[i] += lightmap[i*3 ] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 2)
for (i=0 ; i<size ; i++)
greenblklights[i] += lightmap[i*3+1] * scale;
if (cl_lightstyle[surf->styles[maps]].colour & 4)
for (i=0 ; i<size ; i++)
blueblklights[i] += lightmap[i*3+2] * scale;
}
}
lightmap += size*3; // skip to next lightmap
}
@ -1370,7 +1403,7 @@ store:
}
// else if (b < 0)
// b = 0;
//*
/*
if ((r+cr) > 255)
dest[0] = 0; //inverse lighting
else if ((r+cr) < 0)
@ -1412,7 +1445,7 @@ store:
dest[2] = 0;
else
dest[2] = (b+cb);
*/
//*/
@ -2440,6 +2473,10 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
{
lightmap[i]->allocated[l] = LMBLOCK_HEIGHT;
}
lightmap[i]->rectchange.l = 0;
lightmap[i]->rectchange.t = 0;
lightmap[i]->rectchange.w = LMBLOCK_WIDTH;
lightmap[i]->rectchange.h = LMBLOCK_HEIGHT;
//clear out the deluxmaps incase there is none on the map.
for (l = 0; l < LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3; l+=3)
@ -2449,8 +2486,6 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
lightmap[i]->deluxmaps[l+2] = 255;
}
//maybe someone screwed with my lightmap...
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
if (cl.worldmodel->lightdata)
{
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
@ -2458,6 +2493,9 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
else
{
char basename[MAX_QPATH];
//maybe someone screwed with my lightmap...
memset(lightmap[i]->lightmaps, 255, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
COM_StripExtension(cl.worldmodel->name, basename, sizeof(basename));
lightmap_textures[i] = R_LoadHiResTexture(va("%s/lm_%04i", basename, i), NULL, IF_NOALPHA|IF_NOGAMMA);
lightmap[i]->modified = false;
@ -2486,7 +2524,6 @@ void Surf_BuildSurfaceDisplayList (model_t *model, msurface_t *fa)
float *vec;
float s, t;
int lm;
extern mesh_t nullmesh;
// reconstruct the polygon
pedges = model->edges;
@ -2625,6 +2662,7 @@ static void Surf_CreateSurfaceLightmap (msurface_t *surf, int shift)
void Surf_DeInit(void)
{
int i;
for (i = 0; i < numlightmaps; i++)
{
if (!lightmap[i])
@ -2674,7 +2712,11 @@ void Surf_BuildLightmaps (void)
if (cl.worldmodel->fromgame == fg_doom)
return; //no lightmaps.
if ((cl.worldmodel->engineflags & MDLF_RGBLIGHTING) || cl.worldmodel->deluxdata || r_loadlits.value)
lightmap_bgra = (qrenderer == QR_DIRECT3D);
if (qrenderer == QR_DIRECT3D)
lightmap_bytes = 4;
else if ((cl.worldmodel->engineflags & MDLF_RGBLIGHTING) || cl.worldmodel->deluxdata || r_loadlits.value)
lightmap_bytes = 3;
else
lightmap_bytes = 1;

View File

@ -48,10 +48,12 @@ static const texid_t r_nulltex = {0};
#define GL_INDEX_TYPE GL_UNSIGNED_SHORT
#define D3DFMT_QINDEX D3DFMT_INDEX16
typedef unsigned short index_t;
#define MAX_INDICIES 0xffff
#else
#define GL_INDEX_TYPE GL_UNSIGNED_INT
#define D3DFMT_QINDEX D3DFMT_INDEX32
typedef unsigned int index_t;
#define MAX_INDICIES 0xffffffff
#endif
//=============================================================================
@ -292,8 +294,8 @@ enum uploadfmt
#define R_FindTexture(name) ((qrenderer == QR_DIRECT3D)?D3D_FindTexture(name):GL_FindTexture(name))
#define R_LoadCompressed(name) ((qrenderer == QR_DIRECT3D)?D3D_LoadCompressed(name):GL_LoadCompressed(name))
#elif defined(D3DQUAKE)
// #define R_LoadTexture8Pal32
// #define R_LoadTexture8Pal24
#define R_LoadTexture8Pal32 D3D_LoadTexture8Pal32
#define R_LoadTexture8Pal24 D3D_LoadTexture8Pal24
#define R_FindTexture D3D_FindTexture
#define R_LoadCompressed D3D_LoadCompressed
@ -334,6 +336,9 @@ texid_t D3D_LoadTextureFmt (char *identifier, int width, int height, enum upload
texid_t D3D_LoadCompressed(char *name);
texid_t D3D_FindTexture (char *identifier);
texid_t D3D_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags);
texid_t D3D_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
#endif
extern int image_width, image_height;

View File

@ -417,7 +417,6 @@ void GLRenderer_Init(void)
Cvar_Register (&vid_multisample, GLRENDEREROPTIONS);
Cvar_Register (&gl_fontinwardstep, GRAPHICALNICETIES);
Cvar_Register (&gl_font, GRAPHICALNICETIES);
Cvar_Register (&gl_smoothfont, GRAPHICALNICETIES);
Cvar_Register (&gl_smoothcrosshair, GRAPHICALNICETIES);
@ -592,6 +591,7 @@ void Renderer_Init(void)
//screen
Cvar_Register (&gl_font, GRAPHICALNICETIES);
Cvar_Register (&scr_conspeed, SCREENOPTIONS);
Cvar_Register (&scr_conalpha, SCREENOPTIONS);
Cvar_Register (&scr_showturtle, SCREENOPTIONS);
@ -2205,7 +2205,7 @@ qbyte *R_MarkLeaves_Q3 (void)
r_visframecount++;
r_oldviewcluster = r_viewcluster;
if (r_novis.value || r_viewcluster == -1 || !cl.worldmodel->vis )
if (r_novis.ival || r_viewcluster == -1 || !cl.worldmodel->vis )
{
// mark everything
for (i=0,leaf=cl.worldmodel->leafs ; i<cl.worldmodel->numleafs ; i++, leaf++)
@ -2260,10 +2260,10 @@ qbyte *R_MarkLeaves_Q2 (void)
r_oldviewcluster = r_viewcluster;
r_oldviewcluster2 = r_viewcluster2;
if (r_novis.value == 2)
if (r_novis.ival == 2)
return vis;
r_visframecount++;
if (r_novis.value || r_viewcluster == -1 || !cl.worldmodel->vis)
if (r_novis.ival || r_viewcluster == -1 || !cl.worldmodel->vis)
{
// mark everything
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
@ -2318,7 +2318,7 @@ qbyte *R_CalcVis_Q1 (void)
r_oldviewleaf = r_viewleaf;
r_oldviewleaf2 = r_viewleaf2;
if ((int)r_novis.value&1)
if (r_novis.ival&1)
{
vis = curframevis;
memset (vis, 0xff, (cl.worldmodel->numleafs+7)>>3);
@ -2347,7 +2347,7 @@ qbyte *R_MarkLeaves_Q1 (void)
int i;
qbyte solid[4096];
if (((r_oldviewleaf == r_viewleaf && r_oldviewleaf2 == r_viewleaf2) && !r_novis.value) || r_novis.value == 2)
if (((r_oldviewleaf == r_viewleaf && r_oldviewleaf2 == r_viewleaf2) && !r_novis.ival) || r_novis.ival & 2)
return vis;
// if (mirror)
@ -2489,7 +2489,7 @@ void R_SetFrustum (float projmat[16], float viewmat[16])
int i;
float mvp[16];
if ((int)r_novis.value & 4)
if (r_novis.ival & 4)
return;
Matrix4_Multiply(projmat, viewmat, mvp);
@ -2526,7 +2526,7 @@ void R_SetFrustum (void)
{
int i;
if ((int)r_novis.value & 4)
if (r_novis.ival & 4)
return;
/* removed - assumes fov_x == fov_y

View File

@ -376,6 +376,8 @@ void *Sys_GetGameAPI(void *parms)
void *ret;
getcwd(curpath, sizeof(curpath));
Con_DPrintf("Searching for %s\n", gamename);
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))

View File

@ -50,6 +50,11 @@ qboolean NPFTE_BeginDownload(void *ctx, struct pipetype *ftype, char *url)
return NPERR_NO_ERROR==browserfuncs->geturlnotify(ctx, url, NULL, ftype);
}
void NPFTE_StatusChanged(struct context *ctx)
{
struct contextpublic *pub = (struct contextpublic*)ctx;
InvalidateRgn(pub->oldwnd, NULL, FALSE);
}
#ifdef _WIN32
void DrawWndBack(struct context *ctx, HWND hWnd, HDC hdc, PAINTSTRUCT *p)
@ -59,10 +64,12 @@ void DrawWndBack(struct context *ctx, HWND hWnd, HDC hdc, PAINTSTRUCT *p)
if (bmp)
{
HDC memDC;
RECT irect;
memDC = CreateCompatibleDC(hdc);
SelectObject(memDC, bmp);
StretchBlt(hdc, p->rcPaint.left, p->rcPaint.top, p->rcPaint.right-p->rcPaint.left,p->rcPaint.bottom-p->rcPaint.top, memDC, 0, 0, width, height, SRCCOPY);
GetClientRect(hWnd, &irect);
StretchBlt(hdc, irect.left, irect.top, irect.right-irect.left,irect.bottom-irect.top, memDC, 0, 0, width, height, SRCCOPY);
SelectObject(memDC, NULL);
DeleteDC(memDC);
Plug_ReleaseSplashBack(ctx, bmp);
@ -102,29 +109,16 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
case WM_PAINT:
/* if (ctx->waitingfordatafiles)
if (pub->downloading)
{
HDC hdc;
PAINTSTRUCT paint;
char *s;
unsigned int progress;
unsigned int total;
bool sizeknown = true;
struct qstream *strm;
progress = 0;
total = 0;
if (Sys_TryLockMutex(ctx->mutex)) //this lock doesn't have to be here
{
for (strm = ctx->activestreams; strm; strm = strm->next)
{
progress += strm->offset;
total += strm->size;
if (!total && progress)
sizeknown = false;
}
Plug_LockPlugin(ctx, false);
}
progress = pub->dldone;
total = pub->dlsize;
hdc = BeginPaint(hWnd, &paint);
DrawWndBack(ctx, hWnd, hdc, &paint);
@ -132,7 +126,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
TextOutA(hdc, 0, 0, "Downloading Data, please wait", 16);
if (!progress && !total)
s = "connecting";
else if (sizeknown)
else if (total)
s = va("%i bytes (%i%%)", progress, (int)((100.0f*progress)/total));
else
s = va("%i bytes", progress);
@ -141,7 +135,7 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
}
else
*/ {
{
HDC hdc;
PAINTSTRUCT paint;
char *s;
@ -184,7 +178,8 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
static const struct browserfuncs npfte_browserfuncs =
{
NPFTE_BeginDownload
NPFTE_BeginDownload,
NPFTE_StatusChanged
};
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
@ -247,7 +242,6 @@ NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window)
struct contextpublic *pub = (struct contextpublic*)ctx;
#ifdef _WIN32
HWND oldwindow;
WNDPROC p;
if (!ctx)
@ -446,7 +440,6 @@ struct npscript
NPObject *npscript_allocate(NPP npp, NPClass *aClass)
{
struct npscript_property *prop;
struct npscript *obj;
obj = malloc(sizeof(*obj));
obj->obj._class = aClass;
@ -481,7 +474,6 @@ bool npscript_invokeDefault(NPObject *npobj, const NPVariant *args, uint32_t arg
bool npscript_hasProperty(NPObject *npobj, NPIdentifier name)
{
struct npscript *obj = (struct npscript *)npobj;
struct npscript_property *prop;
NPUTF8 *pname;
pname = browserfuncs->utf8fromidentifier(name);

View File

@ -310,10 +310,24 @@ int Plug_PluginThread(void *ctxptr)
Sys_UnlockMutex(ctx->mutex);
}
ctx->pub.downloading = true;
while(host_initialized && !ctx->shutdown && ctx->packagelist)
{
int total=0, done=0;
Sys_LockMutex(ctx->mutex);
for (dl = ctx->packagelist; dl; dl = dl->next)
{
total += dl->totalsize;
done += dl->completed;
}
dl = ctx->packagelist;
if (total != ctx->pub.dlsize || done != ctx->pub.dldone)
{
ctx->pub.dlsize = total;
ctx->pub.dldone = done;
if (ctx->bfuncs.StatusChanged)
ctx->bfuncs.StatusChanged(&ctx->pub);
}
if (!dl->file)
ctx->packagelist = dl->next;
else
@ -325,6 +339,7 @@ int Plug_PluginThread(void *ctxptr)
DL_Close(dl);
Sleep(10);
}
ctx->pub.downloading = false;
if (host_initialized && !ctx->shutdown)
{
@ -337,6 +352,8 @@ int Plug_PluginThread(void *ctxptr)
Host_FinishInit();
Sys_UnlockMutex(ctx->mutex);
}
if (ctx->bfuncs.StatusChanged)
ctx->bfuncs.StatusChanged(&ctx->pub);
VS_DebugLocation(__FILE__, __LINE__, "main loop");
while(host_initialized)
@ -354,7 +371,7 @@ int Plug_PluginThread(void *ctxptr)
sys_parentwindow = ctx->windowhnd;
sys_parentwidth = ctx->windowwidth;
sys_parentheight = ctx->windowheight;
// R_RestartRenderer_f();
Cbuf_AddText("vid_recenter\n", RESTRICT_LOCAL);
}
else
NPQTV_Sys_MainLoop();
@ -381,7 +398,8 @@ int Plug_PluginThread(void *ctxptr)
}
ctx->pub.running = false;
Sys_UnlockMutex(ctx->mutex);
InvalidateRgn(ctx->windowhnd, NULL, FALSE);
if (ctx->bfuncs.StatusChanged)
ctx->bfuncs.StatusChanged(&ctx->pub);
while(argc-- > 0)
free(argv[argc]);
@ -637,7 +655,11 @@ void LoadSplashImage(struct dl_download *dl)
free(image);
if (!f)
{
if (ctx->bfuncs.StatusChanged)
ctx->bfuncs.StatusChanged(&ctx->pub);
return;
}
len = VFS_GETLEN(f);
buffer = malloc(len);
@ -670,8 +692,8 @@ void LoadSplashImage(struct dl_download *dl)
ctx->splashheight = height;
BZ_Free(image);
if (ctx->windowhnd)
InvalidateRgn(ctx->windowhnd, NULL, FALSE);
if (ctx->bfuncs.StatusChanged)
ctx->bfuncs.StatusChanged(&ctx->pub);
}
}
@ -744,7 +766,7 @@ char *pscript_property_startserver_gets(struct context *ctx)
}
void pscript_property_startserver_sets(struct context *ctx, const char *val)
{
ctx->qtvf.connectiontype = QTVCT_CONNECT;
ctx->qtvf.connectiontype = QTVCT_JOIN;
Q_strncpyz(ctx->qtvf.server, val, sizeof(ctx->qtvf.server));
}
char *pscript_property_curserver_gets(struct context *ctx)
@ -774,6 +796,20 @@ void pscript_property_stream_sets(struct context *ctx, const char *val)
if (pscript_property_running_getb(ctx))
Cmd_ExecuteString(va("qtvplay \"%s\"\n", val), RESTRICT_INSECURE);
}
void pscript_property_map_sets(struct context *ctx, const char *val)
{
ctx->qtvf.connectiontype = QTVCT_MAP;
FILTER(val)
Q_strncpyz(ctx->qtvf.server, val, sizeof(ctx->qtvf.server));
if (pscript_property_running_getb(ctx))
Cmd_ExecuteString(va("map \"%s\"\n", val), RESTRICT_INSECURE);
}
float pscript_property_curver_getf(struct context *ctx)
{
return build_number();
}
void pscript_property_availver_setf(struct context *ctx, float val)
{
@ -816,13 +852,6 @@ void pscript_property_splash_sets(struct context *ctx, const char *val)
DL_Close(ctx->splashdownload);
ctx->splashdownload = NULL;
}
/*
if (ctx->browserfuncs.RequestDownload)
ctx->browserfuncs.RequestDownload(ctx->nppinstance, &SplashscreenImageDescriptor, ctx->qtvf.splashscreen);
else
HTTP_CL_Get();
*/
}
extern cvar_t skin, team, topcolor, bottomcolor, vid_fullscreen, cl_download_mapsrc;
@ -849,6 +878,7 @@ static struct pscript_property pscript_properties[] =
{"splash", false, NULL, NULL, pscript_property_splash_sets},
{"stream", false, NULL, NULL, pscript_property_stream_sets},
{"map", false, NULL, NULL, pscript_property_map_sets},
/*
else if (!stricmp(argn[i], "connType"))
@ -907,12 +937,6 @@ static struct pscript_property pscript_properties[] =
{
ctx->ondemoend = strdup(argv[i]);
}
else if (!stricmp(argn[i], "availVer"))
{
ctx->availver = atof(argv[i]);
if (ctx->availver <= NPQTV_VERSION)
ctx->availver = 0;
}
*/
{NULL}
};

View File

@ -3,21 +3,19 @@ typedef enum qboolean;
typedef void *vfsfile_t;
#endif
struct pipetype
{
int dead;
};
struct browserfuncs
{
qboolean (*RequestDownload)(void *ctx, struct pipetype *ftype, char *url);
void (*StatusChanged)(void *ctx); /*tells it that it needs to redraw the pre-active image*/
};
/*the conext structure contains this at the start*/
/*the conext structure contains this at the start (you can safely cast context->contextpublic)*/
struct contextpublic
{
qboolean running; /*set if the plugin context is actually active*/
qboolean downloading;
unsigned int dlsize;
unsigned int dldone;
float availver; /*this is the version of the plugin that is available, if current is better, use 0*/
#if defined(_WIN32) && defined(__QUAKEDEF_H__)
@ -25,6 +23,7 @@ struct contextpublic
void *oldwnd; /*not used in the plugin itself*/
void *oldproc; /*not used in the plugin itself*/
#endif
void *user;
};
#include <windows.h>

View File

@ -139,18 +139,6 @@ void Sys_ServerActivity(void)
{
}
//Without these two we cannot run Q2 gamecode.
void Sys_UnloadGame (void)
{
}
void *Sys_GetGameAPI (void *parms)
{
return NULL;
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
SDL_UnloadObject((void*)lib);
@ -179,6 +167,60 @@ dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs)
return (dllhandle_t*)lib;
}
//Without these two we cannot run Q2 gamecode.
dllhandle_t *q2gamedll;
void Sys_UnloadGame (void)
{
if (q2gamedll)
Sys_CloseLibrary(q2gamedll);
q2gamedll = NULL;
}
void *Sys_GetGameAPI (void *parms)
{
void *(*GetGameAPI)(void *);
dllfunction_t funcs[] =
{
{(void**)GetGameAPI, "GetGameAPI"},
{NULL,NULL}
};
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *searchpath;
const char *gamename = "gamesdl.so";
void *ret;
Con_DPrintf("Searching for %s\n", gamename);
getcwd(curpath, sizeof(curpath));
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
if (searchpath[0] == '/')
snprintf(name, sizeof(name), "%s/%s", searchpath, gamename);
else
snprintf(name, sizeof(name), "%s/%s/%s", curpath, searchpath, gamename);
q2gamedll = Sys_LoadLibrary(name, funcs);
if (q2gamedll && gamename)
{
ret = GetGameAPI(parms);
if (ret)
{
return ret;
}
Sys_CloseLibrary(q2gamedll);
q2gamedll = 0;
}
}
return NULL;
}
//used to see if a file exists or not.
int Sys_FileTime (char *path)

View File

@ -253,37 +253,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef VM_Q1
#endif
#if defined(D3DQUAKE)
//not supported in anything but GL. avoid bugs.
#undef AVAIL_FREETYPE
#endif
//remove any options that depend upon GL.
#ifndef SERVERONLY
#if !defined(GLQUAKE)
#if !defined(GLQUAKE) && !defined(D3DQUAKE)
#undef DOOMWADS
#undef HALFLIFEMODELS
#undef Q3BSPS
#undef R_XFLIP
#undef RUNTIMELIGHTING
#undef TERRAIN
#undef Q3CLIENT
#endif
#if !defined(GLQUAKE)
#undef TERRAIN
#endif
// undefine things not supported yet for D3D
#if defined(D3DQUAKE) && !defined(GLQUAKE)
#undef DDS // this is dumb
#undef HALFLIFEMODELS
#undef Q3BSPS
#undef Q3CLIENT
#undef Q2BSPS
#undef Q2CLIENT
#undef Q2SERVER
#endif
#endif
#if !defined(GLQUAKE) && !defined(SERVERONLY)
#if !defined(GLQUAKE) && !defined(D3DQUAKE) && !defined(SERVERONLY)
#undef Q3BSPS
#endif
#if !defined(Q3BSPS)

View File

@ -397,7 +397,8 @@ static int Alias_BuildLerps(float plerp[4], float *pose[4], int numbones, galias
int frame2;
float mlerp; //minor lerp, poses within a group.
int l = 0;
if (fg1time < 0)
fg1time = 0;
mlerp = (fg1time)*g1->rate;
frame1=mlerp;
frame2=frame1+1;
@ -422,6 +423,8 @@ static int Alias_BuildLerps(float plerp[4], float *pose[4], int numbones, galias
if (lerpfrac)
{
if (fg2time < 0)
fg2time = 0;
mlerp = (fg2time)*g2->rate;
frame1=mlerp;
frame2=frame1+1;

View File

@ -1636,6 +1636,7 @@ static qboolean GenerateCollisionMesh(world_t *world, model_t *mod, wedict_t *ed
mesh_t *mesh;
unsigned int numverts;
unsigned int numindexes,i;
unsigned int ni;
numverts = 0;
numindexes = 0;
@ -1662,8 +1663,11 @@ static qboolean GenerateCollisionMesh(world_t *world, model_t *mod, wedict_t *ed
Con_DPrintf("entity %i (classname %s) has no geometry\n", NUM_FOR_EDICT(world->progs, (edict_t*)ed), PR_GetString(world->progs, ed->v->classname));
return false;
}
ed->ode.ode_element3i = BZ_Malloc(numindexes*sizeof(index_t));
ed->ode.ode_element3i = BZ_Malloc(numindexes*sizeof(*ed->ode.ode_element3i));
ed->ode.ode_vertex3f = BZ_Malloc(numverts*sizeof(vec3_t));
ni = numindexes;
numverts = 0;
numindexes = 0;
for (sno = 0; sno < mod->nummodelsurfaces; sno++)

View File

@ -1801,7 +1801,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
conchar_t extstack[4];
int extstackdepth = 0;
unsigned int uc, l;
int utf8 = com_parseutf8.value;
int utf8 = com_parseutf8.ival;
conchar_t ext;
@ -1821,7 +1821,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
if (*str == 1 || *str == 2)
{
if (com_parseutf8.value)
if (com_parseutf8.ival)
defaultflags = (defaultflags&~CON_FGMASK) | (COLOR_MAGENTA<<CON_FGSHIFT);
else
defaultflags |= CON_HIGHCHARSMASK;
@ -1973,7 +1973,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
}
else if (str[1] == 'm')
{
if (com_parseutf8.value)
if (com_parseutf8.ival)
{
if ((ext & CON_FGMASK) != (COLOR_MAGENTA<<CON_FGSHIFT))
ext = (ext&~CON_FGMASK) | (COLOR_MAGENTA<<CON_FGSHIFT);
@ -2027,7 +2027,7 @@ conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t
{
if (!--outsize)
break;
if (com_parseutf8.value)
if (com_parseutf8.ival)
*out++ = (unsigned char)(*str) | ext;
else
*out++ = (unsigned char)(*str) | ext | 0xe000;
@ -3160,6 +3160,7 @@ void COM_Init (void)
Cvar_Register (&registered, "Copy protection");
Cvar_Register (&gameversion, "Gamecode");
Cvar_Register (&com_parseutf8, "Internationalisation");
com_parseutf8.ival = 1;

View File

@ -1,5 +1,5 @@
#include "quakedef.h"
#ifdef GLQUAKE
#if defined(GLQUAKE) || defined(D3DQUAKE)
#include "glquake.h"
#endif
#include "com_mesh.h"
@ -784,19 +784,21 @@ static int CM_CreateFacetFromPoints(q2cbrush_t *facet, vec3_t *verts, int numver
/*
* CM_CreatePatch
*/
static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const vec3_t *verts, const int *patch_cp )
static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const vec_t *verts, const int *patch_cp )
{
int step[2], size[2], flat[2];
int i, j, k ,u, v;
int numsides, totalsides;
q2cbrush_t *facets, *facet;
vec3_t *points;
vecV_t *points;
vec3_t tverts[4];
qbyte *data;
mplane_t *brushplanes;
patch->surface = shaderref;
// find the degree of subdivision in the u and v directions
Patch_GetFlatness( cm_subdivlevel, verts[0], 3, patch_cp, flat );
Patch_GetFlatness( cm_subdivlevel, verts, sizeof(vecV_t)/sizeof(vec_t), patch_cp, flat );
step[0] = 1 << flat[0];
step[1] = 1 << flat[1];
@ -805,15 +807,15 @@ static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const
if( size[0] <= 0 || size[1] <= 0 )
return;
data = BZ_Malloc( size[0] * size[1] * sizeof( vec3_t ) +
data = BZ_Malloc( size[0] * size[1] * sizeof( vecV_t ) +
( size[0]-1 ) * ( size[1]-1 ) * 2 * ( sizeof( q2cbrush_t ) + 32 * sizeof( mplane_t ) ) );
points = ( vec3_t * )data; data += size[0] * size[1] * sizeof( vec3_t );
points = ( vec3_t * )data; data += size[0] * size[1] * sizeof( vecV_t );
facets = ( q2cbrush_t * )data; data += ( size[0]-1 ) * ( size[1]-1 ) * 2 * sizeof( q2cbrush_t );
brushplanes = ( mplane_t * )data; data += ( size[0]-1 ) * ( size[1]-1 ) * 2 * MAX_FACET_PLANES * sizeof( mplane_t );
// fill in
Patch_Evaluate( verts[0], patch_cp, step, points[0], 3 );
Patch_Evaluate(verts, patch_cp, step, points[0], sizeof(vecV_t)/sizeof(vec_t));
totalsides = 0;
patch->numfacets = 0;
@ -859,7 +861,7 @@ static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const
}
}
if( patch->numfacets )
if (patch->numfacets)
{
qbyte *data;
@ -886,8 +888,6 @@ static void CM_CreatePatch( q3cpatch_t *patch, q2mapsurface_t *shaderref, const
}
}
patch->surface = shaderref;
for( i = 0; i < 3; i++ )
{
// spread the mins / maxs by a pixel
@ -1026,7 +1026,7 @@ qboolean CM_CreateBrush ( q2cbrush_t *brush, vec3_t *verts, q2mapsurface_t *surf
return true;
}
qboolean CM_CreatePatch ( q3cpatch_t *patch, int numverts, const vec3_t *verts, int *patch_cp )
qboolean CM_CreatePatch ( q3cpatch_t *patch, int numverts, const vec_t *verts, int *patch_cp )
{
int step[2], size[2], flat[2], i, u, v;
vec4_t points[MAX_CM_PATCH_VERTS], pointss[MAX_CM_PATCH_VERTS];
@ -1186,7 +1186,7 @@ qboolean CM_CreatePatchesForLeafs (void)
checkout[k] = numpatches++;
//gcc warns without this cast
CM_CreatePatch ( patch, surf, (const vec3_t *)map_verts + face->firstvert, face->patch_cp );
CM_CreatePatch ( patch, surf, (const vec_t *)map_verts + face->firstvert, face->patch_cp );
}
leaf->contents |= patch->surface->c.value;
@ -2355,10 +2355,10 @@ qboolean CModQ3_LoadIndexes (lump_t *l)
return false;
}
count = l->filelen / sizeof(*in);
if (count < 1 || count >= MAX_Q3MAP_INDICES)
if (count < 1 || count >= MAX_Q3MAP_INDICES || count > MAX_INDICIES)
{
Con_Printf (CON_ERROR "MOD_LoadBmodel: bad surfedges count in %s: %i\n",
loadmodel->name, count);
Con_Printf (CON_ERROR "MOD_LoadBmodel: too many indicies in %s: %i\n",
loadmodel->name, count);
return false;
}
@ -2459,7 +2459,7 @@ qboolean CModRBSP_LoadFaces (lump_t *l)
return true;
}
#ifdef GLQUAKE
#if defined(GLQUAKE) || defined(D3DQUAKE)
/*
=================
@ -2554,9 +2554,6 @@ byte_vec4_t tempcolors_array[MAX_ARRAY_VERTS];
mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, int numverts, int firstvert)
{
int numindexes, patch_cp[2], step[2], size[2], flat[2], i, u, v, p;
vec4_t colors[MAX_ARRAY_VERTS], points[MAX_ARRAY_VERTS], normals[MAX_ARRAY_VERTS],
lm_st[MAX_ARRAY_VERTS], tex_st[MAX_ARRAY_VERTS];
vec4_t colors2[MAX_ARRAY_VERTS], points2[MAX_ARRAY_VERTS], normals2[MAX_ARRAY_VERTS], lm_st2[MAX_ARRAY_VERTS], tex_st2[MAX_ARRAY_VERTS];
mesh_t *mesh;
index_t *indexes;
float subdivlevel;
@ -2575,14 +2572,6 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
if ( subdivlevel < 1 )
subdivlevel = 1;
for ( i = 0; i < numverts; i++ ) {
VectorCopy ( map_verts[firstvert + i], points[i] );
VectorCopy ( map_normals_array[firstvert + i], normals[i] );
Vector4Copy ( map_colors4f_array[firstvert + i], colors[i] );
Vector2Copy ( map_vertstmexcoords[firstvert + i], tex_st[i] );
Vector2Copy ( map_vertlstmexcoords[firstvert + i], lm_st[i] );
}
// find the degree of subdivision in the u and v directions
Patch_GetFlatness ( subdivlevel, map_verts[firstvert], sizeof(vecV_t)/sizeof(vec_t), patch_cp, flat );
@ -2593,11 +2582,9 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
size[1] = (patch_cp[1] / 2) * step[1] + 1;
numverts = size[0] * size[1];
if ( numverts < 0 || numverts > MAX_ARRAY_VERTS ) {
if ( numverts < 0 || numverts > MAX_ARRAY_VERTS )
return NULL;
}
mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
sz = sizeof(mesh_t) + numverts * (
sizeof(vecV_t)+
sizeof(vec3_t)+
@ -2607,36 +2594,31 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
sizeof(vec2_t)+
sizeof(vec4_t));
allocbuf = Hunk_Alloc(sz);
mesh = (mesh_t *)(allocbuf+(sz-=sizeof(mesh_t)));
mesh->xyz_array = (vecV_t *)(allocbuf+(sz-=numverts*sizeof(vecV_t)));
mesh->normals_array = (vec3_t *)(allocbuf+(sz-=numverts*sizeof(vec3_t)));
mesh->snormals_array = (vec3_t *)(allocbuf+(sz-=numverts*sizeof(vec3_t)));
mesh->tnormals_array = (vec3_t *)(allocbuf+(sz-=numverts*sizeof(vec3_t)));
mesh->st_array = (vec2_t *)(allocbuf+(sz-=numverts*sizeof(vec2_t)));
mesh->lmst_array = (vec2_t *)(allocbuf+(sz-=numverts*sizeof(vec2_t)));
mesh->colors4f_array = (vec4_t *)(allocbuf+(sz-=numverts*sizeof(vec4_t)));
#ifdef _DEBUG
if (sz)
Sys_Error("Bug\n");
#endif
sz-=sizeof(mesh_t);
mesh = (mesh_t *)(allocbuf+sz);
sz-=numverts*sizeof(vecV_t);
mesh->xyz_array = (vecV_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec3_t);
mesh->normals_array = (vec3_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec3_t);
mesh->snormals_array = (vec3_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec3_t);
mesh->tnormals_array = (vec3_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec2_t);
mesh->st_array = (vec2_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec2_t);
mesh->lmst_array = (vec2_t *)(allocbuf+sz);
sz-=numverts*sizeof(vec4_t);
mesh->colors4f_array = (vec4_t *)(allocbuf+sz);
mesh->numvertexes = numverts;
// fill in
Patch_Evaluate ( points[0], patch_cp, step, points2[0], 3 );
Patch_Evaluate ( colors[0], patch_cp, step, colors2[0], 4 );
Patch_Evaluate ( normals[0], patch_cp, step, normals2[0], 3 );
Patch_Evaluate ( lm_st[0], patch_cp, step, lm_st2[0], 2 );
Patch_Evaluate ( tex_st[0], patch_cp, step, tex_st2[0], 2 );
for (i = 0; i < numverts; i++)
{
VectorCopy ( points2[i], mesh->xyz_array[i] );
VectorNormalize2 ( normals2[i], mesh->normals_array[i] );
ColorNormalize ( colors2[i], mesh->colors4f_array[i] );
Vector2Copy ( tex_st2[i], mesh->st_array[i] );
Vector2Copy ( lm_st2[i], mesh->lmst_array[i] );
}
Patch_Evaluate ( map_verts[firstvert], patch_cp, step, mesh->xyz_array[0], sizeof(vecV_t)/sizeof(vec_t));
Patch_Evaluate ( map_colors4f_array[firstvert], patch_cp, step, mesh->colors4f_array[0], 4 );
Patch_Evaluate ( map_normals_array[firstvert], patch_cp, step, mesh->normals_array[0], 3 );
Patch_Evaluate ( map_vertstmexcoords[firstvert], patch_cp, step, mesh->st_array[0], 2 );
Patch_Evaluate ( map_vertlstmexcoords[firstvert], patch_cp, step, mesh->lmst_array[0], 2 );
// compute new indexes avoiding adding invalid triangles
numindexes = 0;

File diff suppressed because it is too large Load Diff

View File

@ -3,19 +3,52 @@
#include <d3d9.h>
LPDIRECT3DDEVICE9 pD3DDev9;
typedef struct d3dtexture_s
{
struct d3dtexture_s *next;
texid_t tex;
qboolean loaded;
char name[1];
} d3dtexture_t;
static d3dtexture_t *d3dtextures;
static d3dtexture_t *d3d_lookup_texture(char *ident)
{
d3dtexture_t *tex;
if (ident)
{
for (tex = d3dtextures; tex; tex = tex->next)
if (!strcmp(tex->name, ident))
return tex;
tex = malloc(sizeof(*tex)+strlen(ident));
strcpy(tex->name, ident);
}
else
{
tex = malloc(sizeof(*tex));
tex->name[0] = '\0';
}
tex->tex.ptr = NULL;
tex->next = d3dtextures;
d3dtextures = tex;
return tex;
}
extern cvar_t gl_picmip;
extern cvar_t gl_picmip2d;
texid_t D3D_AllocNewTexture(int width, int height)
{
return r_nulltex;
IDirect3DTexture9 *tx;
texid_t ret = r_nulltex;
if (!FAILED(IDirect3DDevice9_CreateTexture(pD3DDev9, width, height, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &tx, NULL)))
ret.ptr = tx;
return ret;
}
static void D3D9_RoundDimensions(int *scaled_width, int *scaled_height, qboolean mipmap)
{
// if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
@ -59,7 +92,7 @@ static void D3D9_RoundDimensions(int *scaled_width, int *scaled_height, qboolean
*scaled_height = 1;
}
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int width, int height)
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int width, int height, unsigned int flags)
{
int x, y;
unsigned int *dest;
@ -121,10 +154,13 @@ static void Upload_Texture_32(LPDIRECT3DTEXTURE9 tex, unsigned int *data, int wi
}
IDirect3DTexture9_UnlockRect(tex, 0);
if (!(flags & IF_NOMIPMAP))
IDirect3DBaseTexture9_GenerateMipSubLevels(tex);
}
//create a basic shader from a 32bit image
static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(char *name, unsigned int *data, int width, int height, int flags)
static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(d3dtexture_t *tex, unsigned int *data, int width, int height, int flags)
{
int nwidth, nheight;
@ -141,20 +177,19 @@ static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32(char *name, unsigned int *data
nheight = height;
D3D9_RoundDimensions(&nwidth, &nheight, !(flags & IF_NOMIPMAP));
IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, 0, ((flags & IF_NOMIPMAP)?0:D3DUSAGE_AUTOGENMIPMAP), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL);
newsurf = tex->tex.ptr;
if (!newsurf)
IDirect3DDevice9_CreateTexture(pD3DDev9, nwidth, nheight, 0, ((flags & IF_NOMIPMAP)?0:D3DUSAGE_AUTOGENMIPMAP), D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &newsurf, NULL);
if (!newsurf)
return NULL;
Upload_Texture_32(newsurf, data, width, height);
if (!(flags & IF_NOMIPMAP))
IDirect3DBaseTexture9_GenerateMipSubLevels(newsurf);
Upload_Texture_32(newsurf, data, width, height, flags);
return (LPDIRECT3DBASETEXTURE9)newsurf;
}
static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8(char *name, unsigned char *data, int width, int height, int flags, enum uploadfmt fmt)
static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8(d3dtexture_t *tex, unsigned char *data, int width, int height, int flags, enum uploadfmt fmt)
{
static unsigned trans[1024*1024];
int i, s;
@ -167,7 +202,22 @@ static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8(char *name, unsigned char *data
s = width*height;
// if there are no transparent pixels, make it a 3 component
// texture even if it was specified as otherwise
if ((fmt!=TF_SOLID8) && !(flags & IF_NOALPHA))
if (fmt == TF_TRANS8_FULLBRIGHT)
{
for (i=0 ; i<s ; i++)
{
p = data[i];
noalpha = true;
if (p > 255-vid.fullbright)
trans[i] = d_8to24rgbtable[p];
else
{
noalpha = false;
trans[i] = d_8to24rgbtable[p] & 0x00ffffff;
}
}
}
else if ((fmt!=TF_SOLID8) && !(flags & IF_NOALPHA))
{
noalpha = true;
for (i=0 ; i<s ; i++)
@ -242,7 +292,7 @@ static LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8(char *name, unsigned char *data
trans[i] = d_8to24rgbtable[data[i]];
}
}
return D3D9_LoadTexture_32(name, trans, width, height, flags);
return D3D9_LoadTexture_32(tex, trans, width, height, flags);
}
void D3D_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, int width, int height, unsigned int flags)
@ -250,7 +300,10 @@ void D3D_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, int
switch (fmt)
{
case TF_RGBA32:
Upload_Texture_32(tex.ptr, data, width, height, flags);
break;
default:
OutputDebugString(va("D3D_LoadTextureFmt doesn't support fmt %i (%s)", fmt, name));
break;
}
}
@ -258,6 +311,9 @@ void D3D_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, int
texid_t D3D_LoadTextureFmt (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags)
{
texid_t tid;
d3dtexture_t *tex;
tex = d3d_lookup_texture(identifier);
switch (fmt)
{
case TF_SOLID8:
@ -265,12 +321,14 @@ texid_t D3D_LoadTextureFmt (char *identifier, int width, int height, enum upload
case TF_H2_T7G1:
case TF_H2_TRANS8_0:
case TF_H2_T4A4:
tid.ptr = D3D9_LoadTexture_8(identifier, data, width, height, flags, fmt);
case TF_TRANS8_FULLBRIGHT:
tid.ptr = D3D9_LoadTexture_8(tex, data, width, height, flags, fmt);
return tid;
case TF_RGBA32:
tid.ptr = D3D9_LoadTexture_32(identifier, data, width, height, flags);
tid.ptr = D3D9_LoadTexture_32(tex, data, width, height, flags);
return tid;
default:
OutputDebugString(va("D3D_LoadTextureFmt doesn't support fmt %i (%s)", fmt, name));
return r_nulltex;
}
}
@ -281,6 +339,16 @@ texid_t D3D_LoadCompressed(char *name)
}
texid_t D3D_FindTexture (char *identifier)
{
d3dtexture_t *tex = d3d_lookup_texture(identifier);
return tex->tex;
}
texid_t D3D_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags)
{
return r_nulltex;
}
texid_t D3D_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags)
{
return r_nulltex;
}

View File

@ -54,9 +54,9 @@ LPDIRECT3DDEVICE9 pD3DDev9;
static qboolean vid_initializing;
extern qboolean scr_initialized; // ready to draw
extern qboolean scr_drawloading;
extern qboolean scr_initialized; // ready to draw
extern qboolean scr_drawloading;
extern qboolean scr_con_forcedraw;
cvar_t vid_hardwaregamma;
@ -313,8 +313,8 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
{
GetClientRect(mainwindow, &window_rect);
// force width/height to be updated
vid.pixelwidth = window_rect.right - window_rect.left;
vid.pixelheight = window_rect.bottom - window_rect.top;
//vid.pixelwidth = window_rect.right - window_rect.left;
//vid.pixelheight = window_rect.bottom - window_rect.top;
// Cvar_ForceCallback(&vid_conautoscale);
// Cvar_ForceCallback(&vid_conwidth);
}
@ -475,7 +475,7 @@ static void initD3D9(HWND hWnd, rendererstate_t *info)
i,
D3DDEVTYPE_HAL,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp,
&pD3DDev9);
@ -761,7 +761,7 @@ void Matrix4_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, fl
float znear, float zfar);
void d3dx_ortho(float *m);
static void D3D9_Set2D (void)
void D3D9_Set2D (void)
{
float m[16];
D3DVIEWPORT9 vport;
@ -804,80 +804,6 @@ static int d3d9error(int i)
return i;
}
typedef struct {
float x, y, z;
unsigned int colour;
} d3d9bsvert_t;
static void D3D9_BrightenScreen (void)
{
d3d9bsvert_t d3d9bsvert[4];
index_t d3d9quadindexes[6] = {
0, 1, 2,
0, 2, 3
};
extern cvar_t gl_contrast;
float f;
unsigned int colour;
RSpeedMark();
if (gl_contrast.value <= 1.0)
return;
f = gl_contrast.value;
f = min (f, 3);
IDirect3DDevice9_SetTexture (pD3DDev9, 0, NULL);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHABLENDENABLE, TRUE);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_SRCBLEND, D3DBLEND_DESTCOLOR);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_DESTBLEND, D3DBLEND_ONE);
while (f > 1)
{
if (f >= 2)
colour = 0xffffffff;
else
{
colour = (f-1)*255;
colour = (colour * 0x010101) | 0xff000000;
}
d3d9bsvert[0].x = 0;
d3d9bsvert[0].y = 0;
d3d9bsvert[0].z = 0;
d3d9bsvert[0].colour = colour;
d3d9bsvert[1].x = vid.width;
d3d9bsvert[1].y = 0;
d3d9bsvert[1].z = 0;
d3d9bsvert[1].colour = colour;
d3d9bsvert[2].x = vid.width;
d3d9bsvert[2].y = vid.height;
d3d9bsvert[2].z = 0;
d3d9bsvert[2].colour = colour;
d3d9bsvert[3].x = 0;
d3d9bsvert[3].y = vid.height;
d3d9bsvert[3].z = 0;
d3d9bsvert[3].colour = colour;
IDirect3DDevice9_SetFVF(pD3DDev9, D3DFVF_XYZ|D3DFVF_DIFFUSE);
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, D3DPT_TRIANGLELIST, 0, 4, 2, d3d9quadindexes, D3DFMT_QINDEX, d3d9bsvert, sizeof(d3d9bsvert[0]));
f *= 0.5;
}
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ALPHABLENDENABLE, FALSE);
RSpeedEnd(RSPEED_PALETTEFLASHES);
}
static void (D3D9_SCR_UpdateScreen) (void)
{
extern int keydown[];
@ -886,7 +812,7 @@ static void (D3D9_SCR_UpdateScreen) (void)
#ifdef TEXTEDITOR
extern qboolean editormodal;
#endif
qboolean nohud;
qboolean nohud, noworld;
RSpeedMark();
switch (IDirect3DDevice9_TestCooperativeLevel(pD3DDev9))
@ -987,7 +913,7 @@ static void (D3D9_SCR_UpdateScreen) (void)
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
GLR_BrightenScreen();
R2D_BrightenScreen();
if (key_dest == key_console)
Con_DrawConsole(vid_conheight.value/2, false);
@ -1005,7 +931,7 @@ static void (D3D9_SCR_UpdateScreen) (void)
#if defined(_WIN32)
Media_RecordFrame();
#endif
// GLR_BrightenScreen();
// R2D_BrightenScreen();
IDirect3DDevice9_EndScene(pD3DDev9);
IDirect3DDevice9_Present(pD3DDev9, NULL, NULL, NULL, NULL);
@ -1026,6 +952,7 @@ static void (D3D9_SCR_UpdateScreen) (void)
//
SCR_SetUpToDrawConsole ();
noworld = false;
nohud = false;
#ifdef VM_CG
@ -1038,18 +965,32 @@ static void (D3D9_SCR_UpdateScreen) (void)
nohud = true;
else
#endif
if (r_worldentity.model && uimenu != 1)
if (uimenu != 1)
{
V_RenderView ();
// Q1BSP_TestClipDecal();
if (r_worldentity.model && cls.state == ca_active)
V_RenderView ();
else
{
noworld = true;
}
}
D3D9_Set2D ();
D3D9_BrightenScreen();
R2D_BrightenScreen();
if (!nohud)
scr_con_forcedraw = false;
if (noworld)
{
if (scr_con_current != vid.height)
Draw_ConsoleBackground(0, vid.height, true);
else
scr_con_forcedraw = true;
nohud = true;
}
else if (!nohud)
SCR_TileClear ();
SCR_DrawTwoDimensional(uimenu, nohud);
@ -1188,7 +1129,9 @@ static void (D3D9_R_RenderView) (void)
{
D3D9_SetupViewPort();
d3d9error(IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0));
Surf_DrawWorld();
R_SetFrustum (r_projection_matrix, r_view_matrix);
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
Surf_DrawWorld();
P_DrawParticles ();
}

View File

@ -104,7 +104,6 @@ void D3D9R_RenderDynamicLightmaps (msurface_t *fa, int shift);
//
// vid_d3d9.c
//
void D3D9_BrightenScreen (void);
void D3D9_D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
void D3D9_D_EndDirectRect (int x, int y, int width, int height);
void D3D9_GetBufferSize(int *width, int *height);

File diff suppressed because it is too large Load Diff

View File

@ -881,6 +881,9 @@ static qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel, unsigned int
static shader_t reskinnedmodelshader;
void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
{
#ifndef GLQUAKE
#pragma message("DISABLED MODEL RENDERING")
#else
extern cvar_t r_drawflat;
model_t *clmodel;
galiasinfo_t *inf;
@ -1154,6 +1157,7 @@ void R_DrawGAliasModel (entity_t *e, unsigned int rmode)
qglDepthRange (gldepthmin, gldepthmax);
BE_SelectMode(rmode, 0);
#endif
}
//returns result in the form of the result vector

View File

@ -1244,7 +1244,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, const avec4_t *src, ave
}
}
static void deformgen(const deformv_t *deformv, int cnt, const avec4_t *src, avec4_t *dst, const mesh_t *mesh)
static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV_t *dst, const mesh_t *mesh)
{
float *table;
int j, k;
@ -1710,18 +1710,23 @@ static void BE_SendPassBlendAndDepth(unsigned int sbits)
}
if (shaderstate.flags)
{
if (shaderstate.flags & BEF_FORCEADDITIVE)
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS)) | (SBITS_SRCBLEND_ONE | SBITS_DSTBLEND_ONE);
else if (shaderstate.flags & BEF_FORCETRANSPARENT) /*if transparency is forced, clear alpha test bits*/
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS)) | (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
if (!(sbits & SBITS_BLEND_BITS))
{ /*only force blend bits if its not already blended*/
if (shaderstate.flags & BEF_FORCEADDITIVE)
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
| (SBITS_SRCBLEND_ONE | SBITS_DSTBLEND_ONE);
else if (shaderstate.flags & BEF_FORCETRANSPARENT) /*if transparency is forced, clear alpha test bits*/
sbits = (sbits & ~(SBITS_MISC_DEPTHWRITE|SBITS_BLEND_BITS|SBITS_ATEST_BITS))
| (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
}
if (shaderstate.flags & BEF_FORCENODEPTH) /*EF_NODEPTHTEST dp extension*/
sbits |= SBITS_MISC_NODEPTHTEST;
else
{
if (shaderstate.flags & BEF_FORCEDEPTHTEST) /*if transparency is forced, clear alpha test bits*/
if (shaderstate.flags & BEF_FORCEDEPTHTEST)
sbits &= ~SBITS_MISC_NODEPTHTEST;
if (shaderstate.flags & BEF_FORCEDEPTHWRITE) /*if transparency is forced, clear alpha test bits*/
if (shaderstate.flags & BEF_FORCEDEPTHWRITE)
sbits |= SBITS_MISC_DEPTHWRITE;
}
}

View File

@ -118,7 +118,7 @@ int sizeofuploadmemorybuffer;
qbyte *uploadmemorybufferintermediate;
int sizeofuploadmemorybufferintermediate;
index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
static index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
extern qbyte gammatable[256];
@ -383,10 +383,6 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
GL_EndRendering ();
GL_DoSwap();
Font_Init();
Shader_Init();
cs_texture = GL_AllocNewTexture();
crosshair_shader = R_RegisterShader("crosshairshader",
@ -879,38 +875,6 @@ void GLDraw_EndDisc (void)
{
}
// conback/font callbacks
void GL_Smoothfont_Callback(struct cvar_s *var, char *oldvalue)
{
//FIXME: reimplement
}
void GL_Fontinwardstep_Callback(struct cvar_s *var, char *oldvalue)
{
//FIXME: reimplement
if (var->value)
char_instep = custom_char_instep*bound(0, var->value, 1);
else
char_instep = 0;
}
void GL_Font_Callback(struct cvar_s *var, char *oldvalue)
{
//FIXME: reimplement
GLVID_Console_Resize();
}
void GL_Conback_Callback(struct cvar_s *var, char *oldvalue)
{
if (*var->string)
conback = R_RegisterPic(var->string);
if (!conback || !conback->width)
conback = R_RegisterCustom("console", NULL, NULL);
if (!conback || !conback->width)
conback = R_RegisterPic("gfx/conback.lmp");
}
/*
================
GL_Set2D

View File

@ -46,3 +46,6 @@ void R2D_EditorBackground (void);
void R2D_TileClear (int x, int y, int w, int h);
void R2D_Init(void);
void R2D_Shutdown(void);
void R2D_PolyBlend (void);
void R2D_BrightenScreen (void);

View File

@ -282,6 +282,7 @@ static void Font_Flush(void)
fontplanes.planechanged = false;
}
font_mesh.istrifan = (font_mesh.numvertexes == 4);
if (font_colourmask & CON_NONCLEARBG)
{
fontplanes.backshader->defaulttextures.base = r_nulltex;

View File

@ -565,7 +565,7 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
// fill it in
//
Mod_DoCRC(mod, (char*)buf, com_filesize);
switch (LittleLong(*(unsigned *)buf))
{
//The binary 3d mesh model formats
@ -573,7 +573,7 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
if (!Mod_LoadQ1Model(mod, buf))
continue;
break;
#ifdef MD2MODELS
case MD2IDALIASHEADER:
if (!Mod_LoadQ2Model(mod, buf))
@ -623,7 +623,7 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
//Binary Map formats
#ifdef Q2BSPS
#if defined(Q2BSPS) || defined(Q3BSPS)
case ('F'<<0)+('B'<<8)+('S'<<16)+('P'<<24):
case ('R'<<0)+('B'<<8)+('S'<<16)+('P'<<24):
case IDBSPHEADER: //looks like id switched to have proper ids

View File

@ -66,7 +66,7 @@ void R_AnimateLight (void)
v2 = cl_lightstyle[j].map[v2] - 'a';
d_lightstylevalue[j] = (v1*(1-f) + v2*(f))*22;
}
}
}
/*
@ -509,26 +509,7 @@ void GLQ3_LightGrid(model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_a
index[5] = index[1]+(index[1]<(lg->numlightgridelems-1));
index[6] = index[2]+(index[2]<(lg->numlightgridelems-1));
index[7] = index[3]+(index[3]<(lg->numlightgridelems-1));
/*
qglDisable(GL_TEXTURE_2D);
qglDisable(GL_DEPTH_TEST);
GL_CullFace(0);
qglColor4f(1,1,1,1);
qglBegin(GL_QUADS);
for ( i = 0; i < 8; i++ )
{
vec3_t pos;
for(j=0;j<3;j++)
pos[j] = (vi[j]
+((i&1)/1*(j==0))
+((i&2)/2*(j==1))
+((i&4)/4*(j==2))
)*lg->gridSize[j] + lg->gridMins[j];
qglVertex3fv(pos);
}
qglEnd();
*/
for ( i = 0; i < 8; i++ )
{
if ( index[i] < 0 || index[i] >= (lg->numlightgridelems) )

View File

@ -114,7 +114,6 @@ cvar_t gl_maxdist = SCVAR("gl_maxdist", "8192");
cvar_t r_polygonoffset_submodel_factor = SCVAR("r_polygonoffset_submodel_factor", "0.05");
cvar_t r_polygonoffset_submodel_offset = SCVAR("r_polygonoffset_submodel_offset", "25");
extern cvar_t gl_contrast;
extern cvar_t gl_mindist;
extern cvar_t ffov;
@ -158,9 +157,6 @@ int scenepp_fisheye_parm_fov;
int scenepp_panorama_program;
int scenepp_panorama_parm_fov;
shader_t *shader_brighten;
shader_t *shader_polyblend;
// KrimZon - init post processing - called in GL_CheckExtensions, when they're called
// I put it here so that only this file need be changed when messing with the post
// processing shaders
@ -340,28 +336,6 @@ void GL_InitSceneProcessingShaders_MenuTint(void)
void GL_InitSceneProcessingShaders (void)
{
shader_brighten = R_RegisterShader("constrastshader",
"{\n"
"{\n"
"map $whiteimage\n"
"blendfunc gl_dst_color gl_one\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}\n"
);
shader_polyblend = R_RegisterShader("polyblendshader",
"{\n"
"{\n"
"map $whiteimage\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"}\n"
);
if (gl_config.arb_shader_objects)
{
GL_InitSceneProcessingShaders_WaterWarp();
@ -889,53 +863,6 @@ void GLR_DrawEntitiesOnList (void)
}
}
/*
============
R_PolyBlend
============
*/
//bright flashes and stuff
void R_PolyBlend (void)
{
if (!sw_blend[3])
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
R2D_ImageColours (sw_blend[0], sw_blend[1], sw_blend[2], sw_blend[3]);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_polyblend);
}
//for lack of hardware gamma
void GLR_BrightenScreen (void)
{
float f;
RSpeedMark();
if (gl_contrast.value <= 1.0)
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
f = gl_contrast.value;
f = min (f, 3);
while (f > 1)
{
if (f >= 2)
R2D_ImageColours (1, 1, 1, 1);
else
R2D_ImageColours (f - 1, f - 1, f - 1, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_brighten);
f *= 0.5;
}
RSpeedEnd(RSPEED_PALETTEFLASHES);
}
/*
===============
R_SetupFrame
@ -1800,6 +1727,7 @@ static void R_RenderWaterWarp(void)
}
#ifdef FISH
/*FIXME: we could use geometry shaders to draw to all 6 faces at once*/
qboolean R_RenderScene_Fish(void)
{
int cmapsize = 512;

View File

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef GLQUAKE
#include "glquake.h"
#include "shader.h"
#include "gl_draw.h"
#include <time.h>
@ -216,7 +217,7 @@ void GLSCR_UpdateScreen (void)
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
GLR_BrightenScreen();
R2D_BrightenScreen();
if (key_dest == key_console)
Con_DrawConsole(vid_conheight.value/2, false);
@ -233,7 +234,7 @@ void GLSCR_UpdateScreen (void)
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
GLR_BrightenScreen();
R2D_BrightenScreen();
GL_EndRendering ();
GL_DoSwap();
RSpeedEnd(RSPEED_TOTALREFRESH);
@ -280,8 +281,8 @@ void GLSCR_UpdateScreen (void)
if (!noworld)
{
R_PolyBlend ();
GLR_BrightenScreen();
R2D_PolyBlend ();
R2D_BrightenScreen();
}
scr_con_forcedraw = false;

View File

@ -30,6 +30,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
#include <GL/gl.h>
#include "glsupp.h"
extern texid_t missing_texture;
static qboolean shader_reload_needed;
@ -181,11 +186,11 @@ typedef struct shadercache_s {
struct shadercache_s *hash_next;
} shadercache_t;
static shadercache_t *shader_hash[HASH_SIZE];
static shadercache_t **shader_hash;
static char shaderbuf[MAX_QPATH * 256];
int shaderbuflen;
shader_t r_shaders[MAX_SHADERS];
shader_t *r_shaders;
//static char r_skyboxname[MAX_QPATH];
//static float r_skyheight;
@ -959,9 +964,19 @@ static void Shaderpass_VideoMap (shader_t *shader, shaderpass_t *pass, char **pt
else
Con_DPrintf (CON_WARNING "(shader %s) Couldn't load video %s\n", shader->name, token);
pass->flags |= SHADER_PASS_VIDEOMAP;
shader->flags |= SHADER_VIDEOMAP;
pass->texgen = T_GEN_VIDEOMAP;
if (pass->cin)
{
pass->flags |= SHADER_PASS_VIDEOMAP;
shader->flags |= SHADER_VIDEOMAP;
pass->texgen = T_GEN_VIDEOMAP;
}
else
{
pass->texgen = T_GEN_DIFFUSE;
pass->rgbgen = RGB_GEN_CONST;
pass->rgbgen_func.type = SHADER_FUNC_CONSTANT;
pass->rgbgen_func.args[0] = pass->rgbgen_func.args[1] = pass->rgbgen_func.args[2] = 0;
}
#endif
}
@ -1413,6 +1428,10 @@ qboolean Shader_Init (void)
{
shaderbuflen = 0;
r_shaders = calloc(MAX_SHADERS, sizeof(shader_t));
shader_hash = calloc (HASH_SIZE, sizeof(*shader_hash));
Con_Printf ( "Initializing Shaders.\n" );
COM_EnumerateFiles("shaders/*.shader", Shader_InitCallback, NULL);
@ -1604,16 +1623,16 @@ void Shader_Shutdown (void)
}
}
memset (r_shaders, 0, sizeof(shader_t)*MAX_SHADERS);
memset (shader_hash, 0, sizeof(shader_hash));
Z_Free(r_shaders);
r_shaders = NULL;
Z_Free(shader_hash);
shader_hash = NULL;
shader_reload_needed = false;
}
void Shader_SetBlendmode (shaderpass_t *pass)
{
#ifdef GLQUAKE
if (pass->texgen == T_GEN_DELUXMAP)
{
pass->blendmode = GL_DOT3_RGB_ARB;
@ -1626,7 +1645,7 @@ void Shader_SetBlendmode (shaderpass_t *pass)
return;
}
if (!(pass->shaderbits & SBITS_BLEND_BITS) && qglMTexCoord2fSGIS)
if (!(pass->shaderbits & SBITS_BLEND_BITS))
{
if ((pass->rgbgen == RGB_GEN_IDENTITY) && (pass->alphagen == ALPHA_GEN_IDENTITY))
{
@ -1652,7 +1671,6 @@ void Shader_SetBlendmode (shaderpass_t *pass)
pass->blendmode = GL_DECAL;
else
pass->blendmode = GL_MODULATE;
#endif
}
void Shader_Readpass (shader_t *shader, char **ptr)

View File

@ -57,8 +57,6 @@ void GL_InitFogTexture(void);
void GL_BeginRendering (void);
void GL_EndRendering (void);
void R_PolyBlend (void);
void GLR_BrightenScreen (void);
void GLR_NetGraph (void);
void GLR_FrameTimeGraph (int frametime);
void GL_FlushSkinCache(void);
@ -235,12 +233,6 @@ extern const char *gl_vendor;
extern const char *gl_renderer;
extern const char *gl_version;
#ifdef Q3SHADERS
FTE_DEPRECATED void R_UnlockArrays (void);
FTE_DEPRECATED void R_IBrokeTheArrays(void);
FTE_DEPRECATED void R_ClearArrays (void);
#endif
FTE_DEPRECATED void PPL_RevertToKnownState(void);
#ifdef GLQUAKE
@ -364,9 +356,8 @@ void GLR_MarkQ2Lights (dlight_t *light, int bit, mnode_t *node);
void GLR_RenderDlights (void);
void R_InitFlashblends (void);
int GLR_LightPoint (vec3_t p);
void GLQ3_LightGrid(model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir);
#endif
void GLQ3_LightGrid(model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir);
//
// gl_heightmap.c

View File

@ -338,7 +338,7 @@ struct shader_s
int registration_sequence;
};
extern shader_t r_shaders[];
extern shader_t *r_shaders;
extern int be_maxpasses;

View File

@ -6,6 +6,8 @@
#ifdef WEBCLIENT
qboolean HTTPDL_Decide(struct dl_download *dl);
/*
This file does one thing. Connects to servers and grabs the specified file. It doesn't do any uploading whatsoever. Live with it.
It doesn't use persistant connections.
@ -108,6 +110,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
if (strnicmp(msg, "HTTP/", 5))
{ //pre version 1. (lame servers.
con->state = HC_GETTING;
dl->status = DL_ACTIVE;
con->contentlength = -1; //meaning end of stream.
}
else
@ -176,7 +179,27 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
else
{
HTTP_Cleanup(dl);
Q_strncpyz(dl->redir, Location, sizeof(dl->redir));
if (*Location == '/')
{
char *cur = *dl->redir?dl->redir:dl->url;
char *curserver = cur;
char *curpath;
/*same server+protocol*/
if (!strncmp(curserver, "http://", 7))
curserver += 7;
curpath = strchr(curserver, '/');
if (!curpath)
curpath = curserver + strlen(curserver);
if (cur == dl->redir)
*curpath = 0;
else
Q_strncpyz(dl->redir, cur, (curpath-cur) + 1);
Q_strncatz(dl->redir, Location, sizeof(dl->redir));
}
else
Q_strncpyz(dl->redir, Location, sizeof(dl->redir));
dl->poll = HTTPDL_Decide;
dl->status = DL_PENDING;
}
return true;
}
@ -195,6 +218,8 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
con->bufferused -= ammount;
dl->totalsize = con->contentlength;
if (!dl->file)
{
if (*dl->localname)
@ -216,6 +241,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
con->state = HC_GETTING;
dl->status = DL_ACTIVE;
}
//Fall through
@ -313,6 +339,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
dl->status = DL_FINISHED;
return false;
}
dl->completed = con->totalreceived;
break;
}
@ -412,7 +439,9 @@ qboolean HTTPDL_Poll(struct dl_download *dl)
if (dl->ctx)
{
HTTP_DL_Work(dl);
if (!HTTP_DL_Work(dl))
if (dl->status != DL_FINISHED)
dl->status = DL_FAILED;
if (dl->status == DL_FAILED)
{
HTTP_Cleanup(dl);
@ -512,6 +541,7 @@ void DL_Close(struct dl_download *dl)
static struct dl_download *activedownloads;
static struct dl_download *showndownload;
/*create a download context and add it to the list, for lazy people*/
struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*NotifyFunction)(struct dl_download *dl))
{
@ -549,7 +579,7 @@ void HTTP_CL_Think(void)
if (cls.downloadmethod == DL_HTTP)
{
if (!strcmp(cls.downloadlocalname, con->localname))
if (showndownload == con)
{
cls.downloadmethod = DL_NONE;
*cls.downloadlocalname = *cls.downloadremotename = 0;
@ -562,12 +592,13 @@ void HTTP_CL_Think(void)
if (!cls.downloadmethod)
{
cls.downloadmethod = DL_HTTP;
showndownload = con;
strcpy(cls.downloadlocalname, con->localname);
strcpy(cls.downloadremotename, con->localname);
strcpy(cls.downloadremotename, con->url);
}
if (cls.downloadmethod == DL_HTTP)
{
if (!strcmp(cls.downloadlocalname, con->localname))
if (showndownload == con)
{
if (con->status == DL_FINISHED)
cls.downloadpercent = 100;

View File

@ -93,7 +93,6 @@ query "Do you want to enable the text editor ?" TEXTEDITOR
query "Do you want to enable the plugin support ?" PLUGINS
query "Do you want to enable csqc support ?" CSQC_DAT
query "Do you want to enable menu.dat support (used by nexuiz) ?" MENU_DAT
query "Do you want to enable quake3 shader support ?" Q3SHADERS
query "Do you want to enable the built in irc client (note that there is also a plugin irc client, which cooler) ?" IRCCLIENT

View File

@ -548,6 +548,7 @@ pbool QCC_PR_CheckKeyword(int keywordenabled, char *string);
void VARGS QCC_PR_ParseError (int errortype, char *error, ...);
void VARGS QCC_PR_ParseWarning (int warningtype, char *error, ...);
void VARGS QCC_PR_Warning (int type, char *file, int line, char *error, ...);
void VARGS QCC_PR_Note (int type, char *file, int line, char *error, ...);
void QCC_PR_ParsePrintDef (int warningtype, QCC_def_t *def);
void VARGS QCC_PR_ParseErrorPrintDef (int errortype, QCC_def_t *def, char *error, ...);
@ -827,6 +828,7 @@ extern int numtypeinfos;
extern int maxtypeinfos;
extern int ForcedCRC;
extern pbool defaultnoref;
extern pbool defaultstatic;
extern int *qcc_tempofs;

View File

@ -8308,13 +8308,12 @@ void QCC_PR_ParseDefs (char *classname)
QCC_function_t *f;
QCC_dfunction_t *df;
int i;
extern pbool defaultstatic;
pbool shared=false;
pbool isstatic=defaultstatic;
pbool externfnc=false;
pbool isconstant = false;
pbool isvar = false;
pbool noref = false;
pbool noref = defaultnoref;
pbool nosave = false;
pbool allocatenew = true;
pbool inlinefunction = false;

View File

@ -202,6 +202,7 @@ void QCC_FindBestInclude(char *newfile, char *currentfile, char *rootpath)
QCC_Include(fullname);
}
pbool defaultnoref;
pbool defaultstatic;
int ForcedCRC;
int QCC_PR_LexInteger (void);
@ -799,6 +800,10 @@ pbool QCC_PR_Precompiler(void)
{
ForcedCRC = atoi(msg);
}
else if (!strncmp(qcc_token, "noref", 8))
{
defaultnoref = atoi(msg);
}
else if (!strncmp(qcc_token, "defaultstatic", 13))
{
defaultstatic = atoi(msg);
@ -2710,6 +2715,30 @@ void VARGS QCC_PR_ParseWarning (int type, char *error, ...)
}
}
void VARGS QCC_PR_Note (int type, char *file, int line, char *error, ...)
{
va_list argptr;
char string[1024];
if (qccwarningdisabled[type])
return;
va_start (argptr,error);
QC_vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
QCC_PR_PrintScope();
if (file)
{
if (flag_msvcstyle)
printf ("%s(%i) : note: %s\n", file, line, string);
else
printf ("%s:%i: note: %s\n", file, line, string);
}
else
printf ("note: %s\n", string);
}
void VARGS QCC_PR_Warning (int type, char *file, int line, char *error, ...)
{
va_list argptr;

View File

@ -564,6 +564,7 @@ pbool QCC_WriteData (int crc)
pbool debugtarget = false;
pbool types = false;
int outputsize = 16;
pbool warnedunref = false;
if (numstatements==1 && numfunctions==1 && numglobaldefs==1 && numfielddefs==1)
{
@ -704,6 +705,11 @@ pbool QCC_WriteData (int crc)
QCC_PR_Warning(WARN_NOTREFERENCEDCONST, strings + def->s_file, def->s_line, "%s no references", def->name);
else
QCC_PR_Warning(WARN_NOTREFERENCED, strings + def->s_file, def->s_line, "%s no references", def->name);
if (!warnedunref)
{
QCC_PR_Note(WARN_NOTREFERENCED, NULL, 0, "You can use the noref prefix or pragma to silence this message.");
warnedunref = true;
}
if (opt_unreferenced && def->type->type != ev_field)
{
@ -2987,12 +2993,12 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
if (!p || p >= argc-1 || argv[p+1][0] == '-')
p = QCC_CheckParm ("-srcfile");
if (p && p < argc-1 )
sprintf (qccmprogsdat, "%s%s", qccmsourcedir, argv[p+1]);
sprintf (qccmprogsdat, "%s", argv[p+1]);
else
{ //look for a preprogs.src... :o)
sprintf (qccmprogsdat, "%spreprogs.src", qccmsourcedir);
sprintf (qccmprogsdat, "preprogs.src");
if (externs->FileSize(qccmprogsdat) <= 0)
sprintf (qccmprogsdat, "%sprogs.src", qccmsourcedir);
sprintf (qccmprogsdat, "progs.src");
}
numsourcefiles = 0;
@ -3011,8 +3017,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
if (currentsourcefile)
printf("-------------------------------------\n");
strcpy(qccmprogsdat, sourcefileslist[currentsourcefile++]);
sprintf (qccmprogsdat, "%s%s", qccmsourcedir, sourcefileslist[currentsourcefile++]);
printf ("Source file: %s\n", qccmprogsdat);
if (QCC_LoadFile (qccmprogsdat, (void *)&qccmsrc) == -1)

View File

@ -2018,7 +2018,7 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals)
PF_setmodel_Internal(prinst, e, m);
}
void PF_set_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2set_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ //qc/hc lacks string manipulation.
edict_t *e;
char *shortname;
@ -3227,7 +3227,7 @@ void PF_conprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
void PF_printf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2printf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char temp[256];
float v;
@ -3242,7 +3242,7 @@ void PF_printf (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Con_Printf (PR_GetStringOfs(prinst, OFS_PARM0),temp);
}
void PF_printv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2printv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char temp[256];
@ -3251,7 +3251,7 @@ void PF_printv (progfuncs_t *prinst, struct globalvars_s *pr_globals)
Con_Printf (PR_GetStringOfs(prinst, OFS_PARM0),temp);
}
void PF_spawn_temp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2spawn_temp (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ed;
ed = ED_Alloc(prinst);
@ -3400,7 +3400,7 @@ void PF_precache_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
PF_precache_model_Internal(prinst, s);
}
void PF_precache_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2precache_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{ //qc/hc lacks string manipulation.
char *shortname;
char fullname[MAX_QPATH];
@ -4413,68 +4413,68 @@ void PF_WriteString2 (progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_PARM1) = old;
}
void PF_Single_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteByte(MSG_PRERELONE, (qbyte)G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteChar(MSG_PRERELONE, (char)G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteShort(MSG_PRERELONE, (short)G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteLong(MSG_PRERELONE, G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteAngle(MSG_PRERELONE, G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteCoord(MSG_PRERELONE, G_FLOAT(OFS_PARM1));
}
void PF_Single_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteString(MSG_PRERELONE, PF_VarString(prinst, 1, pr_globals));
}
void PF_Single_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtSingle_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteEntity(MSG_PRERELONE, (short)G_EDICTNUM(prinst, OFS_PARM1));
}
void PF_Broadcast_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteByte(MSG_BROADCAST, (qbyte)G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteChar(MSG_BROADCAST, (char)G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteShort(MSG_BROADCAST, (short)G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteLong(MSG_BROADCAST, G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteAngle(MSG_BROADCAST, G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteCoord(MSG_BROADCAST, G_FLOAT(OFS_PARM0));
}
void PF_Broadcast_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteString(MSG_BROADCAST, PF_VarString(prinst, 0, pr_globals));
}
void PF_Broadcast_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_qtBroadcast_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
NPP_NQWriteEntity(MSG_BROADCAST, (short)G_EDICTNUM(prinst, OFS_PARM0));
}
@ -6734,7 +6734,7 @@ void PF_clientcommand (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_AdvanceFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2AdvanceFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *Ent;
float Start,End,Result;
@ -6779,7 +6779,7 @@ void PF_AdvanceFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
G_FLOAT(OFS_RETURN) = Result;
}
void PF_RewindFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2RewindFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *Ent;
float Start,End,Result;
@ -6813,7 +6813,7 @@ void PF_RewindFrame(progfuncs_t *prinst, struct globalvars_s *pr_globals)
#define WF_CYCLE_WRAPPED 2
#define WF_LAST_FRAME 3
void PF_advanceweaponframe (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2advanceweaponframe (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *ent;
float startframe,endframe;
@ -6850,7 +6850,7 @@ void PF_advanceweaponframe (progfuncs_t *prinst, struct globalvars_s *pr_globals
G_FLOAT(OFS_RETURN) = state;
}
void PR_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc)
void PRH2_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc)
{
char temp[16];
if (classnum < 1)
@ -6877,7 +6877,7 @@ void PR_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc)
}
}
void PF_setclass (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2setclass (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float NewClass;
int entnum;
@ -6906,7 +6906,7 @@ void PF_setclass (progfuncs_t *prinst, struct globalvars_s *pr_globals)
client->sendinfo = true;
}
void PF_v_factor(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2v_factor(progfuncs_t *prinst, struct globalvars_s *pr_globals)
// returns (v_right * factor_x) + (v_forward * factor_y) + (v_up * factor_z)
{
float *range;
@ -6929,7 +6929,7 @@ void PF_v_factor(progfuncs_t *prinst, struct globalvars_s *pr_globals)
VectorCopy (result, G_VECTOR(OFS_RETURN));
}
void PF_v_factorrange(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2v_factorrange(progfuncs_t *prinst, struct globalvars_s *pr_globals)
// returns (v_right * factor_x) + (v_forward * factor_y) + (v_up * factor_z)
{
float num,*minv,*maxv;
@ -6961,7 +6961,7 @@ void PF_v_factorrange(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
char *T_GetString(int num);
void PF_plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
@ -7009,7 +7009,7 @@ void PF_plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
static void PF_movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
static void PF_h2movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
vec3_t v;
edict_t *ent;
@ -7032,7 +7032,7 @@ static void PF_movestep (progfuncs_t *prinst, struct globalvars_s *pr_globals)
pr_global_struct->self = oldself;
}
void PF_concatv(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2concatv(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *in,*range;
vec3_t result;
@ -7051,7 +7051,7 @@ void PF_concatv(progfuncs_t *prinst, struct globalvars_s *pr_globals)
VectorCopy (result, G_VECTOR(OFS_RETURN));
}
void PF_matchAngleToSlope(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2matchAngleToSlope(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
edict_t *actor;
vec3_t v_forward, old_forward, old_right, new_angles2 = { 0, 0, 0 };
@ -7083,25 +7083,25 @@ void PF_matchAngleToSlope(progfuncs_t *prinst, struct globalvars_s *pr_globals)
actor->v->angles[2] = (1-fabs(dot))*pitch*mod;
}
void PF_starteffect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2starteffect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_DPrintf("Start effect %i\n", (int)G_FLOAT(OFS_PARM0));
}
void PF_endeffect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2endeffect(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
Con_DPrintf("Stop effect %i\n", (int)G_FLOAT(OFS_PARM0));
}
void PF_rain_go(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2rain_go(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
}
void PF_StopSound(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2StopSound(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
}
void PF_getstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_h2getstring(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s = T_GetString(G_FLOAT(OFS_PARM0)-1);
RETURN_PSTRING(s);
@ -9042,39 +9042,39 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"writestring", PF_WriteString, 58, 58, 58}, //58
{"writeentity", PF_WriteEntity, 59, 59, 59}, //59
{"swritebyte", PF_Single_WriteByte}, //52
{"swritechar", PF_Single_WriteChar}, //53
{"swriteshort", PF_Single_WriteShort}, //54
{"swritelong", PF_Single_WriteLong}, //55
{"swritecoord", PF_Single_WriteCoord}, //56
{"swriteangle", PF_Single_WriteAngle}, //57
{"swritestring", PF_Single_WriteString}, //58
{"swriteentity", PF_Single_WriteEntity},
{"swritebyte", PF_qtSingle_WriteByte}, //52
{"swritechar", PF_qtSingle_WriteChar}, //53
{"swriteshort", PF_qtSingle_WriteShort}, //54
{"swritelong", PF_qtSingle_WriteLong}, //55
{"swritecoord", PF_qtSingle_WriteCoord}, //56
{"swriteangle", PF_qtSingle_WriteAngle}, //57
{"swritestring", PF_qtSingle_WriteString}, //58
{"swriteentity", PF_qtSingle_WriteEntity},
{"bwritebyte", PF_Broadcast_WriteByte}, //59
{"bwritechar", PF_Broadcast_WriteChar}, //60
{"bwriteshort", PF_Broadcast_WriteShort}, //61
{"bwritelong", PF_Broadcast_WriteLong}, //62
{"bwritecoord", PF_Broadcast_WriteCoord}, //63
{"bwriteangle", PF_Broadcast_WriteAngle}, //64
{"bwritestring", PF_Broadcast_WriteString}, //65
{"bwriteentity", PF_Broadcast_WriteEntity}, //66
{"bwritebyte", PF_qtBroadcast_WriteByte}, //59
{"bwritechar", PF_qtBroadcast_WriteChar}, //60
{"bwriteshort", PF_qtBroadcast_WriteShort}, //61
{"bwritelong", PF_qtBroadcast_WriteLong}, //62
{"bwritecoord", PF_qtBroadcast_WriteCoord}, //63
{"bwriteangle", PF_qtBroadcast_WriteAngle}, //64
{"bwritestring", PF_qtBroadcast_WriteString}, //65
{"bwriteentity", PF_qtBroadcast_WriteEntity}, //66
{"printfloat", PF_printf, 0, 0, 60}, //60
{"printfloat", PF_h2printf, 0, 0, 60}, //60
{"sin", PF_Sin, 0, 0, 62, 60}, //60
{"cos", PF_Cos, 0, 0, 61, 61}, //61
{"sqrt", PF_Sqrt, 0, 0, 84, 62}, //62
{"AdvanceFrame", PF_AdvanceFrame, 0, 0, 63, 0},
{"printvec", PF_printv, 0, 0, 64, 0}, //64
{"RewindFrame", PF_RewindFrame, 0, 0, 65, 0},
{"AdvanceFrame", PF_h2AdvanceFrame, 0, 0, 63, 0},
{"printvec", PF_h2printv, 0, 0, 64, 0}, //64
{"RewindFrame", PF_h2RewindFrame, 0, 0, 65, 0},
{"particleexplosion",PF_h2particleexplosion,0, 0, 81, 0},
{"movestep", PF_movestep, 0, 0, 82, 0},
{"advanceweaponframe",PF_advanceweaponframe,0, 0, 83, 0},
{"movestep", PF_h2movestep, 0, 0, 82, 0},
{"advanceweaponframe",PF_h2advanceweaponframe,0, 0, 83, 0},
{"setclass", PF_setclass, 0, 0, 66, 0},
{"setclass", PF_h2setclass, 0, 0, 66, 0},
{"changepitch", PF_changepitch, 0, 0, 0, 63},
{"tracetoss", PF_TraceToss, 0, 0, 0, 64},
@ -9097,7 +9097,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"precache_file2", PF_precache_file, 77, 77, 0}, //77
{"setspawnparms", PF_setspawnparms, 78, 78, 78}, //78
{"plaque_draw", PF_plaque_draw, 0, 0, 79}, //79
{"plaque_draw", PF_h2plaque_draw, 0, 0, 79}, //79
{"logfrag", PF_logfrag, 0, 79, 0, 79}, //79
// Tomaz - QuakeC String Manipulation Begin
@ -9117,7 +9117,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"tq_fputs", PF_fputs, 0, 0, 0, 89, true},// #89 void(float fhandle, string s) fputs (QSG_FILE)
// Tomaz - QuakeC File System End
{"rain_go", PF_rain_go, 0, 0, 80, 0}, //80
{"rain_go", PF_h2rain_go, 0, 0, 80, 0}, //80
{"infokey", PF_infokey, 0, 80, 0, 80}, //80
{"stof", PF_stof, 0, 81, 0, 81}, //81
@ -9154,25 +9154,25 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"forcedemoframe", PF_forcedemoframe, 0, 0, 0, 103, true},
//end of mvdsv
{"setpuzzlemodel", PF_set_puzzle_model,0, 0, 87, 0},
{"starteffect", PF_starteffect, 0, 0, 88, 0}, //FIXME
{"endeffect", PF_endeffect, 0, 0, 89, 0}, //FIXME
{"getstring", PF_getstring, 0, 0, 92, 0}, //FIXME
{"spawntemp", PF_spawn_temp, 0, 0, 93, 0},
{"setpuzzlemodel", PF_h2set_puzzle_model,0, 0, 87, 0},
{"starteffect", PF_h2starteffect, 0, 0, 88, 0}, //FIXME
{"endeffect", PF_h2endeffect, 0, 0, 89, 0}, //FIXME
{"getstring", PF_h2getstring, 0, 0, 92, 0}, //FIXME
{"spawntemp", PF_h2spawn_temp, 0, 0, 93, 0},
{"v_factor", PF_v_factor, 0, 0, 94, 0},
{"v_factorrange", PF_v_factorrange, 0, 0, 95, 0},
{"v_factor", PF_h2v_factor, 0, 0, 94, 0},
{"v_factorrange", PF_h2v_factorrange, 0, 0, 95, 0},
{"precache_puzzle_model", PF_precache_puzzle_model, 0, 0, 90, 0},
{"concatv", PF_concatv, 0, 0, 91, 0},
{"precache_puzzle_model", PF_h2precache_puzzle_model, 0, 0, 90, 0},
{"concatv", PF_h2concatv, 0, 0, 91, 0},
{"precache_sound3", PF_precache_sound, 0, 0, 96, 0},
{"precache_model3", PF_precache_model, 0, 0, 97, 0},//please don't use...
{"matchangletoslope",PF_matchAngleToSlope,0, 0, 99, 0},
{"matchangletoslope",PF_h2matchAngleToSlope,0, 0, 99, 0},
{"precache_sound4", PF_precache_sound, 0, 0, 101, 0},
{"precache_model4", PF_precache_model, 0, 0, 102, 0},
{"precache_file4", PF_precache_file, 0, 0, 103, 0},
{"stopsound", PF_StopSound, 0, 0, 106, 0},
{"stopsound", PF_h2StopSound, 0, 0, 106, 0},
{"precache_model4", PF_precache_model, 0, 0, 116, 0},//please don't use...
{"precache_sound4", PF_precache_sound, 0, 0, 117, 0},
@ -9588,23 +9588,23 @@ void PR_ResetBuiltins(progstype_t type) //fix all nulls to PF_FIXME and add any
if (type == PROG_PREREL)
{
pr_builtin[52] = PF_Single_WriteByte;
pr_builtin[53] = PF_Single_WriteChar;
pr_builtin[54] = PF_Single_WriteShort;
pr_builtin[55] = PF_Single_WriteLong;
pr_builtin[56] = PF_Single_WriteCoord;
pr_builtin[57] = PF_Single_WriteAngle;
pr_builtin[58] = PF_Single_WriteString;
pr_builtin[52] = PF_qtSingle_WriteByte;
pr_builtin[53] = PF_qtSingle_WriteChar;
pr_builtin[54] = PF_qtSingle_WriteShort;
pr_builtin[55] = PF_qtSingle_WriteLong;
pr_builtin[56] = PF_qtSingle_WriteCoord;
pr_builtin[57] = PF_qtSingle_WriteAngle;
pr_builtin[58] = PF_qtSingle_WriteString;
//lack of writeentity is intentional (prerel doesn't have it.
pr_builtin[59] = PF_Broadcast_WriteByte;
pr_builtin[60] = PF_Broadcast_WriteChar;
pr_builtin[61] = PF_Broadcast_WriteShort;
pr_builtin[62] = PF_Broadcast_WriteLong;
pr_builtin[63] = PF_Broadcast_WriteCoord;
pr_builtin[64] = PF_Broadcast_WriteAngle;
pr_builtin[65] = PF_Broadcast_WriteString;
pr_builtin[66] = PF_Broadcast_WriteEntity;
pr_builtin[59] = PF_qtBroadcast_WriteByte;
pr_builtin[60] = PF_qtBroadcast_WriteChar;
pr_builtin[61] = PF_qtBroadcast_WriteShort;
pr_builtin[62] = PF_qtBroadcast_WriteLong;
pr_builtin[63] = PF_qtBroadcast_WriteCoord;
pr_builtin[64] = PF_qtBroadcast_WriteAngle;
pr_builtin[65] = PF_qtBroadcast_WriteString;
pr_builtin[66] = PF_qtBroadcast_WriteEntity;
}
if (!pr_compatabilitytest.value)

View File

@ -221,7 +221,7 @@ vfsfile_t *sv_fraglogfile;
void SV_FixupName(char *in, char *out, unsigned int outlen);
void SV_AcceptClient (netadr_t adr, int userid, char *userinfo);
void Master_Shutdown (void);
void PR_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc);
void PRH2_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc);
char *SV_BannedReason (netadr_t *a);
#ifdef SQL
@ -4270,7 +4270,7 @@ void SV_ExtractFromUserinfo (client_t *cl)
val = Info_ValueForKey (cl->userinfo, "cl_playerclass");
if (val)
{
PR_SetPlayerClass(cl, atoi(val), false);
PRH2_SetPlayerClass(cl, atoi(val), false);
}
// msg command

View File

@ -740,7 +740,7 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
Net_ProxySend(cluster, dest, html, strlen(html));
Net_ProxySend(cluster, dest, hostname, strlen(hostname));
html =
"/plugimg.jpg\">"
"/qtvsplash.jpg\">"
"<param name=\"game\" value=\"q1\">"
"<param name=\"dataDownload\" value=\"id1/pak0.pak:http://random.nquake.com/qsw106.zip\">"
/*once again for firefox and similar friends*/
@ -754,7 +754,7 @@ static void HTTPSV_GeneratePlugin(cluster_t *cluster, oproxy_t *dest)
Net_ProxySend(cluster, dest, html, strlen(html));
Net_ProxySend(cluster, dest, hostname, strlen(hostname));
html =
"/plugimg.jpg\">"
"/qtvsplash.jpg\">"
"<param name=\"game\" value=\"q1\">"
"<param name=\"dataDownload\" value=\"id1/pak0.pak:http://random.nquake.com/qsw106.zip\">"
"It looks like you either don't have the required plugin or its not supported by your browser.<br/>"
@ -1068,7 +1068,7 @@ void HTTPSV_GetMethod(cluster_t *cluster, oproxy_t *pend)
else REDIRECTIF("/", "/plugin.html")
else REDIRECTIF("/", "/nowplaying.html")
else REDIRECTIF("/about.html", "http://www.fteqw.com/")
else REDIRECTIF("/plugimg.jpg", "/file/plugimg.jpg") /*lame, very lame*/
else REDIRECTIF("/qtvsplash.jpg", "/file/qtvsplash.jpg") /*lame, very lame*/
else REDIRECTIF("/npfte.xpi", "/file/npfte.xpi") /*lame, very lame*/
else REDIRECTIF("/npfte.exe", "/file/npfte.exe") /*lame, very lame*/
else REDIRECTIF("/iefte.exe", "/file/iefte.exe") /*lame, very lame*/