1
0
Fork 0
forked from fte/fteqw

gameclock, roq/avis can play on shaders (sound is wrong though, so that's fine with avis!), snprintf changes (this is the bulk), up2's mcharset

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2054 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-03-06 01:41:09 +00:00
parent 789c9b0ee6
commit 2046931e26
64 changed files with 1582 additions and 653 deletions

View file

@ -563,7 +563,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
if (!mod)
mod = cl.worldmodel;
if (mod)
pc = CM_PointContents(mod, VM_POINTER(arg[0]));
pc = cl.worldmodel->funcs.NativeContents(mod, 0, 0, VM_POINTER(arg[0]), vec3_origin, vec3_origin);
else
pc = 1;//FTECONTENTS_SOLID;
VM_LONG(ret) = pc;//Contents_To_Q3(pc);
@ -601,7 +601,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
}
if (mod)
pc = CM_PointContents(mod, p_l);
pc = cl.worldmodel->funcs.NativeContents(mod, 0, 0, VM_POINTER(arg[0]), vec3_origin, vec3_origin);
else
pc = 1;//FTECONTENTS_SOLID;
}
@ -636,7 +636,7 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
if (!angles)
angles = vec3_origin;
if (mod)
tr = CM_TransformedBoxTrace(mod, start, end, mins, maxs, brushmask, origin, angles);
TransformedNativeTrace(mod, 0, 0, start, end, mins, maxs, brushmask, &tr, origin, angles);
else
{
memset(&tr, 0, sizeof(tr));
@ -674,7 +674,9 @@ static long CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const long
if (!maxs)
maxs = vec3_origin;
if (mod)
tr = CM_BoxTrace(mod, start, end, mins, maxs, brushmask);
{
mod->funcs.NativeTrace(mod, 0, 0, start, end, mins, maxs, brushmask, &tr);
}
else
{
memset(&tr, 0, sizeof(tr));

View file

@ -861,7 +861,7 @@ void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...)
return; //no point.
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
@ -1406,7 +1406,7 @@ static char *VARGS vahunk(char *format, ...)
char *ret;
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
ret = Hunk_Alloc(strlen(string)+1);

View file

@ -121,9 +121,9 @@ cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1");
cvar_t cl_item_bobbing = SCVAR("cl_model_bobbing", "0");
cvar_t requiredownloads = SCVARF("requiredownloads","1", CVAR_ARCHIVE);
cvar_t cl_standardchat = SCVAR("cl_standardchat", "0");
cvar_t cl_standardchat = SCVARF("cl_standardchat", "0", CVAR_ARCHIVE);
cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for mm2, 3 for both
cvar_t cl_standardmsg = SCVAR("cl_standardmsg", "0");
cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE);
cvar_t cl_parsewhitetext = SCVAR("cl_parsewhitetext", "0");
cvar_t host_mapname = SCVAR("host_mapname", "");
@ -1292,6 +1292,7 @@ void CL_CheckServerInfo(void)
{
char *s;
unsigned int allowed;
int oldstate;
cl.teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));
cl.deathmatch = atoi(Info_ValueForKey(cl.serverinfo, "deathmatch"));
@ -1410,6 +1411,18 @@ void CL_CheckServerInfo(void)
else
cls.allow_anyparticles = false;
s = Info_ValueForKey(cl.serverinfo, "status");
oldstate = cl.ktprostate;
if (!stricmp(s, "standby"))
cl.ktprostate = KTPRO_STANDBY;
else if (!stricmp(s, "countdown"))
cl.ktprostate = KTPRO_COUNTDOWN;
else
cl.ktprostate = KTPRO_DONTKNOW;
if (oldstate != cl.ktprostate)
cl.ktprogametime = 0;
Cvar_ForceCheatVars(cls.allow_semicheats, cls.allow_cheats);
}
@ -1726,7 +1739,7 @@ void CL_Startdemos_f (void)
#ifndef CLIENTONLY
!sv.state &&
#endif
cls.demonum != -1 && cls.demoplayback==DPB_NONE && !media_filmtype && COM_CheckParm("-demos"))
cls.demonum != -1 && cls.demoplayback==DPB_NONE && !Media_PlayingFullScreen() && COM_CheckParm("-demos"))
{
cls.demonum = 0;
CL_NextDemo ();
@ -2748,7 +2761,7 @@ void VARGS Host_EndGame (char *message, ...)
SCR_EndLoadingPlaque();
va_start (argptr,message);
_vsnprintf (string,sizeof(string)-1, message,argptr);
vsnprintf (string,sizeof(string)-1, message,argptr);
va_end (argptr);
Con_TPrintf (TL_NL);
Con_TPrintf (TL_LINEBREAK_EQUALS);
@ -2785,7 +2798,7 @@ void VARGS Host_Error (char *error, ...)
inerror = true;
va_start (argptr,error);
_vsnprintf (string,sizeof(string)-1, error,argptr);
vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
Con_TPrintf (TLC_HOSTFATALERROR, string);
@ -2966,6 +2979,10 @@ void Host_Frame (double time)
}
host_frametime = (realtime - oldrealtime)*cl.gamespeed;
if (!cl.paused)
{
cl.ktprogametime += host_frametime;
}
oldrealtime = realtime;
CL_ProgressDemoTime();
@ -3311,7 +3328,7 @@ void Host_Init (quakeparms_t *parms)
#endif
#ifndef NOMEDIA
if (!cls.demofile && !cls.state && !media_filmtype)
if (!cls.demofile && !cls.state && !Media_PlayingFullScreen())
{
int ol_depth;
int idcin_depth;

View file

@ -3001,7 +3001,7 @@ void CLQ2_ParseMuzzleFlash (void)
break;
case Q2MZ_MACHINEGUN:
dl->color[0] = 0.2;dl->color[1] = 0.2;dl->color[2] = 0;
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0);
break;
@ -3017,27 +3017,27 @@ void CLQ2_ParseMuzzleFlash (void)
case Q2MZ_CHAINGUN1:
dl->radius = 200 + (rand()&31);
dl->color[0] = 0.2;dl->color[1] = 0.05;dl->color[2] = 0;
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0);
break;
case Q2MZ_CHAINGUN2:
dl->radius = 225 + (rand()&31);
dl->color[0] = 0.2;dl->color[1] = 0.1;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0);
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0.05);
break;
case Q2MZ_CHAINGUN3:
dl->radius = 250 + (rand()&31);
dl->color[0] = 0.2;dl->color[1] = 0.2;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0);
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0.033);
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0.066);
break;

View file

@ -137,12 +137,15 @@ float oldsbar = 0;
void SCR_ScreenShot_f (void);
void SCR_RSShot_f (void);
cvar_t show_fps = SCVAR("show_fps", "0");
cvar_t show_fps = SCVARF("show_fps", "0", CVAR_ARCHIVE);
cvar_t show_fps_x = SCVAR("show_fps_x", "-1");
cvar_t show_fps_y = SCVAR("show_fps_y", "-1");
cvar_t show_clock = SCVAR("cl_clock", "0");
cvar_t show_clock_x = SCVAR("cl_clock_x", "0");
cvar_t show_clock_y = SCVAR("cl_clock_y", "-1");
cvar_t show_gameclock = SCVAR("cl_gameclock", "0");
cvar_t show_gameclock_x = SCVAR("cl_gameclock_x", "0");
cvar_t show_gameclock_y = SCVAR("cl_gameclock_y", "-1");
cvar_t show_speed = SCVAR("show_speed", "0");
cvar_t show_speed_x = SCVAR("show_speed_x", "-1");
cvar_t show_speed_y = SCVAR("show_speed_y", "-9");
@ -156,6 +159,9 @@ void CLSCR_Init(void)
Cvar_Register(&show_clock, cl_screengroup);
Cvar_Register(&show_clock_x, cl_screengroup);
Cvar_Register(&show_clock_y, cl_screengroup);
Cvar_Register(&show_gameclock, cl_screengroup);
Cvar_Register(&show_gameclock_x, cl_screengroup);
Cvar_Register(&show_gameclock_y, cl_screengroup);
Cvar_Register(&show_speed, cl_screengroup);
Cvar_Register(&show_speed_x, cl_screengroup);
Cvar_Register(&show_speed_y, cl_screengroup);
@ -1156,6 +1162,43 @@ void SCR_DrawClock(void)
SCR_StringXY(str, show_clock_x.value, show_clock_y.value);
}
void SCR_DrawGameClock(void)
{
float showtime;
int minuites;
int seconds;
char str[16];
int flags;
float timelimit;
if (!show_gameclock.value)
return;
flags = (show_gameclock.value-1);
if (flags & 1)
timelimit = 60 * atof(Info_ValueForKey(cl.serverinfo, "timelimit"));
else
timelimit = 0;
showtime = timelimit - cl.ktprogametime;
if (showtime < 0)
{
showtime *= -1;
minuites = showtime/60;
seconds = (int)showtime - (minuites*60);
minuites *= -1;
}
else
{
minuites = showtime/60;
seconds = (int)showtime - (minuites*60);
}
sprintf(str, " %02i:%02i", minuites, seconds);
SCR_StringXY(str, show_gameclock_x.value, show_gameclock_y.value);
}
/*
==============
@ -1344,7 +1387,7 @@ void SCR_SetUpToDrawConsole (void)
return; // never a console with loading plaque
// decide on the height of the console
if (cls.state != ca_active && !media_filmtype
if (cls.state != ca_active && !Media_PlayingFullScreen()
#ifdef TEXTEDITOR
&& !editoractive
#endif
@ -1387,7 +1430,7 @@ void SCR_SetUpToDrawConsole (void)
if (clearconsole++ < vid.numpages)
{
if (qrenderer == QR_SOFTWARE && !media_filmtype)
if (qrenderer == QR_SOFTWARE && !Media_PlayingFullScreen())
{
scr_copytop = 1;
Draw_TileClear (0, (int) scr_con_current, vid.width, vid.height - (int) scr_con_current);
@ -1397,7 +1440,7 @@ void SCR_SetUpToDrawConsole (void)
}
else if (clearnotify++ < vid.numpages)
{
if (qrenderer == QR_SOFTWARE && !media_filmtype)
if (qrenderer == QR_SOFTWARE && !Media_PlayingFullScreen())
{
scr_copytop = 1;
Draw_TileClear (0, 0, vid.width, con_notifylines);
@ -2025,6 +2068,7 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
SCR_DrawFPS ();
SCR_DrawUPS ();
SCR_DrawClock();
SCR_DrawGameClock();
SCR_DrawTurtle ();
SCR_DrawPause ();
#ifdef PLUGINS

View file

@ -445,7 +445,7 @@ int VMEnumMods(char *match, int size, void *args)
return true; //we only count directories with a pk3 file
Q_strncpyz(desc, match, sizeof(desc));
f = FS_OpenVFS(va("%s/%s/description.txt", ((vmsearch_t *)args)->dir, match), "rb", FS_BASE);
f = FS_OpenVFS(va("%s/description.txt", match), "rb", FS_BASE);
if (f)
{
VFS_GETS(f, desc, sizeof(desc));
@ -677,6 +677,8 @@ void VQ3_RenderView(const q3refdef_t *ref)
r_refdef.viewangles[2] = 0;
if (ref->rdflags & 1)
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
else
r_refdef.flags &= ~Q2RDF_NOWORLDMODEL;
r_refdef.fov_x = ref->fov_x;
r_refdef.fov_y = ref->fov_y;
r_refdef.vrect.x = ref->x;
@ -735,7 +737,7 @@ void UI_RegisterFont(char *fontName, int pointSize, fontInfo_t *font)
#define readInt() LittleLong(*in.i++)
#define readFloat() LittleFloat(*in.f++)
_snprintf(name, sizeof(name), "fonts/fontImage_%i.dat",pointSize);
snprintf(name, sizeof(name), "fonts/fontImage_%i.dat",pointSize);
in.c = COM_LoadTempFile(name);
if (com_filesize == sizeof(fontInfo_t))
@ -1426,6 +1428,18 @@ long UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const long *arg)
//fixme: memory protect.
return Script_Read(arg[0], VM_POINTER(arg[1]));
case UI_CIN_PLAYCINEMATIC:
//handle(name, x, y, w, h, looping)
case UI_CIN_STOPCINEMATIC:
//(handle)
case UI_CIN_RUNCINEMATIC:
//(handle)
case UI_CIN_DRAWCINEMATIC:
//(handle)
case UI_CIN_SETEXTENTS:
//(handle, x, y, w, h)
break;
default:
Con_Printf("Q3UI: Not implemented system trap: %d\n", fn);
return 0;

View file

@ -573,6 +573,13 @@ typedef struct
qboolean sendprespawn;
int contentstage;
float ktprogametime;
enum {
KTPRO_DONTKNOW,
KTPRO_COUNTDOWN,
KTPRO_STANDBY
} ktprostate;
} client_state_t;
extern int cl_teamtopcolor;
@ -1006,14 +1013,7 @@ void Editor_Init(void);
void CL_AddVWeapModel(entity_t *player, int model);
typedef enum {
MFT_NONE,
MFT_STATIC, //non-moving, PCX, no sound
MFT_ROQ,
MFT_AVI,
MFT_CIN
} media_filmtype_t;
extern media_filmtype_t media_filmtype;
qboolean Media_PlayingFullScreen(void);
void Media_Init(void);
qboolean Media_PlayFilm(char *name);
void CIN_FinishCinematic (void);
@ -1021,6 +1021,11 @@ qboolean CIN_PlayCinematic (char *arg);
qboolean CIN_DrawCinematic (void);
qboolean CIN_RunCinematic (void);
typedef struct cin_s cin_t;
struct cin_s *Media_StartCin(char *name);
int Media_UpdateForShader(int texnum, cin_t *cin);
void Media_ShutdownCin(cin_t *cin);
void MVD_Interpolate(void);
void Stats_NewMap(void);

View file

@ -88,7 +88,7 @@ Called when either the cinematic completes, or it is aborted
*/
void CIN_FinishCinematic (void)
{
// tell the server to advance to the next map / cinematic
// tell the server to advance to the next map / cinematic (a q2 hack)
if (cls.state == ca_active)
{
CL_SendClientCommand(true, "nextserver %i", cl.servercount);
@ -489,8 +489,7 @@ qboolean CIN_PlayCinematic (char *arg)
if (!cin.cinematic_file)
{
_snprintf (name, sizeof(name), "video/%s", arg);
snprintf (name, sizeof(name), "video/%s", arg);
cin.cinematic_file = FS_OpenVFS(name, "rb", FS_GAME);
}

View file

@ -297,7 +297,7 @@ void CLQ2_RunMuzzleFlash2 (int ent, int flash_number)
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
P_RunParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin);
_snprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5);
snprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5);
Q2S_StartSound (NULL, ent, CHAN_WEAPON, S_PrecacheSound(soundname), 1, ATTN_NORM, 0);
break;

View file

@ -492,8 +492,8 @@ qboolean CLQ3_SystemInfoChanged(char *str)
Con_Printf("Sending request to download %s\n", com_token);
CLQ3_SendClientCommand("download %s.pk3", com_token);
ccs.downloadchunknum = 0;
_snprintf(cls.downloadname, sizeof(cls.downloadname), "%s.pk3", com_token);
_snprintf(cls.downloadtempname, sizeof(cls.downloadtempname), "%s.tmp", com_token);
snprintf(cls.downloadname, sizeof(cls.downloadname), "%s.pk3", com_token);
snprintf(cls.downloadtempname, sizeof(cls.downloadtempname), "%s.tmp", com_token);
cls.downloadmethod = DL_Q3;
cls.downloadpercent = 0;
return false;

View file

@ -361,7 +361,7 @@ void Con_ToggleConsole_f (void)
if (key_dest == key_console)
{
if (cls.state == ca_active || media_filmtype
if (cls.state == ca_active || Media_PlayingFullScreen()
#ifdef VM_UI
|| UI_MenuState()
#endif
@ -781,7 +781,7 @@ void VARGS Con_Printf (const char *fmt, ...)
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg), fmt,argptr);
va_end (argptr);
#ifndef CLIENTONLY
@ -835,7 +835,7 @@ void VARGS Con_SafePrintf (char *fmt, ...)
char msg[MAXPRINTMSG];
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
va_end (argptr);
// write it to the scrollable buffer
@ -849,7 +849,7 @@ void VARGS Con_TPrintf (translation_t text, ...)
char *fmt = languagetext[text][cls.language];
va_start (argptr,text);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg), fmt,argptr);
va_end (argptr);
// write it to the scrollable buffer
@ -863,7 +863,7 @@ void VARGS Con_SafeTPrintf (translation_t text, ...)
char *fmt = languagetext[text][cls.language];
va_start (argptr,text);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg), fmt,argptr);
va_end (argptr);
// write it to the scrollable buffer
@ -887,7 +887,7 @@ void VARGS Con_DPrintf (char *fmt, ...)
return; // early exit
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
va_end (argptr);
if (!developer.value)

View file

@ -687,7 +687,7 @@ int Image_WritePNG (char *filename, int compression, qbyte *pixels, int width, i
png_structp png_ptr;
png_infop info_ptr;
png_byte **row_pointers;
_snprintf (name, sizeof(name)-1, "%s/%s", com_gamedir, filename);
snprintf (name, sizeof(name)-1, "%s/%s", com_gamedir, filename);
if (!(fp = fopen (name, "wb"))) {
COM_CreatePath (name);
@ -1923,7 +1923,7 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
return len;
if (subpath && *subpath)
{
_snprintf(fname, sizeof(fname)-1, "%s/%s", subpath, name);
snprintf(fname, sizeof(fname)-1, "%s/%s", subpath, name);
if ((len = GL_FindTexture(fname))!=-1) //don't bother if it already exists.
return len;
}
@ -1944,10 +1944,10 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
{
if (!subpath)
continue;
_snprintf(fname, sizeof(fname)-1, path[i]+1, subpath, /*COM_SkipPath*/(nicename), ".dds");
snprintf(fname, sizeof(fname)-1, path[i]+1, subpath, /*COM_SkipPath*/(nicename), ".dds");
}
else
_snprintf(fname, sizeof(fname)-1, path[i]+1, nicename, ".dds");
snprintf(fname, sizeof(fname)-1, path[i]+1, nicename, ".dds");
if ((buf = COM_LoadFile (fname, 5)))
{
len = GL_LoadTextureDDS(buf, com_filesize);
@ -1963,10 +1963,10 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
{
if (!subpath)
continue;
_snprintf(fname, sizeof(fname)-1, path[i]+1, subpath, /*COM_SkipPath*/(nicename), extensions[e]);
snprintf(fname, sizeof(fname)-1, path[i]+1, subpath, /*COM_SkipPath*/(nicename), extensions[e]);
}
else
_snprintf(fname, sizeof(fname)-1, path[i]+1, nicename, extensions[e]);
snprintf(fname, sizeof(fname)-1, path[i]+1, nicename, extensions[e]);
TRACE(("dbg: Mod_LoadHiResTexture: trying %s\n", fname));
if ((buf = COM_LoadFile (fname, 5)))
{
@ -1978,7 +1978,7 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
TRACE(("dbg: Mod_LoadHiResTexture: %s loaded\n", name));
if (i == 1)
{ //if it came from a special subpath (eg: map specific), upload it using the subpath prefix
_snprintf(fname, sizeof(fname)-1, "%s/%s", subpath, name);
snprintf(fname, sizeof(fname)-1, "%s/%s", subpath, name);
len = GL_LoadTexture32 (fname, image_width, image_height, (unsigned*)data, mipmap, alpha);
}
else
@ -2063,10 +2063,10 @@ int Mod_LoadBumpmapTexture(char *name, char *subpath)
else
#endif
COM_FileBase(cl.model_name[1], map);
_snprintf(fname, sizeof(fname)-1, path[i], map, nicename, extensions[e]);
snprintf(fname, sizeof(fname)-1, path[i], map, nicename, extensions[e]);
}
else
_snprintf(fname, sizeof(fname)-1, path[i], nicename, extensions[e]);
snprintf(fname, sizeof(fname)-1, path[i], nicename, extensions[e]);
TRACE(("dbg: Mod_LoadBumpmapTexture: opening %s\n", fname));

View file

@ -1446,7 +1446,7 @@ void Key_Event (int key, qboolean down)
break;
#endif
case key_game:
if (media_filmtype)
if (Media_PlayingFullScreen())
{
Media_PlayFilm("");
break;

View file

@ -78,7 +78,7 @@ void Draw_TextBox (int x, int y, int width, int lines)
Draw_TransPic (cx, cy+8, p);
}
void Draw_BigFontString(int x, int y, const char *text)
void Draw_Hexen2BigFontString(int x, int y, const char *text)
{
int sx, sy;
mpic_t *p;
@ -108,6 +108,76 @@ void Draw_BigFontString(int x, int y, const char *text)
}
}
mpic_t *QBigFontWorks(void)
{
mpic_t *p;
p = Draw_SafeCachePic ("gfx/mcharset.lmp");
if (p)
return p;
p = Draw_SafeCachePic ("mcharset.lmp");
if (p)
return p;
p = Draw_SafeCachePic ("textures/gfx/mcharset.lmp");
if (p)
return p;
p = Draw_SafeCachePic ("textures/mcharset.lmp");
if (p)
return p;
return NULL;
}
void Draw_BigFontString(int x, int y, const char *text)
{
int sx, sy;
mpic_t *p;
p = QBigFontWorks();
if (!p)
return;
if (qrenderer == QR_OPENGL)
{ //a hack for scaling
p->width = 20*8;
p->height = 20*8;
}
while(*text)
{
if (*text >= 'A' && *text <= 'Z')
{
sx = ((*text-'A')%8)*(p->width>>3);
sy = ((*text-'A')/8)*(p->height>>3);
}
else if (*text >= 'a' && *text <= 'z')
{
sx = ((*text-'a'+26)%8)*(p->width>>3);
sy = ((*text-'a'+26)/8)*(p->height>>3);
}
else if (*text >= '0' && *text <= '1')
{
sx = ((*text-'0'+26*2)%8)*(p->width>>3);
sy = ((*text-'0'+26*2)/8)*(p->height>>3);
}
else if (*text == ':')
{
sx = ((*text-'0'+26*2+10)%8)*(p->width>>3);
sy = ((*text-'0'+26*2+10)/8)*(p->height>>3);
}
else if (*text == '/')
{
sx = ((*text-'0'+26*2+11)%8)*(p->width>>3);
sy = ((*text-'0'+26*2+11)/8)*(p->height>>3);
}
else// if (*text <= ' ')
{
sx=-1;
sy=-1;
}
if(sx>=0)
Draw_SubPic(x, y, p, sx, sy, (p->width>>3), (p->height>>3));
x+=(p->width>>3);
text++;
}
}
char *menudotstyle;
int maxdots;
int mindot;
@ -151,7 +221,10 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
else
Draw_String(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
break;
case mt_buttonbigfont:
case mt_hexen2buttonbigfont:
Draw_Hexen2BigFontString(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
break;
case mt_qbuttonbigfont:
Draw_BigFontString(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
break;
case mt_menudot:
@ -544,6 +617,8 @@ menuedit_t *MC_AddEditCvar(menu_t *menu, int x, int y, char *text, char *name)
n->caption = (char *)(n+1);
strcpy((char *)(n+1), text);
n->cvar = cvar;
if (!(cvar->flags & CVAR_ARCHIVE))
Con_Printf("Warning: %s is not set for archiving\n", cvar->name);
Q_strncpyz(n->text, cvar->string, sizeof(n->text));
n->common.next = menu->options;
@ -594,6 +669,10 @@ menucheck_t *MC_AddCheckBox(menu_t *menu, int x, int y, const char *text, cvar_t
n->var = var;
n->bits = bits;
if (var)
if (!(var->flags & CVAR_ARCHIVE))
Con_Printf("Warning: %s is not set for archiving\n", var->name);
n->common.next = menu->options;
menu->options = (menuoption_t *)n;
return n;
@ -631,8 +710,13 @@ menuslider_t *MC_AddSlider(menu_t *menu, int x, int y, const char *text, cvar_t
strcpy((char *)(n+1), text);
if (var)
{
n->current = var->value;
if (!(var->flags & CVAR_ARCHIVE))
Con_Printf("Warning: %s is not set for archiving\n", var->name);
}
n->min = min;
n->max = max;
@ -687,6 +771,9 @@ menucombo_t *MC_AddCvarCombo(menu_t *menu, int x, int y, const char *caption, cv
n->values = values;
n->cvar = cvar;
if (!(cvar->flags & CVAR_ARCHIVE))
Con_Printf("Warning: %s is not set for archiving\n", cvar->name);
n->selectedoption = 0;
n->common.next = menu->options;
@ -722,10 +809,29 @@ menubutton_t *MC_AddConsoleCommand(menu_t *menu, int x, int y, const char *text,
menu->options = (menuoption_t *)n;
return n;
}
menubutton_t *MC_AddConsoleCommandBigFont(menu_t *menu, int x, int y, const char *text, const char *command)
menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command)
{
menubutton_t *n = Z_Malloc(sizeof(menubutton_t)+strlen(text)+1+strlen(command)+1);
n->common.type = mt_buttonbigfont;
n->common.type = mt_qbuttonbigfont;
n->common.iszone = true;
n->common.posx = x;
n->common.posy = y;
n->common.height = 20;
n->common.width = strlen(text)*20;
n->text = (char *)(n+1);
strcpy((char *)(n+1), text);
n->command = n->text + strlen(n->text)+1;
strcpy((char *)n->command, command);
n->common.next = menu->options;
menu->options = (menuoption_t *)n;
return n;
}
menubutton_t *MC_AddConsoleCommandHexen2BigFont(menu_t *menu, int x, int y, const char *text, const char *command)
{
menubutton_t *n = Z_Malloc(sizeof(menubutton_t)+strlen(text)+1+strlen(command)+1);
n->common.type = mt_hexen2buttonbigfont;
n->common.iszone = true;
n->common.posx = x;
n->common.posy = y;
@ -766,7 +872,7 @@ menubutton_t *VARGS MC_AddConsoleCommandf(menu_t *menu, int x, int y, const char
menubutton_t *n;
va_start (argptr, command);
_vsnprintf (string,sizeof(string)-1, command,argptr);
vsnprintf (string,sizeof(string)-1, command,argptr);
va_end (argptr);
n = Z_Malloc(sizeof(menubutton_t) + strlen(string)+1);
@ -1104,12 +1210,12 @@ menuoption_t *M_NextSelectableItem(menu_t *m, menuoption_t *old)
if (op == old)
{
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_buttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
return op;
return NULL; //whoops.
}
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_buttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
if (!op->common.ishidden)
return op;
}
@ -1136,7 +1242,7 @@ menuoption_t *M_PrevSelectableItem(menu_t *m, menuoption_t *old)
if (op == old)
return old; //whoops.
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_buttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
if (!op->common.ishidden)
return op;
}
@ -1216,7 +1322,8 @@ void M_Complex_Key(int key)
MC_CheckBox_Key(&currentmenu->selecteditem->check, currentmenu, key);
break;
case mt_button:
case mt_buttonbigfont:
case mt_hexen2buttonbigfont:
case mt_qbuttonbigfont:
if (!currentmenu->selecteditem->button.command)
currentmenu->selecteditem->button.key(currentmenu->selecteditem, currentmenu, key);
else if (key == K_ENTER || key == K_MOUSE1)
@ -1459,27 +1566,61 @@ void M_Menu_Main_f (void)
return;
MC_AddPicture(mainm, (320-p->width)/2, 0, "gfx/menu/title0.lmp");
b=MC_AddConsoleCommandBigFont (mainm, 80, 64, "Single Player", "menu_single\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64, "Single Player", "menu_single\n");
b->common.width = 12*20;
b->common.height = 20;
b=MC_AddConsoleCommandBigFont (mainm, 80, 64+20, "MultiPlayer", "menu_multi\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+20, "MultiPlayer", "menu_multi\n");
b->common.width = 12*20;
b->common.height = 20;
b=MC_AddConsoleCommandBigFont (mainm, 80, 64+40, "Options", "menu_options\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+40, "Options", "menu_options\n");
b->common.width = 12*20;
b->common.height = 20;
if (m_helpismedia.value)
b=MC_AddConsoleCommandBigFont (mainm, 80, 64+60, "Media", "menu_media\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+60, "Media", "menu_media\n");
else
b=MC_AddConsoleCommandBigFont (mainm, 80, 64+60, "Help", "help\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+60, "Help", "help\n");
b->common.width = 12*20;
b->common.height = 20;
b=MC_AddConsoleCommandBigFont (mainm, 80, 64+80, "Quit", "menu_quit\n");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+80, "Quit", "menu_quit\n");
b->common.width = 12*20;
b->common.height = 20;
mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, 48, 64);
}
else if (QBigFontWorks())
{
m_state = m_complex;
key_dest = key_menu;
mainm = M_CreateMenu(0);
p = Draw_SafeCachePic("gfx/ttl_main.lmp");
if (!p)
{
MC_AddRedText(mainm, 16, 0, "MAIN MENU", false);
mainm->selecteditem = (menuoption_t *)
MC_AddConsoleCommand (mainm, 64, 32, "Join server", "menu_servers\n");
MC_AddConsoleCommand (mainm, 64, 40, "Options", "menu_options\n");
MC_AddConsoleCommand (mainm, 64, 48, "Quit", "menu_quit\n");
return;
}
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 4, "gfx/qplaque.lmp");
MC_AddPicture(mainm, (320-p->width)/2, 4, "gfx/ttl_main.lmp");
mainm->selecteditem = (menuoption_t *)
MC_AddConsoleCommandQBigFont (mainm, 72, 32, "Single ", "menu_single\n");
MC_AddConsoleCommandQBigFont (mainm, 72, 52, "Multiplayer", "menu_multi\n");
MC_AddConsoleCommandQBigFont (mainm, 72, 72, "Options ", "menu_options\n");
if (m_helpismedia.value)
MC_AddConsoleCommandQBigFont(mainm, 72, 92, "Media ", "menu_media\n");
else
MC_AddConsoleCommandQBigFont(mainm, 72, 92, "Help ", "help\n");
MC_AddConsoleCommandQBigFont (mainm, 72, 112,"Quit ", "menu_quit\n");
mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, 54, 32);
}
else
{
m_state = m_complex;

View file

@ -984,11 +984,11 @@ qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key)
server = Master_SortedServer(info->selectedpos);
if (server)
{
_snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
}
else
{
_snprintf(info->mappic->picturename, 32, "levelshots/nomap");
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
}
}
}
@ -1056,11 +1056,11 @@ qboolean SL_Key (int key, menu_t *menu)
server = Master_SortedServer(info->selectedpos);
if (server)
{
_snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
snprintf(info->mappic->picturename, 32, "levelshots/%s", server->map);
}
else
{
_snprintf(info->mappic->picturename, 32, "levelshots/nomap");
snprintf(info->mappic->picturename, 32, "levelshots/nomap");
}
}
@ -1225,6 +1225,7 @@ void M_Menu_ServerList2_f(void)
cust->key = SL_ServerKey;
cust->common.height = 8;
cust->common.width = vid.width-8;
cust->common.noselectionsound = true;
}
menu->dontexpand = true;

View file

@ -789,138 +789,176 @@ char *Media_NextTrack(void)
///temporary residence for media handling
#include "roq.h"
roq_info *roqfilm;
sfxcache_t *moviesoundbuffer;
sfx_t mediaaudio = {
"movieaudio",
{NULL, true},
NULL
};
qbyte *staticfilmimage; //rgba
int imagewidth;
int imageheight;
#ifdef WINAVI
#undef CDECL //windows is stupid at times.
#define CDECL __cdecl
#include <vfw.h>
AVISTREAMINFO psi; // Pointer To A Structure Containing Stream Info
PAVISTREAM pavivideo=NULL;
PAVISTREAM pavisound=NULL;
PAVIFILE pavi=NULL;
PGETFRAME pgf=NULL;
LPWAVEFORMAT pWaveFormat;
HWND capturewindow;
int aviinited;
int filmwidth;
int filmheight;
float filmfps;
int num_frames;
int currentframe;
float filmstarttime;
int soundpos;
#pragma comment( lib, "vfw32.lib" )
#endif
static qbyte *framedata; //this buffer holds the image data temporarily..
#define MFT_CAPTURE 5 //fixme
media_filmtype_t media_filmtype;
typedef enum {
MFT_NONE,
MFT_STATIC, //non-moving, PCX, no sound
MFT_ROQ,
MFT_AVI,
MFT_CIN
} media_filmtype_t;
int filmnwidth;
int filmnheight;
typedef struct cin_s {
qboolean Media_PlayFilm(char *name)
//these are the outputs (not always power of two!)
int outtype;
int outwidth;
int outheight;
qbyte *outdata;
qbyte *outpalette;
int outunchanged;
//
media_filmtype_t filmtype;
#ifdef WINAVI
struct {
AVISTREAMINFO psi; // Pointer To A Structure Containing Stream Info
PAVISTREAM pavivideo;
PAVISTREAM pavisound;
PAVIFILE pavi;
PGETFRAME pgf;
LPWAVEFORMAT pWaveFormat;
HWND capturewindow;
} avi;
#endif
struct {
qbyte *filmimage; //rgba
int imagewidth;
int imageheight;
} image;
struct {
roq_info *roqfilm;
} roq;
sfxcache_t *moviesoundbuffer;
sfx_t mediaaudio;
/* = {
"movieaudio",
{NULL, true},
NULL
};
*/
float filmstarttime;
float nextframetime;
int currentframe; //last frame in buffer
qbyte *framedata; //Z_Malloced buffer
//sound stuff
int soundpos;
//source sizes
int filmwidth;
int filmheight;
//source info
float filmfps;
int num_frames;
} cin_t;
cin_t *fullscreenvid;
qboolean Media_PlayingFullScreen(void)
{
char *dot;
sfx_t *s;
soundcardinfo_t *sc;
return fullscreenvid!=NULL;
}
switch(media_filmtype) //shut down the old media.
void Media_ShutdownCin(cin_t *cin)
{
soundcardinfo_t *sc;
sfx_t *s;
if (!cin)
return;
for (sc = sndcardinfo; sc; sc=sc->next)
{
s = sc->channel[NUM_AMBIENTS].sfx;
if (s && s == &cin->mediaaudio)
{
sc->channel[NUM_AMBIENTS].pos = 0;
sc->channel[NUM_AMBIENTS].end = 0;
sc->channel[NUM_AMBIENTS].sfx = NULL;
}
}
switch(cin->filmtype) //shut down the old media.
{
case MFT_ROQ:
roq_close(roqfilm);
roqfilm=NULL;
for (sc = sndcardinfo; sc; sc=sc->next)
{
s = sc->channel[NUM_AMBIENTS].sfx;
if (s && s == &mediaaudio)
{
sc->channel[NUM_AMBIENTS].pos = 0;
sc->channel[NUM_AMBIENTS].end = 0;
sc->channel[NUM_AMBIENTS].sfx = NULL;
}
}
roq_close(cin->roq.roqfilm);
cin->roq.roqfilm=NULL;
break;
case MFT_STATIC:
BZ_Free(staticfilmimage);
staticfilmimage = NULL;
BZ_Free(cin->image.filmimage);
cin->image.filmimage = NULL;
break;
#ifdef WINAVI
case MFT_AVI:
AVIStreamGetFrameClose(pgf);
AVIStreamEndStreaming(pavivideo);
AVIStreamRelease(pavivideo);
// AVIFileRelease(pavi);
for (sc = sndcardinfo; sc; sc=sc->next)
{
s = sc->channel[NUM_AMBIENTS].sfx;
if (s && s == &mediaaudio)
{
sc->channel[NUM_AMBIENTS].pos = 0;
sc->channel[NUM_AMBIENTS].end = 0;
sc->channel[NUM_AMBIENTS].sfx = NULL;
}
}
AVIStreamGetFrameClose(cin->avi.pgf);
AVIStreamEndStreaming(cin->avi.pavivideo);
AVIStreamRelease(cin->avi.pavivideo);
//we don't need to free the file (we freed it immediatly after getting the stream handles)
break;
#else
case MFT_AVI:
break;
#endif
case MFT_CIN:
CIN_FinishCinematic();
break;
#if 0
case MFT_CAPTURE:
if (capturewindow)
{
capCaptureStop(capturewindow);
capDriverDisconnect(capturewindow);
DestroyWindow(capturewindow);
}
break;
#endif
case MFT_NONE:
break;
}
media_filmtype = MFT_NONE;
if (framedata)
if (cin->framedata)
{
BZ_Free(framedata);
framedata = NULL;
BZ_Free(cin->framedata);
cin->framedata = NULL;
}
Z_Free(cin);
}
cin_t *Media_StartCin(char *name)
{
cin_t *cin = NULL;
char *dot;
if (!name || !*name) //clear only.
return false;
return NULL;
dot = strchr(name, '.'); //q2 cinematics work like this.
if (dot && (!strcmp(dot, ".pcx") || !strcmp(dot, ".tga") || !strcmp(dot, ".png") || !strcmp(dot, ".jpg")))
{
qbyte *staticfilmimage;
int imagewidth;
int imageheight;
char fullname[MAX_QPATH];
qbyte *file;
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
@ -928,10 +966,15 @@ qboolean Media_PlayFilm(char *name)
qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height);
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height, char *fname);
sprintf(fullname, "pics/%s", name);
sprintf(fullname, "%s", name);
file = COM_LoadMallocFile(fullname); //read file
if (!file)
return false;
{
sprintf(fullname, "pics/%s", name);
file = COM_LoadMallocFile(fullname); //read file
if (!file)
return NULL;
}
if ((staticfilmimage = ReadPCXFile(file, com_filesize, &imagewidth, &imageheight)) || //convert to 32 rgba if not corrupt
(staticfilmimage = ReadTargaFile(file, com_filesize, &imagewidth, &imageheight, false)) ||
@ -947,184 +990,179 @@ qboolean Media_PlayFilm(char *name)
}
else
{
BZ_Free(file); //got image data
Con_Printf("Static cinematic format not supported.\n"); //not supported format
return false;
return NULL;
}
Con_ClearNotify();
if (key_dest != key_console)
scr_con_current=0;
media_filmtype = MFT_STATIC;
return true;
cin = Z_Malloc(sizeof(cin_t));
cin->filmtype = MFT_STATIC;
cin->image.filmimage = staticfilmimage;
cin->image.imagewidth = imagewidth;
cin->image.imageheight = imageheight;
return cin;
}
if (dot && (!strcmp(dot, ".cin")))
{
if (CIN_PlayCinematic(name))
media_filmtype = MFT_CIN;
return true;
{
cin = Z_Malloc(sizeof(cin_t));
cin->filmtype = MFT_CIN;
}
return cin;
}
if ((roqfilm = roq_open(name)))
{
Con_ClearNotify();
if (key_dest != key_console)
scr_con_current=0;
media_filmtype = MFT_ROQ;
roq_info *roqfilm;
if ((roqfilm = roq_open(name)))
{
cin = Z_Malloc(sizeof(cin_t));
cin->filmtype = MFT_ROQ;
cin->roq.roqfilm = roqfilm;
cin->nextframetime = Sys_DoubleTime();
framedata = BZ_Malloc(roqfilm->width*roqfilm->height*4);
return true;
cin->framedata = BZ_Malloc(roqfilm->width*roqfilm->height*4);
return cin;
}
}
#ifdef WINAVI
#if 0
if (dot && (!strcmp(dot, ".cap")))
{
char drivername[256];
capturewindow = capCreateCaptureWindow("Capture Window", WS_OVERLAPPEDWINDOW, 0, 0, 512, 512, mainwindow, 0);
ShowWindow(capturewindow, SW_NORMAL);
PAVIFILE pavi;
capDriverConnect(capturewindow, atoi(name));
drivername[0] = '\0';
capDriverGetName(capturewindow, drivername, sizeof(drivername));
// capDlgVideoSource(capturewindow);
capCaptureSequenceNoFile(capturewindow);
Con_Printf("%s", drivername);
media_filmtype = MFT_CAPTURE;
return false;
}
#endif
if (!aviinited)
{
aviinited=true;
AVIFileInit();
}
if (!AVIFileOpen(&pavi, name, OF_READ, NULL))//!AVIStreamOpenFromFile(&pavi, name, streamtypeVIDEO, 0, OF_READ, NULL))
{
if (AVIFileGetStream(pavi, &pavivideo, streamtypeVIDEO, 0)) //retrieve video stream
if (!aviinited)
{
AVIFileRelease(pavi);
Con_Printf("%s contains no video stream\n", name);
return false;
aviinited=true;
AVIFileInit();
}
if (AVIFileGetStream(pavi, &pavisound, streamtypeAUDIO, 0)) //retrieve audio stream
if (!AVIFileOpen(&pavi, name, OF_READ, NULL))//!AVIStreamOpenFromFile(&pavi, name, streamtypeVIDEO, 0, OF_READ, NULL))
{
Con_Printf("%s contains no audio stream\n", name);
pavisound=NULL;
}
AVIFileRelease(pavi);
cin = Z_Malloc(sizeof(cin_t));
cin->filmtype = MFT_AVI;
cin->avi.pavi = pavi;
//play with video
AVIStreamInfo(pavivideo, &psi, sizeof(psi));
filmwidth=psi.rcFrame.right-psi.rcFrame.left; // Width Is Right Side Of Frame Minus Left
filmheight=psi.rcFrame.bottom-psi.rcFrame.top; // Height Is Bottom Of Frame Minus Top
framedata = BZ_Malloc(filmwidth*filmheight*4);
num_frames=AVIStreamLength(pavivideo); // The Last Frame Of The Stream
filmfps=1000.0f*(float)num_frames/(float)AVIStreamSampleToTime(pavivideo,num_frames); // Calculate Rough Milliseconds Per Frame
for (filmnwidth = 1; filmnwidth<filmwidth; filmnwidth*=2)
;
for (filmnheight = 1; filmnheight<filmheight; filmnheight*=2)
;
AVIStreamBeginStreaming(pavivideo, 0, num_frames, 100);
pgf=AVIStreamGetFrameOpen(pavivideo, NULL);
currentframe=0;
filmstarttime = Sys_DoubleTime();
soundpos=0;
//play with sound
if (pavisound)
{
LONG lSize;
LPBYTE pChunk;
AVIStreamRead(pavisound, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &lSize, NULL);
if (!lSize)
pWaveFormat = NULL;
else
if (AVIFileGetStream(cin->avi.pavi, &cin->avi.pavivideo, streamtypeVIDEO, 0)) //retrieve video stream
{
AVIFileRelease(pavi);
Con_Printf("%s contains no video stream\n", name);
return NULL;
}
if (AVIFileGetStream(cin->avi.pavi, &cin->avi.pavisound, streamtypeAUDIO, 0)) //retrieve audio stream
{
Con_DPrintf("%s contains no audio stream\n", name);
cin->avi.pavisound=NULL;
}
AVIFileRelease(cin->avi.pavi);
pChunk = BZ_Malloc(sizeof(qbyte)*lSize);
//play with video
AVIStreamInfo(cin->avi.pavivideo, &cin->avi.psi, sizeof(cin->avi.psi));
cin->filmwidth=cin->avi.psi.rcFrame.right-cin->avi.psi.rcFrame.left; // Width Is Right Side Of Frame Minus Left
cin->filmheight=cin->avi.psi.rcFrame.bottom-cin->avi.psi.rcFrame.top; // Height Is Bottom Of Frame Minus Top
cin->framedata = BZ_Malloc(cin->filmwidth*cin->filmheight*4);
cin->num_frames=AVIStreamLength(cin->avi.pavivideo); // The Last Frame Of The Stream
cin->filmfps=1000.0f*(float)cin->num_frames/(float)AVIStreamSampleToTime(cin->avi.pavivideo,cin->num_frames); // Calculate Rough Milliseconds Per Frame
if(AVIStreamReadFormat(pavisound, AVIStreamStart(pavisound), pChunk, &lSize))
AVIStreamBeginStreaming(cin->avi.pavivideo, 0, cin->num_frames, 100);
cin->avi.pgf=AVIStreamGetFrameOpen(cin->avi.pavivideo, NULL);
cin->currentframe=0;
cin->filmstarttime = Sys_DoubleTime();
cin->soundpos=0;
//play with sound
if (cin->avi.pavisound)
{
LONG lSize;
LPBYTE pChunk;
AVIStreamRead(cin->avi.pavisound, 0, AVISTREAMREAD_CONVENIENT, NULL, 0, &lSize, NULL);
if (!lSize)
cin->avi.pWaveFormat = NULL;
else
{
// error
Con_Printf("Failiure reading sound info\n");
pChunk = BZ_Malloc(sizeof(qbyte)*lSize);
if(AVIStreamReadFormat(cin->avi.pavisound, AVIStreamStart(cin->avi.pavisound), pChunk, &lSize))
{
// error
Con_Printf("Failiure reading sound info\n");
}
cin->avi.pWaveFormat = (LPWAVEFORMAT)pChunk;
}
pWaveFormat = (LPWAVEFORMAT)pChunk;
}
if (!pWaveFormat)
{
Con_Printf("VFW is broken\n");
AVIStreamRelease(pavisound);
pavisound=NULL;
}
else if (pWaveFormat->wFormatTag != 1)
{
Con_Printf("Audio stream is not PCM\n"); //FIXME: so that it no longer is...
AVIStreamRelease(pavisound);
pavisound=NULL;
if (!cin->avi.pWaveFormat)
{
Con_Printf("VFW is broken\n");
AVIStreamRelease(cin->avi.pavisound);
cin->avi.pavisound=NULL;
}
else if (cin->avi.pWaveFormat->wFormatTag != 1)
{
Con_Printf("Audio stream is not PCM\n"); //FIXME: so that it no longer is...
AVIStreamRelease(cin->avi.pavisound);
cin->avi.pavisound=NULL;
}
}
cin->filmtype = MFT_AVI;
return cin;
}
Con_ClearNotify();
if (key_dest != key_console)
scr_con_current=0;
media_filmtype = MFT_AVI;
return true;
}
#endif
Con_Printf("Failed to find file %s\n", name);
return false;
return NULL;
}
qboolean Media_ShowFilm(void)
qboolean Media_DecodeFrame(cin_t *cin)
{
// sfx_t *s;
static float lastframe=0;
// soundcardinfo_t *sc;
float curtime = Sys_DoubleTime();
switch (media_filmtype)
switch (cin->filmtype)
{
case MFT_ROQ:
if (curtime<lastframe || roq_read_frame(roqfilm)==1) //0 if end, -1 if error, 1 if success
if (curtime<cin->nextframetime || roq_read_frame(cin->roq.roqfilm)==1) //0 if end, -1 if error, 1 if success
{
//#define LIMIT(x) ((x)<0xFFFF)?(x)>>16:0xFF;
#define LIMIT(x) ((((x) > 0xffffff) ? 0xff0000 : (((x) <= 0xffff) ? 0 : (x) & 0xff0000)) >> 16)
unsigned char *pa=roqfilm->y[0];
unsigned char *pb=roqfilm->u[0];
unsigned char *pc=roqfilm->v[0];
int _pixel=0;
int num_columns=(roqfilm->width)>>1;
unsigned char *pa=cin->roq.roqfilm->y[0];
unsigned char *pb=cin->roq.roqfilm->u[0];
unsigned char *pc=cin->roq.roqfilm->v[0];
int pixel=0;
int num_columns=(cin->roq.roqfilm->width)>>1;
int num_rows=cin->roq.roqfilm->height;
int y;
int x;
if (!(curtime<lastframe)) //roq file was read properly
qbyte *framedata;
if (!(curtime<cin->nextframetime)) //roq file was read properly
{
lastframe += 1/30.0; //add a little bit of extra speed so we cover up a little bit of glitchy sound... :o)
cin->nextframetime += 1/30.0; //add a little bit of extra speed so we cover up a little bit of glitchy sound... :o)
if (lastframe < curtime)
lastframe = curtime;
if (cin->nextframetime < curtime)
cin->nextframetime = curtime;
for(y = 0; y < roqfilm->height; ++y) //roq playing doesn't give nice data. It's still fairly raw.
framedata = cin->framedata;
for(y = 0; y < num_rows; ++y) //roq playing doesn't give nice data. It's still fairly raw.
{ //convert it properly.
for(x = 0; x < num_columns; ++x)
{
@ -1141,19 +1179,19 @@ qboolean Media_ShowFilm(void)
b = 116130 * u;
t=r+y1;
framedata[_pixel] =(unsigned char) LIMIT(t);
framedata[pixel] =(unsigned char) LIMIT(t);
t=g+y1;
framedata[_pixel+1] =(unsigned char) LIMIT(t);
framedata[pixel+1] =(unsigned char) LIMIT(t);
t=b+y1;
framedata[_pixel+2] =(unsigned char) LIMIT(t);
framedata[pixel+2] =(unsigned char) LIMIT(t);
t=r+y2;
framedata[_pixel+4] =(unsigned char) LIMIT(t);
framedata[pixel+4] =(unsigned char) LIMIT(t);
t=g+y2;
framedata[_pixel+5] =(unsigned char) LIMIT(t);
framedata[pixel+5] =(unsigned char) LIMIT(t);
t=b+y2;
framedata[_pixel+6] =(unsigned char) LIMIT(t);
_pixel+=8;
framedata[pixel+6] =(unsigned char) LIMIT(t);
pixel+=8;
}
if(y & 0x01) { pb += num_columns; pc += num_columns; }
@ -1161,14 +1199,18 @@ qboolean Media_ShowFilm(void)
}
else if (vid.numpages == 1) //previous frame is still in page.
{
SCR_SetUpToDrawConsole(); //animate the console at the right speed, but don't bother drawing it.
cin->outunchanged = true;
return true;
}
Media_ShowFrameRGBA_32(framedata, roqfilm->width, roqfilm->height);
cin->outunchanged = false;
cin->outtype = 1;
cin->outwidth = cin->roq.roqfilm->width;
cin->outheight = cin->roq.roqfilm->height;
cin->outdata = cin->framedata;
if (roqfilm->audio_channels && sndcardinfo && roqfilm->aud_pos < roqfilm->vid_pos)
if (roq_read_audio(roqfilm)>0)
if (cin->roq.roqfilm->audio_channels && sndcardinfo && cin->roq.roqfilm->aud_pos < cin->roq.roqfilm->vid_pos)
if (roq_read_audio(cin->roq.roqfilm)>0)
{
/* FILE *f;
char wav[] = "\x52\x49\x46\x46\xea\x5f\x04\x00\x57\x41\x56\x45\x66\x6d\x74\x20\x12\x00\x00\x00\x01\x00\x02\x00\x22\x56\x00\x00\x88\x58\x01\x00\x04\x00\x10\x00\x00\x00\x66\x61\x63\x74\x04\x00\x00\x00\xee\x17\x01\x00\x64\x61\x74\x61\xb8\x5f\x04\x00";
@ -1186,38 +1228,65 @@ qboolean Media_ShowFilm(void)
fwrite(&size, sizeof(size), 1, f);
fclose(f);
*/
S_RawAudio(-1, roqfilm->audio, 22050, roqfilm->audio_size/roqfilm->audio_channels, roqfilm->audio_channels, 2);
S_RawAudio(-1, cin->roq.roqfilm->audio, 22050, cin->roq.roqfilm->audio_size/cin->roq.roqfilm->audio_channels, cin->roq.roqfilm->audio_channels, 2);
}
return true;
}
Media_PlayFilm(NULL);
return false;
else
{
cin->roq.roqfilm->frame_num = 0;
cin->roq.roqfilm->aud_pos = cin->roq.roqfilm->roq_start;
cin->roq.roqfilm->vid_pos = cin->roq.roqfilm->roq_start;
}
break;
case MFT_STATIC:
Media_ShowFrameRGBA_32(staticfilmimage, imagewidth, imageheight);
cin->outunchanged = cin->outtype;//handy
cin->outtype = 1;
cin->outwidth = cin->image.imagewidth;
cin->outheight = cin->image.imageheight;
cin->outdata = cin->image.filmimage;
return true;
#ifdef WINAVI
case MFT_CIN:
//FIXME!
if (CIN_RunCinematic())
{
CIN_DrawCinematic();
return true;
}
break;
case MFT_AVI:
{
LPBITMAPINFOHEADER lpbi; // Holds The Bitmap Header Information
float newframe;
int newframei;
currentframe = (curtime - filmstarttime)*filmfps;
newframe = (curtime - cin->filmstarttime)*cin->filmfps;
newframei = newframe;
if (currentframe>=num_frames)
if (newframe == cin->currentframe)
{
cin->outunchanged = true;
return true;
}
if (cin->currentframe < newframei-1)
Con_DPrintf("Dropped %i frame(s)\n", (newframei - cin->currentframe)-1);
cin->currentframe = newframei;
Con_DPrintf("%i\n", newframei);
if (cin->currentframe>=cin->num_frames)
{
Media_PlayFilm(NULL);
return false;
}
lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pgf, currentframe); // Grab Data From The AVI Stream
currentframe++;
lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(cin->avi.pgf, cin->currentframe); // Grab Data From The AVI Stream
cin->currentframe++;
if (!lpbi || lpbi->biBitCount != 24)//oops
{
SCR_SetUpToDrawConsole();
@ -1229,51 +1298,110 @@ qboolean Media_ShowFilm(void)
}
else
{
Media_ShowFrameBGR_24_Flip((char*)lpbi+lpbi->biSize, lpbi->biWidth, lpbi->biHeight);
cin->outtype = 3;
cin->outwidth = lpbi->biWidth;
cin->outheight = lpbi->biHeight;
cin->outdata = (char*)lpbi+lpbi->biSize;
}
if (pavisound)
if (cin->avi.pavisound)
{
LONG lSize;
LPBYTE pBuffer;
LONG samples;
AVIStreamRead(pavisound, 0, AVISTREAMREAD_CONVENIENT,
AVIStreamRead(cin->avi.pavisound, 0, AVISTREAMREAD_CONVENIENT,
NULL, 0, &lSize, &samples);
soundpos+=samples;
cin->soundpos+=samples;
pBuffer = framedata;
pBuffer = cin->framedata;
AVIStreamRead(pavisound, soundpos, AVISTREAMREAD_CONVENIENT, pBuffer, lSize, NULL, &samples);
AVIStreamRead(cin->avi.pavisound, cin->soundpos, AVISTREAMREAD_CONVENIENT, pBuffer, lSize, NULL, &samples);
S_RawAudio(-1, pBuffer, pWaveFormat->nSamplesPerSec, samples, pWaveFormat->nChannels, 2);
S_RawAudio(-1, pBuffer, cin->avi.pWaveFormat->nSamplesPerSec, samples, cin->avi.pWaveFormat->nChannels, 2);
}
}
return true;
#else
case MFT_AVI:
break;
#endif
case MFT_CIN:
if (CIN_RunCinematic())
{
CIN_DrawCinematic();
return true;
}
break;
#ifdef WINAVI
case MFT_CAPTURE:
return false;
#endif
case MFT_NONE:
break;
}
Media_PlayFilm(NULL);
return false;
}
qboolean Media_PlayFilm(char *name)
{
Media_ShutdownCin(fullscreenvid);
fullscreenvid = Media_StartCin(name);
if (fullscreenvid)
{
Con_ClearNotify();
if (key_dest != key_console)
scr_con_current=0;
return true;
}
else
return false;
}
qboolean Media_ShowFilm(void)
{
if (!fullscreenvid)
return false;
if (!Media_DecodeFrame(fullscreenvid))
{
Media_ShutdownCin(fullscreenvid);
fullscreenvid = NULL;
return false;
}
switch(fullscreenvid->outtype)
{
case 1:
Media_ShowFrameRGBA_32(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
break;
case 2:
Media_ShowFrame8bit(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight, fullscreenvid->outpalette);
break;
case 3:
Media_ShowFrameBGR_24_Flip(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
break;
}
return true;
}
#ifdef RGLQUAKE
int Media_UpdateForShader(int texnum, cin_t *cin)
{
if (!cin)
return 0;
if (!Media_DecodeFrame(cin))
{
return 0;
}
GL_Bind(100);
switch(cin->outtype)
{
case 1:
GL_Upload32("cin", (unsigned int*)cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
case 2:
GL_Upload8("cin", cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
case 3:
GL_Upload24BGR_Flip ("cin", cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
}
return 100;
}
#endif
void Media_PlayFilm_f (void)
{
if (Cmd_Argc() < 2)
@ -1287,6 +1415,23 @@ void Media_PlayFilm_f (void)
}
#if defined(RGLQUAKE) && defined(WINAVI)
#define WINAVIRECORDING
PAVIFILE recordavi_file;
@ -1544,7 +1689,7 @@ void Media_RecordFilm_f (void)
if (capturetype == CT_AVI)
{
_snprintf(filename, 192, "%s%s", com_gamedir, Cmd_Argv(1));
snprintf(filename, 192, "%s%s", com_gamedir, Cmd_Argv(1));
COM_StripExtension(filename, filename);
COM_DefaultExtension (filename, ".avi");

View file

@ -39,6 +39,22 @@ void M_Menu_MultiPlayer_f (void)
else if (mgt == MGT_HEXEN2)
{
}
else if (QBigFontWorks())
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_multi.lmp");
mgt=32;
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Join A Game ", "menu_slist\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, 52, "Browser2 ", "menu_servers2\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, 72, "New Game ", "menu_newmulti\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, 92, "Setup ", "menu_setup\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, 112, "Demos ", "menu_demo\n");mgt+=20;
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, 54, 32);
return;
}
else
{
p = Draw_SafeCachePic("gfx/mp_menu.lmp");

View file

@ -192,6 +192,29 @@ void M_MenuS_Text_f (void)
}
}
void M_MenuS_TextBig_f (void)
{
menuoption_t *option;
int x = atoi(Cmd_Argv(1));
int y = atoi(Cmd_Argv(2));
char *text = Cmd_Argv(3);
char *command = Cmd_Argv(4);
if (!menu_script)
{
Con_Printf("%s with no active menu\n", Cmd_Argv(0));
return;
}
if (*command)
MC_AddConsoleCommandQBigFont(menu_script, x, y, text, command);
else
{
option = (menuoption_t *)MC_AddConsoleCommand(menu_script, x, y, text, va("set option %s\n%s\n", command, menualias.string));
if (selectitem-- == 0)
menu_script->selecteditem = option;
}
}
void M_MenuS_Bind_f (void)
{
int x = atoi(Cmd_Argv(1));
@ -231,6 +254,7 @@ void M_Script_Init(void)
Cmd_AddCommand("menubox", M_MenuS_Box_f);
Cmd_AddCommand("menuedit", M_MenuS_Edit_f);
Cmd_AddCommand("menutext", M_MenuS_Text_f);
Cmd_AddCommand("menutextbig", M_MenuS_TextBig_f);
Cmd_AddCommand("menupic", M_MenuS_Picture_f);
Cmd_AddCommand("menucheck", M_MenuS_CheckBox_f);
Cmd_AddCommand("menuslider", M_MenuS_Slider_f);

View file

@ -32,7 +32,7 @@ void M_ScanSaves (void)
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
loadable[i] = false;
_snprintf (line, sizeof(line), "saves/s%i/info.fsv", i);
snprintf (line, sizeof(line), "saves/s%i/info.fsv", i);
f = FS_OpenVFS (line, "rb", FS_GAME);
if (f)
{
@ -163,11 +163,25 @@ void M_Menu_SinglePlayer_f (void)
MC_AddConsoleCommand (menu, 64, 72, "Medium", "togglemenu\nskill 1;deathmatch 0; coop 0;map demo1\n");
MC_AddConsoleCommand (menu, 64, 80, "Hard", "togglemenu\nskill 2;deathmatch 0; coop 0;map demo1\n");
// MC_AddConsoleCommand (menu, 64, 96, "Load Game", "menu_load\n");
MC_AddConsoleCommand (menu, 64, 96, "Load Game", "menu_load\n");
MC_AddConsoleCommand (menu, 64, 104, "Save Game", "menu_save\n");
return;
}
else if (QBigFontWorks())
{
menu = M_CreateMenu(0);
MC_AddPicture(menu, 16, 0, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 0, "gfx/p_option.lmp");
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommandQBigFont (menu, 72, 32, "New Game", "togglemenu\nmaxclients 1;deathmatch 0;coop 0;map start\n");
MC_AddConsoleCommandQBigFont (menu, 72, 52, "Load Game", "menu_load\n");
MC_AddConsoleCommandQBigFont (menu, 72, 72, "Save Game", "menu_save\n");
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, 54, 32);
return;
}
else
{ //q1
menu = M_CreateMenu(0);

View file

@ -116,7 +116,7 @@ struct menu_s;
typedef enum {m_none, m_complex, m_help, m_keys, m_slist, m_media, m_plugin, m_menu_dat} m_state_t;
extern m_state_t m_state;
typedef enum {mt_childwindow, mt_button, mt_buttonbigfont, mt_box, mt_colouredbox, mt_line, mt_edit, mt_text, mt_slider, mt_combo, mt_bind, mt_checkbox, mt_picture, mt_strechpic, mt_menudot, mt_custom} menutype_t;
typedef enum {mt_childwindow, mt_button, mt_qbuttonbigfont, mt_hexen2buttonbigfont, mt_box, mt_colouredbox, mt_line, mt_edit, mt_text, mt_slider, mt_combo, mt_bind, mt_checkbox, mt_picture, mt_strechpic, mt_menudot, mt_custom} menutype_t;
typedef struct { //must be first of each structure type.
menutype_t type;
@ -126,7 +126,7 @@ typedef struct { //must be first of each structure type.
int height;
qboolean noselectionsound:1;
qboolean iszone:1;
qboolean ishidden;
qboolean ishidden:1;
union menuoption_s *next;
} menucommon_t;
@ -263,6 +263,8 @@ menuslider_t *MC_AddSlider(menu_t *menu, int x, int y, const char *text, cvar_t
menucheck_t *MC_AddCheckBox(menu_t *menu, int x, int y, const char *text, cvar_t *var, int cvarbitmask);
menucheck_t *MC_AddCheckBoxFunc(menu_t *menu, int x, int y, const char *text, qboolean (*func) (menucheck_t *option, menu_t *menu, chk_set_t set), int bits);
menubutton_t *MC_AddConsoleCommand(menu_t *menu, int x, int y, const char *text, const char *command);
menubutton_t *MC_AddConsoleCommandQBigFont(menu_t *menu, int x, int y, const char *text, const char *command);
mpic_t *QBigFontWorks(void);
menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));
menucombo_t *MC_AddCombo(menu_t *menu, int x, int y, const char *caption, const char **text, int initialvalue);
menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));

View file

@ -3468,7 +3468,7 @@ void VARGS CSQC_Abort (char *format, ...) //an error occured.
char string[1024];
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
Con_Printf("CSQC_Abort: %s\nShutting down csqc\n", string);
@ -3522,7 +3522,7 @@ qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize)
if (!strcmp(path, "csprogs.dat"))
{
char newname[MAX_QPATH];
_snprintf(newname, MAX_QPATH, "csprogsvers/%x.dat", csqcchecksum);
snprintf(newname, MAX_QPATH, "csprogsvers/%x.dat", csqcchecksum);
file = COM_LoadStackFile(newname, buffer, bufsize);
if (file)
@ -3553,7 +3553,7 @@ int CSQC_PRFileSize (char *path)
if (!strcmp(path, "csprogs.dat"))
{
char newname[MAX_QPATH];
_snprintf(newname, MAX_QPATH, "csprogsvers/%x.dat", csqcchecksum);
snprintf(newname, MAX_QPATH, "csprogsvers/%x.dat", csqcchecksum);
file = COM_LoadTempFile (newname);
if (file)

View file

@ -1353,7 +1353,7 @@ void VARGS Menu_Abort (char *format, ...)
char string[1024];
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
Con_Printf("Menu_Abort: %s\nShutting down menu.dat\n", string);

View file

@ -184,6 +184,18 @@ extern "C" {
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifdef _WIN32
//msvc crap
#define snprintf linuxlike_snprintf
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...);
#define vsnprintf linuxlike_vsnprintf
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
#define _vsnprintf unsafe_vsnprintf
#define _snprintf unsafe_snprintf
#endif
//=============================================================================
// the host system specifies the base of the directory tree, the

View file

@ -399,7 +399,7 @@ player_info_t *s;
{
GL_Bind(a->texture->gl_texturenum);
GL_Upload8 ((qbyte *)a->texture + a->texture->offsets[0], a->texture->width, a->texture->height, false, false);
GL_Upload8 ("bulleten", (qbyte *)a->texture + a->texture->offsets[0], a->texture->width, a->texture->height, false, false);
}
#endif
}

View file

@ -279,6 +279,7 @@ void R_StoreEfrags (efrag_t **ppefrag)
(cl_numvisedicts < MAX_VISEDICTS))
{
pent->frame1time = cl.time;
pent->frame2time = cl.time;
cl_visedicts[cl_numvisedicts++] = *pent;
// mark that we've recorded this entity for this frame

View file

@ -33,7 +33,7 @@ cvar_t r_viewmodelsize = SCVAR("r_viewmodelsize","1");
cvar_t r_drawviewmodelinvis = SCVAR("r_drawviewmodelinvis", "0");
cvar_t r_netgraph = SCVAR("r_netgraph","0");
cvar_t r_speeds = SCVARF("r_speeds","0", CVAR_CHEAT);
cvar_t r_waterwarp = SCVAR("r_waterwarp","1");
cvar_t r_waterwarp = SCVARF("r_waterwarp","1", CVAR_ARCHIVE);
cvar_t r_drawentities = SCVAR("r_drawentities","1");
cvar_t r_fullbright = SCVARF("r_fullbright","0", CVAR_CHEAT);
cvar_t r_ambient = SCVARF("r_ambient", "0", CVAR_CHEAT);
@ -79,7 +79,7 @@ cvar_t r_stains = SCVARF("r_stains", "0.75", CVAR_ARCHIVE);
cvar_t r_stainfadetime = SCVAR("r_stainfadetime", "1");
cvar_t r_stainfadeammount = SCVAR("r_stainfadeammount", "1");
cvar_t _windowed_mouse = SCVAR("_windowed_mouse","1");
cvar_t _windowed_mouse = SCVARF("_windowed_mouse","1", CVAR_ARCHIVE);
cvar_t vid_wait = SCVAR("vid_wait","0");
cvar_t _vid_wait_override = SCVARF("_vid_wait_override", "", CVAR_ARCHIVE);
@ -96,16 +96,16 @@ static cvar_t vid_height = SCVARF("vid_height", "480", CVAR_ARCHIVE|CVAR_RENDERE
static cvar_t vid_refreshrate = SCVARF("vid_displayfrequency", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH);
cvar_t gl_texturemode = SCVAR("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST");
cvar_t gl_motionblur = SCVAR("gl_motionblur", "0");
cvar_t gl_motionblur = SCVARF("gl_motionblur", "0", CVAR_ARCHIVE);
cvar_t gl_motionblurscale = SCVAR("gl_motionblurscale", "1");
cvar_t gl_fontedgeclamp = SCVAR("gl_fontedgeclamp", "0"); //gl blends. Set this to 1 to stop the outside of your conchars from being visible
cvar_t gl_font = SCVAR("gl_font", "");
cvar_t gl_conback = SCVAR("gl_conback", "");
cvar_t gl_smoothfont = SCVAR("gl_smoothfont", "1");
cvar_t gl_part_flame = SCVAR("gl_part_flame", "1");
cvar_t r_part_rain = SCVAR("r_part_rain", "0");
cvar_t r_part_rain = SCVARF("r_part_rain", "0", CVAR_ARCHIVE);
cvar_t r_bouncysparks = SCVAR("r_bouncysparks", "0");
cvar_t r_bouncysparks = SCVARF("r_bouncysparks", "0", CVAR_ARCHIVE);
cvar_t r_fullbrightSkins = SCVARF("r_fullbrightSkins", "1", CVAR_SEMICHEAT);
cvar_t r_fb_models = SCVARF("gl_fb_models", "1", CVAR_SEMICHEAT|CVAR_RENDERERLATCH); //as it can highlight the gun a little... ooo nooo....
@ -114,7 +114,7 @@ cvar_t r_fb_bmodels = SCVARF("gl_fb_bmodels", "1", CVAR_SEMICHEAT|CVAR_RENDERERL
cvar_t r_shadow_bumpscale_basetexture = SCVAR("r_shadow_bumpscale_basetexture", "4");
cvar_t r_shadow_bumpscale_bumpmap = SCVAR("r_shadow_bumpscale_bumpmap", "10");
cvar_t gl_nocolors = SCVAR("gl_nocolors","0");
cvar_t gl_load24bit = SCVAR("gl_load24bit", "1");
cvar_t gl_load24bit = SCVARF("gl_load24bit", "1", CVAR_ARCHIVE);
cvar_t vid_conwidth = SCVARF("vid_conwidth", "640", CVAR_ARCHIVE);
cvar_t vid_conheight = SCVARF("vid_conheight", "480", CVAR_ARCHIVE);
cvar_t gl_nobind = SCVAR("gl_nobind", "0");
@ -122,7 +122,7 @@ cvar_t gl_max_size = SCVAR("gl_max_size", "1024");
cvar_t gl_picmip = SCVAR("gl_picmip", "0");
cvar_t gl_picmip2d = SCVAR("gl_picmip2d", "0");
cvar_t r_drawdisk = SCVAR("r_drawdisk", "1");
cvar_t gl_compress = SCVAR("gl_compress", "0");
cvar_t gl_compress = SCVARF("gl_compress", "0", CVAR_ARCHIVE);
cvar_t gl_savecompressedtex = SCVAR("gl_savecompressedtex", "0");
extern cvar_t gl_dither;
extern cvar_t gl_maxdist;
@ -133,7 +133,7 @@ cvar_t gl_detail = SCVARF("gl_detail", "0", CVAR_ARCHIVE);
cvar_t gl_detailscale = SCVAR("gl_detailscale", "5");
cvar_t gl_overbright = SCVARF("gl_overbright", "0", CVAR_ARCHIVE);
cvar_t r_shadows = SCVARF("r_shadows", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH);
cvar_t r_shadow_realtime_world = SCVARF("r_shadow_realtime_world", "0", CVAR_CHEAT);
cvar_t r_shadow_realtime_world = SCVARF("r_shadow_realtime_world", "0", CVAR_CHEAT|CVAR_ARCHIVE);
cvar_t r_shadow_realtime_world_lightmaps = SCVARF("r_shadow_realtime_world_lightmaps", "0.8", CVAR_CHEAT);
cvar_t r_noaliasshadows = SCVARF("r_noaliasshadows", "0", CVAR_ARCHIVE);
cvar_t gl_maxshadowlights = SCVARF("gl_maxshadowlights", "2", CVAR_ARCHIVE);
@ -199,8 +199,8 @@ extern cvar_t r_fullbright;
extern cvar_t r_shadows;
extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha;
cvar_t r_dynamic = SCVAR("r_dynamic","1");
cvar_t r_flashblend = SCVAR("gl_flashblend","0");
cvar_t r_dynamic = SCVARF("r_dynamic","1", CVAR_ARCHIVE);
cvar_t r_flashblend = SCVARF("gl_flashblend","0", CVAR_ARCHIVE);
cvar_t r_lightstylesmooth = SCVAR("r_lightstylesmooth", "0");
cvar_t r_lightstylespeed = SCVAR("r_lightstylespeed", "10");
extern cvar_t r_novis;
@ -1173,6 +1173,9 @@ void M_Menu_Video_f (void)
extern cvar_t r_stains, v_contrast;
#if defined(SWQUAKE)
extern cvar_t d_smooth;
#endif
#if defined(RGLQUAKE)
extern cvar_t r_bloom;
#endif
extern cvar_t r_bouncysparks;
static const char *modenames[128] = {"Custom"};
@ -1313,6 +1316,7 @@ void M_Menu_Video_f (void)
#endif
#ifdef RGLQUAKE
MC_AddCheckBox(menu, 16, y, " GL Bumpmapping", &gl_bump,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Bloom", &r_bloom,0); y+=8;
#endif
MC_AddCheckBox(menu, 16, y, " Dynamic lights", &r_dynamic,0); y+=8;
MC_AddSlider(menu, 16, y, " Screen size", &scr_viewsize, 30, 120);y+=8;

View file

@ -376,7 +376,7 @@ void SCR_DrawField (int x, int y, int color, int width, int value)
if (width > 5)
width = 5;
_snprintf (num, sizeof(num), "%i", value);
snprintf (num, sizeof(num), "%i", value);
l = strlen(num);
if (l > width)
l = width;

View file

@ -93,7 +93,7 @@ void *Sys_GetGameAPI (void *parms)
#else
_getcwd (cwd, sizeof(cwd));
#endif
_snprintf (name, sizeof(name), "%s/%s/%s", cwd, debugdir, gamename);
snprintf (name, sizeof(name), "%s/%s/%s", cwd, debugdir, gamename);
game_library = LoadLibrary ( name );
if (game_library)
{
@ -119,7 +119,7 @@ void *Sys_GetGameAPI (void *parms)
path = COM_NextPath (path);
if (!path)
return NULL; // couldn't find one anywhere
_snprintf (name, sizeof(name), "%s/%s", path, gamename);
snprintf (name, sizeof(name), "%s/%s", path, gamename);
game_library = LoadLibrary (name);
if (game_library)
{
@ -176,7 +176,7 @@ int VARGS Sys_DebugLog(char *file, char *fmt, ...)
static char data[1024];
va_start(argptr, fmt);
_vsnprintf(data, sizeof(data)-1, fmt, argptr);
vsnprintf(data, sizeof(data)-1, fmt, argptr);
va_end(argptr);
#if defined(CRAZYDEBUGGING) && CRAZYDEBUGGING > 1
@ -368,6 +368,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
HANDLE r;
WIN32_FIND_DATA fd;
char apath[MAX_OSPATH];
char apath2[MAX_OSPATH];
char file[MAX_OSPATH];
char *s;
int go;
@ -386,16 +387,16 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
sprintf(file, "%s/*.*", apath);
//we need to make apath contain the path in match but not gpath
strcpy(apath, match);
Q_strncpyz(apath2, match, sizeof(apath));
match = s+1;
for (s = apath+strlen(apath)-1; s> apath; s--)
for (s = apath2+strlen(apath2)-1; s> apath2; s--)
{
if (*s == '/')
break;
}
*s = '\0';
if (s != apath)
strcat(apath, "/");
if (s != apath2)
strcat(apath2, "/");
r = FindFirstFile(file, &fd);
if (r==(HANDLE)-1)
@ -408,7 +409,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
{
if (wildcmp(match, fd.cFileName))
{
sprintf(file, "%s%s/", apath, fd.cFileName);
sprintf(file, "%s%s/", apath2, fd.cFileName);
go = func(file, fd.nFileSizeLow, parm);
}
}
@ -416,7 +417,7 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
{
if (wildcmp(match, fd.cFileName))
{
sprintf(file, "%s%s", apath, fd.cFileName);
sprintf(file, "%s%s", apath2, fd.cFileName);
go = func(file, fd.nFileSizeLow, parm);
}
}
@ -545,7 +546,7 @@ void VARGS Sys_Error (const char *error, ...)
// DWORD dummy;
va_start (argptr, error);
_vsnprintf (text, sizeof(text)-1, error, argptr);
vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
SetHookState(false);
@ -571,7 +572,7 @@ void VARGS Sys_Printf (char *fmt, ...)
return;
va_start (argptr,fmt);
_vsnprintf (text, sizeof(text)-1, fmt, argptr);
vsnprintf (text, sizeof(text), fmt, argptr);
va_end (argptr);
WriteFile (houtput, text, strlen(text), &dummy, NULL);
@ -1101,9 +1102,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (!GetCurrentDirectory (sizeof(cwd), cwd))
Sys_Error ("Couldn't determine current directory");
if (cwd[Q_strlen(cwd)-1] == '/' || cwd[Q_strlen(cwd)-1] == '\\')
cwd[Q_strlen(cwd)-1] = 0;
TL_InitLanguages();
//tprints are now allowed
@ -1233,12 +1231,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
#endif
{
// yield the CPU for a little while when paused, minimized, or not the focus
if (((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing) && !media_filmtype)
if (((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing) && !Media_PlayingFullScreen())
{
SleepUntilInput (PAUSE_SLEEP);
scr_skipupdate = 1; // no point in bothering to draw
}
else if (!ActiveApp && !DDActive && !media_filmtype)
else if (!ActiveApp && !DDActive && !Media_PlayingFullScreen())
{
SleepUntilInput (NOT_FOCUS_SLEEP);
}

View file

@ -87,7 +87,7 @@ cvar_t gl_cshiftpercent = SCVAR("gl_cshiftpercent", "100");
cvar_t v_bonusflash = SCVAR("v_bonusflash", "0");
cvar_t v_contentblend = SCVAR("v_contentblend", "0");
cvar_t v_contentblend = SCVARF("v_contentblend", "0", CVAR_ARCHIVE);
cvar_t v_damagecshift = SCVAR("v_damagecshift", "0");
cvar_t v_quadcshift = SCVAR("v_quadcshift", "0");
cvar_t v_suitcshift = SCVAR("v_suitcshift", "0");

View file

@ -488,7 +488,7 @@ void Cmd_Exec_f (void)
f = Cmd_Argv(1);
if (!*f)
f = "fte";
_snprintf(name, sizeof(name)-5, "configs/%s", f);
snprintf(name, sizeof(name)-5, "configs/%s", f);
COM_DefaultExtension(name, ".cfg");
}
else
@ -615,7 +615,7 @@ void Cmd_Alias_f (void)
{
if (Cmd_FromGamecode())
{
_snprintf(cmd, sizeof(cmd), "%s_a", s);
snprintf(cmd, sizeof(cmd), "%s_a", s);
Con_Printf ("Can't register alias, %s is a cvar\nAlias has been named %s instead\n", s, cmd);
s = cmd;
}
@ -631,7 +631,7 @@ void Cmd_Alias_f (void)
{
if (Cmd_FromGamecode())
{
_snprintf(cmd, sizeof(cmd), "%s_a", s);
snprintf(cmd, sizeof(cmd), "%s_a", s);
Con_Printf ("Can't register alias, %s is a command\nAlias has been named %s instead\n", s, cmd);
s = cmd;
}

View file

@ -164,11 +164,7 @@ void VARGS Q_snprintfz (char *dest, size_t size, char *fmt, ...)
va_list argptr;
va_start (argptr, fmt);
#ifdef _WIN32
_vsnprintf (dest, size, fmt, argptr);
#else
vsnprintf (dest, size, fmt, argptr);
#endif
va_end (argptr);
dest[size-1] = 0;
@ -2336,7 +2332,7 @@ char *VARGS va(char *format, ...)
bufnum &= (VA_BUFFERS-1);
va_start (argptr, format);
_vsnprintf (string[bufnum],sizeof(string[bufnum])-1, format,argptr);
vsnprintf (string[bufnum],sizeof(string[bufnum])-1, format,argptr);
va_end (argptr);
return string[bufnum];
@ -2669,7 +2665,7 @@ void Info_SetValueForStarKey (char *s, const char *key, const char *value, int m
if (!value || !strlen(value))
return;
_snprintf (newv, sizeof(newv), "\\%s\\%s", key, value);
snprintf (newv, sizeof(newv), "\\%s\\%s", key, value);
if ((int)(strlen(newv) + strlen(s) + 1) > maxsize)
{
@ -3068,3 +3064,40 @@ int build_number( void )
return b;
}
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...)
{
#undef _vsnprintf
int ret;
va_list argptr;
if (size <= 0)
return 0;
size--;
va_start (argptr, format);
ret = _vsnprintf (buffer,size, format,argptr);
va_end (argptr);
buffer[size] = '\0';
return ret;
}
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr)
{
#undef _vsnprintf
int ret;
if (size <= 0)
return 0;
size--;
ret = _vsnprintf (buffer,size, format,argptr);
buffer[size] = '\0';
return ret;
}

View file

@ -269,7 +269,8 @@ vfsfile_t *VFSOS_Open(char *osname, char *mode)
vfsfile_t *FSOS_OpenVFS(void *handle, flocation_t *loc, char *mode)
{
char diskname[MAX_OSPATH];
_snprintf(diskname, sizeof(diskname), "%s/%s", (char*)handle, loc->rawname);
snprintf(diskname, sizeof(diskname), "%s/%s", (char*)handle, loc->rawname);
return VFSOS_Open(diskname, mode);
}
@ -330,7 +331,7 @@ qboolean FSOS_FLocate(void *handle, flocation_t *loc, char *filename, void *hash
*/
// check a file in the directory tree
_snprintf (netpath, sizeof(netpath)-1, "%s/%s",(char*)handle, filename);
snprintf (netpath, sizeof(netpath)-1, "%s/%s",(char*)handle, filename);
f = fopen(netpath, "rb");
if (!f)
@ -450,7 +451,7 @@ qboolean FSPAK_FLocate(void *handle, flocation_t *loc, char *filename, void *has
if (loc)
{
loc->index = pf - pak->files;
_snprintf(loc->rawname, sizeof(loc->rawname), "%s/%s", pak->descname, filename);
snprintf(loc->rawname, sizeof(loc->rawname), "%s/%s", pak->descname, filename);
loc->offset = pf->filepos;
loc->len = pf->filelen;
}
@ -1606,9 +1607,9 @@ qboolean Sys_PathProtection(char *pattern)
if (strchr(pattern, '\\'))
{
char *s;
Con_Printf("Warning: \\ charactures in filename %s\n", pattern);
while((s = strchr(pattern, '\\')))
*s = '/';
Con_Printf("Warning: \\ charactures in filename %s\n", pattern);
}
if (strstr(pattern, ".."))
@ -1806,7 +1807,7 @@ vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto)
//blanket-bans
if (Sys_PathProtection(filename))
if (Sys_PathProtection(filename) )
return NULL;
@ -1819,38 +1820,38 @@ vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto)
case FS_GAMEONLY: //OS access only, no paks
if (*com_homedir)
{
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_homedir, gamedirfile, filename);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_homedir, gamedirfile, filename);
vfs = VFSOS_Open(fullname, mode);
if (vfs)
return vfs;
}
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_quakedir, gamedirfile, filename);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_quakedir, gamedirfile, filename);
return VFSOS_Open(fullname, mode);
case FS_GAME:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_homedir, gamedirfile, filename);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_homedir, gamedirfile, filename);
else
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_quakedir, gamedirfile, filename);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_quakedir, gamedirfile, filename);
break;
case FS_BASE:
if (*com_homedir)
{
_snprintf(fullname, sizeof(fullname), "%s/%s", com_homedir, filename);
snprintf(fullname, sizeof(fullname), "%s%s", com_homedir, filename);
vfs = VFSOS_Open(fullname, mode);
if (vfs)
return vfs;
}
_snprintf(fullname, sizeof(fullname), "%s/%s", com_quakedir, filename);
snprintf(fullname, sizeof(fullname), "%s%s", com_quakedir, filename);
return VFSOS_Open(fullname, mode);
case FS_CONFIGONLY:
if (*com_homedir)
{
_snprintf(fullname, sizeof(fullname), "%s/fte/%s", com_homedir, filename);
snprintf(fullname, sizeof(fullname), "%sfte/%s", com_homedir, filename);
vfs = VFSOS_Open(fullname, mode);
if (vfs)
return vfs;
}
_snprintf(fullname, sizeof(fullname), "%s/fte/%s", com_quakedir, filename);
snprintf(fullname, sizeof(fullname), "%sfte/%s", com_quakedir, filename);
return VFSOS_Open(fullname, mode);
default:
Sys_Error("FS_CreatePath: Bad relative path");
@ -1880,21 +1881,21 @@ int FS_Rename2(char *oldf, char *newf, int oldrelativeto, int newrelativeto)
{
case FS_GAME:
if (*com_homedir)
_snprintf(oldfullname, sizeof(oldfullname), "%s/%s/", com_homedir, gamedirfile);
snprintf(oldfullname, sizeof(oldfullname), "%s%s/", com_homedir, gamedirfile);
else
_snprintf(oldfullname, sizeof(oldfullname), "%s/%s/", com_quakedir, gamedirfile);
snprintf(oldfullname, sizeof(oldfullname), "%s%s/", com_quakedir, gamedirfile);
break;
case FS_SKINS:
if (*com_homedir)
_snprintf(oldfullname, sizeof(oldfullname), "%s/qw/skins/", com_homedir);
snprintf(oldfullname, sizeof(oldfullname), "%sqw/skins/", com_homedir);
else
_snprintf(oldfullname, sizeof(oldfullname), "%s/qw/skins/", com_quakedir);
snprintf(oldfullname, sizeof(oldfullname), "%sqw/skins/", com_quakedir);
break;
case FS_BASE:
if (*com_homedir)
_snprintf(oldfullname, sizeof(oldfullname), "%s/", com_homedir);
snprintf(oldfullname, sizeof(oldfullname), "%s", com_homedir);
else
_snprintf(oldfullname, sizeof(oldfullname), "%s/", com_quakedir);
snprintf(oldfullname, sizeof(oldfullname), "%s", com_quakedir);
break;
default:
Sys_Error("FS_Rename case not handled\n");
@ -1904,21 +1905,21 @@ int FS_Rename2(char *oldf, char *newf, int oldrelativeto, int newrelativeto)
{
case FS_GAME:
if (*com_homedir)
_snprintf(newfullname, sizeof(newfullname), "%s/%s/", com_homedir, gamedirfile);
snprintf(newfullname, sizeof(newfullname), "%s%s/", com_homedir, gamedirfile);
else
_snprintf(newfullname, sizeof(newfullname), "%s/%s/", com_quakedir, gamedirfile);
snprintf(newfullname, sizeof(newfullname), "%s%s/", com_quakedir, gamedirfile);
break;
case FS_SKINS:
if (*com_homedir)
_snprintf(newfullname, sizeof(newfullname), "%s/qw/skins/", com_homedir);
snprintf(newfullname, sizeof(newfullname), "%sqw/skins/", com_homedir);
else
_snprintf(newfullname, sizeof(newfullname), "%s/qw/skins/", com_quakedir);
snprintf(newfullname, sizeof(newfullname), "%sqw/skins/", com_quakedir);
break;
case FS_BASE:
if (*com_homedir)
_snprintf(newfullname, sizeof(newfullname), "%s/", com_homedir);
snprintf(newfullname, sizeof(newfullname), "%s", com_homedir);
else
_snprintf(newfullname, sizeof(newfullname), "%s/", com_quakedir);
snprintf(newfullname, sizeof(newfullname), "%s", com_quakedir);
break;
default:
Sys_Error("FS_Rename case not handled\n");
@ -1938,21 +1939,21 @@ int FS_Rename(char *oldf, char *newf, int relativeto)
{
case FS_GAME:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/%s/", com_homedir, gamedirfile);
snprintf(fullname, sizeof(fullname), "%s%s/", com_homedir, gamedirfile);
else
_snprintf(fullname, sizeof(fullname), "%s/%s/", com_quakedir, gamedirfile);
snprintf(fullname, sizeof(fullname), "%s%s/", com_quakedir, gamedirfile);
break;
case FS_SKINS:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/", com_homedir);
snprintf(fullname, sizeof(fullname), "%sqw/skins/", com_homedir);
else
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/", com_quakedir);
snprintf(fullname, sizeof(fullname), "%sqw/skins/", com_quakedir);
break;
case FS_BASE:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/", com_homedir);
snprintf(fullname, sizeof(fullname), "%s", com_homedir);
else
_snprintf(fullname, sizeof(fullname), "%s/", com_quakedir);
snprintf(fullname, sizeof(fullname), "%s", com_quakedir);
break;
default:
Sys_Error("FS_Rename case not handled\n");
@ -1967,21 +1968,21 @@ int FS_Remove(char *fname, int relativeto)
{
case FS_GAME:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_homedir, gamedirfile, fname);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_homedir, gamedirfile, fname);
else
_snprintf(fullname, sizeof(fullname), "%s/%s/%s", com_quakedir, gamedirfile, fname);
snprintf(fullname, sizeof(fullname), "%s%s/%s", com_quakedir, gamedirfile, fname);
break;
case FS_SKINS:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/%s", com_homedir, fname);
snprintf(fullname, sizeof(fullname), "%sqw/skins/%s", com_homedir, fname);
else
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/%s", com_quakedir, fname);
snprintf(fullname, sizeof(fullname), "%sqw/skins/%s", com_quakedir, fname);
break;
case FS_BASE:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/%s", com_homedir, fname);
snprintf(fullname, sizeof(fullname), "%s%s", com_homedir, fname);
else
_snprintf(fullname, sizeof(fullname), "%s/%s", com_quakedir, fname);
snprintf(fullname, sizeof(fullname), "%s%s", com_quakedir, fname);
break;
default:
Sys_Error("FS_Rename case not handled\n");
@ -1996,25 +1997,25 @@ void FS_CreatePath(char *pname, int relativeto)
{
case FS_GAMEONLY:
case FS_GAME:
_snprintf(fullname, sizeof(fullname), "%s/%s", com_gamedir, pname);
snprintf(fullname, sizeof(fullname), "%s%s", com_gamedir, pname);
break;
case FS_BASE:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/%s", com_homedir, pname);
snprintf(fullname, sizeof(fullname), "%s%s", com_homedir, pname);
else
_snprintf(fullname, sizeof(fullname), "%s/%s", com_quakedir, pname);
snprintf(fullname, sizeof(fullname), "%s%s", com_quakedir, pname);
break;
case FS_SKINS:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/%s", com_homedir, pname);
snprintf(fullname, sizeof(fullname), "%sqw/skins/%s", com_homedir, pname);
else
_snprintf(fullname, sizeof(fullname), "%s/qw/skins/%s", com_quakedir, pname);
snprintf(fullname, sizeof(fullname), "%sqw/skins/%s", com_quakedir, pname);
break;
case FS_CONFIGONLY:
if (*com_homedir)
_snprintf(fullname, sizeof(fullname), "%s/fte/%s", com_homedir, pname);
snprintf(fullname, sizeof(fullname), "%sfte/%s", com_homedir, pname);
else
_snprintf(fullname, sizeof(fullname), "%s/fte/%s", com_quakedir, pname);
snprintf(fullname, sizeof(fullname), "%sfte/%s", com_quakedir, pname);
break;
default:
Sys_Error("FS_CreatePath: Bad relative path");
@ -2540,10 +2541,10 @@ static void COM_AddDataFiles(char *pathto, searchpath_t *search, char *extension
for (i=0 ; ; i++)
{
_snprintf (pakfile, sizeof(pakfile), "pak%i.%s", i, extension);
snprintf (pakfile, sizeof(pakfile), "pak%i.%s", i, extension);
if (!search->funcs->FindFile(search->handle, &loc, pakfile, NULL))
break; //not found..
_snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", pathto, i, extension);
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", pathto, i, extension);
vfs = search->funcs->OpenVFS(search->handle, &loc, "r");
if (!vfs)
break;
@ -2551,7 +2552,7 @@ static void COM_AddDataFiles(char *pathto, searchpath_t *search, char *extension
handle = funcs->OpenNew (vfs, pakfile);
if (!handle)
break;
_snprintf (pakfile, sizeof(pakfile), "%spak%i.%s/", pathto, i, extension);
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s/", pathto, i, extension);
COM_AddPathHandle(pakfile, funcs, handle, true, false, (unsigned int)-1);
}
@ -2589,7 +2590,7 @@ void COM_AddGameDirectory (char *dir, unsigned int loadstuff)
if ((p = strrchr(dir, '/')) != NULL)
strcpy(gamedirfile, ++p);
else
strcpy(gamedirfile, p);
strcpy(gamedirfile, dir);
strcpy (com_gamedir, dir);
for (search = com_searchpaths; search; search = search->next)
@ -2722,9 +2723,9 @@ void COM_Gamedir (char *dir)
//
Cache_Flush ();
COM_AddGameDirectory(va("%s/%s", com_quakedir, dir), (unsigned int)-1);
COM_AddGameDirectory(va("%s%s", com_quakedir, dir), (unsigned int)-1);
if (*com_homedir)
COM_AddGameDirectory(va("%s/%s", com_homedir, dir), (unsigned int)-1);
COM_AddGameDirectory(va("%s%s", com_homedir, dir), (unsigned int)-1);
#ifndef SERVERONLY
@ -3018,6 +3019,17 @@ void COM_InitFilesystem (void)
else
strcpy (com_quakedir, host_parms.basedir);
if (*com_quakedir)
{
if (com_quakedir[strlen(com_quakedir)-1] == '\\')
com_quakedir[strlen(com_quakedir)-1] = '/';
else if (com_quakedir[strlen(com_quakedir)-1] != '/')
{
com_quakedir[strlen(com_quakedir)+1] = '\0';
com_quakedir[strlen(com_quakedir)] = '/';
}
}
Cvar_Register(&com_gamename, "evil hacks");
@ -3026,7 +3038,7 @@ void COM_InitFilesystem (void)
{
if (!gamemode_info[i].auniquefile)
continue; //no more
f = fopen(va("%s/%s", com_quakedir, gamemode_info[i].auniquefile), "rb");
f = fopen(va("%s%s", com_quakedir, gamemode_info[i].auniquefile), "rb");
if (f)
{
fclose(f);
@ -3088,9 +3100,8 @@ void COM_InitFilesystem (void)
if (*com_homedir)
{
strcat(com_homedir, "/.fte/");
Con_Printf("Using home directory \"%s\"\n", com_homedir);
strcat(com_homedir, "/.fte");
}
//
@ -3101,7 +3112,7 @@ void COM_InitFilesystem (void)
{
do //use multiple -basegames
{
COM_AddGameDirectory (va("%s/%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
i = COM_CheckNextParm ("-basegame", i);
}
@ -3110,17 +3121,17 @@ void COM_InitFilesystem (void)
else
{
if (gamemode_info[gamenum].dir1)
COM_AddGameDirectory (va("%s/%s", com_quakedir, gamemode_info[gamenum].dir1), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir1), (unsigned int)-1);
if (gamemode_info[gamenum].dir2)
COM_AddGameDirectory (va("%s/%s", com_quakedir, gamemode_info[gamenum].dir2), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir2), (unsigned int)-1);
if (gamemode_info[gamenum].dir3)
COM_AddGameDirectory (va("%s/%s", com_quakedir, gamemode_info[gamenum].dir3), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir3), (unsigned int)-1);
if (gamemode_info[gamenum].dir4)
COM_AddGameDirectory (va("%s/%s", com_quakedir, gamemode_info[gamenum].dir4), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, gamemode_info[gamenum].dir4), (unsigned int)-1);
}
if (*com_homedir)
COM_AddGameDirectory (va("%s/fte", com_homedir), (unsigned int)-1);
COM_AddGameDirectory (va("%sfte", com_homedir), (unsigned int)-1);
// any set gamedirs will be freed up to here
com_base_searchpaths = com_searchpaths;
@ -3128,7 +3139,7 @@ void COM_InitFilesystem (void)
i = COM_CheckParm ("-game"); //effectivly replace with +gamedir x (But overridable)
if (i && i < com_argc-1)
{
COM_AddGameDirectory (va("%s/%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
COM_AddGameDirectory (va("%s%s", com_quakedir, com_argv[i+1]), (unsigned int)-1);
#ifndef CLIENTONLY
Info_SetValueForStarKey (svs.info, "*gamedir", com_argv[i+1], MAX_SERVERINFO_STRING);

View file

@ -45,6 +45,8 @@ void SWMod_LoadLighting (lump_t *l);
void Q2BSP_SetHullFuncs(hull_t *hull);
qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, trace_t *trace);
qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int contents, trace_t *trace);
unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs);
unsigned int Q2BSP_PointContents(model_t *mod, vec3_t p);
qbyte areabits[MAX_Q2MAP_AREAS/8];
@ -1243,7 +1245,7 @@ void CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place
if (*lwr >= 'A' && *lwr <= 'Z')
*lwr = *lwr - 'A' + 'a';
}
_snprintf (name, sizeof(name), "textures/%s.wal", in->texture);
snprintf (name, sizeof(name), "textures/%s.wal", in->texture);
out->texture = Mod_LoadWall (name);
if (!out->texture || !out->texture->width || !out->texture->height)
@ -3621,6 +3623,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
#endif
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
#ifndef SERVERONLY
//light grid info
@ -3707,6 +3711,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
break;
#if defined(RGLQUAKE)
@ -3747,6 +3753,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
break;
#endif
#if defined(SWQUAKE)
@ -3787,6 +3795,8 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
loadmodel->funcs.Trace = CM_Trace;
loadmodel->funcs.PointContents = Q2BSP_PointContents;
loadmodel->funcs.NativeTrace = CM_NativeTrace;
loadmodel->funcs.NativeContents = CM_NativeContents;
break;
#endif
default:
@ -4055,6 +4065,8 @@ void CM_SetTempboxSize (vec3_t mins, vec3_t maxs)
model_t *CM_TempBoxModel(vec3_t mins, vec3_t maxs)
{
if (box_planes == NULL)
CM_InitBoxHull();
CM_SetTempboxSize(mins, maxs);
return &box_model;
}
@ -4227,6 +4239,61 @@ int CM_PointContents (model_t *mod, vec3_t p)
return contents;
}
unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs)
{
int contents;
if (!DotProduct(mins, mins) && !DotProduct(maxs, maxs))
return CM_PointContents(model, p);
if (!model) // map not loaded
return 0;
{
int i, j, k;
mleaf_t *leaf;
q2cbrush_t *brush;
q2cbrushside_t *brushside;
vec3_t absmin, absmax;
int leaflist[64];
k = CM_BoxLeafnums (model, absmin, absmax, leaflist, 64, NULL);
contents = 0;
for (k--; k >= 0; k--)
{
leaf = &map_leafs[leaflist[k]];
if (mapisq3)
{
for (i = 0; i < leaf->numleafbrushes; i++)
{
brush = &map_brushes[map_leafbrushes[leaf->firstleafbrush + i]];
// check if brush actually adds something to contents
if ( (contents & brush->contents) == brush->contents ) {
continue;
}
brushside = &map_brushsides[brush->firstbrushside];
for ( j = 0; j < brush->numsides; j++, brushside++ )
{
if ( PlaneDiff (p, brushside->plane) > 0 )
break;
}
if (j == brush->numsides)
contents |= brush->contents;
}
}
else
contents |= leaf->contents;
}
}
return contents;
}
/*
==================
CM_TransformedPointContents
@ -5020,6 +5087,11 @@ qboolean CM_Trace(model_t *model, int forcehullnum, int frame, vec3_t start, vec
*trace = CM_BoxTrace(model, start, end, mins, maxs, MASK_PLAYERSOLID);
return trace->fraction != 1;
}
qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int contents, trace_t *trace)
{
*trace = CM_BoxTrace(model, start, end, mins, maxs, contents);
return trace->fraction != 1;
}
/*
==================

View file

@ -182,14 +182,14 @@ void Con_Log (char *s)
i = log_rotate_files.value;
// unlink file at the top of the chain
_snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, i);
snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, i);
FS_Remove(oldf, FS_BASE);
// rename files through chain
for (x = i-1; x > 0; x--)
{
strcpy(newf, oldf);
_snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, x);
snprintf(oldf, sizeof(oldf)-1, "%s.%i", f, x);
// check if file exists, otherwise skip
if ((fi = FS_OpenVFS(f, "rb", FS_BASE)))

View file

@ -146,7 +146,7 @@ void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ..
static char string[8192]; // ??? why static?
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
@ -163,7 +163,7 @@ void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language,
string[0] = A2C_PRINT;
va_start (argptr, text);
_vsnprintf (string+1,sizeof(string)-2, format,argptr);
vsnprintf (string+1,sizeof(string)-1, format,argptr);
va_end (argptr);

View file

@ -87,7 +87,7 @@ void *Sys_LoadDLL(const char *name, void **vmMain, sys_calldll_t syscall)
gpath = COM_NextPath (gpath);
if (!gpath)
return NULL; // couldn't find one anywhere
_snprintf (name, sizeof(name), "%s/%s", gpath, dllname);
snprintf (name, sizeof(name), "%s/%s", gpath, dllname);
hVM = LoadLibrary (name);
if (hVM)
{

View file

@ -232,7 +232,7 @@ static char *defaultlanguagetext =
"TLC_CONNECTFIRST \"Must be connected.\\n\"\n"
"TLC_SYNTAX_DOWNLOAD \"Usage: download <datafile>\\n\"\n"
"TLC_REQUIRESSERVERMOD \"%s is only available with server support\\n\"\n"
"TLC_CLIENTCON_ERROR_ENDGAME \"Host_EndGame: %s\\n\"\n"
"TLC_CLIENTCON_ERROR_ENDGAME \"Host_EndGame: "S_ERROR"%s\\n\"\n"
"TLC_HOSTFATALERROR \"Host_Error: %s\\n\"\n"
"TLC_CONFIGCFG_WRITEFAILED \"Couldn't write config.cfg.\\n\"\n"
"TLC_HOSTSPEEDSOUTPUT \"%3i tot %3i server %3i gfx %3i snd\\n\"\n"

View file

@ -147,7 +147,7 @@ typedef enum {
UI_CVAR_RESET,
UI_CVAR_CREATE,
UI_CVAR_INFOSTRINGBUFFER,
UI_ARGC,
UI_ARGC,//10
UI_ARGV,
UI_CMD_EXECUTETEXT,
UI_FS_FOPENFILE,
@ -157,7 +157,7 @@ typedef enum {
UI_FS_GETFILELIST,
UI_R_REGISTERMODEL,
UI_R_REGISTERSKIN,
UI_R_REGISTERSHADERNOMIP,
UI_R_REGISTERSHADERNOMIP,//20
UI_R_CLEARSCENE,
UI_R_ADDREFENTITYTOSCENE,
UI_R_ADDPOLYTOSCENE,
@ -167,7 +167,7 @@ typedef enum {
UI_R_DRAWSTRETCHPIC,
UI_UPDATESCREEN,
UI_CM_LERPTAG,
UI_CM_LOADMODEL,
UI_CM_LOADMODEL,//30
UI_S_REGISTERSOUND,
UI_S_STARTLOCALSOUND,
UI_KEY_KEYNUMTOSTRINGBUF,
@ -177,7 +177,7 @@ typedef enum {
UI_KEY_GETOVERSTRIKEMODE,
UI_KEY_SETOVERSTRIKEMODE,
UI_KEY_CLEARSTATES,
UI_KEY_GETCATCHER,
UI_KEY_GETCATCHER,//40
UI_KEY_SETCATCHER,
UI_GETCLIPBOARDDATA,
UI_GETGLCONFIG,
@ -187,7 +187,7 @@ typedef enum {
UI_LAN_CLEARPING,
UI_LAN_GETPING,
UI_LAN_GETPINGINFO,
UI_CVAR_REGISTER,
UI_CVAR_REGISTER,//50
UI_CVAR_UPDATE,
UI_MEMORY_REMAINING,
UI_GET_CDKEY,
@ -197,7 +197,7 @@ typedef enum {
UI_PC_ADD_GLOBAL_DEFINE,
UI_PC_LOAD_SOURCE,
UI_PC_FREE_SOURCE,
UI_PC_READ_TOKEN,
UI_PC_READ_TOKEN,//60
UI_PC_SOURCE_FILE_AND_LINE,
UI_S_STOPBACKGROUNDTRACK,
UI_S_STARTBACKGROUNDTRACK,
@ -207,7 +207,7 @@ typedef enum {
UI_LAN_GETSERVERINFO,
UI_LAN_MARKSERVERVISIBLE,
UI_LAN_UPDATEVISIBLEPINGS,
UI_LAN_RESETPINGS,
UI_LAN_RESETPINGS,//70
UI_LAN_LOADCACHEDSERVERS,
UI_LAN_SAVECACHEDSERVERS,
UI_LAN_ADDSERVER,
@ -217,7 +217,7 @@ typedef enum {
UI_CIN_RUNCINEMATIC,
UI_CIN_DRAWCINEMATIC,
UI_CIN_SETEXTENTS,
UI_R_REMAP_SHADER,
UI_R_REMAP_SHADER,//80
UI_VERIFY_CDKEY,
UI_LAN_SERVERSTATUS,
UI_LAN_GETSERVERPING,
@ -225,7 +225,7 @@ typedef enum {
UI_LAN_COMPARESERVERS,
// 1.32
UI_FS_SEEK,
UI_SET_PBCLSTATUS,
UI_SET_PBCLSTATUS,//87
UI_MEMSET = 100,
UI_MEMCPY,

View file

@ -3066,6 +3066,8 @@ SOURCE=..\gl\gl_bloom.c
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"

View file

@ -1050,12 +1050,12 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur
if (e->scoreboard && e->scoreboard->skin && !gl_nocolors.value)
{
sprintf(hashname, "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum);
snprintf(hashname, sizeof(hashname), "%s$%s$%i", modelname, e->scoreboard->skin->name, surfnum);
skinname = hashname;
}
else if (surfnum)
{
sprintf(hashname, "%s$%i", modelname, surfnum);
snprintf(hashname, sizeof(hashname), "%s$%i", modelname, surfnum);
skinname = hashname;
}
else
@ -2787,7 +2787,7 @@ static qboolean VARGS TryAddSkin(char *skinname, ...)
va_start (argptr, skinname);
_vsnprintf (string,sizeof(string)-1, skinname,argptr);
vsnprintf (string,sizeof(string)-1, skinname,argptr);
va_end (argptr);
string[MAX_QPATH-1] = '\0';
@ -2979,7 +2979,6 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
vec3_t *verts;
frame = (galiasgroup_t*)((char *)galias + galias->groupofs);
frame->loop = true;
for (i = 0; i < pq1inmodel->numframes; i++)
{
@ -3029,6 +3028,7 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
pose = (galiaspose_t *)Hunk_Alloc(LittleLong(ingroup->numframes)*(sizeof(galiaspose_t) + sizeof(vec3_t)*2*galias->numverts));
frame->poseofs = (char *)pose - (char *)frame;
frame->numposes = LittleLong(ingroup->numframes);
frame->loop = true;
galias->groups++;
verts = (vec3_t *)(pose+frame->numposes);
@ -3143,30 +3143,30 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
//LH's naming scheme ("models" is likly to be ignored)
fbtexture = 0;
bumptexture = 0;
_snprintf(skinname, sizeof(skinname), "%s_%i.", loadmodel->name, i);
snprintf(skinname, sizeof(skinname), "%s_%i.", loadmodel->name, i);
texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
if (texture)
{
_snprintf(skinname, sizeof(skinname), "%s_%i_luma.", loadmodel->name, i);
snprintf(skinname, sizeof(skinname), "%s_%i_luma.", loadmodel->name, i);
fbtexture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
if (gl_bump.value)
{
sprintf(skinname, "%s_%i_bump", loadmodel->name, i);
snprintf(skinname, sizeof(skinname), "%s_%i_bump", loadmodel->name, i);
bumptexture = Mod_LoadBumpmapTexture(skinname, "models");
}
}
else
{
sprintf(skinname, "%s_%i", loadname, i);
snprintf(skinname, sizeof(skinname), "%s_%i", loadname, i);
texture = Mod_LoadReplacementTexture(skinname, "models", true, false, true);
if (texture && r_fb_models.value)
{
sprintf(skinname, "%s_%i_luma", loadname, i);
snprintf(skinname, sizeof(skinname), "%s_%i_luma", loadname, i);
fbtexture = Mod_LoadReplacementTexture(skinname, "models", true, true, true);
}
if (texture && gl_bump.value)
{
sprintf(skinname, "%s_%i_bump", loadname, i);
snprintf(skinname, sizeof(skinname), "%s_%i_bump", loadname, i);
bumptexture = Mod_LoadBumpmapTexture(skinname, "models");
}
}
@ -3182,16 +3182,16 @@ static void *Q1_LoadSkins (daliasskintype_t *pskintype, qboolean alpha)
GLMod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight);
//the extra underscore is to stop
sprintf(skinname, "%s__%i", loadname, i);
snprintf(skinname, sizeof(skinname), "%s__%i", loadname, i);
texture = GL_LoadTexture(skinname, outskin->skinwidth, outskin->skinheight, saved, true, alpha);
if (r_fb_models.value)
{
sprintf(skinname, "%s__%i_luma", loadname, i);
snprintf(skinname, sizeof(skinname), "%s__%i_luma", loadname, i);
fbtexture = GL_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true);
}
if (gl_bump.value)
{
sprintf(skinname, "%s__%i_bump", loadname, i);
snprintf(skinname, sizeof(skinname), "%s__%i_bump", loadname, i);
bumptexture = GL_LoadTexture8Bump(skinname, outskin->skinwidth, outskin->skinheight, saved, true, true);
}
}
@ -4245,7 +4245,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
pose->scale_origin[1] = 0;
pose->scale_origin[2] = 0;
_snprintf(group->name, sizeof(group->name)-1, "frame%i", i);
snprintf(group->name, sizeof(group->name)-1, "frame%i", i);
group->numposes = 1;
group->rate = 1;

View file

@ -1123,7 +1123,7 @@ void R_VertexTCBase ( int tcgen, int unit )
}
else if ( tcgen == TC_GEN_ENVIRONMENT )
{
RB_CalcEnvironmentTexCoords(outCoords); //use genuine q3 code, to get it totally identical
RB_CalcEnvironmentTexCoords(outCoords); //use genuine q3 code, to get it totally identical (for cell shading effects)
//plus, it looks like less overhead too
//I guess it depends on the size of the mesh
/*
@ -1196,7 +1196,7 @@ R_ShaderpassTex
*/
int R_ShaderpassTex ( shaderpass_t *pass )
{
if (pass->flags & (SHADER_PASS_ANIMMAP|SHADER_PASS_LIGHTMAP|SHADER_PASS_DELUXMAP))
if (pass->flags & (SHADER_PASS_ANIMMAP|SHADER_PASS_LIGHTMAP|SHADER_PASS_VIDEOMAP|SHADER_PASS_DELUXMAP))
{
if ( pass->flags & SHADER_PASS_ANIMMAP ) {
return pass->anim_frames[(int)(pass->anim_fps * r_localShaderTime) % pass->anim_numframes];
@ -1207,7 +1207,11 @@ int R_ShaderpassTex ( shaderpass_t *pass )
}
else if ( (pass->flags & SHADER_PASS_DELUXMAP) && r_lmtex >= 0 )
{
return deluxmap_textures[r_lmtex];
return lightmap_textures[r_lmtex+1];
}
else if ( (pass->flags & SHADER_PASS_VIDEOMAP))
{
return Media_UpdateForShader(pass->anim_frames[0], pass->cin);
}
}
@ -1887,6 +1891,13 @@ void R_RenderMeshCombined ( meshbuffer_t *mb, shaderpass_t *pass )
{
switch ( pass->blendmode )
{
case GL_DOT3_RGB_ARB:
GL_TexEnv (GL_COMBINE_EXT);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, pass->blendmode);
break;
case GL_REPLACE:
case GL_MODULATE:
case GL_ADD:

View file

@ -62,7 +62,7 @@ static float Diamond4x[4][4] = {
static int BLOOM_SIZE;
cvar_t r_bloom = FCVAR("r_bloom", "gl_bloom", "0", 0);
cvar_t r_bloom = FCVAR("r_bloom", "gl_bloom", "0", CVAR_ARCHIVE);
cvar_t r_bloom_alpha = SCVAR("r_bloom_alpha", "0.5");
cvar_t r_bloom_diamond_size = SCVAR("r_bloom_diamond_size", "8");
cvar_t r_bloom_intensity = SCVAR("r_bloom_intensity", "1");

View file

@ -194,7 +194,7 @@ void Scrap_Upload (void)
{
scrap_uploads++;
GL_Bind(scrap_texnum);
GL_Upload8 (scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, true);
GL_Upload8 ("scrap", scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, true);
scrap_dirty = false;
}
@ -357,15 +357,13 @@ mpic_t *GLDraw_SafeCachePic (char *path)
if (glmenu_numcachepics == MAX_CACHED_PICS)
Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
//
// load the pic from disk
//
{
char *mem;
char alternatename[MAX_QPATH];
_snprintf(alternatename, MAX_QPATH-1, "pics/%s.pcx", path);
snprintf(alternatename, sizeof(alternatename), "pics/%s.pcx", path);
data = COM_LoadMallocFile (alternatename);
if (data)
{
@ -393,7 +391,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
{
char *mem;
char alternatename[MAX_QPATH];
_snprintf(alternatename, MAX_QPATH-1, "%s", path);
snprintf(alternatename, MAX_QPATH-1, "%s", path);
data = COM_LoadMallocFile (alternatename);
if (data)
{
@ -435,7 +433,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
{
char *mem;
char alternatename[MAX_QPATH];
_snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path);
snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path);
data = COM_LoadMallocFile (alternatename);
if (data)
{
@ -2422,6 +2420,16 @@ void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight)
dest = uploadmemorybufferintermediate;
//change from bgr bottomup to rgba topdown
for (filmnwidth = 1; filmnwidth < inwidth; filmnwidth*=2)
;
for (filmnheight = 1; filmnheight < inheight; filmnheight*=2)
;
if (filmnwidth > 512)
filmnwidth = 512;
if (filmnheight > 512)
filmnheight = 512;
if (inwidth*inheight > sizeofuploadmemorybufferintermediate/4)
Sys_Error("MediaGL_ShowFrameBGR_24_Flip: image too big (%i*%i)", inwidth, inheight);
@ -3122,6 +3130,154 @@ done:
}
}
void GL_Upload24BGR (char *name, qbyte *framedata, int inwidth, int inheight, qboolean mipmap, qboolean alpha)
{
int outwidth, outheight;
int y, x;
int v;
unsigned int f, fstep;
qbyte *src, *dest;
dest = uploadmemorybufferintermediate;
//change from bgr bottomup to rgba topdown
for (outwidth = 1; outwidth < inwidth; outwidth*=2)
;
for (outheight = 1; outheight < inheight; outheight*=2)
;
if (outwidth > 512)
outwidth = 512;
if (outheight > 512)
outheight = 512;
if (outwidth*outheight > sizeofuploadmemorybufferintermediate/4)
Sys_Error("MediaGL_ShowFrameBGR_24_Flip: image too big (%i*%i)", inwidth, inheight);
for (y=0 ; y<outheight ; y++)
{
v = (y*(float)inheight/outheight);
src = framedata + v*(inwidth*3);
{
f = 0;
fstep = ((inwidth)*0x10000)/outwidth;
for (x=outwidth ; x&3 ; x--) //do the odd ones first. (bigger condition)
{
*dest++ = src[(f>>16)*3+2];
*dest++ = src[(f>>16)*3+1];
*dest++ = src[(f>>16)*3+0];
*dest++ = 255;
f += fstep;
}
for ( ; x ; x-=4) //loop through the remaining chunks.
{
dest[0] = src[(f>>16)*3+2];
dest[1] = src[(f>>16)*3+1];
dest[2] = src[(f>>16)*3+0];
dest[3] = 255;
f += fstep;
dest[4] = src[(f>>16)*3+2];
dest[5] = src[(f>>16)*3+1];
dest[6] = src[(f>>16)*3+0];
dest[7] = 255;
f += fstep;
dest[8] = src[(f>>16)*3+2];
dest[9] = src[(f>>16)*3+1];
dest[10] = src[(f>>16)*3+0];
dest[11] = 255;
f += fstep;
dest[12] = src[(f>>16)*3+2];
dest[13] = src[(f>>16)*3+1];
dest[14] = src[(f>>16)*3+0];
dest[15] = 255;
f += fstep;
dest += 16;
}
}
}
GL_Upload32 (name, (unsigned int*)uploadmemorybufferintermediate, outwidth, outheight, mipmap, alpha);
}
void GL_Upload24BGR_Flip (char *name, qbyte *framedata, int inwidth, int inheight, qboolean mipmap, qboolean alpha)
{
int outwidth, outheight;
int y, x;
int v;
unsigned int f, fstep;
qbyte *src, *dest;
dest = uploadmemorybufferintermediate;
//change from bgr bottomup to rgba topdown
for (outwidth = 1; outwidth < inwidth; outwidth*=2)
;
for (outheight = 1; outheight < inheight; outheight*=2)
;
if (outwidth > 512)
outwidth = 512;
if (outheight > 512)
outheight = 512;
if (outwidth*outheight > sizeofuploadmemorybufferintermediate/4)
Sys_Error("MediaGL_ShowFrameBGR_24_Flip: image too big (%i*%i)", inwidth, inheight);
for (y=1 ; y<=outheight ; y++)
{
v = ((outheight - y)*(float)inheight/outheight);
src = framedata + v*(inwidth*3);
{
f = 0;
fstep = ((inwidth)*0x10000)/outwidth;
for (x=outwidth ; x&3 ; x--) //do the odd ones first. (bigger condition)
{
*dest++ = src[(f>>16)*3+2];
*dest++ = src[(f>>16)*3+1];
*dest++ = src[(f>>16)*3+0];
*dest++ = 255;
f += fstep;
}
for ( ; x ; x-=4) //loop through the remaining chunks.
{
dest[0] = src[(f>>16)*3+2];
dest[1] = src[(f>>16)*3+1];
dest[2] = src[(f>>16)*3+0];
dest[3] = 255;
f += fstep;
dest[4] = src[(f>>16)*3+2];
dest[5] = src[(f>>16)*3+1];
dest[6] = src[(f>>16)*3+0];
dest[7] = 255;
f += fstep;
dest[8] = src[(f>>16)*3+2];
dest[9] = src[(f>>16)*3+1];
dest[10] = src[(f>>16)*3+0];
dest[11] = 255;
f += fstep;
dest[12] = src[(f>>16)*3+2];
dest[13] = src[(f>>16)*3+1];
dest[14] = src[(f>>16)*3+0];
dest[15] = 255;
f += fstep;
dest += 16;
}
}
}
GL_Upload32 (name, (unsigned int*)uploadmemorybufferintermediate, outwidth, outheight, mipmap, alpha);
}
void GL_Upload8Grey (unsigned char*data, int width, int height, qboolean mipmap)
{
int samples;
@ -3486,7 +3642,7 @@ unsigned ColorPercent[16] =
25, 51, 76, 102, 114, 127, 140, 153, 165, 178, 191, 204, 216, 229, 237, 247
};
void GL_Upload8 (qbyte *data, int width, int height, qboolean mipmap, qboolean alpha)
void GL_Upload8 (char *name, qbyte *data, int width, int height, qboolean mipmap, qboolean alpha)
{
unsigned *trans = (unsigned *)uploadmemorybufferintermediate;
int i, s;
@ -3583,7 +3739,7 @@ void GL_Upload8 (qbyte *data, int width, int height, qboolean mipmap, qboolean
#endif
#endif
GL_Upload32 (NULL, trans, width, height, mipmap, alpha);
GL_Upload32 (name, trans, width, height, mipmap, alpha);
}
void GL_Upload8FB (qbyte *data, int width, int height, qboolean mipmap)
@ -3753,7 +3909,7 @@ TRACE(("dbg: GL_LoadTexture: new %s\n", identifier));
GL_Bind(texture_extension_number );
GL_Upload8 (data, width, height, mipmap, alpha);
GL_Upload8 ("8bit", data, width, height, mipmap, alpha);
texture_extension_number++;
@ -3932,7 +4088,7 @@ int GL_LoadCompressed(char *name)
return 0;
_snprintf(inname, sizeof(inname)-1, "tex/%s.tex", name);
snprintf(inname, sizeof(inname)-1, "tex/%s.tex", name);
file = COM_LoadFile(inname, 5);
if (!file)
return 0;

View file

@ -51,3 +51,5 @@ void GLDraw_LevelPic (mpic_t *pic);
void GLDraw_ImageColours(float r, float g, float b, float a);
void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic);
void R_BloomRegister(void);

View file

@ -10,7 +10,7 @@
//it's built into 16 seperate display lists, these display lists are individually culled, but the drivers are expected to optimise them too.
//Tei claims 14x speedup with a single display list. hopefully we can achieve the same speed by culling per-texture.
//we get 20->130
//perhaps we should build it with multitexture?
//perhaps we should build it with multitexture? (no - slower on ati)
#define SECTIONS 8
@ -29,7 +29,7 @@ typedef struct {
#define DISPLISTS
//#define MULTITEXTURE //ATI suck. I don't know about anyone else.
//#define MULTITEXTURE //ATI suck. I don't know about anyone else (this goes at 1/5th the speed).
void GL_DrawHeightmapModel (entity_t *e)
{
@ -45,17 +45,18 @@ void GL_DrawHeightmapModel (entity_t *e)
model_t *m = e->model;
heightmap_t *hm = m->terrain;
qglColor4f(1, 1, 1, 1);
if (e->model == cl.worldmodel)
{
qglColor4f(1, 1, 1, 1);
R_ClearSkyBox();
R_ForceSkyBox();
R_DrawSkyBox(NULL);
}
else
qglColor4fv(e->shaderRGBAf);
qglEnable(GL_CULL_FACE);
qglColor4fv(e->shaderRGBAf);
for (x = 0; x < hm->numsegs; x++)
{
mins[0] = (x+0)*hm->terrainscale*hm->terrainsize/hm->numsegs;
@ -273,6 +274,11 @@ unsigned int Heightmap_PointContents(model_t *model, vec3_t org)
heightmap_t *hm = model->terrain;
return Heightmap_PointContentsHM(hm, 0, org);
}
unsigned int Heightmap_NativeBoxContents(model_t *model, int hulloverride, int frame, vec3_t org, vec3_t mins, vec3_t maxs)
{
heightmap_t *hm = model->terrain;
return Heightmap_PointContentsHM(hm, mins[2], org);
}
void Heightmap_Normal(heightmap_t *hm, vec3_t org, vec3_t norm)
{
@ -568,6 +574,11 @@ qboolean Heightmap_Trace(model_t *model, int forcehullnum, int frame, vec3_t sta
return trace->fraction != 1;
}
qboolean Heightmap_NativeTrace(struct model_s *model, int hulloverride, int frame, vec3_t p1, vec3_t p2, vec3_t mins, vec3_t maxs, unsigned int against, struct trace_s *trace)
{
return Heightmap_Trace(model, hulloverride, frame, p1, p2, mins, maxs, trace);
}
#endif
void Heightmap_FatPVS (model_t *mod, vec3_t org, qboolean add)
{
@ -602,6 +613,8 @@ int Heightmap_LeafForPoint (model_t *model, vec3_t point)
return 0;
}
//Heightmap_NativeBoxContents
void GL_LoadHeightmapModel (model_t *mod, void *buffer)
{
heightmap_t *hm;
@ -744,6 +757,10 @@ void GL_LoadHeightmapModel (model_t *mod, void *buffer)
mod->funcs.Trace = Heightmap_Trace;
mod->funcs.PointContents = Heightmap_PointContents;
mod->funcs.NativeContents = Heightmap_NativeBoxContents;
mod->funcs.NativeTrace = Heightmap_NativeTrace;
mod->funcs.LightPointValues = Heightmap_LightPointValues;
mod->funcs.StainNode = Heightmap_StainNode;
mod->funcs.MarkLights = Heightmap_MarkLights;

View file

@ -953,7 +953,7 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
if (r_fb_bmodels.value)
{
_snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name);
snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name);
if (gl_load24bit.value)
{
tx->gl_texturenumfb = Mod_LoadReplacementTexture(altname, loadname, true, false, true);
@ -971,7 +971,7 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
extern cvar_t gl_bump;
if (gl_bump.value<2) //set to 2 to have faster loading.
{
_snprintf(altname, sizeof(altname)-1, "%s_norm", mt->name);
snprintf(altname, sizeof(altname)-1, "%s_norm", mt->name);
tx->gl_texturenumbumpmap = Mod_LoadHiResTexture(altname, loadname, true, false, false);
if (!tx->gl_texturenumbumpmap)
tx->gl_texturenumbumpmap = Mod_LoadHiResTexture(altname, "bmodels", true, false, false);
@ -980,13 +980,13 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
{
if (gl_load24bit.value)
{
_snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(altname, loadname);
if (!tx->gl_texturenumbumpmap)
tx->gl_texturenumbumpmap = Mod_LoadBumpmapTexture(altname, "bmodels");
}
else
_snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
snprintf(altname, sizeof(altname)-1, "%s_bump", mt->name);
}
if (!(tx->gl_texturenumbumpmap) && loadmodel->fromgame != fg_halflife)
@ -1001,7 +1001,7 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
//don't do any complex quake 8bit -> glossmap. It would likly look a little ugly...
if (gl_specular.value && gl_load24bit.value)
{
_snprintf(altname, sizeof(altname)-1, "%s_gloss", mt->name);
snprintf(altname, sizeof(altname)-1, "%s_gloss", mt->name);
tx->gl_texturenumspec = Mod_LoadHiResTexture(altname, loadname, true, false, false);
if (!tx->gl_texturenumspec)
tx->gl_texturenumspec = Mod_LoadHiResTexture(altname, "bmodels", true, false, false);

View file

@ -35,9 +35,14 @@ typedef struct {
} hullfuncs_t;
typedef struct {
//deals with FTECONTENTS (assumes against solid)
qboolean (*Trace) (struct model_s *model, int hulloverride, int frame, vec3_t p1, vec3_t p2, vec3_t mins, vec3_t maxs, struct trace_s *trace);
qboolean (*PointContents) (struct model_s *model, vec3_t p);
qboolean (*BoxContents) (struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs);
unsigned int (*PointContents) (struct model_s *model, vec3_t p);
unsigned int (*BoxContents) (struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs);
//deals with whatever is native for the bsp (gamecode is expected to distinguish this).
qboolean (*NativeTrace) (struct model_s *model, int hulloverride, int frame, vec3_t p1, vec3_t p2, vec3_t mins, vec3_t maxs, unsigned int against, struct trace_s *trace);
unsigned int (*NativeContents)(struct model_s *model, int hulloverride, int frame, vec3_t p, vec3_t mins, vec3_t maxs);
void (*FatPVS) (struct model_s *model, vec3_t org, qboolean add);
qboolean (*EdictInFatPVS) (struct model_s *model, struct edict_s *edict);
@ -833,6 +838,8 @@ qbyte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#ifdef Q2BSPS
void CM_InitBoxHull (void);
#ifdef __cplusplus
//#pragma message (" c++ stinks")
#else

View file

@ -1622,7 +1622,7 @@ void R_RenderScene (void)
{
qboolean GLR_DoomWorld(void);
if (!cl.worldmodel || !cl.worldmodel->nodes)
if (!cl.worldmodel || (!cl.worldmodel->nodes && cl.worldmodel->type != mod_heightmap))
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
GLR_SetupFrame ();

View file

@ -42,7 +42,7 @@ extern int missing_texture;
cvar_t r_vertexlight = SCVAR("r_vertexlight", "0");
#define Q_stricmp stricmp
#define Com_sprintf _snprintf
#define Com_sprintf snprintf
#define clamp(v,min, max) (v) = (((v)<(min))?(min):(((v)>(max))?(max):(v)));
int FS_LoadFile(char *name, void **file)
@ -583,7 +583,7 @@ static void Shaderpass_Map ( shader_t *shader, shaderpass_t *pass, char **ptr )
pass->anim_frames[0] = Shader_FindImage ( token, flags );
if ( !pass->anim_frames[0] ) {
pass->anim_frames[0] = 0;//FIZME: r_notexture;
pass->anim_frames[0] = missing_texture;
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", shader->name, token );
}
}
@ -612,7 +612,7 @@ static void Shaderpass_AnimMap ( shader_t *shader, shaderpass_t *pass, char **pt
image = Shader_FindImage ( token, flags );
if ( !image ) {
pass->anim_frames[pass->anim_numframes++] = 0;//fizme: r_notexture;
pass->anim_frames[pass->anim_numframes++] = missing_texture;
Con_DPrintf (S_WARNING "Shader %s has an animmap with no image: %s.\n", shader->name, token );
} else {
pass->anim_frames[pass->anim_numframes++] = image;
@ -636,26 +636,27 @@ static void Shaderpass_ClampMap ( shader_t *shader, shaderpass_t *pass, char **p
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
if ( !pass->anim_frames[0] ) {
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", shader->name, token );
}
}
static void Shaderpass_VideoMap ( shader_t *shader, shaderpass_t *pass, char **ptr )
{
/* char *token;
char name[MAX_OSPATH];
char *token;
token = Shader_ParseString ( ptr );
COM_StripExtension ( token, name );
if ( pass->cin )
Z_Free ( pass->cin );
pass->cin = (cinematics_t *)Z_Malloc ( sizeof(cinematics_t) );
pass->cin->frame = -1;
Com_sprintf ( pass->cin->name, sizeof(pass->cin->name), "video/%s.RoQ", name );
*/
pass->cin = Media_StartCin(token);
if (!pass->cin)
pass->cin = Media_StartCin(va("video/%s.roq", token));
else
Con_DPrintf (S_WARNING "(shader %s) Couldn't load video %s\n", shader->name, token );
pass->anim_frames[0] = texture_extension_number++;
pass->flags |= SHADER_PASS_VIDEOMAP;
shader->flags |= SHADER_VIDEOMAP;
}
@ -1170,11 +1171,11 @@ static void Shader_GetPathAndOffset ( char *name, char **path, unsigned int *off
void Shader_FreePass (shaderpass_t *pass)
{
if ( pass->flags & SHADER_PASS_VIDEOMAP ) {
/* GL_StopCinematic ( pass->cin );
Z_Free ( pass->cin );
if ( pass->flags & SHADER_PASS_VIDEOMAP )
{
Media_ShutdownCin(pass->cin);
pass->cin = NULL;
*/ }
}
}
void Shader_Free (shader_t *shader)
@ -1844,50 +1845,121 @@ void Shader_RunCinematic (void)
void Shader_DefaultBSP(char *shortname, shader_t *s)
{
shaderpass_t *pass;
pass = &s->passes[0];
pass->flags = SHADER_PASS_LIGHTMAP | SHADER_PASS_DEPTHWRITE | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_LIGHTMAP;
pass->anim_frames[0] = 0;
pass->depthfunc = GL_LEQUAL;
pass->blendmode = GL_REPLACE;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->numMergedPasses = 2;
if ( qglMTexCoord2fSGIS )
int bumptex;
extern cvar_t gl_bump;
if (0)//this isn't working right yet gl_config.arb_texture_env_dot3)
{
pass->numMergedPasses = 2;
pass->flush = R_RenderMeshMultitextured;
if (gl_bump.value)
bumptex = Mod_LoadHiResTexture(va("normalmaps/%s", shortname), NULL, true, false, false);//GL_FindImage (shortname, 0);
else
bumptex = 0;
}
else
bumptex = 0;
if (bumptex)
{
pass = &s->passes[s->numpasses++];
pass->flags = SHADER_PASS_DELUXMAP | SHADER_PASS_DEPTHWRITE | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_LIGHTMAP;
pass->anim_frames[0] = 0;
pass->depthfunc = GL_LEQUAL;
pass->blendmode = GL_REPLACE;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->numMergedPasses = 2;
if (pass->numMergedPasses > gl_mtexarbable)
pass->numMergedPasses = gl_mtexarbable;
pass->flush = R_RenderMeshCombined;
pass = &s->passes[s->numpasses++];
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = bumptex;
pass->anim_numframes = 1;
pass->blendmode = GL_DOT3_RGB_ARB;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass = &s->passes[s->numpasses++];
pass->flags = SHADER_PASS_NOCOLORARRAY | SHADER_PASS_BLEND;
pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
if (!pass->anim_frames[0])
pass->anim_frames[0] = missing_texture;
pass->depthfunc = GL_LEQUAL;
pass->blendsrc = GL_ZERO;
pass->blenddst = GL_SRC_COLOR;
pass->blendmode = GL_MODULATE;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->numMergedPasses = 2;
pass->flush = R_RenderMeshMultitextured;
pass = &s->passes[s->numpasses++];
pass->flags = SHADER_PASS_LIGHTMAP | SHADER_PASS_NOCOLORARRAY | SHADER_PASS_BLEND;
pass->tcgen = TC_GEN_LIGHTMAP;
pass->anim_frames[0] = 0;
pass->depthfunc = GL_LEQUAL;
pass->blendsrc = GL_ZERO;
pass->blenddst = GL_SRC_COLOR;
pass->blendmode = GL_MODULATE;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->numMergedPasses = 1;
pass->flush = R_RenderMeshGeneric;
}
else
{
pass = &s->passes[0];
pass->flags = SHADER_PASS_LIGHTMAP | SHADER_PASS_DEPTHWRITE | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_LIGHTMAP;
pass->anim_frames[0] = 0;
pass->depthfunc = GL_LEQUAL;
pass->blendmode = GL_REPLACE;
pass->alphagen = ALPHA_GEN_IDENTITY;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->numMergedPasses = 2;
pass = &s->passes[1];
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
if (!pass->anim_frames[0])
pass->anim_frames[0] = missing_texture;
pass->anim_numframes = 1;
pass->blendsrc = GL_ZERO;
pass->blenddst = GL_SRC_COLOR;
pass->blendmode = GL_MODULATE;
pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->alphagen = ALPHA_GEN_IDENTITY;
if ( qglMTexCoord2fSGIS )
{
pass->numMergedPasses = 2;
pass->flush = R_RenderMeshMultitextured;
}
else
{
pass->numMergedPasses = 1;
pass->flush = R_RenderMeshGeneric;
}
pass->numMergedPasses = 1;
pass->flush = R_RenderMeshGeneric;
pass = &s->passes[1];
pass->flags = SHADER_PASS_BLEND | SHADER_PASS_NOCOLORARRAY;
pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
if (!pass->anim_frames[0])
pass->anim_frames[0] = missing_texture;
pass->anim_numframes = 1;
pass->blendsrc = GL_ZERO;
pass->blenddst = GL_SRC_COLOR;
pass->blendmode = GL_MODULATE;
pass->depthfunc = GL_LEQUAL;
pass->rgbgen = RGB_GEN_IDENTITY;
pass->alphagen = ALPHA_GEN_IDENTITY;
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->numMergedPasses = 1;
pass->flush = R_RenderMeshGeneric;
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = missing_texture;
}
s->numpasses = 2;
}
s->numpasses = 2;
s->numdeforms = 0;
s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT;
s->features = MF_STCOORDS|MF_LMCOORDS|MF_TRNORMALS;
@ -1913,7 +1985,7 @@ void Shader_DefaultBSPVertex(char *shortname, shader_t *s)
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
s->numpasses = 1;
@ -1944,7 +2016,7 @@ void Shader_DefaultBSPFlare(char *shortname, shader_t *s)
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
s->numpasses = 1;
@ -1981,7 +2053,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
if (!pass->anim_frames[0])
{
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
}
@ -2003,7 +2075,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
if (!pass->anim_frames[0])
{
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
}
@ -2025,7 +2097,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
if (!pass->anim_frames[0])
{
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
}
@ -2047,7 +2119,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
if (!pass->anim_frames[0])
{
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname);
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
}
@ -2078,7 +2150,7 @@ void Shader_DefaultSkinShell(char *shortname, shader_t *s)
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
s->numpasses = 1;
@ -2118,7 +2190,7 @@ void Shader_Default2D(char *shortname, shader_t *s)
if ( !pass->anim_frames[0] ) {
Con_DPrintf (S_WARNING "Shader %s has a stage with no image: %s.\n", s->name, shortname );
pass->anim_frames[0] = 0;//fizme:r_notexture;
pass->anim_frames[0] = missing_texture;
}
s->numpasses = 1;

View file

@ -325,7 +325,7 @@ void R_LoadSkys (void)
{
for (s = 0; s < sizeof(skyname_suffix)/sizeof(skyname_suffix[0]); s++)
{
_snprintf (name, sizeof(name), skyname_pattern[p], boxname, skyname_suffix[s][i]);
snprintf (name, sizeof(name), skyname_pattern[p], boxname, skyname_suffix[s][i]);
skyboxtex[i] = Mod_LoadHiResTexture(name, NULL, false, false, true);
if (skyboxtex[i])
break;

View file

@ -111,7 +111,9 @@ extern gl_config_t gl_config;
extern float gldepthmin, gldepthmax;
void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha); //name was added for texture compression output
void GL_Upload8 (qbyte *data, int width, int height, qboolean mipmap, qboolean alpha);
void GL_Upload8 (char *name, qbyte *data, int width, int height, qboolean mipmap, qboolean alpha);
void GL_Upload24BGR_Flip (char *name, qbyte *data, int width, int height, qboolean mipmap, qboolean alpha);
void GL_Upload24BGR (char *name, qbyte *data, int width, int height, qboolean mipmap, qboolean alpha);
#ifdef GL_EXT_paletted_texture
void GL_Upload8_EXT (qbyte *data, int width, int height, qboolean mipmap, qboolean alpha);
#endif
@ -334,6 +336,11 @@ void GLQ3_LightGrid(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t
void GL_DrawHeightmapModel (entity_t *e);
void GL_LoadHeightmapModel (model_t *mod, void *buffer);
//gl_bloom.c
void R_BloomRegister(void);
void R_BloomBlend(void);
void R_InitBloomTextures(void);
//
// gl_rsurf.c

View file

@ -108,6 +108,8 @@ typedef struct shaderpass_s {
shaderfunc_t rgbgen_func;
shaderfunc_t alphagen_func;
struct cin_s *cin;
unsigned int blendsrc, blenddst; // glBlendFunc args
unsigned int blendmode, envmode;
@ -173,7 +175,8 @@ typedef struct shaderpass_s {
SHADER_PASS_LIGHTMAP = 1 << 5,
SHADER_PASS_DELUXMAP = 1 << 6,
SHADER_PASS_NOCOLORARRAY = 1<< 7,
SHADER_PASS_ANIMMAP = 1 << 8
SHADER_PASS_ANIMMAP = 1 << 8,
SHADER_PASS_GPUPROGRAM = 1 << 9
} flags;
} shaderpass_t;
@ -212,7 +215,8 @@ typedef struct shader_s {
SHADER_DEPTHWRITE = 1 << 11,
SHADER_AGEN_PORTAL = 1 << 12,
SHADER_BLEND = 1 << 13, //blend or alphatest (not 100% opaque).
SHADER_NODRAW = 1 << 14 //parsed only to pee off developers when they forget it on no-pass shaders.
SHADER_NODRAW = 1 << 14, //parsed only to pee off developers when they forget it on no-pass shaders.
SHADER_PROGRAM = 1 << 15 //run a script
} flags;
shaderpass_t passes[SHADER_PASS_MAX];

View file

@ -213,7 +213,7 @@ void VARGS QueueMessageva(FTPclient_t *cl, char *fmt, ...)
char msg[1024];
va_start (argptr, fmt);
_vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
vsnprintf (msg,sizeof(msg)-1, fmt,argptr);
va_end (argptr);
if (send (cl->controlsock, msg, strlen(msg), 0) == -1)

View file

@ -4,11 +4,6 @@
#include "iweb.h"
#ifdef _WIN32
//msvc crap
#define snprintf _snprintf
#endif
#include "netinc.h"
/*

View file

@ -326,7 +326,7 @@ void VARGS IWebDPrintf(char *fmt, ...)
return;
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
va_end (argptr);
Con_Printf("%s", msg);
@ -337,7 +337,7 @@ void VARGS IWebPrintf(char *fmt, ...)
char msg[4096];
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
va_end (argptr);
Con_Printf("%s", msg);
@ -348,7 +348,7 @@ void VARGS IWebWarnPrintf(char *fmt, ...)
char msg[4096];
va_start (argptr,fmt);
_vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
vsnprintf (msg,sizeof(msg)-10, fmt,argptr); //catch any nasty bugs... (this is hopefully impossible)
va_end (argptr);
Con_Printf(S_WARNING "%s", msg);

View file

@ -1523,7 +1523,7 @@ void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...)
static char string[2048];
va_start (argptr, format);
_vsnprintf (string,sizeof(string)-1, format,argptr);
vsnprintf (string,sizeof(string)-1, format,argptr);
va_end (argptr);
if (developer.value)
@ -2047,7 +2047,7 @@ void PF_set_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_globals)
char *shortname;
char fullname[MAX_QPATH];
shortname = PR_GetStringOfs(prinst, OFS_PARM1);
_snprintf(fullname, sizeof(fullname)-1, "models/puzzle/%s.mdl", shortname);
snprintf(fullname, sizeof(fullname)-1, "models/puzzle/%s.mdl", shortname);
G_INT(OFS_PARM1) = (int)(fullname - prinst->stringtable);
PF_setmodel (prinst, pr_globals);
G_INT(OFS_PARM1) = (int)(shortname - prinst->stringtable); //piece of mind.
@ -3758,7 +3758,7 @@ void PF_precache_puzzle_model (progfuncs_t *prinst, struct globalvars_s *pr_glob
char *shortname;
char fullname[MAX_QPATH];
shortname = PR_GetStringOfs(prinst, OFS_PARM0);
_snprintf(fullname, sizeof(fullname)-1, "models/puzzle/%s.mdl", shortname);
snprintf(fullname, sizeof(fullname)-1, "models/puzzle/%s.mdl", shortname);
G_INT(OFS_PARM0) = (int)(fullname - prinst->stringtable);
PF_precache_model (prinst, pr_globals);
G_INT(OFS_PARM0) = (int)(shortname - prinst->stringtable); //piece of mind.
@ -3987,7 +3987,7 @@ void PF_lightstyle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (!*val)
continue;
#ifdef PEXT_LIGHTSTYLECOL
if (client->fteprotocolextensions & PEXT_LIGHTSTYLECOL && col!=7)
if ((client->fteprotocolextensions & PEXT_LIGHTSTYLECOL) && col!=7)
{
ClientReliableWrite_Begin (client, svc_lightstylecol, strlen(val)+4);
ClientReliableWrite_Byte (client, style);
@ -4086,7 +4086,7 @@ void PF_lightstylestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if ( client->state == cs_spawned )
{
#ifdef PEXT_LIGHTSTYLECOL
if (client->fteprotocolextensions & PEXT_LIGHTSTYLECOL && col!=7)
if ((client->fteprotocolextensions & PEXT_LIGHTSTYLECOL) && col!=7)
{
ClientReliableWrite_Begin (client, svc_lightstylecol, strlen(val)+4);
ClientReliableWrite_Char (client, style);
@ -7008,7 +7008,7 @@ void PF_log(progfuncs_t *prinst, struct globalvars_s *pr_globals)
char name[MAX_OSPATH], *text;
vfsfile_t *file;
_snprintf(name, MAX_OSPATH, "%s.log", PR_GetStringOfs(prinst, OFS_PARM0));
snprintf(name, MAX_OSPATH, "%s.log", PR_GetStringOfs(prinst, OFS_PARM0));
text = PF_VarString(prinst, 2, pr_globals);
PR_CleanText(text);

View file

@ -1194,6 +1194,7 @@ void SV_FlushLevelCache(void);
int SV_RateForClient(client_t *cl);
qboolean TransformedNativeTrace (struct model_s *model, int hulloverride, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int against, struct trace_s *trace, vec3_t origin, vec3_t angles);
void SVVC_Frame (qboolean enabled);
void SV_CalcPHS (void);

View file

@ -659,6 +659,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
if (sv.strings.lightstyles[i])
Z_Free(sv.strings.lightstyles[i]);
sv.strings.lightstyles[i] = NULL;
sv.strings.lightstylecolours[i] = 7;
}
}

View file

@ -235,7 +235,7 @@ void VARGS SV_Error (char *error, ...)
inerror = true;
va_start (argptr,error);
_vsnprintf (string,sizeof(string)-1, error,argptr);
vsnprintf (string,sizeof(string)-1, error,argptr);
va_end (argptr);
{
@ -988,7 +988,7 @@ void SVC_InfoQ2 (void)
version = atoi (Cmd_Argv(1));
if (version != PROTOCOL_VERSION_Q2)
_snprintf (string, sizeof(string), "%s: wrong version\n", hostname.string);
snprintf (string, sizeof(string), "%s: wrong version\n", hostname.string);
else
{
count = 0;
@ -996,7 +996,7 @@ void SVC_InfoQ2 (void)
if (svs.clients[i].state >= cs_connected)
count++;
_snprintf (string, sizeof(string), "%16s %8s %2i/%2i\n", hostname.string, sv.name, count, (int)maxclients.value);
snprintf (string, sizeof(string), "%16s %8s %2i/%2i\n", hostname.string, sv.name, count, (int)maxclients.value);
}
Netchan_OutOfBandPrint (NS_SERVER, net_from, "info\n%s", string);
@ -1248,13 +1248,13 @@ void VARGS SV_OutOfBandPrintf (int q2, netadr_t adr, char *format, ...)
if (q2)
{
strcpy(string, "print\n");
_vsnprintf (string+6,sizeof(string)-1-6, format+1,argptr);
vsnprintf (string+6,sizeof(string)-1-6, format+1,argptr);
}
else
{
string[0] = A2C_PRINT;
string[1] = '\n';
_vsnprintf (string+2,sizeof(string)-1-2, format,argptr);
vsnprintf (string+2,sizeof(string)-1-2, format,argptr);
}
va_end (argptr);
@ -1271,12 +1271,12 @@ void VARGS SV_OutOfBandTPrintf (int q2, netadr_t adr, int language, translation_
if (q2)
{
strcpy(string, "print\n");
_vsnprintf (string+6,sizeof(string)-1-6, format+1,argptr);
vsnprintf (string+6,sizeof(string)-1-6, format+1,argptr);
}
else
{
string[0] = A2C_PRINT;
_vsnprintf (string+1,sizeof(string)-1-1, format,argptr);
vsnprintf (string+1,sizeof(string)-1-1, format,argptr);
}
va_end (argptr);
@ -1311,7 +1311,7 @@ void VARGS SV_RejectMessage(int protocol, char *format, ...)
#ifdef NQPROT
case SCP_NETQUAKE:
string[4] = CCREP_REJECT;
_vsnprintf (string+5,sizeof(string)-1-5, format,argptr);
vsnprintf (string+5,sizeof(string)-1-5, format,argptr);
len = strlen(string+4)+1+4;
*(int*)string = BigLong(NETFLAG_CTL|len);
NET_SendPacket(NS_SERVER, len, string, net_from);
@ -1319,7 +1319,7 @@ void VARGS SV_RejectMessage(int protocol, char *format, ...)
case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
strcpy(string, "reject ");
_vsnprintf (string+7,sizeof(string)-1-7, format,argptr);
vsnprintf (string+7,sizeof(string)-1-7, format,argptr);
len = strlen(string);
break;
#endif
@ -1327,14 +1327,14 @@ void VARGS SV_RejectMessage(int protocol, char *format, ...)
case SCP_QUAKE2:
default:
strcpy(string, "print\n");
_vsnprintf (string+6,sizeof(string)-1-6, format,argptr);
vsnprintf (string+6,sizeof(string)-1-6, format,argptr);
len = strlen(string);
break;
case SCP_QUAKEWORLD:
string[0] = A2C_PRINT;
string[1] = '\n';
_vsnprintf (string+2,sizeof(string)-1-2, format,argptr);
vsnprintf (string+2,sizeof(string)-1-2, format,argptr);
len = strlen(string);
break;
}

View file

@ -64,7 +64,7 @@ void DestClose(mvddest_t *d, qboolean destroyfiles)
if (destroyfiles)
{
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, d->path, d->name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, d->path, d->name);
Sys_remove(path);
Q_strncpyz(path + strlen(path) - 3, "txt", MAX_OSPATH - strlen(path) + 3);
@ -952,22 +952,22 @@ static char *SV_PrintTeams(void)
if (numcl == 2) // duel
{
_snprintf(buf, sizeof(buf), "team1 %s\nteam2 %s\n", clients[0]->name, clients[1]->name);
snprintf(buf, sizeof(buf), "team1 %s\nteam2 %s\n", clients[0]->name, clients[1]->name);
}
else if (!teamplay.value) // ffa
{
_snprintf(buf, sizeof(buf), "players:\n");
snprintf(buf, sizeof(buf), "players:\n");
for (i = 0; i < numcl; i++)
_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name);
}
else
{ // teamplay
for (j = 0; j < numt; j++)
{
_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "team %s:\n", teams[j]);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "team %s:\n", teams[j]);
for (i = 0; i < numcl; i++)
if (!strcmp(Info_ValueForKey(clients[i]->userinfo, "team"), teams[j]))
_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name);
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name);
}
}
@ -1042,7 +1042,7 @@ mvddest_t *SV_InitRecordFile (char *name)
SV_TimeOfDay(&date);
_snprintf(buf, sizeof(buf), "date %s\nmap %s\nteamplay %d\ndeathmatch %d\ntimelimit %d\n%s",date.str, sv.name, (int)teamplay.value, (int)deathmatch.value, (int)timelimit.value, SV_PrintTeams());
snprintf(buf, sizeof(buf), "date %s\nmap %s\nteamplay %d\ndeathmatch %d\ntimelimit %d\n%s",date.str, sv.name, (int)teamplay.value, (int)deathmatch.value, (int)timelimit.value, SV_PrintTeams());
fwrite(buf, strlen(buf),1,f);
fflush(f);
fclose(f);
@ -1579,7 +1579,7 @@ void SV_MVD_Record_f (void)
sizeof(newname) - strlen(sv_demoSuffix.string) - 5);
Q_strncatz(newname, sv_demoSuffix.string, MAX_MVD_NAME);
_snprintf (name, MAX_OSPATH+MAX_MVD_NAME, "%s/%s/%s", com_gamedir, sv_demoDir.string, newname);
snprintf (name, MAX_OSPATH+MAX_MVD_NAME, "%s/%s/%s", com_gamedir, sv_demoDir.string, newname);
COM_StripExtension(name, name);
@ -1772,7 +1772,7 @@ void SV_MVDEasyRecord_f (void)
if (teamplay.value >= 1 && i > 2)
{
// Teamplay
_snprintf (name, sizeof(name), "%don%d_", Dem_CountTeamPlayers(Dem_Team(1)), Dem_CountTeamPlayers(Dem_Team(2)));
snprintf (name, sizeof(name), "%don%d_", Dem_CountTeamPlayers(Dem_Team(1)), Dem_CountTeamPlayers(Dem_Team(2)));
if (sv_demoExtraNames.value > 0)
{
Q_strncatz (name, va("[%s]_%s_vs_[%s]_%s_%s",
@ -1784,13 +1784,13 @@ void SV_MVDEasyRecord_f (void)
} else {
if (i == 2) {
// Duel
_snprintf (name, sizeof(name), "duel_%s_vs_%s_%s",
snprintf (name, sizeof(name), "duel_%s_vs_%s_%s",
Dem_PlayerName(1),
Dem_PlayerName(2),
sv.name);
} else {
// FFA
_snprintf (name, sizeof(name), "ffa_%s(%d)", sv.name, i);
snprintf (name, sizeof(name), "ffa_%s(%d)", sv.name, i);
}
}
}
@ -1815,7 +1815,7 @@ void SV_MVDEasyRecord_f (void)
i = 1;
do {
fclose (f);
_snprintf(name2, sizeof(name2), "%s_%02i", name, i);
snprintf(name2, sizeof(name2), "%s_%02i", name, i);
// COM_StripExtension(name2, name2);
strcat (name2, ".mvd");
if ((f = fopen (name2, "rb")) == 0)
@ -2069,7 +2069,7 @@ void SV_MVDRemove_f (void)
SV_MVDStop_f();
// stop recording first;
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, list->name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, list->name);
if (!Sys_remove(path))
{
Con_Printf("removing %s...\n", list->name);
@ -2095,7 +2095,7 @@ void SV_MVDRemove_f (void)
Q_strncpyz(name, Cmd_Argv(1), MAX_MVD_NAME);
COM_DefaultExtension(name, ".mvd");
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
if (sv.mvdrecording && !strcmp(name, demo.name))
SV_MVDStop_f();
@ -2138,7 +2138,7 @@ void SV_MVDRemoveNum_f (void)
if (sv.mvdrecording && !strcmp(name, demo.name))
SV_MVDStop_f();
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
if (!Sys_remove(path))
{
Con_Printf("demo %s succesfully removed\n", name);
@ -2172,7 +2172,7 @@ void SV_MVDInfoAdd_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
}
else
{
@ -2184,7 +2184,7 @@ void SV_MVDInfoAdd_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
}
if ((f = fopen(path, "a+t")) == NULL)
@ -2224,7 +2224,7 @@ void SV_MVDInfoRemove_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
}
else
{
@ -2236,7 +2236,7 @@ void SV_MVDInfoRemove_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
}
if (Sys_remove(path))
@ -2266,7 +2266,7 @@ void SV_MVDInfo_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, demo.path, SV_MVDName2Txt(demo.name));
}
else
{
@ -2278,7 +2278,7 @@ void SV_MVDInfo_f (void)
return;
}
_snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
snprintf(path, MAX_OSPATH, "%s/%s/%s", com_gamedir, sv_demoDir.string, name);
}
if ((f = fopen(path, "rt")) == NULL)

View file

@ -279,7 +279,7 @@ void VARGS SV_ClientPrintf (client_t *cl, int level, char *fmt, ...)
return;
va_start (argptr,fmt);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string)-1, fmt,argptr);
va_end (argptr);
if(strlen(string) >= sizeof(string))
@ -309,7 +309,7 @@ void VARGS SV_ClientTPrintf (client_t *cl, int level, translation_t stringnum, .
return;
va_start (argptr,stringnum);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string)-1, fmt,argptr);
va_end (argptr);
if(strlen(string) >= sizeof(string))
@ -341,7 +341,7 @@ void VARGS SV_BroadcastPrintf (int level, char *fmt, ...)
int i;
va_start (argptr,fmt);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string)-1, fmt,argptr);
va_end (argptr);
if(strlen(string) >= sizeof(string))
@ -384,7 +384,7 @@ void VARGS SV_BroadcastTPrintf (int level, translation_t stringnum, ...)
char *fmt = languagetext[stringnum][oldlang=svs.language];
va_start (argptr,stringnum);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string)-1, fmt,argptr);
va_end (argptr);
if(strlen(string) >= sizeof(string))
@ -406,7 +406,7 @@ void VARGS SV_BroadcastTPrintf (int level, translation_t stringnum, ...)
fmt = languagetext[stringnum][oldlang=cl->language];
va_start (argptr,stringnum);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string)-1, fmt,argptr);
va_end (argptr);
if(strlen(string) >= sizeof(string))
@ -435,7 +435,7 @@ void VARGS SV_BroadcastCommand (char *fmt, ...)
if (!sv.state)
return;
va_start (argptr,fmt);
_vsnprintf (string,sizeof(string)-1, fmt,argptr);
vsnprintf (string,sizeof(string), fmt,argptr);
va_end (argptr);
for (i=0, cl = svs.clients ; i<MAX_CLIENTS ; i++, cl++)

View file

@ -1126,7 +1126,7 @@ void SV_Spawn_f (void)
if (!sv.strings.lightstyles[i])
continue;
#ifdef PEXT_LIGHTSTYLECOL
if (host_client->fteprotocolextensions & PEXT_LIGHTSTYLECOL && sv.strings.lightstylecolours[i]!=7)
if ((host_client->fteprotocolextensions & PEXT_LIGHTSTYLECOL) && sv.strings.lightstylecolours[i]!=7)
{
ClientReliableWrite_Begin (host_client, svc_lightstylecol,
3 + (sv.strings.lightstyles[i] ? strlen(sv.strings.lightstyles[i]) : 1));

View file

@ -412,30 +412,42 @@ void Q3G_LinkEntity(q3sharedEntity_t *ent)
sent->areanum2 = -1;
//get all leafs, including solids
num_leafs = CM_BoxLeafnums(sv.worldmodel, ent->r.absmin, ent->r.absmax,
leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
if(!num_leafs)
return;
// set areas
for(i=0; i<num_leafs; i++)
if (sv.worldmodel->type == mod_heightmap)
{
clusters[i] = CM_LeafCluster(sv.worldmodel, leafs[i]);
area = CM_LeafArea(sv.worldmodel, leafs[i]);
if(area >= 0)
{
// doors may legally straggle two areas,
// but nothing should ever need more than that
if(sent->areanum >= 0 && sent->areanum != area)
{
if(sent->areanum2 >= 0 && sent->areanum2 != area && sv.state == ss_loading)
Con_DPrintf("Object touching 3 areas at %f %f %f\n", ent->r.absmin[0], ent->r.absmin[1], ent->r.absmin[2]);
sent->areanum = 0;
num_leafs = 1;
sent->num_clusters = -1;
sent->headnode = 0;
clusters[0] = 0;
topnode = 0;
}
else
{
num_leafs = CM_BoxLeafnums(sv.worldmodel, ent->r.absmin, ent->r.absmax,
leafs, MAX_TOTAL_ENT_LEAFS, &topnode);
sent->areanum2 = area;
if(!num_leafs)
return;
// set areas
for(i=0; i<num_leafs; i++)
{
clusters[i] = CM_LeafCluster(sv.worldmodel, leafs[i]);
area = CM_LeafArea(sv.worldmodel, leafs[i]);
if(area >= 0)
{
// doors may legally straggle two areas,
// but nothing should ever need more than that
if(sent->areanum >= 0 && sent->areanum != area)
{
if(sent->areanum2 >= 0 && sent->areanum2 != area && sv.state == ss_loading)
Con_DPrintf("Object touching 3 areas at %f %f %f\n", ent->r.absmin[0], ent->r.absmin[1], ent->r.absmin[2]);
sent->areanum2 = area;
}
else
sent->areanum = area;
}
else
sent->areanum = area;
}
}
@ -574,9 +586,9 @@ void SVQ3_Trace(q3trace_t *result, vec3_t start, vec3_t mins, vec3_t maxs, vec3_
result->fraction = tr.fraction;
result->plane = tr.plane;
result->startsolid = tr.startsolid;
// if (tr.surface)
// result->surfaceFlags = tr.surface->flags;
// else
if (tr.surface)
result->surfaceFlags = tr.surface->flags;
else
result->surfaceFlags = 0;
for (i = 0; i < 3; i++)
@ -668,9 +680,9 @@ int SVQ3_PointContents(vec3_t pos, int entnum)
// sv.worldmodel->funcs.Trace(sv.worldmodel, 0, 0, pos, pos, vec3_origin, vec3_origin, &tr);
// tr = CM_BoxTrace(sv.worldmodel, pos, pos, vec3_origin, vec3_origin, 0);
cont = CM_PointContents(sv.worldmodel, pos);
cont = sv.worldmodel->funcs.NativeContents (sv.worldmodel, 0, 0, pos, vec3_origin, vec3_origin);
if (entnum == -1)
if ((unsigned)entnum >= MAX_GENTITIES)
ourowner = -1;
else if ( entnum != ENTITYNUM_WORLD )
{
@ -1829,8 +1841,14 @@ qboolean SVQ3_InitGame(void)
char sysinfo[8192];
extern cvar_t progs;
if (sv.worldmodel->fromgame == fg_quake || sv.worldmodel->fromgame == fg_quake2)
return false; //always fail on q1bsp
if (sv.worldmodel->type == mod_heightmap)
{
}
else
{
if (sv.worldmodel->fromgame == fg_quake || sv.worldmodel->fromgame == fg_quake2)
return false; //always fail on q1bsp
}
if (*progs.string) //don't load q3 gamecode if we're explicitally told to load a progs.
return false;
@ -1881,6 +1899,8 @@ qboolean SVQ3_InitGame(void)
mapentspointer = sv.worldmodel->entities;
VM_Call(q3gamevm, GAME_INIT, 0, rand(), false);
CM_InitBoxHull();
SVQ3_CreateBaseline();
q3_num_snapshot_entities = 32 * Q3UPDATE_BACKUP * 32;

View file

@ -994,6 +994,84 @@ qboolean TransformedTrace (struct model_s *model, int hulloverride, int frame, v
return result;
}
qboolean TransformedNativeTrace (struct model_s *model, int hulloverride, int frame, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, unsigned int against, struct trace_s *trace, vec3_t origin, vec3_t angles)
{
qboolean rotated;
vec3_t start_l, end_l;
vec3_t a;
vec3_t forward, right, up;
vec3_t temp;
qboolean result;
memset (trace, 0, sizeof(trace_t));
trace->fraction = 1;
trace->allsolid = false;
trace->startsolid = false;
trace->inopen = true; //probably wrong...
VectorCopy (end, trace->endpos);
// don't rotate non bsp ents. Too small to bother.
if (model)
{
rotated = (angles[0] || angles[1] || angles[2]);
if (rotated)
{
AngleVectors (angles, forward, right, up);
VectorSubtract (start, origin, temp);
start_l[0] = DotProduct (temp, forward);
start_l[1] = -DotProduct (temp, right);
start_l[2] = DotProduct (temp, up);
VectorSubtract (end, origin, temp);
end_l[0] = DotProduct (temp, forward);
end_l[1] = -DotProduct (temp, right);
end_l[2] = DotProduct (temp, up);
}
else
{
VectorSubtract (start, origin, start_l);
VectorSubtract (end, origin, end_l);
}
result = model->funcs.NativeTrace (model, hulloverride, frame, start_l, end_l, mins, maxs, against, trace);
if (rotated)
{
// FIXME: figure out how to do this with existing angles
// VectorNegate (angles, a);
a[0] = -angles[0];
a[1] = -angles[1];
a[2] = -angles[2];
AngleVectors (a, forward, right, up);
VectorCopy (trace->plane.normal, temp);
trace->plane.normal[0] = DotProduct (temp, forward);
trace->plane.normal[1] = -DotProduct (temp, right);
trace->plane.normal[2] = DotProduct (temp, up);
trace->endpos[0] = start[0] + trace->fraction * (end[0] - start[0]);
trace->endpos[1] = start[1] + trace->fraction * (end[1] - start[1]);
trace->endpos[2] = start[2] + trace->fraction * (end[2] - start[2]);
}
VectorAdd (trace->endpos, origin, trace->endpos);
}
else
{
hull_t *hull = &box_hull;
memset (trace, 0, sizeof(trace_t));
trace->fraction = 1;
trace->allsolid = true;
VectorSubtract (start, origin, start_l);
VectorSubtract (end, origin, end_l);
VectorCopy (end_l, trace->endpos);
result = Q1BSP_RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l, trace);
VectorAdd (trace->endpos, origin, trace->endpos);
}
return result;
}
/*
==================
SV_ClipMoveToEntity