1
0
Fork 0
forked from fte/fteqw

I got into a discussion with gb. added fps_preset vanilla. this enables all sorts of vanillary things, even more so than faithful (which disables them again).

added r_part_classic_square, cl_demoreel.
fixed a couple of things that the ever vigilant gb spotted. I guess I don't play quake enough.
fixed a load of random warnings reported by gcc. many many many warnings remain. I got bored.
internal mrt feature implemented, not properly tested yet.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4719 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-08-15 02:20:41 +00:00
parent 6066fdf421
commit 362d8f820f
54 changed files with 362 additions and 262 deletions

View file

@ -1537,6 +1537,9 @@ void CL_PlayDemo_f (void)
return; return;
} }
if (cls.state == ca_demostart)
cls.state = ca_disconnected;
#ifdef WEBCLIENT #ifdef WEBCLIENT
#ifdef warningmsg #ifdef warningmsg
#pragma warningmsg("playdemo http://blah is broken right now") #pragma warningmsg("playdemo http://blah is broken right now")

View file

@ -2874,7 +2874,7 @@ static void CL_TransitionPacketEntities(int newsequence, packet_entities_t *newp
snew = &newpack->entities[newpnum]; snew = &newpack->entities[newpnum];
sold = NULL; sold = NULL;
for ( ; oldpnum<oldpack->num_entities ; oldpnum) for ( ; oldpnum<oldpack->num_entities ; )
{ {
sold = &oldpack->entities[oldpnum++]; sold = &oldpack->entities[oldpnum++];
if (sold->number >= snew->number) if (sold->number >= snew->number)

View file

@ -88,6 +88,7 @@ cvar_t qtvcl_forceversion1 = CVAR("qtvcl_forceversion1", "0");
cvar_t qtvcl_eztvextensions = CVAR("qtvcl_eztvextensions", "0"); cvar_t qtvcl_eztvextensions = CVAR("qtvcl_eztvextensions", "0");
cvar_t cl_demospeed = CVARAF("cl_demospeed", "1", "demo_setspeed", 0); cvar_t cl_demospeed = CVARAF("cl_demospeed", "1", "demo_setspeed", 0);
cvar_t cl_demoreel = CVARFD("cl_demoreel", "0", CVAR_SAVE, "When enabled, the engine will begin playing a demo loop on startup.");
cvar_t cl_loopbackprotocol = CVARD("cl_loopbackprotocol", "qw", "Which protocol to use for single-player/the internal client. Should be one of: qw, qwid, nqid, nq, fitz, dp6, dp7. If empty, will use qw protocols for qw mods, and nq protocols for nq mods."); cvar_t cl_loopbackprotocol = CVARD("cl_loopbackprotocol", "qw", "Which protocol to use for single-player/the internal client. Should be one of: qw, qwid, nqid, nq, fitz, dp6, dp7. If empty, will use qw protocols for qw mods, and nq protocols for nq mods.");
@ -110,7 +111,7 @@ extern int total_loading_size, current_loading_size, loading_stage;
// //
cvar_t password = CVARAF("password", "", "pq_password", CVAR_USERINFO | CVAR_NOUNSAFEEXPAND); //this is parhaps slightly dodgy... added pq_password alias because baker seems to be using this for user accounts. cvar_t password = CVARAF("password", "", "pq_password", CVAR_USERINFO | CVAR_NOUNSAFEEXPAND); //this is parhaps slightly dodgy... added pq_password alias because baker seems to be using this for user accounts.
cvar_t spectator = CVARF("spectator", "", CVAR_USERINFO); cvar_t spectator = CVARF("spectator", "", CVAR_USERINFO);
cvar_t name = CVARFC("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, Name_Callback); cvar_t name = CVARFC("name", "Player", CVAR_ARCHIVE | CVAR_USERINFO, Name_Callback);
cvar_t team = CVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t team = CVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t skin = CVARF("skin", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t skin = CVARF("skin", "", CVAR_ARCHIVE | CVAR_USERINFO);
cvar_t model = CVARF("model", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t model = CVARF("model", "", CVAR_ARCHIVE | CVAR_USERINFO);
@ -1198,14 +1199,13 @@ void CL_Rcon_f (void)
void CL_BlendFog(fogstate_t *result, fogstate_t *oldf, float time, fogstate_t *newf) void CL_BlendFog(fogstate_t *result, fogstate_t *oldf, float time, fogstate_t *newf)
{ {
float nfrac, ofrac; float nfrac;
if (time >= newf->time) if (time >= newf->time)
nfrac = 1; nfrac = 1;
else if (time < oldf->time) else if (time < oldf->time)
nfrac = 0; nfrac = 0;
else else
nfrac = (time - oldf->time) / (newf->time - oldf->time); nfrac = (time - oldf->time) / (newf->time - oldf->time);
ofrac = 1 - nfrac;
FloatInterpolate(oldf->alpha, nfrac, newf->alpha, result->alpha); FloatInterpolate(oldf->alpha, nfrac, newf->alpha, result->alpha);
FloatInterpolate(oldf->depthbias, nfrac, newf->depthbias, result->depthbias); FloatInterpolate(oldf->depthbias, nfrac, newf->depthbias, result->depthbias);
@ -1742,7 +1742,7 @@ void CL_CheckServerInfo(void)
oldteamplay = cl.teamplay; oldteamplay = cl.teamplay;
cl.teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay")); cl.teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));
cl.deathmatch = atoi(Info_ValueForKey(cl.serverinfo, "deathmatch")); cls.deathmatch = cl.deathmatch = atoi(Info_ValueForKey(cl.serverinfo, "deathmatch"));
cls.allow_cheats = false; cls.allow_cheats = false;
cls.allow_semicheats=true; cls.allow_semicheats=true;
@ -1803,8 +1803,6 @@ void CL_CheckServerInfo(void)
if (cls.maxfps < 20) if (cls.maxfps < 20)
cls.maxfps = 72; cls.maxfps = 72;
cls.deathmatch = atoi(Info_ValueForKey(cl.serverinfo, "deathmatch"));
cls.z_ext = atoi(Info_ValueForKey(cl.serverinfo, "*z_ext")); cls.z_ext = atoi(Info_ValueForKey(cl.serverinfo, "*z_ext"));
// movement vars for prediction // movement vars for prediction
@ -2194,10 +2192,10 @@ void CL_NextDemo (void)
{ {
char str[1024]; char str[1024];
if (cls.demonum == -1) if (cls.demonum < 0)
return; // don't play demos return; // don't play demos
if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) if (!cls.demos[cls.demonum][0] || cls.demonum >= MAX_DEMOS)
{ {
cls.demonum = 0; cls.demonum = 0;
if (!cls.demos[cls.demonum][0]) if (!cls.demos[cls.demonum][0])
@ -2214,6 +2212,9 @@ void CL_NextDemo (void)
Q_snprintfz (str, sizeof(str), "playdemo %s\n", cls.demos[cls.demonum]); Q_snprintfz (str, sizeof(str), "playdemo %s\n", cls.demos[cls.demonum]);
Cbuf_InsertText (str, RESTRICT_LOCAL, false); Cbuf_InsertText (str, RESTRICT_LOCAL, false);
cls.demonum++; cls.demonum++;
if (!cls.state)
cls.state = ca_demostart;
} }
/* /*
@ -2245,17 +2246,8 @@ void CL_Startdemos_f (void)
for (i=1 ; i<c+1 ; i++) for (i=1 ; i<c+1 ; i++)
Q_strncpyz (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0])); Q_strncpyz (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0]));
if ( cls.demonum = 0;
#ifndef CLIENTONLY //don't start it here - we might have been given a +connect or whatever argument.
!sv.state &&
#endif
cls.demonum != -1 && cls.demoplayback==DPB_NONE && !Media_PlayingFullScreen() && COM_CheckParm("-demos"))
{
cls.demonum = 0;
CL_NextDemo ();
}
else
cls.demonum = -1;
} }
@ -2470,7 +2462,7 @@ void CL_ConnectionlessPacket (void)
else if (!strcmp(s, "reject")) else if (!strcmp(s, "reject"))
{ //generic rejection. stop trying. { //generic rejection. stop trying.
char *data = MSG_ReadStringLine(); char *data = MSG_ReadStringLine();
Con_Printf ("reject\n%s\n", s); Con_Printf ("reject\n%s\n", data);
connectinfo.trying = false; connectinfo.trying = false;
return; return;
} }
@ -3541,6 +3533,8 @@ void CL_Init (void)
Cvar_Register (&b_switch, cl_controlgroup); Cvar_Register (&b_switch, cl_controlgroup);
Cvar_Register (&w_switch, cl_controlgroup); Cvar_Register (&w_switch, cl_controlgroup);
Cvar_Register (&cl_demoreel, cl_controlgroup);
Cvar_Register (&cl_nofake, cl_controlgroup); Cvar_Register (&cl_nofake, cl_controlgroup);
Cvar_Register (&cl_chatsound, cl_controlgroup); Cvar_Register (&cl_chatsound, cl_controlgroup);
Cvar_Register (&cl_enemychatsound, cl_controlgroup); Cvar_Register (&cl_enemychatsound, cl_controlgroup);
@ -4672,7 +4666,12 @@ void CL_StartCinematicOrMenu(void)
#endif #endif
{ {
if (qrenderer > QR_NONE && !m_state) if (qrenderer > QR_NONE && !m_state)
M_ToggleMenu_f(); {
if (cl_demoreel.ival)
CL_NextDemo();
if (!cls.state)
M_ToggleMenu_f();
}
//Con_ForceActiveNow(); //Con_ForceActiveNow();
} }
} }
@ -4972,6 +4971,7 @@ void Host_Shutdown(void)
#endif #endif
Con_Shutdown(); Con_Shutdown();
COM_BiDi_Shutdown();
Memory_DeInit(); Memory_DeInit();
#ifndef CLIENTONLY #ifndef CLIENTONLY

View file

@ -2113,7 +2113,6 @@ static void DLC_RequestDownloadChunks(qdownload_t *dl, float frametime)
void DLC_Poll(qdownload_t *dl) void DLC_Poll(qdownload_t *dl)
{ {
extern cvar_t drate;
static float lasttime; static float lasttime;
DLC_RequestDownloadChunks(dl, realtime - lasttime); DLC_RequestDownloadChunks(dl, realtime - lasttime);
lasttime = realtime; lasttime = realtime;
@ -5673,7 +5672,6 @@ void CL_DumpPacket(void)
void CL_ParsePortalState(void) void CL_ParsePortalState(void)
{ {
qboolean open = false;
int mode = MSG_ReadByte(); int mode = MSG_ReadByte();
int a1, a2; int a1, a2;

View file

@ -434,6 +434,7 @@ void CL_PredictUsercmd (int pnum, int entnum, player_state_t *from, player_state
//Used when cl_nopred is 1 to determine whether we are on ground, otherwise stepup smoothing code produces ugly jump physics //Used when cl_nopred is 1 to determine whether we are on ground, otherwise stepup smoothing code produces ugly jump physics
void CL_CatagorizePosition (playerview_t *pv, float *org) void CL_CatagorizePosition (playerview_t *pv, float *org)
{ {
//fixme: in nq, we are told by the server and should skip this, which avoids needing to know the player's size.
if (cl.spectator) if (cl.spectator)
{ {
pv->onground = false; // in air pv->onground = false; // in air
@ -1056,7 +1057,12 @@ void CL_PredictMovePNum (int seat)
cmdto = &cl.outframes[cl.ackedmovesequence & UPDATE_MASK].cmd[seat]; cmdto = &cl.outframes[cl.ackedmovesequence & UPDATE_MASK].cmd[seat];
if (!nopred) if (nopred)
{ //still need the player's size for onground detection and bobbing.
VectorCopy(tostate->szmins, pmove.player_mins);
VectorCopy(tostate->szmaxs, pmove.player_maxs);
}
else
{ {
for (i=1 ; i<UPDATE_BACKUP-1 && cl.ackedmovesequence+i < cl.movesequence; i++) for (i=1 ; i<UPDATE_BACKUP-1 && cl.ackedmovesequence+i < cl.movesequence; i++)
{ {
@ -1119,7 +1125,7 @@ void CL_PredictMovePNum (int seat)
cmdto->msec = bound(0, msec, 250); cmdto->msec = bound(0, msec, 250);
// Con_DPrintf(" extrap %i: %f-%f\n", toframe, fromtime, simtime); // Con_DPrintf(" extrap %i: %f-%f (%g)\n", toframe, fromtime, simtime, simtime-fromtime);
CL_PredictUsercmd (seat, pv->viewentity, fromstate, tostate, cmdto); CL_PredictUsercmd (seat, pv->viewentity, fromstate, tostate, cmdto);
} }
} }

View file

@ -404,7 +404,6 @@ void SCR_CenterPrint (int pnum, char *str, qboolean skipgamecode)
void SCR_CPrint_f(void) void SCR_CPrint_f(void)
{ {
char *s = Cmd_Args();
if (Cmd_Argc() == 2) if (Cmd_Argc() == 2)
SCR_CenterPrint(0, Cmd_Argv(1), true); SCR_CenterPrint(0, Cmd_Argv(1), true);
else else
@ -1031,13 +1030,7 @@ void SCR_CrosshairPosition(playerview_t *pview, float *x, float *y)
tr.fraction = 1; tr.fraction = 1;
cl.worldmodel->funcs.NativeTrace(cl.worldmodel, 0, 0, NULL, start, end, vec3_origin, vec3_origin, MASK_WORLDSOLID, &tr); cl.worldmodel->funcs.NativeTrace(cl.worldmodel, 0, 0, NULL, start, end, vec3_origin, vec3_origin, MASK_WORLDSOLID, &tr);
start[2]-=16; start[2]-=16;
if (tr.fraction == 1) if (tr.fraction != 1)
{
*x = rect.x + rect.width/2 + cl_crossx.value;
*y = rect.y + rect.height/2 + cl_crossy.value;
return;
}
else
{ {
adj=pview->viewheight; adj=pview->viewheight;
if (v_viewheight.value < -7) if (v_viewheight.value < -7)
@ -1049,17 +1042,14 @@ void SCR_CrosshairPosition(playerview_t *pview, float *x, float *y)
start[2]+=adj; start[2]+=adj;
Matrix4x4_CM_Project(tr.endpos, end, pview->simangles, start, r_refdef.fov_x, r_refdef.fov_y); Matrix4x4_CM_Project(tr.endpos, end, pview->simangles, start, r_refdef.fov_x, r_refdef.fov_y);
*x = rect.x+rect.width*end[0]; *x = rect.x+rect.width*end[0] + cl_crossx.value;
*y = rect.y+rect.height*(1-end[1]); *y = rect.y+rect.height*(1-end[1]) + cl_crossy.value;
return; return;
} }
} }
else
{ *x = rect.x + rect.width/2 + cl_crossx.value;
*x = rect.x + rect.width/2 + cl_crossx.value; *y = rect.y + rect.height/2 + cl_crossy.value;
*y = rect.y + rect.height/2 + cl_crossy.value;
return;
}
} }
/* /*
@ -1594,7 +1584,7 @@ void SCR_DrawLoading (qboolean opaque)
{ {
Draw_FunString(x+8, y+8+4, va("%5ukbps %8umb%s remaining (%i files)", Draw_FunString(x+8, y+8+4, va("%5ukbps %8umb%s remaining (%i files)",
(unsigned int)(CL_DownloadRate()/1000.0f), (unsigned int)(CL_DownloadRate()/1000.0f),
tsize/(1024*1024), (unsigned int)(tsize/(1024*1024)),
sizeextra?"+":"", sizeextra?"+":"",
fcount)); fcount));
} }
@ -1602,7 +1592,7 @@ void SCR_DrawLoading (qboolean opaque)
{ {
Draw_FunString(x+8, y+8+4, va("%5ukbps %8ukb%s remaining (%i files)", Draw_FunString(x+8, y+8+4, va("%5ukbps %8ukb%s remaining (%i files)",
(unsigned int)(CL_DownloadRate()/1000.0f), (unsigned int)(CL_DownloadRate()/1000.0f),
tsize/1024, (unsigned int)(tsize/1024),
sizeextra?"+":"", sizeextra?"+":"",
fcount)); fcount));
} }
@ -1719,7 +1709,7 @@ void SCR_SetUpToDrawConsole (void)
if ((!Key_Dest_Has(~(kdm_console|kdm_game))) && (!cl.sendprespawn && cl.worldmodel && cl.worldmodel->needload)) if ((!Key_Dest_Has(~(kdm_console|kdm_game))) && (!cl.sendprespawn && cl.worldmodel && cl.worldmodel->needload))
{ {
//force console to fullscreen if we're loading stuff //force console to fullscreen if we're loading stuff
Key_Dest_Add(kdm_console); // Key_Dest_Add(kdm_console);
scr_conlines = scr_con_current = vid.height * fullscreenpercent; scr_conlines = scr_con_current = vid.height * fullscreenpercent;
} }
else if (!Key_Dest_Has(kdm_menu) && (!Key_Dest_Has(~(kdm_console|kdm_game))) && SCR_GetLoadingStage() == LS_NONE && cls.state < ca_active && !Media_PlayingFullScreen() && !CSQC_UnconnectedOkay(false)) else if (!Key_Dest_Has(kdm_menu) && (!Key_Dest_Has(~(kdm_console|kdm_game))) && SCR_GetLoadingStage() == LS_NONE && cls.state < ca_active && !Media_PlayingFullScreen() && !CSQC_UnconnectedOkay(false))

View file

@ -474,7 +474,7 @@ typedef struct
qboolean allow_rearview; qboolean allow_rearview;
qboolean allow_skyboxes; qboolean allow_skyboxes;
qboolean allow_mirrors; qboolean allow_mirrors;
qboolean allow_watervis; qboolean allow_watervis; //fixme: not checked any more
float allow_fbskins; //fraction of allowance float allow_fbskins; //fraction of allowance
qboolean allow_postproc; qboolean allow_postproc;
qboolean allow_cheats; qboolean allow_cheats;

View file

@ -65,7 +65,7 @@ static void J_ControllerAdded(int enumid)
char *cname; char *cname;
int i; int i;
for (i = 0; i < MAX_JOYSTICKS; i++) for (i = 0; i < MAX_JOYSTICKS; i++)
if (j_controller[i] == NULL) if (sdljoy[i].controller == NULL)
break; break;
if (i == MAX_JOYSTICKS) if (i == MAX_JOYSTICKS)
return; return;
@ -233,14 +233,14 @@ static void J_Kill(int jid, qboolean verbose)
{ {
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
J_ControllerButton(jid, i, false); J_ControllerButton(jid, i, false);
Con_Printf("Controller unplugged(%i): %s\n", joy - sdljoy, joy->devname); Con_Printf("Controller unplugged(%i): %s\n", (int)(joy - sdljoy), joy->devname);
SDL_GameControllerClose(joy->controller); SDL_GameControllerClose(joy->controller);
} }
else else
{ {
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
J_JoystickButton(jid, i, false); J_JoystickButton(jid, i, false);
Con_Printf("Joystick unplugged(%i): %s\n", joy - sdljoy, joy->devname); Con_Printf("Joystick unplugged(%i): %s\n", (int)(joy - sdljoy), joy->devname);
SDL_JoystickClose(joy->joystick); SDL_JoystickClose(joy->joystick);
} }
joy->controller = NULL; joy->controller = NULL;

View file

@ -1852,10 +1852,11 @@ qboolean MC_Main_Key (int key, menu_t *menu) //here purly to restart demos.
if (key == K_ESCAPE) if (key == K_ESCAPE)
{ {
extern int m_save_demonum; extern int m_save_demonum;
extern cvar_t cl_demoreel;
Key_Dest_Remove(kdm_menu); Key_Dest_Remove(kdm_menu);
m_state = m_none; m_state = m_none;
cls.demonum = m_save_demonum; cls.demonum = m_save_demonum;
if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected && COM_CheckParm("-demos")) if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected && cl_demoreel.ival)
CL_NextDemo (); CL_NextDemo ();
return true; return true;
} }

View file

@ -349,7 +349,7 @@ void M_Menu_Audio_f (void)
"6", "6",
NULL NULL
}; };
#ifdef VOICECHAT
static const char *voipcodecoptions[] = { static const char *voipcodecoptions[] = {
"Speex (ez-compat)", "Speex (ez-compat)",
// "Raw (11025)", // "Raw (11025)",
@ -379,7 +379,7 @@ void M_Menu_Audio_f (void)
"2", "2",
NULL NULL
}; };
#endif
menubulk_t bulk[] = { menubulk_t bulk[] = {
MB_REDTEXT("Sound Options", false), MB_REDTEXT("Sound Options", false),
MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false), MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false),
@ -530,51 +530,57 @@ const char *presetname[] =
{ {
"286", //everything turned off to make it as fast as possible, even if you're crippled without it "286", //everything turned off to make it as fast as possible, even if you're crippled without it
"Fast", //typical deathmatch settings. "Fast", //typical deathmatch settings.
"Normal", //some extra effects "Vanilla", //vanilla effects enabled, no content replacement.
"Normal", //content replacement enabled
"Nice", //potentially expensive, but not painful "Nice", //potentially expensive, but not painful
"Realtime", //everything on "Realtime", //everything on
NULL NULL
}; };
#define PRESET_NUM 5 #define PRESET_NUM 6
// this is structured like this for a possible future feature // this is structured like this for a possible future feature
// also don't include cvars that need a restart here // also don't include cvars that need a restart here
const char *presetexec[] = const char *presetexec[] =
{ {
// 286 options (also the first commands to be execed in the chain) // 286 options (also the first commands to be execed in the chain)
"m_preset_chosen 1;" "seta m_preset_chosen 1;"
"gl_texturemode nn;" "seta gl_texturemode nn;"
"gl_blendsprites 0;" "seta gl_blendsprites 0;"
"r_particlesystem null;" "seta r_particlesystem null;"
"r_particledesc \"\";" "seta r_particledesc \"\";"
"r_stains 0;" "seta r_part_classic_square 0;"
"r_drawflat 1;" "seta r_stains 0;"
"r_nolerp 1;" "seta r_drawflat 1;"
"r_nolightdir 1;" "seta r_nolerp 1;"
"r_dynamic 0;" "seta r_nolightdir 1;"
"gl_polyblend 0;" "seta r_dynamic 0;"
"gl_flashblend 0;" "seta gl_polyblend 0;"
"gl_specular 0;" "seta gl_flashblend 0;"
"r_loadlit 0;" "seta gl_specular 0;"
"r_fastsky 1;" "seta r_loadlit 0;"
"r_drawflame 0;" "seta r_fastsky 1;"
"r_waterstyle 0;" "seta r_drawflame 0;"
"r_lavastyle 0;" "seta r_waterstyle 1;"
"r_coronas 0;" "seta r_lavastyle 1;" //defer to water
"r_shadow_realtime_dlight 0;" // "seta r_slimestyle \"\";" //defer to water
"r_shadow_realtime_world 0;" "seta r_coronas 0;"
"r_glsl_offsetmapping 0;" "seta r_shadow_realtime_dlight 0;"
// "gl_detail 0;" "seta r_shadow_realtime_world 0;"
"gl_load24bit 0;" "seta r_glsl_offsetmapping 0;"
"r_replacemodels \"\";" // "seta gl_detail 0;"
"r_waterwarp 0;" "seta gl_load24bit 0;"
"r_lightstylesmooth 0;" "seta r_replacemodels \"\";"
"r_part_density 0.25;" "seta r_waterwarp 0;"
"cl_nolerp 1;" "seta r_lightstylesmooth 0;"
"r_lerpmuzzlehack 0;" "seta r_part_density 0.25;"
"v_gunkick 0;" "seta cl_nolerp 1;"
"cl_rollangle 0;" "seta r_lerpmuzzlehack 0;"
"cl_bob 0;" "seta v_gunkick 0;"
"seta cl_rollangle 0;"
"seta cl_bob 0;"
"seta cl_sbar 0;"
"seta sv_nqplayerphysics 0;" //server settings in a preset might be bad.
"seta cl_demoreel 0;"
, // fast options , // fast options
"gl_texturemode ln;" "gl_texturemode ln;"
@ -589,6 +595,25 @@ const char *presetexec[] =
"r_lavastyle 1;" "r_lavastyle 1;"
"r_nolightdir 0;" "r_nolightdir 0;"
, //vanilla options.
"r_part_density 1;"
"gl_polyblend 1;"
"r_dynamic 1;"
"gl_flashblend 0;"
"cl_nolerp 0;"
"r_waterwarp 1;"
"r_drawflame 1;"
"v_gunkick 1;"
"cl_rollangle 2.0;"
"cl_bob 0.02;"
//these things are perhaps a little extreme
"gl_texturemode nn;" //yup, we went there.
"r_part_classic_square 1;" //blocky baby!
"cl_sbar 1;" //its a style thing
"sv_nqplayerphysics 1;" //gb wanted this
"cl_demoreel 1;" //yup, arcadey
//"d_mipcap \"0 3\";" //logically correct, but will fuck up on ATI drivers if increased mid-map, because ATI will just ignore any levels that are not currently enabled.
, // normal (faithful) options, but with content replacement thrown in , // normal (faithful) options, but with content replacement thrown in
#ifdef MINIMAL #ifdef MINIMAL
"r_particlesystem classic;" "r_particlesystem classic;"
@ -596,20 +621,15 @@ const char *presetexec[] =
"r_particlesystem script;" "r_particlesystem script;"
"r_particledesc classic;" "r_particledesc classic;"
#endif #endif
"r_part_density 1;" "r_part_classic_square 0;"
"gl_polyblend 1;"
"r_dynamic 1;"
"gl_flashblend 0;"
"gl_load24bit 1;" "gl_load24bit 1;"
"r_replacemodels \"md3 md2\";" "r_replacemodels \"md3 md2\";"
"r_waterwarp 1;"
"r_drawflame 1;"
"r_coronas 1;" "r_coronas 1;"
"cl_nolerp 0;"
"r_lerpmuzzlehack 1;" "r_lerpmuzzlehack 1;"
"v_gunkick 1;" "gl_texturemode ln;"
"cl_rollangle 2.0;" "cl_sbar 0;"
"cl_bob 0.02;" "sv_nqplayerphysics 0;"
"cl_demoreel 0;"
, // nice options , // nice options
"r_stains 0.75;" "r_stains 0.75;"
@ -663,9 +683,10 @@ void M_Menu_Preset_f (void)
{ {
MB_REDTEXT("Please Choose Preset", false), MB_REDTEXT("Please Choose Preset", false),
MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false), MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false),
MB_CONSOLECMD("286 (untextured)", "fps_preset 286;menupop\n", "Lacks textures, particles, pretty much everything."), MB_CONSOLECMD("simple (untextured)", "fps_preset 286;menupop\n", "Lacks textures, particles, pretty much everything."),
MB_CONSOLECMD("fast (deathmatch)", "fps_preset fast;menupop\n", "Fullscreen effects off to give consistant framerates"), MB_CONSOLECMD("fast (deathmatch)", "fps_preset fast;menupop\n", "Fullscreen effects off to give consistant framerates"),
MB_CONSOLECMD("normal (faithful)", "fps_preset normal;menupop\n", "This is for purists!"), MB_CONSOLECMD("vanilla (softwarey)", "fps_preset vanilla;menupop\n", "This is for purists! Party like its 1995! No sanity spared!"),
MB_CONSOLECMD("normal (faithful)", "fps_preset normal;menupop\n", "An updated but still faithful appearance, using content replacements where applicable"),
MB_CONSOLECMD("nice (dynamic)", "fps_preset nice;menupop\n", "For people who like nice things, but still want to actually play"), MB_CONSOLECMD("nice (dynamic)", "fps_preset nice;menupop\n", "For people who like nice things, but still want to actually play"),
MB_CONSOLECMD("realtime (all on)", "fps_preset realtime;menupop\n", "For people who value pretty over fast/smooth. Not viable for deathmatch."), MB_CONSOLECMD("realtime (all on)", "fps_preset realtime;menupop\n", "For people who value pretty over fast/smooth. Not viable for deathmatch."),
MB_END() MB_END()
@ -2623,7 +2644,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
galiasbone_t *b = Mod_GetBoneInfo(ent.model, &bonecount); galiasbone_t *b = Mod_GetBoneInfo(ent.model, &bonecount);
if (b && bonecount) if (b && bonecount)
{ {
Draw_FunString(0, y, va("Bones: ", mods->skingroup, fname)); Draw_FunString(0, y, va("Bones: "));
y+=8; y+=8;
M_BoneDisplay(&ent, b, &y, 0, -1, 0, bonecount); M_BoneDisplay(&ent, b, &y, 0, -1, 0, bonecount);
} }

View file

@ -937,19 +937,19 @@ void M_Menu_Quit_f (void)
} }
else if (!strcmp(arg, "save")) else if (!strcmp(arg, "save"))
mode = 2; mode = 2;
else if (!strcmp(arg, "prompt"))
{ //always prompt, though it might be about saving.
if (Cvar_UnsavedArchive())
mode = 2;
else
mode = 1;
}
else else
{ //prompt to save, but not otherwise. { //prompt to save, but not otherwise.
if (Cvar_UnsavedArchive()) if (Cvar_UnsavedArchive())
mode = 2; mode = 2;
else else
mode = 0; {
if (!strcmp(arg, "prompt"))
mode = 1;
else if (!strcmp(arg, "noprompt"))
mode = 1;
else
mode = 0;
}
} }
switch(mode) switch(mode)

View file

@ -264,15 +264,19 @@ static qboolean PClassic_InitParticles (void)
"{\n" "{\n"
"program defaultsprite\n" "program defaultsprite\n"
"nomipmaps\n" "nomipmaps\n"
"surfaceparm nodlight\n"
"{\n" "{\n"
"map $diffuse\n" "if r_part_classic_square\n"
"map classicparticle_square\n"
"else\n"
"map classicparticle\n"
"endif\n"
"rgbgen vertex\n" "rgbgen vertex\n"
"alphagen vertex\n" "alphagen vertex\n"
"blendfunc blend\n" "blendfunc blend\n"
"}\n" "}\n"
"}\n" "}\n"
); );
TEXASSIGN(classicshader->defaulttextures.base, particlecqtexture);
return true; return true;
} }

View file

@ -486,9 +486,8 @@ qboolean M_Vid_GetMode(int num, int *w, int *h);
//a bit pointless really //a bit pointless really
void QCBUILTIN PF_cl_getresolution (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) void QCBUILTIN PF_cl_getresolution (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {
// extern cvar_t vid_fullscreen;
float mode = G_FLOAT(OFS_PARM0); float mode = G_FLOAT(OFS_PARM0);
qboolean fixedmodes = (prinst->callargc >= 2)?!G_FLOAT(OFS_PARM1):false; //if true, we should return sane-sized modes suitable for a window... or the mod could make up its own, but whatever. // qboolean fixedmodes = (prinst->callargc >= 2)?!G_FLOAT(OFS_PARM1):false; //if true, we should return sane-sized modes suitable for a window... or the mod could make up its own, but whatever.
float *ret = G_VECTOR(OFS_RETURN); float *ret = G_VECTOR(OFS_RETURN);
int w, h; int w, h;

View file

@ -5943,7 +5943,9 @@ qboolean CSQC_DrawView(void)
qboolean CSQC_KeyPress(int key, int unicode, qboolean down, int devid) qboolean CSQC_KeyPress(int key, int unicode, qboolean down, int devid)
{ {
void *pr_globals; void *pr_globals;
#ifdef TEXTEDITOR
extern qboolean editormodal; extern qboolean editormodal;
#endif
if (!csqcprogs || !csqcg.input_event) if (!csqcprogs || !csqcg.input_event)
return false; return false;

View file

@ -535,6 +535,7 @@ extern cvar_t r_editlights_import_diffuse;
extern cvar_t r_editlights_import_specular; extern cvar_t r_editlights_import_specular;
extern cvar_t r_mirroralpha; extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha; extern cvar_t r_wateralpha;
extern cvar_t r_lavaalpha;
extern cvar_t r_waterstyle; extern cvar_t r_waterstyle;
extern cvar_t r_slimestyle; extern cvar_t r_slimestyle;
extern cvar_t r_lavastyle; extern cvar_t r_lavastyle;

View file

@ -144,6 +144,8 @@ cvar_t r_walltexture = CVARF ("r_walltexture", "",
CVAR_RENDERERCALLBACK|CVAR_SHADERSYSTEM); //FIXME: broken CVAR_RENDERERCALLBACK|CVAR_SHADERSYSTEM); //FIXME: broken
cvar_t r_wateralpha = CVARF ("r_wateralpha", "1", cvar_t r_wateralpha = CVARF ("r_wateralpha", "1",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM); CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_lavaalpha = CVARF ("r_lavaalpha", "",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_waterwarp = CVARF ("r_waterwarp", "1", cvar_t r_waterwarp = CVARF ("r_waterwarp", "1",
CVAR_ARCHIVE); CVAR_ARCHIVE);
@ -327,7 +329,7 @@ cvar_t gl_texture_anisotropic_filtering = CVARFC("gl_texture_anisotropic_filter
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
GL_Texture_Anisotropic_Filtering_Callback); GL_Texture_Anisotropic_Filtering_Callback);
cvar_t gl_texturemode = CVARFC("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", cvar_t gl_texturemode = CVARFC("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK | CVAR_SAVE,
GL_Texturemode_Callback); GL_Texturemode_Callback);
cvar_t gl_mipcap = CVARFC("d_mipcap", "0 1000", cvar_t gl_mipcap = CVARFC("d_mipcap", "0 1000",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
@ -696,6 +698,7 @@ void Renderer_Init(void)
Cvar_Register (&r_fastsky, GRAPHICALNICETIES); Cvar_Register (&r_fastsky, GRAPHICALNICETIES);
Cvar_Register (&r_fastskycolour, GRAPHICALNICETIES); Cvar_Register (&r_fastskycolour, GRAPHICALNICETIES);
Cvar_Register (&r_wateralpha, GRAPHICALNICETIES); Cvar_Register (&r_wateralpha, GRAPHICALNICETIES);
Cvar_Register (&r_lavaalpha, GRAPHICALNICETIES);
Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS); Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS);
Cvar_Register (&r_clear, GLRENDEREROPTIONS); Cvar_Register (&r_clear, GLRENDEREROPTIONS);
@ -2496,10 +2499,17 @@ void R_InitParticleTexture (void)
data[y*32+x][3] = 255; data[y*32+x][3] = 255;
} }
} }
particlecqtexture = R_LoadTexture32("classicparticle", 32, 32, data, IF_NOMIPMAP|IF_NOPICMIP); particlecqtexture = R_LoadTexture32("classicparticle", 32, 32, data, IF_NOMIPMAP|IF_NOPICMIP);
//draw a square in the top left. still a triangle.
for (x=0 ; x<16 ; x++)
{
for (y=0 ; y<16 ; y++)
{
data[y*32+x][3] = 255;
}
}
R_LoadTexture32("classicparticle_square", 32, 32, data, IF_NOMIPMAP|IF_NOPICMIP);

View file

@ -2550,7 +2550,11 @@ void Sbar_Draw (playerview_t *pv)
if (pv == cl.playerview) if (pv == cl.playerview)
{ {
if (!cls.deathmatch) if (!cls.deathmatch)
{
if (cl_sbar.value)
Sbar_DrawPic (0, 0, 320, 24, sb_scorebar);
Sbar_CoopScoreboard (); Sbar_CoopScoreboard ();
}
else else
Sbar_SoloScoreboard (); Sbar_SoloScoreboard ();
} }

View file

@ -899,7 +899,6 @@ static int DSOUND_InitCard_Internal (soundcardinfo_t *sc, char *cardname)
#ifdef MULTITHREAD #ifdef MULTITHREAD
int GetSoundtime(soundcardinfo_t *sc);
static int DSOUND_Thread(void *arg) static int DSOUND_Thread(void *arg)
{ {
soundcardinfo_t *sc = arg; soundcardinfo_t *sc = arg;

View file

@ -2813,7 +2813,7 @@ static void S_UpdateCard(soundcardinfo_t *sc)
S_Update_(sc); S_Update_(sc);
} }
int GetSoundtime(soundcardinfo_t *sc) int S_GetMixerTime(soundcardinfo_t *sc)
{ {
int samplepos; int samplepos;
int fullsamples; int fullsamples;
@ -2896,7 +2896,7 @@ static void S_Update_(soundcardinfo_t *sc)
int samps; int samps;
// Updates DMA time // Updates DMA time
soundtime = GetSoundtime(sc); soundtime = S_GetMixerTime(sc);
if (sc->samplequeue) if (sc->samplequeue)
{ {

View file

@ -27,6 +27,7 @@ JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_audioinfo(JNIEnv *env, jcla
} }
} }
extern int S_GetMixerTime(soundcardinfo_t *sc);
//transfer the 'dma' buffer into the buffer it requests, called from a dedicated sound thread created by the java code. //transfer the 'dma' buffer into the buffer it requests, called from a dedicated sound thread created by the java code.
JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_paintaudio(JNIEnv *env, jclass this, jbyteArray stream, jint len) JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_paintaudio(JNIEnv *env, jclass this, jbyteArray stream, jint len)
{ {
@ -38,7 +39,7 @@ JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_paintaudio(JNIEnv *env, jcl
{ {
int buffersize = sc->sn.samples*sc->sn.samplebits/8; int buffersize = sc->sn.samples*sc->sn.samplebits/8;
int curtime = GetSoundtime(sc); int curtime = S_GetMixerTime(sc);
framesz = sc->sn.numchannels * sc->sn.samplebits/8; framesz = sc->sn.numchannels * sc->sn.samplebits/8;
S_PaintChannels (sc, curtime + (len / framesz)); S_PaintChannels (sc, curtime + (len / framesz));

View file

@ -207,8 +207,6 @@ JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_init(JNIEnv *env, jobject o
"", "",
"" ""
}; };
char *basepack;
int align;
quakeparms_t parms; quakeparms_t parms;
Sys_Printf("reinit\n"); Sys_Printf("reinit\n");
if (sys_memheap) if (sys_memheap)

View file

@ -593,22 +593,12 @@ void Mod_ParseInfoFromEntityLump(model_t *wmodel, char *data, char *mapname) //a
return; return;
#endif #endif
// this hack is necessary to ensure Quake 2 maps get their // this hack is necessary to ensure Quake 2 maps get their default skybox, without breaking q1 etc
// default skybox
if (wmodel->fromgame == fg_quake2) if (wmodel->fromgame == fg_quake2)
strcpy(cl.skyname, "unit1_"); strcpy(cl.skyname, "unit1_");
else else
cl.skyname[0] = '\0'; cl.skyname[0] = '\0';
for (msky = mapskies; msky; msky = msky->next)
{
if (!strcmp(msky->mapname, mapname))
{
Q_strncpyz(cl.skyname, msky->skyname, sizeof(cl.skyname));
break;
}
}
if (data) if (data)
if ((data=COM_Parse(data))) //read the map info. if ((data=COM_Parse(data))) //read the map info.
if (com_token[0] == '{') if (com_token[0] == '{')
@ -636,7 +626,7 @@ void Mod_ParseInfoFromEntityLump(model_t *wmodel, char *data, char *mapname) //a
{ {
Q_strncpyz(cl.skyname, com_token, sizeof(cl.skyname)); Q_strncpyz(cl.skyname, com_token, sizeof(cl.skyname));
} }
else if (!strcmp("fog", key)) else if (!strcmp("fog", key)) //q1 extension. FIXME: should be made temporary.
{ {
int oel = Cmd_ExecLevel; int oel = Cmd_ExecLevel;
void CL_Fog_f(void); void CL_Fog_f(void);
@ -648,15 +638,20 @@ void Mod_ParseInfoFromEntityLump(model_t *wmodel, char *data, char *mapname) //a
CL_Fog_f(); CL_Fog_f();
Cmd_ExecLevel=oel; Cmd_ExecLevel=oel;
} }
else if (!strcmp("wateralpha", key)) //override cvars so mappers don't end up hacking cvars and fucking over configs (at least in other engines).
{
Cvar_LockFromServer(&r_wateralpha, com_token);
Cvar_LockFromServer(&r_waterstyle, "1"); //force vanilla-style water too.
}
else if (!strcmp("sky", key)) // for Quake2 maps else if (!strcmp("sky", key)) // for Quake2 maps
{ {
Q_strncpyz(cl.skyname, com_token, sizeof(cl.skyname)); Q_strncpyz(cl.skyname, com_token, sizeof(cl.skyname));
} }
else if (!strcmp("skyrotate", key)) else if (!strcmp("skyrotate", key)) //q2 feature
{ {
cl.skyrotate = atof(com_token); cl.skyrotate = atof(com_token);
} }
else if (!strcmp("skyaxis", key)) else if (!strcmp("skyaxis", key)) //q2 feature
{ {
char *s; char *s;
Q_strncpyz(key, com_token, sizeof(key)); Q_strncpyz(key, com_token, sizeof(key));
@ -675,6 +670,17 @@ void Mod_ParseInfoFromEntityLump(model_t *wmodel, char *data, char *mapname) //a
} }
} }
} }
//map-specific sky override feature
for (msky = mapskies; msky; msky = msky->next)
{
if (!strcmp(msky->mapname, mapname))
{
Q_strncpyz(cl.skyname, msky->skyname, sizeof(cl.skyname));
break;
}
}
} }
//textures/fred.wad is the DP standard - I wanna go for that one. //textures/fred.wad is the DP standard - I wanna go for that one.

View file

@ -2720,7 +2720,13 @@ char *COM_ParseStringSetSep (const char *data, char sep)
com_token[len] = 0; com_token[len] = 0;
return (char*)data; return (char*)data;
} }
void COM_BiDi_Setup(void) void COM_BiDi_Shutdown(void)
{
bidi_charcount = 0;
BZ_Free(bidi_chartype);
bidi_chartype = NULL;
}
static void COM_BiDi_Setup(void)
{ {
char *file; char *file;
char *line; char *line;
@ -2782,7 +2788,7 @@ void COM_BiDi_Setup(void)
//bi-direction text is fun. //bi-direction text is fun.
//the text is specified in input order. the first in the string is the first entered on the keyboard. //the text is specified in input order. the first in the string is the first entered on the keyboard.
//this makes switching direction mid-line quite awkward. so lets hope you don't do that too often, mmkay? //this makes switching direction mid-line quite awkward. so lets hope you don't do that too often, mmkay?
void COM_BiDi_Parse(conchar_t *fte_restrict start, size_t length) static void COM_BiDi_Parse(conchar_t *fte_restrict start, size_t length)
{ {
char fl[2048], next, run, prev, para = BIDI_LTR; char fl[2048], next, run, prev, para = BIDI_LTR;
size_t i, runstart, j, k; size_t i, runstart, j, k;

View file

@ -304,6 +304,8 @@ unsigned int iso88591_encode(char *out, unsigned int unicode, int maxlen, qboole
unsigned int qchar_encode(char *out, unsigned int unicode, int maxlen, qboolean markup); unsigned int qchar_encode(char *out, unsigned int unicode, int maxlen, qboolean markup);
unsigned int COM_DeQuake(conchar_t chr); unsigned int COM_DeQuake(conchar_t chr);
void COM_BiDi_Shutdown(void);
//small macro to tell COM_ParseFunString (and related functions like con_printf) that the input is a utf-8 string. //small macro to tell COM_ParseFunString (and related functions like con_printf) that the input is a utf-8 string.
#define U8(s) "=`u8:"s"`=" #define U8(s) "=`u8:"s"`="

View file

@ -2342,7 +2342,7 @@ void COM_Gamedir (const char *dir)
/*some modern non-compat settings*/ /*some modern non-compat settings*/
#define DMFCFG "set com_parseutf8 1\npm_airstep 1\nsv_demoExtensions 1\n" #define DMFCFG "set com_parseutf8 1\npm_airstep 1\nsv_demoExtensions 1\n"
/*set some stuff so our regular qw client appears more like hexen2. sv_mintic is required to 'fix' the ravenstaff so that its projectiles don't impact upon each other*/ /*set some stuff so our regular qw client appears more like hexen2. sv_mintic is required to 'fix' the ravenstaff so that its projectiles don't impact upon each other*/
#define HEX2CFG "set com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset sv_maxspeed 640\ncl_run 0\nset watervis 1\nset r_lavastyle -2\nset r_wateralpha 0.5\nset sv_pupglow 1\ngl_shaftlight 0.5\nsv_mintic 0.015\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n" #define HEX2CFG "set com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset sv_maxspeed 640\ncl_run 0\nset watervis 1\nset r_lavaalpha 1\nset r_lavastyle -2\nset r_wateralpha 0.5\nset sv_pupglow 1\ngl_shaftlight 0.5\nsv_mintic 0.015\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n"
/*yay q2!*/ /*yay q2!*/
#define Q2CFG "com_nogamedirnativecode 0\n" #define Q2CFG "com_nogamedirnativecode 0\n"
/*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/ /*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/

View file

@ -4934,12 +4934,12 @@ static void CM_ClipBoxToPlanes (vec3_t trmins, vec3_t trmaxs, vec3_t p1, vec3_t
// q2cbrushside_t *side, *leadside; // q2cbrushside_t *side, *leadside;
static mplane_t bboxplanes[6] = //we change the dist, but nothing else static mplane_t bboxplanes[6] = //we change the dist, but nothing else
{ {
{1, 0, 0}, {{1, 0, 0}},
{0, 1, 0}, {{0, 1, 0}},
{0, 0, 1}, {{0, 0, 1}},
{-1, 0, 0}, {{-1, 0, 0}},
{0, -1, 0}, {{0, -1, 0}},
{0, 0, -1}, {{0, 0, -1}},
}; };
float nearfrac=0; float nearfrac=0;

View file

@ -1437,8 +1437,8 @@ void QCBUILTIN PF_hash_createtab (pubprogfuncs_t *prinst, struct globalvars_s *p
{ {
int i; int i;
int numbuckets = G_FLOAT(OFS_PARM0); int numbuckets = G_FLOAT(OFS_PARM0);
qboolean dupestrings = (prinst->callargc>1)?G_FLOAT(OFS_PARM1):false; // qboolean dupestrings = (prinst->callargc>1)?G_FLOAT(OFS_PARM1):false;
etype_t type = (prinst->callargc>2)?G_FLOAT(OFS_PARM2):ev_vector; etype_t type = (prinst->callargc>1)?G_FLOAT(OFS_PARM1):ev_vector;
if (!type) if (!type)
type = ev_vector; type = ev_vector;
if (numbuckets < 4) if (numbuckets < 4)
@ -1516,7 +1516,7 @@ void QCBUILTIN PF_fopen (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
const char *name = PR_GetStringOfs(prinst, OFS_PARM0); const char *name = PR_GetStringOfs(prinst, OFS_PARM0);
int fmode = G_FLOAT(OFS_PARM1); int fmode = G_FLOAT(OFS_PARM1);
int fsize = G_FLOAT(OFS_PARM2); int fsize = G_FLOAT(OFS_PARM2);
char *fallbackread; const char *fallbackread;
int i; int i;
for (i = 0; i < MAX_QC_FILES; i++) for (i = 0; i < MAX_QC_FILES; i++)
@ -3409,7 +3409,7 @@ void QCBUILTIN PF_buf_loadfile (pubprogfuncs_t *prinst, struct globalvars_s *pr
int bufno = G_FLOAT(OFS_PARM1)-BUFSTRBASE; int bufno = G_FLOAT(OFS_PARM1)-BUFSTRBASE;
vfsfile_t *file; vfsfile_t *file;
char line[8192]; char line[8192];
char *fallback; const char *fallback;
G_FLOAT(OFS_RETURN) = 0; G_FLOAT(OFS_RETURN) = 0;

View file

@ -152,7 +152,7 @@ struct world_s
{ {
void (*Event_Touch)(struct world_s *w, wedict_t *s, wedict_t *o); void (*Event_Touch)(struct world_s *w, wedict_t *s, wedict_t *o);
void (*Event_Think)(struct world_s *w, wedict_t *s); void (*Event_Think)(struct world_s *w, wedict_t *s);
void (*Event_Sound) (float *origin, wedict_t *entity, int channel, char *sample, int volume, float attenuation, int pitchadj); void (*Event_Sound) (float *origin, wedict_t *entity, int channel, const char *sample, int volume, float attenuation, int pitchadj);
qboolean (*Event_ContentsTransition) (struct world_s *w, wedict_t *ent, int oldwatertype, int newwatertype); qboolean (*Event_ContentsTransition) (struct world_s *w, wedict_t *ent, int oldwatertype, int newwatertype);
model_t *(*Get_CModel)(struct world_s *w, int modelindex); model_t *(*Get_CModel)(struct world_s *w, int modelindex);
void (*Get_FrameState)(struct world_s *w, wedict_t *s, framestate_t *fstate); void (*Get_FrameState)(struct world_s *w, wedict_t *s, framestate_t *fstate);

View file

@ -23,9 +23,9 @@
> >
<Tool <Tool
Name="VCNMakeTool" Name="VCNMakeTool"
BuildCommandLine="cd $(InputDir)\.. &amp;&amp; make droid-dbg ANDROID_HOME=C:/Games/tools/android-sdk ANDROID_NDK_ROOT=C:/Games/tools/android-ndk-r8e ANT=C:/Games/tools/apache-ant-1.8.2/bin/ant JAVATOOL=&quot;C:/Program\ Files/Java/jdk1.7.0_02/bin/&quot; -j8 DROID_ARCH=&quot;armeabi x86&quot;" BuildCommandLine="cd $(InputDir)\.. &amp;&amp; vcify make droid-dbg ANDROID_HOME=C:/Games/tools/android-sdk ANDROID_NDK_ROOT=C:/Games/tools/android-ndk-r8e ANT=C:/Games/tools/apache-ant-1.8.2/bin/ant JAVATOOL=&quot;C:/Program\ Files/Java/jdk1.7.0_02/bin/&quot; -j8 DROID_ARCH=&quot;armeabi x86&quot;"
ReBuildCommandLine="" ReBuildCommandLine=""
CleanCommandLine="cd $(InputDir)\..\.. &amp;&amp; make clean -j8" CleanCommandLine="cd $(InputDir)\.. &amp;&amp; vcify make clean -j8"
Output="" Output=""
PreprocessorDefinitions="ANDROID" PreprocessorDefinitions="ANDROID"
IncludeSearchPath="" IncludeSearchPath=""

View file

@ -1226,7 +1226,7 @@ static float *FTableForFunc ( unsigned int func )
return NULL; return NULL;
} }
void Shader_LightPass(char *shortname, shader_t *s, const void *args) void Shader_LightPass(const char *shortname, shader_t *s, const void *args)
{ {
char shadertext[8192*2]; char shadertext[8192*2];
sprintf(shadertext, LIGHTPASS_SHADER, ""); sprintf(shadertext, LIGHTPASS_SHADER, "");
@ -2598,13 +2598,17 @@ static void BE_SendPassBlendDepthMask(unsigned int sbits)
qglDisable(GL_PN_TRIANGLES_ATI); qglDisable(GL_PN_TRIANGLES_ATI);
} }
if (delta & SBITS_AFFINE) #ifdef GL_PERSPECTIVE_CORRECTION_HINT
if ((delta & SBITS_AFFINE) && qglHint)
{ {
if (sbits & SBITS_AFFINE) if (!qglHint || (gl_config.gles && gl_config.glversion >= 2) || (!gl_config.gles && gl_config.nofixedfunc))
; //doesn't exist in gles2 nor gl3+core contexts
else if (sbits & SBITS_AFFINE)
qglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); qglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
else else
qglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); qglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
} }
#endif
} }
static void BE_SubmitMeshChain(void) static void BE_SubmitMeshChain(void)
@ -4285,7 +4289,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} }
oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, true, FBO_TEX_COLOUR|FBO_RB_DEPTH, shaderstate.tex_reflection, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2); oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_reflection, 1, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2);
r_refdef.vrect.x = 0; r_refdef.vrect.x = 0;
r_refdef.vrect.y = 0; r_refdef.vrect.y = 0;
r_refdef.vrect.width = vid.fbvwidth/2; r_refdef.vrect.width = vid.fbvwidth/2;
@ -4334,11 +4338,11 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} }
oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, true, FBO_TEX_COLOUR|FBO_TEX_DEPTH, shaderstate.tex_refraction, shaderstate.tex_refractiondepth, vid.pixelwidth/2, vid.pixelheight/2); oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_TEX_DEPTH, &shaderstate.tex_refraction, 1, shaderstate.tex_refractiondepth, vid.pixelwidth/2, vid.pixelheight/2);
} }
else else
{ {
oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, true, FBO_TEX_COLOUR|FBO_RB_DEPTH, shaderstate.tex_refraction, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2); oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, FBO_RB_DEPTH, &shaderstate.tex_refraction, 1, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2);
} }
r_refdef.vrect.x = 0; r_refdef.vrect.x = 0;
@ -4380,7 +4384,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} }
oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, true, FBO_TEX_COLOUR, shaderstate.tex_ripplemap, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2); oldfbo = GLBE_FBO_Update(&shaderstate.fbo_reflectrefrac, 0, &shaderstate.tex_ripplemap, 1, r_nulltex, vid.pixelwidth/2, vid.pixelheight/2);
r_refdef.vrect.x = 0; r_refdef.vrect.x = 0;
r_refdef.vrect.y = 0; r_refdef.vrect.y = 0;
r_refdef.vrect.width = vid.fbvwidth/2; r_refdef.vrect.width = vid.fbvwidth/2;
@ -4526,7 +4530,7 @@ void GLBE_RenderToTextureUpdate2d(qboolean destchanged)
if (*r_refdef.rt_destcolour[0].texname) if (*r_refdef.rt_destcolour[0].texname)
{ {
texid_t tex = R2D_RT_GetTexture(r_refdef.rt_destcolour[0].texname, &width, &height); texid_t tex = R2D_RT_GetTexture(r_refdef.rt_destcolour[0].texname, &width, &height);
GLBE_FBO_Update(&shaderstate.fbo_2dfbo, true, FBO_TEX_COLOUR, tex, r_nulltex, width, height); GLBE_FBO_Update(&shaderstate.fbo_2dfbo, 0, &tex, 1, r_nulltex, width, height);
} }
else else
GLBE_FBO_Push(NULL); GLBE_FBO_Push(NULL);
@ -4589,21 +4593,19 @@ void GLBE_FBO_Destroy(fbostate_t *state)
} }
//state->colour is created if usedepth is set and it doesn't previously exist //state->colour is created if usedepth is set and it doesn't previously exist
int GLBE_FBO_Update(fbostate_t *state, qboolean bind, unsigned int enables, texid_t destcol, texid_t destdepth, int width, int height) int GLBE_FBO_Update(fbostate_t *state, unsigned int enables, texid_t *destcol, int mrt, texid_t destdepth, int width, int height)
{ {
int i;
int old; int old;
if (TEXVALID(destcol))
{
enables |= FBO_TEX_COLOUR;
enables &= ~FBO_RB_COLOUR;
}
if (TEXVALID(destdepth)) if (TEXVALID(destdepth))
{ {
enables |= FBO_TEX_DEPTH; enables |= FBO_TEX_DEPTH;
enables &= ~FBO_RB_DEPTH; enables &= ~FBO_RB_DEPTH;
} }
enables |= (mrt<<16);
if ((state->enables ^ enables) & ~FBO_RESET) if ((state->enables ^ enables) & ~FBO_RESET)
{ {
GLBE_FBO_Destroy(state); GLBE_FBO_Destroy(state);
@ -4638,7 +4640,7 @@ int GLBE_FBO_Update(fbostate_t *state, qboolean bind, unsigned int enables, texi
enables |= FBO_RESET; enables |= FBO_RESET;
if (enables & (FBO_TEX_COLOUR|FBO_RB_COLOUR)) if (mrt)
{ {
qglDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); qglDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
qglReadBuffer(GL_COLOR_ATTACHMENT0_EXT); qglReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
@ -4687,8 +4689,8 @@ int GLBE_FBO_Update(fbostate_t *state, qboolean bind, unsigned int enables, texi
} }
} }
if (enables & FBO_TEX_COLOUR) for (i = 0; i < mrt; i++)
qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, destcol.num, 0); qglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+i, GL_TEXTURE_2D, destcol[i].num, 0);
return old; return old;
} }
/* /*
@ -4857,7 +4859,7 @@ void GLBE_DrawLightPrePass(qbyte *vis)
} }
/*set the FB up to draw surface info*/ /*set the FB up to draw surface info*/
oldfbo = GLBE_FBO_Update(&shaderstate.fbo_lprepass, true, FBO_TEX_COLOUR|FBO_RB_DEPTH, shaderstate.tex_normals, r_nulltex, vid.pixelwidth, vid.pixelheight); oldfbo = GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_normals, 1, r_nulltex, vid.pixelwidth, vid.pixelheight);
GL_ForceDepthWritable(); GL_ForceDepthWritable();
//FIXME: should probably clear colour buffer too. //FIXME: should probably clear colour buffer too.
qglClear(GL_DEPTH_BUFFER_BIT); qglClear(GL_DEPTH_BUFFER_BIT);
@ -4873,7 +4875,7 @@ void GLBE_DrawLightPrePass(qbyte *vis)
/*reconfigure - now drawing diffuse light info using the previous fb image as a source image*/ /*reconfigure - now drawing diffuse light info using the previous fb image as a source image*/
GLBE_FBO_Sources(shaderstate.tex_normals, r_nulltex); GLBE_FBO_Sources(shaderstate.tex_normals, r_nulltex);
GLBE_FBO_Update(&shaderstate.fbo_lprepass, true, FBO_TEX_COLOUR|FBO_RB_DEPTH, shaderstate.tex_diffuse, r_nulltex, vid.pixelwidth, vid.pixelheight); GLBE_FBO_Update(&shaderstate.fbo_lprepass, FBO_RB_DEPTH, &shaderstate.tex_diffuse, 1, r_nulltex, vid.pixelwidth, vid.pixelheight);
BE_SelectMode(BEM_STANDARD); BE_SelectMode(BEM_STANDARD);
qglClearColor (0,0,0,1); qglClearColor (0,0,0,1);

View file

@ -215,7 +215,7 @@ void R_BloomBlend (void)
if (i == 0) if (i == 0)
{ {
/*filter the screen into a downscaled image*/ /*filter the screen into a downscaled image*/
oldfbo = GLBE_FBO_Update(&fbo_bloom, true, FBO_TEX_COLOUR, pingtex[0][0], r_nulltex, 0, 0); oldfbo = GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][0], 1, r_nulltex, 0, 0);
GLBE_FBO_Sources(scrtex, r_nulltex); GLBE_FBO_Sources(scrtex, r_nulltex);
qglViewport (0, 0, texwidth[0], texheight[0]); qglViewport (0, 0, texwidth[0], texheight[0]);
R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomfilter); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomfilter);
@ -223,7 +223,7 @@ void R_BloomBlend (void)
else else
{ {
/*simple downscale that multiple times*/ /*simple downscale that multiple times*/
GLBE_FBO_Update(&fbo_bloom, true, FBO_TEX_COLOUR, pingtex[0][i], r_nulltex, 0, 0); GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0);
GLBE_FBO_Sources(pingtex[0][i-1], r_nulltex); GLBE_FBO_Sources(pingtex[0][i-1], r_nulltex);
qglViewport (0, 0, texwidth[i], texheight[i]); qglViewport (0, 0, texwidth[i], texheight[i]);
R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomrescale); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomrescale);
@ -237,14 +237,14 @@ void R_BloomBlend (void)
*/ */
r_worldentity.glowmod[0] = 1.2 / texwidth[i]; r_worldentity.glowmod[0] = 1.2 / texwidth[i];
r_worldentity.glowmod[1] = 0; r_worldentity.glowmod[1] = 0;
GLBE_FBO_Update(&fbo_bloom, true, FBO_TEX_COLOUR, pingtex[1][i], r_nulltex, 0, 0); GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[1][i], 1, r_nulltex, 0, 0);
GLBE_FBO_Sources(pingtex[0][i], r_nulltex); GLBE_FBO_Sources(pingtex[0][i], r_nulltex);
qglViewport (0, 0, texwidth[i], texheight[i]); qglViewport (0, 0, texwidth[i], texheight[i]);
R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomblur); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomblur);
r_worldentity.glowmod[0] = 0; r_worldentity.glowmod[0] = 0;
r_worldentity.glowmod[1] = 1.2 / texheight[i]; r_worldentity.glowmod[1] = 1.2 / texheight[i];
GLBE_FBO_Update(&fbo_bloom, true, FBO_TEX_COLOUR, pingtex[0][i], r_nulltex, 0, 0); GLBE_FBO_Update(&fbo_bloom, 0, &pingtex[0][i], 1, r_nulltex, 0, 0);
GLBE_FBO_Sources(pingtex[1][i], r_nulltex); GLBE_FBO_Sources(pingtex[1][i], r_nulltex);
qglViewport (0, 0, texwidth[i], texheight[i]); qglViewport (0, 0, texwidth[i], texheight[i]);
R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomblur); R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, bloomblur);

View file

@ -321,8 +321,8 @@ void R_RenderDlights (void)
if (l->key == -(r_refdef.playerview->viewentity)) if (l->key == -(r_refdef.playerview->viewentity))
continue; //was a muzzleflash continue; //was a muzzleflash
coronastyle = (l->flags & (LFLAG_NORMALMODE|LFLAG_REALTIMEMODE)); coronastyle = (l->flags & (LFLAG_NORMALMODE|LFLAG_REALTIMEMODE)) && r_coronas.value;
flashstyle = ((l->flags & LFLAG_FLASHBLEND) && r_flashblend.ival); flashstyle = ((l->flags & LFLAG_FLASHBLEND) && r_flashblend.value);
if (!coronastyle && !flashstyle) if (!coronastyle && !flashstyle)
continue; continue;

View file

@ -1268,11 +1268,11 @@ void GLR_SetupFog (void)
static void R_RenderMotionBlur(void) static void R_RenderMotionBlur(void)
{ {
#if !defined(ANDROID) && !defined(NACL)
int vwidth = 1, vheight = 1; int vwidth = 1, vheight = 1;
float vs, vt, cs, ct; float vs, vt, cs, ct;
shader_t *shader; shader_t *shader;
#if !defined(ANDROID) && !defined(NACL)
//figure out the size of our texture. //figure out the size of our texture.
if (r_config.texture_non_power_of_two) if (r_config.texture_non_power_of_two)
{ //we can use any size, supposedly { //we can use any size, supposedly
@ -1534,7 +1534,11 @@ void GLR_RenderView (void)
for (mrt = 0; mrt < R_MAX_RENDERTARGETS; mrt++) for (mrt = 0; mrt < R_MAX_RENDERTARGETS; mrt++)
{ {
if (*r_refdef.rt_destcolour[mrt].texname) if (*r_refdef.rt_destcolour[mrt].texname)
{
col[mrt] = R2D_RT_GetTexture(r_refdef.rt_destcolour[mrt].texname, &cw, &ch); col[mrt] = R2D_RT_GetTexture(r_refdef.rt_destcolour[mrt].texname, &cw, &ch);
if (!TEXVALID(col[mrt]))
break;
}
else else
{ {
col[mrt] = r_nulltex; col[mrt] = r_nulltex;
@ -1559,13 +1563,11 @@ void GLR_RenderView (void)
vid.fbvwidth = vid.fbpwidth = dw; vid.fbvwidth = vid.fbpwidth = dw;
vid.fbvheight = vid.fbpheight = dh; vid.fbvheight = vid.fbpheight = dh;
} }
if (TEXVALID(col[0]))
flags |= FBO_TEX_COLOUR;
if (TEXVALID(depth)) if (TEXVALID(depth))
flags |= FBO_TEX_DEPTH; flags |= FBO_TEX_DEPTH;
else else
flags |= FBO_RB_DEPTH; flags |= FBO_RB_DEPTH;
GLBE_FBO_Update(&fbo_gameview, true, flags, col[0], depth, vid.fbpwidth, vid.fbpheight); GLBE_FBO_Update(&fbo_gameview, flags, col, mrt, depth, vid.fbpwidth, vid.fbpheight);
} }
else else
{ {

View file

@ -878,7 +878,6 @@ static void Shader_EntityMergable ( shader_t *shader, shaderpass_t *pass, char *
shader->flags |= SHADER_ENTITY_MERGABLE; shader->flags |= SHADER_ENTITY_MERGABLE;
} }
static void Shader_ProgAutoFields(program_t *prog, char **cvarnames, int *cvartypes);
/*program text is already loaded, this function parses the 'header' of it to see which permutations it provides, and how many times we need to recompile it*/ /*program text is already loaded, this function parses the 'header' of it to see which permutations it provides, and how many times we need to recompile it*/
static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *script, int qrtype, int ver, char *blobfilename) static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *script, int qrtype, int ver, char *blobfilename)
{ {
@ -895,7 +894,7 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
NULL NULL
}; };
#define MAXMODIFIERS 64 #define MAXMODIFIERS 64
char *permutationdefines[sizeof(permutationname)/sizeof(permutationname[0]) + MAXMODIFIERS + 1]; const char *permutationdefines[sizeof(permutationname)/sizeof(permutationname[0]) + MAXMODIFIERS + 1];
unsigned int nopermutation = ~0u; unsigned int nopermutation = ~0u;
int nummodifiers = 0; int nummodifiers = 0;
int p, n, pn; int p, n, pn;
@ -1088,22 +1087,22 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
} }
for (end = strchr(name, '#'); end && *end; ) for (end = strchr(name, '#'); end && *end; )
{ {
char *start = end+1; char *start = end+1, *d;
end = strchr(start, '#'); end = strchr(start, '#');
if (!end) if (!end)
end = start + strlen(start); end = start + strlen(start);
if (nummodifiers < MAXMODIFIERS) if (nummodifiers < MAXMODIFIERS)
{ {
permutationdefines[nummodifiers] = BZ_Malloc(10 + end - start); permutationdefines[nummodifiers] = d = BZ_Malloc(10 + end - start);
memcpy(permutationdefines[nummodifiers], "#define ", 8); memcpy(d, "#define ", 8);
memcpy(permutationdefines[nummodifiers]+8, start, end - start); memcpy(d+8, start, end - start);
memcpy(permutationdefines[nummodifiers]+8+(end-start), "\n", 2); memcpy(d+8+(end-start), "\n", 2);
start = strchr(permutationdefines[nummodifiers]+8, '='); start = strchr(d+8, '=');
if (start) if (start)
*start = ' '; *start = ' ';
for (start = permutationdefines[nummodifiers]+8; *start; start++) for (start = d+8; *start; start++)
*start = toupper(*start); *start = toupper(*start);
nummodifiers++; nummodifiers++;
permutationdefines[nummodifiers] = NULL; permutationdefines[nummodifiers] = NULL;
@ -1114,7 +1113,8 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
{ {
unsigned int next; unsigned int next;
unsigned int argsz; unsigned int argsz;
char *args, *mp, *mv; char *args, *mp;
const char *mv;
int ml, mi; int ml, mi;
unsigned int bloblink = 4; unsigned int bloblink = 4;
@ -1235,7 +1235,7 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
} }
} }
while(nummodifiers) while(nummodifiers)
Z_Free(permutationdefines[--nummodifiers]); Z_Free((char*)permutationdefines[--nummodifiers]);
if (sh_config.pProgAutoFields) if (sh_config.pProgAutoFields)
sh_config.pProgAutoFields(prog, cvarnames, cvartypes); sh_config.pProgAutoFields(prog, cvarnames, cvartypes);
@ -3418,12 +3418,12 @@ void Shader_Programify (shader_t *s)
{ {
char *prog = NULL; char *prog = NULL;
const char *mask; const char *mask;
enum /* enum
{ {
T_UNKNOWN, T_UNKNOWN,
T_WALL, T_WALL,
T_MODEL T_MODEL
} type = 0; } type = 0;*/
int i; int i;
shaderpass_t *pass, *lightmap = NULL, *modellighting = NULL; shaderpass_t *pass, *lightmap = NULL, *modellighting = NULL;
for (i = 0; i < s->numpasses; i++) for (i = 0; i < s->numpasses; i++)
@ -4177,13 +4177,14 @@ void Shader_DefaultSkybox(const char *shortname, shader_t *s, const void *args)
char *Shader_DefaultBSPWater(const char *shortname) char *Shader_DefaultBSPWater(const char *shortname)
{ {
int wstyle; int wstyle;
int islava = !strncmp(shortname, "*lava", 5);
if (r_wateralpha.value == 0) if (((islava && *r_lavaalpha.string)?r_lavaalpha.value:r_wateralpha.value) <= 0)
wstyle = -1; wstyle = -1;
else if (r_fastturb.ival) else if (r_fastturb.ival)
wstyle = 0; wstyle = 0;
#ifdef GLQUAKE #ifdef GLQUAKE
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && !strncmp(shortname, "*lava", 5) && *r_lavastyle.string) else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && islava && *r_lavastyle.string)
wstyle = r_lavastyle.ival; wstyle = r_lavastyle.ival;
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && !strncmp(shortname, "*slime", 5) && *r_slimestyle.string) else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && !strncmp(shortname, "*slime", 5) && *r_slimestyle.string)
wstyle = r_slimestyle.ival; wstyle = r_slimestyle.ival;
@ -4231,27 +4232,54 @@ char *Shader_DefaultBSPWater(const char *shortname)
); );
default: default:
case 1: //vanilla style case 1: //vanilla style
return ( if (islava && *r_lavaalpha.string)
"{\n" {
"program defaultwarp\n" return (
"{\n" "{\n"
"map $diffuse\n" "program defaultwarp\n"
"tcmod turb 0.02 0.1 0.5 0.1\n" "{\n"
"if !$#ALPHA\n" "map $diffuse\n"
"if r_wateralpha < 1\n" "tcmod turb 0.02 0.1 0.5 0.1\n"
"alphagen const $r_wateralpha\n" "if !$#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n" "if r_lavaalpha < 1\n"
"alphagen const $r_lavaalpha\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"else\n"
"if $#ALPHA < 1\n"
"alphagen const $#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"endif\n" "endif\n"
"else\n" "}\n"
"if $#ALPHA < 1\n" "surfaceparm nodlight\n"
"alphagen const $#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"endif\n"
"}\n" "}\n"
"surfaceparm nodlight\n" );
"}\n" }
); else
{
return (
"{\n"
"program defaultwarp\n"
"{\n"
"map $diffuse\n"
"tcmod turb 0.02 0.1 0.5 0.1\n"
"if !$#ALPHA\n"
"if r_wateralpha < 1\n"
"alphagen const $r_wateralpha\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"else\n"
"if $#ALPHA < 1\n"
"alphagen const $#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"endif\n"
"}\n"
"surfaceparm nodlight\n"
"}\n"
);
}
case 2: //refraction of the underwater surface, with a fresnel case 2: //refraction of the underwater surface, with a fresnel
return ( return (
"{\n" "{\n"
@ -4518,7 +4546,7 @@ void Shader_DefaultBSPQ1(const char *shortname, shader_t *s, const void *args)
Shader_DefaultBSPLM(shortname, s, args); Shader_DefaultBSPLM(shortname, s, args);
} }
void Shader_DefaultBSPVertex(char *shortname, shader_t *s, const void *args) void Shader_DefaultBSPVertex(const char *shortname, shader_t *s, const void *args)
{ {
shaderpass_t *pass; shaderpass_t *pass;
@ -4555,7 +4583,7 @@ void Shader_DefaultBSPVertex(char *shortname, shader_t *s, const void *args)
s->sort = SHADER_SORT_OPAQUE; s->sort = SHADER_SORT_OPAQUE;
s->uses = 1; s->uses = 1;
} }
void Shader_DefaultBSPFlare(char *shortname, shader_t *s, const void *args) void Shader_DefaultBSPFlare(const char *shortname, shader_t *s, const void *args)
{ {
shaderpass_t *pass; shaderpass_t *pass;
if (Shader_ParseShader("defaultflare", s)) if (Shader_ParseShader("defaultflare", s))
@ -4586,7 +4614,7 @@ void Shader_DefaultBSPFlare(char *shortname, shader_t *s, const void *args)
s->flags |= SHADER_NODRAW; s->flags |= SHADER_NODRAW;
} }
void Shader_DefaultSkin(char *shortname, shader_t *s, const void *args) void Shader_DefaultSkin(const char *shortname, shader_t *s, const void *args)
{ {
if (Shader_ParseShader("defaultskin", s)) if (Shader_ParseShader("defaultskin", s))
return; return;
@ -4657,7 +4685,7 @@ void Shader_DefaultSkinShell(const char *shortname, shader_t *s, const void *arg
"}\n" "}\n"
); );
} }
void Shader_Default2D(char *shortname, shader_t *s, const void *genargs) void Shader_Default2D(const char *shortname, shader_t *s, const void *genargs)
{ {
if (Shader_ParseShader("default2d", s)) if (Shader_ParseShader("default2d", s))
return; return;

View file

@ -578,6 +578,9 @@ static struct {
int prev; int prev;
} edge[MAX_MAP_EDGES]; } edge[MAX_MAP_EDGES];
static int firstedge; static int firstedge;
//} *edge;
//static int firstedge;
//static int maxedge;
static void SHM_RecursiveWorldNodeQ1_r (dlight_t *dl, mnode_t *node) static void SHM_RecursiveWorldNodeQ1_r (dlight_t *dl, mnode_t *node)
{ {
@ -1404,6 +1407,11 @@ static struct shadowmesh_s *SHM_BuildShadowMesh(dlight_t *dl, unsigned char *lvi
} }
firstedge=0; firstedge=0;
// if (maxedge < cl.worldmodel->numedges)
// {
// maxedge = cl.worldmodel->numedges;
// edge = realloc(edge, sizeof(*edge) * maxedge);
// }
if (cl.worldmodel->type == mod_brush) if (cl.worldmodel->type == mod_brush)
{ {
@ -3192,7 +3200,7 @@ void Sh_DrawCrepuscularLight(dlight_t *dl, float *colours)
BE_Scissor(NULL); BE_Scissor(NULL);
oldfbo = GLBE_FBO_Update(&crepuscular_fbo, true, FBO_TEX_COLOUR, crepuscular_texture_id, r_nulltex, vid.pixelwidth, vid.pixelheight); oldfbo = GLBE_FBO_Update(&crepuscular_fbo, 0, &crepuscular_texture_id, 1, r_nulltex, vid.pixelwidth, vid.pixelheight);
BE_SelectMode(BEM_CREPUSCULAR); BE_SelectMode(BEM_CREPUSCULAR);
BE_SelectDLight(dl, colours, LSHADER_STANDARD); BE_SelectDLight(dl, colours, LSHADER_STANDARD);

View file

@ -1639,7 +1639,7 @@ GLhandleARB GLSlang_CreateProgram(const char *name, int ver, const char **precom
GLhandleARB handle; GLhandleARB handle;
GLhandleARB vs; GLhandleARB vs;
GLhandleARB fs; GLhandleARB fs;
char *nullconstants = NULL; const char *nullconstants = NULL;
if (!gl_config.arb_shader_objects) if (!gl_config.arb_shader_objects)
return 0; return 0;
@ -2044,7 +2044,10 @@ void GL_Init(void *(*getglfunction) (char *name))
if (qglDebugMessageControlARB) if (qglDebugMessageControlARB)
qglDebugMessageControlARB(0, 0, 0, 0, NULL, true); qglDebugMessageControlARB(0, 0, 0, 0, NULL, true);
if (qglDebugMessageCallbackARB) if (qglDebugMessageCallbackARB)
{
qglDebugMessageCallbackARB(myGLDEBUGPROCAMD, NULL); qglDebugMessageCallbackARB(myGLDEBUGPROCAMD, NULL);
qglEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
}
qglGetError(); /*suck up the invalid operation error for non-debug contexts*/ qglGetError(); /*suck up the invalid operation error for non-debug contexts*/
#endif #endif

View file

@ -601,6 +601,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"gl_Position = skeletaltransform_n(n);\n" "gl_Position = skeletaltransform_n(n);\n"
"#endif\n" "#endif\n"
"float d = dot(n,e_light_dir);\n"
"if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.\n"
"d = 0.0; //this avoids the dark side going below the ambient level.\n"
"light = e_light_ambient + (dot(n,e_light_dir)*e_light_mul);\n" "light = e_light_ambient + (dot(n,e_light_dir)*e_light_mul);\n"
"tc = v_texcoord;\n" "tc = v_texcoord;\n"
"}\n" "}\n"
@ -1605,7 +1608,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"nst = (1.0 + nst) / 2.0;\n" "nst = (1.0 + nst) / 2.0;\n"
"vec4 l = texture2D(s_t0, nst)*5.0;\n" "vec4 l = texture2D(s_t0, nst)*5.0;\n"
"vec4 c = texture2D(s_t1, tc);\n" "vec4 c = texture2D(s_t1, tc);\n"
"vec3 lmsamp = texture2D(s_t2, lm).rgb*lmscale;\n" "vec3 lmsamp = texture2D(s_t2, lm).rgb*e_lmscale;\n"
"vec3 diff = l.rgb;\n" "vec3 diff = l.rgb;\n"
"vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11)));\n" "vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11)));\n"
"vec3 spec = chrom * l.a;\n" "vec3 spec = chrom * l.a;\n"

View file

@ -29,7 +29,7 @@ lights are then added over the top based upon the diffusemap, bumpmap and specul
#ifndef SHADER_H #ifndef SHADER_H
#define SHADER_H #define SHADER_H
typedef void (shader_gen_t)(char *name, shader_t*, const void *args); typedef void (shader_gen_t)(const char *name, shader_t*, const void *args);
#define SHADER_TMU_MAX 16 #define SHADER_TMU_MAX 16
#define SHADER_PASS_MAX 8 #define SHADER_PASS_MAX 8
@ -608,11 +608,9 @@ typedef struct
texid_t colour; texid_t colour;
unsigned int enables; unsigned int enables;
} fbostate_t; } fbostate_t;
#define FBO_RB_COLOUR 1
#define FBO_RB_DEPTH 2 #define FBO_RB_DEPTH 2
#define FBO_RB_STENCIL 4 #define FBO_RB_STENCIL 4
#define FBO_RESET 8 //resize all renderbuffers / free any that are not active. implied if the sizes differ #define FBO_RESET 8 //resize all renderbuffers / free any that are not active. implied if the sizes differ
#define FBO_TEX_COLOUR 16 //internal
#define FBO_TEX_DEPTH 32 //internal #define FBO_TEX_DEPTH 32 //internal
#define FBO_TEX_STENCIL 64 //internal #define FBO_TEX_STENCIL 64 //internal
@ -667,7 +665,7 @@ void GLBE_FBO_Sources(texid_t sourcecolour, texid_t sourcedepth);
int GLBE_FBO_Push(fbostate_t *state); int GLBE_FBO_Push(fbostate_t *state);
void GLBE_FBO_Pop(int oldfbo); void GLBE_FBO_Pop(int oldfbo);
void GLBE_FBO_Destroy(fbostate_t *state); void GLBE_FBO_Destroy(fbostate_t *state);
int GLBE_FBO_Update(fbostate_t *state, qboolean bind, unsigned int enables, texid_t destcol, texid_t destdepth, int width, int height); int GLBE_FBO_Update(fbostate_t *state, unsigned int enables, texid_t *destcol, int colourbuffers, texid_t destdepth, int width, int height);
#endif #endif
#ifdef D3D9QUAKE #ifdef D3D9QUAKE
void D3D9BE_Init(void); void D3D9BE_Init(void);

View file

@ -10,7 +10,7 @@ extern PP_Instance pp_instance;
static PPB_Audio_Callback audio_callback; static PPB_Audio_Callback audio_callback;
extern int GetSoundtime(soundcardinfo_t *sc); extern int S_GetMixerTime(soundcardinfo_t *sc);
static void PPAPI_audio_callback(void *sample_buffer, uint32_t len, void *user_data) static void PPAPI_audio_callback(void *sample_buffer, uint32_t len, void *user_data)
{ {
@ -18,7 +18,7 @@ static void PPAPI_audio_callback(void *sample_buffer, uint32_t len, void *user_d
unsigned int framesz; unsigned int framesz;
if (sc) if (sc)
{ {
int curtime = GetSoundtime(sc); int curtime = S_GetMixerTime(sc);
framesz = sc->sn.numchannels * sc->sn.samplebits/8; framesz = sc->sn.numchannels * sc->sn.samplebits/8;
//might as well dump it directly... //might as well dump it directly...

View file

@ -895,7 +895,7 @@ char *PDECL PR_RemoveProgsString (pubprogfuncs_t *ppf, string_t str)
return NULL; return NULL;
} }
char *ASMCALL PR_StringToNative (pubprogfuncs_t *ppf, string_t str) const char *ASMCALL PR_StringToNative (pubprogfuncs_t *ppf, string_t str)
{ {
progfuncs_t *progfuncs = (progfuncs_t*)ppf; progfuncs_t *progfuncs = (progfuncs_t*)ppf;
if (((unsigned int)str & STRING_SPECMASK) == STRING_STATIC) if (((unsigned int)str & STRING_SPECMASK) == STRING_STATIC)

View file

@ -642,7 +642,7 @@ char *PDECL PR_UglyValueString (pubprogfuncs_t *ppf, etype_t type, eval_t *val)
{ {
char *outs = line; char *outs = line;
int outb = sizeof(line)-2; int outb = sizeof(line)-2;
char *ins = PR_StringToNative(&progfuncs->funcs, val->string); const char *ins = PR_StringToNative(&progfuncs->funcs, val->string);
//markup the output string. //markup the output string.
while(*ins && outb > 0) while(*ins && outb > 0)
{ {
@ -2226,7 +2226,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, float killonspawnfl
if (!resethunk) if (!resethunk)
{ {
char *eclassname; const char *eclassname;
func_t f; func_t f;
if (!CheckSpawn) if (!CheckSpawn)
CheckSpawn = PR_FindFunc(&progfuncs->funcs, "CheckSpawn", -2); CheckSpawn = PR_FindFunc(&progfuncs->funcs, "CheckSpawn", -2);
@ -2327,7 +2327,7 @@ char *PDECL PR_SaveEnt (pubprogfuncs_t *ppf, char *buf, int *size, int maxsize,
int *v; int *v;
unsigned int i;unsigned int j; unsigned int i;unsigned int j;
char *name, *mname; char *name, *mname;
char *classname = NULL; const char *classname = NULL;
int classnamelen = 0; int classnamelen = 0;
int type; int type;

View file

@ -262,7 +262,7 @@ static void PDECL PR_PrintRelevantLocals(progfuncs_t *progfuncs)
eval_t *ptr; eval_t *ptr;
fdef_t *fdef; fdef_t *fdef;
fdef_t *cnfd; fdef_t *cnfd;
char *classname; const char *classname;
if (!ent || !fld) if (!ent || !fld)
continue; continue;
//all this extra code to avoid printing dupes... //all this extra code to avoid printing dupes...
@ -1358,7 +1358,6 @@ PR_ExecuteProgram
*/ */
static void PR_ExecuteCode (progfuncs_t *progfuncs, int s) static void PR_ExecuteCode (progfuncs_t *progfuncs, int s)
{ {
int swtchtype = 0; //warning about not being initialized before use
int runaway; int runaway;
if (prinst.watch_ptr && prinst.watch_ptr->_int != prinst.watch_old._int) if (prinst.watch_ptr && prinst.watch_ptr->_int != prinst.watch_old._int)

View file

@ -461,6 +461,7 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *progfuncs, eval_t *eval, int type, con
QueryPerformanceFrequency(&li); QueryPerformanceFrequency(&li);
return li.QuadPart; return li.QuadPart;
} }
#define Sys_GetClock Sys_GetClock
#endif #endif
#if 0//!defined(Sys_GetClock) && defined(__unix__) #if 0//!defined(Sys_GetClock) && defined(__unix__)
@ -475,24 +476,16 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *progfuncs, eval_t *eval, int type, con
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &c); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &c);
return (c.tv_sec*1000000000ull) + c.tv_nsec; return (c.tv_sec*1000000000ull) + c.tv_nsec;
} }
static unsigned long long Sys_GetClockRate(void) #define Sys_GetClock Sys_GetClock
{ #define Sys_GetClockRate() 1000000000ull
return 1000000000ull;
}
#endif #endif
#endif #endif
#endif #endif
#if !defined(Sys_GetClock) && defined(__unix__) #if !defined(Sys_GetClock) && defined(__unix__)
#include <time.h> #include <time.h>
static unsigned long long Sys_GetClock(void) #define Sys_GetClock() clock()
{ #define Sys_GetClockRate() CLOCKS_PER_SEC
return clock();
}
static unsigned long long Sys_GetClockRate(void)
{
return CLOCKS_PER_SEC;
}
#endif #endif
#ifndef Sys_GetClock #ifndef Sys_GetClock
@ -551,7 +544,7 @@ ddef32_t *ED_FindGlobal32 (progfuncs_t *progfuncs, char *name);
ddef32_t *ED_GlobalAtOfs32 (progfuncs_t *progfuncs, unsigned int ofs); ddef32_t *ED_GlobalAtOfs32 (progfuncs_t *progfuncs, unsigned int ofs);
string_t PDECL PR_StringToProgs (pubprogfuncs_t *inst, const char *str); string_t PDECL PR_StringToProgs (pubprogfuncs_t *inst, const char *str);
char *ASMCALL PR_StringToNative (pubprogfuncs_t *inst, string_t str); const char *ASMCALL PR_StringToNative (pubprogfuncs_t *inst, string_t str);
void PR_FreeTemps (progfuncs_t *progfuncs, int depth); void PR_FreeTemps (progfuncs_t *progfuncs, int depth);

View file

@ -100,7 +100,7 @@ struct pubprogfuncs_s
void (PDECL *ED_Print) (pubprogfuncs_t *prinst, struct edict_s *ed); void (PDECL *ED_Print) (pubprogfuncs_t *prinst, struct edict_s *ed);
char *(PDECL *save_ents) (pubprogfuncs_t *prinst, char *buf, int *size, int maxsize, int mode); //dump the entire progs info into one big self allocated string char *(PDECL *save_ents) (pubprogfuncs_t *prinst, char *buf, int *size, int maxsize, int mode); //dump the entire progs info into one big self allocated string
int (PDECL *load_ents) (pubprogfuncs_t *prinst, char *s, float killonspawnflags); //restore the entire progs state (or just add some more ents) (returns edicts ize) int (PDECL *load_ents) (pubprogfuncs_t *prinst, const char *s, float killonspawnflags); //restore the entire progs state (or just add some more ents) (returns edicts ize)
char *(PDECL *saveent) (pubprogfuncs_t *prinst, char *buf, int *size, int maxsize, struct edict_s *ed); //will save just one entities vars char *(PDECL *saveent) (pubprogfuncs_t *prinst, char *buf, int *size, int maxsize, struct edict_s *ed); //will save just one entities vars
struct edict_s *(PDECL *restoreent) (pubprogfuncs_t *prinst, const char *buf, int *size, struct edict_s *ed); //will restore the entity that had it's values saved (can use NULL for ed) struct edict_s *(PDECL *restoreent) (pubprogfuncs_t *prinst, const char *buf, int *size, struct edict_s *ed); //will restore the entity that had it's values saved (can use NULL for ed)

View file

@ -7467,7 +7467,7 @@ void QCC_PR_ParseStatement (void)
int old_numstatements; int old_numstatements;
int numtemp, i; int numtemp, i;
QCC_statement_t temp[32]; QCC_statement_t temp[256];
continues = num_continues; continues = num_continues;
breaks = num_breaks; breaks = num_breaks;

View file

@ -339,7 +339,7 @@ typedef enum {
static char *q1qvmentstring; static const char *q1qvmentstring;
static vm_t *q1qvm; static vm_t *q1qvm;
static pubprogfuncs_t q1qvmprogfuncs; static pubprogfuncs_t q1qvmprogfuncs;
static edict_t *q1qvmedicts[MAX_Q1QVM_EDICTS]; static edict_t *q1qvmedicts[MAX_Q1QVM_EDICTS];
@ -465,7 +465,7 @@ static edict_t *QDECL Q1QVMPF_EntAlloc(pubprogfuncs_t *pf)
return (struct edict_s *)e; return (struct edict_s *)e;
} }
static int QDECL Q1QVMPF_LoadEnts(pubprogfuncs_t *pf, char *mapstring, float spawnflags) static int QDECL Q1QVMPF_LoadEnts(pubprogfuncs_t *pf, const char *mapstring, float spawnflags)
{ {
q1qvmentstring = mapstring; q1qvmentstring = mapstring;
VM_Call(q1qvm, GAME_LOADENTS); VM_Call(q1qvm, GAME_LOADENTS);
@ -500,7 +500,7 @@ static string_t QDECL Q1QVMPF_StringToProgs(pubprogfuncs_t *prinst, const char *
return ret; return ret;
} }
static char *ASMCALL QDECL Q1QVMPF_StringToNative(pubprogfuncs_t *prinst, string_t str) static const char *ASMCALL QDECL Q1QVMPF_StringToNative(pubprogfuncs_t *prinst, string_t str)
{ {
char *ret = (char*)VM_MemoryBase(q1qvm) + str; char *ret = (char*)VM_MemoryBase(q1qvm) + str;
if (!ret) //qvms can never return a null. make sure native code can't crash things either. if (!ret) //qvms can never return a null. make sure native code can't crash things either.
@ -1534,7 +1534,7 @@ void Q1QVM_ClientConnect(client_t *cl)
if (cl->edict->v->netname) if (cl->edict->v->netname)
{ {
strcpy(cl->namebuf, cl->name); strcpy(cl->namebuf, cl->name);
cl->name = Q1QVMPF_StringToNative(svprogfuncs, cl->edict->v->netname); cl->name = (char*)Q1QVMPF_StringToNative(svprogfuncs, cl->edict->v->netname);
//FIXME: check this pointer //FIXME: check this pointer
strcpy(cl->name, cl->namebuf); strcpy(cl->name, cl->namebuf);
} }

View file

@ -1158,6 +1158,11 @@ void SV_Loadgame_f (void)
SV_Loadgame_Legacy(filename, f, version); SV_Loadgame_Legacy(filename, f, version);
return; return;
} }
#ifndef SERVERONLY
if (cls.state)
CL_Disconnect_f();
#endif
gametype = version - FTESAVEGAME_VERSION; gametype = version - FTESAVEGAME_VERSION;
VFS_GETS(f, str, sizeof(str)-1); VFS_GETS(f, str, sizeof(str)-1);
#ifndef SERVERONLY #ifndef SERVERONLY

View file

@ -1090,13 +1090,12 @@ static void SV_FilterIP_f (void)
{ {
bannedips_t proto; bannedips_t proto;
extern cvar_t filterban; extern cvar_t filterban;
int arg=2;
char *s; char *s;
if (Cmd_Argc() < 2) if (Cmd_Argc() < 2)
{ {
Con_Printf("%s <address/mask|adress/maskbits> [flags] [+time] [reason]\n", Cmd_Argv(0)); Con_Printf("%s <address/mask|adress/maskbits> [flags] [+time] [reason]\n", Cmd_Argv(0));
Con_Printf("allowed flags: ban,safe,cuff,mute,cripple,deaf,lag,blind,spec. time is in seconds (omitting the plus will be taken to mean unix time).\n", Cmd_Argv(0)); Con_Printf("allowed flags: ban,safe,cuff,mute,cripple,deaf,lag,blind,spec. time is in seconds (omitting the plus will be taken to mean unix time).\n");
return; return;
} }
@ -1178,7 +1177,7 @@ static void SV_BanList_f (void)
{ {
*middlebit = 0; *middlebit = 0;
if (nb->expiretime) if (nb->expiretime)
Q_strncatz(middlebit, va(",\t%+llu", (unsigned long long)nb->expiretime - bantime), sizeof(middlebit)); Q_strncatz(middlebit, va(",\t+%llu", (unsigned long long)nb->expiretime - bantime), sizeof(middlebit));
if (nb->reason[0]) if (nb->reason[0])
Q_strncatz(middlebit, ",\t", sizeof(middlebit)); Q_strncatz(middlebit, ",\t", sizeof(middlebit));
Con_Printf("%s%s%s\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), middlebit, nb->reason); Con_Printf("%s%s%s\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), middlebit, nb->reason);
@ -1334,7 +1333,7 @@ static void SV_Unfilter_f (void)
} }
static void SV_PenaltyToggle (unsigned int banflag, char *penaltyname) static void SV_PenaltyToggle (unsigned int banflag, char *penaltyname)
{ {
char *name = Cmd_Argv(1); char *clname = Cmd_Argv(1);
char *duration = Cmd_Argv(2); char *duration = Cmd_Argv(2);
char *reason = Cmd_Argv(3); char *reason = Cmd_Argv(3);
bannedips_t proto; bannedips_t proto;
@ -1356,7 +1355,7 @@ static void SV_PenaltyToggle (unsigned int banflag, char *penaltyname)
reason = duration; reason = duration;
memset(&proto.adrmask.address, 0xff, sizeof(proto.adrmask.address)); memset(&proto.adrmask.address, 0xff, sizeof(proto.adrmask.address));
while((cl = SV_GetClientForString(Cmd_Argv(1), &clnum))) while((cl = SV_GetClientForString(clname, &clnum)))
{ {
found = true; found = true;
proto.adr = cl->netchan.remote_address; proto.adr = cl->netchan.remote_address;

View file

@ -283,6 +283,7 @@ void SV_Shutdown (void)
IWebShutdown(); IWebShutdown();
#endif #endif
COM_BiDi_Shutdown();
Memory_DeInit(); Memory_DeInit();
} }

View file

@ -1157,10 +1157,15 @@ void SVQ1_StartSound (float *origin, wedict_t *wentity, int channel, const char
//be warned that it does mean you might be able to hear people triggering stuff on the other side of the map however. //be warned that it does mean you might be able to hear people triggering stuff on the other side of the map however.
channel |= 256; channel |= 256;
} }
else else if (progstype == PROG_QW)
{ { //quakeworld puts the sound ONLY at the entity's actual origin. this is annoying and stupid. I'm not really sure what to do here. it seems wrong.
VectorCopy (entity->v->origin, origin); VectorCopy (entity->v->origin, origin);
} }
else
{ //nq (and presumably h2) always put the sound in the middle of the ent's bbox. this is needed to avoid triggers breaking (like trigger_secret).
for (i=0 ; i<3 ; i++)
origin[i] = entity->v->origin[i]+0.5*(entity->v->mins[i]+entity->v->maxs[i]);
}
} }
SV_StartSound(NUM_FOR_EDICT(svprogfuncs, entity), origin, entity->xv->dimension_seen, channel, sample, volume, attenuation, pitchadj); SV_StartSound(NUM_FOR_EDICT(svprogfuncs, entity), origin, entity->xv->dimension_seen, channel, sample, volume, attenuation, pitchadj);

View file

@ -941,7 +941,7 @@ void SV_SendClientPrespawnInfo(client_t *client)
ClientReliableWrite_Byte (client, track); ClientReliableWrite_Byte (client, track);
if (!track && *sv.h2miditrack) if (!track && *sv.h2miditrack)
SV_StuffcmdToClient(client, va("cd loop \"%s\"\n")); SV_StuffcmdToClient(client, va("cd loop \"%s\"\n", sv.h2miditrack));
} }
else if (client->prespawn_idx == 2) else if (client->prespawn_idx == 2)
{ {
@ -1999,7 +1999,7 @@ void SV_DarkPlacesDownloadAck(client_t *cl)
pos += csize; pos += csize;
} }
s = va("\ncl_downloadfinished %i %i \"\"\n", host_client->downloadsize, crc); s = va("\ncl_downloadfinished %u %i \"\"\n", (unsigned int)host_client->downloadsize, crc);
ClientReliableWrite_Begin (cl, svc_stufftext, 2+strlen(s)); ClientReliableWrite_Begin (cl, svc_stufftext, 2+strlen(s));
ClientReliableWrite_String(cl, s); ClientReliableWrite_String(cl, s);

View file

@ -3140,7 +3140,7 @@ void SVQ3_ParseClientMessage(client_t *client)
// //
while(1) while(1)
{ {
if(client->state < ca_connected) if(client->state < cs_connected)
return; // parsed command caused client to disconnect return; // parsed command caused client to disconnect
if(msg_readcount > net_message.cursize) if(msg_readcount > net_message.cursize)

View file

@ -43,6 +43,9 @@ void main ()
gl_Position = skeletaltransform_n(n); gl_Position = skeletaltransform_n(n);
#endif #endif
float d = dot(n,e_light_dir);
if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.
d = 0.0; //this avoids the dark side going below the ambient level.
light = e_light_ambient + (dot(n,e_light_dir)*e_light_mul); light = e_light_ambient + (dot(n,e_light_dir)*e_light_mul);
tc = v_texcoord; tc = v_texcoord;
} }

View file

@ -25,7 +25,7 @@ void main ()
nst = (1.0 + nst) / 2.0; nst = (1.0 + nst) / 2.0;
vec4 l = texture2D(s_t0, nst)*5.0; vec4 l = texture2D(s_t0, nst)*5.0;
vec4 c = texture2D(s_t1, tc); vec4 c = texture2D(s_t1, tc);
vec3 lmsamp = texture2D(s_t2, lm).rgb*lmscale; vec3 lmsamp = texture2D(s_t2, lm).rgb*e_lmscale;
vec3 diff = l.rgb; vec3 diff = l.rgb;
vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11))); vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11)));
vec3 spec = chrom * l.a; vec3 spec = chrom * l.a;