Cleaned up GL a minor amount more.
Sounds can now be recorded while capturing to tga sequences (as raw sound). Fixed frame limits a little. Passed the unicode key values around to a few more key input functions. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3332 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
bce186834f
commit
10accd2908
30 changed files with 434 additions and 272 deletions
|
@ -1179,7 +1179,7 @@ void CG_Command_f(void)
|
|||
}
|
||||
}
|
||||
|
||||
qboolean CG_KeyPress(int key, int down)
|
||||
qboolean CG_KeyPress(int key, int unicode, int down)
|
||||
{
|
||||
if (!cgvm || !(keycatcher&8))
|
||||
return false;
|
||||
|
|
|
@ -2622,7 +2622,8 @@ void CL_LinkPlayers (void)
|
|||
ent->forcedshader = NULL;
|
||||
#endif
|
||||
|
||||
if (state->command.impulse && cl.model_precache_vwep[0])
|
||||
//the extra modelindex check is to stop lame mods from using vweps with rings
|
||||
if (state->command.impulse && cl.model_precache_vwep[0] && state->modelindex == cl_playerindex)
|
||||
ent->model = cl.model_precache_vwep[0];
|
||||
else
|
||||
ent->model = cl.model_precache[state->modelindex];
|
||||
|
|
|
@ -1411,7 +1411,7 @@ int UI_MenuState(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
qboolean UI_KeyPress(int key, qboolean down)
|
||||
qboolean UI_KeyPress(int key, int unicode, qboolean down)
|
||||
{
|
||||
extern qboolean keydown[256];
|
||||
extern int keyshift[256]; // key to map to if shift held down in console
|
||||
|
|
|
@ -976,7 +976,7 @@ void CSQC_Input_Frame(int lplayernum, usercmd_t *cmd);
|
|||
void CSQC_WorldLoaded(void);
|
||||
qboolean CSQC_ParseTempEntity(unsigned char firstbyte);
|
||||
qboolean CSQC_ConsoleCommand(char *cmd);
|
||||
qboolean CSQC_KeyPress(int key, qboolean down);
|
||||
qboolean CSQC_KeyPress(int key, int unicode, qboolean down);
|
||||
int CSQC_StartSound(int entnum, int channel, char *soundname, vec3_t pos, float vol, float attenuation);
|
||||
void CSQC_ParseEntities(void);
|
||||
qboolean CSQC_SettingListener(void);
|
||||
|
@ -1168,7 +1168,7 @@ 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);
|
||||
void Media_Send_GetSize(cin_t *cin, int *x, int *y);
|
||||
void Media_Send_KeyEvent(cin_t *cin, int button, int event);
|
||||
void Media_Send_KeyEvent(cin_t *cin, int button, int unicode, int event);
|
||||
|
||||
void MVD_Interpolate(void);
|
||||
|
||||
|
|
|
@ -547,8 +547,7 @@ void Con_PrintCon (console_t *con, char *txt)
|
|||
cr = true;
|
||||
break;
|
||||
case '\n':
|
||||
if (cr)
|
||||
cr = false;
|
||||
cr = false;
|
||||
while (con->linecount >= con_maxlines.value)
|
||||
{
|
||||
if (con->oldest == con->current)
|
||||
|
@ -578,7 +577,10 @@ void Con_PrintCon (console_t *con, char *txt)
|
|||
break;
|
||||
default:
|
||||
if (cr)
|
||||
{
|
||||
con->current->length = 0;
|
||||
cr = false;
|
||||
}
|
||||
|
||||
if (selstartline == con->current)
|
||||
selstartline = NULL;
|
||||
|
|
|
@ -1371,7 +1371,7 @@ void IN_MouseEvent (int mstate)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (dinput)
|
||||
if (dinput && mouseactive)
|
||||
return;
|
||||
|
||||
#ifdef HLCLIENT
|
||||
|
@ -1379,7 +1379,7 @@ void IN_MouseEvent (int mstate)
|
|||
return;
|
||||
#endif
|
||||
|
||||
if (mouseactive || (key_dest != key_game))
|
||||
if (1)//mouseactive || (key_dest != key_game))
|
||||
{
|
||||
// perform button actions
|
||||
for (i=0 ; i<sysmouse.numbuttons ; i++)
|
||||
|
@ -1463,10 +1463,11 @@ static void ProcessMouse(mouse_t *mouse, float *movements, int pnum)
|
|||
if(in_xflip.value) mx *= -1;
|
||||
#endif
|
||||
|
||||
mousemove_x += mx;
|
||||
mousemove_y += my;
|
||||
|
||||
if (Key_MouseShouldBeFree())
|
||||
{
|
||||
mousemove_x += mx;
|
||||
mousemove_y += my;
|
||||
mousecursor_x += mx;
|
||||
mousecursor_y += my;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
key up events are sent even if in console mode
|
||||
|
||||
*/
|
||||
void Editor_Key(int key);
|
||||
void Editor_Key(int key, int unicode);
|
||||
|
||||
#define KEY_MODIFIERSTATES 8
|
||||
#define MAXCMDLINE 256
|
||||
|
@ -451,7 +451,7 @@ qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Key_ConsoleRelease(int key)
|
||||
void Key_ConsoleRelease(int key, int unicode)
|
||||
{
|
||||
if (key == K_MOUSE1)
|
||||
con_mousedown[2] = false;
|
||||
|
@ -479,7 +479,6 @@ Interactive line editing and console scrollback
|
|||
void Key_Console (unsigned int unicode, int key)
|
||||
{
|
||||
char *clipText;
|
||||
int upperconbound;
|
||||
|
||||
if (con_current->redirect)
|
||||
{
|
||||
|
@ -1301,12 +1300,12 @@ qboolean Key_MouseShouldBeFree(void)
|
|||
//if true, the input code is expected to return mouse cursor positions rather than deltas
|
||||
|
||||
extern int mouseusedforgui;
|
||||
if (mouseusedforgui) //I don't like this
|
||||
return true;
|
||||
// if (mouseusedforgui) //I don't like this
|
||||
// return true;
|
||||
|
||||
if (key_dest == key_menu)
|
||||
{
|
||||
if (m_state == m_complex || m_state == m_plugin || m_state == m_menu_dat)
|
||||
if (m_state == m_complex || m_state == m_plugin /*|| m_state == m_menu_dat*/)
|
||||
return true;
|
||||
}
|
||||
if (key_dest == key_console)
|
||||
|
@ -1463,11 +1462,11 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
if (key_dest == key_game)
|
||||
{
|
||||
#ifdef CSQC_DAT
|
||||
if (CSQC_KeyPress(key, down)) //give csqc a chance to handle it.
|
||||
if (CSQC_KeyPress(key, unicode, down)) //give csqc a chance to handle it.
|
||||
return;
|
||||
#endif
|
||||
#ifdef VM_CG
|
||||
if (CG_KeyPress(key, down))
|
||||
if (CG_KeyPress(key, unicode, down))
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
@ -1482,7 +1481,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
if (key_dest == key_game)
|
||||
#endif
|
||||
{
|
||||
if (UI_KeyPress(key, down)) //Allow the UI to see the escape key. It is possible that a developer may get stuck at a menu.
|
||||
if (UI_KeyPress(key, unicode, down)) //Allow the UI to see the escape key. It is possible that a developer may get stuck at a menu.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1490,7 +1489,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
if (!down)
|
||||
{
|
||||
if (key_dest == key_menu)
|
||||
M_Keyup (key);
|
||||
M_Keyup (key, unicode);
|
||||
return;
|
||||
}
|
||||
switch (key_dest)
|
||||
|
@ -1499,11 +1498,11 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
Key_Message (key, unicode);
|
||||
break;
|
||||
case key_menu:
|
||||
M_Keydown (key);
|
||||
M_Keydown (key, unicode);
|
||||
break;
|
||||
#ifdef TEXTEDITOR
|
||||
case key_editor:
|
||||
Editor_Key (key);
|
||||
Editor_Key (key, unicode);
|
||||
break;
|
||||
#endif
|
||||
case key_game:
|
||||
|
@ -1524,7 +1523,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
#ifndef NOMEDIA
|
||||
if (key_dest == key_game && Media_PlayingFullScreen())
|
||||
{
|
||||
Media_Send_KeyEvent(NULL, key, down?0:1);
|
||||
Media_Send_KeyEvent(NULL, key, unicode, down?0:1);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1541,10 +1540,10 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
switch (key_dest)
|
||||
{
|
||||
case key_menu:
|
||||
M_Keyup (key);
|
||||
M_Keyup (key, unicode);
|
||||
break;
|
||||
case key_console:
|
||||
Key_ConsoleRelease(key);
|
||||
Key_ConsoleRelease(key, unicode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1589,7 +1588,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
if (key != '`' && key != '~')
|
||||
if (key_dest == key_game || !down)
|
||||
{
|
||||
if (UI_KeyPress(key, down) && down) //UI is allowed to take these keydowns. Keyups are always maintained.
|
||||
if (UI_KeyPress(key, unicode, down) && down) //UI is allowed to take these keydowns. Keyups are always maintained.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1617,7 +1616,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
return;
|
||||
}
|
||||
|
||||
if (shift_down)
|
||||
if (shift_down && unicode < K_MAX && keyshift[unicode])
|
||||
unicode = keyshift[unicode];
|
||||
|
||||
if (!down)
|
||||
|
@ -1625,7 +1624,7 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
switch (key_dest)
|
||||
{
|
||||
case key_menu:
|
||||
M_Keyup (key);
|
||||
M_Keyup (key, unicode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1639,11 +1638,11 @@ void Key_Event (int key, unsigned int unicode, qboolean down)
|
|||
Key_Message (key, unicode);
|
||||
break;
|
||||
case key_menu:
|
||||
M_Keydown (key);
|
||||
M_Keydown (key, unicode);
|
||||
break;
|
||||
#ifdef TEXTEDITOR
|
||||
case key_editor:
|
||||
Editor_Key (key);
|
||||
Editor_Key (key, unicode);
|
||||
break;
|
||||
#endif
|
||||
case key_game:
|
||||
|
|
|
@ -814,7 +814,7 @@ struct cin_s {
|
|||
void (*shutdown)(cin_t *cin); //warning: don't free cin_t
|
||||
//these are any interactivity functions you might want...
|
||||
void (*cursormove) (struct cin_s *cin, float posx, float posy); //pos is 0-1
|
||||
void (*key) (struct cin_s *cin, int code, int event);
|
||||
void (*key) (struct cin_s *cin, int code, int unicode, int event);
|
||||
qboolean (*setsize) (struct cin_s *cin, int width, int height);
|
||||
void (*getsize) (struct cin_s *cin, int *width, int *height);
|
||||
void (*changestream) (struct cin_s *cin, char *streamname);
|
||||
|
@ -833,7 +833,6 @@ struct cin_s {
|
|||
PGETFRAME pgf;
|
||||
|
||||
LPWAVEFORMAT pWaveFormat;
|
||||
HWND capturewindow;
|
||||
|
||||
//sound stuff
|
||||
int soundpos;
|
||||
|
@ -1746,13 +1745,13 @@ void Media_Send_Command(cin_t *cin, char *command)
|
|||
return;
|
||||
cin->changestream(cin, command);
|
||||
}
|
||||
void Media_Send_KeyEvent(cin_t *cin, int button, int event)
|
||||
void Media_Send_KeyEvent(cin_t *cin, int button, int unicode, int event)
|
||||
{
|
||||
if (!cin)
|
||||
cin = fullscreenvid;
|
||||
if (!cin || !cin->key)
|
||||
return;
|
||||
cin->key(cin, button, event);
|
||||
cin->key(cin, button, unicode, event);
|
||||
}
|
||||
void Media_Send_MouseMove(cin_t *cin, float x, float y)
|
||||
{
|
||||
|
@ -1828,6 +1827,7 @@ float recordavi_audiotime;
|
|||
int capturesize;
|
||||
int capturewidth;
|
||||
char *capturevideomem;
|
||||
vfsfile_t *captureaudiorawfile;
|
||||
//short *captureaudiomem;
|
||||
int captureaudiosamples;
|
||||
int captureframe;
|
||||
|
@ -1867,7 +1867,7 @@ qboolean Media_PausedDemo (void)
|
|||
//capturedemo doesn't record any frames when the console is visible
|
||||
//but that's okay, as we don't load any demo frames either.
|
||||
if ((cls.demoplayback && Media_Capturing()) || capturepaused)
|
||||
if (scr_con_current > 0 || !cl.validsequence || capturepaused)
|
||||
if (key_dest != key_game || scr_con_current > 0 || !cl.validsequence || capturepaused)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -1875,7 +1875,7 @@ qboolean Media_PausedDemo (void)
|
|||
|
||||
double Media_TweekCaptureFrameTime(double time)
|
||||
{
|
||||
if (cls.demoplayback && Media_Capturing() && recordavi_frametime>0.01)
|
||||
if (cls.demoplayback && Media_Capturing() && recordavi_frametime)
|
||||
{
|
||||
return time = recordavi_frametime;
|
||||
}
|
||||
|
@ -2053,6 +2053,16 @@ static void MSD_Submit(soundcardinfo_t *sc)
|
|||
case CT_NONE:
|
||||
break;
|
||||
case CT_SCREENSHOT:
|
||||
if ((sc->snd_completed % (sc->sn.samples/sc->sn.numchannels)) < offset)
|
||||
{
|
||||
int partialsamplestosubmit;
|
||||
//wraped, two chunks to send
|
||||
partialsamplestosubmit = ((sc->sn.samples/sc->sn.numchannels)) - offset;
|
||||
VFS_WRITE(captureaudiorawfile, sc->sn.buffer+offset*bytespersample, partialsamplestosubmit*bytespersample);
|
||||
samplestosubmit -= partialsamplestosubmit;
|
||||
offset = 0;
|
||||
}
|
||||
VFS_WRITE(captureaudiorawfile, sc->sn.buffer+offset*bytespersample, samplestosubmit*bytespersample);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2116,9 +2126,17 @@ void Media_StopRecordFilm_f (void)
|
|||
recordavi_file = NULL;
|
||||
#endif /* WINAVI */
|
||||
|
||||
if (capturevideomem) BZ_Free(capturevideomem);
|
||||
if (capturevideomem)
|
||||
BZ_Free(capturevideomem);
|
||||
capturevideomem = NULL;
|
||||
|
||||
if (capture_fakesounddevice) S_ShutdownCard(capture_fakesounddevice);
|
||||
if (capture_fakesounddevice)
|
||||
S_ShutdownCard(capture_fakesounddevice);
|
||||
capture_fakesounddevice = NULL;
|
||||
|
||||
if (captureaudiorawfile)
|
||||
VFS_CLOSE(captureaudiorawfile);
|
||||
captureaudiorawfile = NULL;
|
||||
|
||||
|
||||
capturevideomem = NULL;
|
||||
|
@ -2153,6 +2171,8 @@ void Media_RecordFilm_f (void)
|
|||
}
|
||||
|
||||
recordavi_frametime = 1/capturerate.value;
|
||||
if (recordavi_frametime < 0.001)
|
||||
recordavi_frametime = 0.001; //no more than 1000 images per second.
|
||||
|
||||
captureframe = 0;
|
||||
if (*fourcc)
|
||||
|
@ -2181,6 +2201,23 @@ void Media_RecordFilm_f (void)
|
|||
}
|
||||
else if (capturetype == CT_SCREENSHOT)
|
||||
{
|
||||
if (capturesound.value && capturesoundchannels.value >= 1)
|
||||
{
|
||||
char filename[MAX_OSPATH];
|
||||
int chans = capturesoundchannels.value;
|
||||
int sbits = capturesoundbits.value;
|
||||
if (sbits < 8)
|
||||
sbits = 8;
|
||||
if (sbits != 8)
|
||||
sbits = 16;
|
||||
if (chans > 6)
|
||||
chans = 6;
|
||||
sprintf(filename, "%s/audio_%ichan_%ikhz_%ib.raw", capturefilenameprefix, chans, snd_speed/1000, sbits);
|
||||
captureaudiorawfile = FS_OpenVFS(filename, "wb", FS_GAMEONLY);
|
||||
|
||||
if (captureaudiorawfile)
|
||||
Media_InitFakeSoundDevice(chans, sbits);
|
||||
}
|
||||
}
|
||||
#if defined(WINAVI)
|
||||
else if (capturetype == CT_AVI)
|
||||
|
@ -2401,7 +2438,7 @@ void Media_StopRecordFilm_f (void) {}
|
|||
void Media_RecordFilm_f (void){}
|
||||
void M_Menu_Media_f (void) {}
|
||||
|
||||
char *Media_NextTrack(void) {return NULL;}
|
||||
char *Media_NextTrack(int musicchannelnum) {return NULL;}
|
||||
qboolean Media_PausedDemo(void) {return false;}
|
||||
qboolean Media_PlayingFullScreen(void) {return false;}
|
||||
|
||||
|
|
|
@ -1081,7 +1081,7 @@ void M_Draw (int uimenu)
|
|||
}
|
||||
|
||||
|
||||
void M_Keydown (int key)
|
||||
void M_Keydown (int key, int unicode)
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
|
@ -1115,14 +1115,14 @@ void M_Keydown (int key)
|
|||
#endif
|
||||
#ifdef MENU_DAT
|
||||
case m_menu_dat:
|
||||
MP_Keydown(key);
|
||||
MP_Keydown(key, unicode);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void M_Keyup (int key)
|
||||
void M_Keyup (int key, int unicode)
|
||||
{
|
||||
switch (m_state)
|
||||
{
|
||||
|
@ -1133,7 +1133,7 @@ void M_Keyup (int key)
|
|||
#endif
|
||||
#ifdef MENU_DAT
|
||||
case m_menu_dat:
|
||||
MP_Keyup(key);
|
||||
MP_Keyup(key, unicode);
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
|
|
|
@ -102,8 +102,8 @@ void M_SomeInitialisationFunctionCalledAtStartup(void)
|
|||
// menus
|
||||
//
|
||||
void M_Init (void);
|
||||
void M_Keydown (int key);
|
||||
void M_Keyup (int key);
|
||||
void M_Keydown (int key, int unicode);
|
||||
void M_Keyup (int key, int unicode);
|
||||
void M_Draw (int uimenu);
|
||||
void M_ToggleMenu_f (void);
|
||||
mpic_t *M_CachePic (char *path);
|
||||
|
@ -400,8 +400,8 @@ void MP_Init (void);
|
|||
qboolean MP_Toggle(void);
|
||||
void MP_Draw(void);
|
||||
void MP_RegisterCvarsAndCmds(void);
|
||||
void MP_Keydown(int key);
|
||||
void MP_Keyup(int key);
|
||||
void MP_Keydown(int key, int unicode);
|
||||
void MP_Keyup(int key, int unicode);
|
||||
|
||||
#define MGT_BAD ~0
|
||||
#define MGT_QUAKE1 0
|
||||
|
|
|
@ -187,7 +187,7 @@ static void PClassic_InitParticles (void)
|
|||
{
|
||||
mod->particleeffect = P_INVALID;
|
||||
mod->particletrail = P_INVALID;
|
||||
mod->engineflags &= ~MDLF_NODEFAULTTRAIL;
|
||||
mod->engineflags &= ~(MDLF_NODEFAULTTRAIL | MDLF_ENGULPHS);
|
||||
|
||||
P_DefaultTrail(mod);
|
||||
}
|
||||
|
|
|
@ -1546,7 +1546,7 @@ static void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue)
|
|||
{
|
||||
mod->particleeffect = P_INVALID;
|
||||
mod->particletrail = P_INVALID;
|
||||
mod->engineflags &= ~MDLF_NODEFAULTTRAIL;
|
||||
mod->engineflags &= ~(MDLF_NODEFAULTTRAIL | MDLF_ENGULPHS);
|
||||
|
||||
P_DefaultTrail(mod);
|
||||
}
|
||||
|
|
|
@ -3334,7 +3334,7 @@ static void PF_cs_gecko_keyevent (progfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
|
||||
if (!cin)
|
||||
return;
|
||||
Media_Send_KeyEvent(cin, MP_TranslateDPtoFTECodes(key), eventtype);
|
||||
Media_Send_KeyEvent(cin, MP_TranslateDPtoFTECodes(key), (key>127)?0:key, eventtype);
|
||||
}
|
||||
// #491 void gecko_mousemove( string name, float x, float y )
|
||||
static void PF_cs_gecko_mousemove (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
@ -5959,7 +5959,7 @@ qboolean CSQC_DrawView(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
qboolean CSQC_KeyPress(int key, qboolean down)
|
||||
qboolean CSQC_KeyPress(int key, int unicode, qboolean down)
|
||||
{
|
||||
void *pr_globals;
|
||||
|
||||
|
@ -5969,7 +5969,7 @@ qboolean CSQC_KeyPress(int key, qboolean down)
|
|||
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
|
||||
G_FLOAT(OFS_PARM0) = !down;
|
||||
G_FLOAT(OFS_PARM1) = MP_TranslateFTEtoDPCodes(key);
|
||||
G_FLOAT(OFS_PARM2) = 0;
|
||||
G_FLOAT(OFS_PARM2) = unicode;
|
||||
|
||||
PR_ExecuteProgram (csqcprogs, csqcg.input_event);
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ void PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
if (*prinst->callargc > 2)
|
||||
fontsize = G_FLOAT(OFS_PARM2);
|
||||
else
|
||||
fontsize = 8;
|
||||
fontsize = 1;
|
||||
if (usecolours)
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = COM_FunStringLength(text)*fontsize;
|
||||
|
@ -788,8 +788,8 @@ void PF_cl_getmousepos (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
mousemove_x=0;
|
||||
mousemove_y=0;
|
||||
|
||||
ret[0] = mousecursor_x;
|
||||
ret[1] = mousecursor_y;
|
||||
// ret[0] = mousecursor_x;
|
||||
// ret[1] = mousecursor_y;
|
||||
ret[2] = 0;
|
||||
}
|
||||
|
||||
|
@ -1986,7 +1986,7 @@ int MP_TranslateDPtoFTECodes(int code)
|
|||
}
|
||||
}
|
||||
|
||||
void MP_Keydown(int key)
|
||||
void MP_Keydown(int key, int unicode)
|
||||
{
|
||||
extern qboolean keydown[K_MAX];
|
||||
if (setjmp(mp_abort))
|
||||
|
@ -2018,16 +2018,13 @@ void MP_Keydown(int key)
|
|||
{
|
||||
void *pr_globals = PR_globals(menuprogs, PR_CURRENT);
|
||||
G_FLOAT(OFS_PARM0) = MP_TranslateFTEtoDPCodes(key);
|
||||
if (G_FLOAT(OFS_PARM0) > 127)
|
||||
G_FLOAT(OFS_PARM1) = 0;
|
||||
else
|
||||
G_FLOAT(OFS_PARM1) = G_FLOAT(OFS_PARM0);
|
||||
G_FLOAT(OFS_PARM1) = unicode;
|
||||
PR_ExecuteProgram(menuprogs, mp_keydown_function);
|
||||
}
|
||||
inmenuprogs--;
|
||||
}
|
||||
|
||||
void MP_Keyup(int key)
|
||||
void MP_Keyup(int key, int unicode)
|
||||
{
|
||||
if (setjmp(mp_abort))
|
||||
return;
|
||||
|
@ -2041,10 +2038,7 @@ void MP_Keyup(int key)
|
|||
{
|
||||
void *pr_globals = PR_globals(menuprogs, PR_CURRENT);
|
||||
G_FLOAT(OFS_PARM0) = MP_TranslateFTEtoDPCodes(key);
|
||||
if (G_FLOAT(OFS_PARM0) > 127)
|
||||
G_FLOAT(OFS_PARM1) = 0;
|
||||
else
|
||||
G_FLOAT(OFS_PARM1) = G_FLOAT(OFS_PARM0);
|
||||
G_FLOAT(OFS_PARM1) = unicode;
|
||||
PR_ExecuteProgram(menuprogs, mp_keyup_function);
|
||||
}
|
||||
inmenuprogs--;
|
||||
|
|
|
@ -1802,4 +1802,4 @@ void Sys_DestroyConditional(void *condv)
|
|||
DeleteCriticalSection(&cv->mainlock);
|
||||
free(cv);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -350,7 +350,7 @@ void EditorOpenFile(char *name)
|
|||
editoractive = true;
|
||||
}
|
||||
|
||||
void Editor_Key(int key)
|
||||
void Editor_Key(int key, int unicode)
|
||||
{
|
||||
int i;
|
||||
if (keybindings[key][0])
|
||||
|
@ -420,9 +420,12 @@ void Editor_Key(int key)
|
|||
evalstring[i-1] = '\0';
|
||||
break;
|
||||
default:
|
||||
i = strlen(evalstring);
|
||||
evalstring[i] = key;
|
||||
evalstring[i+1] = '\0';
|
||||
if (unicode)
|
||||
{
|
||||
i = strlen(evalstring);
|
||||
evalstring[i] = unicode;
|
||||
evalstring[i+1] = '\0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
@ -700,7 +703,7 @@ void Editor_Key(int key)
|
|||
insertkeyhit = insertkeyhit?false:true;
|
||||
break;
|
||||
default:
|
||||
if ((key < ' ' || key > 127) && key != '\t') //we deem these as unprintable
|
||||
if (unicode < ' ' && unicode != '\t') //we deem these as unprintable
|
||||
break;
|
||||
|
||||
if (insertkeyhit) //insert a char
|
||||
|
@ -719,13 +722,13 @@ void Editor_Key(int key)
|
|||
}
|
||||
cursorx++;
|
||||
cursorblock->datalength++;
|
||||
*(s+1) = key;
|
||||
*(s+1) = unicode;
|
||||
}
|
||||
else //over write a char
|
||||
{
|
||||
MakeNewSize(cursorblock, cursorblock->datalength+5); //not really needed
|
||||
|
||||
cursorblock->data[cursorx] = key;
|
||||
cursorblock->data[cursorx] = unicode;
|
||||
cursorx++;
|
||||
if (cursorx > cursorblock->datalength)
|
||||
cursorblock->datalength = cursorx;
|
||||
|
|
|
@ -145,7 +145,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// #define HLCLIENT //we can run HL gamecode (not protocol compatible)
|
||||
// #define HLSERVER //we can run HL gamecode (not protocol compatible)
|
||||
#define NQPROT //server and client are capable of using quake1/netquake protocols. (qw is still prefered. uses the command 'nqconnect')
|
||||
#define FISH //sw rendering only
|
||||
#define FISH //fisheye distortion stuff
|
||||
#define ZLIB //zip/pk3 support
|
||||
#define WEBSERVER //http/ftp servers
|
||||
#define WEBCLIENT //http/ftp clients.
|
||||
|
@ -187,7 +187,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
|
||||
//temporarily disable stuff here, so as to not break any custom configs
|
||||
#ifdef Q3SHADERS
|
||||
//#define NEWBACKEND
|
||||
#endif
|
||||
|
||||
|
||||
//fix things a little...
|
||||
|
|
|
@ -2305,9 +2305,6 @@ qboolean CModQ3_LoadFogs (lump_t *l)
|
|||
}
|
||||
}
|
||||
|
||||
if (count)
|
||||
GL_InitFogTexture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2412,7 +2409,8 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
|
|||
patch_cp[0] = patchwidth;
|
||||
patch_cp[1] = patchheight;
|
||||
|
||||
if ( !patch_cp[0] || !patch_cp[1] ) {
|
||||
if ( !patch_cp[0] || !patch_cp[1] )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ qboolean UI_Q2LayoutChanged(void);
|
|||
void UI_StringChanged(int num);
|
||||
void UI_MousePosition(int xpos, int ypos);
|
||||
int UI_MenuState(void);
|
||||
qboolean UI_KeyPress(int key, qboolean down);
|
||||
qboolean UI_KeyPress(int key, int unicode, qboolean down);
|
||||
void UI_Reset(void);
|
||||
void UI_DrawMenu(void);
|
||||
qboolean UI_DrawStatusBar(int scores);
|
||||
|
@ -121,7 +121,7 @@ void CG_Stop (void);
|
|||
void CG_Start (void);
|
||||
int CG_Refresh(void);
|
||||
qboolean CG_Command(void);
|
||||
qboolean CG_KeyPress(int key, int down);
|
||||
qboolean CG_KeyPress(int key, int unicode, int down);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1307,7 +1307,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
mb.entity = &r_worldentity;
|
||||
mb.entity = currententity;
|
||||
mb.shader = currententity->forcedshader;
|
||||
mb.fog = fog;
|
||||
mb.mesh = &mesh;
|
||||
|
@ -1346,7 +1346,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
skin->shader->passes[0].flags &= ~SHADER_PASS_DEPTHWRITE;
|
||||
}
|
||||
|
||||
mb.entity = &r_worldentity;
|
||||
mb.entity = currententity;
|
||||
mb.shader = skin->shader;
|
||||
mb.fog = fog;
|
||||
mb.mesh = &mesh;
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "glquake.h"
|
||||
#include "shader.h"
|
||||
|
||||
#ifndef NEWBACKEND
|
||||
|
||||
#ifdef RGLQUAKE
|
||||
|
||||
#define MAX_TEXTURE_UNITS 8
|
||||
|
@ -23,6 +25,7 @@ void GL_SetShaderState2D(qboolean is2d)
|
|||
|
||||
extern int *lightmap_textures;
|
||||
extern int *deluxmap_textures;
|
||||
extern int gl_filter_max;
|
||||
|
||||
void GL_SelectTexture (GLenum target)
|
||||
{
|
||||
|
@ -310,6 +313,43 @@ void R_FetchBottomColour(int *retred, int *retgreen, int *retblue)
|
|||
}
|
||||
}
|
||||
|
||||
#define FOG_TEXTURE_WIDTH 32
|
||||
#define FOG_TEXTURE_HEIGHT 32
|
||||
int r_fogtexture;
|
||||
void GL_InitFogTexture (void)
|
||||
{
|
||||
qbyte data[FOG_TEXTURE_WIDTH*FOG_TEXTURE_HEIGHT];
|
||||
int x, y;
|
||||
float tw = 1.0f / ((float)FOG_TEXTURE_WIDTH - 1.0f);
|
||||
float th = 1.0f / ((float)FOG_TEXTURE_HEIGHT - 1.0f);
|
||||
float tx, ty, t;
|
||||
|
||||
if (r_fogtexture)
|
||||
return;
|
||||
|
||||
//
|
||||
// fog texture
|
||||
//
|
||||
for ( y = 0, ty = 0.0f; y < FOG_TEXTURE_HEIGHT; y++, ty += th )
|
||||
{
|
||||
for ( x = 0, tx = 0.0f; x < FOG_TEXTURE_WIDTH; x++, tx += tw )
|
||||
{
|
||||
t = (float)(sqrt( tx ) * 255.0);
|
||||
data[x+y*FOG_TEXTURE_WIDTH] = (qbyte)(min( t, 255.0f ));
|
||||
}
|
||||
}
|
||||
|
||||
r_fogtexture = GL_AllocNewTexture();
|
||||
GL_Bind(r_fogtexture);
|
||||
qglTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, FOG_TEXTURE_WIDTH, FOG_TEXTURE_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
||||
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
void R_InitDynamicLightTexture (void)
|
||||
{
|
||||
int x, y;
|
||||
|
@ -544,6 +584,8 @@ void R_BackendInit (void)
|
|||
|
||||
currentColor = inColorsArray[0];
|
||||
|
||||
r_fogtexture = 0;
|
||||
|
||||
r_arrays_locked = false;
|
||||
r_blocked = false;
|
||||
|
||||
|
@ -577,6 +619,7 @@ void R_BackendInit (void)
|
|||
}
|
||||
|
||||
R_InitDynamicLightTexture();
|
||||
GL_InitFogTexture();
|
||||
}
|
||||
|
||||
qboolean varrayactive;
|
||||
|
@ -2199,7 +2242,6 @@ R_RenderFogOnMesh
|
|||
================
|
||||
*/
|
||||
|
||||
int r_fogtexture;
|
||||
#define PlaneDiff(point,plane) (((plane)->type < 3 ? (point)[(plane)->type] : DotProduct((point), (plane)->normal)) - (plane)->dist)
|
||||
void R_RenderFogOnMesh ( shader_t *shader, struct mfog_s *fog )
|
||||
{
|
||||
|
@ -2531,4 +2573,6 @@ void R_FinishMeshBuffer ( meshbuffer_t *mb )
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -713,42 +713,6 @@ void GL_Texturemode2d_Callback (struct cvar_s *var, char *oldvalue)
|
|||
}
|
||||
|
||||
#ifdef Q3SHADERS
|
||||
#define FOG_TEXTURE_WIDTH 32
|
||||
#define FOG_TEXTURE_HEIGHT 32
|
||||
extern int r_fogtexture;
|
||||
void GL_InitFogTexture (void)
|
||||
{
|
||||
qbyte data[FOG_TEXTURE_WIDTH*FOG_TEXTURE_HEIGHT];
|
||||
int x, y;
|
||||
float tw = 1.0f / ((float)FOG_TEXTURE_WIDTH - 1.0f);
|
||||
float th = 1.0f / ((float)FOG_TEXTURE_HEIGHT - 1.0f);
|
||||
float tx, ty, t;
|
||||
|
||||
if (r_fogtexture)
|
||||
return;
|
||||
|
||||
//
|
||||
// fog texture
|
||||
//
|
||||
for ( y = 0, ty = 0.0f; y < FOG_TEXTURE_HEIGHT; y++, ty += th )
|
||||
{
|
||||
for ( x = 0, tx = 0.0f; x < FOG_TEXTURE_WIDTH; x++, tx += tw )
|
||||
{
|
||||
t = (float)(sqrt( tx ) * 255.0);
|
||||
data[x+y*FOG_TEXTURE_WIDTH] = (qbyte)(min( t, 255.0f ));
|
||||
}
|
||||
}
|
||||
|
||||
r_fogtexture = GL_AllocNewTexture();
|
||||
GL_Bind(r_fogtexture);
|
||||
qglTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, FOG_TEXTURE_WIDTH, FOG_TEXTURE_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
||||
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
===============
|
||||
|
@ -800,9 +764,6 @@ void GLDraw_ReInit (void)
|
|||
draw_mesh.colors_array = NULL;
|
||||
draw_mesh.indexes = r_quad_indexes;
|
||||
|
||||
#ifdef Q3SHADERS
|
||||
r_fogtexture=0;
|
||||
#endif
|
||||
GL_FlushBackEnd();
|
||||
// GL_FlushSkinCache();
|
||||
TRACE(("dbg: GLDraw_ReInit: GL_GAliasFlushSkinCache\n"));
|
||||
|
@ -1198,6 +1159,9 @@ void GLDraw_Init (void)
|
|||
GLDraw_ReInit();
|
||||
|
||||
R_BackendInit();
|
||||
#ifdef NEWBACKEND
|
||||
BE_Init();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -193,6 +193,9 @@ typedef struct
|
|||
vec3_t *svector;
|
||||
int vbotvector;
|
||||
vec3_t *tvector;
|
||||
|
||||
int vbocolours;
|
||||
byte_vec4_t *colours;
|
||||
} vbo_t;
|
||||
|
||||
typedef struct texture_s
|
||||
|
|
|
@ -18,6 +18,7 @@ void R_MirrorChain (msurface_t *s);
|
|||
void GL_SelectTexture (GLenum target);
|
||||
void R_RenderDynamicLightmaps (msurface_t *fa, int shift);
|
||||
void R_BlendLightmaps (void);
|
||||
void PPL_SchematicsTextureChain(msurface_t *first);
|
||||
|
||||
|
||||
void PPL_BeginShadowMesh(dlight_t *dl);
|
||||
|
@ -2299,148 +2300,6 @@ void PPL_BaseBModelTextures(entity_t *e)
|
|||
R_IBrokeTheArrays();
|
||||
}
|
||||
|
||||
#ifdef Q3SHADERS
|
||||
void R_DrawLightning(entity_t *e)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t dir, cr;
|
||||
float scale = e->scale;
|
||||
float length;
|
||||
|
||||
vec3_t points[4];
|
||||
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
|
||||
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
|
||||
|
||||
mesh_t mesh;
|
||||
meshbuffer_t mb;
|
||||
|
||||
if (!e->forcedshader)
|
||||
return;
|
||||
|
||||
if (!scale)
|
||||
scale = 10;
|
||||
|
||||
|
||||
VectorSubtract(e->origin, e->oldorigin, dir);
|
||||
length = Length(dir);
|
||||
|
||||
//this seems to be about right.
|
||||
texcoords[2][0] = length/128;
|
||||
texcoords[3][0] = length/128;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->origin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->origin, -scale/2, cr, points[0]);
|
||||
VectorMA(e->origin, scale/2, cr, points[1]);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->oldorigin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->oldorigin, scale/2, cr, points[2]);
|
||||
VectorMA(e->oldorigin, -scale/2, cr, points[3]);
|
||||
|
||||
mesh.xyz_array = points;
|
||||
mesh.indexes = indexarray;
|
||||
mesh.numindexes = sizeof(indexarray)/sizeof(indexarray[0]);
|
||||
mesh.colors_array = NULL;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.numvertexes = 4;
|
||||
mesh.st_array = texcoords;
|
||||
|
||||
mb.entity = e;
|
||||
mb.mesh = &mesh;
|
||||
mb.shader = e->forcedshader;
|
||||
mb.infokey = 0;
|
||||
mb.fog = NULL;
|
||||
mb.infokey = currententity->keynum;
|
||||
mb.dlightbits = 0;
|
||||
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED);
|
||||
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
void R_DrawRailCore(entity_t *e)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t dir, cr;
|
||||
float scale = e->scale;
|
||||
float length;
|
||||
|
||||
mesh_t mesh;
|
||||
meshbuffer_t mb;
|
||||
vec3_t points[4];
|
||||
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
|
||||
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
|
||||
int colors[4];
|
||||
qbyte colorsb[4];
|
||||
|
||||
if (!e->forcedshader)
|
||||
return;
|
||||
|
||||
if (!scale)
|
||||
scale = 10;
|
||||
|
||||
|
||||
VectorSubtract(e->origin, e->oldorigin, dir);
|
||||
length = Length(dir);
|
||||
|
||||
//this seems to be about right.
|
||||
texcoords[2][0] = length/128;
|
||||
texcoords[3][0] = length/128;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->origin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->origin, -scale/2, cr, points[0]);
|
||||
VectorMA(e->origin, scale/2, cr, points[1]);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->oldorigin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->oldorigin, scale/2, cr, points[2]);
|
||||
VectorMA(e->oldorigin, -scale/2, cr, points[3]);
|
||||
|
||||
colorsb[0] = e->shaderRGBAf[0]*255;
|
||||
colorsb[1] = e->shaderRGBAf[1]*255;
|
||||
colorsb[2] = e->shaderRGBAf[2]*255;
|
||||
colorsb[3] = e->shaderRGBAf[3]*255;
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *(int*)colorsb;
|
||||
|
||||
mesh.xyz_array = points;
|
||||
mesh.indexes = indexarray;
|
||||
mesh.numindexes = sizeof(indexarray)/sizeof(indexarray[0]);
|
||||
mesh.colors_array = (byte_vec4_t*)colors;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.numvertexes = 4;
|
||||
mesh.st_array = texcoords;
|
||||
|
||||
mb.entity = e;
|
||||
mb.mesh = &mesh;
|
||||
mb.shader = e->forcedshader;
|
||||
mb.infokey = 0;
|
||||
mb.fog = NULL;
|
||||
mb.infokey = currententity->keynum;
|
||||
mb.dlightbits = 0;
|
||||
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED | MF_COLORS);
|
||||
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
#endif
|
||||
|
||||
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
|
||||
void PerpendicularVector( vec3_t dst, const vec3_t src );
|
||||
void R_DrawBeam( entity_t *e )
|
||||
|
|
|
@ -595,16 +595,18 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
coloursb[3] = e->shaderRGBAf[3]*255;
|
||||
*(int*)colours[0] = *(int*)colours[1] = *(int*)colours[2] = *(int*)colours[3] = *(int*)coloursb;
|
||||
|
||||
mesh.vbofirstelement = 0;
|
||||
mesh.vbofirstvert = 0;
|
||||
|
||||
mesh.colors_array = colours;
|
||||
mesh.indexes = indexes;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.st_array = texcoords;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.xyz_array = vertcoords;
|
||||
mesh.numvertexes = 4;
|
||||
mesh.numindexes = 6;
|
||||
mesh.radius = e->scale;
|
||||
mesh.xyz_array = vertcoords;
|
||||
mesh.normals_array = NULL;
|
||||
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
@ -741,8 +743,101 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
|
||||
//==================================================================================
|
||||
|
||||
static void R_DrawShadedSpriteModels(int count, void **entlist, void *parm)
|
||||
{
|
||||
vec3_t point;
|
||||
mspriteframe_t *frame;
|
||||
vec3_t forward, right, up;
|
||||
msprite_t *psprite;
|
||||
|
||||
qbyte coloursb[4];
|
||||
|
||||
meshbuffer_t mb;
|
||||
mesh_t mesh;
|
||||
vec2_t texcoords[4]={{0, 1},{0,0},{1,0},{1,1}};
|
||||
vec3_t vertcoords[4];
|
||||
index_t indexes[6] = {0, 1, 2, 0, 2, 3};
|
||||
byte_vec4_t colours[4];
|
||||
float x, y;
|
||||
|
||||
int vnum = 0, inum = 0;
|
||||
|
||||
shader_t *lastshader = NULL;
|
||||
|
||||
mesh.vbofirstelement = 0;
|
||||
mesh.vbofirstvert = 0;
|
||||
|
||||
mesh.colors_array = colours;
|
||||
mesh.indexes = indexes;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.st_array = texcoords;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.xyz_array = vertcoords;
|
||||
|
||||
mb.fog = NULL;//fog;
|
||||
mb.mesh = NULL;
|
||||
mb.infokey = -1;
|
||||
mb.dlightbits = 0;
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
while (count--)
|
||||
{
|
||||
currententity = *entlist++;
|
||||
if (currententity->forcedshader != lastshader || 1)
|
||||
{
|
||||
if (lastshader)
|
||||
{
|
||||
mesh.numvertexes = vnum;
|
||||
mesh.numindexes = inum;
|
||||
mesh.radius = currententity->scale;
|
||||
R_PushMesh(&mesh, lastshader->features | MF_NONBATCHED|MF_COLORS);
|
||||
|
||||
mb.entity = currententity;
|
||||
mb.shader = currententity->forcedshader;
|
||||
R_RenderMeshBuffer (&mb, false);
|
||||
}
|
||||
|
||||
lastshader = currententity->forcedshader;
|
||||
}
|
||||
|
||||
|
||||
#define VectorSet(a,b,c,v) {v[0]=a;v[1]=b;v[2]=c;}
|
||||
x = cos(currententity->rotation+225*M_PI/180)*currententity->scale;
|
||||
y = sin(currententity->rotation+225*M_PI/180)*currententity->scale;
|
||||
VectorSet (currententity->origin[0] - y*vright[0] + x*vup[0], currententity->origin[1] - y*vright[1] + x*vup[1], currententity->origin[2] - y*vright[2] + x*vup[2], vertcoords[3]);
|
||||
VectorSet (currententity->origin[0] - x*vright[0] - y*vup[0], currententity->origin[1] - x*vright[1] - y*vup[1], currententity->origin[2] - x*vright[2] - y*vup[2], vertcoords[2]);
|
||||
VectorSet (currententity->origin[0] + y*vright[0] - x*vup[0], currententity->origin[1] + y*vright[1] - x*vup[1], currententity->origin[2] + y*vright[2] - x*vup[2], vertcoords[1]);
|
||||
VectorSet (currententity->origin[0] + x*vright[0] + y*vup[0], currententity->origin[1] + x*vright[1] + y*vup[1], currententity->origin[2] + x*vright[2] + y*vup[2], vertcoords[0]);
|
||||
|
||||
coloursb[0] = currententity->shaderRGBAf[0]*255;
|
||||
coloursb[1] = currententity->shaderRGBAf[1]*255;
|
||||
coloursb[2] = currententity->shaderRGBAf[2]*255;
|
||||
coloursb[3] = currententity->shaderRGBAf[3]*255;
|
||||
*(int*)colours[0] = *(int*)colours[1] = *(int*)colours[2] = *(int*)colours[3] = *(int*)coloursb;
|
||||
|
||||
vnum += 4;
|
||||
inum += 6;
|
||||
}
|
||||
|
||||
if (lastshader)
|
||||
{
|
||||
mesh.numvertexes = vnum;
|
||||
mesh.numindexes = inum;
|
||||
mesh.radius = currententity->scale;
|
||||
R_PushMesh(&mesh, lastshader->features | MF_NONBATCHED|MF_COLORS);
|
||||
|
||||
mb.entity = currententity;
|
||||
mb.shader = currententity->forcedshader;
|
||||
R_RenderMeshBuffer (&mb, false);
|
||||
}
|
||||
}
|
||||
|
||||
void GLR_DrawSprite(int count, void **e, void *parm)
|
||||
{
|
||||
// R_DrawShadedSpriteModels(count, e, parm);
|
||||
// return;
|
||||
|
||||
while(count--)
|
||||
{
|
||||
currententity = *e++;
|
||||
|
@ -751,6 +846,155 @@ void GLR_DrawSprite(int count, void **e, void *parm)
|
|||
R_DrawSpriteModel (currententity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//q3 lightning gun
|
||||
void R_DrawLightning(entity_t *e)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t dir, cr;
|
||||
float scale = e->scale;
|
||||
float length;
|
||||
|
||||
vec3_t points[4];
|
||||
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
|
||||
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
|
||||
|
||||
mesh_t mesh;
|
||||
meshbuffer_t mb;
|
||||
|
||||
if (!e->forcedshader)
|
||||
return;
|
||||
|
||||
if (!scale)
|
||||
scale = 10;
|
||||
|
||||
|
||||
VectorSubtract(e->origin, e->oldorigin, dir);
|
||||
length = Length(dir);
|
||||
|
||||
//this seems to be about right.
|
||||
texcoords[2][0] = length/128;
|
||||
texcoords[3][0] = length/128;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->origin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->origin, -scale/2, cr, points[0]);
|
||||
VectorMA(e->origin, scale/2, cr, points[1]);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->oldorigin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->oldorigin, scale/2, cr, points[2]);
|
||||
VectorMA(e->oldorigin, -scale/2, cr, points[3]);
|
||||
|
||||
mesh.vbofirstelement = 0;
|
||||
mesh.vbofirstvert = 0;
|
||||
mesh.xyz_array = points;
|
||||
mesh.indexes = indexarray;
|
||||
mesh.numindexes = sizeof(indexarray)/sizeof(indexarray[0]);
|
||||
mesh.colors_array = NULL;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.numvertexes = 4;
|
||||
mesh.st_array = texcoords;
|
||||
|
||||
mb.entity = e;
|
||||
mb.mesh = &mesh;
|
||||
mb.shader = e->forcedshader;
|
||||
mb.infokey = 0;
|
||||
mb.fog = NULL;
|
||||
mb.infokey = currententity->keynum;
|
||||
mb.dlightbits = 0;
|
||||
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED);
|
||||
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
//q3 railgun beam
|
||||
void R_DrawRailCore(entity_t *e)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t dir, cr;
|
||||
float scale = e->scale;
|
||||
float length;
|
||||
|
||||
mesh_t mesh;
|
||||
meshbuffer_t mb;
|
||||
vec3_t points[4];
|
||||
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
|
||||
index_t indexarray[6] = {0, 1, 2, 0, 2, 3};
|
||||
int colors[4];
|
||||
qbyte colorsb[4];
|
||||
|
||||
if (!e->forcedshader)
|
||||
return;
|
||||
|
||||
if (!scale)
|
||||
scale = 10;
|
||||
|
||||
|
||||
VectorSubtract(e->origin, e->oldorigin, dir);
|
||||
length = Length(dir);
|
||||
|
||||
//this seems to be about right.
|
||||
texcoords[2][0] = length/128;
|
||||
texcoords[3][0] = length/128;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->origin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->origin, -scale/2, cr, points[0]);
|
||||
VectorMA(e->origin, scale/2, cr, points[1]);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, e->oldorigin, v);
|
||||
CrossProduct(v, dir, cr);
|
||||
VectorNormalize(cr);
|
||||
|
||||
VectorMA(e->oldorigin, scale/2, cr, points[2]);
|
||||
VectorMA(e->oldorigin, -scale/2, cr, points[3]);
|
||||
|
||||
colorsb[0] = e->shaderRGBAf[0]*255;
|
||||
colorsb[1] = e->shaderRGBAf[1]*255;
|
||||
colorsb[2] = e->shaderRGBAf[2]*255;
|
||||
colorsb[3] = e->shaderRGBAf[3]*255;
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *(int*)colorsb;
|
||||
|
||||
mesh.vbofirstelement = 0;
|
||||
mesh.vbofirstvert = 0;
|
||||
mesh.xyz_array = points;
|
||||
mesh.indexes = indexarray;
|
||||
mesh.numindexes = sizeof(indexarray)/sizeof(indexarray[0]);
|
||||
mesh.colors_array = (byte_vec4_t*)colors;
|
||||
mesh.lmst_array = NULL;
|
||||
mesh.normals_array = NULL;
|
||||
mesh.numvertexes = 4;
|
||||
mesh.st_array = texcoords;
|
||||
|
||||
mb.entity = e;
|
||||
mb.mesh = &mesh;
|
||||
mb.shader = e->forcedshader;
|
||||
mb.infokey = 0;
|
||||
mb.fog = NULL;
|
||||
mb.infokey = currententity->keynum;
|
||||
mb.dlightbits = 0;
|
||||
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
R_PushMesh(&mesh, mb.shader->features | MF_NONBATCHED | MF_COLORS);
|
||||
|
||||
R_RenderMeshBuffer ( &mb, false );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_DrawEntitiesOnList
|
||||
|
|
|
@ -3069,6 +3069,8 @@ static void GL_GenBrushModelVBO(model_t *mod)
|
|||
if (mod->surfaces[i].texinfo->texture != mod->textures[t])
|
||||
continue;
|
||||
m = mod->surfaces[i].mesh;
|
||||
if (!m)
|
||||
continue;
|
||||
|
||||
maxvboelements += m->numindexes;
|
||||
maxvboverts += m->numvertexes;
|
||||
|
@ -3105,6 +3107,8 @@ static void GL_GenBrushModelVBO(model_t *mod)
|
|||
if (mod->surfaces[i].texinfo->texture != mod->textures[t])
|
||||
continue;
|
||||
m = mod->surfaces[i].mesh;
|
||||
if (!m)
|
||||
continue;
|
||||
|
||||
m->vbofirstvert = vcount;
|
||||
m->vbofirstelement = ecount;
|
||||
|
|
|
@ -435,7 +435,7 @@ qboolean VID_SetWindowedMode (rendererstate_t *info)
|
|||
SetWindowLong(dibwindow, GWL_EXSTYLE, GetWindowLong(dibwindow, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
|
||||
// Make this window 70% alpha
|
||||
pSetLayeredWindowAttributes(dibwindow, 0, av, LWA_ALPHA);
|
||||
pSetLayeredWindowAttributes(dibwindow, 0, (BYTE)av, LWA_ALPHA);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1031,7 +1031,7 @@ void VID_WndAlpha_Override_Callback(struct cvar_s *var, char *oldvalue)
|
|||
SetWindowLong(mainwindow, GWL_EXSTYLE, GetWindowLong(mainwindow, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||
|
||||
// Make this window 70% alpha
|
||||
pSetLayeredWindowAttributes(mainwindow, 0, av, LWA_ALPHA);
|
||||
pSetLayeredWindowAttributes(mainwindow, 0, (BYTE)av, LWA_ALPHA);
|
||||
}
|
||||
else
|
||||
SetWindowLong(mainwindow, GWL_EXSTYLE, GetWindowLong(mainwindow, GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
||||
|
|
|
@ -390,18 +390,21 @@ void GL_DrawSkyChain (msurface_t *s)
|
|||
|
||||
if (r_fastsky.value>0) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
|
||||
{
|
||||
R_IBrokeTheArrays();
|
||||
qglDisable(GL_BLEND);
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
qglColor3f(glskycolor[0], glskycolor[1], glskycolor[2]);
|
||||
qglDisableClientState( GL_COLOR_ARRAY );
|
||||
qglEnableClientState( GL_VERTEX_ARRAY );
|
||||
for (fa=s ; fa ; fa=fa->texturechain)
|
||||
{
|
||||
qglVertexPointer(3, GL_FLOAT, 0, fa->mesh->xyz_array);
|
||||
qglDrawElements(GL_TRIANGLES, fa->mesh->numindexes, GL_INDEX_TYPE, fa->mesh->indexes);
|
||||
}
|
||||
R_IBrokeTheArrays();
|
||||
|
||||
qglColor3f(1, 1, 1);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
R_IBrokeTheArrays();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1092,6 +1095,8 @@ static void GL_SkyForceDepth(msurface_t *fa)
|
|||
|
||||
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
R_IBrokeTheArrays();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -613,6 +613,8 @@ void SV_Map_f (void)
|
|||
{
|
||||
if (host_client->protocol == SCP_QUAKE3)
|
||||
continue;
|
||||
if (host_client->protocol == SCP_BAD)
|
||||
continue;
|
||||
|
||||
if (ISNQCLIENT(host_client))
|
||||
SVNQ_New_f();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
float RadiusFromBounds (vec3_t mins, vec3_t maxs);
|
||||
|
||||
|
||||
//#define USEBOTLIB
|
||||
#define USEBOTLIB
|
||||
|
||||
#ifdef USEBOTLIB
|
||||
|
||||
|
|
Loading…
Reference in a new issue