Work In Progress branch.

In this version: replacement GL backend. Replacement D3D backend sharing code with GL. Lots of code reorganisation.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3401 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-11-04 21:16:50 +00:00
parent 7184ac46d1
commit 66b78c0b11
204 changed files with 20477 additions and 21412 deletions

View File

@ -168,7 +168,7 @@ PROFILE_DIR=$(BASE_DIR)/profile
ALL_CFLAGS=$(HAVECONFIG) $(CFLAGS) $(BASE_CFLAGS) $(WCFLAGS)
DO_CC=$(CC) $(ALL_CFLAGS) -o $@ -c $<
DO_CC=@echo $< && $(CC) $(ALL_CFLAGS) -o $@ -c $<
ifeq ($(USEASM),true)
ifdef windir
DO_AS=$(CC) $(BASE_CFLAGS) $(WCFLAGS) -x assembler-with-cpp -o $@ -c $< $(CFLAGS)
@ -177,6 +177,9 @@ ifeq ($(USEASM),true)
endif
endif
ifeq ($(FTE_TARGET),vc)
BASELDFLAGS=
endif
ifeq ($(FTE_TARGET),win32)
BASELDFLAGS=-lm
endif
@ -236,7 +239,16 @@ else
BASE_ASM_CFLAGS = -DNOASM
endif
BASE_CFLAGS=$(BASE_ASM_CFLAGS) -Wall -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D9_DIR) -I$(D3D7_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk7/include -I$(LIBS_DIR)/sdl/include -I$(LIBS_DIR)/sdl/include/SDL -I./libs/freetype2/include -I./libs/freetype2/include/freetype -D_vsnprintf=vsnprintf -D_snprintf=snprintf $(SVNREVISION)
ifeq ($(FTE_TARGET),vc)
WARNINGFLAGS=-W3 -D_CRT_SECURE_NO_WARNINGS
GNUC_FUNCS=
else
WARNINGFLAGS=-Wall
GNUC_FUNCS= -Dstrnicmp=strncasecmp -Dstricmp=strcasecmp -D_vsnprintf=vsnprintf -D_snprintf=snprintf
endif
BASE_CFLAGS=$(BASE_ASM_CFLAGS) $(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D9_DIR) -I$(D3D7_DIR) -I$(PROGS_DIR) -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk7/include -I$(LIBS_DIR)/sdl/include -I$(LIBS_DIR)/sdl/include/SDL -I./libs/freetype2/include -I./libs/freetype2/include/freetype $(SVNREVISION)
CLIENT_ONLY_CFLAGS=-DCLIENTONLY
SERVER_ONLY_CFLAGS=-DSERVERONLY
JOINT_CFLAGS=
@ -341,7 +353,8 @@ GLQUAKE_OBJS = \
ltface.o \
gl_screen.o \
gl_bloom.o \
gl_backend.o \
gl_vbo.o \
gl_shadow.o \
gl_shader.o \
gl_warp.o \
gl_ppl.o \
@ -478,7 +491,7 @@ GLCL_DIR=glcl_sdl$(BITS)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(SERVERONLY_OBJS)
SV_EXE_NAME=../fteqw_sdl.sv$(BITS)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -lz
SV_CFLAGS=$(SERVER_ONLY_CFLAGS)
MINGL_DIR=mingl_sdl$(BITS)
MINGL_EXE_NAME=../fteqw_sdl.mingl$(BITS)
@ -537,6 +550,35 @@ ifeq ($(FTE_TARGET),win32_SDL)
endif
endif
ifeq ($(FTE_TARGET),vc)
CC=cl
DEBUG_CFLAGS ?= -Od $(CPUOPTIMIZATIONS) /fp:fast
PROFILE_CFLAGS = -O2 -Ot -Ox -GL $(CPUOPTIMISATIONS) /fp:fast
PROFILE_LDFLAGS = /LTCG:PGINSTRUMENT
RELEASE_CFLAGS = -O2 -Ot -Ox -GL $(CPUOPTIMIZATIONS) /fp:fast
RELEASE_LDFLAGS = /LTCG:PGOPTIMIZE
DO_CC=@$(CC) /nologo $(ALL_CFLAGS) -Fo$@ -c $<
DO_LD=link /nologo /out:$@ wsock32.lib user32.lib advapi32.lib winmm.lib libs/zlib.lib shell32.lib /nodefaultlib:libc.lib /nodefaultlib:MSVCRT /manifest:no /OPT:REF
PRECOMPHEADERS =
NODEPS = 1
LIBS_DIR=./libs/
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS)
SV_EXE_NAME=../fteqwsv.exe
SV_DIR=sv_vc
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o resources.o
SV_LDFLAGS=/subsystem:console
M_EXE_NAME=../fteqw.exe
MCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS)
MB_DIR=m_vc
M_LDFLAGS=$(GLLDFLAGS) libs/jpeg.lib libs/libpng.lib libs/zlib.lib uuid.lib gdi32.lib ole32.lib libs/dxsdk7/lib/dxguid.lib /subsystem:windows
endif
ifeq ($(FTE_TARGET),win32)
# The extra object file called resources.o is specific for MinGW to link the icon in
@ -808,17 +850,21 @@ $(OUT_DIR)/npplug.o : ftequake/npplug.rc
# rm -f $@.$$$$
$(OUT_DIR)/%.o $(OUT_DIR)/%.d : %.c
ifeq ($(NODEPS),)
@set -e; rm -f $@.d; \
$(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@.d : ,g' < $@.d.$$$$ > $@.d; \
rm -f $@.d.$$$$
endif
$(DO_CC) -I$(OUT_DIR)
$(OUT_DIR)/%.oo $(OUT_DIR)/%.d : %.c
ifeq ($(NODEPS),)
@set -e; rm -f $@.d; \
$(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \
sed 's,\($*\)\.oo[ :]*,\1.oo $@.d : ,g' < $@.d.$$$$ > $@.d; \
rm -f $@.d.$$$$
endif
$(DO_CC) -I$(OUT_DIR)
$(OUT_DIR)/%.mo $(OUT_DIR)/%.d : %.m
@ -831,6 +877,7 @@ $(OUT_DIR)/%.mo $(OUT_DIR)/%.d : %.m
#enables use of precompiled headers in gcc 3.4 onwards.
$(OUT_DIR)/quakedef.h.gch : quakedef.h
$(CC) -x c $(BASE_CFLAGS) $(WCFLAGS) -o $@ -c $< $(CFLAGS)
PRECOMPHEADERS ?= $(OUT_DIR)/quakedef.h.gch
#addprefix is to add the ./release/server/ part of the object name
#foreach is needed as the OBJS is a list of variable names containing object lists.
@ -838,18 +885,19 @@ $(OUT_DIR)/quakedef.h.gch : quakedef.h
#god knows how gcc loads the list properly.
#or at least I hope he does. It makes no sence to mortals.
$(OUT_DIR)/$(EXE_NAME): $(OUT_DIR)/quakedef.h.gch $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol))))
$(CC) $(WCFLAGS) -o $@ $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS) $(CFLAGS)
DO_LD ?= $(CC) -o $@ $(WCFLAGS) $(CFLAGS)
$(OUT_DIR)/$(EXE_NAME): $(PRECOMPHEADERS) $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol))))
$(DO_LD) $(addprefix $(OUT_DIR)/, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol)))) $(LDFLAGS)
_out-rel:
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)"
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="$(OBJS)"
$(STRIP) $(STRIPFLAGS) $(OUT_DIR)/$(EXE_NAME)
_out-dbg:
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)"
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS) $(DEBUG_LDFLAGS)" OBJS="$(OBJS)"
_out-profile:
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(PROFILE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS)" OBJS="$(OBJS)"
$(MAKE) $(OUT_DIR)/$(EXE_NAME) EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(WCFLAGS) $(PROFILE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(LDFLAGS) $(PROFILE_LDFLAGS)" OBJS="$(OBJS)"
_cl-rel: reldir
$(MAKE) _out-rel EXE_NAME="$(EXE_NAME)" OUT_DIR="$(OUT_DIR)" WCFLAGS="$(CLIENT_ONLY_CFLAGS) $(WCFLAGS)" LDFLAGS="$(LDFLAGS)" SOBJS="$(SOBJS)" OBJS="SOBJS COMMON_OBJS CLIENT_OBJS PROGS_OBJS"
@ -1003,6 +1051,12 @@ help:
@-echo "'d3d-???' (for windows builds)"
@-echo "'mcl-???' (currently broken)"
@-echo "'glcl-???' (currently broken)"
@-echo ""
@-echo "Cross targets can be specified with FTE_TARGET=blah"
@-echo "linux32, linux64 specify specific x86 archs"
@-echo "SDL - Attempt to use sdl for the current target"
@-echo "win32 - Mingw compile for win32"
@-echo "vc - Attempts to use msvc8+ to compile. Note: uses profile guided optimisations. You must build+run the relevent profile target before a release target will compile properly. Debug doesn't care."
install:
-cp debug/*.* /opt/quake/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -100,7 +100,7 @@ qboolean Cam_DrawViewModel(int pnum)
{
if (cl.spectator)
{
if (autocam[pnum] && locked[pnum] && cl_chasecam.value)
if (autocam[pnum] && locked[pnum] && cl_chasecam.ival)
return true;
return false;
}
@ -624,7 +624,7 @@ void Cam_FinishMove(int pnum, usercmd_t *cmd)
}
}
if (autocam[pnum] && cl_hightrack.value)
if (autocam[pnum] && cl_hightrack.ival)
{
Cam_CheckHighTarget(pnum);
return;

View File

@ -2,7 +2,7 @@
//#include "cg_public.h"
#ifdef VM_CG
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "shader.h"
@ -15,14 +15,8 @@ typedef float m3by3_t[3][3];
#include "clq3defs.h"
//cl_ui.c
typedef struct q3refEntity_s q3refEntity_t;
void VQ3_AddEntity(const q3refEntity_t *q3);
typedef struct q3refdef_s q3refdef_t;
void VQ3_RenderView(const q3refdef_t *ref);
void CG_Command_f(void);
void GLDraw_ShaderImage (int x, int y, int w, int h, float s1, float t1, float s2, float t2, shader_t *pic);
#define CGAME_IMPORT_API_VERSION 4
#define CGTAGNUM 5423
@ -268,6 +262,12 @@ void CG_InsertIntoGameState(int num, char *str)
Con_DPrintf("%i: %s", num, str);
}
if (num == CFGSTR_SYSINFO)
{
//check some things.
cl.servercount = atoi(Info_ValueForKey(str, "sv_serverid"));
}
if (cggamestate.dataCount + strlen(str)+1 > MAX_GAMESTATE_CHARS)
{
char oldstringData[MAX_GAMESTATE_CHARS];
@ -378,16 +378,15 @@ typedef struct {
int numPoints;
} markFragment_t;
int CG_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection,
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer )
int maxPoints, float *pointBuffer, int maxFragments, markFragment_t *fragmentBuffer )
{
#if 1 //FIXME: make work
return 0;
#else
vec3_t center;
vec3_t axis[3];
vec3_t p[4];
int i;
float *clippedpoints;
float radius;
int numtris;
if (numPoints != 4)
return 0;
@ -407,10 +406,10 @@ int CG_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projecti
*/
VectorClear(center);
VectorAdd(center, points[0], center);
VectorAdd(center, points[1], center);
VectorAdd(center, points[2], center);
VectorAdd(center, points[3], center);
VectorMA(center, 0.25, points[0], center);
VectorMA(center, 0.25, points[1], center);
VectorMA(center, 0.25, points[2], center);
VectorMA(center, 0.25, points[3], center);
VectorSubtract(points[0], center, p[0]);
VectorSubtract(points[1], center, p[1]);
@ -419,23 +418,35 @@ int CG_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projecti
for (i = 0; i < 3; i++)
{
axis[1][i] = (p[2][i]+p[1][i])/2;
axis[2][i] = (p[2][i]+p[3][i])/2;
axis[1][i] = (p[2][i]-p[1][i]);
axis[2][i] = (p[3][i]-p[2][i]);
}
radius = VectorNormalize(axis[1]);
VectorNormalize(axis[2]);
VectorNormalize(projection);
VectorNormalize2(projection, axis[0]);
numtris = Q1BSP_ClipDecal(center, axis[0], axis[1], axis[2], radius, &clippedpoints);
if (numtris > maxFragments)
numtris = maxFragments;
if (numtris > maxPoints/3)
numtris = maxPoints/3;
for (i = 0; i < numtris; i++)
{
fragmentBuffer[i].numPoints = 3;
fragmentBuffer[i].firstPoint = i*3;
Q1BSP_ClipDecal(center, axis[0], axis[1], axis[2], radius, pointBuffer, maxPoints);
fragmentBuffer->firstPoint = 0;
fragmentBuffer->numPoints = 0;
return 1;
#endif
pointBuffer[i*9+0] = clippedpoints[i*9+0];
pointBuffer[i*9+1] = clippedpoints[i*9+1];
pointBuffer[i*9+2] = clippedpoints[i*9+2];
pointBuffer[i*9+3] = clippedpoints[i*9+3];
pointBuffer[i*9+4] = clippedpoints[i*9+4];
pointBuffer[i*9+5] = clippedpoints[i*9+5];
pointBuffer[i*9+6] = clippedpoints[i*9+6];
pointBuffer[i*9+7] = clippedpoints[i*9+7];
pointBuffer[i*9+8] = clippedpoints[i*9+8];
}
return numtris;
}
@ -462,10 +473,10 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
switch(fn)
{
case CG_PRINT:
Con_Printf("%s", VM_POINTER(arg[0]));
Con_Printf("%s", (char*)VM_POINTER(arg[0]));
break;
case CG_ERROR:
Host_EndGame("cgame: %s", VM_POINTER(arg[0]));
Host_EndGame("cgame: %s", (char*)VM_POINTER(arg[0]));
break;
case CG_ARGC:
@ -518,23 +529,21 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
break;
case CG_SENDCONSOLECOMMAND:
Con_DPrintf("CG_SENDCONSOLECOMMAND: %s", VM_POINTER(arg[0]));
Con_DPrintf("CG_SENDCONSOLECOMMAND: %s", (char*)VM_POINTER(arg[0]));
Cbuf_AddText(VM_POINTER(arg[0]), RESTRICT_SERVER);
break;
case CG_ADDCOMMAND:
Cmd_AddRemCommand(VM_POINTER(arg[0]), NULL);
break;
case CG_SENDCLIENTCOMMAND:
Con_DPrintf("CG_SENDCLIENTCOMMAND: %s", VM_POINTER(arg[0]));
CL_SendClientCommand(true, "%s", VM_POINTER(arg[0]));
Con_DPrintf("CG_SENDCLIENTCOMMAND: %s", (char*)VM_POINTER(arg[0]));
CL_SendClientCommand(true, "%s", (char*)VM_POINTER(arg[0]));
break;
case CG_UPDATESCREEN: //force a buffer swap cos loading won't refresh it soon.
SCR_BeginLoadingPlaque();
SCR_UpdateScreen();
SCR_EndLoadingPlaque();
// GL_EndRendering();
// GL_DoSwap();
break;
case CG_FS_FOPENFILE: //fopen
@ -776,13 +785,15 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
// VM_LONG(ret) = VM_TOHANDLE(Draw_SafeCachePic(VM_POINTER(arg[0])));
break;
case CG_R_CLEARSCENE: //clear scene
cl_numvisedicts=0;
dlights_running=0;
dlights_software=0;
case CG_R_CLEARSCENE: //clear scene (not rtlights, only dynamic ones)
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
rtlights_first = RTL_FIRST;
break;
case CG_R_ADDPOLYTOSCENE:
// ...
VQ3_AddPoly(VM_FROMSHANDLE(arg[0]), VM_LONG(arg[1]), VM_POINTER(arg[2]));
break;
case CG_R_ADDREFENTITYTOSCENE: //add ent to scene
VQ3_AddEntity(VM_POINTER(arg[0]));
@ -791,7 +802,7 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
case CG_R_ADDLIGHTTOSCENE: //add light to scene.
{
float *org = VM_POINTER(arg[0]);
CL_NewDlightRGB(-1, org[0], org[1], org[2], VM_FLOAT(arg[1]), 0, VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]));
CL_NewDlightRGB(-1, org, VM_FLOAT(arg[1]), 0, VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]));
}
break;
case CG_R_RENDERSCENE: //render scene
@ -810,10 +821,7 @@ static int CG_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *
break;
case CG_R_DRAWSTRETCHPIC:
if (qrenderer == QR_OPENGL)
GLDraw_ShaderImage(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(arg[8]));
// else
// Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), (mpic_t *)VM_LONG(arg[8]));
Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), (mpic_t *)VM_LONG(arg[8]));
break;
case CG_R_LERPTAG: //Lerp tag...
@ -1081,7 +1089,7 @@ static int EXPORT_FN CG_SystemCalls(int arg, ...)
int CG_Refresh(void)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
int time;
if (!cgvm)
return false;
@ -1101,7 +1109,7 @@ int CG_Refresh(void)
void CG_Stop (void)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
keycatcher &= ~2;
if (cgvm)
{
@ -1122,7 +1130,7 @@ void CG_Start (void)
return;
}
#if defined(RGLQUAKE) || defined(DIRECT3D)
#if defined(GLQUAKE) || defined(DIRECT3D)
if (!Draw_SafeCachePic) //no renderer loaded
{
CG_Stop();
@ -1157,7 +1165,7 @@ void CG_Start (void)
qboolean CG_Command(void)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (!cgvm)
return false;
Con_DPrintf("CG_Command: %s %s\n", Cmd_Argv(0), Cmd_Args());

View File

@ -1055,6 +1055,11 @@ void CL_Record_f (void)
MSG_WriteLong (&buf, PROTOCOL_VERSION_FTE);
MSG_WriteLong (&buf, cls.fteprotocolextensions);
}
if (cls.fteprotocolextensions2) //maintain demo compatability
{
MSG_WriteLong (&buf, PROTOCOL_VERSION_FTE2);
MSG_WriteLong (&buf, cls.fteprotocolextensions2);
}
#endif
MSG_WriteLong (&buf, PROTOCOL_VERSION_QW);
MSG_WriteLong (&buf, cl.servercount);
@ -1424,18 +1429,27 @@ void CL_PlayDemo(char *demoname)
//
Q_strncpyz (name, demoname, sizeof(name));
COM_DefaultExtension (name, ".qwd", sizeof(name));
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
if (*name == '#')
cls.demofile = VFSOS_Open(name+1, "rb");
else
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
if (!cls.demofile)
{
Q_strncpyz (name, demoname, sizeof(name));
COM_DefaultExtension (name, ".dem", sizeof(name));
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
if (*name == '#')
cls.demofile = VFSOS_Open(name+1, "rb");
else
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
}
if (!cls.demofile)
{
Q_strncpyz (name, demoname, sizeof(name));
COM_DefaultExtension (name, ".mvd", sizeof(name));
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
if (*name == '#')
cls.demofile = VFSOS_Open(name+1, "rb");
else
cls.demofile = FS_OpenVFS(name, "rb", FS_GAME);
}
if (!cls.demofile)
{
@ -1679,7 +1693,7 @@ void CL_QTVPoll (void)
if (*colon)
Con_Printf("streaming \"%s\" from qtv\n", colon);
else
Con_Printf("qtv connection established\n", colon);
Con_Printf("qtv connection established to %s\n", colon);
streamavailable = true;
}
@ -1723,8 +1737,8 @@ void CL_QTVPoll (void)
key_dest = key_menu;
sourcesmenu = M_CreateMenu(0);
MC_AddPicture(sourcesmenu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(sourcesmenu, 4, "gfx/p_option.lmp");
MC_AddPicture(sourcesmenu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(sourcesmenu, 4, 24, "gfx/p_option.lmp");
}
if (init_numplayers == true && init_numviewers == true)
MC_AddConsoleCommand(sourcesmenu, 42, (sourcenum++)*8 + 32, va("%s (p%i, v%i)", srchost, numplayers, numviewers), va("qtvplay %i@%s\n", streamid, qtvhostname));
@ -1769,12 +1783,12 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result)
memset(result, 0, sizeof(*result));
if (!f)
{
Con_Printf("Couldn't open QTV file: %s\n", name);
Con_Printf("Couldn't open QTV file: %s\n", fname);
return;
}
if (!VFS_GETS(f, buffer, sizeof(buffer)-1))
{
Con_Printf("Empty QTV file: %s\n", name);
Con_Printf("Empty QTV file: %s\n", fname);
VFS_CLOSE(f);
return;
}
@ -1783,7 +1797,7 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result)
s++;
if (*s != '[')
{
Con_Printf("Bad QTV file: %s\n", name);
Con_Printf("Bad QTV file: %s\n", fname);
VFS_CLOSE(f);
return;
}
@ -1792,7 +1806,7 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result)
s++;
if (strnicmp(s, "QTV", 3))
{
Con_Printf("Bad QTV file: %s\n", name);
Con_Printf("Bad QTV file: %s\n", fname);
VFS_CLOSE(f);
return;
}
@ -1801,7 +1815,7 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result)
s++;
if (*s != ']')
{
Con_Printf("Bad QTV file: %s\n", name);
Con_Printf("Bad QTV file: %s\n", fname);
VFS_CLOSE(f);
return;
}
@ -1810,7 +1824,7 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result)
s++;
if (*s)
{
Con_Printf("Bad QTV file: %s\n", name);
Con_Printf("Bad QTV file: %s\n", fname);
VFS_CLOSE(f);
return;
}
@ -1972,7 +1986,7 @@ void CL_QTVPlay_f (void)
else
host = NULL;
if (qtvcl_forceversion1.value)
if (qtvcl_forceversion1.ival)
{
connrequest = "QTV\n"
"VERSION: 1.0\n";
@ -1985,7 +1999,7 @@ void CL_QTVPlay_f (void)
VFS_WRITE(newf, connrequest, strlen(connrequest));
if (qtvcl_eztvextensions.value)
if (qtvcl_eztvextensions.ival)
{
connrequest = "QTV_EZQUAKE_EXT: 3\n";
VFS_WRITE(newf, connrequest, strlen(connrequest));
@ -2039,7 +2053,7 @@ void CL_QTVList_f (void)
return;
}
if (qtvcl_forceversion1.value)
if (qtvcl_forceversion1.ival)
{
connrequest = "QTV\n"
"VERSION: 1.0\n";

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "particles.h"
#include "shader.h"
extern cvar_t cl_predict_players;
extern cvar_t cl_predict_players2;
@ -34,6 +35,7 @@ extern cvar_t r_powerupglow;
extern cvar_t v_powerupshell;
extern cvar_t cl_nolerp;
extern cvar_t cl_nolerp_netquake;
extern cvar_t r_torch;
extern cvar_t cl_gibfilter, cl_deadbodyfilter;
extern int cl_playerindex;
@ -58,19 +60,19 @@ qboolean CL_FilterModelindex(int modelindex, int frame)
{
if (modelindex == cl_playerindex)
{
if (cl_deadbodyfilter.value == 2)
if (cl_deadbodyfilter.ival == 2)
{
if (frame >= 41 && frame <= 102)
return true;
}
else if (cl_deadbodyfilter.value)
else if (cl_deadbodyfilter.ival)
{
if (frame == 49 || frame == 60 || frame == 69 || frame == 84 || frame == 93 || frame == 102)
return true;
}
}
if (cl_gibfilter.value && (
if (cl_gibfilter.ival && (
modelindex == cl_h_playerindex ||
modelindex == cl_gib1index ||
modelindex == cl_gib2index ||
@ -81,9 +83,16 @@ qboolean CL_FilterModelindex(int modelindex, int frame)
//============================================================
void CL_InitDlights(void)
{
rtlights_max = cl_maxdlights = RTL_FIRST;
cl_dlights = BZ_Realloc(NULL, sizeof(*cl_dlights)*cl_maxdlights);
memset(cl_dlights, 0, sizeof(*cl_dlights)*cl_maxdlights);
}
static void CL_ClearDlight(dlight_t *dl, int key)
{
int st;
texid_t st;
st = dl->stexture;
memset (dl, 0, sizeof(*dl));
dl->stexture = st;
@ -92,6 +101,23 @@ static void CL_ClearDlight(dlight_t *dl, int key)
dl->axis[2][2] = 1;
dl->key = key;
dl->flags = LFLAG_DYNAMIC;
// if (r_shadow_realtime_dlight_shadowmap.value)
// dl->flags |= LFLAG_SHADOWMAP;
}
dlight_t *CL_AllocSlight(void)
{
dlight_t *dl;
if (rtlights_max == cl_maxdlights)
{
cl_maxdlights = rtlights_max+8;
cl_dlights = BZ_Realloc(cl_dlights, sizeof(*cl_dlights)*cl_maxdlights);
memset(&cl_dlights[rtlights_max], 0, sizeof(*cl_dlights)*(cl_maxdlights-rtlights_max));
}
dl = &cl_dlights[rtlights_max++];
CL_ClearDlight(dl, 0);
return dl;
}
/*
@ -108,8 +134,8 @@ dlight_t *CL_AllocDlight (int key)
// first look for an exact key match
if (key)
{
dl = cl_dlights;
for (i=0 ; i<dlights_running ; i++, dl++)
dl = cl_dlights+rtlights_first;
for (i=rtlights_first ; i<RTL_FIRST ; i++, dl++)
{
if (dl->key == key)
{
@ -119,18 +145,21 @@ dlight_t *CL_AllocDlight (int key)
}
}
// then look for anything else
if (dlights_running < MAX_DLIGHTS)
//default to the first
dl = &cl_dlights[rtlights_first?rtlights_first-1:0];
//try and find one that is free
for (i=RTL_FIRST; i > rtlights_first && i > 0; )
{
dl = &cl_dlights[dlights_running];
CL_ClearDlight(dl, key);
dlights_running++;
if (dlights_software < MAX_SWLIGHTS)
dlights_software++;
return dl;
i--;
if (!cl_dlights[i].radius)
{
dl = &cl_dlights[i];
break;
}
}
if (rtlights_first > dl - cl_dlights)
rtlights_first = dl - cl_dlights;
dl = &cl_dlights[0];
CL_ClearDlight(dl, key);
return dl;
}
@ -140,46 +169,33 @@ dlight_t *CL_AllocDlight (int key)
CL_NewDlight
===============
*/
dlight_t *CL_NewDlight (int key, float x, float y, float z, float radius, float time,
int type)
dlight_t *CL_NewDlight (int key, const vec3_t org, float radius, float time, int type)
{
static const vec3_t lightcolour[] =
{
{0.2, 0.1, 0.05},
{0.05, 0.05, 0.3},
{0.5, 0.05, 0.05},
{0.5, 0.05, 0.4}
};
dlight_t *dl;
if (type >= sizeof(lightcolour)/sizeof(lightcolour[0]))
type = 0;
dl = CL_AllocDlight (key);
dl->origin[0] = x;
dl->origin[1] = y;
dl->origin[2] = z;
VectorCopy(org, dl->origin);
dl->radius = radius;
dl->die = (float)cl.time + time;
if (type == 0) {
dl->color[0] = 0.2;
dl->color[1] = 0.1;
dl->color[2] = 0.05;
} else if (type == 1) {
dl->color[0] = 0.05;
dl->color[1] = 0.05;
dl->color[2] = 0.3;
} else if (type == 2) {
dl->color[0] = 0.5;
dl->color[1] = 0.05;
dl->color[2] = 0.05;
} else if (type == 3) {
dl->color[0]=0.5;
dl->color[1] = 0.05;
dl->color[2] = 0.4;
}
VectorCopy(lightcolour[type], dl->color);
return dl;
}
dlight_t *CL_NewDlightRGB (int key, float x, float y, float z, float radius, float time,
dlight_t *CL_NewDlightRGB (int key, const vec3_t org, float radius, float time,
float r, float g, float b)
{
dlight_t *dl;
dl = CL_AllocDlight (key);
dl->origin[0] = x;
dl->origin[1] = y;
dl->origin[2] = z;
VectorCopy(org, dl->origin);
dl->radius = radius;
dl->die = cl.time + time;
dl->color[0] = r;
@ -199,26 +215,28 @@ CL_DecayLights
void CL_DecayLights (void)
{
int i;
int lastrunning = -1;
dlight_t *dl;
if (cl.paused) //DON'T DO IT!!!
return;
dl = cl_dlights;
for (i=0 ; i<dlights_running ; i++, dl++)
dl = cl_dlights+rtlights_first;
for (i=rtlights_first ; i<RTL_FIRST ; i++, dl++)
{
if (!dl->radius)
{
continue;
}
if (!dl->die)
{
lastrunning = i;
continue;
}
if (dl->die < (float)cl.time)
{
if (i==rtlights_first)
rtlights_first++;
dl->radius = 0;
continue;
}
@ -226,10 +244,11 @@ void CL_DecayLights (void)
dl->radius -= host_frametime*dl->decay;
if (dl->radius < 0)
{
if (i==rtlights_first)
rtlights_first++;
dl->radius = 0;
continue;
}
lastrunning = i;
if (dl->channelfade[0])
{
@ -252,10 +271,6 @@ void CL_DecayLights (void)
dl->color[2] = 0;
}
}
dlights_running = lastrunning+1;
dlights_software = dlights_running;
if (dlights_software > MAX_SWLIGHTS)
dlights_software = MAX_SWLIGHTS;
}
@ -300,7 +315,7 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
bitcounts[i]++;
#ifdef PROTOCOLEXTENSIONS
if (bits & U_EVENMORE && cls.fteprotocolextensions)
if (bits & U_EVENMORE && (cls.fteprotocolextensions & (PEXT_SCALE|PEXT_TRANS|PEXT_FATNESS|PEXT_HEXEN2|PEXT_COLOURMOD|PEXT_DPFLAGS|PEXT_MODELDBL|PEXT_ENTITYDBL|PEXT_ENTITYDBL2)))
morebits = MSG_ReadByte ();
if (morebits & U_YETMORE)
morebits |= MSG_ReadByte()<<8;
@ -369,11 +384,11 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
to->colormod[2] = MSG_ReadByte();
}
if (morebits & U_ENTITYDBL)
if (morebits & U_ENTITYDBL && cls.fteprotocolextensions & PEXT_ENTITYDBL)
to->number += 512;
if (morebits & U_ENTITYDBL2)
if (morebits & U_ENTITYDBL2 && cls.fteprotocolextensions & PEXT_ENTITYDBL2)
to->number += 1024;
if (morebits & U_MODELDBL)
if (morebits & U_MODELDBL && cls.fteprotocolextensions & PEXT_MODELDBL)
to->modelindex += 256;
if (morebits & U_DPFLAGS)// && cls.fteprotocolextensions & PEXT_DPFLAGS)
@ -459,19 +474,21 @@ void CL_ParsePacketEntities (qboolean delta)
qboolean full;
int from;
if (!(cls.fteprotocolextensions & PEXT_ACCURATETIMINGS))
newpacket = cls.netchan.incoming_sequence&UPDATE_MASK;
newp = &cl.frames[newpacket].packet_entities;
cl.frames[newpacket].invalid = false;
if (!(cls.fteprotocolextensions & PEXT_ACCURATETIMINGS) && cls.protocol == CP_QUAKEWORLD)
{
cl.oldgametime = cl.gametime;
cl.oldgametimemark = cl.gametimemark;
cl.gametime = realtime;
cl.gametimemark = realtime;
newp->servertime = realtime;
}
newpacket = cls.netchan.incoming_sequence&UPDATE_MASK;
newp = &cl.frames[newpacket].packet_entities;
cl.frames[newpacket].invalid = false;
newp->servertime = cl.gametime;
else
newp->servertime = cl.gametime;
if (delta)
{
@ -1369,9 +1386,9 @@ void VQ2_AddLerpEntity(entity_t *in) //a convienience function
ent->angles[0]*=-1;
}
void V_AddLight (vec3_t org, float quant, float r, float g, float b)
int V_AddLight (int entsource, vec3_t org, float quant, float r, float g, float b)
{
CL_NewDlightRGB (0, org[0], org[1], org[2], quant, -0.1, r, g, b);
return CL_NewDlightRGB (entsource, org, quant, -0.1, r, g, b) - cl_dlights;
}
static void CL_LerpNetFrameState(int fsanim, framestate_t *fs, lerpents_t *le)
@ -1638,13 +1655,15 @@ void CL_LinkPacketEntities (void)
//, spnum;
dlight_t *dl;
vec3_t angles;
int flicker;
qboolean nolerp;
float servertime;
CL_CalcClientTime();
servertime = cl.servertime;
if ((cls.fteprotocolextensions & PEXT_ACCURATETIMINGS) || cls.protocol != CP_QUAKEWORLD)
servertime = cl.servertime;
else
servertime = realtime;
nolerp = !CL_MayLerp() && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV;
#ifdef NQPROT
@ -1654,7 +1673,10 @@ void CL_LinkPacketEntities (void)
if (!pack)
return;
servertime = cl.servertime;
if ((cls.fteprotocolextensions & PEXT_ACCURATETIMINGS) || cls.protocol != CP_QUAKEWORLD)
servertime = cl.servertime;
else
servertime = realtime;
autorotate = anglemod(100*servertime);
@ -1681,9 +1703,7 @@ void CL_LinkPacketEntities (void)
#endif
ent = &cl_visedicts[cl_numvisedicts];
#ifdef Q3SHADERS
ent->forcedshader = NULL;
#endif
le = &cl.lerpents[state->number];
@ -1691,25 +1711,58 @@ void CL_LinkPacketEntities (void)
VectorCopy(le->origin, ent->origin);
//bots or powerup glows. items always glow, powerups can be disabled
if (state->modelindex != cl_playerindex || r_powerupglow.value)
//bots or powerup glows. items always glow, bots can be disabled
if (state->modelindex != cl_playerindex || r_powerupglow.ival)
if (state->effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT) || state->light[3])
{
flicker = r_lightflicker.value?(rand()&31):0;
// spawn light flashes, even ones coming from invisible objects
if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED))
CL_NewDlight (state->number, state->origin[0], state->origin[1], state->origin[2], 200 + flicker, 0, 3);
else if (state->effects & EF_BLUE)
CL_NewDlight (state->number, state->origin[0], state->origin[1], state->origin[2], 200 + flicker, 0, 1);
else if (state->effects & EF_RED)
CL_NewDlight (state->number, state->origin[0], state->origin[1], state->origin[2], 200 + flicker, 0, 2);
else if (state->effects & EF_BRIGHTLIGHT)
CL_NewDlight (state->number, state->origin[0], state->origin[1], state->origin[2] + 16, 400 + flicker, 0, 0);
else if (state->effects & EF_DIMLIGHT)
CL_NewDlight (state->number, state->origin[0], state->origin[1], state->origin[2], 200 + flicker, 0, 0);
}
if (state->light[3])
{
CL_NewDlightRGB (state->number, state->origin[0], state->origin[1], state->origin[2], state->light[3], 0, state->light[0]/1024.0f, state->light[1]/1024.0f, state->light[2]/1024.0f);
vec3_t colour;
float radius;
colour[0] = 0;
colour[1] = 0;
colour[2] = 0;
radius = 0;
if (state->effects & EF_BRIGHTLIGHT)
{
radius = max(radius,400);
colour[0] += 0.2;
colour[1] += 0.1;
colour[2] += 0.05;
}
if (state->effects & EF_DIMLIGHT)
{
radius = max(radius,200);
colour[0] += 0.2;
colour[1] += 0.1;
colour[2] += 0.05;
}
if (state->effects & EF_BLUE)
{
radius = max(radius,200);
colour[0] += 0.05;
colour[1] += 0.05;
colour[2] += 0.3;
}
if (state->effects & EF_RED)
{
radius = max(radius,200);
colour[0] += 0.5;
colour[1] += 0.05;
colour[2] += 0.05;
}
if (state->light[3])
{
radius = max(radius,state->light[3]);
colour[0] += state->light[0]/1024.0f;
colour[1] += state->light[1]/1024.0f;
colour[2] += state->light[2]/1024.0f;
}
if (radius)
{
radius += r_lightflicker.value?(rand()&31):0;
CL_NewDlightRGB(state->number, state->origin, radius, 0.1, colour[0], colour[1], colour[2]);
}
}
// if set to invisible, skip
@ -1732,10 +1785,7 @@ void CL_LinkPacketEntities (void)
cl_numvisedicts++;
#ifdef Q3SHADERS
ent->forcedshader = NULL;
#endif
ent->visframe = 0;
ent->keynum = state->number;
@ -1746,8 +1796,8 @@ void CL_LinkPacketEntities (void)
ent->model = model;
ent->flags = state->flags;
if (state->effects & NQEF_ADDATIVE)
ent->flags |= Q2RF_ADDATIVE;
if (state->effects & NQEF_ADDITIVE)
ent->flags |= Q2RF_ADDITIVE;
if (state->effects & EF_NODEPTHTEST)
ent->flags |= RF_NODEPTHTEST;
@ -1884,7 +1934,7 @@ void CL_LinkPacketEntities (void)
{
extern cvar_t gl_part_flame;
if (cls.allow_anyparticles && gl_part_flame.value)
if (cls.allow_anyparticles && gl_part_flame.ival)
{
P_EmitEffect (ent->origin, model->particleeffect, &(le->emitstate));
}
@ -1902,6 +1952,7 @@ void CL_LinkPacketEntities (void)
if (model->flags & EF_ROCKET)
{
#pragma message("Replace this flag on load for hexen2 models")
if (strncmp(model->name, "models/sflesh", 13))
{ //hmm. hexen spider gibs...
rad = 200;
@ -2002,7 +2053,7 @@ void CL_ParseProjectiles (int modelindex, qboolean nails2)
pr->origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
pr->origin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096;
pr->origin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
pr->angles[0] = 360*((int)bits[4]>>4)/16.0f;
pr->angles[0] = 360*(((int)bits[4]>>4)/16.0f + 1/32.0f);
pr->angles[1] = 360*(int)bits[5]/256.0f;
}
}
@ -2030,9 +2081,8 @@ void CL_LinkProjectiles (void)
if (pr->modelindex < 1)
continue;
#ifdef Q3SHADERS
ent->forcedshader = NULL;
#endif
ent->model = cl.model_precache[pr->modelindex];
ent->skinnum = 0;
memset(&ent->framestate, 0, sizeof(ent->framestate));
@ -2553,6 +2603,9 @@ void CL_LinkPlayers (void)
continue;
#endif
if (info->spectator)
continue;
// spawn light flashes, even ones coming from invisible objects
if (r_powerupglow.value && !(r_powerupglow.value == 2 && j == cl.playernum[0])
&& (state->effects & (EF_BLUE|EF_RED|EF_BRIGHTLIGHT|EF_DIMLIGHT)))
@ -2597,7 +2650,7 @@ void CL_LinkPlayers (void)
if (radius)
{
radius += r_lightflicker.value?(rand()&31):0;
CL_NewDlightRGB(j+1, org[0], org[1], org[2], radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_ALLOW_FLASH;
CL_NewDlightRGB(j+1, org, radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_ALLOW_FLASH;
}
}
@ -2617,10 +2670,7 @@ void CL_LinkPlayers (void)
cl_numvisedicts++;
ent->keynum = j+1;
ent->flags = 0;
#ifdef Q3SHADERS
ent->forcedshader = NULL;
#endif
//the extra modelindex check is to stop lame mods from using vweps with rings
if (state->command.impulse && cl.model_precache_vwep[0] && state->modelindex == cl_playerindex)
@ -2705,7 +2755,7 @@ void CL_LinkPlayers (void)
if (pnum < cl.splitclients)
{ //this is a local player
}
else if (msec <= 0 || (!cl_predict_players.value && !cl_predict_players2.value))
else if (msec <= 0 || (!cl_predict_players.ival && !cl_predict_players2.ival))
{
VectorCopy (state->origin, ent->origin);
//Con_DPrintf ("nopredict\n");
@ -2737,23 +2787,23 @@ void CL_LinkPlayers (void)
else if (state->command.impulse)
CL_AddVWeapModel (ent, cl.model_precache_vwep[state->command.impulse]);
if (r_torch.ival)
{
dlight_t *dl;
dl = CL_NewDlightRGB(j+1, ent->origin, 300, r_torch.ival, 0.05, 0.05, 0.02);
dl->flags |= LFLAG_SHADOWMAP|LFLAG_ALLOW_FLASH;
dl->fov = 60;
angles[0] *= 3;
angles[1] += sin(realtime)*8;
angles[0] += cos(realtime*1.13)*5;
AngleVectors(angles, dl->axis[0], dl->axis[1], dl->axis[2]);
}
}
}
#ifdef Q3SHADERS //fixme: do better.
#include "shader.h"
#endif
void CL_LinkViewModel(void)
{
entity_t ent;
// float ambient[4], diffuse[4];
// int j;
// int lnum;
// vec3_t dist;
// float add;
// dlight_t *dl;
// int ambientlight, shadelight;
static struct model_s *oldmodel[MAX_SPLITS];
static float lerptime[MAX_SPLITS];
@ -2779,7 +2829,7 @@ void CL_LinkViewModel(void)
return;
#endif
if (!r_drawentities.value)
if (!r_drawentities.ival)
return;
if ((cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_INVISIBILITY) && r_drawviewmodelinvis.value <= 0)
@ -2851,40 +2901,33 @@ void CL_LinkViewModel(void)
ent.framestate.g[FS_REG].lerpfrac = 1-(realtime-lerptime[r_refdef.currentplayernum])/frameduration[r_refdef.currentplayernum];
ent.framestate.g[FS_REG].lerpfrac = bound(0, ent.framestate.g[FS_REG].lerpfrac, 1);
}
#define Q2RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define Q2RF_WEAPONMODEL 4 // only draw through eyes
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching
ent.flags = Q2RF_WEAPONMODEL|Q2RF_DEPTHHACK;
ent.flags = Q2RF_WEAPONMODEL|Q2RF_DEPTHHACK|RF_NOSHADOW;
V_AddEntity(&ent);
if (!v_powerupshell.value)
if (!v_powerupshell.ival)
return;
if (cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_QUAD)
{
#ifdef Q3SHADERS
if (v_powerupshell.value == 2)
if (v_powerupshell.ival == 2)
{
ent.forcedshader = R_RegisterCustom("powerups/quadWeapon", Shader_DefaultSkinShell, NULL);
V_AddEntity(&ent);
}
else
#endif
ent.flags |= Q2RF_SHELL_BLUE;
}
if (cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_INVULNERABILITY)
{
#ifdef Q3SHADERS
if (v_powerupshell.value == 2)
if (v_powerupshell.ival == 2)
{
ent.forcedshader = R_RegisterCustom("powerups/regen", Shader_DefaultSkinShell, NULL);
ent.fatness = -2.5;
V_AddEntity(&ent);
}
else
#endif
ent.flags |= Q2RF_SHELL_RED;
}
@ -2893,16 +2936,11 @@ void CL_LinkViewModel(void)
ent.fatness = 0.5;
ent.shaderRGBAf[3] /= 10;
#ifdef Q3SHADERS //fixme: do better.
//fixme: this is woefully gl specific. :(
if (qrenderer == QR_OPENGL)
{
ent.shaderRGBAf[0] = (!!(ent.flags & Q2RF_SHELL_RED));
ent.shaderRGBAf[1] = (!!(ent.flags & Q2RF_SHELL_GREEN));
ent.shaderRGBAf[2] = (!!(ent.flags & Q2RF_SHELL_BLUE));
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell, NULL);
}
#endif
ent.shaderRGBAf[0] = (!!(ent.flags & Q2RF_SHELL_RED));
ent.shaderRGBAf[1] = (!!(ent.flags & Q2RF_SHELL_GREEN));
ent.shaderRGBAf[2] = (!!(ent.flags & Q2RF_SHELL_BLUE));
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell, NULL);
V_AddEntity(&ent);
}
@ -2983,7 +3021,7 @@ void CL_SetUpPlayerPrediction(qboolean dopred)
if (playertime > realtime)
playertime = realtime;
if (cl_nopred.value || cls.demoplayback)
if (cl_nopred.value || cls.demoplayback || cl.paused)
return;
frame = &cl.frames[cl.parsecount&UPDATE_MASK];
@ -3034,7 +3072,7 @@ void CL_SetUpPlayerPrediction(qboolean dopred)
// only predict half the move to minimize overruns
msec = 500*(playertime - state->state_time);
if (msec <= 0 ||
(!cl_predict_players.value && !cl_predict_players2.value) ||
(!cl_predict_players.ival && !cl_predict_players2.ival) ||
!dopred)
{
VectorCopy (state->origin, pplayer->origin);
@ -3080,7 +3118,7 @@ void CL_SetSolidPlayers (int playernum)
struct predicted_player *pplayer;
physent_t *pent;
if (!cl_solid_players.value)
if (!cl_solid_players.ival)
return;
pent = pmove.physents + pmove.numphysent;
@ -3131,6 +3169,9 @@ void CL_SwapEntityLists(void)
// cl_visedicts = cl_visedicts_list[cls.netchan.incoming_sequence&1];
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
}
void CL_EmitEntities (void)

View File

@ -127,13 +127,13 @@ static void Display_Ignorelist(void) {
if (x)
Con_Printf ("\n");
if (ignore_opponents.value)
if (ignore_opponents.ival)
Con_Printf("\x02" "Opponents are Ignored\n");
if (ignore_spec.value == 2 || (ignore_spec.value == 1 && !cl.spectator))
if (ignore_spec.ival == 2 || (ignore_spec.ival == 1 && !cl.spectator))
Con_Printf ("\x02" "Spectators are Ignored\n");
if (ignore_qizmo_spec.value)
if (ignore_qizmo_spec.ival)
Con_Printf("\x02" "Qizmo spectators are Ignored\n");
Con_Printf("\n");
@ -399,13 +399,13 @@ qboolean Ignore_Message(char *s, int flags, int offset) {
int slot, i, p, q, len;
char name[MAX_SCOREBOARDNAME];
if (!ignore_mode.value && (flags & 2))
if (!ignore_mode.ival && (flags & 2))
return false;
if (ignore_spec.value == 2 && (flags == 4 || (flags == 8 && ignore_mode.value)))
if (ignore_spec.ival == 2 && (flags == 4 || (flags == 8 && ignore_mode.ival)))
return true;
else if (ignore_spec.value == 1 && (flags == 4) && !cl.spectator)
else if (ignore_spec.ival == 1 && (flags == 4) && !cl.spectator)
return true;
if (flags == 1 || flags == 4) {
@ -431,8 +431,8 @@ qboolean Ignore_Message(char *s, int flags, int offset) {
return true;
if (ignore_opponents.value && (
(int) ignore_opponents.value == 1 ||
if (ignore_opponents.ival && (
(int) ignore_opponents.ival == 1 ||
(cls.state >= ca_connected && /*!cl.standby &&*/ !cls.demoplayback && !cl.spectator) // match?
) &&
flags == 1 && !cl.spectator && slot != cl.playernum[0] &&

View File

@ -38,7 +38,7 @@ cvar_t cl_sparemsec = SCVARC("cl_sparemsec", "10", CL_SpareMsec_Callback);
cvar_t cl_queueimpulses = SCVAR("cl_queueimpulses", "0");
cvar_t cl_smartjump = SCVAR("cl_smartjump", "1");
cvar_t cl_prydoncursor = SCVAR("cl_prydoncursor", "0"); //for dp protocol
cvar_t cl_prydoncursor = SCVAR("cl_prydoncursor", ""); //for dp protocol
cvar_t cl_instantrotate = SCVARF("cl_instantrotate", "1", CVAR_SEMICHEAT);
cvar_t prox_inmenu = SCVAR("prox_inmenu", "0");
@ -81,6 +81,9 @@ int in_impulse[MAX_SPLITS][IN_IMPULSECACHE];
int in_nextimpulse[MAX_SPLITS];
int in_impulsespending[MAX_SPLITS];
float cursor_screen[2];
qboolean cursor_active;
void KeyDown (kbutton_t *b)
{
@ -165,7 +168,7 @@ void IN_MLookUp (void) {
pnum = atoi(c+strlen(c)-1);
if (pnum)pnum--;
KeyUp(&in_mlook);
if ( !(in_mlook.state[pnum]&1) && lookspring.value)
if ( !(in_mlook.state[pnum]&1) && lookspring.ival)
V_StartPitchDrift(pnum);
}
void IN_UpDown(void) {KeyDown(&in_up);}
@ -212,7 +215,7 @@ void IN_JumpDown (void)
condition = (cls.state == ca_active && cl_smartjump.value && !prox_inmenu.value);
condition = (cls.state == ca_active && cl_smartjump.ival && !prox_inmenu.ival);
#ifdef Q2CLIENT
if (condition && cls.protocol == CP_QUAKE2)
KeyDown(&in_up);
@ -229,7 +232,7 @@ void IN_JumpDown (void)
}
void IN_JumpUp (void)
{
if (cl_smartjump.value)
if (cl_smartjump.ival)
KeyUp(&in_up);
KeyUp(&in_jump);
}
@ -328,7 +331,7 @@ void IN_Impulse (void)
return;
}
if (cl_queueimpulses.value)
if (cl_queueimpulses.ival)
{
in_impulse[pnum][(in_nextimpulse[pnum]+in_impulsespending[pnum])%IN_IMPULSECACHE] = newimp;
in_impulsespending[pnum]++;
@ -412,7 +415,7 @@ void CL_ProxyMenuHook(char *command, kbutton_t *key)
void CL_ProxyMenuHooks(void)
{
if (!prox_inmenu.value)
if (!prox_inmenu.ival)
return;
CL_ProxyMenuHook("say proxy:menu down\n", &in_back);
@ -456,10 +459,10 @@ void CL_AdjustAngles (int pnum, double frametime)
if (in_speed.state[pnum] & 1)
{
if (ruleset_allow_frj.value)
speed = frametime * cl_anglespeedkey.value;
if (ruleset_allow_frj.ival)
speed = frametime * cl_anglespeedkey.ival;
else
speed = frametime * bound(-2, cl_anglespeedkey.value, 2);
speed = frametime * bound(-2, cl_anglespeedkey.ival, 2);
}
else
speed = frametime;
@ -467,17 +470,17 @@ void CL_AdjustAngles (int pnum, double frametime)
if (in_rotate && pnum==0 && !(cl.fpd & FPD_LIMIT_YAW))
{
quant = in_rotate;
if (!cl_instantrotate.value)
if (!cl_instantrotate.ival)
quant *= speed;
in_rotate -= quant;
if (ruleset_allow_frj.value)
if (ruleset_allow_frj.ival)
cl.viewangles[pnum][YAW] += quant;
}
if (!(in_strafe.state[pnum] & 1))
{
quant = cl_yawspeed.value;
if (cl.fpd & FPD_LIMIT_YAW || !ruleset_allow_frj.value)
quant = cl_yawspeed.ival;
if (cl.fpd & FPD_LIMIT_YAW || !ruleset_allow_frj.ival)
quant = bound(-900, quant, 900);
cl.viewangles[pnum][YAW] -= speed*quant * CL_KeyState (&in_right, pnum);
cl.viewangles[pnum][YAW] += speed*quant * CL_KeyState (&in_left, pnum);
@ -486,8 +489,8 @@ void CL_AdjustAngles (int pnum, double frametime)
if (in_klook.state[pnum] & 1)
{
V_StopPitchDrift (pnum);
quant = cl_pitchspeed.value;
if (cl.fpd & FPD_LIMIT_PITCH || !ruleset_allow_frj.value)
quant = cl_pitchspeed.ival;
if (cl.fpd & FPD_LIMIT_PITCH || !ruleset_allow_frj.ival)
quant = bound(-700, quant, 700);
cl.viewangles[pnum][PITCH] -= speed*quant * CL_KeyState (&in_forward, pnum);
cl.viewangles[pnum][PITCH] += speed*quant * CL_KeyState (&in_back, pnum);
@ -496,11 +499,11 @@ void CL_AdjustAngles (int pnum, double frametime)
up = CL_KeyState (&in_lookup, pnum);
down = CL_KeyState(&in_lookdown, pnum);
quant = cl_pitchspeed.value;
if (!ruleset_allow_frj.value)
quant = cl_pitchspeed.ival;
if (!ruleset_allow_frj.ival)
quant = bound(-700, quant, 700);
cl.viewangles[pnum][PITCH] -= speed*cl_pitchspeed.value * up;
cl.viewangles[pnum][PITCH] += speed*cl_pitchspeed.value * down;
cl.viewangles[pnum][PITCH] -= speed*cl_pitchspeed.ival * up;
cl.viewangles[pnum][PITCH] += speed*cl_pitchspeed.ival * down;
if (up || down)
V_StopPitchDrift (pnum);
@ -541,7 +544,7 @@ void CL_BaseMove (usercmd_t *cmd, int pnum, float extra, float wantfps)
cmd->sidemove -= scale*cl_sidespeed.value * CL_KeyState (&in_moveleft, pnum);
#ifdef IN_XFLIP
if(in_xflip.value) cmd->sidemove *= -1;
if(in_xflip.ival) cmd->sidemove *= -1;
#endif
@ -587,7 +590,7 @@ void CL_ClampPitch (int pnum)
else
#endif
#ifdef Q3CLIENT
if (cls.gamemode == CP_QUAKE3) //q3 expects the cgame to do it
if (cls.protocol == CP_QUAKE3) //q3 expects the cgame to do it
{
//no-op
}
@ -598,7 +601,7 @@ void CL_ClampPitch (int pnum)
cl.viewangles[pnum][PITCH] = cl.maxpitch;
if (cl.viewangles[pnum][PITCH] < cl.minpitch)
cl.viewangles[pnum][PITCH] = cl.minpitch;
}
}
}
/*
@ -652,19 +655,12 @@ void CL_FinishMove (usercmd_t *cmd, int msecs, int pnum)
cmd->impulse = 0;
}
float cursor_screen[2];
void CL_DrawPrydonCursor(void)
{
if (cls.protocol == CP_NETQUAKE)
if (nq_dp_protocol >= 6)
if (cl_prydoncursor.value)
if (cursor_active && cl_prydoncursor.ival)
{
mpic_t *pic = Draw_SafeCachePic(va("gfx/prydoncursor%03i.lmp", (int)cl_prydoncursor.value));
if (pic)
Draw_Pic((int)((cursor_screen[0] + 1) * 0.5 * vid.width), (int)((cursor_screen[1] + 1) * 0.5 * vid.height), pic);
else
Draw_Character((int)((cursor_screen[0] + 1) * 0.5 * vid.width), (int)((cursor_screen[1] + 1) * 0.5 * vid.height), '+');
SCR_DrawCursor(cl_prydoncursor.ival);
V_StopPitchDrift (0);
}
}
@ -675,15 +671,19 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
vec3_t temp;
vec3_t cursor_impact_normal;
if (!cl_prydoncursor.value)
extern int mousecursor_x, mousecursor_y;
cursor_active = true;
if (!cl_prydoncursor.ival)
{ //center the cursor
cursor_screen[0] = 0;
cursor_screen[1] = 0;
}
else
{
cursor_screen[0] += from->sidemove/10000.0f;
cursor_screen[1] -= from->forwardmove/10000.0f;
cursor_screen[0] = mousecursor_x/(vid.width/2.0f) - 1;
cursor_screen[1] = mousecursor_y/(vid.height/2.0f) - 1;
if (cursor_screen[0] < -1)
cursor_screen[0] = -1;
if (cursor_screen[1] < -1)
@ -717,23 +717,16 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
cl.cmd.cursor_screen[1] = 1;
}
*/
// cursor_screen[0] = bound(-1, cursor_screen[0], 1);
// cursor_screen[1] = bound(-1, cursor_screen[1], 1);
VectorClear(cursor_start);
temp[0] = (cursor_screen[0]+1)/2;
temp[1] = (-cursor_screen[1]+1)/2;
temp[2] = 1;
Matrix4_UnProject(temp, cursor_end, cl.viewangles[0], vec3_origin, scr_fov.value*(float)vid.width/vid.height, scr_fov.value );
VectorCopy(r_origin, cursor_start);
Matrix4_UnProject(temp, cursor_end, cl.viewangles[0], cursor_start, r_refdef.fov_x, r_refdef.fov_y);
VectorScale(cursor_end, 100000, cursor_end);
VectorAdd(cursor_start, cl.simorg[0], cursor_start);
VectorAdd(cursor_end, cl.simorg[0], cursor_end);
cursor_start[2]+=cl.viewheight[0];
cursor_end[2]+=cl.viewheight[0];
CL_SetSolidEntities();
//don't bother with players, they don't exist in NQ...
@ -1005,20 +998,20 @@ unsigned long _stdcall CL_IndepPhysicsThread(void *param)
{
int sleeptime;
float fps;
float time, lasttime;
unsigned int time, lasttime;
float spare;
lasttime = Sys_DoubleTime();
lasttime = Sys_Milliseconds();
while(1)
{
time = Sys_DoubleTime();
spare = CL_FilterTime((time - lasttime)*1000, cl_netfps.value);
time = Sys_Milliseconds();
spare = CL_FilterTime((time - lasttime), cl_netfps.value);
if (spare)
{
//don't let them bank too much and get sudden bursts
if (spare > 15)
spare = 15;
time -= spare/1000.0f;
time -= spare;
EnterCriticalSection(&indepcriticialsection);
if (cls.state)
{
@ -1210,20 +1203,20 @@ qboolean CL_WriteDeltas (int plnum, sizebuf_t *buf)
i = (cls.netchan.outgoing_sequence-2) & UPDATE_MASK;
cmd = &cl.frames[i].cmd[plnum];
if (cl_c2sImpulseBackup.value >= 2)
if (cl_c2sImpulseBackup.ival >= 2)
dontdrop = dontdrop || cmd->impulse;
MSG_WriteDeltaUsercmd (buf, &nullcmd, cmd);
oldcmd = cmd;
i = (cls.netchan.outgoing_sequence-1) & UPDATE_MASK;
if (cl_c2sImpulseBackup.value >= 3)
if (cl_c2sImpulseBackup.ival >= 3)
dontdrop = dontdrop || cmd->impulse;
cmd = &cl.frames[i].cmd[plnum];
MSG_WriteDeltaUsercmd (buf, oldcmd, cmd);
oldcmd = cmd;
i = (cls.netchan.outgoing_sequence) & UPDATE_MASK;
if (cl_c2sImpulseBackup.value >= 1)
if (cl_c2sImpulseBackup.ival >= 1)
dontdrop = dontdrop || cmd->impulse;
cmd = &cl.frames[i].cmd[plnum];
MSG_WriteDeltaUsercmd (buf, oldcmd, cmd);
@ -1261,7 +1254,7 @@ qboolean CL_SendCmdQ2 (sizebuf_t *buf)
checksumIndex = buf->cursize;
MSG_WriteByte (buf, 0);
if (!cl.q2frame.valid || cl_nodelta.value)
if (!cl.q2frame.valid || cl_nodelta.ival)
MSG_WriteLong (buf, -1); // no compression
else
MSG_WriteLong (buf, cl.q2frame.serverframe);
@ -1307,8 +1300,9 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
int seq_hash;
qboolean dontdrop = false;
usercmd_t *cmd;
int checksumIndex, firstsize, i, plnum;
int checksumIndex, firstsize, plnum;
int clientcount, lost;
int curframe = cls.netchan.outgoing_sequence & UPDATE_MASK;
seq_hash = cls.netchan.outgoing_sequence;
@ -1319,6 +1313,42 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
if (!clientcount)
clientcount = 1;
for (plnum = 0; plnum<clientcount; plnum++)
{
cmd = &cl.frames[curframe].cmd[plnum];
*cmd = independantphysics[plnum];
cmd->lightlevel = 0;
#ifdef CSQC_DAT
CSQC_Input_Frame(plnum, cmd);
#endif
memset(&independantphysics[plnum], 0, sizeof(independantphysics[plnum]));
}
cl.frames[curframe].senttime = realtime;
cl.frames[curframe].receivedtime = -1; // we haven't gotten a reply yet
if ((cls.fteprotocolextensions2 & PEXT2_PRYDONCURSOR) && *cl_prydoncursor.string)
{
vec3_t cursor_start, cursor_impact;
int cursor_entitynumber = 0;
cmd = &cl.frames[curframe].cmd[0];
CL_UpdatePrydonCursor(cmd, cursor_screen, cursor_start, cursor_impact, &cursor_entitynumber);
MSG_WriteByte (buf, clc_prydoncursor);
MSG_WriteShort(buf, cursor_screen[0] * 32767.0f);
MSG_WriteShort(buf, cursor_screen[1] * 32767.0f);
MSG_WriteFloat(buf, cursor_start[0]);
MSG_WriteFloat(buf, cursor_start[1]);
MSG_WriteFloat(buf, cursor_start[2]);
MSG_WriteFloat(buf, cursor_impact[0]);
MSG_WriteFloat(buf, cursor_impact[1]);
MSG_WriteFloat(buf, cursor_impact[2]);
MSG_WriteShort(buf, cursor_entitynumber);
}
else
cursor_active = false;
MSG_WriteByte (buf, clc_move);
// save the position for a checksum qbyte
@ -1332,18 +1362,7 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
firstsize=0;
for (plnum = 0; plnum<clientcount; plnum++)
{
i = cls.netchan.outgoing_sequence & UPDATE_MASK;
cmd = &cl.frames[i].cmd[plnum];
*cmd = independantphysics[plnum];
cmd->lightlevel = 0;
#ifdef CSQC_DAT
CSQC_Input_Frame(plnum, cmd);
#endif
cl.frames[i].senttime = realtime;
cl.frames[i].receivedtime = -1; // we haven't gotten a reply yet
memset(&independantphysics[plnum], 0, sizeof(independantphysics[plnum]));
cmd = &cl.frames[curframe].cmd[plnum];
if (plnum)
MSG_WriteByte (buf, clc_move);
@ -1364,7 +1383,7 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
if (cls.netchan.outgoing_sequence - cl.validsequence >= UPDATE_BACKUP-1)
cl.validsequence = 0;
if (cl.validsequence && !cl_nodelta.value && cls.state == ca_active && !cls.demorecording)
if (cl.validsequence && !cl_nodelta.ival && cls.state == ca_active && !cls.demorecording)
{
cl.frames[cls.netchan.outgoing_sequence&UPDATE_MASK].delta_sequence = cl.validsequence;
MSG_WriteByte (buf, clc_delta);
@ -1382,7 +1401,6 @@ qboolean CL_SendCmdQW (sizebuf_t *buf)
void CL_SendCmd (double frametime, qboolean mainloop)
{
extern cvar_t cl_indepphysics;
sizebuf_t buf;
qbyte data[512];
int i, plnum;
@ -1427,9 +1445,9 @@ void CL_SendCmd (double frametime, qboolean mainloop)
cl.frames[i].senttime = realtime; // we haven't gotten a reply yet
cl.frames[i].receivedtime = -1; // we haven't gotten a reply yet
if (cl.splitclients > cl_splitscreen.value+1)
if (cl.splitclients > cl_splitscreen.ival+1)
{
cl.splitclients = cl_splitscreen.value+1;
cl.splitclients = cl_splitscreen.ival+1;
if (cl.splitclients < 1)
cl.splitclients = 1;
}
@ -1533,8 +1551,8 @@ void CL_SendCmd (double frametime, qboolean mainloop)
#endif
))
fullsend = false;
if (spare > cl_sparemsec.value)
spare = cl_sparemsec.value;
if (spare > cl_sparemsec.ival)
spare = cl_sparemsec.ival;
if (spare > 0)
msecstouse -= spare;
}
@ -1680,7 +1698,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
else
#endif
//shamelessly stolen from fuhquake
if (cl_c2spps.value>0)
if (cl_c2spps.ival>0)
{
pps_balance += frametime;
// never drop more than 2 messages in a row -- that'll cause PL
@ -1688,7 +1706,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
if (pps_balance > 0 || dropcount >= 2 || dontdrop)
{
float pps;
pps = cl_c2spps.value;
pps = cl_c2spps.ival;
if (pps < 10) pps = 10;
if (pps > 72) pps = 72;
pps_balance -= 1 / pps;
@ -1914,13 +1932,3 @@ void CL_InitInput (void)
Cvar_Register (&cl_prydoncursor, inputnetworkcvargroup);
Cvar_Register (&cl_instantrotate, inputnetworkcvargroup);
}
/*
============
CL_ClearStates
============
*/
void CL_ClearStates (void)
{
}

View File

@ -118,6 +118,7 @@ cvar_t cl_chatsound = SCVAR("cl_chatsound","1");
cvar_t cl_enemychatsound = SCVAR("cl_enemychatsound", "misc/talk.wav");
cvar_t cl_teamchatsound = SCVAR("cl_teamchatsound", "misc/talk.wav");
cvar_t r_torch = SCVARF("r_torch", "0", CVAR_CHEAT);
cvar_t r_rocketlight = SCVARC("r_rocketlight", "1", Cvar_Limiter_ZeroToOne_Callback);
cvar_t r_lightflicker = SCVAR("r_lightflicker", "1");
cvar_t cl_r2g = SCVAR("cl_r2g", "0");
@ -162,6 +163,7 @@ cvar_t ruleset_allow_larger_models = SCVAR("ruleset_allow_larger_models", "1");
cvar_t ruleset_allow_modified_eyes = SCVAR("ruleset_allow_modified_eyes", "0");
cvar_t ruleset_allow_sensative_texture_replacements = SCVAR("ruleset_allow_sensative_texture_replacements", "1");
cvar_t ruleset_allow_localvolume = SCVAR("ruleset_allow_localvolume", "1");
cvar_t ruleset_allow_shaders = SCVAR("ruleset_allow_shaders", "1");
extern cvar_t cl_hightrack;
extern cvar_t vid_renderer;
@ -182,10 +184,11 @@ entity_t cl_static_entities[MAX_STATIC_ENTITIES];
trailstate_t *cl_static_emit[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
//lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS];
dlight_t *cl_dlights;
unsigned int cl_maxdlights; /*size of cl_dlights array*/
int cl_baselines_count;
int dlights_running, dlights_software;
int rtlights_first, rtlights_max;
// refresh list
// this is double buffered so the last frame
@ -194,6 +197,18 @@ int cl_numvisedicts, cl_oldnumvisedicts;
entity_t *cl_visedicts, *cl_oldvisedicts;
entity_t cl_visedicts_list[2][MAX_VISEDICTS];
scenetris_t *cl_stris;
vecV_t *cl_strisvertv;
vec4_t *cl_strisvertc;
vec2_t *cl_strisvertt;
index_t *cl_strisidx;
unsigned int cl_numstrisidx;
unsigned int cl_maxstrisidx;
unsigned int cl_numstrisvert;
unsigned int cl_maxstrisvert;
unsigned int cl_numstris;
unsigned int cl_maxstris;
double connect_time = -1; // for connection retransmits
int connect_type = 0;
int connect_tries = 0; //increased each try, every fourth trys nq connect packets.
@ -279,6 +294,7 @@ void CL_ConnectToDarkPlaces(char *challenge, netadr_t adr)
{
char data[2048];
cls.fteprotocolextensions = 0;
cls.fteprotocolextensions2 = 0;
cls.resendinfo = false;
@ -292,9 +308,10 @@ void CL_ConnectToDarkPlaces(char *challenge, netadr_t adr)
}
#ifdef PROTOCOL_VERSION_FTE
unsigned int CL_SupportedFTEExtensions(void)
void CL_SupportedFTEExtensions(int *pext1, int *pext2)
{
unsigned int fteprotextsupported = 0;
unsigned int fteprotextsupported2 = 0;
#ifdef PEXT_SCALE //dmw - protocol extensions
fteprotextsupported |= PEXT_SCALE;
@ -373,12 +390,19 @@ unsigned int CL_SupportedFTEExtensions(void)
fteprotextsupported |= PEXT_DPFLAGS;
#endif
fteprotextsupported2 |= PEXT2_PRYDONCURSOR;
fteprotextsupported &= strtoul(cl_pext_mask.string, NULL, 16);
// fteprotextsupported2 &= strtoul(cl_pext2_mask.string, NULL, 16);
if (cl_nopext.value)
if (cl_nopext.ival)
{
fteprotextsupported = 0;
fteprotextsupported2 = 0;
}
return fteprotextsupported;
*pext1 = fteprotextsupported;
*pext2 = fteprotextsupported2;
}
#endif
@ -391,7 +415,7 @@ called by CL_Connect_f and CL_CheckResend
*/
void CL_SendConnectPacket (
#ifdef PROTOCOL_VERSION_FTE
int ftepext,
int ftepext, int ftepext2,
#endif
int compressioncrc
/*, ...*/) //dmw new parms
@ -403,6 +427,7 @@ void CL_SendConnectPacket (
double t1, t2;
#ifdef PROTOCOL_VERSION_FTE
int fteprotextsupported=0;
int fteprotextsupported2=0;
#endif
int clients;
int c;
@ -414,15 +439,16 @@ void CL_SendConnectPacket (
if (cls.state != ca_disconnected)
return;
if (cl_nopext.value) //imagine it's an unenhanced server
if (cl_nopext.ival) //imagine it's an unenhanced server
{
compressioncrc = 0;
}
#ifdef PROTOCOL_VERSION_FTE
fteprotextsupported = CL_SupportedFTEExtensions();
CL_SupportedFTEExtensions(&fteprotextsupported, &fteprotextsupported2);
fteprotextsupported &= ftepext;
fteprotextsupported2 &= ftepext2;
#ifdef Q2CLIENT
if (cls.protocol != CP_QUAKEWORLD)
@ -430,6 +456,7 @@ void CL_SendConnectPacket (
#endif
cls.fteprotocolextensions = fteprotextsupported;
cls.fteprotocolextensions2 = fteprotextsupported2;
#endif
t1 = Sys_DoubleTime ();
@ -526,6 +553,10 @@ void CL_SendConnectPacket (
if (ftepext)
Q_strncatz(data, va("0x%x 0x%x\n", PROTOCOL_VERSION_FTE, fteprotextsupported), sizeof(data));
#endif
#ifdef PROTOCOL_VERSION_FTE2
if (ftepext2)
Q_strncatz(data, va("0x%x 0x%x\n", PROTOCOL_VERSION_FTE2, fteprotextsupported2), sizeof(data));
#endif
#ifdef HUFFNETWORK
if (compressioncrc && Huff_CompressionCRC(compressioncrc))
@ -616,7 +647,7 @@ void CL_CheckForResend (void)
CL_ConnectToDarkPlaces("", adr);
}
else
CL_SendConnectPacket (svs.fteprotocolextensions, false);
CL_SendConnectPacket (svs.fteprotocolextensions, svs.fteprotocolextensions2, false);
return;
}
#endif
@ -839,7 +870,6 @@ void CLNQ_Connect_f (void)
#endif
#ifdef IRCCONNECT
struct ftenet_generic_connection_s *FTENET_IRCConnect_EstablishConnection(qboolean isserver, char *address);
void CL_IRCConnect_f (void)
{
CL_Disconnect_f ();
@ -1025,7 +1055,7 @@ void CL_ClearState (void)
// memset (cl_dlights, 0, sizeof(cl_dlights));
memset (cl_lightstyle, 0, sizeof(cl_lightstyle));
dlights_running = 0;
rtlights_first = rtlights_max = RTL_FIRST;
if (cl_baselines)
{
@ -1144,7 +1174,7 @@ void CL_Disconnect (void)
if (cl.worldmodel)
{
#if defined(RUNTIMELIGHTING) && defined(RGLQUAKE)
#if defined(RUNTIMELIGHTING) && defined(GLQUAKE)
extern model_t *lightmodel;
lightmodel = NULL;
#endif
@ -1374,9 +1404,6 @@ void CL_CheckServerInfo(void)
unsigned int allowed;
int oldstate;
int oldteamplay;
qboolean oldallowshaders;
oldallowshaders = cls.allow_shaders;
oldteamplay = cl.teamplay;
cl.teamplay = atoi(Info_ValueForKey(cl.serverinfo, "teamplay"));
@ -1388,7 +1415,6 @@ void CL_CheckServerInfo(void)
cls.allow_watervis=false;
cls.allow_skyboxes=false;
cls.allow_mirrors=false;
cls.allow_shaders=false;
cls.allow_luma=false;
cls.allow_bump=false;
#ifdef FISH
@ -1435,18 +1461,12 @@ void CL_CheckServerInfo(void)
cls.allow_cheats = true;
s = Info_ValueForKey(cl.serverinfo, "strict");
if ((!cl.spectator && !cls.demoplayback && *s && strcmp(s, "0")) || !ruleset_allow_semicheats.value)
if ((!cl.spectator && !cls.demoplayback && *s && strcmp(s, "0")) || !ruleset_allow_semicheats.ival)
{
cls.allow_semicheats = false;
cls.allow_cheats = false;
}
cls.allow_shaders = cls.allow_cheats;
if (cl.spectator || cls.demoplayback || atoi(Info_ValueForKey(cl.serverinfo, "allow_shaders")))
cls.allow_shaders=true;
cls.maxfps = atof(Info_ValueForKey(cl.serverinfo, "maxfps"));
if (cls.maxfps < 20)
cls.maxfps = 72;
@ -1471,10 +1491,18 @@ void CL_CheckServerInfo(void)
movevars.stepheight = PM_DEFAULTSTEPHEIGHT;
// Initialize cl.maxpitch & cl.minpitch
s = (cls.z_ext & Z_EXT_PITCHLIMITS) ? Info_ValueForKey (cl.serverinfo, "maxpitch") : "";
cl.maxpitch = *s ? Q_atof(s) : 80.0f;
s = (cls.z_ext & Z_EXT_PITCHLIMITS) ? Info_ValueForKey (cl.serverinfo, "minpitch") : "";
cl.minpitch = *s ? Q_atof(s) : -70.0f;
if (cls.protocol == CP_QUAKEWORLD || cls.protocol == CP_NETQUAKE)
{
s = (cls.z_ext & Z_EXT_PITCHLIMITS) ? Info_ValueForKey (cl.serverinfo, "maxpitch") : "";
cl.maxpitch = *s ? Q_atof(s) : 80.0f;
s = (cls.z_ext & Z_EXT_PITCHLIMITS) ? Info_ValueForKey (cl.serverinfo, "minpitch") : "";
cl.minpitch = *s ? Q_atof(s) : -70.0f;
}
else
{
cl.maxpitch = 89.9;
cl.minpitch = -89.9;
}
allowed = atoi(Info_ValueForKey(cl.serverinfo, "allow"));
if (allowed & 1)
@ -1485,8 +1513,7 @@ void CL_CheckServerInfo(void)
cls.allow_skyboxes = true;
if (allowed & 8)
cls.allow_mirrors = true;
if (allowed & 16)
cls.allow_shaders = true;
//16
if (allowed & 32)
cls.allow_luma = true;
if (allowed & 64)
@ -1526,8 +1553,6 @@ void CL_CheckServerInfo(void)
Cvar_ForceCheatVars(cls.allow_semicheats, cls.allow_cheats);
Validation_Apply_Ruleset();
if (oldallowshaders != cls.allow_shaders)
Cache_Flush(); //this will cause all models to be reloaded.
if (oldteamplay != cl.teamplay)
Skin_FlushPlayers();
}
@ -1622,7 +1647,7 @@ void CL_FullInfo_f (void)
if (!stricmp(key, pmodel_name) || !stricmp(key, emodel_name))
continue;
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING);
Info_SetValueForKey (cls.userinfo, key, value, sizeof(cls.userinfo));
}
}
@ -1636,7 +1661,7 @@ void CL_SetInfo (char *key, char *value)
return;
}
Info_SetValueForStarKey (cls.userinfo, key, value, MAX_INFO_STRING);
Info_SetValueForStarKey (cls.userinfo, key, value, sizeof(cls.userinfo));
if (cls.state >= ca_connected)
{
#ifdef Q2CLIENT
@ -1755,7 +1780,7 @@ void CL_Packet_f (void)
cls.realserverip = adr;
Con_DPrintf ("Sending realip packet\n");
}
else if (!ruleset_allow_packet.value)
else if (!ruleset_allow_packet.ival)
{
Con_Printf("Sorry, the %s command is disallowed\n", Cmd_Argv(0));
return;
@ -1818,7 +1843,10 @@ void CL_NextDemo (void)
}
}
sprintf (str,"playdemo %s\n", cls.demos[cls.demonum]);
if (!strcmp(cls.demos[cls.demonum], "quit"))
sprintf (str,"quit\n");
else
sprintf (str,"playdemo %s\n", cls.demos[cls.demonum]);
Cbuf_InsertText (str, RESTRICT_LOCAL, false);
cls.demonum++;
}
@ -2060,7 +2088,7 @@ void CL_ConnectionlessPacket (void)
if (c == S2C_CHALLENGE)
{
unsigned long pext = 0, huffcrc=0;
unsigned long pext = 0, pext2 = 0, huffcrc=0;
Con_TPrintf (TLC_S2C_CHALLENGE);
s = MSG_ReadString ();
@ -2072,7 +2100,7 @@ void CL_ConnectionlessPacket (void)
{
cls.protocol = CP_QUAKE3;
cls.challenge = atoi(s+17);
CL_SendConnectPacket (0, 0/*, ...*/);
CL_SendConnectPacket (0, 0, 0/*, ...*/);
}
else
{
@ -2150,6 +2178,8 @@ void CL_ConnectionlessPacket (void)
break;
if (c == PROTOCOL_VERSION_FTE)
pext = MSG_ReadLong ();
else if (c == PROTOCOL_VERSION_FTE2)
pext2 = MSG_ReadLong ();
#ifdef HUFFNETWORK
else if (c == (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)))
huffcrc = MSG_ReadLong ();
@ -2158,7 +2188,7 @@ void CL_ConnectionlessPacket (void)
else
MSG_ReadLong ();
}
CL_SendConnectPacket (pext, huffcrc/*, ...*/);
CL_SendConnectPacket (pext, pext2, huffcrc/*, ...*/);
return;
}
#ifdef Q2CLIENT
@ -2558,7 +2588,6 @@ void CL_ReadPackets (void)
CLQ3_ParseServerMessage();
#endif
break;
break;
case CP_QUAKEWORLD:
if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
{
@ -2691,7 +2720,7 @@ void CL_DownloadSize_f(void)
dl = CL_DownloadFailed(rname);
if (allow_download_redirection.value)
if (allow_download_redirection.ival)
{
Con_DPrintf("Download of \"%s\" redirected to \"%s\".\n", rname, redirection);
CL_CheckOrEnqueDownloadFile(redirection, NULL, dl->flags);
@ -2836,7 +2865,7 @@ void CL_Init (void)
cls.state = ca_disconnected;
sprintf (st, "%s %i", DISTRIBUTION, build_number());
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING);
Info_SetValueForStarKey (cls.userinfo, "*ver", st, sizeof(cls.userinfo));
InitValidation();
@ -2844,6 +2873,7 @@ void CL_Init (void)
CL_InitTEnts ();
CL_InitPrediction ();
CL_InitCam ();
CL_InitDlights();
PM_Init ();
TP_Init();
@ -2908,6 +2938,7 @@ void CL_Init (void)
Cvar_Register (&cl_staticsounds, "Item effects");
Cvar_Register (&r_torch, "Item effects");
Cvar_Register (&r_rocketlight, "Item effects");
Cvar_Register (&r_lightflicker, "Item effects");
Cvar_Register (&cl_r2g, "Item effects");
@ -2987,6 +3018,7 @@ void CL_Init (void)
Cvar_Register (&ruleset_allow_modified_eyes, cl_controlgroup);
Cvar_Register (&ruleset_allow_sensative_texture_replacements, cl_controlgroup);
Cvar_Register (&ruleset_allow_localvolume, cl_controlgroup);
Cvar_Register (&ruleset_allow_shaders, cl_controlgroup);
Cvar_Register (&qtvcl_forceversion1, cl_controlgroup);
Cvar_Register (&qtvcl_eztvextensions, cl_controlgroup);
@ -3006,6 +3038,10 @@ void CL_Init (void)
Cmd_AddCommand ("demo_jump", CL_DemoJump_f);
Cmd_AddCommand ("timedemo", CL_TimeDemo_f);
#ifdef _DEBUG
Cmd_AddCommand ("crashme", (void*)~0);
#endif
Cmd_AddCommand ("showpic", SCR_ShowPic_Script_f);
Cmd_AddCommand ("startdemos", CL_Startdemos_f);
@ -3244,9 +3280,12 @@ void Host_Frame (double time)
// realframetime *= cl_demospeed.value; // this probably screws up other timings
#ifndef CLIENTONLY
RSpeedRemark();
SV_Frame();
RSpeedEnd(RSPEED_SERVER);
if (sv.state)
{
RSpeedRemark();
SV_Frame();
RSpeedEnd(RSPEED_SERVER);
}
#endif
if (cl.gamespeed<0.1)
@ -3286,22 +3325,22 @@ void Host_Frame (double time)
*/
Mod_Think(); //think even on idle (which means small walls and a fast cpu can get more surfaces done.
if ((cl_netfps.value>0 || cls.demoplayback || cl_indepphysics.value))
if ((cl_netfps.value>0 || cls.demoplayback || cl_indepphysics.ival))
{ //limit the fps freely, and expect the netfps to cope.
if (cl_maxfps.value > 0)
if (cl_maxfps.ival > 0)
if ((realtime - oldrealtime) < 1/cl_maxfps.value)
return;
}
else
{
realtime += spare/1000; //don't use it all!
spare = CL_FilterTime((realtime - oldrealtime)*1000, (cl_maxfps.value>0||cls.protocol!=CP_QUAKEWORLD)?cl_maxfps.value:cl_netfps.value);
spare = CL_FilterTime((realtime - oldrealtime)*1000, (cl_maxfps.ival>0||cls.protocol!=CP_QUAKEWORLD)?cl_maxfps.value:cl_netfps.value);
if (!spare)
return;
if (spare < 0 || cls.state < ca_onserver)
spare = 0; //uncapped.
if (spare > cl_sparemsec.value)
spare = cl_sparemsec.value;
if (spare > cl_sparemsec.ival)
spare = cl_sparemsec.ival;
realtime -= spare/1000; //don't use it all!
}
@ -3343,7 +3382,7 @@ void Host_Frame (double time)
RSpeedRemark();
CL_UseIndepPhysics(!!cl_indepphysics.value);
CL_UseIndepPhysics(!!cl_indepphysics.ival);
CL_AllowIndependantSendCmd(false);
@ -3359,7 +3398,7 @@ void Host_Frame (double time)
}
else
{
CL_SendCmd (host_frametime/cl.gamespeed, true);
CL_SendCmd (cl.gamespeed?host_frametime/cl.gamespeed:host_frametime, true);
if (cls.state == ca_onserver && cl.validsequence && cl.worldmodel)
{ // first update is the final signon stage
@ -3371,7 +3410,7 @@ void Host_Frame (double time)
RSpeedEnd(RSPEED_PROTOCOL);
// update video
if (host_speeds.value)
if (host_speeds.ival)
time1 = Sys_DoubleTime ();
if (SCR_UpdateScreen)
@ -3379,7 +3418,7 @@ void Host_Frame (double time)
extern mleaf_t *r_viewleaf;
extern cvar_t scr_chatmodecvar;
if (scr_chatmodecvar.value && !cl.intermission)
if (scr_chatmodecvar.ival && !cl.intermission)
scr_chatmode = (cl.spectator&&cl.splitclients<2&&cls.state == ca_active)?2:1;
else
scr_chatmode = 0;
@ -3391,7 +3430,7 @@ void Host_Frame (double time)
SNDDMA_SetUnderWater(false);
}
if (host_speeds.value)
if (host_speeds.ival)
time2 = Sys_DoubleTime ();
// update audio
@ -3412,7 +3451,7 @@ void Host_Frame (double time)
CDAudio_Update();
if (host_speeds.value)
if (host_speeds.ival)
{
pass1 = (time1 - time3)*1000;
time3 = Sys_DoubleTime ();

View File

@ -253,7 +253,7 @@ int CL_CalcNet (void)
lost++;
}
if (!cl_countpendingpl.value)
if (!cl_countpendingpl.ival)
{
pending = cls.netchan.outgoing_sequence - cls.netchan.incoming_sequence - 1;
lost -= pending;
@ -770,7 +770,7 @@ void Model_CheckDownloads (void)
#ifdef Q2CLIENT
if (cls.protocol == CP_QUAKE2)
{
R_SetSky(cl.skyname, cl.skyrotate, cl.skyaxis);
// R_SetSky(cl.skyname);
for (i = 0; i < Q2MAX_IMAGES; i++)
{
char picname[256];
@ -837,7 +837,7 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
{
extern cvar_t allow_download_csprogs;
unsigned int chksum = strtoul(s, NULL, 0);
if (allow_download_csprogs.value)
if (allow_download_csprogs.ival)
{
char *str = va("csprogsvers/%x.dat", chksum);
if (CL_CheckOrEnqueDownloadFile("csprogs.dat", str, DLLF_REQUIRED))
@ -865,12 +865,16 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
if (atstage())
{
char *s;
s = Info_ValueForKey(cl.serverinfo, "*csprogs");
#ifndef FTE_DEBUG
if (*s || cls.demoplayback) //only allow csqc if the server says so, and the 'checksum' matches.
qboolean anycsqc;
#if 0//ndef FTE_DEBUG
anycsqc = true;
#else
anycsqc = atoi(Info_ValueForKey(cl.serverinfo, "anycsqc"));
#endif
s = Info_ValueForKey(cl.serverinfo, "*csprogs");
if (anycsqc || *s || cls.demoplayback) //only allow csqc if the server says so, and the 'checksum' matches.
{
unsigned int chksum = strtoul(s, NULL, 0);
unsigned int chksum = anycsqc?0:strtoul(s, NULL, 0);
if (CSQC_Init(chksum))
{
CL_SendClientCommand(true, "enablecsqc");
@ -965,8 +969,6 @@ int CL_LoadModels(int stage, qboolean dontactuallyload)
else
cl.hexen2pickups = false;
R_CheckSky();
#ifdef CSQC_DAT
CSQC_WorldLoaded();
#endif
@ -1079,7 +1081,7 @@ void Sound_CheckDownloads (void)
{
extern cvar_t allow_download_csprogs;
unsigned int chksum = strtoul(s, NULL, 0);
if (allow_download_csprogs.value)
if (allow_download_csprogs.ival)
{
char *str = va("csprogsvers/%x.dat", chksum);
CL_CheckOrEnqueDownloadFile("csprogs.dat", str, DLLF_REQUIRED);
@ -1222,7 +1224,7 @@ void CL_RequestNextDownload (void)
{
if (CL_RemoveClientCommands("qtvspawn"))
Con_Printf("Multiple prespawns\n");
CL_SendClientCommand(true, "qtvspawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(true, "qtvspawn %i 0 %i", cl.servercount, COM_RemapMapChecksum(LittleLong(cl.worldmodel->checksum2)));
SCR_SetLoadingStage(LS_NONE);
}
else
@ -1231,7 +1233,7 @@ void CL_RequestNextDownload (void)
if (CL_RemoveClientCommands("prespawn"))
Con_Printf("Multiple prespawns\n");
// CL_SendClientCommand("prespawn %i 0 %i", cl.servercount, cl.worldmodel->checksum2);
CL_SendClientCommand(true, prespawn_name, cl.servercount, LittleLong(cl.worldmodel->checksum2));
CL_SendClientCommand(true, prespawn_name, cl.servercount, COM_RemapMapChecksum(LittleLong(cl.worldmodel->checksum2)));
}
}
@ -1676,7 +1678,7 @@ void CL_ParseDownload (void)
if (cls.downloadmethod == DL_QWPENDING)
cls.downloadmethod = DL_QW;
if (percent != 100 && size == 0 && cl_dlemptyterminate.value)
if (percent != 100 && size == 0 && cl_dlemptyterminate.ival)
{
Con_Printf(CON_WARNING "WARNING: Client received empty svc_download, assuming EOF\n");
percent = 100;
@ -2012,14 +2014,18 @@ void CL_ParseServerData (void)
// allow 2.2 and 2.29 demos to play
#ifdef PROTOCOL_VERSION_FTE
cls.fteprotocolextensions=0;
cls.fteprotocolextensions2=0;
for(;;)
{
protover = MSG_ReadLong ();
if (protover == PROTOCOL_VERSION_FTE)
{
cls.fteprotocolextensions = MSG_ReadLong();
if (developer.value || cl_shownet.value)
Con_TPrintf (TL_FTEEXTENSIONS, cls.fteprotocolextensions);
continue;
}
if (protover == PROTOCOL_VERSION_FTE2)
{
cls.fteprotocolextensions2 = MSG_ReadLong();
continue;
}
if (protover == PROTOCOL_VERSION_QW) //this ends the version info
@ -2035,6 +2041,10 @@ void CL_ParseServerData (void)
Host_EndGame ("Server returned version %i, not %i\n", protover, PROTOCOL_VERSION_QW);
#endif
if (cls.fteprotocolextensions2||cls.fteprotocolextensions)
if (developer.ival || cl_shownet.ival)
Con_TPrintf (TL_FTEEXTENSIONS, cls.fteprotocolextensions2, cls.fteprotocolextensions);
if (cls.fteprotocolextensions & PEXT_FLOATCOORDS)
{
sizeofcoord = 4;
@ -2323,7 +2333,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
char *str;
int gametype;
int protover;
if (developer.value)
if (developer.ival)
Con_TPrintf (TLC_GOTSVDATAPACKET);
SCR_SetLoadingStage(LS_CLIENT);
CL_ClearState ();
@ -2453,7 +2463,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
{
Info_SetValueForStarKey(cl.serverinfo, "*csprogs", va("%i", cl_dp_csqc_progscrc), sizeof(cl.serverinfo));
Info_SetValueForStarKey(cl.serverinfo, "*csprogssize", va("%i", cl_dp_csqc_progssize), sizeof(cl.serverinfo));
Info_SetValueForStarKey(cl.serverinfo, "*csprogsname", va("%i", cl_dp_csqc_progsname), sizeof(cl.serverinfo));
Info_SetValueForStarKey(cl.serverinfo, "*csprogsname", va("%s", cl_dp_csqc_progsname), sizeof(cl.serverinfo));
}
//update gamemode
@ -2494,7 +2504,7 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
case 2:
CL_SendClientCommand(true, "name \"%s\"\n", name.string);
CL_SendClientCommand(true, "color %i %i\n", (int)topcolor.value, (int)bottomcolor.value);
CL_SendClientCommand(true, "color %i %i\n", topcolor.ival, bottomcolor.ival);
CL_SendClientCommand(true, "spawn %s", "");
@ -3160,7 +3170,8 @@ void CL_ParseStaticSound (void)
vol = MSG_ReadByte ();
atten = MSG_ReadByte ();
if (!cl_staticsounds.value)
vol *= cl_staticsounds.value;
if (vol < 0)
return;
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
@ -3739,7 +3750,7 @@ void CL_MuzzleFlash (int destsplit)
i = MSG_ReadShort ();
//was it us?
if (!cl_muzzleflash.value) // remove all muzzleflashes
if (!cl_muzzleflash.ival) // remove all muzzleflashes
return;
if (i-1 == cl.playernum[destsplit] && cl_muzzleflash.value == 2)
@ -4241,7 +4252,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
if (plr) // use special formatting with a real chat message
name = plr->name; // use player's name
if (cl_standardchat.value)
if (cl_standardchat.ival)
{
name_coloured = true;
c = 7;
@ -4288,7 +4299,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
Q_strncatz(fullchatmessage, va("%s%s^d", name_coloured?"^m":"", name), sizeof(fullchatmessage));
Q_strncatz(fullchatmessage, va("%s^%c)", name_coloured?"^m":"", c), sizeof(fullchatmessage));
}
else if (cl_standardchat.value)
else if (cl_standardchat.ival)
{
Q_strncatz(fullchatmessage, va("\1%s", name), sizeof(fullchatmessage));
}
@ -4403,7 +4414,7 @@ void CL_PrintStandardMessage(char *msg, int printlevel)
msg = v + len; // update search point
// get name color
if (p->spectator || cl_standardmsg.value)
if (p->spectator || cl_standardmsg.ival)
{
coloured = false;
c = '7';
@ -5147,7 +5158,7 @@ void CLQ2_ParseServerMessage (void)
switch (cmd)
{
default:
Host_EndGame ("CL_ParseServerMessage: Illegible server message");
Host_EndGame ("CLQ2_ParseServerMessage: Illegible server message (%i)", cmd);
return;
//known to game
@ -5523,8 +5534,8 @@ void CLNQ_ParseServerMessage (void)
cl.playernum[0] = (cl.viewentity[0] = MSG_ReadShort())-1;
if (cl.playernum[0] >= MAX_CLIENTS)
{
cl.playernum[0] = 32; //pretend it's an mvd (we have that spare slot)
Con_Printf(CON_WARNING "WARNING: Server put us in slot %i. We are not on the scoreboard.\n");
Con_Printf(CON_WARNING "WARNING: Server put us in slot %i. We are not on the scoreboard.\n", cl.playernum[0]);
cl.playernum[0] = MAX_CLIENTS; //pretend it's an mvd (we have that spare slot)
}
}
else

View File

@ -215,7 +215,7 @@ qintptr_t VARGS Plug_Draw_Line(void *offset, quintptr_t mask, const qintptr_t *a
{
switch(qrenderer) //FIXME: I don't want qrenderer seen outside the refresh
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
case QR_OPENGL:
qglDisable(GL_TEXTURE_2D);
qglBegin(GL_LINES);
@ -232,9 +232,12 @@ qintptr_t VARGS Plug_Draw_Line(void *offset, quintptr_t mask, const qintptr_t *a
}
qintptr_t VARGS Plug_Draw_Character(void *offset, quintptr_t mask, const qintptr_t *arg)
{
int x, y;
if (qrenderer <= 0)
return 0;
Draw_Character(arg[0], arg[1], (unsigned int)arg[2]);
Font_BeginString(font_conchar, arg[0], arg[1], &x, &y);
Font_DrawChar(x, y, CON_WHITEMASK | 0xe000 | (unsigned int)arg[2]);
Font_EndString(font_conchar);
return 0;
}
void (D3D_Draw_Fill_Colours) (int x, int y, int w, int h);
@ -249,7 +252,7 @@ qintptr_t VARGS Plug_Draw_Fill(void *offset, quintptr_t mask, const qintptr_t *a
height = VM_FLOAT(arg[3]);
switch(qrenderer) //FIXME: I don't want qrenderer seen outside the refresh
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
case QR_OPENGL:
qglDisable(GL_TEXTURE_2D);
qglBegin(GL_QUADS);

View File

@ -644,17 +644,21 @@ void CL_CalcClientTime(void)
{
float want;
float oldst = cl.servertime;
float oldst = realtime;
want = cl.oldgametime + (realtime - cl.gametimemark);
if (want>cl.servertime)
cl.servertime = want;
if (cl.servertime > cl.gametime)
cl.servertime = cl.gametime;
if (cl.servertime < cl.oldgametime)
cl.servertime = cl.oldgametime;
if (!(cls.fteprotocolextensions & PEXT_ACCURATETIMINGS) && cls.protocol == CP_QUAKEWORLD)
cl.servertime = cl.time;
else
{
want = cl.oldgametime + (realtime - cl.gametimemark);
if (want>cl.servertime)
cl.servertime = want;
if (cl.servertime > cl.gametime)
cl.servertime = cl.gametime;
if (cl.servertime < cl.oldgametime)
cl.servertime = cl.oldgametime;
}
if (oldst == 0)
{
int i;
@ -806,7 +810,7 @@ void CL_PredictMovePNum (int pnum)
f = 1-f;
// Con_Printf("%f\n", f);
// if (cl_nolerp.value)
// if (cl_nolerp.ival)
// f = 1;

View File

@ -21,9 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl_screen.c -- master for refresh, status bar, console, chat, notify, etc
#include "quakedef.h"
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"//would prefer not to have this
#endif
#include "shader.h"
//name of the current backdrop for the loading screen
char levelshotname[MAX_QPATH];
@ -39,7 +40,7 @@ void RSpeedShow(void)
char *s;
static int framecount;
if (!r_speeds.value)
if (!r_speeds.ival)
return;
memset(RSpNames, 0, sizeof(RSpNames));
@ -49,7 +50,7 @@ void RSpeedShow(void)
RSpNames[RSPEED_WORLDNODE] = "World walking";
RSpNames[RSPEED_WORLD] = "World rendering";
RSpNames[RSPEED_DYNAMIC] = "Lightmap updates";
RSpNames[RSPEED_PARTICLES] = "Particle physics and sorting";
RSpNames[RSPEED_PARTICLES] = "Particle phys/sort";
RSpNames[RSPEED_PARTICLESDRAW] = "Particle drawing";
RSpNames[RSPEED_2D] = "2d elements";
RSpNames[RSPEED_SERVER] = "Server";
@ -61,7 +62,7 @@ void RSpeedShow(void)
RSpNames[RSPEED_FULLBRIGHTS] = "World fullbrights";
RSpNames[RSPEED_FINISH] = "Waiting for card to catch up";
RSpNames[RSPEED_FINISH] = "glFinish";
RQntNames[RQUANT_MSECS] = "Microseconds";
RQntNames[RQUANT_EPOLYS] = "Entity Polys";
@ -72,16 +73,16 @@ void RSpeedShow(void)
for (i = 0; i < RSPEED_MAX; i++)
{
s = va("%i %-30s", samplerspeeds[i], RSpNames[i]);
Draw_String(vid.width-strlen(s)*8, i*8, s);
s = va("%i %-20s", samplerspeeds[i], RSpNames[i]);
Draw_FunString(vid.width-strlen(s)*8, i*8, s);
}
for (i = 0; i < RQUANT_MAX; i++)
{
s = va("%i %-30s", samplerquant[i], RQntNames[i]);
Draw_String(vid.width-strlen(s)*8, (i+RSPEED_MAX)*8, s);
s = va("%i %-20s", samplerquant[i], RQntNames[i]);
Draw_FunString(vid.width-strlen(s)*8, (i+RSPEED_MAX)*8, s);
}
s = va("%f %-30s", 100000000.0f/samplerspeeds[RSPEED_TOTALREFRESH], "Framerate");
Draw_String(vid.width-strlen(s)*8, (i+RSPEED_MAX)*8, s);
s = va("%f %-20s", 100000000.0f/samplerspeeds[RSPEED_TOTALREFRESH], "Framerate");
Draw_FunString(vid.width-strlen(s)*8, (i+RSPEED_MAX)*8, s);
if (framecount++>=100)
{
@ -240,12 +241,26 @@ CENTER PRINTING
===============================================================================
*/
conchar_t scr_centerstring[MAX_SPLITS][1024];
float scr_centertime_start[MAX_SPLITS]; // for slow victory printing
float scr_centertime_off[MAX_SPLITS];
int scr_center_lines[MAX_SPLITS];
int scr_erase_lines[MAX_SPLITS];
int scr_erase_center[MAX_SPLITS];
typedef struct {
unsigned int flags;
#define CPRINT_BALIGN (1<<0) //B
#define CPRINT_OBITUARTY (1<<1) //O
#define CPRINT_TALIGN (1<<2) //T
#define CPRINT_LALIGN (1<<3) //L
#define CPRINT_RALIGN (1<<4) //R
#define CPRINT_PERSIST (1<<5) //P
#define CPRINT_BACKGROUND (1<<6) //P
#define CPRINT_TYPEWRITER (1<<7) //
conchar_t string[1024];
unsigned int charcount;
float time_start; // for slow victory printing
float time_off;
int erase_lines;
int erase_center;
} cprint_t;
cprint_t scr_centerprint[MAX_SPLITS];
// SCR_StringToRGB: takes in "<index>" or "<r> <g> <b>" and converts to an RGB vector
void SCR_StringToRGB (char *rgbstring, float *rgb, float rgbinputscale)
@ -332,6 +347,7 @@ for a few moments
*/
void SCR_CenterPrint (int pnum, char *str, qboolean skipgamecode)
{
cprint_t *p;
if (!skipgamecode)
{
#ifdef CSQC_DAT
@ -350,18 +366,38 @@ void SCR_CenterPrint (int pnum, char *str, qboolean skipgamecode)
Cbuf_AddText("f_centerprint\n", RESTRICT_LOCAL);
}
COM_ParseFunString(CON_WHITEMASK, str, scr_centerstring[pnum], sizeof(scr_centerstring[pnum]), false);
scr_centertime_off[pnum] = scr_centertime.value;
scr_centertime_start[pnum] = cl.time;
p = &scr_centerprint[pnum];
p->flags = 0;
if (cl.intermission)
p->flags |= CPRINT_TYPEWRITER | CPRINT_PERSIST;
// count the number of lines for centering
scr_center_lines[pnum] = 1;
while (*str)
while (*str == '/')
{
if (*str == '\n')
scr_center_lines[pnum]++;
str++;
if (str[1] == '.')
{
/* /. means text actually starts after, no more flags */
str+=2;
break;
}
else if (str[1] == 'P')
p->flags |= CPRINT_PERSIST | CPRINT_BACKGROUND;
else if (str[1] == 'O')
p->flags = CPRINT_OBITUARTY;
else if (str[1] == 'B')
p->flags |= CPRINT_BALIGN; //Note: you probably want to add some blank lines...
else if (str[1] == 'T')
p->flags |= CPRINT_TALIGN;
else if (str[1] == 'L')
p->flags |= CPRINT_LALIGN;
else if (str[1] == 'R')
p->flags |= CPRINT_RALIGN;
else
break;
str += 2;
}
p->charcount = COM_ParseFunString(CON_WHITEMASK, str, p->string, sizeof(p->string), false) - p->string;
p->time_off = scr_centertime.value;
p->time_start = cl.time;
}
void SCR_CPrint_f(void)
@ -371,6 +407,7 @@ void SCR_CPrint_f(void)
void SCR_EraseCenterString (void)
{
cprint_t *p;
int pnum;
int y;
@ -379,161 +416,121 @@ void SCR_EraseCenterString (void)
for (pnum = 0; pnum < cl.splitclients; pnum++)
{
if (scr_erase_center[pnum]++ > vid.numpages)
p = &scr_centerprint[pnum];
if (p->erase_center++ > vid.numpages)
{
scr_erase_lines[pnum] = 0;
p->erase_lines = 0;
continue;
}
if (scr_center_lines[pnum] <= 4)
y = vid.height*0.35;
else
y = 48;
Draw_TileClear (0, y, vid.width, min(8*scr_erase_lines[pnum], vid.height - y - 1));
y = vid.height>>1;
Draw_TileClear (0, y, vid.width, min(8*p->erase_lines, vid.height - y - 1));
}
}
void SCR_CenterPrintBreaks(conchar_t *start, int *lines, int *maxlength)
#define MAX_CPRINT_LINES 128
void SCR_DrawCenterString (vrect_t *rect, cprint_t *p)
{
int l;
*lines = 0;
*maxlength = 0;
do
{
// scan the width of the line
for (l=0 ; l<40 ; l++)
if ((start[l]&CON_CHARMASK) == '\n' || !(start[l]&CON_CHARMASK))
break;
if (l == 40)
{
while(l > 0 && (start[l-1]&CON_CHARMASK)>' ')
{
l--;
}
}
(*lines)++;
if (*maxlength < l)
*maxlength = l;
start+=l;
// for (l=0 ; l<40 && *start && *start != '\n'; l++)
// start++;
if (!(*start&CON_CHARMASK))
break;
else if ((*start&CON_CHARMASK) == '\n'||!l)
start++; // skip the \n
} while (1);
}
void SCR_DrawCenterString (int pnum)
{
conchar_t *start;
int l;
int j;
int x, y;
int y, x;
int left;
int right;
int top;
int bottom;
int remaining;
int hd = 1;
int screenwidth;
vrect_t rect;
conchar_t *str;
conchar_t *line_start[MAX_CPRINT_LINES];
conchar_t *line_end[MAX_CPRINT_LINES];
int linecount;
int telejanostyle = 0;
if (cl.splitclients)
hd = cl.splitclients;
// the finale prints the characters one at a time
if (cl.intermission)
remaining = scr_printspeed.value * (cl.time - scr_centertime_start[pnum]);
if (p->flags & CPRINT_TYPEWRITER)
remaining = scr_printspeed.value * (cl.time - p->time_start);
else
remaining = 9999;
scr_erase_center[pnum] = 0;
start = scr_centerstring[pnum];
p->erase_center = 0;
if (scr_center_lines[pnum] <= 4)
y = vid.height/hd*0.35;
else
y = 48;
Font_BeginString(font_conchar, rect->x, rect->y, &left, &top);
Font_BeginString(font_conchar, rect->x+rect->width, rect->y+rect->height, &right, &bottom);
linecount = Font_LineBreaks(p->string, p->string + p->charcount, right - left, MAX_CPRINT_LINES, line_start, line_end);
SCR_VRectForPlayer(&rect, pnum);
y += rect.y;
screenwidth = 40;//vid.width/8;
if ((start[0]&CON_CHARMASK) == '/')
{
if ((start[1]&CON_CHARMASK) == 'O')
{
telejanostyle = (start[1]&CON_CHARMASK);
start+=2;
}
else if ((start[1]&CON_CHARMASK) == 'P')
{ //hexen2 style plaque.
int lines, len;
start+=2;
SCR_CenterPrintBreaks(start, &lines, &len);
x = rect.x+(rect.width-len*8)/2;
Draw_TextBox(x-6, y-8, len-1, lines);
}
if (p->flags & CPRINT_BACKGROUND)
{ //hexen2 style plaque.
// int lines, len;
// SCR_CenterPrintBreaks(start, &lines, &len);
// x = rect.x+(rect.width-len*8)/2;
// Draw_TextBox(x-6, y-8, len-1, lines);
}
do
if (p->flags & CPRINT_TALIGN)
y = top;
else if (p->flags & CPRINT_BALIGN)
y = bottom - Font_CharHeight()*linecount;
else if (p->flags & CPRINT_OBITUARTY)
//'obituary' messages appear at the bottom of the screen
y = (bottom-top - Font_CharHeight()*linecount) * 0.65 + top;
else if (p->flags & CPRINT_TYPEWRITER)
Font_BeginString(font_conchar, 48, rect->y, &y, &top);
else
{
// scan the width of the line
for (l=0 ; l<=screenwidth ; l++)
if ((start[l]&CON_CHARMASK) == '\n' || !(start[l]&CON_CHARMASK))
break;
if (l == screenwidth+1)
{
while(l > 0 && (start[l-1]&CON_CHARMASK)>' ' && (start[l-1]&CON_CHARMASK) != ' '+128)
{
l--;
}
if (linecount <= 4)
{
//small messages appear above and away from the crosshair
y = (bottom-top - Font_CharHeight()*linecount) * 0.35 + top;
}
x = rect.x + (rect.width - l*8)/2+4;
for (j=0 ; j<l ; j++, x+=8)
else
{
//longer messages are fully centered
y = (bottom-top - Font_CharHeight()*linecount) * 0.5 + top;
}
}
for (l = 0; l < linecount; l++, y += Font_CharHeight())
{
if (p->flags & CPRINT_RALIGN)
{
x = right;
for (str = line_start[l]; str < line_end[l]; str++)
x -= Font_CharWidth(*str);
}
else if (p->flags & CPRINT_LALIGN)
x = left;
else
{
x = 0;
for (str = line_start[l]; str < line_end[l]; str++)
x += Font_CharWidth(*str);
x = (right + left - x)/2;
}
for (str = line_start[l]; str < line_end[l]; str++)
{
switch(telejanostyle)
{
case 'O':
Draw_ColouredCharacter (x, y+vid.height/2, start[j]);
break;
default:
Draw_ColouredCharacter (x, y, start[j]);
}
if (!remaining--)
return;
{
l = linecount-1;
break;
}
x = Font_DrawChar(x, y, *str);
}
y += 8;
start+=l;
// for (l=0 ; l<40 && *start && *start != '\n'; l++)
// start++;
if (!(*start&CON_CHARMASK))
break;
else if ((*start&CON_CHARMASK) == '\n'||!l)
start++; // skip the \n
} while (1);
}
Font_EndString(font_conchar);
}
void SCR_CheckDrawCenterString (void)
{
extern qboolean sb_showscores;
int pnum;
cprint_t *p;
vrect_t rect;
for (pnum = 0; pnum < cl.splitclients; pnum++)
{
if (scr_center_lines[pnum] > scr_erase_lines[pnum])
scr_erase_lines[pnum] = scr_center_lines[pnum];
p = &scr_centerprint[pnum];
scr_centertime_off[pnum] -= host_frametime;
p->time_off -= host_frametime;
if (key_dest != key_game) //don't let progs guis/centerprints interfere with the game menu
continue;
@ -541,13 +538,40 @@ extern qboolean sb_showscores;
if (sb_showscores) //this was annoying
continue;
if (scr_centertime_off[pnum] <= 0 && !cl.intermission && (scr_centerstring[pnum][0]&255) != '/' && (scr_centerstring[pnum][1]&255) != 'P')
if (p->time_off <= 0 && !cl.intermission && !(p->flags & CPRINT_PERSIST))
continue; //'/P' prefix doesn't time out
SCR_DrawCenterString (pnum);
SCR_VRectForPlayer(&rect, pnum);
SCR_DrawCenterString(&rect, p);
}
}
void SCR_DrawCursor(int prydoncursornum)
{
extern cvar_t cl_cursor, cl_cursorbias, cl_cursorsize;
extern int mousecursor_x, mousecursor_y;
mpic_t *p;
if (!*cl_cursor.string || prydoncursornum>1)
p = Draw_SafeCachePic(va("gfx/prydoncursor%03i.lmp", prydoncursornum));
else
p = Draw_SafeCachePic(cl_cursor.string);
if (p)
{
Draw_ImageColours(1, 1, 1, 1);
Draw_Image(mousecursor_x-cl_cursorbias.value, mousecursor_y-cl_cursorbias.value, cl_cursorsize.value, cl_cursorsize.value, 0, 0, 1, 1, p);
// Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p);
}
else
{
int x, y;
Font_BeginString(font_conchar, mousecursor_x, mousecursor_y, &x, &y);
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
y -= Font_CharHeight()/2;
Font_DrawChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
}
////////////////////////////////////////////////////////////////
//TEI_SHOWLMP2 (not 3)
@ -637,7 +661,7 @@ void SCR_ShowPics_Draw(void)
p = Draw_SafeCachePic(sp->picname);
if (!p)
continue;
Draw_Pic(x, y, p);
Draw_ScalePic(x, y, p->width, p->height, p);
}
}
@ -647,7 +671,7 @@ void SCR_ShowPic_Clear(void)
int pnum;
for (pnum = 0; pnum < MAX_SPLITS; pnum++)
*scr_centerstring[pnum] = '\0';
scr_centerprint[pnum].charcount = 0;
while((sp = showpics))
{
@ -975,7 +999,7 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y)
vrect_t rect;
SCR_VRectForPlayer(&rect, pnum);
if (cl.worldmodel && crosshaircorrect.value)
if (cl.worldmodel && crosshaircorrect.ival)
{
float adj;
trace_t tr;
@ -1093,7 +1117,7 @@ void SCR_DrawTurtle (void)
{
static int count;
if (!scr_showturtle.value || !scr_turtle)
if (!scr_showturtle.ival || !scr_turtle)
return;
if (host_frametime <= 1.0/scr_turtlefps.value)
@ -1106,7 +1130,7 @@ void SCR_DrawTurtle (void)
if (count < 3)
return;
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
Draw_ScalePic (scr_vrect.x, scr_vrect.y, 64, 64, scr_turtle);
}
/*
@ -1121,17 +1145,28 @@ void SCR_DrawNet (void)
if (cls.demoplayback || !scr_net)
return;
Draw_Pic (scr_vrect.x+64, scr_vrect.y, scr_net);
Draw_ScalePic (scr_vrect.x+64, scr_vrect.y, 64, 64, scr_net);
}
void SCR_StringXY(char *str, float x, float y)
{
if (x < 0)
x = vid.width + x*strlen(str)*8;
if (y < 0)
y = vid.height - sb_lines + y*8;
char *s2;
int px, py;
Draw_String(x, y, str);
Font_BeginString(font_conchar, ((x<0)?vid.width:x), ((y<0)?vid.height - sb_lines:y), &px, &py);
if (x < 0)
{
for (s2 = str; *s2; s2++)
px -= Font_CharWidth(*s2);
}
if (y < 0)
py += y*Font_CharHeight();
while (*str)
px = Font_DrawChar(px, py, CON_WHITEMASK|*str++);
Font_EndString(font_conchar);
}
void SCR_DrawFPS (void)
@ -1141,11 +1176,13 @@ void SCR_DrawFPS (void)
double t;
extern int fps_count;
static float lastfps;
static float deviationtimes[64];
static int deviationframe;
char str[80];
int sfps;
int sfps, frame;
qboolean usemsecs = false;
if (!show_fps.value)
if (!show_fps.ival)
return;
t = Sys_DoubleTime();
@ -1156,7 +1193,7 @@ void SCR_DrawFPS (void)
lastframetime = t;
}
sfps = show_fps.value;
sfps = show_fps.ival;
if (sfps < 0)
{
sfps = -sfps;
@ -1185,12 +1222,34 @@ void SCR_DrawFPS (void)
lastfps = 1/host_frametime;
lastframetime = t;
break;
#ifdef RGLQUAKE
#ifdef GLQUAKE
case 5:
if (qrenderer == QR_OPENGL)
GLR_FrameTimeGraph((int)(1000.0*host_frametime));
GLR_FrameTimeGraph((int)(1000.0*1.5*host_frametime));
break;
#endif
case 6:
{
float mean, deviation;
deviationtimes[deviationframe++&63] = host_frametime*1000;
mean = 0;
for (frame = 0; frame < 64; frame++)
{
mean += deviationtimes[frame];
}
mean /= 64;
deviation = 0;
for (frame = 0; frame < 64; frame++)
{
deviation += (deviationtimes[frame] - mean)*(deviationtimes[frame] - mean);
}
deviation /= 64;
deviation = sqrt(deviation);
SCR_StringXY(va("%f deviation", deviation), show_fps_x.value, show_fps_y.value-8);
}
break;
}
if (usemsecs)
@ -1207,14 +1266,24 @@ void SCR_DrawUPS (void)
double t;
static float lastups;
char str[80];
float *vel;
int track;
if (!show_speed.value)
if (!show_speed.ival)
return;
t = Sys_DoubleTime();
if ((t - lastupstime) >= 1.0/20)
{
lastups = sqrt((cl.simvel[0][0]*cl.simvel[0][0]) + (cl.simvel[0][1]*cl.simvel[0][1]));
if (cl.spectator)
track = Cam_TrackNum(0);
else
track = -1;
if (track != -1)
vel = cl.frames[cl.validsequence&UPDATE_MASK].playerstate[track].velocity;
else
vel = cl.simvel[0];
lastups = sqrt((vel[0]*vel[0]) + (vel[1]*vel[1]));
lastupstime = t;
}
@ -1228,7 +1297,7 @@ void SCR_DrawClock(void)
time_t long_time;
char str[16];
if (!show_clock.value)
if (!show_clock.ival)
return;
time( &long_time );
@ -1247,7 +1316,7 @@ void SCR_DrawGameClock(void)
int flags;
float timelimit;
if (!show_gameclock.value)
if (!show_gameclock.ival)
return;
flags = (show_gameclock.value-1);
@ -1285,7 +1354,7 @@ void SCR_DrawPause (void)
{
mpic_t *pic;
if (!scr_showpause.value) // turn off for screenshots
if (!scr_showpause.ival) // turn off for screenshots
return;
if (!cl.paused)
@ -1294,11 +1363,11 @@ void SCR_DrawPause (void)
pic = Draw_SafeCachePic ("gfx/pause.lmp");
if (pic)
{
Draw_Pic ( (vid.width - pic->width)/2,
(vid.height - 48 - pic->height)/2, pic);
Draw_ScalePic ( (vid.width - pic->width)/2,
(vid.height - 48 - pic->height)/2, pic->width, pic->height, pic);
}
else
Draw_String((vid.width-strlen("Paused")*8)/2, (vid.height-8)/2, "Paused");
Draw_FunString((vid.width-strlen("Paused")*8)/2, (vid.height-8)/2, "Paused");
}
@ -1342,7 +1411,7 @@ void SCR_DrawLoading (void)
{
x = (vid.width - pic->width)/2;
y = (vid.height - 48 - pic->height)/2;
Draw_Pic (x, y, pic);
Draw_ScalePic (x, y, pic->width, pic->height, pic);
x = (vid.width/2) - 96;
y += pic->height + 8;
}
@ -1351,7 +1420,7 @@ void SCR_DrawLoading (void)
x = (vid.width/2) - 96;
y = (vid.height/2) - 8;
Draw_String((vid.width-7*8)/2, y-16, "Loading");
Draw_FunString((vid.width-7*8)/2, y-16, "Loading");
}
if (!total_loading_size)
@ -1370,7 +1439,7 @@ void SCR_DrawLoading (void)
Draw_FillRGB(x+sizex, y, 192-sizex, 16, 1.0, 0.0, 0.0);
}
Draw_String(x+8, y+4, va("Loading %s... %i%%",
Draw_FunString(x+8, y+4, va("Loading %s... %i%%",
(loading_stage == LS_SERVER) ? "server" : "client",
current_loading_size * 100 / total_loading_size));
@ -1388,7 +1457,7 @@ void SCR_DrawLoading (void)
return;
offset = (vid.width - pic->width)/2;
Draw_TransPic (offset , 0, pic);
Draw_ScalePic (offset, 0, pic->width, pic->height, pic);
if (loading_stage == LS_NONE)
return;
@ -1431,13 +1500,13 @@ void SCR_DrawLoading (void)
CL_GetDownloadSizes(&fcount, &tsize, &sizeextra);
//downloading files?
if (cls.downloadmethod)
Draw_String(x+8, y+4, va("Downloading %s... %i%%",
Draw_FunString(x+8, y+4, va("Downloading %s... %i%%",
cls.downloadlocalname,
cls.downloadpercent));
if (tsize > 1024*1024*16)
{
Draw_String(x+8, y+8+4, va("%5ukbps %8umb%s remaining (%i files)",
Draw_FunString(x+8, y+8+4, va("%5ukbps %8umb%s remaining (%i files)",
(unsigned int)(CL_DownloadRate()/1000.0f),
tsize/(1024*1024),
sizeextra?"+":"",
@ -1445,7 +1514,7 @@ void SCR_DrawLoading (void)
}
else
{
Draw_String(x+8, y+8+4, va("%5ukbps %8ukb%s remaining (%i files)",
Draw_FunString(x+8, y+8+4, va("%5ukbps %8ukb%s remaining (%i files)",
(unsigned int)(CL_DownloadRate()/1000.0f),
tsize/1024,
sizeextra?"+":"",
@ -1464,7 +1533,7 @@ void SCR_DrawLoading (void)
dots[1] = '.';
dots[2] = '.';
dots[(int)realtime & 3] = 0;
Draw_String(x, y+4, va("Connecting to: %s%s", s, dots));
Draw_FunString(x, y+4, va("Connecting to: %s%s", s, dots));
}
}
@ -1496,6 +1565,8 @@ void SCR_EndLoadingPlaque (void)
scr_disabled_for_loading = false;
*levelshotname = '\0';
scr_drawloading = false;
loading_stage = 0;
}
void SCR_ImageName (char *mapname)
@ -1503,7 +1574,7 @@ void SCR_ImageName (char *mapname)
strcpy(levelshotname, "levelshots/");
COM_FileBase(mapname, levelshotname + strlen(levelshotname), sizeof(levelshotname)-strlen(levelshotname));
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
if (!Draw_SafeCachePic (levelshotname))
@ -1520,7 +1591,7 @@ void SCR_ImageName (char *mapname)
scr_disabled_for_loading = false;
scr_drawloading = true;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
GL_BeginRendering ();
SCR_DrawLoading();
SCR_SetUpToDrawConsole();
SCR_DrawConsole(!!*levelshotname);
@ -1549,29 +1620,12 @@ void SCR_SetUpToDrawConsole (void)
#endif
Con_CheckResize ();
scr_con_forcedraw = false;
if (scr_drawloading)
return; // never a console with loading plaque
// decide on the height of the console
if (!scr_disabled_for_loading)
{
/*if (cls.state != ca_active && !Media_PlayingFullScreen()
#ifdef TEXTEDITOR
&& !editoractive
#endif
#ifdef VM_UI
&& !UI_MenuState()
#endif
)
{
scr_conlines = vid.height; // full screen
scr_con_current = scr_conlines;
scr_con_forcedraw = true;
}
else */
scr_con_forcedraw = false;
if ((key_dest == key_console || key_dest == key_game) && !cl.sendprespawn && cl.worldmodel && cl.worldmodel->needload)
Con_ForceActiveNow();
else if (key_dest == key_console || scr_chatmode)
@ -1707,6 +1761,7 @@ qboolean SCR_ScreenShot (char *filename)
ext = COM_FileExtension(filename);
buffer = VID_GetRGBInfo(MAX_PREPAD, &truewidth, &trueheight);
#pragma message("Need to ensure that the various image writing routines can cope with ((width|height)&3")
if (!buffer)
return false;
@ -1900,7 +1955,7 @@ qboolean SCR_RSShot (void)
char st[80];
time_t now;
if (!scr_allowsnap.value)
if (!scr_allowsnap.ival)
return false;
if (CL_IsUploading())
@ -1995,74 +2050,6 @@ qboolean SCR_RSShot (void)
//=============================================================================
//=============================================================================
char *scr_notifystring;
qboolean scr_drawdialog;
void SCR_DrawNotifyString (void)
{
char *start;
int l;
int j;
int x, y;
start = scr_notifystring;
y = vid.height*0.35;
do
{
// scan the width of the line
for (l=0 ; l<40 ; l++)
if (start[l] == '\n' || !start[l])
break;
x = (vid.width - l*8)/2;
for (j=0 ; j<l ; j++, x+=8)
Draw_Character (x, y, start[j]);
y += 8;
while (*start && *start != '\n')
start++;
if (!*start)
break;
start++; // skip the \n
} while (1);
}
/*
==================
SCR_ModalMessage
Displays a text string in the center of the screen and waits for a Y or N
keypress.
==================
*/
int SCR_ModalMessage (char *text)
{
scr_notifystring = text;
// draw a fresh screen
scr_drawdialog = true;
SCR_UpdateScreen ();
scr_drawdialog = false;
S_StopAllSounds (true); // so dma doesn't loop current sound
do
{
key_count = -1; // wait for a key down and up
Sys_SendKeyEvents ();
} while (key_lastpress != 'y' && key_lastpress != 'n' && key_lastpress != K_ESCAPE);
SCR_UpdateScreen ();
return key_lastpress == 'y';
}
//=============================================================================
/*
@ -2078,7 +2065,7 @@ void SCR_BringDownConsole (void)
int pnum;
for (pnum = 0; pnum < cl.splitclients; pnum++)
scr_centertime_off[pnum] = 0;
scr_centerprint[pnum].charcount = 0;
for (i=0 ; i<20 && scr_conlines != scr_con_current ; i++)
SCR_UpdateScreen ();
@ -2097,7 +2084,7 @@ void SCR_TileClear (void)
return; //splitclients always takes the entire screen.
#ifdef PLUGINS
if (plug_sbar.value)
if (plug_sbar.ival)
{
if (scr_vrect.x > 0)
{
@ -2159,30 +2146,12 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
//
// draw any areas not covered by the refresh
//
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (r_netgraph.value && qrenderer == QR_OPENGL)
GLR_NetGraph ();
#endif
if (scr_drawdialog)
{
if (!nohud)
{
#ifdef PLUGINS
Plug_SBar ();
#else
if (Sbar_ShouldDraw())
{
Sbar_Draw ();
Sbar_DrawScoreboard ();
}
#endif
}
SCR_ShowPics_Draw();
Draw_FadeScreen ();
SCR_DrawNotifyString ();
}
else if (scr_drawloading || loading_stage)
if (scr_drawloading || loading_stage)
{
SCR_DrawLoading();
@ -2241,10 +2210,6 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
else
SCR_DrawFPS ();
SCR_CheckDrawCenterString ();
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
qglTexEnvi ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
#endif
}
#ifdef TEXTEDITOR
@ -2252,12 +2217,16 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
Editor_Draw();
#endif
SCR_DrawConsole (false);
if (key_dest != key_console)
SCR_DrawConsole (false);
M_Draw (uimenu);
#ifdef MENU_DAT
MP_Draw();
#endif
if (key_dest == key_console)
SCR_DrawConsole (false);
RSpeedEnd(RSPEED_2D);
}

View File

@ -548,7 +548,7 @@ void CL_AddBeam (int tent, int ent, vec3_t start, vec3_t end) //fixme: use TE_ n
if (etype >= 0 && cls.state == ca_active && etype != P_INVALID)
{
if (cl_beam_trace.value)
if (cl_beam_trace.ival)
{
VectorSubtract(end, start, normal);
VectorNormalize(normal);
@ -933,7 +933,7 @@ void CL_ParseTEnt (void)
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1);
// sprite
if (cl_expsprite.value) // temp hopefully
if (cl_expsprite.ival) // temp hopefully
{
explosion_t *ex = CL_AllocExplosion ();
VectorCopy (pos, ex->origin);
@ -973,7 +973,7 @@ void CL_ParseTEnt (void)
S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1);
// sprite
if (cl_expsprite.value && !nqprot) // temp hopefully
if (cl_expsprite.ival && !nqprot) // temp hopefully
{
explosion_t *ex = CL_AllocExplosion ();
VectorCopy (pos, ex->origin);
@ -2532,7 +2532,7 @@ void CLQ2_ParseTEnt (void)
VectorCopy (pos, ex->origin);
ex->flags = Q2RF_FULLBRIGHT;
ex->start = cl.q2frame.servertime - 100;
CL_NewDlightRGB(0, pos[0], pos[1], pos[2], 350, 0.5, 0.2, 0.1, 0);
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0.1, 0);
P_RunParticleEffectTypeString(pos, NULL, 1, "te_muzzleflash");
break;
case CRTE_BLUE_MUZZLEFLASH:
@ -2541,7 +2541,7 @@ void CLQ2_ParseTEnt (void)
VectorCopy (pos, ex->origin);
ex->flags = Q2RF_FULLBRIGHT;
ex->start = cl.q2frame.servertime - 100;
CL_NewDlightRGB(0, pos[0], pos[1], pos[2], 350, 0.5, 0.2, 0.1, 0);
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0.1, 0);
P_RunParticleEffectTypeString(pos, NULL, 1, "te_blue_muzzleflash");
break;
case CRTE_SMART_MUZZLEFLASH:
@ -2550,7 +2550,7 @@ void CLQ2_ParseTEnt (void)
VectorCopy (pos, ex->origin);
ex->flags = Q2RF_FULLBRIGHT;
ex->start = cl.q2frame.servertime - 100;
CL_NewDlightRGB(0, pos[0], pos[1], pos[2], 350, 0.5, 0.2, 0, 0.2);
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0, 0.2);
P_RunParticleEffectTypeString(pos, NULL, 1, "te_smart_muzzleflash");
break;
case CRTE_LEADERFIELD:
@ -2561,7 +2561,7 @@ void CLQ2_ParseTEnt (void)
VectorCopy (pos, ex->origin);
ex->flags = Q2RF_FULLBRIGHT;
ex->start = cl.q2frame.servertime - 100;
CL_NewDlightRGB(0, pos[0], pos[1], pos[2], 350, 0.5, 0.2, 0, 0.2);
CL_NewDlightRGB(0, pos, 350, 0.5, 0.2, 0, 0.2);
P_RunParticleEffectTypeString(pos, NULL, 1, "te_deathfield");
break;
case CRTE_BLASTERBEAM:
@ -2642,10 +2642,13 @@ void CL_UpdateBeams (void)
if (b->endtime < cl.time)
{
P_DelinkTrailstate(&b->trailstate);
P_DelinkTrailstate(&b->emitstate);
b->model = NULL;
continue;
if (!sv.paused)
{ /*don't let lightning decay while paused*/
P_DelinkTrailstate(&b->trailstate);
P_DelinkTrailstate(&b->emitstate);
b->model = NULL;
continue;
}
}
lastrunningbeam = bnum;
@ -2709,7 +2712,7 @@ void CL_UpdateBeams (void)
org[2] += 16;
VectorAdd (org, fwd, b->end);
if (cl_beam_trace.value)
if (cl_beam_trace.ival)
{
vec3_t normal;
VectorMA(org, len+4, ang, fwd);
@ -2760,7 +2763,7 @@ void CL_UpdateBeams (void)
pitch += 360;
}
if (ruleset_allow_particle_lightning.value)
if (ruleset_allow_particle_lightning.ival)
if (b->particleeffect >= 0 && !P_ParticleTrail(b->start, b->end, b->particleeffect, &b->trailstate))
continue;

View File

@ -7,9 +7,6 @@
int keycatcher;
void GLDraw_ShaderImage (int x, int y, int w, int h, float s1, float t1, float s2, float t2, struct shader_s *pic);
#define MAX_TOKENLENGTH 1024
typedef struct pc_token_s
{
@ -38,8 +35,8 @@ typedef struct {
char *defines;
int numdefines;
} script_t;
script_t *scripts;
int maxscripts;
static script_t *scripts;
static int maxscripts;
#define Q3SCRIPTPUNCTUATION "(,{})(\':;=!><&|+-\""
void StripCSyntax (char *s)
{
@ -123,7 +120,7 @@ int Script_Read(int handle, struct pc_token_s *token)
if (sc->originalfilestack[sc->stackdepth])
BZ_Free(sc->originalfilestack[sc->stackdepth]);
sc->filestack[sc->stackdepth] = sc->originalfilestack[sc->stackdepth] = COM_LoadMallocFile(com_token);
sc->filestack[sc->stackdepth] = sc->originalfilestack[sc->stackdepth] = FS_LoadMallocFile(com_token);
Q_strncpyz(sc->filename[sc->stackdepth], com_token, MAX_QPATH);
sc->stackdepth++;
continue;
@ -217,7 +214,7 @@ int Script_LoadFile(char *filename)
sc = scripts+i;
memset(sc, 0, sizeof(*sc));
sc->filestack[0] = sc->originalfilestack[0] = COM_LoadMallocFile(filename);
sc->filestack[0] = sc->originalfilestack[0] = FS_LoadMallocFile(filename);
Q_strncpyz(sc->filename[sc->stackdepth], filename, MAX_QPATH);
sc->stackdepth = 1;
@ -274,7 +271,7 @@ void Script_Get_File_And_Line(int handle, char *filename, int *line)
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"//hack
#else
typedef float m3by3_t[3][3];
@ -284,8 +281,6 @@ static vm_t *uivm;
static char *scr_centerstring;
static int ox, oy;
void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, qpic_t *pic);
void SWDraw_Image (float xp, float yp, float wp, float hp, float s1, float t1, float s2, float t2, qpic_t *pic);
char *Get_Q2ConfigString(int i);
@ -307,7 +302,7 @@ extern shader_t r_shaders[];
#define VM_TOSHANDLE(a) (a?a-r_shaders+1:0)
typedef struct q3refEntity_s {
struct q3refEntity_s {
refEntityType_t reType;
int renderfx;
@ -340,12 +335,14 @@ typedef struct q3refEntity_s {
// extra sprite information
float radius;
float rotation;
} q3refEntity_t;
#define Q2RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define Q2RF_WEAPONMODEL 4 // only draw through eyes
#define Q2RF_DEPTHHACK 16 // for view weapon Z crunching
};
struct q3polyvert_s
{
vec3_t org;
vec2_t tcoord;
qbyte colours[4];
};
#define Q3RF_MINLIGHT 1
#define Q3RF_THIRD_PERSON 2 // don't draw through eyes, only mirrors (player bodies, chat sprites)
@ -416,21 +413,76 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
// if (ent.shaderRGBAf[3] <= 0)
// return;
#ifdef Q3SHADERS
ent.forcedshader = VM_FROMSHANDLE(q3->customShader);
ent.shaderTime = q3->shaderTime;
#endif
if (q3->renderfx & Q3RF_FIRST_PERSON)
ent.flags |= Q2RF_WEAPONMODEL;
if (q3->renderfx & Q3RF_DEPTHHACK)
ent.flags |= Q2RF_DEPTHHACK;
if (q3->renderfx & Q3RF_THIRD_PERSON)
ent.flags |= Q2RF_VIEWERMODEL;
ent.flags |= Q2RF_EXTERNALMODEL;
if (q3->renderfx & Q3RF_NOSHADOW)
ent.flags |= RF_NOSHADOW;
VectorCopy(q3->origin, ent.origin);
VectorCopy(q3->oldorigin, ent.oldorigin);
V_AddAxisEntity(&ent);
}
void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts)
{
unsigned int v;
scenetris_t *t;
/*reuse the previous trigroup if its the same shader*/
if (cl_numstris && cl_stris[cl_numstris-1].shader == s)
t = &cl_stris[cl_numstris-1];
else
{
if (cl_numstris == cl_maxstris)
{
cl_maxstris += 8;
cl_stris = BZ_Realloc(cl_stris, sizeof(*cl_stris)*cl_maxstris);
}
t = &cl_stris[cl_numstris++];
t->shader = s;
t->numidx = 0;
t->numvert = 0;
t->firstidx = cl_numstrisidx;
t->firstvert = cl_numstrisvert;
}
if (cl_maxstrisvert < cl_numstrisvert+num)
{
cl_maxstrisvert = cl_numstrisvert+num + 64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(vec3_t)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
if (cl_maxstrisidx < cl_numstrisidx+(num-2)*3)
{
cl_maxstrisidx = cl_numstrisidx+(num-2)*3 + 64;
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
for (v = 0; v < num; v++)
{
VectorCopy(verts[v].org, cl_strisvertv[cl_numstrisvert+v]);
Vector2Copy(verts[v].tcoord, cl_strisvertt[cl_numstrisvert+v]);
Vector4Scale(verts[v].colours, (1/255.0f), cl_strisvertc[cl_numstrisvert+v]);
}
for (v = 2; v < num; v++)
{
cl_strisidx[cl_numstrisidx++] = cl_numstrisvert - t->firstvert;
cl_strisidx[cl_numstrisidx++] = cl_numstrisvert+(v-1) - t->firstvert;
cl_strisidx[cl_numstrisidx++] = cl_numstrisvert+v - t->firstvert;
}
t->numvert += num;
t->numidx += (num-2)*3;
cl_numstrisvert += num;
//we already increased idx
}
int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagname)
{
int tagnum;
@ -496,7 +548,7 @@ int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagnam
#define MAX_RENDER_STRINGS 8
#define MAX_RENDER_STRING_LENGTH 32
typedef struct q3refdef_s {
struct q3refdef_s {
int x, y, width, height;
float fov_x, fov_y;
vec3_t vieworg;
@ -512,10 +564,11 @@ typedef struct q3refdef_s {
// text messages for deform text shaders
char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
} q3refdef_t;
};
void VQ3_RenderView(const q3refdef_t *ref)
{
extern cvar_t r_torch;
VectorCopy(ref->vieworg, r_refdef.vieworg);
r_refdef.viewangles[0] = -(atan2(ref->viewaxis[0][2], sqrt(ref->viewaxis[0][1]*ref->viewaxis[0][1]+ref->viewaxis[0][0]*ref->viewaxis[0][0])) * 180 / M_PI);
r_refdef.viewangles[1] = (atan2(ref->viewaxis[0][1], ref->viewaxis[0][0]) * 180 / M_PI);
@ -534,8 +587,19 @@ void VQ3_RenderView(const q3refdef_t *ref)
r_refdef.useperspective = true;
r_refdef.currentplayernum = -1;
if (r_torch.ival)
{
dlight_t *dl;
dl = CL_NewDlightRGB(0, ref->vieworg, 300, r_torch.ival, 0.05, 0.05, 0.02);
dl->flags |= LFLAG_SHADOWMAP|LFLAG_ALLOW_FLASH;
dl->fov = 60;
VectorCopy(ref->viewaxis[0], dl->axis[0]);
VectorCopy(ref->viewaxis[1], dl->axis[1]);
VectorCopy(ref->viewaxis[2], dl->axis[2]);
}
memcpy(cl.q2frame.areabits, ref->areamask, sizeof(cl.q2frame.areabits));
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
gl_ztrickdisabled|=16;
@ -544,7 +608,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
}
#endif
R_RenderView();
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
gl_ztrickdisabled&=~16;
@ -554,7 +618,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
}
#endif
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
qglDisable(GL_ALPHA_TEST);
@ -641,10 +705,10 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
switch((uiImport_t)fn)
{
case UI_ERROR:
Con_Printf("%s", VM_POINTER(arg[0]));
Con_Printf("%s", (char*)VM_POINTER(arg[0]));
break;
case UI_PRINT:
Con_Printf("%s", VM_POINTER(arg[0]));
Con_Printf("%s", (char*)VM_POINTER(arg[0]));
break;
case UI_MILLISECONDS:
@ -669,7 +733,7 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
cvar_t *var;
if (!strcmp(VM_POINTER(arg[0]), "fs_game"))
{
Cbuf_AddText(va("gamedir %s\nui_restart\n", VM_POINTER(arg[1])), RESTRICT_SERVER);
Cbuf_AddText(va("gamedir %s\nui_restart\n", (char*)VM_POINTER(arg[1])), RESTRICT_SERVER);
}
else
{
@ -726,7 +790,7 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
break;
case UI_CMD_EXECUTETEXT:
if (!strncmp(VM_POINTER(arg[1]), "ping ", 5))
if (!strncmp((char*)VM_POINTER(arg[1]), "ping ", 5))
{
int i;
for (i = 0; i < MAX_PINGREQUESTS; i++)
@ -821,7 +885,10 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
break;
case UI_R_CLEARSCENE: //clear scene
cl_numvisedicts=0;
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
break;
case UI_R_ADDREFENTITYTOSCENE: //add ent to scene
VQ3_AddEntity(VM_POINTER(arg[0]));
@ -833,7 +900,6 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
break;
case UI_R_SETCOLOR: //setcolour float*
if (Draw_ImageColours)
{
float *fl =VM_POINTER(arg[0]);
if (!fl)
@ -844,13 +910,7 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
break;
case UI_R_DRAWSTRETCHPIC:
// qglDisable(GL_ALPHA_TEST);
// qglEnable(GL_BLEND);
// GL_TexEnv(GL_MODULATE);
if (qrenderer == QR_OPENGL)
GLDraw_ShaderImage(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), VM_FROMSHANDLE(arg[8]));
// else
// Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), (mpic_t *)VM_LONG(arg[8]));
Draw_Image(VM_FLOAT(arg[0]), VM_FLOAT(arg[1]), VM_FLOAT(arg[2]), VM_FLOAT(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]), VM_FLOAT(arg[6]), VM_FLOAT(arg[7]), (mpic_t *)VM_LONG(arg[8]));
break;
case UI_CM_LERPTAG: //Lerp tag...
@ -863,7 +923,7 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
case UI_S_REGISTERSOUND:
{
sfx_t *sfx;
sfx = S_PrecacheSound(va("../%s", VM_POINTER(arg[0])));
sfx = S_PrecacheSound(va("../%s", (char*)VM_POINTER(arg[0])));
if (sfx)
VM_LONG(ret) = VM_TOSTRCACHE(arg[0]); //return handle is the parameter they just gave
else
@ -936,6 +996,7 @@ int UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const int *arg)
case UI_GETCLIENTSTATE: //get client state
//fixme: we need to fill in a structure.
Con_Printf("ui_getclientstate\n");
break;
case UI_GETCONFIGSTRING:
@ -1429,10 +1490,7 @@ qboolean UI_KeyPress(int key, int unicode, qboolean down)
Media_PlayFilm("");
}
if (cls.state)
VM_Call(uivm, UI_SET_ACTIVE_MENU, 2);
else
VM_Call(uivm, UI_SET_ACTIVE_MENU, 1);
UI_OpenMenu();
scr_conlines = 0;
return true;
@ -1458,26 +1516,14 @@ qboolean UI_KeyPress(int key, int unicode, qboolean down)
// return result;
}
void UI_MousePosition(int xpos, int ypos)
qboolean UI_MousePosition(int xpos, int ypos)
{
if (uivm && (ox != xpos || oy != ypos))
if (uivm && (keycatcher&2))
{
if (xpos < 0)
xpos = 0;
if (ypos < 0)
ypos = 0;
if (xpos > vid.width)
xpos = vid.width;
if (ypos > vid.height)
ypos = vid.height;
ox=0;oy=0;
//force a cap
VM_Call(uivm, UI_MOUSE_EVENT, -32767, -32767);
VM_Call(uivm, UI_MOUSE_EVENT, (xpos-ox)*640/vid.width, (ypos-oy)*480/vid.height);
ox = xpos;
oy = ypos;
VM_Call(uivm, UI_MOUSE_EVENT, (xpos)*640/(int)vid.width, (ypos)*480/(int)vid.height);
return true;
}
return false;
}
void UI_Stop (void)
@ -1515,11 +1561,7 @@ void UI_Start (void)
}
VM_Call(uivm, UI_INIT);
VM_Call(uivm, UI_MOUSE_EVENT, -32767, -32767);
ox = 0;
oy = 0;
VM_Call(uivm, UI_SET_ACTIVE_MENU, 1);
UI_OpenMenu();
}
}
@ -1537,6 +1579,20 @@ void UI_Restart_f(void)
}
}
qboolean UI_OpenMenu(void)
{
if (uivm)
{
if (cls.state)
VM_Call(uivm, UI_SET_ACTIVE_MENU, 2);
else
VM_Call(uivm, UI_SET_ACTIVE_MENU, 1);
key_dest = key_game;
return true;
}
return false;
}
qboolean UI_Command(void)
{
if (uivm)

View File

@ -3,15 +3,27 @@
#ifdef HLCLIENT
//make shared
#ifndef QDECL
#ifdef _MSC_VER
#define QDECL _cdecl
#else
#define QDECL
#endif
#endif
struct hlcvar_s *QDECL GHL_CVarGetPointer(char *varname);
#define notimp(l) Con_Printf("halflife cl builtin not implemented on line %i\n", l)
//#define HLCL_API_VERSION 6
#if HLCLIENT >= 1
#define HLCL_API_VERSION HLCLIENT
#else
#define HLCL_API_VERSION 7
#endif
//make shared
struct hlcvar_s *GHL_CVarGetPointer(char *varname);
#define HLPIC model_t*
@ -111,104 +123,104 @@ typedef struct
typedef struct
{
HLPIC (*pic_load) (char *picname);
int (*pic_getnumframes) (HLPIC pic);
int (*pic_getheight) (HLPIC pic, int frame);
int (*pic_getwidth) (HLPIC pic, int frame);
void (*pic_select) (HLPIC pic, int r, int g, int b);
void (*pic_drawcuropaque) (int frame, int x, int y, void *loc);
void (*pic_drawcuralphatest) (int frame, int x, int y, void *loc);
void (*pic_drawcuradditive) (int frame, int x, int y, void *loc);
void (*pic_enablescissor) (int x, int y, int width, int height);
void (*pic_disablescissor) (void);
hlspriteinf_t *(*pic_parsepiclist) (char *filename, int *numparsed);
HLPIC (QDECL *pic_load) (char *picname);
int (QDECL *pic_getnumframes) (HLPIC pic);
int (QDECL *pic_getheight) (HLPIC pic, int frame);
int (QDECL *pic_getwidth) (HLPIC pic, int frame);
void (QDECL *pic_select) (HLPIC pic, int r, int g, int b);
void (QDECL *pic_drawcuropaque) (int frame, int x, int y, void *loc);
void (QDECL *pic_drawcuralphatest) (int frame, int x, int y, void *loc);
void (QDECL *pic_drawcuradditive) (int frame, int x, int y, void *loc);
void (QDECL *pic_enablescissor) (int x, int y, int width, int height);
void (QDECL *pic_disablescissor) (void);
hlspriteinf_t *(QDECL *pic_parsepiclist) (char *filename, int *numparsed);
void (*fillrgba) (int x, int y, int width, int height, int r, int g, int b, int a);
int (*getscreeninfo) (hlscreeninfo_t *info);
void (*setcrosshair) (HLPIC pic, hlsubrect_t rect, int r, int g, int b); //I worry about stuff like this
void (QDECL *fillrgba) (int x, int y, int width, int height, int r, int g, int b, int a);
int (QDECL *getscreeninfo) (hlscreeninfo_t *info);
void (QDECL *setcrosshair) (HLPIC pic, hlsubrect_t rect, int r, int g, int b); //I worry about stuff like this
int (*cvar_register) (char *name, char *defvalue, int flags);
float (*cvar_getfloat) (char *name);
char *(*cvar_getstring) (char *name);
struct hlcvar_s *(QDECL *cvar_register) (char *name, char *defvalue, int flags);
float (QDECL *cvar_getfloat) (char *name);
char *(QDECL *cvar_getstring) (char *name);
void (*cmd_register) (char *name, void (*func) (void));
void (*hooknetmsg) (char *msgname, void *func);
void (*forwardcmd) (char *command);
void (*localcmd) (char *command);
void (QDECL *cmd_register) (char *name, void (*func) (void));
void (QDECL *hooknetmsg) (char *msgname, void *func);
void (QDECL *forwardcmd) (char *command);
void (QDECL *localcmd) (char *command);
void (*getplayerinfo) (int entnum, hlplayerinfo_t *result);
void (QDECL *getplayerinfo) (int entnum, hlplayerinfo_t *result);
void (*startsound_name) (char *name, float vol);
void (*startsound_idx) (int idx, float vol);
void (QDECL *startsound_name) (char *name, float vol);
void (QDECL *startsound_idx) (int idx, float vol);
void (*anglevectors) (float *ina, float *outf, float *outr, float *outu);
void (QDECL *anglevectors) (float *ina, float *outf, float *outr, float *outu);
hlmsginfo_t *(*get_message_info) (char *name); //translated+scaled+etc intro stuff
int (*drawchar) (int x, int y, int charnum, int r, int g, int b);
int (*drawstring) (int x, int y, char *string);
hlmsginfo_t *(QDECL *get_message_info) (char *name); //translated+scaled+etc intro stuff
int (QDECL *drawchar) (int x, int y, int charnum, int r, int g, int b);
int (QDECL *drawstring) (int x, int y, char *string);
#if HLCL_API_VERSION >= 7
void (*settextcolour) (float r, float b, float g);
void (QDECL *settextcolour) (float r, float b, float g);
#endif
void (*drawstring_getlen) (char *string, int *outlen, int *outheight);
void (*consoleprint) (char *str);
void (*centerprint) (char *str);
void (QDECL *drawstring_getlen) (char *string, int *outlen, int *outheight);
void (QDECL *consoleprint) (char *str);
void (QDECL *centerprint) (char *str);
#if HLCL_API_VERSION >= 7
int (*getwindowcenterx)(void); //yes, really, window center. for use with Get/SetCursorPos, the windows function.
int (*getwindowcentery)(void); //yes, really, window center. for use with Get/SetCursorPos, the windows function.
void (*getviewnangles)(float*ang);
void (*setviewnangles)(float*ang);
void (*getmaxclients)(float*ang);
void (*cvar_setvalue)(char *cvarname, char *value);
int (QDECL *getwindowcenterx)(void); //yes, really, window center. for use with Get/SetCursorPos, the windows function.
int (QDECL *getwindowcentery)(void); //yes, really, window center. for use with Get/SetCursorPos, the windows function.
void (QDECL *getviewnangles)(float*ang);
void (QDECL *setviewnangles)(float*ang);
void (QDECL *getmaxclients)(float*ang);
void (QDECL *cvar_setvalue)(char *cvarname, char *value);
int (*cmd_argc)(void);
char *(*cmd_argv)(int i);
void (*con_printf)(char *fmt, ...);
void (*con_dprintf)(char *fmt, ...);
void (*con_notificationprintf)(int pos, char *fmt, ...);
void (*con_notificationprintfex)(void *info, char *fmt, ...); //arg1 is of specific type
char *(*physkey)(char *key);
char *(*serverkey)(char *key);
float (*getclientmaxspeed)(void);
int (*checkparm)(char *str, char **next);
int (*keyevent)(int key, int down);
void (*getmousepos)(int *outx, int *outy);
int (*movetypeisnoclip)(void);
struct hlclent_s *(*getlocalplayer)(void);
struct hlclent_s *(*getviewent)(void);
struct hlclent_s *(*getentidx)(void);
float (*getlocaltime)(void);
void (*calcshake)(void);
void (*applyshake)(void);
int (*pointcontents)(float *point, float *truecon);
int (*waterentity)(float *point);
void (*traceline) (float *start, float *end, int flags, int hull, int forprediction);
int (QDECL *cmd_argc)(void);
char *(QDECL *cmd_argv)(int i);
void (QDECL *con_printf)(char *fmt, ...);
void (QDECL *con_dprintf)(char *fmt, ...);
void (QDECL *con_notificationprintf)(int pos, char *fmt, ...);
void (QDECL *con_notificationprintfex)(void *info, char *fmt, ...); //arg1 is of specific type
char *(QDECL *physkey)(char *key);
char *(QDECL *serverkey)(char *key);
float (QDECL *getclientmaxspeed)(void);
int (QDECL *checkparm)(char *str, char **next);
int (QDECL *keyevent)(int key, int down);
void (QDECL *getmousepos)(int *outx, int *outy);
int (QDECL *movetypeisnoclip)(void);
struct hlclent_s *(QDECL *getlocalplayer)(void);
struct hlclent_s *(QDECL *getviewent)(void);
struct hlclent_s *(QDECL *getentidx)(void);
float (QDECL *getlocaltime)(void);
void (QDECL *calcshake)(void);
void (QDECL *applyshake)(float *,float *,float);
int (QDECL *pointcontents)(float *point, float *truecon);
int (QDECL *waterentity)(float *point);
void (QDECL *traceline) (float *start, float *end, int flags, int hull, int forprediction);
model_t *(*loadmodel)(char *modelname, int *mdlindex);
int (*addrentity)(int type, void *ent);
model_t *(QDECL *loadmodel)(char *modelname, int *mdlindex);
int (QDECL *addrentity)(int type, void *ent);
model_t *(*modelfrompic) (HLPIC pic);
void (*soundatloc)(char*sound, float volume, float *org);
model_t *(QDECL *modelfrompic) (HLPIC pic);
void (QDECL *soundatloc)(char*sound, float volume, float *org);
unsigned short (*precacheevent)(int evtype, char *name);
void (*playevent)(int flags, struct hledict_s *ent, unsigned short evindex, float delay, float *origin, float *angles, float f1, float f2, int i1, int i2, int b1, int b2);
void (*weaponanimate)(int anim, int body);
float (*randfloat) (float minv, float maxv);
long (*randlong) (long minv, long maxv);
void (*hookevent) (char *name, void (*func)(struct hlevent_s *event));
int (*con_isshown) (void);
char *(*getgamedir) (void);
struct hlcvar_s *(*cvar_find) (char *name);
char *(*lookupbinding) (char *command);
char *(*getlevelname) (void);
void (*getscreenfade) (struct hlsfade_s *fade);
void (*setscreenfade) (struct hlsfade_s *fade);
void *(*vgui_getpanel) (void);
void (*vgui_paintback) (int extents[4]);
unsigned short (QDECL *precacheevent)(int evtype, char *name);
void (QDECL *playevent)(int flags, struct hledict_s *ent, unsigned short evindex, float delay, float *origin, float *angles, float f1, float f2, int i1, int i2, int b1, int b2);
void (QDECL *weaponanimate)(int anim, int body);
float (QDECL *randfloat) (float minv, float maxv);
long (QDECL *randlong) (long minv, long maxv);
void (QDECL *hookevent) (char *name, void (*func)(struct hlevent_s *event));
int (QDECL *con_isshown) (void);
char *(QDECL *getgamedir) (void);
struct hlcvar_s *(QDECL *cvar_find) (char *name);
char *(QDECL *lookupbinding) (char *command);
char *(QDECL *getlevelname) (void);
void (QDECL *getscreenfade) (struct hlsfade_s *fade);
void (QDECL *setscreenfade) (struct hlsfade_s *fade);
void *(QDECL *vgui_getpanel) (void);
void (QDECL *vgui_paintback) (int extents[4]);
void *(*loadfile) (char *path, int onhunk, int *length);
char *(*parsefile) (char *data, char *token);
void (*freefile) (void *file);
void *(QDECL *loadfile) (char *path, int onhunk, int *length);
char *(QDECL *parsefile) (char *data, char *token);
void (QDECL *freefile) (void *file);
struct hl_tri_api_s
{
@ -227,10 +239,10 @@ typedef struct
} *eventapi;
struct hl_demo_api_s
{
int (*isrecording)(void);
int (*isplaying)(void);
int (*istimedemo)(void);
void (*writedata)(int size, void *data);
int (QDECL *isrecording)(void);
int (QDECL *isplaying)(void);
int (QDECL *istimedemo)(void);
void (QDECL *writedata)(int size, void *data);
int sentinal;
} *demoapi;
@ -245,22 +257,22 @@ typedef struct
int sentinal;
} *voiceapi;
int (*forcedspectator) (void);
model_t *(*loadmapsprite) (char *name);
int (QDECL *forcedspectator) (void);
model_t *(QDECL *loadmapsprite) (char *name);
void (*fs_addgamedir) (char *basedir, char *appname);
int (*expandfilename) (char *filename, char *outbuff, int outsize);
void (QDECL *fs_addgamedir) (char *basedir, char *appname);
int (QDECL *expandfilename) (char *filename, char *outbuff, int outsize);
char *(*player_key) (int pnum, char *key);
void (*player_setkey) (char *key, char *value); //wait, no pnum?
char *(QDECL *player_key) (int pnum, char *key);
void (QDECL *player_setkey) (char *key, char *value); //wait, no pnum?
qboolean (*getcdkey) (int playernum, char key[16]);
qboolean (QDECL *getcdkey) (int playernum, char key[16]);
int trackerfromplayer;
int playerfromtracker;
int (*sendcmd_unreliable) (char *cmd);
void (*getsysmousepos) (long *xandy);
void (*setsysmousepos) (int x, int y);
void (*setmouseenable) (qboolean enable);
int (QDECL *sendcmd_unreliable) (char *cmd);
void (QDECL *getsysmousepos) (long *xandy);
void (QDECL *setsysmousepos) (int x, int y);
void (QDECL *setmouseenable) (qboolean enable);
#endif
int sentinal;
@ -269,17 +281,17 @@ typedef struct
typedef struct
{
int (*HUD_VidInit) (void);
int (*HUD_Init) (void);
int (*HUD_Shutdown) (void);
int (*HUD_Redraw) (float maptime, int inintermission);
int (*HUD_UpdateClientData) (hllocalclientdata_t *localclientdata, float maptime);
int (*HUD_Reset) (void);
int (QDECL *HUD_VidInit) (void);
int (QDECL *HUD_Init) (void);
int (QDECL *HUD_Shutdown) (void);
int (QDECL *HUD_Redraw) (float maptime, int inintermission);
int (QDECL *HUD_UpdateClientData) (hllocalclientdata_t *localclientdata, float maptime);
int (QDECL *HUD_Reset) (void);
#if HLCL_API_VERSION >= 7
void (*CL_CreateMove) (float frametime, hlusercmd_t *cmd, int isplaying);
void (*IN_ActivateMouse) (void);
void (*IN_DeactivateMouse) (void);
void (*IN_MouseEvent) (int buttonmask);
void (QDECL *CL_CreateMove) (float frametime, hlusercmd_t *cmd, int isplaying);
void (QDECL *IN_ActivateMouse) (void);
void (QDECL *IN_DeactivateMouse) (void);
void (QDECL *IN_MouseEvent) (int buttonmask);
#endif
} CLHL_cgamefuncs_t;
@ -311,7 +323,7 @@ typedef struct
typedef struct
{
char name[64];
int (*hook) (char *name, int bufsize, void *bufdata);
int (QDECL *hook) (char *name, int bufsize, void *bufdata);
} CLHL_UserMessages_t;
CLHL_UserMessages_t usermsgs[256];
@ -329,12 +341,12 @@ int hl_viewmodelsequencebody;
HLPIC CLGHL_pic_load (char *picname)
HLPIC QDECL CLGHL_pic_load (char *picname)
{
return Mod_ForName(picname, false);
// return Draw_SafeCachePic(picname);
}
int CLGHL_pic_getnumframes (HLPIC pic)
int QDECL CLGHL_pic_getnumframes (HLPIC pic)
{
if (pic)
return pic->numframes;
@ -369,7 +381,7 @@ static mpic_t *getspritepic(HLPIC pic, int frame)
return NULL;
}
int CLGHL_pic_getheight (HLPIC pic, int frame)
int QDECL CLGHL_pic_getheight (HLPIC pic, int frame)
{
mspriteframe_t *pframe;
@ -379,7 +391,7 @@ int CLGHL_pic_getheight (HLPIC pic, int frame)
return pframe->p.width;
}
int CLGHL_pic_getwidth (HLPIC pic, int frame)
int QDECL CLGHL_pic_getwidth (HLPIC pic, int frame)
{
mspriteframe_t *pframe;
@ -389,12 +401,12 @@ int CLGHL_pic_getwidth (HLPIC pic, int frame)
return pframe->p.height;
}
void CLGHL_pic_select (HLPIC pic, int r, int g, int b)
void QDECL CLGHL_pic_select (HLPIC pic, int r, int g, int b)
{
selectedpic = pic;
Draw_ImageColours(r/255.0f, g/255.0f, b/255.0f, 1);
}
void CLGHL_pic_drawcuropaque (int frame, int x, int y, hlsubrect_t *loc)
void QDECL CLGHL_pic_drawcuropaque (int frame, int x, int y, hlsubrect_t *loc)
{
mpic_t *pic = getspritepic(selectedpic, frame);
if (!pic)
@ -409,7 +421,7 @@ void CLGHL_pic_drawcuropaque (int frame, int x, int y, hlsubrect_t *loc)
(float)loc->r/pic->width, (float)loc->b/pic->height,
pic);
}
void CLGHL_pic_drawcuralphtest (int frame, int x, int y, hlsubrect_t *loc)
void QDECL CLGHL_pic_drawcuralphtest (int frame, int x, int y, hlsubrect_t *loc)
{
mpic_t *pic = getspritepic(selectedpic, frame);
if (!pic)
@ -423,7 +435,7 @@ void CLGHL_pic_drawcuralphtest (int frame, int x, int y, hlsubrect_t *loc)
(float)loc->r/pic->width, (float)loc->b/pic->height,
pic);
}
void CLGHL_pic_drawcuradditive (int frame, int x, int y, hlsubrect_t *loc)
void QDECL CLGHL_pic_drawcuradditive (int frame, int x, int y, hlsubrect_t *loc)
{
mpic_t *pic = getspritepic(selectedpic, frame);
if (!pic)
@ -452,13 +464,13 @@ void CLGHL_pic_drawcuradditive (int frame, int x, int y, hlsubrect_t *loc)
}
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void CLGHL_pic_enablescissor (int x, int y, int width, int height)
void QDECL CLGHL_pic_enablescissor (int x, int y, int width, int height)
{
}
void CLGHL_pic_disablescissor (void)
void QDECL CLGHL_pic_disablescissor (void)
{
}
hlspriteinf_t *CLGHL_pic_parsepiclist (char *filename, int *numparsed)
hlspriteinf_t *QDECL CLGHL_pic_parsepiclist (char *filename, int *numparsed)
{
hlspriteinf_t *result;
int entry;
@ -514,10 +526,10 @@ hlspriteinf_t *CLGHL_pic_parsepiclist (char *filename, int *numparsed)
return result;
}
void CLGHL_fillrgba (int x, int y, int width, int height, int r, int g, int b, int a)
void QDECL CLGHL_fillrgba (int x, int y, int width, int height, int r, int g, int b, int a)
{
}
int CLGHL_getscreeninfo (hlscreeninfo_t *info)
int QDECL CLGHL_getscreeninfo (hlscreeninfo_t *info)
{
int i;
if (info->size != sizeof(*info))
@ -532,25 +544,25 @@ int CLGHL_getscreeninfo (hlscreeninfo_t *info)
return true;
}
void CLGHL_setcrosshair (HLPIC pic, hlsubrect_t rect, int r, int g, int b)
void QDECL CLGHL_setcrosshair (HLPIC pic, hlsubrect_t rect, int r, int g, int b)
{
}
struct hlcvar_s *CLGHL_cvar_register (char *name, char *defvalue, int flags)
struct hlcvar_s *QDECL CLGHL_cvar_register (char *name, char *defvalue, int flags)
{
if (Cvar_Get(name, defvalue, 0, "Halflife cvars"))
return GHL_CVarGetPointer(name);
else
return NULL;
}
float CLGHL_cvar_getfloat (char *name)
float QDECL CLGHL_cvar_getfloat (char *name)
{
cvar_t *var = Cvar_FindVar(name);
if (var)
return var->value;
return 0;
}
char *CLGHL_cvar_getstring (char *name)
char *QDECL CLGHL_cvar_getstring (char *name)
{
cvar_t *var = Cvar_FindVar(name);
if (var)
@ -558,11 +570,11 @@ char *CLGHL_cvar_getstring (char *name)
return "";
}
void CLGHL_cmd_register (char *name, xcommand_t func)
void QDECL CLGHL_cmd_register (char *name, xcommand_t func)
{
Cmd_AddRemCommand(name, func);
}
void CLGHL_hooknetmsg (char *msgname, void *func)
void QDECL CLGHL_hooknetmsg (char *msgname, void *func)
{
int i;
//update the current list now.
@ -589,16 +601,16 @@ void CLGHL_hooknetmsg (char *msgname, void *func)
pendingusermsgs[numnewhooks].hook = func;
numnewhooks++;
}
void CLGHL_forwardcmd (char *command)
void QDECL CLGHL_forwardcmd (char *command)
{
CL_SendClientCommand(true, "%s", command);
}
void CLGHL_localcmd (char *command)
void QDECL CLGHL_localcmd (char *command)
{
Cbuf_AddText(command, RESTRICT_SERVER);
}
void CLGHL_getplayerinfo (int entnum, hlplayerinfo_t *result)
void QDECL CLGHL_getplayerinfo (int entnum, hlplayerinfo_t *result)
{
player_info_t *player;
entnum--;
@ -619,7 +631,7 @@ void CLGHL_getplayerinfo (int entnum, hlplayerinfo_t *result)
result->model = "";
}
void CLGHL_startsound_name (char *name, float vol)
void QDECL CLGHL_startsound_name (char *name, float vol)
{
sfx_t *sfx = S_PrecacheSound (name);
if (!sfx)
@ -629,7 +641,7 @@ void CLGHL_startsound_name (char *name, float vol)
}
S_StartSound (-1, -1, sfx, vec3_origin, vol, 1);
}
void CLGHL_startsound_idx (int idx, float vol)
void QDECL CLGHL_startsound_idx (int idx, float vol)
{
sfx_t *sfx = cl.sound_precache[idx];
if (!sfx)
@ -640,12 +652,12 @@ void CLGHL_startsound_idx (int idx, float vol)
S_StartSound (-1, -1, sfx, vec3_origin, vol, 1);
}
void CLGHL_anglevectors (float *ina, float *outf, float *outr, float *outu)
void QDECL CLGHL_anglevectors (float *ina, float *outf, float *outr, float *outu)
{
AngleVectors(ina, outf, outr, outu);
}
hlmsginfo_t *CLGHL_get_message_info (char *name)
hlmsginfo_t *QDECL CLGHL_get_message_info (char *name)
{
//fixme: add parser
hlmsginfo_t *ret;
@ -664,70 +676,70 @@ hlmsginfo_t *CLGHL_get_message_info (char *name)
ret->holdtime = 1000;
return ret;
}
int CLGHL_drawchar (int x, int y, int charnum, int r, int g, int b)
int QDECL CLGHL_drawchar (int x, int y, int charnum, int r, int g, int b)
{
return 0;
}
int CLGHL_drawstring (int x, int y, char *string)
int QDECL CLGHL_drawstring (int x, int y, char *string)
{
return 0;
}
void CLGHL_settextcolour(float r, float g, float b)
void QDECL CLGHL_settextcolour(float r, float g, float b)
{
}
void CLGHL_drawstring_getlen (char *string, int *outlen, int *outheight)
void QDECL CLGHL_drawstring_getlen (char *string, int *outlen, int *outheight)
{
*outlen = strlen(string)*8;
*outheight = 8;
}
void CLGHL_consoleprint (char *str)
void QDECL CLGHL_consoleprint (char *str)
{
Con_Printf("%s", str);
}
void CLGHL_centerprint (char *str)
void QDECL CLGHL_centerprint (char *str)
{
SCR_CenterPrint(0, str, true);
}
int CLGHL_getwindowcenterx(void)
int QDECL CLGHL_getwindowcenterx(void)
{
return window_center_x;
}
int CLGHL_getwindowcentery(void)
int QDECL CLGHL_getwindowcentery(void)
{
return window_center_y;
}
void CLGHL_getviewnangles(float*ang)
void QDECL CLGHL_getviewnangles(float*ang)
{
VectorCopy(cl.viewangles[0], ang);
}
void CLGHL_setviewnangles(float*ang)
void QDECL CLGHL_setviewnangles(float*ang)
{
VectorCopy(ang, cl.viewangles[0]);
}
void CLGHL_getmaxclients(float*ang){notimp(__LINE__);}
void CLGHL_cvar_setvalue(char *cvarname, char *value){notimp(__LINE__);}
void QDECL CLGHL_getmaxclients(float*ang){notimp(__LINE__);}
void QDECL CLGHL_cvar_setvalue(char *cvarname, char *value){notimp(__LINE__);}
int CLGHL_cmd_argc(void)
int QDECL CLGHL_cmd_argc(void)
{
return Cmd_Argc();
}
char *CLGHL_cmd_argv(int i)
char *QDECL CLGHL_cmd_argv(int i)
{
return Cmd_Argv(i);
}
#define CLGHL_con_printf Con_Printf//void CLGHL_con_printf(char *fmt, ...){notimp(__LINE__);}
#define CLGHL_con_dprintf Con_DPrintf//void CLGHL_con_dprintf(char *fmt, ...){notimp(__LINE__);}
void CLGHL_con_notificationprintf(int pos, char *fmt, ...){notimp(__LINE__);}
void CLGHL_con_notificationprintfex(void *info, char *fmt, ...){notimp(__LINE__);}
char *CLGHL_physkey(char *key){notimp(__LINE__);return NULL;}
char *CLGHL_serverkey(char *key){notimp(__LINE__);return NULL;}
float CLGHL_getclientmaxspeed(void)
void QDECL CLGHL_con_notificationprintf(int pos, char *fmt, ...){notimp(__LINE__);}
void QDECL CLGHL_con_notificationprintfex(void *info, char *fmt, ...){notimp(__LINE__);}
char *QDECL CLGHL_physkey(char *key){notimp(__LINE__);return NULL;}
char *QDECL CLGHL_serverkey(char *key){notimp(__LINE__);return NULL;}
float QDECL CLGHL_getclientmaxspeed(void)
{
return 320;
}
int CLGHL_checkparm(char *str, const char **next)
int QDECL CLGHL_checkparm(char *str, const char **next)
{
int i;
i = COM_CheckParm(str);
@ -740,7 +752,7 @@ int CLGHL_checkparm(char *str, const char **next)
}
return i;
}
int CLGHL_keyevent(int key, int down)
int QDECL CLGHL_keyevent(int key, int down)
{
if (key >= 241 && key <= 241+5)
Key_Event(K_MOUSE1+key-241, 0, down);
@ -748,62 +760,62 @@ int CLGHL_keyevent(int key, int down)
Con_Printf("CLGHL_keyevent: Unrecognised HL key code\n");
return true; //fixme: check the return type
}
void CLGHL_getmousepos(int *outx, int *outy){notimp(__LINE__);}
int CLGHL_movetypeisnoclip(void){notimp(__LINE__);return 0;}
struct hlclent_s *CLGHL_getlocalplayer(void){notimp(__LINE__);return NULL;}
struct hlclent_s *CLGHL_getviewent(void){notimp(__LINE__);return NULL;}
struct hlclent_s *CLGHL_getentidx(void){notimp(__LINE__);return NULL;}
float CLGHL_getlocaltime(void){return cl.time;}
void CLGHL_calcshake(void){notimp(__LINE__);}
void CLGHL_applyshake(float *origin, float *angles, float factor){notimp(__LINE__);}
int CLGHL_pointcontents(float *point, float *truecon){notimp(__LINE__);return 0;}
int CLGHL_entcontents(float *point){notimp(__LINE__);return 0;}
void CLGHL_traceline(float *start, float *end, int flags, int hull, int forprediction){notimp(__LINE__);}
void QDECL CLGHL_getmousepos(int *outx, int *outy){notimp(__LINE__);}
int QDECL CLGHL_movetypeisnoclip(void){notimp(__LINE__);return 0;}
struct hlclent_s *QDECL CLGHL_getlocalplayer(void){notimp(__LINE__);return NULL;}
struct hlclent_s *QDECL CLGHL_getviewent(void){notimp(__LINE__);return NULL;}
struct hlclent_s *QDECL CLGHL_getentidx(void){notimp(__LINE__);return NULL;}
float QDECL CLGHL_getlocaltime(void){return cl.time;}
void QDECL CLGHL_calcshake(void){notimp(__LINE__);}
void QDECL CLGHL_applyshake(float *origin, float *angles, float factor){notimp(__LINE__);}
int QDECL CLGHL_pointcontents(float *point, float *truecon){notimp(__LINE__);return 0;}
int QDECL CLGHL_entcontents(float *point){notimp(__LINE__);return 0;}
void QDECL CLGHL_traceline(float *start, float *end, int flags, int hull, int forprediction){notimp(__LINE__);}
model_t *CLGHL_loadmodel(char *modelname, int *mdlindex){notimp(__LINE__);return Mod_ForName(modelname, false);}
int CLGHL_addrentity(int type, void *ent){notimp(__LINE__);return 0;}
model_t *QDECL CLGHL_loadmodel(char *modelname, int *mdlindex){notimp(__LINE__);return Mod_ForName(modelname, false);}
int QDECL CLGHL_addrentity(int type, void *ent){notimp(__LINE__);return 0;}
model_t *CLGHL_modelfrompic(HLPIC pic){notimp(__LINE__);return NULL;}
void CLGHL_soundatloc(char*sound, float volume, float *org){notimp(__LINE__);}
model_t *QDECL CLGHL_modelfrompic(HLPIC pic){notimp(__LINE__);return NULL;}
void QDECL CLGHL_soundatloc(char*sound, float volume, float *org){notimp(__LINE__);}
unsigned short CLGHL_precacheevent(int evtype, char *name){notimp(__LINE__);return 0;}
void CLGHL_playevent(int flags, struct hledict_s *ent, unsigned short evindex, float delay, float *origin, float *angles, float f1, float f2, int i1, int i2, int b1, int b2){notimp(__LINE__);}
void CLGHL_weaponanimate(int newsequence, int body)
unsigned short QDECL CLGHL_precacheevent(int evtype, char *name){notimp(__LINE__);return 0;}
void QDECL CLGHL_playevent(int flags, struct hledict_s *ent, unsigned short evindex, float delay, float *origin, float *angles, float f1, float f2, int i1, int i2, int b1, int b2){notimp(__LINE__);}
void QDECL CLGHL_weaponanimate(int newsequence, int body)
{
hl_viewmodelsequencetime = cl.time;
hl_viewmodelsequencecur = newsequence;
hl_viewmodelsequencebody = body;
}
float CLGHL_randfloat(float minv, float maxv){notimp(__LINE__);return minv;}
long CLGHL_randlong(long minv, long maxv){notimp(__LINE__);return minv;}
void CLGHL_hookevent(char *name, void (*func)(struct hlevent_s *event)){notimp(__LINE__);}
int CLGHL_con_isshown(void)
float QDECL CLGHL_randfloat(float minv, float maxv){notimp(__LINE__);return minv;}
long QDECL CLGHL_randlong(long minv, long maxv){notimp(__LINE__);return minv;}
void QDECL CLGHL_hookevent(char *name, void (*func)(struct hlevent_s *event)){notimp(__LINE__);}
int QDECL CLGHL_con_isshown(void)
{
return scr_con_current > 0;
}
char *CLGHL_getgamedir(void)
char *QDECL CLGHL_getgamedir(void)
{
extern char gamedirfile[];
return gamedirfile;
}
struct hlcvar_s *CLGHL_cvar_find(char *name)
struct hlcvar_s *QDECL CLGHL_cvar_find(char *name)
{
return GHL_CVarGetPointer(name);
}
char *CLGHL_lookupbinding(char *command)
char *QDECL CLGHL_lookupbinding(char *command)
{
return NULL;
}
char *CLGHL_getlevelname(void)
char *QDECL CLGHL_getlevelname(void)
{
return cl.levelname;
}
void CLGHL_getscreenfade(struct hlsfade_s *fade){notimp(__LINE__);}
void CLGHL_setscreenfade(struct hlsfade_s *fade){notimp(__LINE__);}
void *CLGHL_vgui_getpanel(void){notimp(__LINE__);return NULL;}
void CLGHL_vgui_paintback(int extents[4]){notimp(__LINE__);}
void QDECL CLGHL_getscreenfade(struct hlsfade_s *fade){notimp(__LINE__);}
void QDECL CLGHL_setscreenfade(struct hlsfade_s *fade){notimp(__LINE__);}
void *QDECL CLGHL_vgui_getpanel(void){notimp(__LINE__);return NULL;}
void QDECL CLGHL_vgui_paintback(int extents[4]){notimp(__LINE__);}
void *CLGHL_loadfile(char *path, int alloctype, int *length)
void *QDECL CLGHL_loadfile(char *path, int alloctype, int *length)
{
void *ptr = NULL;
int flen = -1;
@ -819,49 +831,49 @@ void *CLGHL_loadfile(char *path, int alloctype, int *length)
return ptr;
}
char *CLGHL_parsefile(char *data, char *token)
char *QDECL CLGHL_parsefile(char *data, char *token)
{
return COM_ParseOut(data, token, 1024);
}
void CLGHL_freefile(void *file)
void QDECL CLGHL_freefile(void *file)
{
//only valid for alloc type 5
FS_FreeFile(file);
}
int CLGHL_forcedspectator(void)
int QDECL CLGHL_forcedspectator(void)
{
return cls.demoplayback;
}
model_t *CLGHL_loadmapsprite(char *name)
model_t *QDECL CLGHL_loadmapsprite(char *name)
{
notimp(__LINE__);return NULL;
}
void CLGHL_fs_addgamedir(char *basedir, char *appname){notimp(__LINE__);}
int CLGHL_expandfilename(char *filename, char *outbuff, int outsize){notimp(__LINE__);return false;}
void QDECL CLGHL_fs_addgamedir(char *basedir, char *appname){notimp(__LINE__);}
int QDECL CLGHL_expandfilename(char *filename, char *outbuff, int outsize){notimp(__LINE__);return false;}
char *CLGHL_player_key(int pnum, char *key){notimp(__LINE__);return NULL;}
void CLGHL_player_setkey(char *key, char *value){notimp(__LINE__);return NULL;}
char *QDECL CLGHL_player_key(int pnum, char *key){notimp(__LINE__);return NULL;}
void QDECL CLGHL_player_setkey(char *key, char *value){notimp(__LINE__);return;}
qboolean CLGHL_getcdkey(int playernum, char key[16]){notimp(__LINE__);return false;}
int CLGHL_trackerfromplayer(int pslot){notimp(__LINE__);return 0;}
int CLGHL_playerfromtracker(int tracker){notimp(__LINE__);return 0;}
int CLGHL_sendcmd_unreliable(char *cmd){notimp(__LINE__);return 0;}
void CLGHL_getsysmousepos(long *xandy)
qboolean QDECL CLGHL_getcdkey(int playernum, char key[16]){notimp(__LINE__);return false;}
int QDECL CLGHL_trackerfromplayer(int pslot){notimp(__LINE__);return 0;}
int QDECL CLGHL_playerfromtracker(int tracker){notimp(__LINE__);return 0;}
int QDECL CLGHL_sendcmd_unreliable(char *cmd){notimp(__LINE__);return 0;}
void QDECL CLGHL_getsysmousepos(long *xandy)
{
#ifdef _WIN32
GetCursorPos((LPPOINT)xandy);
#endif
}
void CLGHL_setsysmousepos(int x, int y)
void QDECL CLGHL_setsysmousepos(int x, int y)
{
#ifdef _WIN32
SetCursorPos(x, y);
#endif
}
void CLGHL_setmouseenable(qboolean enable)
void QDECL CLGHL_setmouseenable(qboolean enable)
{
extern cvar_t _windowed_mouse;
Cvar_Set(&_windowed_mouse, enable?"1":"0");
@ -870,19 +882,19 @@ void CLGHL_setmouseenable(qboolean enable)
#if HLCL_API_VERSION >= 7
int CLGHL_demo_isrecording(void)
int QDECL CLGHL_demo_isrecording(void)
{
return cls.demorecording;
}
int CLGHL_demo_isplaying(void)
int QDECL CLGHL_demo_isplaying(void)
{
return cls.demoplayback;
}
int CLGHL_demo_istimedemo(void)
int QDECL CLGHL_demo_istimedemo(void)
{
return cls.timedemo;
}
void CLGHL_demo_writedata(int size, void *data)
void QDECL CLGHL_demo_writedata(int size, void *data)
{
notimp(__LINE__);
}
@ -1100,7 +1112,7 @@ void CLHL_LoadClientGame(void)
char fullname[MAX_OSPATH];
char *path;
int (*initfunc)(CLHL_enginecgamefuncs_t *funcs, int version);
int (QDECL *initfunc)(CLHL_enginecgamefuncs_t *funcs, int version);
dllfunction_t funcs[] =
{
{(void*)&initfunc, "Initialize"},
@ -1115,7 +1127,7 @@ void CLHL_LoadClientGame(void)
while((path = COM_NextPath (path)))
{
if (!path)
return NULL; // couldn't find one anywhere
return; // couldn't find one anywhere
snprintf (fullname, sizeof(fullname), "%s/%s", path, "cl_dlls/client");
clg = Sys_LoadLibrary(fullname, funcs);
if (clg)
@ -1127,6 +1139,7 @@ void CLHL_LoadClientGame(void)
if (!initfunc(&CLHL_enginecgamefuncs, HLCL_API_VERSION))
{
Con_Printf("HalfLife cldll is not version %i\n", HLCL_API_VERSION);
Sys_CloseLibrary(clg);
clg = NULL;
return;
@ -1284,7 +1297,7 @@ int CLHL_ParseGamePacket(void)
if (!(flags & 4))
S_StartSound(0, 0, S_PrecacheSound("explosion"), startp, 1, 1);
if (!(flags & 2))
CL_NewDlightRGB(0, startp[0], startp[1], startp[2], 200, 1, 0.2,0.2,0.2);
CL_NewDlightRGB(0, startp, 200, 1, 0.2,0.2,0.2);
ef = CL_AllocExplosion();
VectorCopy(startp, ef->origin);

View File

@ -28,9 +28,9 @@ typedef struct
int height;
//for hardware 32bit texture overrides
int tex_base;
int tex_lower;
int tex_upper;
texid_t tex_base;
texid_t tex_lower;
texid_t tex_upper;
qboolean failedload; // the name isn't a valid skin
cache_user_t cache;
@ -231,19 +231,11 @@ typedef struct
//
// client_state_t should hold all pieces of the client state
//
#define MAX_SWLIGHTS 32 //sw lighting, aka: r_dynamic, uses unsigned ints as a mask for cached lit flags. We could increase this on 64bit platforms or by just using more fields.
#ifdef RGLQUAKE
#define MAX_RTLIGHTS 256 //r_shadow_realtime_world needs a LOT of lights.
#else
#define MAX_RTLIGHTS 0 //but sw rendering doesn't have that.
#endif
#if MAX_SWLIGHTS > MAX_RTLIGHTS
#define MAX_DLIGHTS MAX_SWLIGHTS
#else
#define MAX_DLIGHTS MAX_RTLIGHTS
#endif
//the light array works thusly:
//dlights are allocated DL_LAST downwards to 0, static wlights are allocated DL_LAST+1 to MAX_RTLIGHTS.
//thus to clear the dlights but not rtlights, set the first light to RTL_FIRST
#define DL_LAST (sizeof(unsigned int)*8-1)
#define RTL_FIRST (sizeof(unsigned int)*8)
#define LFLAG_NORMALMODE (1<<0)
#define LFLAG_REALTIMEMODE (1<<1)
@ -252,6 +244,7 @@ typedef struct
#define LFLAG_ALLOW_LMHACK (1<<16)
#define LFLAG_ALLOW_FLASH (1<<17)
#define LFLAG_ALLOW_PPL (1<<18)
#define LFLAG_SHADOWMAP (1<<19)
#define LFLAG_DYNAMIC (LFLAG_ALLOW_PPL | LFLAG_ALLOW_LMHACK | LFLAG_ALLOW_FLASH | LFLAG_NORMALMODE | LFLAG_REALTIMEMODE)
@ -271,11 +264,13 @@ typedef struct dlight_s
//the following are used for rendering (client code should clear on create)
struct shadowmesh_s *worldshadowmesh;
int stexture;
texid_t stexture;
struct {
float updatetime;
} face [6];
int style; //multiply by style values if > 0
float fov; //spotlight
int refresh;
float dist;
struct dlight_s *next;
} dlight_t;
@ -343,7 +338,7 @@ typedef struct
float lastarbiatarypackettime; //used to mark when packets were sent to prevent mvdsv servers from causing us to disconnect.
// private userinfo for sending to masterless servers
char userinfo[MAX_INFO_STRING];
char userinfo[EXTENDED_INFO_STRING];
char servername[MAX_OSPATH]; // name of server from original connect
@ -390,7 +385,6 @@ typedef struct
qboolean allow_skyboxes;
qboolean allow_mirrors;
qboolean allow_watervis;
qboolean allow_shaders;
qboolean allow_luma;
qboolean allow_bump;
float allow_fbskins; //fraction of allowance
@ -404,6 +398,7 @@ typedef struct
#ifdef PROTOCOLEXTENSIONS
unsigned long fteprotocolextensions;
unsigned long fteprotocolextensions2;
#endif
unsigned long z_ext;
#ifdef NQPROT
@ -699,6 +694,7 @@ extern cvar_t ruleset_allow_larger_models;
extern cvar_t ruleset_allow_modified_eyes;
extern cvar_t ruleset_allow_sensative_texture_replacements;
extern cvar_t ruleset_allow_localvolume;
extern cvar_t ruleset_allow_shaders;
#define MAX_STATIC_ENTITIES 256 // torches, etc
@ -710,9 +706,10 @@ extern efrag_t cl_efrags[MAX_EFRAGS];
extern entity_t cl_static_entities[MAX_STATIC_ENTITIES];
extern trailstate_t *cl_static_emit[MAX_STATIC_ENTITIES];
extern lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
extern dlight_t cl_dlights[MAX_DLIGHTS];
extern dlight_t *cl_dlights;
extern unsigned int cl_maxdlights;
extern int dlights_running, dlights_software;
extern int rtlights_first, rtlights_max;
extern int cl_baselines_count;
extern qboolean nomaster;
@ -724,10 +721,14 @@ extern float server_version; // version of server we connected to
//
// cl_main
//
void CL_InitDlights(void);
dlight_t *CL_AllocDlight (int key);
dlight_t *CL_NewDlight (int key, float x, float y, float z, float radius, float time, int type);
dlight_t *CL_NewDlightRGB (int key, float x, float y, float z, float radius, float time, float r, float g, float b);
dlight_t *CL_AllocSlight (void); //allocates a static light
dlight_t *CL_NewDlight (int key, const vec3_t origin, float radius, float time, int type);
dlight_t *CL_NewDlightRGB (int key, const vec3_t origin, float radius, float time, float r, float g, float b);
dlight_t *CL_NewDlightCube (int key, const vec3_t origin, vec3_t angles, float radius, float time, vec3_t colours);
void CL_DecayLights (void);
void CL_ParseDelta (struct entity_state_s *from, struct entity_state_s *to, int bits, qboolean);
void CL_Init (void);
@ -752,12 +753,33 @@ void CL_SetInfo (char *key, char *value);
void CL_BeginServerConnect(void);
void CLNQ_BeginServerConnect(void);
char *CL_TryingToConnect(void);
#define MAX_VISEDICTS 1024
extern int cl_numvisedicts, cl_oldnumvisedicts;
extern entity_t *cl_visedicts, *cl_oldvisedicts;
extern entity_t cl_visedicts_list[2][MAX_VISEDICTS];
/*these are for q3 really*/
typedef struct {
struct shader_s *shader;
int firstvert;
int firstidx;
int numvert;
int numidx;
} scenetris_t;
extern scenetris_t *cl_stris;
extern vecV_t *cl_strisvertv;
extern vec4_t *cl_strisvertc;
extern vec2_t *cl_strisvertt;
extern index_t *cl_strisidx;
extern unsigned int cl_numstrisidx;
extern unsigned int cl_maxstrisidx;
extern unsigned int cl_numstrisvert;
extern unsigned int cl_maxstrisvert;
extern unsigned int cl_numstris;
extern unsigned int cl_maxstris;
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];
qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);
@ -810,7 +832,7 @@ char *Key_GetBinding(int keynum);
void CL_UseIndepPhysics(qboolean allow);
void CL_FlushClientCommands(void);
void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...);
void VARGS CL_SendClientCommand(qboolean reliable, char *format, ...) LIKEPRINTF(2);
int CL_RemoveClientCommands(char *command);
void CL_AllowIndependantSendCmd(qboolean allow);
@ -822,6 +844,7 @@ void CL_DrawPrydonCursor(void);
void CL_StopPlayback (void);
qboolean CL_GetMessage (void);
void CL_WriteDemoCmd (usercmd_t *pcmd);
void CL_Demo_ClientCommand(char *commandtext); //for QTV.
void CL_Stop_f (void);
void CL_Record_f (void);
@ -865,25 +888,31 @@ void CL_ParseQTVFile(vfsfile_t *f, const char *fname, qtvfile_t *result);
#define NET_TIMINGSMASK 255
extern int packet_latency[NET_TIMINGS];
int CL_CalcNet (void);
void CL_ParseServerMessage (void);
void CL_ClearParseState(void);
void CL_DumpPacket(void);
void CL_ParseEstablished(void);
void CL_ParseServerMessage (void);
void CLNQ_ParseServerMessage (void);
#ifdef Q2CLIENT
void CLQ2_ParseServerMessage (void);
#endif
void CL_NewTranslation (int slot);
qboolean CL_CheckOrEnqueDownloadFile (char *filename, char *localname, unsigned int flags);
qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags);
downloadlist_t *CL_DownloadFailed(char *name);
int CL_DownloadRate(void);
void CL_GetDownloadSizes(unsigned int *filecount, unsigned int *totalsize, qboolean *somesizesunknown);
qboolean CL_ParseOOBDownload(void);
void CL_DownloadFinished(void);
void CL_RequestNextDownload (void);
void CL_SendDownloadReq(sizebuf_t *msg);
qboolean CL_IsUploading(void);
void CL_NextUpload(void);
void CL_StartUpload (qbyte *data, int size);
void CL_StopUpload(void);
void CL_RequestNextDownload (void);
void CL_SendDownloadReq(sizebuf_t *msg);
qboolean CL_CheckBaselines (int size);
//
@ -946,7 +975,7 @@ qboolean CL_MayLerp(void);
//clq3_parse.c
//
#ifdef Q3CLIENT
void VARGS CLQ3_SendClientCommand(const char *fmt, ...);
void VARGS CLQ3_SendClientCommand(const char *fmt, ...) LIKEPRINTF(1);
void CLQ3_SendAuthPacket(netadr_t gameserver);
void CLQ3_SendConnectPacket(netadr_t to);
void CLQ3_SendCmd(usercmd_t *cmd);
@ -971,6 +1000,8 @@ qboolean CSQC_DrawView(void);
void CSQC_Shutdown(void);
qboolean CSQC_StuffCmd(int lplayernum, char *cmd);
qboolean CSQC_LoadResource(char *resname, char *restype);
qboolean CSQC_ParsePrint(char *message, int printlevel);
qboolean CSQC_ParseGamePacket(void);
qboolean CSQC_CenterPrint(int lplayernum, char *cmd);
void CSQC_Input_Frame(int lplayernum, usercmd_t *cmd);
void CSQC_WorldLoaded(void);
@ -1015,6 +1046,7 @@ void Cam_Lock(int pnum, int playernum);
void Cam_SelfTrack(int pnum);
void Cam_Track(int pnum, usercmd_t *cmd);
void Cam_TrackCrosshairedPlayer(int pnum);
void Cam_SetAutoTrack(int userid);
void Cam_FinishMove(int pnum, usercmd_t *cmd);
void Cam_Reset(void);
void Cam_TrackPlayer(int pnum, char *cmdname, char *plrarg);
@ -1047,6 +1079,7 @@ char* TP_LocationName (vec3_t location);
char* TP_MapName (void);
void TP_NewMap (void);
void TP_ParsePlayerInfo(player_state_t *oldstate, player_state_t *state, player_info_t *info);
qboolean TP_IsPlayerVisible(vec3_t origin);
char* TP_PlayerName (void);
char* TP_PlayerTeam (void);
void TP_SearchForMsgTriggers (char *s, int level);
@ -1054,6 +1087,7 @@ qboolean TP_SoundTrigger(char *message);
void TP_StatChanged (int stat, int value);
qboolean TP_SuppressMessage(char *buf);
colourised_t *TP_FindColours(char *name);
void TP_UpdateAutoStatus(void);
//
// skin.c
@ -1117,15 +1151,17 @@ void CLQ2_AddEntities (void);
void CLQ2_ParseBaseline (void);
void CLQ2_ParseFrame (void);
void CLQ2_RunMuzzleFlash2 (int ent, int flash_number);
void CLNQ_ParseEntity(unsigned int bits);
int CLQ2_RegisterTEntModels (void);
#endif
#ifdef NQPROT
void CLNQ_ParseEntity(unsigned int bits);
void NQ_P_ParseParticleEffect (void);
void CLNQ_SignonReply (void);
void NQ_BeginConnect(char *to);
void NQ_ContinueConnect(char *to);
int CLNQ_GetMessage (void);
#endif
void CL_BeginServerReconnect(void);
@ -1159,7 +1195,7 @@ 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);
texid_t Media_UpdateForShader(cin_t *cin);
void Media_ShutdownCin(cin_t *cin);
//these accept NULL for cin to mean the current fullscreen video
@ -1179,7 +1215,7 @@ int Stats_GetTouches(int playernum);
int Stats_GetCaptures(int playernum);
qboolean Stats_HaveFlags(void);
qboolean Stats_HaveKills(void);
void VARGS Stats_Message(char *msg, ...);
void VARGS Stats_Message(char *msg, ...) LIKEPRINTF(1);
int qm_strcmp(char *s1, char *s2);
int qm_stricmp(char *s1, char *s2);
void Stats_ParsePrintLine(char *line);

View File

@ -1511,7 +1511,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
AngleVectors (ent.angles, forward, NULL, NULL);
VectorMA (ent.origin, 64, forward, start);
V_AddLight (start, 100, 0.2, 0, 0);
V_AddLight (ent.keynum, start, 100, 0.2, 0, 0);
}
}
else
@ -1535,13 +1535,13 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
// ent.flags |= Q2RF_EXTERNALMODEL; // only draw from mirrors
if (effects & Q2EF_FLAG1)
V_AddLight (ent.origin, 225, 0.2, 0.05, 0.05);
V_AddLight (ent.keynum, ent.origin, 225, 0.2, 0.05, 0.05);
else if (effects & Q2EF_FLAG2)
V_AddLight (ent.origin, 225, 0.05, 0.05, 0.2);
V_AddLight (ent.keynum, ent.origin, 225, 0.05, 0.05, 0.2);
else if (effects & Q2EF_TAGTRAIL) //PGM
V_AddLight (ent.origin, 225, 0.2, 0.2, 0.0); //PGM
V_AddLight (ent.keynum, ent.origin, 225, 0.2, 0.2, 0.0); //PGM
else if (effects & Q2EF_TRACKERTRAIL) //PGM
V_AddLight (ent.origin, 225, -0.2, -0.2, -0.2); //PGM
V_AddLight (ent.keynum, ent.origin, 225, -0.2, -0.2, -0.2); //PGM
}
// if set to invisible, skip
@ -1623,18 +1623,11 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
ent.shaderRGBAf[0] = (!!(renderfx & Q2RF_SHELL_RED));
ent.shaderRGBAf[1] = (!!(renderfx & Q2RF_SHELL_GREEN));
ent.shaderRGBAf[2] = (!!(renderfx & Q2RF_SHELL_BLUE));
#ifdef Q3SHADERS //fixme: do better.
//fixme: this is woefully gl specific. :(
if (qrenderer == QR_OPENGL)
{
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell, NULL);
}
#endif
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell, NULL);
VQ2_AddLerpEntity (&ent);
}
#ifdef Q3SHADERS
ent.forcedshader = NULL;
#endif
// ent.skin = NULL; // never use a custom skin on others
ent.skinnum = 0;
@ -1723,7 +1716,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rt_rocket, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xdc, 4, &cent->trailstate);
V_AddLight (ent.origin, 200, 0.2, 0.2, 0);
V_AddLight (ent.keynum, ent.origin, 200, 0.2, 0.2, 0);
}
// PGM - Do not reorder EF_BLASTER and EF_HYPERBLASTER.
// EF_BLASTER | EF_TRACKER is a special case for EF_BLASTER2... Cheese!
@ -1733,22 +1726,22 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
if (effects & Q2EF_TRACKER) // lame... problematic?
{
CLQ2_BlasterTrail2 (cent->lerp_origin, ent.origin);
V_AddLight (ent.origin, 200, 0, 0.2, 0);
V_AddLight (ent.keynum, ent.origin, 200, 0, 0.2, 0);
}
else
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_blastertrail, &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0xe0, 1, &cent->trailstate);
V_AddLight (ent.origin, 200, 0.2, 0.2, 0);
V_AddLight (ent.keynum, ent.origin, 200, 0.2, 0.2, 0);
}
//PGM
}
else if (effects & Q2EF_HYPERBLASTER)
{
if (effects & Q2EF_TRACKER) // PGM overloaded for blaster2.
V_AddLight (ent.origin, 200, 0, 0.2, 0); // PGM
V_AddLight (ent.keynum, ent.origin, 200, 0, 0.2, 0); // PGM
else // PGM
V_AddLight (ent.origin, 200, 0.2, 0.2, 0);
V_AddLight (ent.keynum, ent.origin, 200, 0.2, 0.2, 0);
}
else if (effects & Q2EF_GIB)
{
@ -1779,7 +1772,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
i = bfg_lightramp[s1->frame];
}
V_AddLight (ent.origin, i, 0, 0.2, 0);
V_AddLight (ent.keynum, ent.origin, i, 0, 0.2, 0);
}
// RAFAEL
else if (effects & Q2EF_TRAP)
@ -1787,19 +1780,19 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
ent.origin[2] += 32;
CLQ2_TrapParticles (&ent);
i = (rand()%100) + 100;
V_AddLight (ent.origin, i, 0.2, 0.16, 0.05);
V_AddLight (ent.keynum, ent.origin, i, 0.2, 0.16, 0.05);
}
else if (effects & Q2EF_FLAG1)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, P_FindParticleType("ef_flag1"), &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 242, 1, &cent->trailstate);
V_AddLight (ent.origin, 225, 0.2, 0.05, 0.05);
V_AddLight (ent.keynum, ent.origin, 225, 0.2, 0.05, 0.05);
}
else if (effects & Q2EF_FLAG2)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, P_FindParticleType("ef_flag2"), &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 115, 1, &cent->trailstate);
V_AddLight (ent.origin, 225, 0.05, 0.05, 0.2);
V_AddLight (ent.keynum, ent.origin, 225, 0.05, 0.05, 0.2);
}
//======
//ROGUE
@ -1807,7 +1800,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, P_FindParticleType("ef_tagtrail"), &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 220, 1, &cent->trailstate);
V_AddLight (ent.origin, 225, 0.2, 0.2, 0.0);
V_AddLight (ent.keynum, ent.origin, 225, 0.2, 0.2, 0.0);
}
else if (effects & Q2EF_TRACKERTRAIL)
{
@ -1818,19 +1811,19 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
intensity = 50 + (500 * (sin(cl.time/500.0) + 1.0));
// FIXME - check out this effect in rendition
V_AddLight (ent.origin, intensity, -0.2, -0.2, -0.2);
V_AddLight (ent.keynum, ent.origin, intensity, -0.2, -0.2, -0.2);
}
else
{
CLQ2_Tracker_Shell (cent->lerp_origin);
V_AddLight (ent.origin, 155, -0.2, -0.2, -0.2);
V_AddLight (ent.keynum, ent.origin, 155, -0.2, -0.2, -0.2);
}
}
else if (effects & Q2EF_TRACKER)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, P_FindParticleType("ef_tracker"), &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 0, 1, &cent->trailstate);
V_AddLight (ent.origin, 200, -0.2, -0.2, -0.2);
V_AddLight (ent.keynum, ent.origin, 200, -0.2, -0.2, -0.2);
}
//ROGUE
//======
@ -1845,12 +1838,12 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
if (P_ParticleTrail(cent->lerp_origin, ent.origin, P_FindParticleType("ef_ionripper"), &cent->trailstate))
P_ParticleTrailIndex(cent->lerp_origin, ent.origin, 228, 4, &cent->trailstate);
V_AddLight (ent.origin, 100, 0.2, 0.1, 0.1);
V_AddLight (ent.keynum, ent.origin, 100, 0.2, 0.1, 0.1);
}
// RAFAEL
else if (effects & Q2EF_BLUEHYPERBLASTER)
{
V_AddLight (ent.origin, 200, 0, 0, 0.2);
V_AddLight (ent.keynum, ent.origin, 200, 0, 0, 0.2);
}
// RAFAEL
else if (effects & Q2EF_PLASMA)
@ -1859,7 +1852,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
{
P_ParticleTrail(cent->lerp_origin, ent.origin, rtq2_blastertrail, &cent->trailstate);
}
V_AddLight (ent.origin, 130, 0.2, 0.1, 0.1);
V_AddLight (ent.keynum, ent.origin, 130, 0.2, 0.1, 0.1);
}
}
@ -2056,6 +2049,9 @@ void CLQ2_AddEntities (void)
cl_visedicts = cl_visedicts_list[cls.netchan.incoming_sequence&1];
cl_numvisedicts = 0;
cl_numstrisidx = 0;
cl_numstrisvert = 0;
cl_numstris = 0;
if (cl.time*1000 > cl.q2frame.servertime)
{

View File

@ -559,11 +559,6 @@ void CLQ3_ParseGameState(void)
Host_EndGame("CLQ3_ParseGameState: configString index %i out of range", index);
}
configString = MSG_ReadString();
if (index == CFGSTR_SYSINFO)
{
//check some things.
cl.servercount = atoi(Info_ValueForKey(configString, "sv_serverid"));
}
CG_InsertIntoGameState(index, configString);
break;

View File

@ -321,4 +321,14 @@ void MSG_Q3_ReadDeltaUsercmd(int key, const usercmd_t *from, usercmd_t *to);
void MSG_WriteBits(sizebuf_t *msg, int value, int bits);
typedef struct q3refEntity_s q3refEntity_t;
void VQ3_AddEntity(const q3refEntity_t *q3);
typedef struct q3polyvert_s q3polyvert_t;
void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts);
typedef struct q3refdef_s q3refdef_t;
void VQ3_RenderView(const q3refdef_t *ref);
#endif

View File

@ -24,29 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
console_t con_main;
console_t *con_current; // point to either con_main
#ifdef AVAIL_FREETYPE
extern struct font_s *conchar_font;
int GLFont_DrawChar(struct font_s *font, int px, int py, unsigned int charcode);
void GLFont_BeginString(struct font_s *font, int vx, int vy, int *px, int *py);
//void GLFont_EndString(struct font_s *font);
#define GLFont_EndString(f)
#define Font_ScreenWidth() (vid.pixelwidth)
#define Font_DrawChar(x,y,c) (conchar_font?GLFont_DrawChar(conchar_font, x, y, c):(Draw_ColouredCharacter(x, y, c),(x)+8))
#define Font_CharWidth(c) (conchar_font?GLFont_CharWidth(conchar_font, c):8)
#define Font_CharHeight() (conchar_font?GLFont_CharHeight(conchar_font):8)
#define Font_ScreenWidth() (conchar_font?glwidth:vid.width)
extern int glwidth;
#else
#define GLFont_BeginString(f, vx, vy, px, py) *px = vx; *py = vy;
#define GLFont_EndString(f)
#define Font_DrawChar(x,y,c) (Draw_ColouredCharacter(x, y, c),(x)+8)
#define Font_CharWidth(c) 8
#define Font_CharHeight() 8
#define Font_ScreenWidth() vid.width
#endif
static int Con_LineBreaks(conchar_t *start, conchar_t *end, int scrwidth, int maxlines, conchar_t **starts, conchar_t **ends);
static int Con_DrawProgress(int left, int right, int y);
#ifdef QTERM
@ -915,6 +894,8 @@ void Con_DrawNotify (void)
int maxlines;
float t;
Font_BeginString(font_conchar, x, y, &x, &y);
maxlines = con_numnotifylines.value;
if (maxlines < 0)
maxlines = 0;
@ -935,7 +916,7 @@ void Con_DrawNotify (void)
if (t > con_notifytime.value)
break;
line = Con_LineBreaks((conchar_t*)(l+1), (conchar_t*)(l+1)+l->length, Font_ScreenWidth(), lines, starts, ends);
line = Font_LineBreaks((conchar_t*)(l+1), (conchar_t*)(l+1)+l->length, Font_ScreenWidth(), lines, starts, ends);
if (!line && lines > 0)
{
lines--;
@ -983,7 +964,7 @@ void Con_DrawNotify (void)
int lines, i;
c = COM_ParseFunString(CON_WHITEMASK, va(chat_team?"say_team: %s":"say: %s", chat_buffer), markup, sizeof(markup), true);
*c++ = (0xe00a+((int)(realtime*con_cursorspeed)&1))|CON_WHITEMASK;
lines = Con_LineBreaks(markup, c, Font_ScreenWidth(), 8, starts, ends);
lines = Font_LineBreaks(markup, c, Font_ScreenWidth(), 8, starts, ends);
for (i = 0; i < lines; i++)
{
c = starts[i];
@ -998,6 +979,8 @@ void Con_DrawNotify (void)
if (y > con_notifylines)
con_notifylines = y;
Font_EndString(font_conchar);
}
//send all the stuff that was con_printed to sys_print.
@ -1018,53 +1001,6 @@ void Con_PrintToSys(void)
}
}
static int Con_LineBreaks(conchar_t *start, conchar_t *end, int scrwidth, int maxlines, conchar_t **starts, conchar_t **ends)
{
int l, bt;
int px;
int foundlines = 0;
while (start < end)
{
// scan the width of the line
for (px=0, l=0 ; px <= scrwidth;)
{
if (start+l >= end || (start[l]&CON_CHARMASK) == '\n')
break;
l++;
px += Font_CharWidth(start[l]);
}
//if we did get to the end
if (px > scrwidth)
{
bt = l;
//backtrack until we find a space
while(l > 0 && (start[l-1]&CON_CHARMASK)>' ')
{
l--;
}
if (l == 0 && bt>0)
l = bt-1;
px -= Font_CharWidth(start[l]);
}
starts[foundlines] = start;
ends[foundlines] = start+l;
foundlines++;
if (foundlines == maxlines)
break;
start+=l;
// for (l=0 ; l<40 && *start && *start != '\n'; l++)
// start++;
if ((*start&CON_CHARMASK) == '\n'||!l)
start++; // skip the \n
}
return foundlines;
}
//returns the bottom of the progress bar
static int Con_DrawProgress(int left, int right, int y)
{
@ -1253,7 +1189,7 @@ void Con_DrawConsole (int lines, qboolean noback)
int top;
conchar_t *starts[64], *ends[sizeof(starts)/sizeof(starts[0])];
int i;
extern int glwidth;
qboolean haveprogress;
if (lines <= 0)
return;
@ -1276,20 +1212,15 @@ void Con_DrawConsole (int lines, qboolean noback)
selactive = Key_GetConsoleSelectionBox(&selsx, &selsy, &selex, &seley);
#ifdef AVAIL_FREETYPE
if (conchar_font)
{
GLFont_BeginString(conchar_font, x, y, &x, &y);
GLFont_BeginString(conchar_font, selsx, selsy, &selsx, &selsy);
GLFont_BeginString(conchar_font, selex, seley, &selex, &seley);
}
#endif
Font_BeginString(font_conchar, x, y, &x, &y);
Font_BeginString(font_conchar, selsx, selsy, &selsx, &selsy);
Font_BeginString(font_conchar, selex, seley, &selex, &seley);
ex = Font_ScreenWidth();
sx = x;
ex -= sx;
y -= Font_CharHeight();
Con_DrawProgress(x, ex - x, y);
haveprogress = Con_DrawProgress(x, ex - x, y) != y;
y -= Font_CharHeight();
Con_DrawInput (x, ex - x, y);
@ -1358,7 +1289,7 @@ void Con_DrawConsole (int lines, qboolean noback)
{
s = (conchar_t*)(l+1);
linecount = Con_LineBreaks(s, s+l->length, ex-sx, sizeof(starts)/sizeof(starts[0]), starts, ends);
linecount = Font_LineBreaks(s, s+l->length, ex-sx, sizeof(starts)/sizeof(starts[0]), starts, ends);
//if Con_LineBreaks didn't find any lines at all, then it was an empty line, and we need to ensure that its still drawn
if (linecount == 0)
@ -1386,7 +1317,9 @@ void Con_DrawConsole (int lines, qboolean noback)
int sstart;
int send;
sstart = sx;
send = sstart+linelength*8;
send = sstart;
for (i = 0; i < linelength; i++)
send += Font_CharWidth(s[i]);
//show something on blank lines
if (send == sstart)
@ -1426,7 +1359,7 @@ void Con_DrawConsole (int lines, qboolean noback)
selstartoffset = 0;
}
Draw_Fill(sstart, y, send - sstart, Font_CharHeight(), 0);
Draw_Fill((sstart*vid.width)/vid.pixelwidth, (y*vid.height)/vid.pixelheight, ((send - sstart)*vid.width)/vid.pixelwidth, (Font_CharHeight()*vid.height)/vid.pixelheight, 0);
}
}
}
@ -1444,10 +1377,22 @@ void Con_DrawConsole (int lines, qboolean noback)
break;
}
GLFont_EndString(conchar_font);
if (!haveprogress && lines == vid.height)
{
char *version = va(DISTRIBUTION " Quake %i", build_number());
int i;
Font_BeginString(font_conchar, vid.width, lines, &x, &y);
y -= Font_CharHeight();
for (i = 0; version[i]; i++)
x -= Font_CharWidth(version[i] | CON_WHITEMASK|CON_HALFALPHA);
for (i = 0; version[i]; i++)
x = Font_DrawChar(x, y, version[i] | CON_WHITEMASK|CON_HALFALPHA);
}
Font_EndString(font_conchar);
// draw the input prompt, user text, and cursor if desired
DrawCursor();
SCR_DrawCursor(0);
}

View File

@ -216,7 +216,7 @@ void Stats_Evaluate(fragfilemsgtypes_t mt, int wid, int p1, int p2)
{
fragstats.weapontotals[wid].owndeaths++;
Stats_Message("%s killed you\n", cl.players[p2].name);
Stats_Message("%s deaths: %i (%i/%i)\n", fragstats.weapontotals[wid].fullname, fragstats.clienttotals[p2].kills, fragstats.weapontotals[wid].kills);
Stats_Message("%s deaths: %i (%i/%i)\n", fragstats.weapontotals[wid].fullname, fragstats.clienttotals[p2].owndeaths, fragstats.weapontotals[wid].owndeaths, fragstats.totaldeaths);
}
fragstats.clienttotals[p2].kills++;
@ -225,7 +225,7 @@ void Stats_Evaluate(fragfilemsgtypes_t mt, int wid, int p1, int p2)
{
fragstats.weapontotals[wid].ownkills++;
Stats_Message("You killed %s\n", cl.players[p1].name);
Stats_Message("%s kills: %i (%i/%i)\n", fragstats.weapontotals[wid].fullname, fragstats.clienttotals[p2].kills, fragstats.weapontotals[wid].kills);
Stats_Message("%s kills: %i (%i/%i)\n", fragstats.weapontotals[wid].fullname, fragstats.clienttotals[p2].kills, fragstats.weapontotals[wid].kills, fragstats.totalkills);
}
break;
case ff_tkdeath:

View File

@ -1,10 +1,10 @@
#include "quakedef.h"
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"
#endif
#ifdef D3DQUAKE
#include "d3dquake.h"
//#include "d3dquake.h"
#endif
cvar_t r_dodgytgafiles = SCVAR("r_dodgytgafiles", "0"); //Certain tgas are upside down.
@ -545,15 +545,17 @@ return NULL;
#ifndef PNG_SUCKS_WITH_SETJMP
#if defined(MINGW)
#include "./mingw-libs/png.h"
#pragma comment(lib, "../libs/libpng.a")
#elif defined(_WIN32)
#include "png.h"
#pragma comment(lib, "../libs/libpng.lib")
#else
#include <png.h>
#endif
#endif
#ifdef _MSC_VER
#pragma comment(lib, MSVCLIBSPATH "libpng.lib")
#endif
#if defined(MINGW) //hehehe... add annother symbol so the statically linked cygwin libpng can link
#undef setjmp
@ -761,18 +763,20 @@ int Image_WritePNG (char *filename, int compression, qbyte *pixels, int width, i
#define JPEG_API VARGS
#include "./mingw-libs/jpeglib.h"
#include "./mingw-libs/jerror.h"
#pragma comment(lib, "../libs/jpeg.a")
#elif defined(_WIN32)
#define JPEG_API VARGS
#include "jpeglib.h"
#include "jerror.h"
#pragma comment(lib, "../libs/jpeg.lib")
#else
// #include <jinclude.h>
#include <jpeglib.h>
#include <jerror.h>
#endif
#ifdef _MSC_VER
#pragma comment(lib, MSVCLIBSPATH "jpeg.lib")
#endif
#ifndef JPEG_FALSE
#define JPEG_BOOL boolean
#endif
@ -1761,7 +1765,7 @@ void SaturateR8G8B8(qbyte *data, int size, float sat)
void BoostGamma(qbyte *rgba, int width, int height)
{
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
int i;
extern qbyte gammatable[256];
@ -1784,7 +1788,7 @@ void BoostGamma(qbyte *rgba, int width, int height)
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
#ifdef DDS
#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
@ -1817,11 +1821,11 @@ typedef struct {
} ddsheader;
int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
texid_t GL_LoadTextureDDS(unsigned char *buffer, int filesize)
{
extern int gl_filter_min;
extern int gl_filter_max;
int texnum;
texid_t texnum;
int nummips;
int mipnum;
int datasize;
@ -1831,12 +1835,12 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
ddsheader fmtheader;
if (*(int*)buffer != *(int*)"DDS ")
return 0;
return r_nulltex;
buffer+=4;
memcpy(&fmtheader, buffer, sizeof(fmtheader));
if (fmtheader.dwSize != sizeof(fmtheader))
return 0; //corrupt/different version
return r_nulltex; //corrupt/different version
buffer += fmtheader.dwSize;
@ -1860,10 +1864,10 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
pad = 8;
}
else
return 0;
return r_nulltex;
if (!qglCompressedTexImage2DARB)
return 0;
return r_nulltex;
texnum = GL_AllocNewTexture();
GL_Bind(texnum);
@ -1892,13 +1896,13 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
if (nummips>1)
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
else
{
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
return texnum;
@ -1950,15 +1954,16 @@ qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height, char *fn
int image_width, image_height;
qbyte *COM_LoadFile (char *path, int usehunk);
//fixme: should probably get rid of the 'Mod' prefix, and use something more suitable.
int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean colouradjust)
texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags)
{
qboolean alphaed;
char *buf, *data;
int len;
texid_t tex;
// int h;
char fname[MAX_QPATH], nicename[MAX_QPATH];
static char *extensions[] = {//reverse order of preference - (match commas with optional file types)
static char *extensions[] =
{//reverse order of preference - (match commas with optional file types)
".pcx", //pcxes are the original gamedata of q2. So we don't want them to override pngs.
#ifdef AVAIL_JPEGLIB
".jpg",
@ -1971,9 +1976,12 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
""
};
static char *path[] ={
static char *path[] =
{
/*if three args, first is the subpath*/
/*the last two args are texturename then extension*/
"2%s%s",
"3textures/%s/%s%s", //this is special... It uses the subpath parameter. Note references to (i == 1)
"3textures/%s/%s%s",
"3%s/%s%s",
"2textures/%s%s",
"2override/%s%s"
@ -1981,6 +1989,9 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
int i, e;
image_width = 0;
image_height = 0;
COM_StripAllExtensions(name, nicename, sizeof(nicename));
while((data = strchr(nicename, '*')))
@ -1988,17 +1999,20 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
*data = '#';
}
if ((len = R_FindTexture(name))!=-1) //don't bother if it already exists.
return len;
tex = R_FindTexture(name);
if (TEXVALID(tex)) //don't bother if it already exists.
return tex;
if (subpath && *subpath)
{
snprintf(fname, sizeof(fname)-1, "%s/%s", subpath, name);
if ((len = R_FindTexture(fname))!=-1) //don't bother if it already exists.
return len;
tex = R_FindTexture(fname);
if (TEXVALID(tex)) //don't bother if it already exists.
return tex;
}
if ((len = R_LoadCompressed(name)))
return len;
tex = R_LoadCompressed(name);
if (TEXVALID(tex))
return tex;
if (strchr(name, '/')) //never look in a root dir for the pic
i = 0;
@ -2019,10 +2033,10 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
snprintf(fname, sizeof(fname)-1, path[i]+1, nicename, ".dds");
if ((buf = COM_LoadFile (fname, 5)))
{
len = GL_LoadTextureDDS(buf, com_filesize);
tex = GL_LoadTextureDDS(buf, com_filesize);
BZ_Free(buf);
if (len)
return len;
if (TEXVALID(tex))
return tex;
}
#endif
@ -2042,22 +2056,22 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
if ((data = Read32BitImageFile(buf, com_filesize, &image_width, &image_height, fname)))
{
extern cvar_t vid_hardwaregamma;
if (colouradjust && !vid_hardwaregamma.value)
if (!(flags&IF_NOGAMMA) && !vid_hardwaregamma.value)
BoostGamma(data, image_width, image_height);
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);
len = R_LoadTexture32 (fname, image_width, image_height, (unsigned*)data, mipmap, alpha);
tex = R_LoadTexture32 (fname, image_width, image_height, data, flags);
}
else
len = R_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alpha);
tex = R_LoadTexture32 (name, image_width, image_height, data, flags);
BZ_Free(data);
BZ_Free(buf);
return len;
return tex;
}
else
{
@ -2068,33 +2082,54 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
}
}
/*still failed? attempt to load quake lmp files, which have no real format id*/
snprintf(fname, sizeof(fname)-1, "%s%s", nicename, ".lmp");
if ((buf = COM_LoadFile (fname, 5)))
{
extern cvar_t vid_hardwaregamma;
tex = r_nulltex;
if (com_filesize >= 8)
{
image_width = LittleLong(((int*)buf)[0]);
image_height = LittleLong(((int*)buf)[1]);
if (image_width*image_height+8 == com_filesize)
{
tex = R_LoadTexture8(name, image_width, image_height, buf+8, flags, 1);
}
}
BZ_Free(buf);
return tex;
}
//now look in wad files. (halflife compatability)
data = W_GetTexture(name, &image_width, &image_height, &alphaed);
if (data)
return R_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alphaed);
return 0;
return R_LoadTexture32 (name, image_width, image_height, (unsigned*)data, flags);
return r_nulltex;
}
int Mod_LoadReplacementTexture(char *name, char *subpath, qboolean mipmap, qboolean alpha, qboolean gammaadjust)
texid_t R_LoadReplacementTexture(char *name, char *subpath, unsigned int flags)
{
if (!gl_load24bit.value)
return 0;
return Mod_LoadHiResTexture(name, subpath, mipmap, alpha, gammaadjust);
return r_nulltex;
return R_LoadHiResTexture(name, subpath, flags);
}
extern cvar_t r_shadow_bumpscale_bumpmap;
int Mod_LoadBumpmapTexture(char *name, char *subpath)
texid_t R_LoadBumpmapTexture(char *name, char *subpath)
{
char *buf, *data;
int len;
texid_t tex;
// int h;
char fname[MAX_QPATH], nicename[MAX_QPATH];
static char *extensions[] = {//reverse order of preference - (match commas with optional file types)
static char *extensions[] =
{//reverse order of preference - (match commas with optional file types)
".tga",
""
};
static char *path[] ={
static char *path[] =
{
"%s%s",
"textures/%s/%s%s", //this is special... It's special name is Mr Ben Ian Graham Hacksworth.
"textures/%s%s",
@ -2107,11 +2142,13 @@ int Mod_LoadBumpmapTexture(char *name, char *subpath)
COM_StripExtension(name, nicename, sizeof(nicename));
if ((len = R_FindTexture(name))!=-1) //don't bother if it already exists.
return len;
tex = R_FindTexture(name);
if (TEXVALID(tex)) //don't bother if it already exists.
return tex;
if ((len = R_LoadCompressed(name)))
return len;
tex = R_LoadCompressed(name);
if (TEXVALID(tex))
return tex;
if (strchr(name, '/')) //never look in a root dir for the pic
i = 0;
@ -2144,7 +2181,7 @@ int Mod_LoadBumpmapTexture(char *name, char *subpath)
if ((data = ReadTargaFile(buf, com_filesize, &image_width, &image_height, 2))) //Only load a greyscale image.
{
TRACE(("dbg: Mod_LoadBumpmapTexture: tga %s loaded\n", name));
len = R_LoadTexture8Bump(name, image_width, image_height, data, true, r_shadow_bumpscale_bumpmap.value);
tex = R_LoadTexture8Bump(name, image_width, image_height, data, IF_NOALPHA|IF_NOGAMMA);
BZ_Free(data);
}
else
@ -2155,11 +2192,11 @@ int Mod_LoadBumpmapTexture(char *name, char *subpath)
BZ_Free(buf);
return len;
return tex;
}
}
}
return 0;
return r_nulltex;
}
#endif

View File

@ -32,9 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef AVAIL_DINPUT
#ifdef _MSC_VER
#pragma comment (lib, "dxguid.lib")
#else
#ifndef _MSC_VER
#define DIRECTINPUT_VERSION 0x0500
#endif
@ -173,6 +171,14 @@ DWORD joy_flags;
DWORD joy_numbuttons;
#ifdef AVAIL_DINPUT
static const GUID fGUID_XAxis = {0xA36D02E0, 0xC9F3, 0x11CF, {0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
static const GUID fGUID_YAxis = {0xA36D02E1, 0xC9F3, 0x11CF, {0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
static const GUID fGUID_ZAxis = {0xA36D02E2, 0xC9F3, 0x11CF, {0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
static const GUID fGUID_SysMouse = {0x6F1D2B60, 0xD5A0, 0x11CF, {0xBF, 0xC7, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
static const GUID fIID_IDirectInputDevice7A = {0x57d7c6bc, 0x2356, 0x11d3, {0x8e, 0x9d, 0x00, 0xC0, 0x4f, 0x68, 0x44, 0xae}};
static const GUID fIID_IDirectInput7A = {0x9a4cb684, 0x236d, 0x11d3, {0x8e, 0x9d, 0x00, 0xc0, 0x4f, 0x68, 0x44, 0xae}};
// devices
LPDIRECTINPUT g_pdi;
LPDIRECTINPUTDEVICE g_pMouse;
@ -199,9 +205,9 @@ typedef struct MYDATA {
} MYDATA;
static DIOBJECTDATAFORMAT rgodf[] = {
{ &GUID_XAxis, FIELD_OFFSET(MYDATA, lX), DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ &GUID_YAxis, FIELD_OFFSET(MYDATA, lY), DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ &GUID_ZAxis, FIELD_OFFSET(MYDATA, lZ), 0x80000000 | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ &fGUID_XAxis, FIELD_OFFSET(MYDATA, lX), DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ &fGUID_YAxis, FIELD_OFFSET(MYDATA, lY), DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ &fGUID_ZAxis, FIELD_OFFSET(MYDATA, lZ), 0x80000000 | DIDFT_AXIS | DIDFT_ANYINSTANCE, 0,},
{ 0, FIELD_OFFSET(MYDATA, bButtonA), DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0,},
{ 0, FIELD_OFFSET(MYDATA, bButtonB), DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0,},
{ 0, FIELD_OFFSET(MYDATA, bButtonC), 0x80000000 | DIDFT_BUTTON | DIDFT_ANYINSTANCE, 0,},
@ -697,7 +703,7 @@ int IN_InitDInput (void)
if (pDirectInputCreateEx) // use DirectInput 7
{
// register with DirectInput and get an IDirectInput to play with.
hr = iDirectInputCreateEx(global_hInstance, DINPUT_VERSION_DX7, &IID_IDirectInput7, &g_pdi7, NULL);
hr = iDirectInputCreateEx(global_hInstance, DINPUT_VERSION_DX7, &fIID_IDirectInput7A, &g_pdi7, NULL);
if (FAILED(hr))
return 0;
@ -705,7 +711,7 @@ int IN_InitDInput (void)
IDirectInput7_EnumDevices(g_pdi7, 0, &IN_EnumerateDevices, NULL, DIEDFL_ATTACHEDONLY);
// obtain an interface to the system mouse device.
hr = IDirectInput7_CreateDeviceEx(g_pdi7, &GUID_SysMouse, &IID_IDirectInputDevice7, &g_pMouse7, NULL);
hr = IDirectInput7_CreateDeviceEx(g_pdi7, &fGUID_SysMouse, &fIID_IDirectInputDevice7A, &g_pMouse7, NULL);
if (FAILED(hr)) {
Con_SafePrintf ("Couldn't open DI7 mouse device\n");
@ -763,7 +769,7 @@ int IN_InitDInput (void)
IDirectInput_EnumDevices(g_pdi, 0, &IN_EnumerateDevices, NULL, DIEDFL_ATTACHEDONLY);
// obtain an interface to the system mouse device.
hr = IDirectInput_CreateDevice(g_pdi, &GUID_SysMouse, &g_pMouse, NULL);
hr = IDirectInput_CreateDevice(g_pdi, &fGUID_SysMouse, &g_pMouse, NULL);
if (FAILED(hr))
{
@ -1487,11 +1493,17 @@ static void ProcessMouse(mouse_t *mouse, float *movements, int pnum)
if (mousecursor_y >= vid.height)
mousecursor_y = vid.height - 1;
mx=my=0;
#ifdef VM_UI
UI_MousePosition(mousecursor_x, mousecursor_y);
#endif
}
#ifdef VM_UI
else
{
if (UI_MousePosition(mx, my))
{
mx = 0;
my = 0;
}
}
#endif
#ifdef PEXT_CSQC
if (CSQC_MouseMove(mx, my))
@ -1537,8 +1549,8 @@ static void ProcessMouse(mouse_t *mouse, float *movements, int pnum)
return;
}
if (cl.paused)
return;
// if (cl.paused)
// return;
// add mouse X/Y movement to cmd
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
@ -1577,9 +1589,6 @@ IN_MouseMove
*/
void IN_MouseMove (float *movements, int pnum)
{
#ifdef RGLQUAKE
extern int glwidth, glheight;
#endif
POINT current_pos;
extern int mousecursor_x, mousecursor_y;
@ -1591,16 +1600,12 @@ void IN_MouseMove (float *movements, int pnum)
mousecursor_x = current_pos.x-window_x;
mousecursor_y = current_pos.y-window_y;
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL) //2d res scaling.
{
mousecursor_x *= vid.width/(float)glwidth;
mousecursor_y *= vid.height/(float)glheight;
}
#endif
mousecursor_x *= vid.width/(float)vid.pixelwidth;
mousecursor_y *= vid.height/(float)vid.pixelheight;
#ifdef VM_UI
UI_MousePosition(mousecursor_x, mousecursor_y);
if (!Key_MouseShouldBeFree())
UI_MousePosition(mousecursor_x, mousecursor_y);
#endif
return;

View File

@ -182,7 +182,7 @@ void Key_WriteBindings (vfsfile_t *f);
void Key_SetBinding (int keynum, int modifier, char *binding, int cmdlevel);
void Key_ClearStates (void);
void Key_ConsoleDrawSelectionBox(void);
qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey);
#endif

View File

@ -267,31 +267,29 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct menu_s *m)
p = c->data;
if (p)
{
Draw_Character (x+4, y, 128);
Draw_Character (x+12, y, 130);
Draw_Character (x+24, y, 128);
Draw_Character (x+32, y, 130);
Draw_FunString (x+4, y, "^Ue080^Ue082");
Draw_FunString (x+24, y, "^Ue080^Ue082");
if (p->flags&DPF_WANTTOINSTALL)
Draw_Character (x+8, y, 131);
Draw_FunString (x+8, y, "^Ue083");
else
Draw_Character (x+8, y, 129);
Draw_FunString (x+8, y, "^Ue081");
//if you have it already
if (p->flags&(DPF_HAVEAVERSION | ((((int)(realtime*4))&1)?(DPF_DOWNLOADING|DPF_ENQUED):0) ))
Draw_Character (x+28, y, 131);
Draw_FunString (x+28, y, "^Ue083");
else
Draw_Character (x+28, y, 129);
Draw_FunString (x+28, y, "^Ue081");
if (&m->selecteditem->common == &c->common)
Draw_Alt_String (x+48, y, p->name);
Draw_AltFunString (x+48, y, p->name);
else
Draw_String(x+48, y, p->name);
Draw_FunString(x+48, y, p->name);
if (p->flags & DPF_DISPLAYVERSION)
{
Draw_String(x+48+strlen(p->name)*8, y, va(" (%i.%i)", p->version/1000, p->version%1000));
Draw_FunString(x+48+strlen(p->name)*8, y, va(" (%i.%i)", p->version/1000, p->version%1000));
}
}
}

View File

@ -1,6 +1,7 @@
//read menu.h
#include "quakedef.h"
#include "shader.h"
int omousex;
int omousey;
@ -28,17 +29,17 @@ void Draw_TextBox (int x, int y, int width, int lines)
}
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 8, 8, p);
p = Draw_SafeCachePic ("gfx/box_ml.lmp");
for (n = 0; n < lines; n++)
{
cy += 8;
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 8, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_bl.lmp");
if (p)
Draw_TransPic (cx, cy+8, p);
Draw_ScalePic (cx, cy+8, 8, 8, p);
// draw middle
cx += 8;
@ -47,7 +48,7 @@ void Draw_TextBox (int x, int y, int width, int lines)
cy = y;
p = Draw_SafeCachePic ("gfx/box_tm.lmp");
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 16, 8, p);
p = Draw_SafeCachePic ("gfx/box_mm.lmp");
for (n = 0; n < lines; n++)
{
@ -55,11 +56,11 @@ void Draw_TextBox (int x, int y, int width, int lines)
if (n == 1)
p = Draw_SafeCachePic ("gfx/box_mm2.lmp");
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 16, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_bm.lmp");
if (p)
Draw_TransPic (cx, cy+8, p);
Draw_ScalePic (cx, cy+8, 16, 8, p);
width -= 2;
cx += 16;
}
@ -68,17 +69,17 @@ void Draw_TextBox (int x, int y, int width, int lines)
cy = y;
p = Draw_SafeCachePic ("gfx/box_tr.lmp");
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 8, 8, p);
p = Draw_SafeCachePic ("gfx/box_mr.lmp");
for (n = 0; n < lines; n++)
{
cy += 8;
if (p)
Draw_TransPic (cx, cy, p);
Draw_ScalePic (cx, cy, 8, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_br.lmp");
if (p)
Draw_TransPic (cx, cy+8, p);
Draw_ScalePic (cx, cy+8, 8, 8, p);
}
void Draw_Hexen2BigFontString(int x, int y, const char *text)
@ -105,7 +106,7 @@ void Draw_Hexen2BigFontString(int x, int y, const char *text)
sy=-1;
}
if(sx>=0)
Draw_SubPic(x, y, p, sx, sy, 20, 20);
Draw_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*8);
x+=20;
text++;
}
@ -175,7 +176,7 @@ void Draw_BigFontString(int x, int y, const char *text)
sy=-1;
}
if(sx>=0)
Draw_SubPic(x, y, p, sx, sy, (p->width>>3), (p->height>>3));
Draw_SubPic(x, y, 20, 20, p, sx, sy, 20*8, 20*8);
x+=(p->width>>3);
text++;
}
@ -286,6 +287,45 @@ void MenuTooltipSplit(menu_t *menu, const char *text)
menu->tooltip = mtt;
}
qboolean MI_Selectable(menuoption_t *op)
{
switch(op->common.type)
{
case mt_text:
return false;
case mt_button:
return true;
case mt_hexen2buttonbigfont:
return true;
case mt_qbuttonbigfont:
return true;
case mt_menudot:
return false;
case mt_picturesel:
return true;
case mt_picture:
return false;
case mt_childwindow:
return true;
case mt_box:
return false;
case mt_slider:
return true;
case mt_checkbox:
return true;
case mt_edit:
return true;
case mt_bind:
return true;
case mt_combo:
return true;
case mt_custom:
return true;
default:
return false;
}
}
void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
{
int i;
@ -297,16 +337,19 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
if (omousex > xpos+option->common.posx && omousex < xpos+option->common.posx+option->common.width)
if (omousey > ypos+option->common.posy && omousey < ypos+option->common.posy+option->common.height)
{
if (menu->selecteditem != option)
if (MI_Selectable(option))
{
if (!option->common.noselectionsound)
S_LocalSound ("misc/menu1.wav");
menu->selecteditem = option;
menu->tooltiptime = realtime + 1;
MenuTooltipSplit(menu, menu->selecteditem->common.tooltip);
if (menu->selecteditem != option)
{
if (!option->common.noselectionsound)
S_LocalSound ("misc/menu1.wav");
menu->selecteditem = option;
menu->tooltiptime = realtime + 1;
MenuTooltipSplit(menu, menu->selecteditem->common.tooltip);
}
if (menu->cursoritem)
menu->cursoritem->common.posy = menu->selecteditem->common.posy;
}
if (menu->cursoritem)
menu->cursoritem->common.posy = menu->selecteditem->common.posy;
}
}
if (!option->common.ishidden)
@ -314,17 +357,20 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
{
case mt_text:
if (!option->text.text)
Draw_Character (xpos+option->common.posx, ypos+option->common.posy, 12+((int)(realtime*4)&1));
{
if ((int)(realtime*4)&1)
Draw_FunString(xpos+option->common.posx, ypos+option->common.posy, "^Ue00d");
}
else if (option->text.isred)
Draw_Alt_String(xpos+option->common.posx, ypos+option->common.posy, option->text.text);
Draw_AltFunString(xpos+option->common.posx, ypos+option->common.posy, option->text.text);
else
Draw_String(xpos+option->common.posx, ypos+option->common.posy, option->text.text);
Draw_FunString(xpos+option->common.posx, ypos+option->common.posy, option->text.text);
break;
case mt_button:
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
Draw_AltFunString(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
else
Draw_String(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
Draw_FunString(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
break;
case mt_hexen2buttonbigfont:
Draw_Hexen2BigFontString(xpos+option->common.posx, ypos+option->common.posy, option->button.text);
@ -335,7 +381,7 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
case mt_menudot:
i = (int)(realtime * 10)%maxdots;
p = Draw_SafeCachePic(va(menudotstyle, i+mindot ));
Draw_TransPic(xpos+option->common.posx, ypos+option->common.posy+dotofs, p);
Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy+dotofs, 20, 20, p);
break;
case mt_picturesel:
p = NULL;
@ -350,13 +396,9 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
if (!p)
p = Draw_SafeCachePic(option->picture.picturename);
Draw_TransPic (xpos+option->common.posx, ypos+option->common.posy, p);
Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width, option->common.height, p);
break;
case mt_picture:
p = Draw_SafeCachePic(option->picture.picturename);
Draw_TransPic (xpos+option->common.posx, ypos+option->common.posy, p);
break;
case mt_strechpic:
p = Draw_SafeCachePic(option->picture.picturename);
if (p) Draw_ScalePic(xpos+option->common.posx, ypos+option->common.posy, option->common.width, option->common.height, p);
break;
@ -374,15 +416,16 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
int i;
int x = xpos+option->common.posx;
int y = ypos+option->common.posy;
int s;
range = (option->slider.current - option->slider.min)/(option->slider.max-option->slider.min);
if (option->slider.text)
{
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->slider.text);
Draw_AltFunString(x, y, option->slider.text);
else
Draw_String(x, y, option->slider.text);
Draw_FunString(x, y, option->slider.text);
x += strlen(option->slider.text)*8+28;
}
@ -390,11 +433,15 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
range = 0;
if (range > 1)
range = 1;
Draw_Character (x-8, y, 128);
x -= 8;
Font_BeginString(font_conchar, x, y, &x, &y);
x = Font_DrawChar(x, y, 0xe080 | CON_WHITEMASK);
s = x;
for (i=0 ; i<SLIDER_RANGE ; i++)
Draw_Character (x + i*8, y, 129);
Draw_Character (x+i*8, y, 130);
Draw_Character (x + (SLIDER_RANGE-1)*8 * range, y, 131);
x = Font_DrawChar(x, y, 0xe081 | CON_WHITEMASK);
Font_DrawChar(x, y, 0xe082 | CON_WHITEMASK);
Font_DrawChar(s + (x-s) * range - Font_CharWidth(0xe083 | CON_WHITEMASK)/2, y, 0xe083 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
break;
case mt_checkbox:
@ -424,9 +471,9 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
if (option->check.text)
{
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->check.text);
Draw_AltFunString(x, y, option->check.text);
else
Draw_String(x, y, option->check.text);
Draw_FunString(x, y, option->check.text);
x += strlen(option->check.text)*8+28;
}
#if 0
@ -436,9 +483,9 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
Draw_Character (x, y, 129);
#endif
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String (x, y, on ? "on" : "off");
Draw_AltFunString (x, y, on ? "on" : "off");
else
Draw_String (x, y, on ? "on" : "off");
Draw_FunString (x, y, on ? "on" : "off");
}
break;
case mt_edit:
@ -446,18 +493,19 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
int x = xpos+option->common.posx;
int y = ypos+option->common.posy;
//Fixme: variable width fonts
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->edit.caption);
Draw_AltFunString(x, y, option->edit.caption);
else
Draw_String(x, y, option->edit.caption);
Draw_FunString(x, y, option->edit.caption);
x+=strlen(option->edit.caption)*8+8;
Draw_TextBox(x-8, y-8, 16, 1);
Draw_String(x, y, option->edit.text);
Draw_FunString(x, y, option->edit.text);
if (menu->selecteditem == option && (int)(realtime*4) & 1)
{
x += strlen(option->edit.text)*8;
Draw_Character(x, y, 11);
Draw_FunString(x, y, "^Ue00b");
}
}
break;
@ -470,9 +518,9 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
char *keyname;
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->bind.caption);
Draw_AltFunString(x, y, option->bind.caption);
else
Draw_String(x, y, option->bind.caption);
Draw_FunString(x, y, option->bind.caption);
x += strlen(option->bind.caption)*8+28;
{
l = strlen (option->bind.command);
@ -481,21 +529,21 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
if (bindingactive && menu->selecteditem == option)
{
Draw_String (x, y, "Press key");
Draw_FunString (x, y, "Press key");
}
else if (keys[0] == -1)
{
Draw_String (x, y, "???");
Draw_FunString (x, y, "???");
}
else
{
keyname = Key_KeynumToString (keys[0]);
Draw_String (x, y, keyname);
Draw_FunString (x, y, keyname);
x += strlen(keyname) * 8;
if (keys[1] != -1)
{
Draw_String (x + 8, y, "or");
Draw_String (x + 32, y, Key_KeynumToString (keys[1]));
{ /*these offsets are wrong*/
Draw_FunString (x + 8, y, "or");
Draw_FunString (x + 32, y, Key_KeynumToString (keys[1]));
}
}
}
@ -508,16 +556,16 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
int y = ypos+option->common.posy;
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->combo.caption);
Draw_AltFunString(x, y, option->combo.caption);
else
Draw_String(x, y, option->combo.caption);
Draw_FunString(x, y, option->combo.caption);
x += strlen(option->combo.caption)*8+24;
if (option->combo.numoptions)
{
if (!menu->cursoritem && menu->selecteditem == option)
Draw_Alt_String(x, y, option->combo.options[option->combo.selectedoption]);
Draw_AltFunString(x, y, option->combo.options[option->combo.selectedoption]);
else
Draw_String(x, y, option->combo.options[option->combo.selectedoption]);
Draw_FunString(x, y, option->combo.options[option->combo.selectedoption]);
}
}
break;
@ -565,7 +613,7 @@ void MenuDraw(menu_t *menu)
y += 8;
for (l = 0; l < lines; l++)
{
Draw_String(x, y, menu->tooltip->lines[l]);
Draw_FunString(x, y, menu->tooltip->lines[l]);
y += 8;
}
}
@ -664,7 +712,7 @@ menupicture_t *MC_AddSelectablePicture(menu_t *menu, int x, int y, char *picname
return n;
}
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, char *picname)
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, int width, int height, char *picname)
{
menupicture_t *n;
if (!qrenderer)
@ -677,27 +725,6 @@ menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, char *picname)
n->common.iszone = true;
n->common.posx = x;
n->common.posy = y;
n->picturename = (char *)(n+1);
strcpy(n->picturename, picname);
n->common.next = menu->options;
menu->options = (menuoption_t *)n;
return n;
}
menupicture_t *MC_AddStrechPicture(menu_t *menu, int x, int y, int width, int height, char *picname)
{
menupicture_t *n;
if (!qrenderer)
return NULL;
Draw_SafeCachePic(picname);
n = Z_Malloc(sizeof(menupicture_t) + strlen(picname)+1);
n->common.type = mt_strechpic;
n->common.iszone = true;
n->common.posx = x;
n->common.posy = y;
n->common.width = width;
n->common.height = height;
n->picturename = (char *)(n+1);
@ -708,20 +735,27 @@ menupicture_t *MC_AddStrechPicture(menu_t *menu, int x, int y, int width, int he
return n;
}
menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, char *picname)
menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, int height, char *picname)
{
int x;
int width;
mpic_t *p;
if (!qrenderer)
return NULL;
p = Draw_SafeCachePic(picname);
if (!p)
{
x = 320/2;
width = 64;
}
else
x = (320-p->width)/2;
{
width = (p->width * (float)height) / p->height;
x = (320-(int)width)/2;
}
return MC_AddPicture(menu, x, y, picname);
return MC_AddPicture(menu, x, y, width, height, picname);
}
menupicture_t *MC_AddCursor(menu_t *menu, int x, int y)
@ -1216,7 +1250,7 @@ void MC_CheckBox_Key(menucheck_t *option, menu_t *menu, int key)
}
}
void MC_EditBox_Key(menuedit_t *edit, int key)
void MC_EditBox_Key(menuedit_t *edit, int key, unsigned int unicode)
{
int len = strlen(edit->text);
if (key == K_DEL || key == K_BACKSPACE)
@ -1225,12 +1259,18 @@ void MC_EditBox_Key(menuedit_t *edit, int key)
return;
edit->text[len-1] = '\0';
}
else if (key < 32 || key > 127)
else if (!unicode)
return;
else
{
edit->text[len] = key;
edit->text[len+1] = '\0';
if (unicode < 128)
{
if (len < sizeof(edit->text))
{
edit->text[len] = unicode;
edit->text[len+1] = '\0';
}
}
}
edit->modified = true;
@ -1378,7 +1418,7 @@ void M_RemoveAllMenus (void)
}
void DrawCursor(void)
void DrawCursor(int prydoncursornum)
{
extern int mousecursor_x, mousecursor_y;
mpic_t *p;
@ -1393,7 +1433,14 @@ void DrawCursor(void)
// Draw_TransPic(mousecursor_x-4, mousecursor_y-4, p);
}
else
Draw_Character(mousecursor_x-4, mousecursor_y-4, '+');
{
int x, y;
Font_BeginString(font_conchar, mousecursor_x, mousecursor_y, &x, &y);
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
y -= Font_CharHeight()/2;
Font_DrawChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
Font_EndString(font_conchar);
}
}
@ -1431,7 +1478,7 @@ void M_Complex_Draw(void)
MenuDraw(cmenu);
}
DrawCursor();
SCR_DrawCursor(0);
}
menuoption_t *M_NextItem(menu_t *m, menuoption_t *old)
@ -1504,7 +1551,7 @@ menuoption_t *M_PrevSelectableItem(menu_t *m, menuoption_t *old)
}
}
void M_Complex_Key(int key)
void M_Complex_Key(int key, int unicode)
{
if (!currentmenu)
return; //erm...
@ -1593,7 +1640,7 @@ void M_Complex_Key(int key)
currentmenu->selecteditem->custom.key(&currentmenu->selecteditem->custom, currentmenu, key);
break;
case mt_edit:
MC_EditBox_Key(&currentmenu->selecteditem->edit, key);
MC_EditBox_Key(&currentmenu->selecteditem->edit, key, unicode);
break;
case mt_combo:
MC_Combo_Key(&currentmenu->selecteditem->combo, key);
@ -1777,11 +1824,11 @@ void M_Menu_Main_f (void)
mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 0, 4, "pics/m_main_plaque");
MC_AddPicture(mainm, 0, 4, 38, 166, "pics/m_main_plaque");
p = Draw_SafeCachePic("pics/m_main_logo");
if (!p)
return;
MC_AddPicture(mainm, 0, 173, "pics/m_main_logo");
MC_AddPicture(mainm, 0, 173, 36, 42, "pics/m_main_logo");
#ifndef CLIENTONLY
MC_AddSelectablePicture(mainm, 68, 13, "pics/m_main_game");
#endif
@ -1823,11 +1870,11 @@ void M_Menu_Main_f (void)
mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 0, "gfx/menu/hplaque.lmp");
MC_AddPicture(mainm, 16, 0, 35, 176, "gfx/menu/hplaque.lmp");
p = Draw_SafeCachePic("gfx/menu/title0.lmp");
if (!p)
return;
MC_AddPicture(mainm, (320-p->width)/2, 0, "gfx/menu/title0.lmp");
MC_AddCenterPicture(mainm, 0, 60, "gfx/menu/title0.lmp");
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64, "Single Player", "menu_single\n");
b->common.width = 12*20;
@ -1868,9 +1915,9 @@ void M_Menu_Main_f (void)
return;
}
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 4, "gfx/qplaque.lmp");
MC_AddPicture(mainm, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddPicture(mainm, (320-p->width)/2, 4, "gfx/ttl_main.lmp");
MC_AddCenterPicture(mainm, 4, 24, "gfx/ttl_main.lmp");
mainm->selecteditem = (menuoption_t *)
MC_AddConsoleCommandQBigFont (mainm, 72, 32, "Single ", "menu_single\n");
@ -1902,10 +1949,10 @@ void M_Menu_Main_f (void)
return;
}
mainm->key = MC_Main_Key;
MC_AddPicture(mainm, 16, 4, "gfx/qplaque.lmp");
MC_AddPicture(mainm, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddPicture(mainm, (320-p->width)/2, 4, "gfx/ttl_main.lmp");
MC_AddPicture(mainm, 72, 32, "gfx/mainmenu.lmp");
MC_AddCenterPicture(mainm, 4, 24, "gfx/ttl_main.lmp");
MC_AddPicture(mainm, 72, 32, 240, 112, "gfx/mainmenu.lmp");
p = Draw_SafeCachePic("gfx/mainmenu.lmp");

View File

@ -73,48 +73,40 @@ int slist_type;
static void NM_DrawColouredCharacter (int cx, int line, unsigned int num)
{
Draw_ColouredCharacter(cx, line, num);
}
static void NM_Print (int cx, int cy, qbyte *str)
{
while (*str)
{
Draw_ColouredCharacter (cx, cy, (*str)|CON_HIGHCHARSMASK|CON_WHITEMASK);
str++;
cx += 8;
}
Draw_AltFunString(cx, cy, str);
}
static void NM_PrintWhite (int cx, int cy, qbyte *str)
{
while (*str)
{
Draw_ColouredCharacter (cx, cy, (*str)|CON_WHITEMASK);
str++;
cx += 8;
}
Draw_FunString(cx, cy, str);
}
static void NM_PrintColoured (int cx, int cy, int colour, qbyte *str)
{
#pragma message("needs reimplementing")
/*
while (*str)
{
NM_DrawColouredCharacter (cx, cy, (*str) | (colour<<CON_FGSHIFT));
str++;
cx += 8;
}
*/
}
static void NM_PrintHighlighted (int cx, int cy, int colour, int bg, qbyte *str)
{
#pragma message("needs reimplementing")
/*
while (*str)
{
NM_DrawColouredCharacter (cx, cy, (*str) | (colour<<CON_FGSHIFT) | (bg<<CON_BGSHIFT) | CON_NONCLEARBG);
str++;
cx += 8;
}
*/
}
qboolean M_IsFiltered(serverinfo_t *server) //figure out if we should filter a server.
@ -266,6 +258,8 @@ int M_AddColumn (int right, int y, char *text, int maxchars, int colour, int hig
right = left;
#pragma message("needs reimplementing")
/*
if (highlight >= 0)
{
while (*text && maxchars>0)
@ -286,6 +280,7 @@ int M_AddColumn (int right, int y, char *text, int maxchars, int colour, int hig
maxchars--;
}
}
*/
return left;
}
void M_DrawServerList(void)
@ -418,11 +413,7 @@ void M_DrawServerList(void)
// make sure we have a highlighted background
if (highlight >= 0)
{
int i = 8;
for (; i < vid.width - 8; i += 8)
Draw_ColouredCharacter(i, y, ' ' | CON_NONCLEARBG | (COLOR_WHITE << CON_FGSHIFT) | (highlight << CON_BGSHIFT));
}
Draw_FillRGB(8, y, vid.width-16, 8, consolecolours[highlight].fr, consolecolours[highlight].fg, consolecolours[highlight].fb);
if (sb_showtimelimit.value)
x = M_AddColumn(x, y, va("%i", server->tl), 3, colour, highlight); //time limit
@ -918,19 +909,19 @@ void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboolean re
if (mx >= xmin && !(*filldraw))
{
*filldraw = true;
Draw_FillRGB(xmin*8, y, xlen*8, 8, (sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08);
Draw_FillRGB(xmin, y, xlen, 8, (sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08);
}
Draw_FunStringLen(xmin*8, y, str, xlen);
Draw_FunStringWidth(xmin, y, str, xlen);
if (x != NULL)
*x -= xlen + 1;
*x -= xlen + 8;
}
void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
{
int sf = Master_GetSortField();
extern int mousecursor_x, mousecursor_y;
int mx = mousecursor_x/8;
int mx = mousecursor_x;
qboolean filldraw = false;
qbyte clr;
@ -938,17 +929,17 @@ void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
clr = 'D';
else
clr = 'B';
x = ths->common.width/8;
x = ths->common.width;
if (mx > x || mousecursor_y < y || mousecursor_y >= y+8)
filldraw = true;
if (sb_showtimelimit.value) {SL_DrawColumnTitle(&x, y, 3, mx, "tl", (sf==SLKEY_TIMELIMIT), clr, &filldraw);}
if (sb_showfraglimit.value) {SL_DrawColumnTitle(&x, y, 3, mx, "fl", (sf==SLKEY_FRAGLIMIT), clr, &filldraw);}
if (sb_showplayers.value) {SL_DrawColumnTitle(&x, y, 5, mx, "plyrs", (sf==SLKEY_NUMPLAYERS), clr, &filldraw);}
if (sb_showmap.value) {SL_DrawColumnTitle(&x, y, 8, mx, "map", (sf==SLKEY_MAP), clr, &filldraw);}
if (sb_showgamedir.value) {SL_DrawColumnTitle(&x, y, 8, mx, "gamedir", (sf==SLKEY_GAMEDIR), clr, &filldraw);}
if (sb_showping.value) {SL_DrawColumnTitle(&x, y, 3, mx, "png", (sf==SLKEY_PING), clr, &filldraw);}
if (sb_showaddress.value) {SL_DrawColumnTitle(&x, y, 21, mx, "address", (sf==SLKEY_ADDRESS), clr, &filldraw);}
SL_DrawColumnTitle(NULL, y, x, mx, "hostname^7 ", (sf==SLKEY_NAME), clr, &filldraw);
if (sb_showtimelimit.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "tl", (sf==SLKEY_TIMELIMIT), clr, &filldraw);}
if (sb_showfraglimit.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "fl", (sf==SLKEY_FRAGLIMIT), clr, &filldraw);}
if (sb_showplayers.value) {SL_DrawColumnTitle(&x, y, 5*8, mx, "plyrs", (sf==SLKEY_NUMPLAYERS), clr, &filldraw);}
if (sb_showmap.value) {SL_DrawColumnTitle(&x, y, 8*8, mx, "map", (sf==SLKEY_MAP), clr, &filldraw);}
if (sb_showgamedir.value) {SL_DrawColumnTitle(&x, y, 8*8, mx, "gamedir", (sf==SLKEY_GAMEDIR), clr, &filldraw);}
if (sb_showping.value) {SL_DrawColumnTitle(&x, y, 3*8, mx, "png", (sf==SLKEY_PING), clr, &filldraw);}
if (sb_showaddress.value) {SL_DrawColumnTitle(&x, y, 21*8, mx, "address", (sf==SLKEY_ADDRESS), clr, &filldraw);}
SL_DrawColumnTitle(NULL, y, x, mx, "hostname ", (sf==SLKEY_NAME), clr, &filldraw);
}
qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
@ -1083,16 +1074,14 @@ void SL_ServerDraw (int x, int y, menucustom_t *ths, menu_t *menu)
serverbackcolor[(int)stype * 2 + (thisone & 1)][2]);
}
x /= 8;
if (sb_showtimelimit.value) {Draw_FunStringLen((x-3)*8, y, va("%i", si->tl), 3); x-=4;}
if (sb_showfraglimit.value) {Draw_FunStringLen((x-3)*8, y, va("%i", si->fl), 3); x-=4;}
if (sb_showplayers.value) {Draw_FunStringLen((x-5)*8, y, va("%2i/%2i", si->players, si->maxplayers), 5); x-=6;}
if (sb_showmap.value) {Draw_FunStringLen((x-8)*8, y, si->map, 8); x-=9;}
if (sb_showgamedir.value) {Draw_FunStringLen((x-8)*8, y, si->gamedir, 8); x-=9;}
if (sb_showping.value) {Draw_FunStringLen((x-3)*8, y, va("%i", si->ping), 3); x-=4;}
if (sb_showaddress.value) {Draw_FunStringLen((x-21)*8, y, NET_AdrToString(adr, sizeof(adr), si->adr), 21); x-=22;}
Draw_FunStringLen(0, y, si->name, x);
if (sb_showtimelimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->tl), 3*8); x-=4*8;}
if (sb_showfraglimit.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->fl), 3*8); x-=4*8;}
if (sb_showplayers.value) {Draw_FunStringWidth((x-5*8), y, va("%2i/%2i", si->players, si->maxplayers), 5*8); x-=6*8;}
if (sb_showmap.value) {Draw_FunStringWidth((x-8*8), y, si->map, 8*8); x-=9*8;}
if (sb_showgamedir.value) {Draw_FunStringWidth((x-8*8), y, si->gamedir, 8*8); x-=9*8;}
if (sb_showping.value) {Draw_FunStringWidth((x-3*8), y, va("%i", si->ping), 3*8); x-=4*8;}
if (sb_showaddress.value) {Draw_FunStringWidth((x-21*8), y, NET_AdrToString(adr, sizeof(adr), si->adr), 21*8); x-=22*8;}
Draw_FunStringWidth(0, y, si->name, x);
}
}
qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key)
@ -1111,8 +1100,8 @@ qboolean SL_ServerKey (menucustom_t *ths, menu_t *menu, int key)
info->selectedpos = info->scrollpos + (mousecursor_y-16)/8;
server = Master_SortedServer(info->selectedpos);
// selectedserver.inuse = true;
// SListOptionChanged(server);
selectedserver.inuse = true;
SListOptionChanged(server);
if (server)
{
@ -1253,7 +1242,7 @@ void SL_ServerPlayer (int x, int y, menucustom_t *ths, menu_t *menu)
Draw_Fill (x, y+4, 28, 4, Sbar_ColorForMap(selectedserver.detail->players[i].botc));
NM_PrintWhite (x, y, va("%3i", selectedserver.detail->players[i].frags));
Draw_FunStringLen (x+28, y, selectedserver.detail->players[i].name, 12);
Draw_FunStringWidth (x+28, y, selectedserver.detail->players[i].name, 12*8);
}
}
}
@ -1501,7 +1490,7 @@ void M_Menu_ServerList2_f(void)
info->filter[6] = !!sb_hideempty.value;
info->filter[7] = !!sb_hidefull.value;
info->mappic = (menupicture_t *)MC_AddStrechPicture(menu, vid.width - 64, vid.height - 64, 64, 64, "012345678901234567890123456789012");
info->mappic = (menupicture_t *)MC_AddPicture(menu, vid.width - 64, vid.height - 64, 64, 64, "012345678901234567890123456789012");
CalcFilters(menu);
@ -1577,7 +1566,7 @@ qboolean M_QuickConnect_Cancel (menuoption_t *opt, menu_t *menu, int key)
void M_QuickConnect_DrawStatus (int x, int y, menucustom_t *ths, menu_t *menu)
{
Draw_String(x, y, va("Polling, %i secs\n", (int)(quickconnecttimeout - Sys_DoubleTime() + 0.9)));
Draw_FunString(x, y, va("Polling, %i secs\n", (int)(quickconnecttimeout - Sys_DoubleTime() + 0.9)));
}
void M_QuickConnect_f(void)

View File

@ -2,9 +2,10 @@
//was origonally an mp3 track selector, now handles lots of media specific stuff - like q3 films!
//should rename to m_media.c
#include "quakedef.h"
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"//fixme
#endif
#include "shader.h"
#if !defined(NOMEDIA)
@ -289,7 +290,7 @@ void M_Media_Draw (void)
p = Draw_SafeCachePic ("gfx/p_option.lmp");
if (p)
M_DrawPic ( (320-p->width)/2, 4, p);
M_DrawScalePic ( (320-p->width)/2, 4, 144, 24, p);
if (!bgmvolume.value)
M_Print (12, 32, "Not playing - no volume");
else if (!*currenttrack.nicename)
@ -791,24 +792,18 @@ typedef enum {
MFT_OFSGECKO
} media_filmtype_t;
typedef enum {
MOT_NONE,
MOT_PALETTE,
MOT_RGBA,
MOT_BGRA,
MOT_BGR_FLIP
} media_outputtype_t;
struct cin_s {
//these are the outputs (not always power of two!)
media_outputtype_t outtype;
enum uploadfmt outtype;
int outwidth;
int outheight;
qbyte *outdata;
qbyte *outpalette;
int outunchanged;
texid_t texture;
qboolean (*decodeframe)(cin_t *cin, qboolean nosound);
void (*doneframe)(cin_t *cin);
void (*shutdown)(cin_t *cin); //warning: don't free cin_t
@ -915,11 +910,11 @@ qboolean Media_WinAvi_DecodeFrame(cin_t *cin, qboolean nosound)
{
SCR_SetUpToDrawConsole();
Draw_ConsoleBackground(0, vid.height, true);
Draw_String(0, 0, "Video stream is corrupt\n");
Draw_FunString(0, 0, "Video stream is corrupt\n");
}
else
{
cin->outtype = MOT_BGR_FLIP;
cin->outtype = TF_BGR24_FLIP;
cin->outwidth = lpbi->biWidth;
cin->outheight = lpbi->biHeight;
cin->outdata = (char*)lpbi+lpbi->biSize;
@ -1053,6 +1048,7 @@ cin_t *Media_WinAvi_TryLoad(char *name)
//////////////////////////////////////////////////////////////////////////////////
//Quake3 RoQ Support
#ifdef Q3CLIENT
void Media_Roq_Shutdown(struct cin_s *cin)
{
roq_close(cin->roq.roqfilm);
@ -1131,7 +1127,7 @@ qboolean Media_Roq_DecodeFrame (cin_t *cin, qboolean nosound)
}
cin->outunchanged = false;
cin->outtype = MOT_RGBA;
cin->outtype = TF_RGBA32;
cin->outwidth = cin->roq.roqfilm->width;
cin->outheight = cin->roq.roqfilm->height;
cin->outdata = cin->framedata;
@ -1190,11 +1186,13 @@ cin_t *Media_RoQ_TryLoad(char *name)
}
return NULL;
}
#endif
//Quake3 RoQ Support
//////////////////////////////////////////////////////////////////////////////////
//Static Image Support
#ifndef MINIMAL
void Media_Static_Shutdown(struct cin_s *cin)
{
BZ_Free(cin->image.filmimage);
@ -1203,8 +1201,8 @@ void Media_Static_Shutdown(struct cin_s *cin)
qboolean Media_Static_DecodeFrame(cin_t *cin, qboolean nosound)
{
cin->outunchanged = cin->outtype==MOT_RGBA?true:false;//handy
cin->outtype = MOT_RGBA;
cin->outunchanged = cin->outtype==TF_RGBA32?true:false;//handy
cin->outtype = TF_RGBA32;
cin->outwidth = cin->image.imagewidth;
cin->outheight = cin->image.imageheight;
cin->outdata = cin->image.filmimage;
@ -1268,11 +1266,13 @@ cin_t *Media_Static_TryLoad(char *name)
}
return NULL;
}
#endif
//Static Image Support
//////////////////////////////////////////////////////////////////////////////////
//Quake2 CIN Support
#ifdef Q2CLIENT
void Media_Cin_Shutdown(struct cin_s *cin)
{
CIN_FinishCinematic();
@ -1308,6 +1308,7 @@ cin_t *Media_Cin_TryLoad(char *name)
return NULL;
}
#endif
//Quake2 CIN Support
//////////////////////////////////////////////////////////////////////////////////
@ -1605,6 +1606,9 @@ void Media_ShutdownCin(cin_t *cin)
if (cin->shutdown)
cin->shutdown(cin);
if (TEXVALID(cin->texture))
R_DestroyTexture(cin->texture);
if (cin->framedata)
{
BZ_Free(cin->framedata);
@ -1621,20 +1625,26 @@ cin_t *Media_StartCin(char *name)
if (!name || !*name) //clear only.
return NULL;
#ifdef OFFSCREENGECKO
if (!cin)
cin = Media_Gecko_TryLoad(name);
#endif
if (!cin)
cin = Media_Static_TryLoad(name);
#ifdef Q2CLIENT
if (!cin)
cin = Media_Cin_TryLoad(name);
#endif
#ifdef Q3CLIENT
if (!cin)
cin = Media_RoQ_TryLoad(name);
#endif
#ifdef WINAVI
if (!cin)
cin = Media_WinAvi_TryLoad(name);
#endif
return cin;
}
@ -1677,16 +1687,17 @@ qboolean Media_ShowFilm(void)
switch(fullscreenvid->outtype)
{
case MOT_RGBA:
case TF_RGBA32:
Media_ShowFrameRGBA_32(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
break;
case MOT_PALETTE:
case TF_TRANS8:
case TF_SOLID8:
Media_ShowFrame8bit(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight, fullscreenvid->outpalette);
break;
case MOT_BGR_FLIP:
case TF_BGR24_FLIP:
Media_ShowFrameBGR_24_Flip(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
break;
case MOT_BGRA:
case TF_BGRA32:
#pragma message("Media_ShowFilm: BGRA comes out as RGBA")
// Media_ShowFrameBGRA_32
Media_ShowFrameRGBA_32(fullscreenvid->outdata, fullscreenvid->outwidth, fullscreenvid->outheight);
@ -1699,41 +1710,28 @@ qboolean Media_ShowFilm(void)
return true;
}
#ifdef RGLQUAKE
int Media_UpdateForShader(int texnum, cin_t *cin)
#ifdef GLQUAKE
texid_t Media_UpdateForShader(cin_t *cin)
{
if (!cin)
return 0;
return r_nulltex;
if (!Media_DecodeFrame(cin, true))
{
return 0;
return r_nulltex;
}
if (!cin->outunchanged)
{
GL_Bind(texnum);
switch(cin->outtype)
{
case MOT_RGBA:
GL_Upload32("cin", (unsigned int*)cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
case MOT_PALETTE:
GL_Upload8("cin", cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
case MOT_BGR_FLIP:
GL_Upload24BGR_Flip ("cin", cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
case MOT_BGRA:
GL_Upload32_BGRA("cin", (unsigned int*)cin->outdata, cin->outwidth, cin->outheight, false, false);
break;
}
if (!TEXVALID(cin->texture))
cin->texture = R_AllocNewTexture(cin->outwidth, cin->outheight);
R_Upload(cin->texture, "cin", cin->outtype, cin->outdata, cin->outwidth, cin->outheight, IF_NOMIPMAP|IF_NOALPHA|IF_NOGAMMA);
}
if (cin->doneframe)
cin->doneframe(cin);
return texnum;
return cin->texture;
}
#endif
@ -1806,7 +1804,7 @@ void Media_PlayFilm_f (void)
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
#if defined(WINAVI)
#define WINAVIRECORDING
PAVIFILE recordavi_file;
@ -1893,12 +1891,7 @@ void Media_RecordFrame (void)
if (y < scr_con_current) y = scr_con_current;
if (y > vid.height-8)
y = vid.height-8;
qglColor4f(1, 0, 0, sin(realtime*4)/4+0.75);
qglEnable(GL_BLEND);
qglDisable(GL_ALPHA_TEST);
GL_TexEnv(GL_MODULATE);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Draw_String((strlen(capturemessage.string)+1)*8, y, "PAUSED");
Draw_FunString((strlen(capturemessage.string)+1)*8, y, S_COLOR_RED "PAUSED");
return;
}
@ -1912,7 +1905,7 @@ void Media_RecordFrame (void)
if (y < scr_con_current) y = scr_con_current;
if (y > vid.height-8)
y = vid.height-8;
Draw_String(0, y, capturemessage.string);
Draw_FunString(0, y, capturemessage.string);
}
//time for annother frame?
@ -1939,10 +1932,10 @@ void Media_RecordFrame (void)
return;
}
//ask gl for it
qglReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer );
qglReadPixels (0, 0, vid.pixelwidth, vid.pixelheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer );
// swap rgb to bgr
c = glwidth*glheight*3;
c = vid.pixelwidth*vid.pixelheight*3;
for (i=0 ; i<c ; i+=3)
{
temp = framebuffer[i];
@ -1950,7 +1943,7 @@ void Media_RecordFrame (void)
framebuffer[i+2] = temp;
}
//write it
hr = AVIStreamWrite(recordavi_video_stream, captureframe++, 1, framebuffer, glwidth*glheight * 3, ((captureframe%15) == 0)?AVIIF_KEYFRAME:0, NULL, NULL);
hr = AVIStreamWrite(recordavi_video_stream, captureframe++, 1, framebuffer, vid.pixelwidth*vid.pixelheight * 3, ((captureframe%15) == 0)?AVIIF_KEYFRAME:0, NULL, NULL);
if (FAILED(hr)) Con_Printf("Recoring error\n");
}
#endif /* WINAVI */
@ -1973,12 +1966,7 @@ skipframe:
if (y < scr_con_current) y = scr_con_current;
if (y > vid.height-8)
y = vid.height-8;
qglColor4f(1, 0, 0, sin(realtime*4)/4+0.75);
qglEnable(GL_BLEND);
qglDisable(GL_ALPHA_TEST);
GL_TexEnv(GL_MODULATE);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Draw_String((strlen(capturemessage.string)+1)*8, y, "RECORDING");
Draw_FunString((strlen(capturemessage.string)+1)*8, y, S_COLOR_RED"RECORDING");
}
}
@ -2262,12 +2250,12 @@ void Media_RecordFilm_f (void)
memset(&bitmap_info_header, 0, sizeof(BITMAPINFOHEADER));
bitmap_info_header.biSize = 40;
bitmap_info_header.biWidth = glwidth;
bitmap_info_header.biHeight = glheight;
bitmap_info_header.biWidth = vid.pixelwidth;
bitmap_info_header.biHeight = vid.pixelheight;
bitmap_info_header.biPlanes = 1;
bitmap_info_header.biBitCount = 24;
bitmap_info_header.biCompression = BI_RGB;
bitmap_info_header.biSizeImage = glwidth*glheight * 3;
bitmap_info_header.biSizeImage = vid.pixelwidth*vid.pixelheight * 3;
memset(&stream_header, 0, sizeof(stream_header));
@ -2275,7 +2263,7 @@ void Media_RecordFilm_f (void)
stream_header.fccHandler = recordavi_codec_fourcc;
stream_header.dwScale = 100;
stream_header.dwRate = (unsigned long)(0.5 + 100.0/recordavi_frametime);
SetRect(&stream_header.rcFrame, 0, 0, glwidth, glheight);
SetRect(&stream_header.rcFrame, 0, 0, vid.pixelwidth, vid.pixelheight);
hr = AVIFileCreateStream(recordavi_file, &recordavi_uncompressed_video_stream, &stream_header);
if (FAILED(hr))
@ -2350,7 +2338,7 @@ void Media_RecordFilm_f (void)
// if (recordavi_wave_format.nSamplesPerSec)
// captureaudiomem = BZ_Malloc(recordavi_wave_format.nSamplesPerSec*2);
capturevideomem = BZ_Malloc(glwidth*glheight*3);
capturevideomem = BZ_Malloc(vid.pixelwidth*vid.pixelheight*3);
}
#endif /* WINAVI */
else
@ -2376,13 +2364,13 @@ void Media_RecordDemo_f(void)
else
CL_Stopdemo_f(); //capturing failed for some reason
}
#else /* RGLQUAKE */
#else /* GLQUAKE */
void Media_CaptureDemoEnd(void){}
void Media_RecordAudioFrame (short *sample_buffer, int samples){}
double Media_TweekCaptureFrameTime(double time) { return time ; }
void Media_RecordFrame (void) {}
qboolean Media_PausedDemo (void) {return false;} //should not return a value
#endif /* RGLQUAKE */
#endif /* GLQUAKE */
void Media_Init(void)
{
Cmd_AddCommand("playfilm", Media_PlayFilm_f);
@ -2391,7 +2379,7 @@ void Media_Init(void)
Cmd_AddCommand("music_rewind", Media_Rewind_f);
Cmd_AddCommand("music_next", Media_Next_f);
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
Cmd_AddCommand("capture", Media_RecordFilm_f);
Cmd_AddCommand("capturedemo", Media_RecordDemo_f);
Cmd_AddCommand("capturestop", Media_StopRecordFilm_f);

View File

@ -2,6 +2,7 @@
#include "quakedef.h"
#include "winquake.h"
#include "shader.h"
extern cvar_t maxclients;
@ -25,7 +26,7 @@ void M_Menu_MultiPlayer_f (void)
if (mgt == MGT_QUAKE2)
{
MC_AddCenterPicture(menu, 4, "pics/m_banner_multiplayer");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_multiplayer");
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommand (menu, 64, 40, "Join network server", "menu_slist\n");
@ -39,7 +40,7 @@ void M_Menu_MultiPlayer_f (void)
}
else if (mgt == MGT_HEXEN2)
{
MC_AddCenterPicture(menu, 0, "gfx/menu/title4.lmp");
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title4.lmp");
mgt=64;
menu->selecteditem = (menuoption_t*)
@ -54,8 +55,8 @@ void M_Menu_MultiPlayer_f (void)
}
else if (QBigFontWorks())
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_multi.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp");
mgt=32;
menu->selecteditem = (menuoption_t*)
@ -74,9 +75,9 @@ void M_Menu_MultiPlayer_f (void)
p = Draw_SafeCachePic("gfx/mp_menu.lmp");
if (p)
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_multi.lmp");
MC_AddPicture(menu, 72, 32, "gfx/mp_menu.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp");
MC_AddPicture(menu, 72, 32, 232, 64, "gfx/mp_menu.lmp");
}
}
@ -260,7 +261,7 @@ void MSetupQ2_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
p = Draw_SafeCachePic (va("players/%s_i", skin.string));
}
if (p)
Draw_TransPic (x-12, y-8, p);
Draw_ScalePic (x-12, y-8, p->width, p->height, p);
}
void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
@ -289,7 +290,7 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
p = Draw_SafeCachePic ("gfx/bigbox.lmp");
if (p)
Draw_TransPic (x-12, y-8, p);
Draw_ScalePic (x-12, y-8, 72, 72, p);
M_BuildTranslationTable(info->topcolour*16, info->lowercolour*16);
Draw_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable);
@ -321,11 +322,11 @@ void M_Menu_Setup_f (void)
info = menu->data;
// menu->key = MC_Main_Key;
MC_AddPicture(menu, 0, 4, "pics/m_main_plaque");
MC_AddPicture(menu, 0, 4, 38, 166, "pics/m_main_plaque");
p = Draw_SafeCachePic("pics/m_main_logo");
if (!p)
return;
MC_AddPicture(menu, 0, 173, "pics/m_main_logo");
MC_AddPicture(menu, 0, 173, 36, 42, "pics/m_main_logo");
menu->selecteditem = (menuoption_t*)
(info->nameedit = MC_AddEdit(menu, 64, 40, "Your name", name.string));
@ -369,8 +370,8 @@ void M_Menu_Setup_f (void)
menu = M_CreateMenu(sizeof(setupmenu_t));
info = menu->data;
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_multi.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp");
// MC_AddPicture(menu, 72, 32, Draw_CachePic ("gfx/mp_menu.lmp") );
@ -563,7 +564,7 @@ void M_Menu_GameOptions_f (void)
if (mgt == MGT_QUAKE2)
{
MC_AddCenterPicture(menu, 4, "pics/m_banner_start_server");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_start_server");
y += 8;
}
else if (mgt == MGT_HEXEN2)
@ -571,8 +572,8 @@ void M_Menu_GameOptions_f (void)
}
else
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_multi.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_multi.lmp");
}
// MC_AddPicture(menu, 72, 32, ("gfx/mp_menu.lmp") );

View File

@ -52,19 +52,19 @@ void M_Menu_Options_f (void)
mgt = M_GameType();
if (mgt == MGT_QUAKE2)
{ //q2...
MC_AddCenterPicture(menu, 4, "pics/m_banner_options");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_options");
y += 32;
}
else if (mgt == MGT_HEXEN2)
{ //h2
MC_AddPicture(menu, 16, 0, "gfx/menu/hplaque.lmp");
MC_AddCenterPicture(menu, 0, "gfx/menu/title3.lmp");
MC_AddPicture(menu, 16, 0, 35, 176, "gfx/menu/hplaque.lmp");
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title3.lmp");
y+=32;
}
else
{ //q1
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp");
}
menu->selecteditem = (union menuoption_s *)
@ -83,7 +83,8 @@ void M_Menu_Options_f (void)
MC_AddCheckBox(menu, 16, y, " HUD on left side", &cl_hudswap,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style chatting", &cl_standardchat,0);y+=8;
MC_AddCheckBox(menu, 16, y, " Old-style messages", &cl_standardmsg,0);y+=8;
y+=4;MC_AddEditCvar(menu, 16, y, " Imitate FPS", "cl_netfps"); y+=8+4;
y+=4;MC_AddEditCvar(menu, 16, y," Imitate FPS", "cl_netfps"); y+=8+4;
y+=4;MC_AddEditCvar(menu, 16, y," Auto status format", "tp_autostatus"); y+=8+4;
MC_AddConsoleCommand(menu, 16, y, " Video Options", "menu_video\n"); y+=8;
MC_AddConsoleCommand(menu, 16, y, " FPS Options", "menu_fps\n"); y+=8;
@ -271,7 +272,7 @@ void M_Menu_Audio_f (void)
if (mgt == MGT_QUAKE2)
{
MC_AddCenterPicture(menu, 4, "pics/m_banner_options");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_options");
y += 32;
}
else if (mgt == MGT_HEXEN2)
@ -279,8 +280,8 @@ void M_Menu_Audio_f (void)
}
else
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp");
}
menu->selecteditem = (union menuoption_s *)
@ -338,7 +339,7 @@ void M_Menu_Particles_f (void)
if (mgt == MGT_QUAKE2)
{
MC_AddCenterPicture(menu, 4, "pics/m_banner_options");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_options");
y += 32;
}
else if (mgt == MGT_HEXEN2)
@ -346,8 +347,8 @@ void M_Menu_Particles_f (void)
}
else
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp");
}
menu->selecteditem = (union menuoption_s *)
@ -388,18 +389,21 @@ presetinfo_t preset[] =
{"r_particlesystem", {"none", "classic", "script", "script", "script"}},
{"r_stains", {"0", "0", "0.75", "0.75", "0.75"}},
{"r_drawflat", {"1", "0", "0", "0", "0"}},
{"gl_miptexLevel", {"3", "0", "0", "0", "0"}},
{"r_nolerp", {"1", "0", "0", "0", "0"}},
{"r_nolightdir", {"1", "1", "0", "0", "0"}},
{"r_dynamic", {"0", "0", "1", "1", "1"}},
{"r_dynamic", {"0", "0", "1", "0", "0"}},
{"r_bloom", {"0", "0", "0", "0", "1"}},
{"gl_flashblend", {"0", "1", "0", "1", "2"}},
{"gl_bump", {"0", "0", "0", "1", "1"}},
{"r_skin_overlays", {"0", "0", "1", "1", "1"}},
{"gl_specular", {"0", "0", "0", "1", "1"}},
{"r_loadlit", {"0", "1", "1", "2", "2"}},
{"r_fastsky", {"1", "0", "0", "-1", "-1"}},
{"r_waterlayers", {"0", "2", "", "4", "4"}},
{"r_shadows", {"0", "0", "0", "1", "1"}},
{"r_shadow_realtime_world",{"0", "0", "0", "0", "1"}},
{"r_shadow_realtime_dlight",{"0", "0", "0", "1", "1"}},
{"gl_detail", {"0", "0", "0", "1", "1"}},
{"gl_load24bit", {"0", "0", "1", "1", "1"}},
{"r_replacemodels", {"", "", "md3 md2", "md3 md2", "md3 md2"}},
@ -441,12 +445,14 @@ void FPS_Preset_f (void)
void M_Menu_FPS_f (void)
{
char *loadlitoptions[] = {" off", " load", " generate", NULL};
char *numbervalues[] = {"0", "1", "2"};
int y = 32;
menu_t *menu;
int mgt;
int i, len;
#ifdef RGLQUAKE
extern cvar_t gl_compress, gl_detail, gl_bump, r_flashblend, r_shadow_realtime_world, gl_motionblur;
#ifdef GLQUAKE
extern cvar_t gl_compress, gl_detail, gl_bump, gl_specular, r_flashblend, r_shadow_realtime_world, r_shadow_realtime_dlight, gl_motionblur, r_nolightdir;
#endif
extern cvar_t r_stains, r_bloodstains, r_loadlits, r_dynamic, v_contentblend, show_fps;
@ -459,7 +465,7 @@ void M_Menu_FPS_f (void)
if (mgt == MGT_QUAKE2)
{
MC_AddCenterPicture(menu, 4, "pics/m_banner_options");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_options");
y += 32;
}
else if (mgt == MGT_HEXEN2)
@ -467,8 +473,8 @@ void M_Menu_FPS_f (void)
}
else
{
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp");
}
menu->selecteditem = (union menuoption_s *)
@ -480,27 +486,35 @@ void M_Menu_FPS_f (void)
len = strlen(preset[0].value[i]);
MC_AddConsoleCommand(menu, 48+8*(9-len), y, va("(preset) %s", preset[0].value[i]), va("fps_preset %s\n", preset[0].value[i])); y+=8;
}
MC_AddCheckBox(menu, 48, y, " Show FPS", &show_fps,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Content blend", &v_contentblend,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Dynamic lights", &r_dynamic,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Stainmaps", &r_stains,0);y+=8;
y+=4;MC_AddEditCvar(menu, 48, y, " Skybox", "r_skybox");y+=8;y+=4;
y+=4;MC_AddEditCvar(menu, 48, y, " Skybox", "r_skybox");y+=8;y+=4;
switch(qrenderer)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
case QR_OPENGL:
MC_AddCheckBox(menu, 48, y, " Blood stains", &r_bloodstains,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Load .lit files", &r_loadlits,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Flashblending", &r_flashblend,0);y+=8;
MC_AddCvarCombo(menu, 48, y, " Coloured lighting", &r_loadlits, loadlitoptions, numbervalues);y+=8;
MC_AddCheckBox(menu, 48, y, " 32 bit textures", &gl_load24bit,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Detail Texturing", &gl_detail,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Bumpmaps", &gl_bump,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Specular Textures", &gl_specular,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Tex Compression", &gl_compress,0);y+=8;
MC_AddCheckBox(menu, 48, y, " 32 bit textures", &gl_load24bit,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Dynamic shadows", &r_shadows,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Realtime Lights", &r_shadow_realtime_world,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Stainmaps", &r_stains,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Blood stains", &r_bloodstains,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Flat mdl Lighting", &r_nolightdir,0);y+=8;
MC_AddCheckBox(menu, 48, y, "Old Dynamic lights", &r_dynamic,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Flashblending", &r_flashblend,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Realtime DLights", &r_shadow_realtime_dlight,0);y+=8;
MC_AddCheckBox(menu, 48, y, " DLights Shadows", &r_shadow_realtime_dlight_shadows,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Realtime WLights", &r_shadow_realtime_world,0);y+=8;
MC_AddCheckBox(menu, 48, y, " World Shadows", &r_shadow_realtime_world_shadows,0);y+=8;
MC_AddCheckBox(menu, 48, y, " Waterwarp", &r_waterwarp,0);y+=8;
MC_AddSlider(menu, 48, y, " Motion blur", &gl_motionblur, 0, 0.99, 0);y+=8;
break;

View File

@ -1,6 +1,7 @@
//read menu.h
#include "quakedef.h"
#include "shader.h"
int selectitem;
menu_t *menu_script;
@ -145,6 +146,7 @@ void M_MenuS_Picture_f (void)
int x = atoi(Cmd_Argv(1));
int y = atoi(Cmd_Argv(2));
char *picname = Cmd_Argv(3);
mpic_t *p;
if (!menu_script)
{
@ -152,10 +154,14 @@ void M_MenuS_Picture_f (void)
return;
}
p = Draw_SafeCachePic(picname);
if (!p)
return;
if (!strcmp(Cmd_Argv(1), "-"))
MC_AddCenterPicture(menu_script, y, picname);
MC_AddCenterPicture(menu_script, y, p->height, picname);
else
MC_AddPicture(menu_script, x, y, picname);
MC_AddPicture(menu_script, x, y, p->width, p->height, picname);
}
void M_MenuS_Edit_f (void)

View File

@ -2,6 +2,7 @@
#include "quakedef.h"
#include "winquake.h"
#include "shader.h"
#ifndef CLIENTONLY
//=============================================================================
/* LOAD/SAVE MENU */
@ -79,7 +80,7 @@ void M_Menu_Save_f (void)
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1;
MC_AddCenterPicture (menu, 4, "gfx/p_save.lmp");
MC_AddCenterPicture (menu, 4, 24, "gfx/p_save.lmp");
menu->cursoritem = (menuoption_t *)MC_AddRedText(menu, 8, 32, NULL, false);
M_ScanSaves ();
@ -103,7 +104,7 @@ void M_Menu_Load_f (void)
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1;
MC_AddCenterPicture(menu, 4, "gfx/p_load.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_load.lmp");
menu->cursoritem = (menuoption_t *)MC_AddRedText(menu, 8, 32, NULL, false);
M_ScanSaves ();
@ -124,22 +125,31 @@ void M_Menu_Load_f (void)
void M_Menu_SinglePlayer_f (void)
{
int mgt;
#ifndef CLIENTONLY
menubutton_t *b;
#endif
menu_t *menu;
#ifndef CLIENTONLY
int mgt;
menubutton_t *b;
mpic_t *p;
#endif
key_dest = key_menu;
m_state = m_complex;
#ifdef CLIENTONLY
menu = M_CreateMenu(0);
MC_AddWhiteText(menu, 84, 12*8, "This build is unable", false);
MC_AddWhiteText(menu, 84, 13*8, "to start a local game", false);
MC_AddBox (menu, 60, 10*8, 25, 4);
#else
mgt = M_GameType();
if (mgt == MGT_QUAKE2)
{ //q2...
menu = M_CreateMenu(0);
MC_AddCenterPicture(menu, 4, "pics/m_banner_game");
MC_AddCenterPicture(menu, 4, 24, "pics/m_banner_game");
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommand (menu, 64, 40, "Easy", "skill 0;deathmatch 0; coop 0;newgame\n");
@ -174,8 +184,8 @@ void M_Menu_SinglePlayer_f (void)
NULL
};
menu = M_CreateMenu(0);
MC_AddPicture(menu, 16, 0, "gfx/menu/hplaque.lmp");
MC_AddCenterPicture(menu, 0, "gfx/menu/title1.lmp");
MC_AddPicture(menu, 16, 0, 35, 176, "gfx/menu/hplaque.lmp");
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title1.lmp");
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommand (menu, 64, 64, "Easy", "closemenu\nskill 0;deathmatch 0; coop 0;map demo1\n");
@ -194,8 +204,8 @@ void M_Menu_SinglePlayer_f (void)
else if (QBigFontWorks())
{
menu = M_CreateMenu(0);
MC_AddPicture(menu, 16, 0, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 0, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 0, 24, "gfx/p_option.lmp");
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommandQBigFont (menu, 72, 32, "New Game", "closemenu\nmaxclients 1;deathmatch 0;coop 0;map start\n");
@ -208,8 +218,8 @@ void M_Menu_SinglePlayer_f (void)
else
{ //q1
menu = M_CreateMenu(0);
MC_AddPicture(menu, 16, 4, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, "gfx/p_option.lmp");
MC_AddPicture(menu, 16, 4, 32, 144, "gfx/qplaque.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/p_option.lmp");
}
p = Draw_SafeCachePic("gfx/sp_menu.lmp");
@ -222,28 +232,22 @@ void M_Menu_SinglePlayer_f (void)
}
else
{
#ifdef CLIENTONLY
MC_AddWhiteText(menu, 92, 12*8, "QuakeWorld is for", false);
MC_AddWhiteText(menu, 92, 13*8, "Internet play only", false);
MC_AddPicture(menu, 72, 32, 232, 64, "gfx/sp_menu.lmp");
MC_AddBox (menu, 60, 10*8, 23, 4);
#else
MC_AddPicture(menu, 72, 32, "gfx/sp_menu.lmp");
b = MC_AddConsoleCommand (menu, 16, 32, "", "closemenu\nmaxclients 1;deathmatch 0;coop 0;map start\n");
menu->selecteditem = (menuoption_t *)b;
b->common.width = p->width;
b->common.height = 20;
b = MC_AddConsoleCommand (menu, 16, 52, "", "menu_load\n");
b->common.width = p->width;
b->common.height = 20;
b = MC_AddConsoleCommand (menu, 16, 72, "", "menu_save\n");
b->common.width = p->width;
b->common.height = 20;
b = MC_AddConsoleCommand (menu, 16, 32, "", "closemenu\nmaxclients 1;deathmatch 0;coop 0;map start\n");
menu->selecteditem = (menuoption_t *)b;
b->common.width = p->width;
b->common.height = 20;
b = MC_AddConsoleCommand (menu, 16, 52, "", "menu_load\n");
b->common.width = p->width;
b->common.height = 20;
b = MC_AddConsoleCommand (menu, 16, 72, "", "menu_save\n");
b->common.width = p->width;
b->common.height = 20;
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, 54, 32);
#endif
menu->cursoritem = (menuoption_t*)MC_AddCursor(menu, 54, 32);
}
#endif
}
@ -312,9 +316,9 @@ static void M_DemoDraw(int x, int y, menucustom_t *control, menu_t *menu)
else
text = item->name+info->pathlen;
if (item == info->selected)
Draw_Alt_String(x, y+8, text);
Draw_AltFunString(x, y+8, text);
else
Draw_String(x, y+8, text);
Draw_FunString(x, y+8, text);
y+=8;
item = item->next;
}

View File

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "winquake.h"
#include "shader.h"
void M_Menu_Audio_f (void);
void M_Menu_Demos_f (void);
@ -47,60 +48,17 @@ cvar_t m_helpismedia = SCVAR("m_helpismedia", "0");
//=============================================================================
/* Support Routines */
/*
================
M_DrawCharacter
Draws one solid graphics character
================
*/
void M_DrawCharacter (int cx, int line, unsigned int num)
{
Draw_Character ( cx + ((vid.width - 320)>>1), line, num);
}
void M_DrawColouredCharacter (int cx, int line, unsigned int num)
{
Draw_ColouredCharacter( cx + ((vid.width - 320)>>1), line, num);
}
void M_Print (int cx, int cy, qbyte *str)
{
while (*str)
{
M_DrawCharacter (cx, cy, (*str)|CON_HIGHCHARSMASK);
str++;
cx += 8;
}
Draw_AltFunString(cx + ((vid.width - 320)>>1), cy, str);
}
void M_PrintColoured (int cx, int cy, int colour, qbyte *str)
{
while (*str)
{
M_DrawColouredCharacter (cx, cy, (*str) + (colour<<CON_FGSHIFT));
str++;
cx += 8;
}
}
void M_PrintWhite (int cx, int cy, qbyte *str)
{
while (*str)
{
M_DrawCharacter (cx, cy, *str);
str++;
cx += 8;
}
Draw_FunString(cx + ((vid.width - 320)>>1), cy, str);
}
void M_DrawTransPic (int x, int y, mpic_t *pic)
void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic)
{
Draw_TransPic (x + ((vid.width - 320)>>1), y, pic);
}
void M_DrawPic (int x, int y, mpic_t *pic)
{
Draw_Pic (x + ((vid.width - 320)>>1), y, pic);
Draw_ScalePic (x + ((vid.width - 320)>>1), y, w, h, pic);
}
qbyte identityTable[256];
@ -149,17 +107,17 @@ void M_DrawTextBox (int x, int y, int width, int lines)
p = Draw_SafeCachePic ("gfx/box_tl.lmp");
if (!p)
return; //assume we can't find any
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 8, 8, p);
p = Draw_SafeCachePic ("gfx/box_ml.lmp");
if (p)
for (n = 0; n < lines; n++)
{
cy += 8;
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 8, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_bl.lmp");
if (p)
M_DrawTransPic (cx, cy+8, p);
M_DrawScalePic (cx, cy+8, 8, 8, p);
// draw middle
cx += 8;
@ -168,7 +126,7 @@ void M_DrawTextBox (int x, int y, int width, int lines)
cy = y;
p = Draw_SafeCachePic ("gfx/box_tm.lmp");
if (p)
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 16, 8, p);
p = Draw_SafeCachePic ("gfx/box_mm.lmp");
if (p)
for (n = 0; n < lines; n++)
@ -180,11 +138,11 @@ void M_DrawTextBox (int x, int y, int width, int lines)
if (!p)
break;
}
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 16, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_bm.lmp");
if (p)
M_DrawTransPic (cx, cy+8, p);
M_DrawScalePic (cx, cy+8, 16, 8, p);
width -= 2;
cx += 16;
}
@ -193,17 +151,17 @@ void M_DrawTextBox (int x, int y, int width, int lines)
cy = y;
p = Draw_SafeCachePic ("gfx/box_tr.lmp");
if (p)
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 8, 8, p);
p = Draw_SafeCachePic ("gfx/box_mr.lmp");
if (p)
for (n = 0; n < lines; n++)
{
cy += 8;
M_DrawTransPic (cx, cy, p);
M_DrawScalePic (cx, cy, 8, 8, p);
}
p = Draw_SafeCachePic ("gfx/box_br.lmp");
if (p)
M_DrawTransPic (cx, cy+8, p);
M_DrawScalePic (cx, cy+8, 8, 8, p);
}
//=============================================================================
@ -235,6 +193,10 @@ void M_ToggleMenu_f (void)
if (MP_Toggle())
return;
#endif
#ifdef VM_UI
if (UI_OpenMenu())
return;
#endif
if (key_dest == key_menu)
{
@ -255,39 +217,6 @@ void M_ToggleMenu_f (void)
}
}
//=============================================================================
/* OPTIONS MENU */
#define SLIDER_RANGE 10
void M_DrawSlider (int x, int y, float range)
{
int i;
if (range < 0)
range = 0;
if (range > 1)
range = 1;
M_DrawCharacter (x-8, y, 128);
for (i=0 ; i<SLIDER_RANGE ; i++)
M_DrawCharacter (x + i*8, y, 129);
M_DrawCharacter (x+i*8, y, 130);
M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
}
void M_DrawCheckbox (int x, int y, int on)
{
#if 0
if (on)
M_DrawCharacter (x, y, 131);
else
M_DrawCharacter (x, y, 129);
#endif
if (on)
M_Print (x, y, "on");
else
M_Print (x, y, "off");
}
//=============================================================================
/* KEYS MENU */
@ -418,7 +347,7 @@ void M_Menu_Keys_f (void)
menu = M_CreateMenu(0);
MC_AddCenterPicture(menu, 4, "gfx/ttl_cstm.lmp");
MC_AddCenterPicture(menu, 4, 24, "gfx/ttl_cstm.lmp");
mgt = M_GameType();
#ifdef Q2CLIENT
@ -486,121 +415,6 @@ void M_UnbindCommand (char *command)
}
}
void M_Keys_Draw (void)
{
int i, l;
int keys[2];
char *name;
int x, y;
mpic_t *p;
p = Draw_SafeCachePic ("gfx/ttl_cstm.lmp");
if (p)
M_DrawPic ( (320-p->width)/2, 4, p);
if (bind_grab)
M_Print (12, 32, "Press a key or button for this action");
else
M_Print (18, 32, "Enter to change, backspace to clear");
// search for known bindings
for (i=0 ; ; i++)
{
if (!bindnames[i].command)
break;
y = 48 + 8*i;
M_Print (16, y, bindnames[i].name);
l = strlen (bindnames[i].command);
M_FindKeysForCommand (bindnames[i].command, keys);
if (keys[0] == -1)
{
M_Print (140, y, "???");
}
else
{
name = Key_KeynumToString (keys[0]);
M_Print (140, y, name);
x = strlen(name) * 8;
if (keys[1] != -1)
{
M_Print (140 + x + 8, y, "or");
M_Print (140 + x + 32, y, Key_KeynumToString (keys[1]));
}
}
}
if (bind_grab)
M_DrawCharacter (130, 48 + keys_cursor*8, '=');
else
M_DrawCharacter (130, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
}
void M_Keys_Key (int k)
{
char cmd[80];
int keys[2];
if (bind_grab)
{ // defining a key
S_LocalSound ("misc/menu1.wav");
if (k == K_ESCAPE)
{
bind_grab = false;
}
else if (k != '`')
{
sprintf (cmd, "bind %s \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor].command);
Cbuf_InsertText (cmd, RESTRICT_LOCAL, false);
}
bind_grab = false;
return;
}
switch (k)
{
case K_ESCAPE:
M_Menu_Options_f ();
break;
case K_LEFTARROW:
case K_UPARROW:
S_LocalSound ("misc/menu1.wav");
keys_cursor--;
if (keys_cursor < 0)
keys_cursor = numbindnames-1;
break;
case K_DOWNARROW:
case K_RIGHTARROW:
S_LocalSound ("misc/menu1.wav");
keys_cursor++;
if (keys_cursor >= numbindnames)
keys_cursor = 0;
break;
case K_ENTER: // go into bind mode
M_FindKeysForCommand (bindnames[keys_cursor].command, keys);
S_LocalSound ("misc/menu2.wav");
if (keys[1] != -1)
M_UnbindCommand (bindnames[keys_cursor].command);
bind_grab = true;
break;
case K_BACKSPACE: // delete bindings
case K_DEL: // delete bindings
S_LocalSound ("misc/menu2.wav");
M_UnbindCommand (bindnames[keys_cursor].command);
break;
}
}
//=============================================================================
/* HELP MENU */
@ -639,7 +453,7 @@ void M_Help_Draw (void)
if (!pic)
M_Menu_Main_f ();
else
M_DrawPic (0, 0, pic);
M_DrawScalePic (0, 0, 320, 200, pic);
}
@ -974,7 +788,6 @@ void M_DeInit_Internal (void)
#endif
Cmd_RemoveCommand ("menu_setup");
Cmd_RemoveCommand ("menu_newmulti");
Cmd_RemoveCommand ("menu_main"); //I've moved main to last because that way tab give us main and not quit.
Cmd_RemoveCommand ("menu_options");
Cmd_RemoveCommand ("menu_video");
@ -986,6 +799,8 @@ void M_DeInit_Internal (void)
Cmd_RemoveCommand ("menu_download");
Cmd_RemoveCommand ("menu_main"); //I've moved main to last because that way tab give us main and not quit.
Cmd_RemoveCommand ("quickconnect");
}
@ -1043,15 +858,13 @@ void M_Draw (int uimenu)
m_recursiveDraw = false;
}
Draw_ImageColours(1, 1, 1, 1);
switch (m_state)
{
case m_none:
break;
case m_keys:
M_Keys_Draw ();
break;
case m_help:
M_Help_Draw ();
break;
@ -1089,10 +902,6 @@ void M_Keydown (int key, int unicode)
key_dest = key_console;
return;
case m_keys:
M_Keys_Key (key);
return;
case m_help:
M_Help_Key (key);
return;
@ -1106,7 +915,7 @@ void M_Keydown (int key, int unicode)
return;
case m_complex:
M_Complex_Key (key);
M_Complex_Key (key, unicode);
return;
#ifdef PLUGINS
case m_plugin:
@ -1145,6 +954,7 @@ void M_Keyup (int key, int unicode)
int M_GameType (void)
{
int cached;
#if defined(Q2CLIENT)
int q1, h2, q2;
q1 = COM_FDepthFile("gfx/sp_menu.lmp", true);
@ -1156,6 +966,7 @@ int M_GameType (void)
else if (h2 < q1)
cached = MGT_HEXEN2;
else
#endif
cached = MGT_QUAKE1;
return cached;

View File

@ -74,7 +74,7 @@ void M_SomeMenuConsoleCommand_f (void)
int y = 32;
//add the title
MC_AddCenterPicture(m, 4, "gfx/p_option.lmp");
MC_AddCenterPicture(m, 4, 24, "gfx/p_option.lmp");
//add the blinking > thingie
//(note NULL instead of a valid string, this should really be a variant of mt_menudot instead)
@ -113,7 +113,7 @@ void M_Menu_Quit_f (void);
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;
typedef enum {m_none, m_complex, m_help, m_slist, m_media, m_plugin, m_menu_dat} m_state_t;
extern m_state_t m_state;
typedef enum {
@ -132,7 +132,6 @@ typedef enum {
mt_checkbox,
mt_picture,
mt_picturesel,
mt_strechpic,
mt_menudot,
mt_custom
} menutype_t;
@ -284,10 +283,9 @@ menutext_t *MC_AddRedText(menu_t *menu, int x, int y, const char *text, qboolean
menutext_t *MC_AddWhiteText(menu_t *menu, int x, int y, const char *text, qboolean rightalign);
menubind_t *MC_AddBind(menu_t *menu, int x, int y, const char *caption, char *command);
menubox_t *MC_AddBox(menu_t *menu, int x, int y, int width, int height);
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, char *picname);
menupicture_t *MC_AddPicture(menu_t *menu, int x, int y, int width, int height, char *picname);
menupicture_t *MC_AddSelectablePicture(menu_t *menu, int x, int y, char *picname);
menupicture_t *MC_AddStrechPicture(menu_t *menu, int x, int y, int width, int height, char *picname);
menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, char *picname);
menupicture_t *MC_AddCenterPicture(menu_t *menu, int y, int height, char *picname);
menupicture_t *MC_AddCursor(menu_t *menu, int x, int y);
menuslider_t *MC_AddSlider(menu_t *menu, int x, int y, const char *text, cvar_t *var, float min, float max, float delta);
menucheck_t *MC_AddCheckBox(menu_t *menu, int x, int y, const char *text, cvar_t *var, int cvarbitmask);
@ -311,9 +309,7 @@ void M_HideMenu (menu_t *menu);
void M_RemoveMenu (menu_t *menu);
void M_RemoveAllMenus (void);
void DrawCursor(void);
void M_Complex_Key(int key);
void M_Complex_Key(int key, int unicode);
void M_Complex_Draw(void);
void M_Script_Init(void);
void M_Serverlist_Init(void);
@ -346,7 +342,6 @@ void M_Main_Draw (void);
void M_Setup_Draw (void);
void M_Net_Draw (void);
void M_Options_Draw (void);
void M_Keys_Draw (void);
void M_Video_Draw (void);
void M_Help_Draw (void);
void M_Quit_Draw (void);
@ -366,7 +361,6 @@ void M_Main_Key (int key);
void M_Setup_Key (int key);
void M_Net_Key (int key);
void M_Options_Key (int key);
void M_Keys_Key (int key);
void M_Video_Key (int key);
void M_Help_Key (int key);
void M_Quit_Key (int key);
@ -384,12 +378,11 @@ void M_SListKey(int key);
//drawing funcs
void M_BuildTranslationTable(int top, int bottom);
void M_DrawTransPicTranslate (int x, int y, mpic_t *pic);
void M_DrawTransPic (int x, int y, mpic_t *pic);
FTE_DEPRECATED void M_DrawTransPicTranslate (int x, int y, mpic_t *pic);
void M_DrawCharacter (int cx, int line, unsigned int num);
void M_Print (int cx, int cy, qbyte *str);
void M_PrintWhite (int cx, int cy, qbyte *str);
void M_DrawPic (int x, int y, mpic_t *pic);
void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic);
void M_FindKeysForCommand (char *command, int *twokeys);

View File

@ -52,24 +52,15 @@ extern r_qrenderer_t qrenderer;
extern char *q_renderername;
extern mpic_t *(*Draw_SafePicFromWad) (char *name);
extern mpic_t *(*Draw_CachePic) (char *path);
extern mpic_t *(*Draw_SafeCachePic) (char *path);
extern void (*Draw_Init) (void);
extern void (*Draw_ReInit) (void);
extern void (*Draw_Character) (int x, int y, unsigned int num);
extern void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
extern void (*Draw_ColouredCharacter) (int x, int y, unsigned int num);
extern void (*Draw_String) (int x, int y, const qbyte *str);
extern void (*Draw_Alt_String) (int x, int y, const qbyte *str);
extern void (*Draw_Crosshair) (void);
extern void (*Draw_DebugChar) (qbyte num);
extern void (*Draw_Pic) (int x, int y, mpic_t *pic);
extern void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
extern void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
extern void (*Draw_TransPic) (int x, int y, mpic_t *pic);
extern void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
extern void (*Draw_TransPicTranslate) (int x, int y, int width, int height, qbyte *image, qbyte *translation);
extern void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque);
extern void (*Draw_EditorBackground) (int lines);
extern void (*Draw_EditorBackground) (void);
extern void (*Draw_TileClear) (int x, int y, int w, int h);
extern void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c);
extern void (*Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b);
@ -83,12 +74,8 @@ extern void (*Draw_ImageColours) (float r, float g, float b, float a);
extern void (*R_Init) (void);
extern void (*R_DeInit) (void);
extern void (*R_ReInit) (void);
extern void (*R_RenderView) (void); // must set r_refdef first
extern qboolean (*R_CheckSky) (void);
extern void (*R_SetSky) (char *name, float rotate, vec3_t axis);
extern void (*R_NewMap) (void);
extern void (*R_PreNewMap) (void);
extern int (*R_LightPoint) (vec3_t point);
@ -96,7 +83,6 @@ extern int (*R_LightPoint) (vec3_t point);
extern void (*R_PushDlights) (void);
extern void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius);
extern void (*R_LessenStains) (void);
extern void (*R_DrawWaterSurfaces) (void);
extern void (*Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up...
extern void (*Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down
@ -151,8 +137,9 @@ int Mod_GetBoneRelations(struct model_s *model, int firstbone, int lastbone, fra
int Mod_GetBoneParent(struct model_s *model, int bonenum);
char *Mod_GetBoneName(struct model_s *model, int bonenum);
void Draw_FunString(int x, int y, unsigned char *str);
void Draw_FunStringLen(int x, int y, unsigned char *str, int len);
void Draw_FunString(int x, int y, const unsigned char *str);
void Draw_AltFunString(int x, int y, const unsigned char *str);
void Draw_FunStringWidth(int x, int y, const unsigned char *str, int width);
#ifdef SERVERONLY
@ -168,24 +155,15 @@ typedef struct {
r_qrenderer_t rtype;
mpic_t *(*Draw_SafePicFromWad) (char *name);
mpic_t *(*Draw_CachePic) (char *path);
mpic_t *(*Draw_SafeCachePic) (char *path);
void (*Draw_Init) (void);
void (*Draw_ReInit) (void);
void (*Draw_Character) (int x, int y, unsigned int num);
void (*Draw_ColouredCharacter) (int x, int y, unsigned int num);
void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
void (*Draw_String) (int x, int y, const qbyte *str);
void (*Draw_Alt_String) (int x, int y, const qbyte *str);
void (*Draw_Shutdown) (void);
void (*Draw_Crosshair) (void);
void (*Draw_DebugChar) (qbyte num);
void (*Draw_Pic) (int x, int y, mpic_t *pic);
void (*Draw_ScalePic) (int x, int y, int width, int height, mpic_t *pic);
void (*Draw_SubPic) (int x, int y, mpic_t *pic, int srcx, int srcy, int width, int height);
void (*Draw_TransPic) (int x, int y, mpic_t *pic);
void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
void (*Draw_TransPicTranslate) (int x, int y, int w, int h, qbyte *pic, qbyte *translation);
void (*Draw_ConsoleBackground) (int firstline, int lastline, qboolean forceopaque);
void (*Draw_EditorBackground) (int lines);
void (*Draw_EditorBackground) (void);
void (*Draw_TileClear) (int x, int y, int w, int h);
void (*Draw_Fill) (int x, int y, int w, int h, unsigned int c);
void (*Draw_FillRGB) (int x, int y, int w, int h, float r, float g, float b);
@ -198,12 +176,8 @@ typedef struct {
void (*R_Init) (void);
void (*R_DeInit) (void);
void (*R_ReInit) (void);
void (*R_RenderView) (void); // must set r_refdef first
qboolean (*R_CheckSky) (void);
void (*R_SetSky) (char *name, float rotate, vec3_t axis);
void (*R_NewMap) (void);
void (*R_PreNewMap) (void);
int (*R_LightPoint) (vec3_t point);

View File

@ -584,7 +584,7 @@ void Master_AddMaster (char *address, int type, char *description)
#pragma message("Master_AddMaster: add ipv6. don't care about tcp/irc.")
if (adr.type != NA_IP && adr.type != NA_IPX)
{
Con_Printf("Fixme: unable to poll address family\n", address);
Con_Printf("Fixme: unable to poll address family for \"%s\"\n", address);
return;
}

View File

@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef PSET_CLASSIC
#include "glquake.h"
#include "shader.h"
#include "renderque.h"
void D_DrawParticleTrans (vec3_t porg, float palpha, float pscale, unsigned int pcolour, blendmode_t blendmode);
@ -51,8 +53,14 @@ typedef enum {
} effect_type_t;
typedef struct cparticle_s {
enum {
typedef struct cparticle_s
{
avec3_t org;
float die;
avec3_t vel;
float ramp;
enum
{
pt_static,
pt_fire,
pt_explode,
@ -62,10 +70,6 @@ typedef struct cparticle_s {
pt_grav,
pt_slowgrav
} type;
float die;
vec3_t org;
vec3_t vel;
float ramp;
unsigned char color;
struct cparticle_s *next;
} cparticle_t;
@ -81,6 +85,21 @@ static int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
static int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
#define BUFFERVERTS 2048*3
static vecV_t classicverts[BUFFERVERTS];
static union c
{
byte_vec4_t b;
unsigned int i;
} classiccolours[BUFFERVERTS];
static vec2_t classictexcoords[BUFFERVERTS];
index_t classicindexes[BUFFERVERTS];
static mesh_t classicmesh;
static shader_t *classicshader;
//obtains an index for the name, even if it is unknown (one can be loaded after. will only fail if the effect limit is reached)
//technically this function is not meant to fail often, but thats fine so long as the other functions are meant to safely reject invalid effect numbers.
static int PClassic_ParticleTypeForName(char *name)
@ -172,10 +191,13 @@ static void PClassic_InitParticles (void)
extern model_t mod_known[];
extern int mod_numknown;
if ((i = COM_CheckParm ("-particles")) && i + 1 < com_argc) {
if ((i = COM_CheckParm ("-particles")) && i + 1 < com_argc)
{
r_numparticles = (int) (Q_atoi(com_argv[i + 1]));
r_numparticles = bound(ABSOLUTE_MIN_PARTICLES, r_numparticles, ABSOLUTE_MAX_PARTICLES);
} else {
}
else
{
r_numparticles = DEFAULT_NUM_PARTICLES;
}
@ -191,6 +213,31 @@ static void PClassic_InitParticles (void)
P_DefaultTrail(mod);
}
for (i = 0; i < BUFFERVERTS; i += 3)
{
classictexcoords[i+1][0] = 1;
classictexcoords[i+2][1] = 1;
classicindexes[i+0] = i+0;
classicindexes[i+1] = i+1;
classicindexes[i+2] = i+2;
}
classicmesh.xyz_array = classicverts;
classicmesh.st_array = classictexcoords;
classicmesh.colors4b_array = (byte_vec4_t*)classiccolours;
classicmesh.indexes = classicindexes;
classicshader = R_RegisterShader("particles_classic",
"{\n"
"{\n"
"map $diffuse\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"blendfunc blend\n"
"}\n"
"}\n"
);
classicshader->defaulttextures.base = particlecqtexture;
}
static void PClassic_ShutdownParticles(void)
@ -217,87 +264,27 @@ static void PClassic_ClearParticles (void)
particles[r_numparticles - 1].next = NULL;
}
#define USEARRAYS
#define BUFFERVERTS 2048*3
vec3_t classicverts[BUFFERVERTS];
union c
{
byte_vec4_t b;
unsigned int i;
} classiccolours[BUFFERVERTS];
vec2_t classictexcoords[BUFFERVERTS];
int classicnumverts;
int setuptexcoords;
//draws all the active particles.
static void PClassic_DrawParticles(void)
{
RSpeedLocals();
cparticle_t *p, *kill;
int i;
float time2, time3, time1, dvel, frametime, grav;
#ifdef RGLQUAKE
#ifndef USEARRAYS
unsigned char *at, theAlpha;
#endif
vec3_t up, right;
float dist, scale, r_partscale=0;
union c usecolours;
#endif
RSpeedMark();
RQ_RenderDistAndClear();
if (!active_particles)
{
RQ_RenderDistAndClear();
return;
}
switch(qrenderer)
{
#ifdef RGLQUAKE
case QR_OPENGL:
r_partscale = 0.004 * tan (r_refdef.fov_x * (M_PI / 180) * 0.5f);
GL_Bind(particlecqtexture);
qglEnable (GL_BLEND);
if (!gl_solidparticles.value)
qglDepthMask (GL_FALSE);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
#ifdef USEARRAYS
if (!setuptexcoords)
{
setuptexcoords = true;
for (i = 0; i < BUFFERVERTS; i += 3)
{
classictexcoords[i+1][0] = 1;
classictexcoords[i+2][1] = 1;
}
}
qglTexCoordPointer(2, GL_FLOAT, 0, classictexcoords);
qglVertexPointer(3, GL_FLOAT, 0, classicverts);
qglColorPointer(4, GL_UNSIGNED_BYTE, 0, classiccolours);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglEnableClientState(GL_COLOR_ARRAY);
qglEnableClientState(GL_VERTEX_ARRAY);
#else
qglBegin (GL_TRIANGLES);
#endif
VectorScale (vup, 1.5, up);
VectorScale (vright, 1.5, right);
classicnumverts = 0;
break;
#endif
default:
RQ_RenderDistAndClear();
return;
}
r_partscale = 0.004 * tan (r_refdef.fov_x * (M_PI / 180) * 0.5f);
VectorScale (vup, 1.5, up);
VectorScale (vright, 1.5, right);
frametime = host_frametime;
if (cl.paused)
@ -336,54 +323,36 @@ static void PClassic_DrawParticles(void)
break;
}
switch(qrenderer)
if (classicmesh.numvertexes >= BUFFERVERTS-3)
{
#ifdef RGLQUAKE
case QR_OPENGL:
#ifdef USEARRAYS
if (classicnumverts >= BUFFERVERTS-3)
{
qglDrawArrays(GL_TRIANGLES, 0, classicnumverts);
classicnumverts = 0;
}
#endif
// hack a scale up to keep particles from disapearing
dist = (p->org[0] - r_origin[0]) * vpn[0] + (p->org[1] - r_origin[1]) * vpn[1] + (p->org[2] - r_origin[2]) * vpn[2];
scale = 1 + dist * r_partscale;
#ifdef USEARRAYS
usecolours.i = d_8to24rgbtable[(int)p->color];
if (p->type == pt_fire)
usecolours.b[3] = 255 * (6 - p->ramp) / 6;
else
usecolours.b[3] = 255;
classiccolours[classicnumverts].i = usecolours.i;
VectorCopy(p->org, classicverts[classicnumverts]);
classicnumverts++;
classiccolours[classicnumverts].i = usecolours.i;
VectorMA(p->org, scale, up, classicverts[classicnumverts]);
classicnumverts++;
classiccolours[classicnumverts].i = usecolours.i;
VectorMA(p->org, scale, right, classicverts[classicnumverts]);
classicnumverts++;
#else
at = (qbyte *) &d_8to24rgbtable[(int)p->color];
if (p->type == pt_fire)
theAlpha = 255 * (6 - p->ramp) / 6;
else
theAlpha = 255;
qglColor4ub (*at, *(at + 1), *(at + 2), theAlpha);
qglTexCoord2f (0, 0); qglVertex3fv (p->org);
qglTexCoord2f (1, 0); qglVertex3f (p->org[0] + up[0] * scale, p->org[1] + up[1] * scale, p->org[2] + up[2] * scale);
qglTexCoord2f (0, 1); qglVertex3f (p->org[0] + right[0] * scale, p->org[1] + right[1] * scale, p->org[2] + right[2] * scale);
#endif
break;
#endif
classicmesh.numindexes = classicmesh.numvertexes;
BE_DrawMeshChain(classicshader, &classicmesh, NULL, &classicshader->defaulttextures);
classicmesh.numvertexes = 0;
}
// hack a scale up to keep particles from disapearing
dist = (p->org[0] - r_origin[0]) * vpn[0] + (p->org[1] - r_origin[1]) * vpn[1] + (p->org[2] - r_origin[2]) * vpn[2];
scale = 1 + dist * r_partscale;
usecolours.i = d_8to24rgbtable[(int)p->color];
if (p->type == pt_fire)
usecolours.b[3] = 255 * (6 - p->ramp) / 6;
else
usecolours.b[3] = 255;
classiccolours[classicmesh.numvertexes].i = usecolours.i;
VectorCopy(p->org, classicverts[classicmesh.numvertexes]);
classicmesh.numvertexes++;
classiccolours[classicmesh.numvertexes].i = usecolours.i;
VectorMA(p->org, scale, up, classicverts[classicmesh.numvertexes]);
classicmesh.numvertexes++;
classiccolours[classicmesh.numvertexes].i = usecolours.i;
VectorMA(p->org, scale, right, classicverts[classicmesh.numvertexes]);
classicmesh.numvertexes++;
p->org[0] += p->vel[0] * frametime;
p->org[1] += p->vel[1] * frametime;
p->org[2] += p->vel[2] * frametime;
@ -437,44 +406,16 @@ static void PClassic_DrawParticles(void)
}
}
switch(qrenderer)
if (classicmesh.numvertexes)
{
#ifdef RGLQUAKE
case QR_OPENGL:
#ifdef USEARRAYS
if (classicnumverts)
{
qglDrawArrays(GL_TRIANGLES, 0, classicnumverts);
classicnumverts = 0;
}
#else
qglEnd ();
#endif
qglDisable (GL_BLEND);
qglDepthMask (GL_TRUE);
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
qglColor3ub (255, 255, 255);
break;
#endif
default:
break;
classicmesh.numindexes = classicmesh.numvertexes;
BE_DrawMeshChain(classicshader, &classicmesh, NULL, &classicshader->defaulttextures);
classicmesh.numvertexes = 0;
}
RSpeedRemark();
RQ_RenderDistAndClear();
RSpeedEnd(RSPEED_PARTICLESDRAW);
}
//called to set up the rendering state (opengl)
static void PClassic_FlushRenderer(void)
{
}
static void Classic_ParticleExplosion (vec3_t org)
{
@ -677,7 +618,8 @@ static void Classic_ParticleTrail (vec3_t start, vec3_t end, vec3_t *trail_origi
goto done;
VectorScale(delta, 1 / len, dir); //unit vector in direction of trail
switch (type) {
switch (type)
{
case ALT_ROCKET_TRAIL:
len /= 1.5; break;
case BLOOD_TRAIL:
@ -691,7 +633,8 @@ static void Classic_ParticleTrail (vec3_t start, vec3_t end, vec3_t *trail_origi
VectorScale (delta, 1.0 / num_particles, delta);
for (i = 0; i < num_particles && free_particles; i++) {
for (i = 0; i < num_particles && free_particles; i++)
{
p = free_particles;
free_particles = p->next;
p->next = active_particles;
@ -700,7 +643,8 @@ static void Classic_ParticleTrail (vec3_t start, vec3_t end, vec3_t *trail_origi
VectorClear (p->vel);
p->die = cl.time + 2;
switch(type) {
switch(type)
{
case GRENADE_TRAIL:
p->ramp = (rand() & 3) + 2;
p->color = ramp3[(int) p->ramp];
@ -732,10 +676,13 @@ static void Classic_ParticleTrail (vec3_t start, vec3_t end, vec3_t *trail_origi
tracercount++;
VectorCopy (point, p->org);
if (tracercount & 1) {
if (tracercount & 1)
{
p->vel[0] = 90 * dir[1];
p->vel[1] = 90 * -dir[0];
} else {
}
else
{
p->vel[0] = 90 * -dir[1];
p->vel[1] = 90 * dir[0];
}
@ -837,8 +784,7 @@ particleengine_t pe_classic =
PClassic_ShutdownParticles,
PClassic_DelinkTrailstate,
PClassic_ClearParticles,
PClassic_DrawParticles,
PClassic_FlushRenderer
PClassic_DrawParticles
};
#endif

View File

@ -2,6 +2,7 @@
#include "glquake.h"
#include "particles.h"
#include "renderque.h"
//obtains an index for the name, even if it is unknown (one can be loaded after. will only fail if the effect limit is reached)
static int PNULL_ParticleTypeForName(char *name)
@ -46,14 +47,9 @@ static void PNULL_DrawParticles(void)
RSpeedLocals();
RSpeedRemark();
#ifdef GLQUAKE
RQ_RenderDistAndClear();
#endif
RSpeedEnd(RSPEED_PARTICLESDRAW);
}
static void PNULL_FlushRenderer(void)
{
}
particleengine_t pe_null =
@ -80,6 +76,5 @@ particleengine_t pe_null =
PNULL_ShutdownParticles,
PNULL_DelinkTrailstate,
PNULL_ClearParticles,
PNULL_DrawParticles,
PNULL_FlushRenderer
PNULL_DrawParticles
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,10 @@
#ifdef MENU_DAT
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"
#ifdef Q3SHADERS
#endif
#include "shader.h"
#endif
#endif
#include "pr_common.h"
@ -349,8 +347,7 @@ void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float alpha = G_FLOAT(OFS_PARM4);
// float flag = G_FLOAT(OFS_PARM5);
const float fsize = 0.0625;
float frow, fcol;
int x, y;
if (!chara)
{
@ -358,14 +355,12 @@ void PF_CL_drawcharacter (progfuncs_t *prinst, struct globalvars_s *pr_globals)
return;
}
chara &= 255;
frow = (chara>>4)*fsize;
fcol = (chara&15)*fsize;
if (Draw_ImageColours)
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
if (Draw_Image)
Draw_Image(pos[0], pos[1], size[0], size[1], fcol, frow, fcol+fsize, frow+fsize, Draw_CachePic("conchars"));
#pragma message("fixme: this doesn't scale or colour chars")
Font_BeginString(font_conchar, pos[0], pos[1], &x, &y);
Font_ForceColour(rgb[0], rgb[1], rgb[2], alpha);
Font_DrawChar(x, y, 0xe000|(chara&0xff));
Font_ForceColour(1, 1, 1, 1);
Font_EndString(font_conchar);
G_FLOAT(OFS_RETURN) = 1;
}
@ -375,9 +370,10 @@ void PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float *pos = G_VECTOR(OFS_PARM0);
char *text = PR_GetStringOfs(prinst, OFS_PARM1);
float *size = G_VECTOR(OFS_PARM2);
// float *rgb = G_VECTOR(OFS_PARM3);
// float alpha = G_FLOAT(OFS_PARM4);
float *rgb = G_VECTOR(OFS_PARM3);
float alpha = G_FLOAT(OFS_PARM4);
// float flag = G_FLOAT(OFS_PARM5);
int x, y;
if (!text)
{
@ -385,12 +381,15 @@ void PF_CL_drawrawstring (progfuncs_t *prinst, struct globalvars_s *pr_globals)
return;
}
#pragma message("fixme: this doesn't scale")
Font_BeginString(font_conchar, pos[0], pos[1], &x, &y);
Font_ForceColour(rgb[0], rgb[1], rgb[2], alpha);
while(*text)
{
G_FLOAT(OFS_PARM1) = *text++;
PF_CL_drawcharacter(prinst, pr_globals);
pos[0] += size[0];
x = Font_DrawChar(x, y, 0xe000|(*text++&0xff));
}
Font_ForceColour(1, 1, 1, 1);
Font_EndString(font_conchar);
}
//float drawstring(vector position, string text, vector scale, float alpha, float flag) = #455;
@ -435,9 +434,19 @@ void PF_CL_stringwidth(progfuncs_t *prinst, struct globalvars_s *pr_globals)
#define DRAWFLAG_MODULATE 2
#define DRAWFLAG_MODULATE2 3
#ifdef Q3SHADERS
void GLDraw_ShaderPic (int x, int y, int width, int height, shader_t *pic, float r, float g, float b, float a);
#endif
static void PF_SelectDPDrawFlag(int flag)
{
//flags:
//0 = blend
//1 = add
//2 = modulate
//3 = modulate*2
if (flag == 1)
BE_SelectMode(BEM_STANDARD, BEF_FORCEADDITIVE);
else
BE_SelectMode(BEM_STANDARD, BEF_FORCETRANSPARENT);
}
//float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -446,46 +455,16 @@ void PF_CL_drawpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float *size = G_VECTOR(OFS_PARM2);
float *rgb = G_VECTOR(OFS_PARM3);
float alpha = G_FLOAT(OFS_PARM4);
float flag = G_FLOAT(OFS_PARM5);
int flag = (int)G_FLOAT(OFS_PARM5);
mpic_t *p;
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
#ifdef Q3SHADERS
shader_t *s;
s = R_RegisterCustom(picname, NULL, NULL);
if (s)
{
GLDraw_ShaderPic(pos[0], pos[1], size[0], size[1], s, rgb[0], rgb[1], rgb[2], alpha);
return;
}
#endif
if (flag == 1) //add
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
else if(flag == 2) //modulate
qglBlendFunc(GL_DST_COLOR, GL_ZERO);
else if(flag == 3) //modulate*2
qglBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else //blend
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
#endif
p = Draw_SafeCachePic(picname);
if (Draw_ImageColours)
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
if (Draw_Image)
Draw_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p);
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif
PF_SelectDPDrawFlag(flag);
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
Draw_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p);
BE_SelectMode(BEM_STANDARD, 0);
G_FLOAT(OFS_RETURN) = 1;
}
@ -503,49 +482,16 @@ void PF_CL_drawsubpic (progfuncs_t *prinst, struct globalvars_s *pr_globals)
mpic_t *p;
if(pos[2] || size[2])
Con_Printf("VM_drawsubpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
#ifdef Q3SHADERS
shader_t *s;
s = R_RegisterCustom(picname, NULL, NULL);
if (s)
{
GLDraw_ShaderPic(pos[0], pos[1], size[0], size[1], s, rgb[0], rgb[1], rgb[2], alpha);
return;
}
#endif
if (flag == 1) //add
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
else if(flag == 2) //modulate
qglBlendFunc(GL_DST_COLOR, GL_ZERO);
else if(flag == 3) //modulate*2
qglBlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else //blend
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
#endif
p = Draw_SafeCachePic(picname);
if (Draw_ImageColours)
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
if (Draw_Image)
Draw_Image( pos[0], pos[1],
size[0], size[1],
srcPos[0], srcPos[1],
srcPos[0]+srcSize[0], srcPos[1]+srcSize[1],
p);
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#endif
PF_SelectDPDrawFlag(flag);
Draw_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
Draw_Image( pos[0], pos[1],
size[0], size[1],
srcPos[0], srcPos[1],
srcPos[0]+srcSize[0], srcPos[1]+srcSize[1],
p);
BE_SelectMode(BEM_STANDARD, 0);
G_FLOAT(OFS_RETURN) = 1;
}
@ -557,7 +503,7 @@ void PF_CL_drawfill (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float *size = G_VECTOR(OFS_PARM1);
float *rgb = G_VECTOR(OFS_PARM2);
float alpha = G_FLOAT(OFS_PARM3);
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
qglColor4f(rgb[0], rgb[1], rgb[2], alpha);
@ -581,15 +527,15 @@ void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals
{
float x = G_FLOAT(OFS_PARM0), y = G_FLOAT(OFS_PARM1), w = G_FLOAT(OFS_PARM2), h = G_FLOAT(OFS_PARM3);
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL && qglScissor)
{
x *= (float)glwidth/vid.width;
y *= (float)glheight/vid.height;
x *= (float)vid.pixelwidth/vid.width;
y *= (float)vid.pixelheight/vid.height;
w *= (float)glwidth/vid.width;
h *= (float)glheight/vid.height;
w *= (float)vid.pixelwidth/vid.width;
h *= (float)vid.pixelheight/vid.height;
//add a pixel because this makes DP's menus come out right.
x-=1;
@ -598,7 +544,7 @@ void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals
h+=2;
qglScissor (x, glheight-(y+h), w, h);
qglScissor (x, vid.pixelheight-(y+h), w, h);
qglEnable(GL_SCISSOR_TEST);
G_FLOAT(OFS_RETURN) = 1;
return;
@ -609,7 +555,7 @@ void PF_CL_drawsetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals
//void drawresetcliparea(void) = #459;
void PF_CL_drawresetcliparea (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
qglDisable(GL_SCISSOR_TEST);
@ -628,7 +574,7 @@ void PF_CL_drawline (progfuncs_t *prinst, struct globalvars_s *pr_globals)
float *pos = G_VECTOR(OFS_PARM4);
int numpoints = *prinst->callargc-4;
#ifdef RGLQUAKE // :(
#ifdef GLQUAKE // :(
if (qrenderer == QR_OPENGL)
{
@ -1762,7 +1708,7 @@ void MP_Draw(void)
if (setjmp(mp_abort))
return;
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
GL_TexEnv(GL_MODULATE);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -24,10 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "bothdefs.h" //first thing included by ALL files.
#if _MSC_VER
#define MSVCDISABLEWARNINGS
#endif
#ifdef MSVCDISABLEWARNINGS
//#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
/*#pragma warning( disable : 4244) //conversion from const double to float
@ -81,8 +77,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma warning( 4 : 4267) //truncation from const double to float
#pragma warning( error : 4020)
//#pragma warning(error:4013)
#pragma warning(error:4013)
#endif
@ -91,11 +88,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define WATERLAYERS
#ifdef GLQUAKE
#define RGLQUAKE
#undef GLQUAKE //compiler option
#endif
#ifdef SERVERONLY
#define isDedicated true
#endif
@ -151,7 +143,7 @@ extern "C" {
#include "vm.h"
//#if defined(RGLQUAKE)
//#if defined(GLQUAKE)
#include "gl_model.h"
//#else
//#include "model.h"
@ -189,12 +181,12 @@ extern "C" {
#if (_MSC_VER >= 1400)
//with MSVC 8, use MS extensions
#define snprintf linuxlike_snprintf_vc8
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...);
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
#else
//msvc crap
#define snprintf linuxlike_snprintf
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...);
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
#define vsnprintf linuxlike_vsnprintf
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
#endif
@ -256,12 +248,12 @@ void Host_ServerFrame (void);
void Host_InitCommands (void);
void Host_Init (quakeparms_t *parms);
void Host_Shutdown(void);
void VARGS Host_Error (char *error, ...);
void VARGS Host_EndGame (char *message, ...);
NORETURN void VARGS Host_Error (char *error, ...) LIKEPRINTF(1);
NORETURN void VARGS Host_EndGame (char *message, ...) LIKEPRINTF(1);
qboolean Host_SimulationTime(float time);
void Host_Frame (double time);
void Host_Quit_f (void);
void VARGS Host_ClientCommands (char *fmt, ...);
void VARGS Host_ClientCommands (char *fmt, ...) LIKEPRINTF(1);
void Host_ShutdownServer (qboolean crash);
extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
@ -274,6 +266,14 @@ extern qboolean isDedicated;
void FTE_DEPRECATED GL_DrawAliasMesh (mesh_t *mesh, texid_t texnum);
void FTE_DEPRECATED R_RenderMeshBuffer(struct meshbuffer_s *mb, qboolean shadowpass);
#ifdef __cplusplus
}
#endif

278
engine/client/r_2d.c Normal file
View File

@ -0,0 +1,278 @@
#include "quakedef.h"
#ifndef SERVERONLY
#include "shader.h"
#include "gl_draw.h"
texid_t missing_texture;
static mpic_t *conback;
static mpic_t *draw_backtile;
mpic_t *draw_disc;
static mesh_t draw_mesh;
static vecV_t draw_mesh_xyz[4];
static vec2_t draw_mesh_st[4];
static avec4_t draw_mesh_colors[4];
static index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
extern cvar_t scr_conalpha;
extern cvar_t gl_conback;
extern cvar_t gl_font;
void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue);
//We need this for minor things though, so we'll just use the slow accurate method.
//this is unlikly to be called too often.
qbyte GetPaletteIndex(int red, int green, int blue)
{
//slow, horrible method.
{
int i, best=15;
int bestdif=256*256*256, curdif;
extern qbyte *host_basepal;
qbyte *pa;
#define _abs(x) ((x)*(x))
pa = host_basepal;
for (i = 0; i < 256; i++, pa+=3)
{
curdif = _abs(red - pa[0]) + _abs(green - pa[1]) + _abs(blue - pa[2]);
if (curdif < bestdif)
{
if (curdif<1)
return i;
bestdif = curdif;
best = i;
}
}
return best;
}
}
/*
Iniitalise the 2d rendering functions (including font).
Image loading code must be ready for use at this point.
*/
void R2D_Init(void)
{
BE_Init();
draw_mesh.numvertexes = 4;
draw_mesh.numindexes = 6;
draw_mesh.xyz_array = draw_mesh_xyz;
draw_mesh.st_array = draw_mesh_st;
draw_mesh.colors4f_array = draw_mesh_colors;
draw_mesh.indexes = r_quad_indexes;
Font_Init();
#pragma message("Fixme: move conwidth handling into here")
if (font_conchar)
Font_Free(font_conchar);
font_conchar = Font_LoadFont(8*vid.pixelheight/vid.height, gl_font.string);
if (!font_conchar && *gl_font.string)
font_conchar = Font_LoadFont(8*vid.pixelheight/vid.height, "");
missing_texture = R_LoadTexture8("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], IF_NOALPHA|IF_NOGAMMA, 0);
draw_backtile = Draw_SafePicFromWad ("backtile");
if (!draw_backtile)
draw_backtile = Draw_SafeCachePic ("gfx/menu/backtile.lmp");
Cvar_Hook(&gl_conback, R2D_Conback_Callback);
}
mpic_t *R2D_SafeCachePic (char *path)
{
shader_t *s = R_RegisterPic(path);
if (s->width)
return s;
return NULL;
}
char *failedpic; //easier this way
mpic_t *R2D_SafePicFromWad (char *name)
{
char newname[32];
shader_t *s;
snprintf(newname, sizeof(newname), "gfx/%s.lmp", name);
s = R_RegisterPic(newname);
if (s->width)
return s;
failedpic = name;
return NULL;
}
void R2D_ImageColours(float r, float g, float b, float a)
{
draw_mesh_colors[0][0] = r;
draw_mesh_colors[0][1] = g;
draw_mesh_colors[0][2] = b;
draw_mesh_colors[0][3] = a;
Vector4Copy(draw_mesh_colors[0], draw_mesh_colors[1]);
Vector4Copy(draw_mesh_colors[0], draw_mesh_colors[2]);
Vector4Copy(draw_mesh_colors[0], draw_mesh_colors[3]);
}
//awkward and weird to use
void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic)
{
if (!pic)
return;
/*
if (w == 0 && h == 0)
{
w = pic->width;
h = pic->height;
}
*/
draw_mesh_xyz[0][0] = x;
draw_mesh_xyz[0][1] = y;
draw_mesh_st[0][0] = s1;
draw_mesh_st[0][1] = t1;
draw_mesh_xyz[1][0] = x+w;
draw_mesh_xyz[1][1] = y;
draw_mesh_st[1][0] = s2;
draw_mesh_st[1][1] = t1;
draw_mesh_xyz[2][0] = x+w;
draw_mesh_xyz[2][1] = y+h;
draw_mesh_st[2][0] = s2;
draw_mesh_st[2][1] = t2;
draw_mesh_xyz[3][0] = x;
draw_mesh_xyz[3][1] = y+h;
draw_mesh_st[3][0] = s1;
draw_mesh_st[3][1] = t2;
BE_DrawMeshChain(pic, &draw_mesh, NULL, &pic->defaulttextures);
}
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic)
{
R2D_Image(x, y, width, height, 0, 0, 1, 1, pic);
}
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight)
{
float newsl, newtl, newsh, newth;
newsl = (srcx)/(float)srcwidth;
newsh = newsl + (width)/(float)srcwidth;
newtl = (srcy)/(float)srcheight;
newth = newtl + (height)/(float)srcheight;
R2D_Image(x, y, width, height, newsl, newtl, newsh, newth, pic);
}
/*
================
Draw_ConsoleBackground
================
*/
void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque)
{
float a;
int w, h;
if (!conback)
return;
w = vid.conwidth;
h = vid.conheight;
if (forceopaque)
{
a = 1; // console background is necessary
}
else
{
if (!scr_conalpha.value)
return;
a = scr_conalpha.value;
}
if (scr_chatmode == 2)
{
h>>=1;
w>>=1;
}
if (a >= 1)
{
R2D_ImageColours(1, 1, 1, 1);
R2D_ScalePic(0, lastline-(int)vid.conheight, w, h, conback);
}
else
{
R2D_ImageColours(1, 1, 1, a);
R2D_ScalePic (0, lastline - (int)vid.conheight, w, h, conback);
R2D_ImageColours(1, 1, 1, 1);
}
}
void R2D_EditorBackground (void)
{
R2D_ScalePic(0, 0, vid.conwidth, vid.conheight, conback);
}
/*
=============
Draw_TileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void R2D_TileClear (int x, int y, int w, int h)
{
float newsl, newsh, newtl, newth;
newsl = (x)/(float)64;
newsh = newsl + (w)/(float)64;
newtl = (y)/(float)64;
newth = newtl + (h)/(float)64;
R2D_ImageColours(1,1,1,1);
draw_mesh_xyz[0][0] = x;
draw_mesh_xyz[0][1] = y;
draw_mesh_st[0][0] = newsl;
draw_mesh_st[0][1] = newtl;
draw_mesh_xyz[1][0] = x+w;
draw_mesh_xyz[1][1] = y;
draw_mesh_st[1][0] = newsh;
draw_mesh_st[1][1] = newtl;
draw_mesh_xyz[2][0] = x+w;
draw_mesh_xyz[2][1] = y+h;
draw_mesh_st[2][0] = newsh;
draw_mesh_st[2][1] = newth;
draw_mesh_xyz[3][0] = x;
draw_mesh_xyz[3][1] = y+h;
draw_mesh_st[3][0] = newsl;
draw_mesh_st[3][1] = newth;
BE_DrawMeshChain(draw_backtile, &draw_mesh, NULL, NULL);
}
void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
{
if (*var->string)
conback = R_RegisterPic(var->string);
if (!conback || !conback->width)
conback = R_RegisterCustom("console", NULL, NULL);
if (!conback || !conback->width)
conback = R_RegisterPic("gfx/conback.lmp");
}
#endif

View File

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#ifdef PEXT_BULLETENS
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"//hack
#endif
@ -390,12 +390,12 @@ player_info_t *s;
#endif
R_MakeBulleten(a->texture, a->bultextleft, a->bultexttop, text, a->normaltexture);
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
GL_Bind(a->texture->tn.base);
GL_Upload8 ("bulleten", (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, IF_NOMIPMAP|IF_NOALPHA|IF_NOGAMMA, 0);
}
#endif
}

View File

@ -28,10 +28,6 @@ extern bulletentexture_t *bulletentexture;
extern qbyte *draw_chars; //console text
extern int scoreboardlines;
extern int fragsort[];
qboolean R_AddBulleten (texture_t *textur);
void R_MakeBulleten (texture_t *textur, int lefttext, int toptext, char *text, qbyte *background);
//void R_MakeBulleten (texture_t *textur, int lefttext, int toptext, char *text);

View File

@ -222,7 +222,7 @@ void R_StoreEfrags (efrag_t **ppefrag)
pent = pefrag->entity;
clmodel = pent->model;
if ((!r_drawflame.value) && (clmodel->engineflags & MDLF_FLAME))
if ((!r_drawflame.ival) && (clmodel->engineflags & MDLF_FLAME))
break;
// switch (clmodel->type)
@ -243,7 +243,7 @@ void R_StoreEfrags (efrag_t **ppefrag)
pent->visframe = r_framecount;
// emit particles for statics (we don't need to cheat check statics)
if (clmodel->particleeffect >= 0 && gl_part_flame.value)
if (clmodel->particleeffect >= 0 && gl_part_flame.ival)
{
// TODO: this is ugly.. assumes ent is in static entities, and subtracts
// pointer math to get an index to use in cl_static emit

View File

@ -122,7 +122,6 @@ cvar_t r_part_sparks = SCVAR("r_part_sparks", "1");
cvar_t r_part_sparks_trifan = SCVAR("r_part_sparks_trifan", "1");
cvar_t r_part_sparks_textured = SCVAR("r_part_sparks_textured", "1");
cvar_t r_part_beams = SCVAR("r_part_beams", "1");
cvar_t r_part_beams_textured = SCVAR("r_part_beams_textured", "1");
cvar_t r_part_contentswitch = SCVAR("r_part_contentswitch", "1");
@ -150,7 +149,6 @@ void P_InitParticleSystem(void)
Cvar_Register(&r_part_sparks_trifan, particlecvargroupname);
Cvar_Register(&r_part_sparks_textured, particlecvargroupname);
Cvar_Register(&r_part_beams, particlecvargroupname);
Cvar_Register(&r_part_beams_textured, particlecvargroupname);
Cvar_Register(&r_part_contentswitch, particlecvargroupname);
Cvar_Register (&gl_part_flame, particlecvargroupname);

View File

@ -31,6 +31,29 @@ extern int r_framecount;
struct msurface_s;
typedef union {
int num;
#ifdef D3DQUAKE
void *ptr;
#endif
} texid_t;
static const texid_t r_nulltex = {0};
#define TEXVALID(t) (t.num!=0)
#ifdef D3DQUAKE
#define sizeof_index_t 2
#endif
#if sizeof_index_t == 2
#define GL_INDEX_TYPE GL_UNSIGNED_SHORT
#define D3DFMT_QINDEX D3DFMT_INDEX16
typedef unsigned short index_t;
#else
#define GL_INDEX_TYPE GL_UNSIGNED_INT
#define D3DFMT_QINDEX D3DFMT_INDEX32
typedef unsigned int index_t;
#endif
//=============================================================================
typedef struct efrag_s
@ -93,9 +116,7 @@ typedef struct entity_s
refEntityType_t rtype;
float rotation;
#ifdef Q3SHADERS
struct shader_s *forcedshader;
#endif
#ifdef PEXT_SCALE
float scale;
@ -155,16 +176,13 @@ extern struct texture_s *r_notexture_mip;
extern entity_t r_worldentity;
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
void GLR_Init (void);
void GLR_ReInit (void);
void GLR_InitTextures (void);
void GLR_InitEfrags (void);
void GLR_RenderView (void); // must set r_refdef first
// called whenever r_refdef or vid change
void GLR_InitSky (struct texture_s *mt); // called at level load
void GLR_SetSky (char *name, float rotate, vec3_t axis);
qboolean GLR_CheckSky(void);
void GLR_AddEfrags (entity_t *ent);
void GLR_RemoveEfrags (entity_t *ent);
@ -182,14 +200,10 @@ void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *p
void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down
void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up...
void GLR_SetSky (char *name, float rotate, vec3_t axis);
qboolean GLR_CheckSky(void);
void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius);
void GLR_LessenStains(void);
void GLVID_DeInit (void);
void GLR_DeInit (void);
void GLSCR_DeInit (void);
void GLVID_Console_Resize(void);
int GLR_LightPoint (vec3_t p);
#endif
@ -198,27 +212,33 @@ int GLR_LightPoint (vec3_t p);
void R_AddEfrags (entity_t *ent);
void R_RemoveEfrags (entity_t *ent);
enum imageflags
{
/*warning: many of these flags only apply the first time it is requested*/
IF_CLAMP = 1<<0,
IF_NOPICMIP = 1<<1,
IF_NOMIPMAP = 1<<2,
IF_NOALPHA = 1<<3,
IF_NOGAMMA = 1<<4
};
//normalmaps
//bumpmaps
//32bits
//8bits
//8bitpal24
//8bitpal32
enum uploadfmt
{
TF_INVALID,
TF_RGBA32, /*rgba byte order*/
TF_BGRA32, /*bgra byte order*/
TF_RGBX32, /*rgb byte order, with extra wasted byte after blue*/
TF_RGB24, /*bgr byte order, no alpha channel nor pad, and top down*/
TF_BGR24_FLIP, /*bgr byte order, no alpha channel nor pad, and bottom up*/
TF_SOLID8, /*8bit quake-palette image*/
TF_TRANS8, /*8bit quake-palette image, index 255=transparent*/
TF_TRANS8_FULLBRIGHT, /*fullbright 8 - fullbright texels have alpha 255, everything else 0*/
TF_HEIGHT8, /*image data is greyscale, convert to a normalmap and load that, uploaded alpha contains the original heights*/
TF_H2_T7G1, /*8bit data, odd indexes give greyscale transparence*/
TF_H2_TRANS8_0, /*8bit data, 0 is transparent, not 255*/
TF_H2_T4A4 /*8bit data, weird packing*/
};
#define TF_NOMIPMAP 0x0000
#define TF_NOTBUMPMAP 0x0000
#define TF_NOALPHA 0x0000
#define TF_MIPMAP 0x0001
#define TF_BUMPMAP 0x0002 //or normalmap, depending on 8/24 bitness
#define TF_ALPHA 0x0004 //preserve alpha channel (8biit, use index 255 for transparency)
#define TF_FULLBRIGHT 0x0008 //dark pixels have alpha forced to 0
#define TF_24BIT 0x0010
#define TF_32BIT 0x0020 //use the standard quake palette
#define TF_MANDATORY (TF_NOMIPMAP|TF_NOTBUMPMAP|TF_NOALPHA)
#if 0
/*
@ -278,65 +298,100 @@ int R_LoadTexture(char *name, int width, int height, void *data, void *palette,
#define R_FindTexture(name) R_LoadTexture(name, 0, 0, NULL, NULL, 0)
#define R_LoadCompressed(name) ((qrenderer == QR_OPENGL)?GL_LoadCompressed(name):0)
*/
#elif defined(RGLQUAKE) && defined(D3DQUAKE)
#elif defined(GLQUAKE) && defined(D3DQUAKE)
#define R_LoadTexture8Pal32(skinname,width,height,data,palette,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture8Pal32(skinname, width, height, data, palette, usemips, alpha):GL_LoadTexture8Pal32(skinname, width, height, data, palette, usemips, alpha))
#define R_LoadTexture8Pal24(skinname,width,height,data,palette,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture8Pal24(skinname, width, height, data, palette, usemips, alpha):GL_LoadTexture8Pal24(skinname, width, height, data, palette, usemips, alpha))
#define R_LoadTexture8(skinname,width,height,data,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture(skinname, width, height, data, usemips, alpha):GL_LoadTexture(skinname, width, height, data, usemips, alpha))
#define R_LoadTexture32(skinname,width,height,data,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture32(skinname, width, height, data, usemips, alpha):GL_LoadTexture32(skinname, width, height, data, usemips, alpha))
#define R_LoadTextureFB(skinname,width,height,data,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTextureFB(skinname, width, height, data, usemips, alpha):GL_LoadTextureFB(skinname, width, height, data, usemips, alpha))
#define R_LoadTexture8Bump(skinname,width,height,data,usemips,alpha) ((qrenderer == QR_DIRECT3D)?D3D_LoadTexture8Bump(skinname, width, height, data, usemips, alpha):GL_LoadTexture8Bump(skinname, width, height, data, usemips, alpha))
#define R_FindTexture(name) ((qrenderer == QR_DIRECT3D)?D3D_FindTexture(name):GL_FindTexture(name))
#define R_LoadCompressed(name) ((qrenderer == QR_DIRECT3D)?D3D_LoadCompressed(name):GL_LoadCompressed(name))
#elif defined(D3DQUAKE)
#define R_LoadTexture8Pal32 D3D_LoadTexture8Pal32
#define R_LoadTexture8Pal24 D3D_LoadTexture8Pal24
#define R_LoadTexture8 D3D_LoadTexture
#define R_LoadTexture32 D3D_LoadTexture32
#define R_LoadTextureFB D3D_LoadTextureFB
#define R_LoadTexture8Bump D3D_LoadTexture8Bump
// #define R_LoadTexture8Pal32
// #define R_LoadTexture8Pal24
#define R_FindTexture D3D_FindTexture
#define R_LoadCompressed D3D_LoadCompressed
#elif defined(RGLQUAKE)
#define R_AllocNewTexture D3D_AllocNewTexture
#define R_Upload D3D_UploadFmt
#define R_LoadTexture D3D_LoadTextureFmt
#define R_DestroyTexture(tno) 0
#elif defined(GLQUAKE)
#define R_LoadTexture8Pal32 GL_LoadTexture8Pal32
#define R_LoadTexture8Pal24 GL_LoadTexture8Pal24
#define R_LoadTexture8 GL_LoadTexture
#define R_LoadTexture32 GL_LoadTexture32
#define R_LoadTextureFB GL_LoadTextureFB
#define R_LoadTexture8Bump GL_LoadTexture8Bump
#define R_FindTexture GL_FindTexture
#define R_LoadCompressed GL_LoadCompressed
#define R_AllocNewTexture(w,h) GL_AllocNewTexture()
#define R_Upload GL_UploadFmt
#define R_LoadTexture GL_LoadTextureFmt
#define R_DestroyTexture(tno) 0
#endif
#define R_LoadTexture8(id,w,h,d,f,t) R_LoadTexture(id,w,h,t?TF_TRANS8:TF_SOLID8,d,f)
#define R_LoadTexture32(id,w,h,d,f) R_LoadTexture(id,w,h,TF_RGBA32,d,f)
#define R_LoadTextureFB(id,w,h,d,f) R_LoadTexture(id,w,h,TF_TRANS8_FULLBRIGHT,d,f)
#define R_LoadTexture8Bump(id,w,h,d,f) R_LoadTexture(id,w,h,TF_HEIGHT8,d,f)
/*it seems a little excessive to have to include glquake (and windows headers), just to load some textures/shaders for the backend*/
#ifdef GLQUAKE
texid_t GL_AllocNewTexture(void);
void GL_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, int width, int height, unsigned int flags);
texid_t GL_LoadTextureFmt (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
#endif
#ifdef D3DQUAKE
texid_t D3D_AllocNewTexture(int width, int height);
void D3D_UploadFmt(texid_t tex, char *name, enum uploadfmt fmt, void *data, int width, int height, unsigned int flags);
texid_t D3D_LoadTextureFmt (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
texid_t D3D_LoadCompressed(char *name);
texid_t D3D_FindTexture (char *identifier);
#endif
extern int image_width, image_height;
texid_t R_LoadReplacementTexture(char *name, char *subpath, unsigned int flags);
texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags);
texid_t R_LoadBumpmapTexture(char *name, char *subpath);
extern texid_t particletexture;
extern texid_t particlecqtexture;
extern texid_t explosiontexture;
extern texid_t balltexture;
extern texid_t beamtexture;
extern texid_t ptritexture;
void GL_ParallelPerspective(double xmin, double xmax, double ymax, double ymin, double znear, double zfar);
void GL_InfinatePerspective(double fovx, double fovy, double zNear);
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
void GLMod_Init (void);
void RMod_Init (void);
int Mod_TagNumForName(struct model_s *model, char *name);
int Mod_SkinNumForName(struct model_s *model, char *name);
int Mod_FrameNumForName(struct model_s *model, char *name);
float Mod_FrameDuration(struct model_s *model, int frameno);
void GLMod_ClearAll (void);
struct model_s *GLMod_ForName (char *name, qboolean crash);
struct model_s *GLMod_FindName (char *name);
void *GLMod_Extradata (struct model_s *mod); // handles caching
void GLMod_TouchModel (char *name);
void RMod_ClearAll (void);
struct model_s *RMod_ForName (char *name, qboolean crash);
struct model_s *RMod_FindName (char *name);
void *RMod_Extradata (struct model_s *mod); // handles caching
void RMod_TouchModel (char *name);
struct mleaf_s *GLMod_PointInLeaf (struct model_s *model, float *p);
struct mleaf_s *RMod_PointInLeaf (struct model_s *model, float *p);
void GLMod_Think (void);
void GLMod_NowLoadExternal(void);
void RMod_Think (void);
void RMod_NowLoadExternal(void);
void GLR_WipeStains(void);
void GLR_LoadSkys (void);
void R_BloomRegister(void);
#endif
#ifdef RUNTIMELIGHTING
void LightFace (int surfnum);
void LightLoadEntities(char *entstring);
#endif
extern struct model_s *currentmodel;
qboolean Media_ShowFilm(void);
@ -347,11 +402,13 @@ double Media_TweekCaptureFrameTime(double time);
void MYgluPerspective(double fovx, double fovy, double zNear, double zFar);
void R_MarkLeaves_Q1 (void);
void R_MarkLeaves_Q2 (void);
void R_MarkLeaves_Q3 (void);
void R_SetFrustum (void);
qbyte *R_MarkLeaves_Q1 (void);
qbyte *R_CalcVis_Q1 (void);
qbyte *R_MarkLeaves_Q2 (void);
qbyte *R_MarkLeaves_Q3 (void);
void R_SetFrustum (float projmat[16], float viewmat[16]);
void R_SetRenderer(int wanted);
void R_AnimateLight (void);
void RQ_Init(void);
void CLQ2_EntityEvent(entity_state_t *es);
@ -380,6 +437,7 @@ void SaturateR8G8B8(qbyte *data, int size, float sat);
void AddOcranaLEDsIndexed (qbyte *image, int h, int w);
void Renderer_Init(void);
void R_ShutdownRenderer(void);
void R_RestartRenderer_f (void);//this goes here so we can save some stack when first initing the sw renderer.
//used to live in glquake.h
@ -393,7 +451,8 @@ extern cvar_t r_speeds;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_lightmap;
extern cvar_t r_shadows;
extern cvar_t r_shadow_realtime_dlight, r_shadow_realtime_dlight_shadows;
extern cvar_t r_shadow_realtime_world,r_shadow_realtime_world_shadows;
extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha;
extern cvar_t r_dynamic;
@ -463,9 +522,12 @@ int rquant[RQUANT_MAX];
#define RQuantAdd(type,quant) rquant[type] += quant;
#define RSpeedLocals() int rsp
#define RSpeedMark() int rsp = r_speeds.value?Sys_DoubleTime()*1000000:0
#define RSpeedRemark() rsp = r_speeds.value?Sys_DoubleTime()*1000000:0
#define RSpeedMark() int rsp = r_speeds.ival?Sys_DoubleTime()*1000000:0
#define RSpeedRemark() rsp = r_speeds.ival?Sys_DoubleTime()*1000000:0
//extern void (_stdcall *qglFinish) (void);
//#define RSpeedEnd(spt) do {qglFinish(); rspeeds[spt] += r_speeds.value?Sys_DoubleTime()*1000000 - rsp:0;}while (0)
#if defined(_WIN32) && defined(GLQUAKE)
extern void (_stdcall *qglFinish) (void);
#define RSpeedEnd(spt) do {if(r_speeds.ival && qglFinish){qglFinish(); rspeeds[spt] += (int)(Sys_DoubleTime()*1000000) - rsp;}}while (0)
#else
#define RSpeedEnd(spt) rspeeds[spt] += r_speeds.value?Sys_DoubleTime()*1000000 - rsp:0
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2,15 +2,8 @@
// Microsoft Developer Studio generated include file.
// Used by winquake.rc
//
#define IDS_STRING1 1
#define IDI_ICON2 1
#define IDD_DIALOG1 108
#define IDD_PROGRESS 109
#define IDB_QWBITMAP 112
#define IDI_ICON1 115
#define IDB_BITMAP1 116
#define IDI_ICON3 122
#define IDC_PROGRESS 1000
#define IDI_ICON1 1
#define IDI_ICON2 2
// Next default values for new objects
//

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ extern int sb_lines; // scan lines to draw
void Sbar_Init (void);
struct player_info_s;
qboolean Sbar_UpdateTeamStatus(struct player_info_s *player, char *status);
#ifdef RGLQUAKE
#ifdef GLQUAKE
void Sbar_ReInit (void);
#endif
@ -49,3 +49,6 @@ void Sbar_SortFrags (qboolean includespec);
void Sbar_Start (void);
void Sbar_Flush (void);
unsigned int Sbar_ColorForMap (unsigned int m);
extern int scoreboardlines;
extern int fragsort[];

View File

@ -48,7 +48,7 @@ qboolean SCR_RSShot (void);
//void SCR_UpdateScreen (void);
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
void GLSCR_UpdateScreen (void);
#endif
@ -67,6 +67,7 @@ void SCR_DrawNet (void);
void SCR_DrawTurtle (void);
void SCR_DrawPause (void);
void SCR_VRectForPlayer(vrect_t *vrect, int pnum); //returns a region for the player's view
void SCR_DrawCursor(int prydoncursornum);
void CLSCR_Init(void); //basically so I can register a few friendly cvars.
@ -93,3 +94,20 @@ enum
};
int SCR_GetLoadingStage(void);
void SCR_SetLoadingStage(int stage);
/*fonts*/
void Font_Init(void);
void Font_Shutdown(void);
struct font_s *Font_LoadFont(int height, char *fontfilename);
void Font_Free(struct font_s *f);
void Font_BeginString(struct font_s *font, int vx, int vy, int *px, int *py);
int Font_CharHeight(void);
int Font_CharWidth(unsigned int charcode);
int Font_DrawChar(int px, int py, unsigned int charcode);
void Font_ForceColour(float r, float g, float b, float a);
void Font_EndString(struct font_s *font);
int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int maxlines, conchar_t **starts, conchar_t **ends);
extern struct font_s *font_conchar;
extern struct font_s *font_tiny;
/*end fonts*/

View File

@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "glquake.h"
cvar_t baseskin = SCVAR("baseskin", "");
cvar_t noskins = SCVAR("noskins", "0");
@ -222,9 +223,9 @@ qbyte *Skin_Cache8 (skin_t *skin)
if (skin->failedload)
return NULL;
skin->tex_base = 0;
skin->tex_lower = 0;
skin->tex_upper = 0;
skin->tex_base = r_nulltex;
skin->tex_lower = r_nulltex;
skin->tex_upper = r_nulltex;
out = Cache_Check (&skin->cache);
if (out)
@ -275,16 +276,16 @@ qbyte *Skin_Cache8 (skin_t *skin)
{
if (strcmp(skin->name, baseskin.string))
{
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
{
skin->tex_base = Mod_LoadReplacementTexture(skin->name, "skins", true, false, true);
if (skin->tex_base)
skin->tex_base = R_LoadReplacementTexture(skin->name, "skins", IF_NOALPHA);
if (TEXVALID(skin->tex_base))
{
sprintf (name, "%s_shirt", skin->name);
skin->tex_upper = Mod_LoadReplacementTexture(name, "skins", true, true, true);
skin->tex_upper = R_LoadReplacementTexture(name, "skins", 0);
sprintf (name, "%s_pants", skin->name);
skin->tex_lower = Mod_LoadReplacementTexture(name, "skins", true, true, true);
skin->tex_lower = R_LoadReplacementTexture(name, "skins", 0);
skin->failedload = true;
return NULL;
@ -382,7 +383,7 @@ qbyte *Skin_Cache8 (skin_t *skin)
}
if (dataByte >= 256-vid.fullbright) //kill the fb componant
if (!r_fb_models.value)
if (!r_fb_models.ival)
dataByte = fbremap[dataByte + vid.fullbright-256];
while(runLength-- > 0)
@ -528,7 +529,7 @@ void Skin_NextDownload (void)
if (!sc->name[0])
continue;
Skin_Find (sc);
if (noskins.value)
if (noskins.ival)
continue;
if (strchr(sc->skin->name, ' ')) //skip over skins using a space
@ -550,7 +551,7 @@ void Skin_NextDownload (void)
Skin_Cache32(sc->skin);
else
Skin_Cache8 (sc->skin);
#ifdef RGLQUAKE
#ifdef GLQUAKE
sc->skin = NULL;
#endif
}

View File

@ -22,6 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <dsound.h>
#ifdef _MSC_VER
#pragma comment(lib, MSVCLIBSPATH "dxsdk7/lib/dxguid.lib")
#endif
#define SND_ERROR 0
#define SND_LOADED 1
#define SND_NOMORE 2 //like error, but doesn't try the next card.
@ -594,7 +598,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
dsndcard="DirectSound";
if (pDirectSoundEnumerate)
pDirectSoundEnumerate(&DSEnumCallback, NULL);
if (!snd_usemultipledevices.value) //if only one device, ALWAYS use the default.
if (!snd_usemultipledevices.ival) //if only one device, ALWAYS use the default.
dsndguid=NULL;
aimedforguid++;
@ -609,7 +613,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
#ifndef MINIMAL
#ifdef _IKsPropertySet_
dh->pDS = NULL;
if (snd_eax.value)
if (snd_eax.ival)
{
CoInitialize(NULL);
if (FAILED(CoCreateInstance( &CLSID_EAXDirectSound, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound, (void **)&dh->pDS )))
@ -676,7 +680,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
dsbuf.lpwfxFormat = NULL;
#ifdef DSBCAPS_GLOBALFOCUS
if (snd_inactive.value)
if (snd_inactive.ival)
{
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
sc->inactive_sound = true;
@ -715,7 +719,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
dsbuf.dwSize = sizeof(DSBUFFERDESC);
dsbuf.dwFlags = DSBCAPS_CTRLFREQUENCY|DSBCAPS_LOCSOFTWARE; //dmw 29 may, 2003 removed locsoftware
#ifdef DSBCAPS_GLOBALFOCUS
if (snd_inactive.value)
if (snd_inactive.ival)
{
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
sc->inactive_sound = true;
@ -836,7 +840,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
#ifdef _IKsPropertySet_
//attempt at eax support
if (snd_eax.value)
if (snd_eax.ival)
{
int r;
DWORD support;
@ -982,7 +986,7 @@ void DSOUND_UpdateCapture(void)
// return;
if (!snd_capture.value)
if (!snd_capture.ival)
{
if (DSCaptureBuffer)
{

View File

@ -129,7 +129,6 @@ void S_SoundInfo_f(void)
Con_Printf("%5d samplepos\n", sc->sn.samplepos);
Con_Printf("%5d samplebits\n", sc->sn.samplebits);
Con_Printf("%5d speed\n", sc->sn.speed);
Con_Printf("0x%x dma buffer\n", sc->sn.buffer);
Con_Printf("%5d total_channels\n", sc->total_chans);
}
}
@ -178,42 +177,42 @@ static int SNDDMA_Init(soundcardinfo_t *sc, int *cardnum, int *drivernum)
memset(sc, 0, sizeof(*sc));
// set requested rate
if (!snd_khz.value)
if (!snd_khz.ival)
sc->sn.speed = 22050;
/* else if (snd_khz.value >= 195)
/* else if (snd_khz.ival >= 195)
sc->sn.speed = 200000;
else if (snd_khz.value >= 180)
else if (snd_khz.ival >= 180)
sc->sn.speed = 192000;
else if (snd_khz.value >= 90)
else if (snd_khz.ival >= 90)
sc->sn.speed = 96000; */
else if (snd_khz.value >= 45)
else if (snd_khz.ival >= 45)
sc->sn.speed = 48000;
else if (snd_khz.value >= 30)
else if (snd_khz.ival >= 30)
sc->sn.speed = 44100;
else if (snd_khz.value >= 20)
else if (snd_khz.ival >= 20)
sc->sn.speed = 22050;
else if (snd_khz.value >= 10)
else if (snd_khz.ival >= 10)
sc->sn.speed = 11025;
else
sc->sn.speed = 8000;
// set requested speaker count
if (snd_speakers.value > MAXSOUNDCHANNELS)
if (snd_speakers.ival > MAXSOUNDCHANNELS)
sc->sn.numchannels = MAXSOUNDCHANNELS;
else if (snd_speakers.value > 1)
sc->sn.numchannels = (int)snd_speakers.value;
else if (snd_speakers.ival > 1)
sc->sn.numchannels = (int)snd_speakers.ival;
else
sc->sn.numchannels = 1;
// set requested sample bits
if (snd_samplebits.value >= 16)
if (snd_samplebits.ival >= 16)
sc->sn.samplebits = 16;
else
sc->sn.samplebits = 8;
// set requested buffer size
if (snd_buffersize.value > 0)
sc->sn.samples = (int)snd_buffersize.value * sc->sn.numchannels;
if (snd_buffersize.ival > 0)
sc->sn.samples = snd_buffersize.ival * sc->sn.numchannels;
else
sc->sn.samples = 0;
@ -362,7 +361,7 @@ void S_Startup (void)
sc->next = sndcardinfo;
sndcardinfo = sc;
if (!snd_usemultipledevices.value)
if (!snd_usemultipledevices.ival)
break;
}
@ -383,7 +382,7 @@ void SNDDMA_SetUnderWater(qboolean underwater)
//so that the video code can call it directly without flushing the models it's just loaded.
void S_DoRestart (void)
{
if (nosound.value)
if (nosound.ival)
return;
S_StopAllSounds (true);
@ -427,13 +426,13 @@ void S_Control_f (void)
{
if (!Q_strcasecmp(Cmd_Argv (2), "off"))
{
if (snd_usemultipledevices.value)
if (snd_usemultipledevices.ival)
{
Cvar_SetValue(&snd_usemultipledevices, 0);
S_Restart_f();
}
}
else if (!snd_usemultipledevices.value)
else if (!snd_usemultipledevices.ival)
{
Cvar_SetValue(&snd_usemultipledevices, 1);
S_Restart_f();
@ -752,13 +751,13 @@ sfx_t *S_PrecacheSound (char *name)
{
sfx_t *sfx;
if (nosound.value)
if (nosound.ival)
return NULL;
sfx = S_FindName (name);
// cache it in
if (precache.value &&sndcardinfo)
if (precache.ival && sndcardinfo)
S_LoadSound (sfx);
return sfx;
@ -848,6 +847,9 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch)
dotforward = DotProduct(listener_forward, source_vec);
dotup = DotProduct(listener_up, source_vec);
if (snd_leftisright.ival)
dotright = -dotright;
for (i = 0; i < sc->sn.numchannels; i++)
{
scale = 1 + (dotright*sin(sc->yaw[i]*M_PI/180) + dotforward*cos(sc->yaw[i]*M_PI/180));// - dotup*cos(sc->pitch[0])*2;
@ -878,7 +880,7 @@ void S_StartSoundCard(soundcardinfo_t *sc, int entnum, int entchannel, sfx_t *sf
if (!sfx)
return;
if (nosound.value)
if (nosound.ival)
return;
vol = fvol*255;
@ -915,7 +917,7 @@ void S_StartSoundCard(soundcardinfo_t *sc, int entnum, int entchannel, sfx_t *sf
return; // couldn't load the sound's data
}
if (scache->length > snd_speed*20 && !ruleset_allow_overlongsounds.value)
if (scache->length > snd_speed*20 && !ruleset_allow_overlongsounds.ival)
{
Con_DPrintf("Shortening over-long sound effect\n");
startpos = scache->length - snd_speed*10;
@ -1366,7 +1368,7 @@ void S_UpdateCard(soundcardinfo_t *sc)
//
// debugging output
//
if (snd_show.value)
if (snd_show.ival)
{
total = 0;
ch = sc->channel;
@ -1422,7 +1424,7 @@ void S_ExtraUpdate (void)
IN_Accumulate ();
#endif
if (snd_noextraupdate.value)
if (snd_noextraupdate.ival)
return; // don't pollute timings
S_RunCapture();
@ -1560,7 +1562,7 @@ void S_LocalSound (char *sound)
{
sfx_t *sfx;
if (nosound.value)
if (nosound.ival)
return;
if (!sound_started)
return;
@ -1718,7 +1720,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
if (prepadl == 0x7fffffff)
{
if (snd_show.value)
if (snd_show.ival)
Con_Printf("Wasn't playing\n");
prepadl = 0;
spare = s->sfxcache->length;
@ -1762,7 +1764,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
snd_speed,
s->sfxcache->width,
s->sfxcache->numchannels,
(int)snd_linearresample_stream.value);
snd_linearresample_stream.ival);
}
s->sfxcache->loopstart = s->sfxcache->length;

View File

@ -561,7 +561,7 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, qbyte *data)
sc->loopstart = sc->loopstart * scale;
sc->speed = snd_speed;
if (loadas8bit.value)
if (loadas8bit.ival)
sc->width = 1;
else
sc->width = inwidth;
@ -575,7 +575,7 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, qbyte *data)
sc->speed,
sc->width,
sc->numchannels,
(int)snd_linearresample.value);
snd_linearresample.ival);
}
//=============================================================================

View File

@ -51,11 +51,6 @@
#define USE_MADLIB
#include "mymad.c"
#ifdef _MSC_VER
#pragma comment (lib, "../libs/libmad/msvc++/release/libmad.lib")
#endif
/*
* This is perhaps the simplest example use of the MAD high-level API.
* Standard input is mapped into memory via mmap(), then the high-level API

View File

@ -209,7 +209,7 @@ int OV_DecodeSome(sfx_t *s, int minlength)
snd_speed,
2,
dec->mediasc.numchannels,
(int)snd_linearresample_stream.value);
snd_linearresample_stream.ival);
bytesread = (int)floor(bytesread / scale) & ~0x1;
}
@ -255,7 +255,7 @@ void OV_CancelDecoder(sfx_t *s)
//and it's now indistinguisable from a wav
}
static size_t read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
static size_t VARGS read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
{
ovdecoderbuffer_t *buffer = datasource;
int spare = buffer->length - buffer->pos;
@ -267,7 +267,7 @@ static size_t read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
return nmemb;
}
static int seek_func (void *datasource, ogg_int64_t offset, int whence)
static int VARGS seek_func (void *datasource, ogg_int64_t offset, int whence)
{
ovdecoderbuffer_t *buffer = datasource;
switch(whence)
@ -285,7 +285,7 @@ static int seek_func (void *datasource, ogg_int64_t offset, int whence)
return 0;
}
static int close_func (void *datasource)
static int VARGS close_func (void *datasource)
{
ovdecoderbuffer_t *buffer = datasource;
BZ_Free(buffer->start);
@ -293,7 +293,7 @@ static int close_func (void *datasource)
return 0;
}
static long tell_func (void *datasource)
static long VARGS tell_func (void *datasource)
{
ovdecoderbuffer_t *buffer = datasource;
return buffer->pos;

View File

@ -115,6 +115,7 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
void S_StopSound (int entnum, int entchannel);
void S_StopAllSounds(qboolean clear);
void S_UpdateListener(vec3_t origin, vec3_t forward, vec3_t right, vec3_t up, qboolean dontmix);
void S_GetListenerInfo(float *origin, float *forward, float *right, float *up);
void S_ExtraUpdate (void);
qboolean S_HaveOutput(void);

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// sys_win.h
#include "quakedef.h"
#include "winquake.h"
#include "resource.h"
#include "errno.h"
@ -33,6 +34,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <process.h>
#endif
#ifdef _DEBUG
#define CATCHCRASH
#endif
#if !defined(CLIENTONLY) && !defined(SERVERONLY)
qboolean isDedicated = false;
#endif
@ -45,7 +50,7 @@ void Sys_CloseLibrary(dllhandle_t *lib)
{
FreeLibrary((HMODULE)lib);
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs)
{
int i;
HMODULE lib;
@ -72,7 +77,7 @@ dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
return (dllhandle_t*)lib;
}
void *Sys_GetAddressForName(dllhandle_t *module, char *exportname)
void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname)
{
if (!module)
return NULL;
@ -310,6 +315,80 @@ int VARGS Sys_DebugLog(char *file, char *fmt, ...)
return 1;
};
#ifdef CATCHCRASH
#include "dbghelp.h"
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP) (
HANDLE hProcess,
DWORD ProcessId,
HANDLE hFile,
MINIDUMP_TYPE DumpType,
PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
static DWORD CrashExceptionHandler (DWORD exceptionCode, LPEXCEPTION_POINTERS exceptionInfo)
{
char dumpPath[1024];
HANDLE hProc = GetCurrentProcess();
DWORD procid = GetCurrentProcessId();
HANDLE dumpfile;
HMODULE hDbgHelp;
MINIDUMPWRITEDUMP fnMiniDumpWriteDump;
HMODULE hKernel;
BOOL (WINAPI *pIsDebuggerPresent)(void);
hKernel = LoadLibrary ("kernel32");
pIsDebuggerPresent = (void*)GetProcAddress(hKernel, "IsDebuggerPresent");
#ifdef GLQUAKE
GLVID_Crashed();
#endif
if (pIsDebuggerPresent ())
{
/*if we have a current window, minimize it to bring us out of fullscreen*/
ShowWindow(mainwindow, SW_MINIMIZE);
return EXCEPTION_CONTINUE_SEARCH;
}
/*if we have a current window, kill it, so it can't steal input of handle window messages or anything risky like that*/
DestroyWindow(mainwindow);
hDbgHelp = LoadLibrary ("DBGHELP");
if (hDbgHelp)
fnMiniDumpWriteDump = (MINIDUMPWRITEDUMP)GetProcAddress (hDbgHelp, "MiniDumpWriteDump");
else
fnMiniDumpWriteDump = NULL;
if (fnMiniDumpWriteDump)
{
if (MessageBox(NULL, "KABOOM! We crashed!\nBlame the monkey in the corner.\nI hope you saved your work.\nWould you like to take a dump now?", DISTRIBUTION " Sucks", MB_ICONSTOP|MB_YESNO) != IDYES)
return EXCEPTION_EXECUTE_HANDLER;
/*take a dump*/
GetTempPath (sizeof(dumpPath)-16, dumpPath);
Q_strncatz(dumpPath, DISTRIBUTION"CrashDump.dmp", sizeof(dumpPath));
dumpfile = CreateFile (dumpPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (dumpfile)
{
MINIDUMP_EXCEPTION_INFORMATION crashinfo;
crashinfo.ClientPointers = TRUE;
crashinfo.ExceptionPointers = exceptionInfo;
crashinfo.ThreadId = GetCurrentThreadId ();
if (fnMiniDumpWriteDump(hProc, procid, dumpfile, MiniDumpWithIndirectlyReferencedMemory|MiniDumpWithDataSegs, &crashinfo, NULL, NULL))
{
CloseHandle(dumpfile);
MessageBox(NULL, va("You can find the crashdump at\n%s\nPlease send this file to someone.\n\nWarning: sensitive information (like your current user name) might be present in the dump.\nYou will probably want to compress it.", dumpPath), DISTRIBUTION " Sucks", 0);
return EXCEPTION_EXECUTE_HANDLER;
}
}
}
MessageBox(NULL, "Kaboom! Sorry. Blame the nubs.", DISTRIBUTION " Sucks", 0);
return EXCEPTION_EXECUTE_HANDLER;
}
#endif
int *debug;
@ -364,7 +443,7 @@ LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
// Disable CTRL+ESC
//this works, but we've got to give some way to tab out...
if (sys_disableTaskSwitch.value)
if (sys_disableTaskSwitch.ival)
{
if (pkbhs->vkCode == VK_ESCAPE && GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1))
return 1;
@ -408,54 +487,6 @@ FILE IO
===============================================================================
*/
/*
================
Sys_filelength
================
*/
int Sys_filelength (FILE *f)
{
int pos;
int end;
pos = ftell (f);
fseek (f, 0, SEEK_END);
end = ftell (f);
fseek (f, pos, SEEK_SET);
return end;
}
int Sys_FileTime (char *path)
{
FILE *f;
int t=0, retval;
#ifndef SERVERONLY
if (qrenderer)
t = VID_ForceUnlockedAndReturnState ();
#endif
f = fopen(path, "rb");
if (f)
{
fclose(f);
retval = 1;
}
else
{
retval = -1;
}
#ifndef SERVERONLY
if (qrenderer)
VID_ForceLockState (t);
#endif
return retval;
}
void Sys_mkdir (char *path)
{
_mkdir (path);
@ -735,7 +766,7 @@ void Sys_Quit (void)
}
#if 0
#if 1
/*
================
Sys_DoubleTime
@ -743,91 +774,32 @@ Sys_DoubleTime
*/
double Sys_DoubleTime (void)
{
static int sametimecount;
static unsigned int oldtime;
static int first = 1;
static LARGE_INTEGER qpcfreq;
LARGE_INTEGER PerformanceCount;
unsigned int temp, t2;
double time;
Sys_PushFPCW_SetHigh ();
static LONGLONG oldcall;
static LONGLONG firsttime;
LONGLONG diff;
QueryPerformanceCounter (&PerformanceCount);
temp = ((unsigned int)PerformanceCount.LowPart >> lowshift) |
((unsigned int)PerformanceCount.HighPart << (32 - lowshift));
if (first)
{
oldtime = temp;
first = 0;
QueryPerformanceFrequency(&qpcfreq);
firsttime = PerformanceCount.QuadPart;
diff = 0;
}
else
{
// check for turnover or backward time
if ((temp <= oldtime) && ((oldtime - temp) < 0x10000000))
{
oldtime = temp; // so we can't get stuck
}
else
{
t2 = temp - oldtime;
time = (double)t2 * pfreq;
oldtime = temp;
curtime += time;
if (curtime == lastcurtime)
{
sametimecount++;
if (sametimecount > 100000)
{
curtime += 1.0;
sametimecount = 0;
}
}
else
{
sametimecount = 0;
}
lastcurtime = curtime;
}
}
Sys_PopFPCW ();
return curtime;
diff = PerformanceCount.QuadPart - oldcall;
if (diff >= 0)
oldcall = PerformanceCount.QuadPart;
return (oldcall - firsttime) / (double)qpcfreq.QuadPart;
}
/*
================
Sys_InitFloatTime
================
*/
void Sys_InitFloatTime (void)
unsigned int Sys_Milliseconds (void)
{
int j;
Sys_DoubleTime ();
j = COM_CheckParm("-starttime");
if (j)
{
curtime = (double) (Q_atof(com_argv[j+1]));
}
else
{
curtime = 0.0;
}
lastcurtime = curtime;
return Sys_DoubleTime()*1000;
}
#endif
#else
unsigned int Sys_Milliseconds (void)
{
static DWORD starttime;
@ -861,7 +833,7 @@ double Sys_DoubleTime (void)
{
return Sys_Milliseconds()/1000.f;
}
#endif
@ -1248,7 +1220,7 @@ void NPQTV_Sys_MainLoop(void)
Host_Frame (duratrion);
lastlooptime = newtime;
SetHookState(sys_disableWinKeys.value);
SetHookState(sys_disableWinKeys.ival);
// Sleep(0);
#else
@ -1296,229 +1268,279 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
quakeparms_t parms;
double time, oldtime, newtime;
char cwd[1024];
RECT rect;
const char *qtvfile = NULL;
/* previous instances do not exist in Win32 */
if (hPrevInstance)
return 0;
#ifdef _MSC_VER
#if _M_IX86_FP >= 1
{
int idedx;
char cpuname[13];
/*I'm not going to check to make sure cpuid works.*/
__asm
{
xor eax, eax
cpuid
mov dword ptr [cpuname+0],ebx
mov dword ptr [cpuname+4],edx
mov dword ptr [cpuname+8],ecx
}
cpuname[12] = 0;
__asm
{
mov eax, 0x1
cpuid
mov idedx, edx
}
// MessageBox(NULL, cpuname, cpuname, 0);
#if _M_IX86_FP >= 2
if (!(idedx&(1<<26)))
MessageBox(NULL, "This is an SSE2 optimised build, and your cpu doesn't seem to support it", DISTRIBUTION, 0);
else
#endif
if (!(idedx&(1<<25)))
MessageBox(NULL, "This is an SSE optimised build, and your cpu doesn't seem to support it", DISTRIBUTION, 0);
}
#endif
#endif
#ifdef CATCHCRASH
__try
#endif
{
/*
#ifndef _DEBUG
#ifdef _MSC_VER
signal (SIGFPE, Signal_Error_Handler);
signal (SIGILL, Signal_Error_Handler);
signal (SIGSEGV, Signal_Error_Handler);
signal (SIGFPE, Signal_Error_Handler);
signal (SIGILL, Signal_Error_Handler);
signal (SIGSEGV, Signal_Error_Handler);
#endif
#endif
*/
global_hInstance = hInstance;
global_nCmdShow = nCmdShow;
global_hInstance = hInstance;
global_nCmdShow = nCmdShow;
parms.argc = 1;
argv[0] = exename;
parms.argc = 1;
argv[0] = exename;
while (*lpCmdLine && (parms.argc < MAX_NUM_ARGVS))
{
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
lpCmdLine++;
if (*lpCmdLine)
while (*lpCmdLine && (parms.argc < MAX_NUM_ARGVS))
{
if (*lpCmdLine == '\"')
{
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
lpCmdLine++;
argv[parms.argc] = lpCmdLine;
parms.argc++;
while (*lpCmdLine && *lpCmdLine != '\"')
lpCmdLine++;
}
else
{
argv[parms.argc] = lpCmdLine;
parms.argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
}
if (*lpCmdLine)
{
*lpCmdLine = 0;
lpCmdLine++;
if (*lpCmdLine == '\"')
{
lpCmdLine++;
argv[parms.argc] = lpCmdLine;
parms.argc++;
while (*lpCmdLine && *lpCmdLine != '\"')
lpCmdLine++;
}
else
{
argv[parms.argc] = lpCmdLine;
parms.argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
}
if (*lpCmdLine)
{
*lpCmdLine = 0;
lpCmdLine++;
}
}
}
}
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
strcpy(exename, COM_SkipPath(cwd));
parms.argv = argv;
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
strcpy(exename, COM_SkipPath(cwd));
parms.argv = argv;
COM_InitArgv (parms.argc, parms.argv);
COM_InitArgv (parms.argc, parms.argv);
if (COM_CheckParm("--version") || COM_CheckParm("-v"))
{
printf("version " DISTRIBUTION " " __TIME__ __DATE__ "\n");
return true;
}
if (!GetCurrentDirectory (sizeof(cwd), cwd))
Sys_Error ("Couldn't determine current directory");
if (parms.argc >= 2)
{
if (*parms.argv[1] != '-' && *parms.argv[1] != '+')
if (COM_CheckParm("--version") || COM_CheckParm("-v"))
{
char *e;
printf("version " DISTRIBUTION " " __TIME__ __DATE__ "\n");
return true;
}
qtvfile = parms.argv[1];
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
for (e = cwd+strlen(cwd)-1; e >= cwd; e--)
if (!GetCurrentDirectory (sizeof(cwd), cwd))
Sys_Error ("Couldn't determine current directory");
if (parms.argc >= 2)
{
if (*parms.argv[1] != '-' && *parms.argv[1] != '+')
{
if (*e == '/' || *e == '\\')
char *e;
qtvfile = parms.argv[1];
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
for (e = cwd+strlen(cwd)-1; e >= cwd; e--)
{
*e = 0;
break;
if (*e == '/' || *e == '\\')
{
*e = 0;
break;
}
}
}
}
TL_InitLanguages();
//tprints are now allowed
parms.basedir = cwd;
parms.argc = com_argc;
parms.argv = com_argv;
#if !defined(CLIENTONLY) && !defined(SERVERONLY)
if (COM_CheckParm ("-dedicated"))
isDedicated = true;
#endif
if (isDedicated)
{
#if !defined(CLIENTONLY)
hwnd_dialog=NULL;
if (!Sys_InitTerminal())
Sys_Error ("Couldn't allocate dedicated server console");
#endif
}
#ifdef IDD_DIALOG1
else
hwnd_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
if (hwnd_dialog)
{
RECT rect;
if (GetWindowRect (hwnd_dialog, &rect))
{
if (rect.left > (rect.top * 2))
{
SetWindowPos (hwnd_dialog, 0,
(rect.left / 2) - ((rect.right - rect.left) / 2),
rect.top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE);
}
}
ShowWindow (hwnd_dialog, SW_SHOWDEFAULT);
UpdateWindow (hwnd_dialog);
SetForegroundWindow (hwnd_dialog);
}
}
#endif
TL_InitLanguages();
//tprints are now allowed
if (!Sys_Startup_CheckMem(&parms))
Sys_Error ("Not enough memory free; check disk space\n");
parms.basedir = cwd;
parms.argc = com_argc;
parms.argv = com_argv;
#if !defined(CLIENTONLY) && !defined(SERVERONLY)
if (COM_CheckParm ("-dedicated"))
isDedicated = true;
#endif
if (isDedicated)
{
#if !defined(CLIENTONLY)
hwnd_dialog=NULL;
if (!Sys_InitTerminal())
Sys_Error ("Couldn't allocate dedicated server console");
#endif
}
else
hwnd_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
if (hwnd_dialog)
{
if (GetWindowRect (hwnd_dialog, &rect))
#ifndef CLIENTONLY
if (isDedicated) //compleate denial to switch to anything else - many of the client structures are not initialized.
{
if (rect.left > (rect.top * 2))
SV_Init (&parms);
SV_Frame ();
while (1)
{
SetWindowPos (hwnd_dialog, 0,
(rect.left / 2) - ((rect.right - rect.left) / 2),
rect.top, 0, 0,
SWP_NOZORDER | SWP_NOSIZE);
if (!isDedicated)
Sys_Error("Dedicated was cleared");
NET_Sleep(100, false);
SV_Frame ();
}
return TRUE;
}
#endif
tevent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!tevent)
Sys_Error ("Couldn't create event");
#ifdef SERVERONLY
Sys_Printf ("SV_Init\n");
SV_Init(&parms);
#else
Sys_Printf ("Host_Init\n");
Host_Init (&parms);
#endif
oldtime = Sys_DoubleTime ();
if (qtvfile)
{
char *ext = COM_FileExtension(qtvfile);
if (!strcmp(ext, "qwd") || !strcmp(ext, "dem") || !strcmp(ext, "mvd"))
Cbuf_AddText(va("playdemo \"#%s\"\n", qtvfile), RESTRICT_LOCAL);
else
Cbuf_AddText(va("qtvplay \"#%s\"\n", qtvfile), RESTRICT_LOCAL);
}
ShowWindow (hwnd_dialog, SW_SHOWDEFAULT);
UpdateWindow (hwnd_dialog);
SetForegroundWindow (hwnd_dialog);
}
if (!Sys_Startup_CheckMem(&parms))
Sys_Error ("Not enough memory free; check disk space\n");
#ifndef CLIENTONLY
if (isDedicated) //compleate denial to switch to anything else - many of the client structures are not initialized.
{
SV_Init (&parms);
SV_Frame ();
//client console should now be initialized.
/* main window message loop */
while (1)
{
if (!isDedicated)
Sys_Error("Dedicated was cleared");
NET_Sleep(100, false);
SV_Frame ();
if (isDedicated)
{
#ifndef CLIENTONLY
NET_Sleep(50, false);
// find time passed since last cycle
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
oldtime = newtime;
SV_Frame ();
#else
Sys_Error("wut?");
#endif
}
else
{
#ifndef SERVERONLY
// yield the CPU for a little while when paused, minimized, or not the focus
/* if (cl.paused && !Media_PlayingFullScreen())
{
SleepUntilInput (PAUSE_SLEEP);
scr_skipupdate = 1; // no point in bothering to draw
}
else if (!ActiveApp && !Media_PlayingFullScreen())
{
SleepUntilInput (NOT_FOCUS_SLEEP);
}
*/
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
Host_Frame (time);
oldtime = newtime;
SetHookState(sys_disableWinKeys.ival);
// Sleep(0);
#else
Sys_Error("wut?");
#endif
}
}
return TRUE;
}
#endif
tevent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!tevent)
Sys_Error ("Couldn't create event");
#ifdef SERVERONLY
Sys_Printf ("SV_Init\n");
SV_Init(&parms);
#else
Sys_Printf ("Host_Init\n");
Host_Init (&parms);
#endif
oldtime = Sys_DoubleTime ();
if (qtvfile)
Cbuf_AddText(va("qtvplay \"#%s\"\n", qtvfile), RESTRICT_LOCAL);
//client console should now be initialized.
/* main window message loop */
while (1)
#ifdef CATCHCRASH
__except (CrashExceptionHandler(GetExceptionCode(), GetExceptionInformation()))
{
if (isDedicated)
{
#ifndef CLIENTONLY
NET_Sleep(50, false);
// find time passed since last cycle
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
oldtime = newtime;
SV_Frame ();
#else
Sys_Error("wut?");
#endif
}
else
{
#ifndef SERVERONLY
// yield the CPU for a little while when paused, minimized, or not the focus
if (cl.paused && !Media_PlayingFullScreen())
{
SleepUntilInput (PAUSE_SLEEP);
scr_skipupdate = 1; // no point in bothering to draw
}
else if (!ActiveApp && !Media_PlayingFullScreen())
{
SleepUntilInput (NOT_FOCUS_SLEEP);
}
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
Host_Frame (time);
oldtime = newtime;
SetHookState(sys_disableWinKeys.value);
// Sleep(0);
#else
Sys_Error("wut?");
#endif
}
return 1;
}
#endif
/* return success of application */
return TRUE;

View File

@ -204,7 +204,7 @@ qboolean EditorSaveFile(char *s) //returns true if succesful
{
memcpy(data + pos, b->data, b->datalength);
pos += b->datalength;
if (editaddcr.value)
if (editaddcr.ival)
{
data[pos]='\r';
pos++;
@ -294,7 +294,7 @@ void EditorOpenFile(char *name)
pos+=len;
pos++; //and a \n
if (editstripcr.value)
if (editstripcr.ival)
{
if (line[len-1] == '\r')
len--;
@ -739,6 +739,8 @@ void Editor_Key(int key, int unicode)
void Draw_CursorLine(int ox, int y, fileblock_t *b)
{
#pragma message("Fixme: ")
/*
int x=0;
qbyte *d = b->data;
int cx;
@ -791,10 +793,13 @@ void Draw_CursorLine(int ox, int y, fileblock_t *b)
}
if (a == cx)
Draw_ColouredCharacter (x+ox, y, 11|CON_WHITEMASK);
*/
}
void Draw_NonCursorLine(int x, int y, fileblock_t *b)
{
#pragma message("Fixme: ")
/*
int nx = 0;
qbyte *d = b->data;
int i;
@ -831,6 +836,7 @@ void Draw_NonCursorLine(int x, int y, fileblock_t *b)
d++;
nx += 8;
}
*/
}
fileblock_t *firstline(void)
@ -863,7 +869,7 @@ void Editor_Draw(void)
key_dest = key_editor;
if ((editoractive && cls.state == ca_disconnected) || editormodal)
Draw_EditorBackground (vid.height);
Draw_EditorBackground();
if (cursorlinenum < 0) //look for the cursor line num
{
@ -905,10 +911,10 @@ void Editor_Draw(void)
x = 0;
if (madechanges)
Draw_Character (vid.width - 8, 0, '!'|CON_HIGHCHARSMASK);
Draw_FunString (vid.width - 8, 0, "!");
if (!insertkeyhit)
Draw_Character (vid.width - 16, 0, 'O'|CON_HIGHCHARSMASK);
Draw_String(0, 0, va("%6i:%4i:%s", cursorlinenum, cursorx+1, OpenEditorFile));
Draw_FunString (vid.width - 16, 0, "O");
Draw_FunString(0, 0, va("%6i:%4i:%s", cursorlinenum, cursorx+1, OpenEditorFile));
if (useeval)
{
@ -917,7 +923,7 @@ void Editor_Draw(void)
else
{
char *eq;
Draw_String(0, 8, evalstring);
Draw_FunString(0, 8, evalstring);
eq = strchr(evalstring, '=');
if (eq)
@ -930,7 +936,7 @@ void Editor_Draw(void)
else
*eq = '\0';
}
Draw_String(vid.width/2, 8, editprogfuncs->EvaluateDebugString(editprogfuncs, evalstring));
Draw_FunString(vid.width/2, 8, editprogfuncs->EvaluateDebugString(editprogfuncs, evalstring));
if (eq)
*eq = '=';
}
@ -976,7 +982,7 @@ void Editor_Draw(void)
int QCLibEditor(progfuncs_t *prfncs, char *filename, int line, int nump, char **parms)
{
if (editormodal || !developer.value)
if (editormodal || !developer.ival)
return line; //whoops
if (!qrenderer)

View File

@ -72,23 +72,20 @@ static void Validation_Version(void)
switch(qrenderer)
{
#ifdef RGLQUAKE
#ifdef GLQUAKE
case QR_OPENGL:
s = sr;
//print certain allowed 'cheat' options.
//realtime lighting (shadows can show around corners)
//drawflat is just lame
//24bits can be considered eeeevil, by some.
if (r_shadows.value)
{
if (r_shadow_realtime_world.value)
*s++ = 'W';
else
*s++ = 'S';
}
if (r_drawflat.value)
if (r_shadow_realtime_world.ival)
*s++ = 'W';
else if (r_shadow_realtime_dlight.ival)
*s++ = 'S';
if (r_drawflat.ival)
*s++ = 'F';
if (gl_load24bit.value)
if (gl_load24bit.ival)
*s++ = 'H';
*s = *"";
@ -101,7 +98,7 @@ static void Validation_Version(void)
*s = '\0';
if (!allow_f_version.value)
if (!allow_f_version.ival)
return; //suppress it
if (Security_Generate_Crc)
@ -133,7 +130,7 @@ void Validation_CheckIfResponse(char *text)
if (!Security_Verify_Response)
return; //valid or not, we can't check it.
if (!auth_validateclients.value)
if (!auth_validateclients.ival)
return;
//do the parsing.
@ -274,7 +271,7 @@ void Validation_IncludeFile(char *filename, char *file, int filelen)
static void Validation_FilesModified (void)
{
Con_Printf ("Not implemented\n", RESTRICT_RCON);
Con_Printf ("Not implemented\n");
}
void Validation_FlushFileList(void)
@ -299,7 +296,7 @@ static void Validation_Server(void)
#ifndef _MSC_VER
#warning is allowing the user to turn this off practical?..
#endif
if (!allow_f_server.value)
if (!allow_f_server.ival)
return;
Cbuf_AddText(va("say server is %s\n", NET_AdrToString(adr, sizeof(adr), cls.netchan.remote_address)), RESTRICT_LOCAL);
}
@ -309,7 +306,7 @@ static void Validation_Skins(void)
extern cvar_t r_fullbrightSkins, r_fb_models;
int percent = r_fullbrightSkins.value*100;
if (!allow_f_skins.value)
if (!allow_f_skins.ival)
return;
RulesetLatch(&r_fb_models);
@ -321,7 +318,7 @@ static void Validation_Skins(void)
percent = cls.allow_fbskins*100;
if (percent)
Cbuf_AddText(va("say all player skins %i%% fullbright%s\n", percent, r_fb_models.value?" (plus luma)":""), RESTRICT_LOCAL);
else if (r_fb_models.value)
else if (r_fb_models.ival)
Cbuf_AddText("say luma textures only\n", RESTRICT_LOCAL);
else
Cbuf_AddText("say Only cheaters use full bright skins\n", RESTRICT_LOCAL);
@ -329,9 +326,9 @@ static void Validation_Skins(void)
static void Validation_Scripts(void)
{ //subset of ruleset
if (!allow_f_scripts.value)
if (!allow_f_scripts.ival)
return;
if (ruleset_allow_frj.value)
if (ruleset_allow_frj.ival)
Cbuf_AddText("say scripts are allowed\n", RESTRICT_LOCAL);
else
Cbuf_AddText("say scripts are capped\n", RESTRICT_LOCAL);
@ -340,7 +337,7 @@ static void Validation_Scripts(void)
static void Validation_FakeShaft(void)
{
extern cvar_t cl_truelightning;
if (!allow_f_fakeshaft.value)
if (!allow_f_fakeshaft.ival)
return;
if (cl_truelightning.value > 0.999)
Cbuf_AddText("say fakeshaft on\n", RESTRICT_LOCAL);
@ -352,14 +349,14 @@ static void Validation_FakeShaft(void)
static void Validation_System(void)
{ //subset of ruleset
if (!allow_f_system.value)
if (!allow_f_system.ival)
return;
Cbuf_AddText("say f_system not supported\n", RESTRICT_LOCAL);
}
static void Validation_CmdLine(void)
{
if (!allow_f_cmdline.value)
if (!allow_f_cmdline.ival)
return;
Cbuf_AddText("say f_cmdline not supported\n", RESTRICT_LOCAL);
}
@ -380,8 +377,7 @@ typedef struct {
} ruleset_t;
rulesetrule_t rulesetrules_strict[] = {
{"gl_shadeq1", "0"},
{"gl_shadeq3", "0"}, //FIXME: there needs to be some other way to block these
{"ruleset_allow_shaders", "0"},
{"ruleset_allow_playercount", "0"},
{"ruleset_allow_frj", "0"},
{"ruleset_allow_packet", "0"},
@ -405,8 +401,7 @@ rulesetrule_t rulesetrules_nqr[] = {
{"ruleset_allow_modified_eyes", "0"},
{"ruleset_allow_sensative_texture_replacements", "0"},
{"ruleset_allow_localvolume", "0"},
{"gl_shadeq1", "0"},
{"gl_shadeq3", "0"},
{"ruleset_allow_shaders", "0"},
{NULL}
};

View File

@ -35,10 +35,8 @@ typedef struct {
int bpp;
int rate;
int multisample; //for opengl antialiasing (which requires context stuff)
float stretch;
char glrenderer[MAX_QPATH];
r_qrenderer_t renderer;
qboolean allow_modex;
} rendererstate_t;
typedef struct vrect_s
@ -49,32 +47,29 @@ typedef struct vrect_s
typedef struct
{
pixel_t *buffer; // invisible buffer
pixel_t *colormap; // 256 * VID_GRADES size
int fullbright; // index of first fullbright color
unsigned rowbytes; // may be > width if displayed in a window
unsigned width;
unsigned height;
float aspect; // width / height -- < 0 is taller than wide
int numpages;
int recalc_refdef; // if true, recalc vid-based stuff
pixel_t *conbuffer;
int conrowbytes;
unsigned conwidth;
unsigned conheight;
FTE_DEPRECATED pixel_t *conbuffer;
FTE_DEPRECATED int conrowbytes;
FTE_DEPRECATED unsigned conwidth;
FTE_DEPRECATED unsigned conheight;
int maxwarpwidth;
int maxwarpheight;
pixel_t *direct; // direct drawing to framebuffer, if not
// NULL
unsigned pixelwidth;
unsigned pixelheight;
} viddef_t;
extern viddef_t vid; // global video state
extern unsigned int d_8to24rgbtable[256];
#ifdef RGLQUAKE
#ifdef GLQUAKE
void GLVID_SetPalette (unsigned char *palette);
// called at startup and after any gamma correction
@ -89,6 +84,8 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette);
void GLVID_Shutdown (void);
// Called at shutdown
void GLVID_Crashed(void);
void GLVID_Update (vrect_t *rects);
// flushes the given rectangles from the view buffer to the screen

View File

@ -362,7 +362,7 @@ void BuildGammaTable (float g, float c)
V_CheckGamma
=================
*/
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue)
{
BuildGammaTable (v_gamma.value, v_contrast.value);
@ -598,7 +598,7 @@ void V_CalcPowerupCshift (void)
V_CalcBlend
=============
*/
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
void GLV_CalcBlendServer (float colors[4])
{
@ -640,7 +640,7 @@ void GLV_CalcBlend (void)
{
// if (j != CSHIFT_SERVER)
// {
if (!gl_cshiftpercent.value || !gl_cshiftenabled.value)
if (!gl_cshiftpercent.value || !gl_cshiftenabled.ival)
continue;
a2 = ((cl.cshifts[j].percent * gl_cshiftpercent.value) / 100.0) / 255.0;
@ -693,7 +693,7 @@ void GLV_UpdatePalette (qboolean force, double ftime)
for (i=0 ; i<CSHIFT_SERVER ; i++)
{
if (gl_nohwblend.value || !gl_cshiftenabled.value)
if (gl_nohwblend.ival || !gl_cshiftenabled.ival)
{
if (0 != cl.prev_cshifts[i].percent)
{
@ -732,7 +732,7 @@ void GLV_UpdatePalette (qboolean force, double ftime)
GLV_CalcBlend ();
a = v_blend[3];
if (gl_nohwblend.value)
if (gl_nohwblend.ival)
a = 0;
r = 255*v_blend[0]*a;
g = 255*v_blend[1]*a;
@ -1049,8 +1049,8 @@ void V_CalcRefdef (int pnum)
if (view_message && view_message->flags & PF_DEAD && v_deathtilt.value) // PF_GIB will also set PF_DEAD
{
if (!cl.spectator || !cl_chasecam.value)
r_refdef.viewangles[ROLL] = 80; // dead view angle
if (!cl.spectator || !cl_chasecam.ival)
r_refdef.viewangles[ROLL] = 80*v_deathtilt.value; // dead view angle
}
else
{
@ -1162,9 +1162,6 @@ entity_t *CL_EntityNum(int num)
float CalcFov (float fov_x, float width, float height);
void SCR_VRectForPlayer(vrect_t *vrect, int pnum)
{
#ifdef GLQUAKE
extern int glwidth, glheight;
#endif
#if MAX_SPLITS > 4
#pragma warning "Please change this function to cope with the new MAX_SPLITS value"
#endif
@ -1186,7 +1183,7 @@ void SCR_VRectForPlayer(vrect_t *vrect, int pnum)
case 2: //horizontal bands
case 3:
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL && glwidth > glheight * 2)
if (qrenderer == QR_OPENGL && vid.pixelwidth > vid.pixelheight * 2)
{ //over twice as wide as high, assume duel moniter, horizontal.
vrect->width = vid.width/cl.splitclients;
vrect->height = vid.height;
@ -1219,15 +1216,12 @@ void SCR_VRectForPlayer(vrect_t *vrect, int pnum)
if (cl.stats[pnum][STAT_VIEWZOOM])
r_refdef.fov_x *= cl.stats[pnum][STAT_VIEWZOOM]/255.0f;
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL && vrect->width < (vrect->height*640)/432)
if (vrect->width < (vrect->height*640)/432)
{
extern int glwidth, glheight;
r_refdef.fov_y = CalcFov(r_refdef.fov_x, (vrect->width*glwidth)/vid.width, (vrect->height*glheight)/vid.height);
r_refdef.fov_y = CalcFov(r_refdef.fov_x, (vrect->width*vid.pixelwidth)/vid.width, (vrect->height*vid.pixelheight)/vid.height);
// r_refdef.fov_x = CalcFov(r_refdef.fov_y, 432, 640);
}
else
#endif
{
r_refdef.fov_y = CalcFov(r_refdef.fov_x, 640, 432);
r_refdef.fov_x = CalcFov(r_refdef.fov_y, vrect->height, vrect->width);
@ -1247,12 +1241,12 @@ void R_DrawNameTags(void)
if (!cl.spectator && !cls.demoplayback)
return;
if (!scr_autoid.value)
if (!scr_autoid.ival)
return;
if (cls.state != ca_active || !cl.validsequence)
return;
#ifdef RGLQUAKE
#ifdef GLQUAKE
if (qrenderer == QR_OPENGL)
{
void GL_Set2D (void);
@ -1350,7 +1344,7 @@ void V_RenderPlayerViews(int plnum)
r_refdef.vrect.height += vsecheight;
}
*/
#ifdef RGLQUAKE
#ifdef GLQUAKE
gl_ztrickdisabled&=~1;
#endif
for (viewnum = 0; viewnum < SIDEVIEWS; viewnum++)

View File

@ -36,4 +36,4 @@ qboolean V_CheckGamma (void);
void V_AddEntity(entity_t *in);
void VQ2_AddLerpEntity(entity_t *in);
void V_AddAxisEntity(entity_t *in);
void V_AddLight (vec3_t org, float quant, float r, float g, float b);
int V_AddLight (int entsource, vec3_t org, float quant, float r, float g, float b);

View File

@ -38,7 +38,7 @@ Space padding is so names can be printed nicely in tables.
Can safely be performed in place.
==================
*/
void W_CleanupName (char *in, char *out)
void W_CleanupName (const char *in, char *out)
{
int i;
int c;
@ -136,7 +136,7 @@ lumpinfo_t *W_GetLumpinfo (char *name)
return NULL;
}
void *W_SafeGetLumpName (char *name)
void *W_SafeGetLumpName (const char *name)
{
int i;
lumpinfo_t *lump_p;
@ -428,6 +428,25 @@ qbyte *W_GetTexture(char *name, int *width, int *height, qboolean *usesalpha)//r
miptex_t *tex;
qbyte *data;
if (!strncmp(name, "gfx/", 4))
{
qpic_t *p;
p = W_SafeGetLumpName(name+4);
if (p)
{
*width = p->width;
*height = p->height;
*usesalpha = false;
data = BZ_Malloc(p->width * p->height * 4);
for (i = 0; i < p->width * p->height; i++)
{
((unsigned int*)data)[i] = d_8to24rgbtable[p->data[i]];
}
return data;
}
}
texname[16] = 0;
W_CleanupName (name, texname);
for (i = 0;i < numwadtextures;i++)
@ -562,10 +581,11 @@ void Mod_ParseInfoFromEntityLump(char *data, char *mapname) //actually, this sho
extern model_t *loadmodel;
char key[128];
char skyname[64];
float skyrotate = 0;
vec3_t skyaxis = {0, 0, 0};
mapskys_t *msky;
cl.skyrotate = 0;
VectorClear(cl.skyaxis);
wads[0] = '\0';
#ifndef CLIENTONLY
@ -622,7 +642,7 @@ void Mod_ParseInfoFromEntityLump(char *data, char *mapname) //actually, this sho
}
else if (!strcmp("skyrotate", key))
{
skyrotate = atof(com_token);
cl.skyrotate = atof(com_token);
}
else if (!strcmp("skyaxis", key))
{
@ -631,21 +651,18 @@ void Mod_ParseInfoFromEntityLump(char *data, char *mapname) //actually, this sho
s = COM_Parse(key);
if (s)
{
skyaxis[0] = atof(s);
cl.skyaxis[0] = atof(s);
s = COM_Parse(s);
if (s)
{
skyaxis[1] = atof(s);
cl.skyaxis[1] = atof(s);
COM_Parse(s);
if (s)
skyaxis[2] = atof(s);
cl.skyaxis[2] = atof(s);
}
}
}
}
skyrotate = VectorNormalize(skyaxis);
R_SetSky(skyname, skyrotate, skyaxis);
}
//textures/fred.wad is the DP standard - I wanna go for that one.

View File

@ -43,7 +43,7 @@ typedef struct
qbyte data[4]; // variably sized
} qpic_t;
#ifdef RGLQUAKE
#ifdef GLQUAKE
typedef struct
{
int texnum;
@ -51,6 +51,7 @@ typedef struct
} glpic_t;
#endif
/*
//this is what's actually used.
#define MPIC_ALPHA 1
typedef struct //use this so we don't have to go slow over pics, and don't have to shift too much data around.
@ -62,12 +63,15 @@ typedef struct //use this so we don't have to go slow over pics, and don't have
union {
int dummy;
#ifdef RGLQUAKE
#ifdef GLQUAKE
glpic_t gl;
#endif
} d;
struct shader_s *shader;
} mpic_t;
*/
typedef struct shader_s shader_t;
#define mpic_t shader_t
extern mpic_t *draw_disc; // also used on sbar
@ -95,10 +99,10 @@ extern lumpinfo_t *wad_lumps;
extern qbyte *wad_base;
void W_LoadWadFile (char *filename);
void W_CleanupName (char *in, char *out);
void W_CleanupName (const char *in, char *out);
lumpinfo_t *W_GetLumpinfo (char *name);
void *W_GetLumpName (char *name);
void *W_SafeGetLumpName (char *name);
void *W_SafeGetLumpName (const char *name);
void *W_GetLumpNum (int num);
void Wads_Flush (void);

View File

@ -931,7 +931,7 @@ static void CountNearbyPlayers(qboolean dead)
static char *Macro_CountNearbyEnemyPlayers (void)
{
if (!ruleset_allow_playercount.value)
if (!ruleset_allow_playercount.ival)
return " ";
CountNearbyPlayers(false);
sprintf(macro_buf, "\xffz%d\xff", vars.numenemies);
@ -942,7 +942,7 @@ static char *Macro_CountNearbyEnemyPlayers (void)
static char *Macro_Count_Last_NearbyEnemyPlayers (void)
{
if (!ruleset_allow_playercount.value)
if (!ruleset_allow_playercount.ival)
return " ";
if (vars.deathtrigger_time && realtime - vars.deathtrigger_time <= 5)
{
@ -960,7 +960,7 @@ static char *Macro_Count_Last_NearbyEnemyPlayers (void)
static char *Macro_CountNearbyFriendlyPlayers (void)
{
if (!ruleset_allow_playercount.value)
if (!ruleset_allow_playercount.ival)
return " ";
CountNearbyPlayers(false);
sprintf(macro_buf, "\xffz%d\xff", vars.numfriendlies);
@ -971,7 +971,7 @@ static char *Macro_CountNearbyFriendlyPlayers (void)
static char *Macro_Count_Last_NearbyFriendlyPlayers (void)
{
if (!ruleset_allow_playercount.value)
if (!ruleset_allow_playercount.ival)
return " ";
if (vars.deathtrigger_time && realtime - vars.deathtrigger_time <= 5)
{
@ -1200,7 +1200,7 @@ static char *TP_ParseMacroString (char *s)
int i = 0;
char *macro_string;
if (!cl_parseSay.value)
if (!cl_parseSay.ival)
return s;
while (*s && i < MAX_MACRO_STRING-1)
@ -1322,7 +1322,7 @@ static char *TP_ParseFunChars (char *s, qbool chat)
char *out = buf;
int c;
if (!cl_parseFunChars.value)
if (!cl_parseFunChars.ival)
return s;
while (*s) {
@ -2505,7 +2505,7 @@ static int CountTeammates (void)
player_info_t *player;
char *myteam;
if (tp_forceTriggers.value)
if (tp_forceTriggers.ival)
return 1;
if (!cl.teamplay)
@ -2531,7 +2531,7 @@ static qboolean CheckTrigger (void)
if (cl.spectator)
return false;
if (tp_forceTriggers.value)
if (tp_forceTriggers.ival)
return true;
if (!cl.teamplay)
@ -2695,6 +2695,7 @@ more:
}
}
qboolean R_CullSphere (vec3_t org, float radius);
static qboolean TP_IsItemVisible(item_vis_t *visitem)
{
vec3_t end, v;
@ -2703,6 +2704,9 @@ static qboolean TP_IsItemVisible(item_vis_t *visitem)
if (visitem->dist <= visitem->radius)
return true;
if (R_CullSphere(visitem->entorg, visitem->radius))
return false;
VectorNegate (visitem->dir, v);
VectorNormalize (v);
VectorMA (visitem->entorg, visitem->radius, v, end);
@ -3044,7 +3048,7 @@ void TP_UpdateAutoStatus(void)
char newstatusbuf[sizeof(vars.autoteamstatus)];
char *newstatus;
if (vars.autoteamstatus_time > realtime)
if (vars.autoteamstatus_time > realtime || !*tp_autostatus.string)
return;
vars.autoteamstatus_time = realtime + 3;

View File

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __BOTHDEFS_H
#if defined(__APPLE__) && defined(__MACH__)
#define MACOSX
#define MACOSX
#endif
#if defined(__MINGW32_VERSION) || defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__)
@ -35,6 +35,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef HAVE_CONFIG_H //if it was configured properly, then we have a more correct list of features we want to use.
#include "config.h"
#else
#ifndef MSVCLIBSPATH
#define MSVCLIBSPATH "../libs/"
#endif
#ifdef NO_LIBRARIES
#define NO_DIRECTX
@ -72,6 +75,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_FREETYPE
#endif
//#define ODE_DYNAMIC
#ifdef NO_PNG
#undef AVAIL_PNGLIB
#endif
@ -92,7 +97,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
//#define AVAIL_FREETYPE
//#define NEWBACKEND
//set any additional defines or libs in win32
#ifndef AVAIL_MASM
@ -142,8 +146,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define Q2CLIENT //client can connect to q2 servers
#define Q3CLIENT
#define Q3SERVER
// #define HLCLIENT //we can run HL gamecode (not protocol compatible)
// #define HLSERVER //we can run HL gamecode (not protocol compatible)
// #define HLCLIENT 7 //we can run HL gamecode (not protocol compatible, set to 6 or 7)
// #define HLSERVER 140 //we can run HL gamecode (not protocol compatible, set to 138 or 140)
#define NQPROT //server and client are capable of using quake1/netquake protocols. (qw is still prefered. uses the command 'nqconnect')
#define FISH //fisheye distortion stuff
#define ZLIB //zip/pk3 support
@ -158,6 +162,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TEXTEDITOR
#define PPL //per pixel lighting (stencil shadowing)
#define DDS //a sort of image file format.
#define RTLIGHTS //realtime lighting
#define VM_Q1 //q1 qvm gamecode interface
@ -173,8 +178,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CSQC_DAT //support for csqc
#define MENU_DAT //support for menu.dat
#define Q3SHADERS
#define PSET_SCRIPT
#define PSET_CLASSIC
//#define PSET_DARKPLACES
@ -186,11 +189,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
//temporarily disable stuff here, so as to not break any custom configs
#ifdef Q3SHADERS
//#define NEWBACKEND
#endif
//fix things a little...
@ -207,7 +205,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif
#if !defined(AVAIL_D3D) || (!defined(GLQUAKE) && !defined(RGLQUAKE))
#if !defined(AVAIL_D3D) || !defined(GLQUAKE)
#undef USE_D3D
#endif
@ -227,7 +225,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef WEBCLIENT
#undef TEXTEDITOR
#undef RUNTIMELIGHTING
#undef Q3SHADERS
#undef TERRAIN //not supported
#undef PSET_SCRIPT
@ -353,11 +350,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#ifdef _MSC_VER
#define VARGS __cdecl
#define VARGS __cdecl
#define MSVCDISABLEWARNINGS
#define FTE_DEPRECATED __declspec(deprecated)
#define NORETURN __declspec(noreturn)
#endif
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define FTE_DEPRECATED __attribute__((__deprecated__)) //no idea about the actual gcc version
#define LIKEPRINTF(x) __attribute__((format(printf,x,x+1)))
#endif
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
#define NORETURN __attribute__((noreturn))
#endif
#ifndef FTE_DEPRECATED
#define FTE_DEPRECATED
#endif
#ifndef LIKEPRINTF
#define LIKEPRINTF(x)
#endif
#ifndef VARGS
#define VARGS
#endif
#ifndef NORETURN
#define NORETURN
#endif
#ifdef _WIN32
#define ZEXPORT VARGS

View File

@ -492,22 +492,21 @@ typedef struct
#define Q2CONTENTS_LADDER 0x20000000
//Texinfo flags - warning: these mix with q3 surface flags
#define TI_LIGHT 0x1 // value will hold the light strength
#define SURF_LIGHT 0x1 // value will hold the light strength
#define TI_SLICK 0x2 // effects game physics
#define SURF_SLICK 0x2 // effects game physics
#define TI_SKY 0x4 // don't draw, but add to skybox
#define TI_WARP 0x8 // turbulent water warp
#define TI_TRANS33 0x10
#define TI_TRANS66 0x20
#define TI_FLOWING 0x40 // scroll towards angle
#define TI_NODRAW 0x80 // don't bother referencing the texture
#define SURF_SKY 0x4 // don't draw, but add to skybox
#define SURF_WARP 0x8 // turbulent water warp
#define SURF_TRANS33 0x10
#define SURF_TRANS66 0x20
#define SURF_FLOWING 0x40 // scroll towards angle
#define SURF_NODRAW 0x80 // don't bother referencing the texture
#define SURF_NODRAW 0x80 // don't bother referencing the texture
#define SURF_ALPHATEST 0x100
#define TI_ALPHATEST 0x100
//Surface flags
#define Q3SURF_LADDER 0x8 //wee
// content masks

View File

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
cvar_t com_fs_cache = SCVARF("fs_cache", "0", CVAR_ARCHIVE);
cvar_t rcon_level = SCVAR("rcon_level", "50");
cvar_t rcon_level = SCVAR("rcon_level", "20");
cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536");
int Cmd_ExecLevel;
@ -103,7 +103,7 @@ char *TP_MacroString (char *s, int *len)
if (!Q_strcasecmp(s, macro->name))
{
if (macro->disputableintentions)
if (!tp_disputablemacros.value)
if (!tp_disputablemacros.ival)
continue;
if (len)
*len = strlen(macro->name);
@ -208,7 +208,7 @@ void Cbuf_AddText (const char *text, int level)
newmax = cmd_text[level].buf.maxsize*2;
if (newmax > cmd_maxbuffersize.value && cmd_maxbuffersize.value)
if (newmax > cmd_maxbuffersize.ival && cmd_maxbuffersize.ival)
{
Con_TPrintf (TL_FUNCOVERFLOW, "Cbuf_AddText");
return;
@ -531,7 +531,7 @@ void Cmd_Exec_f (void)
Con_TPrintf (TL_EXECFAILED,name);
return;
}
if (cl_warncmd.value || developer.value)
if (cl_warncmd.ival || developer.ival)
Con_TPrintf (TL_EXECING,name);
// don't execute anything as if it was from server
@ -676,7 +676,7 @@ void Cmd_Alias_f (void)
{
if (!strcmp(s, a->name))
{
if ((a->restriction?a->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((a->restriction?a->restriction:rcon_level.ival) > Cmd_ExecLevel)
{
Con_TPrintf (TL_ALIASRESTRICTIONLEVELERROR);
return;
@ -835,7 +835,7 @@ char *Cmd_AliasExist(char *name, int restrictionlevel)
{
if (!strcmp(name, a->name))
{
if ((a->restriction?a->restriction:rcon_level.value) > restrictionlevel)
if ((a->restriction?a->restriction:rcon_level.ival) > restrictionlevel)
{
return NULL; //not at this level...
}
@ -879,7 +879,7 @@ void Cmd_AliasLevel_f (void)
else if (level < RESTRICT_MIN)
level = RESTRICT_MIN;
if (level > Cmd_ExecLevel || (a->restriction?a->restriction:rcon_level.value) > Cmd_ExecLevel)
if (level > Cmd_ExecLevel || (a->restriction?a->restriction:rcon_level.ival) > Cmd_ExecLevel)
{
Con_TPrintf(TL_ALIASRAISELEVELERROR);
return;
@ -908,16 +908,16 @@ void Cmd_AliasList_f (void)
for (cmd=cmd_alias ; cmd ; cmd=cmd->next)
{
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
continue;
if (flags && !(cmd->flags & flags))
continue;
if (!num)
Con_TPrintf(TL_ALIASLIST);
if (cmd->execlevel)
Con_Printf("(%2i)(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.value), cmd->execlevel, cmd->name);
Con_Printf("(%2i)(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->execlevel, cmd->name);
else
Con_Printf("(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.value), cmd->name);
Con_Printf("(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->name);
num++;
}
if (num)
@ -931,7 +931,7 @@ void Alias_WriteAliases (vfsfile_t *f)
int num=0;
for (cmd=cmd_alias ; cmd ; cmd=cmd->next)
{
// if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
// if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
// continue;
if (cmd->flags & ALIAS_FROMSERVER)
continue;
@ -1581,9 +1581,9 @@ void Cmd_RestrictCommand_f (void)
if (cmd->restriction)
Con_TPrintf (TL_RESTRICTCURRENTLEVEL, cmd_name, (int)cmd->restriction);
else
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, (int)rcon_level.value);
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, rcon_level.ival);
}
else if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
else if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
Con_TPrintf(TL_RESTRICTCOMMANDTOOHIGH);
else
cmd->restriction = level;
@ -1600,9 +1600,9 @@ void Cmd_RestrictCommand_f (void)
if (v->restriction)
Con_TPrintf (TL_RESTRICTCURRENTLEVEL, cmd_name, (int)v->restriction);
else
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, (int)rcon_level.value);
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, rcon_level.ival);
}
else if ((v->restriction?v->restriction:rcon_level.value) > Cmd_ExecLevel)
else if ((v->restriction?v->restriction:rcon_level.ival) > Cmd_ExecLevel)
Con_TPrintf(TL_RESTRICTCOMMANDTOOHIGH);
else
v->restriction = level;
@ -1620,9 +1620,9 @@ void Cmd_RestrictCommand_f (void)
if (a->restriction)
Con_TPrintf (TL_RESTRICTCURRENTLEVEL, cmd_name, (int)a->restriction);
else
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, (int)rcon_level.value);
Con_TPrintf (TL_RESTRICTCURRENTLEVELDEFAULT, cmd_name, rcon_level.ival);
}
else if ((a->restriction?a->restriction:rcon_level.value) > Cmd_ExecLevel)
else if ((a->restriction?a->restriction:rcon_level.ival) > Cmd_ExecLevel)
Con_TPrintf(TL_RESTRICTCOMMANDTOOHIGH);
else
a->restriction = level;
@ -1642,7 +1642,7 @@ int Cmd_Level(char *name)
{
if (!strcmp(cmds->name, name))
{
return cmds->restriction?cmds->restriction:rcon_level.value;
return cmds->restriction?cmds->restriction:rcon_level.ival;
}
}
for (a=cmd_alias ; a ; a=a->next)
@ -1796,11 +1796,11 @@ void Cmd_List_f (void)
int num=0;
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
continue;
if (!num)
Con_TPrintf(TL_COMMANDLISTHEADER);
Con_Printf("(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.value), cmd->name);
Con_Printf("(%2i) %s\n", (int)(cmd->restriction?cmd->restriction:rcon_level.ival), cmd->name);
num++;
}
if (num)
@ -1912,7 +1912,7 @@ void Cmd_ExecuteString (char *text, int level)
if (strcmp (cmd_argv[0],cmd->name))
break; //yes, I know we found it... (but it's the wrong case, go for an alias or cvar instead FIRST)
if ((cmd->restriction?cmd->restriction:rcon_level.value) > level)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > level)
Con_TPrintf(TL_WASRESTIRCTED, cmd_argv[0]);
else if (!cmd->function)
{
@ -1952,7 +1952,7 @@ void Cmd_ExecuteString (char *text, int level)
return;
#endif
if ((a->restriction?a->restriction:rcon_level.value) > level)
if ((a->restriction?a->restriction:rcon_level.ival) > level)
{
Con_TPrintf(TL_WASRESTIRCTED, cmd_argv[0]);
return;
@ -1988,7 +1988,7 @@ void Cmd_ExecuteString (char *text, int level)
if (cmd) //go for skipped ones
{
if ((cmd->restriction?cmd->restriction:rcon_level.value) > level)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > level)
Con_TPrintf(TL_WASRESTIRCTED, cmd_argv[0]);
else if (!cmd->function)
Cmd_ForwardToServer ();
@ -2219,7 +2219,7 @@ const char *If_Token(const char *func, const char **end)
var = Cvar_FindVar(com_token); //for consistancy.
if (var)
{
if ((var->restriction?var->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((var->restriction?var->restriction:rcon_level.ival) > Cmd_ExecLevel)
s2 = "RESTRICTED";
else
s2 = var->string;
@ -2904,7 +2904,7 @@ void Cmd_Init (void)
Cvar_Register(&tp_disputablemacros, "Teamplay");
#ifndef SERVERONLY
rcon_level.value = atof(rcon_level.string); //client is restricted to not be allowed to change restrictions.
rcon_level.ival = atof(rcon_level.string); //client is restricted to not be allowed to change restrictions.
#else
Cvar_Register(&rcon_level, "Access controls"); //server gains versatility.
#endif

View File

@ -69,6 +69,7 @@ typedef void (*xcommand_t) (void);
int Cmd_Level(char *name);
void Cmd_Init (void);
void Cmd_Shutdown(void);
void Cmd_StuffCmds (void);
void Cmd_RemoveCommand (char *cmd_name);
@ -116,14 +117,14 @@ void Cmd_ExecuteString (char *text, int restrictionlevel);
void Cmd_Args_Set(char *newargs);
#define RESTRICT_MAX 64 //1-64 it's all about bit size. This is max settable. servers are +1
#define RESTRICT_DEFAULT 50 //rcon get's 63, local always gets 64
#define RESTRICT_MAX 29 //1-64 it's all about bit size. This is max settable. servers are +1 or +2
#define RESTRICT_DEFAULT 20 //rcon get's 63, local always gets 64
#define RESTRICT_MIN 1 //rcon get's 63, local always gets 64
#define RESTRICT_LOCAL RESTRICT_MAX
#define RESTRICT_INSECURE RESTRICT_MAX+1
#define RESTRICT_SERVER RESTRICT_MAX+2
#define RESTRICT_RCON rcon_level.value
#define RESTRICT_RCON rcon_level.ival
#define RESTRICT_PROGS RESTRICT_MAX-2
#define Cmd_FromGamecode() (Cmd_ExecLevel>=RESTRICT_SERVER) //cheat provention

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,8 @@
#define MAX_BONES 256
int HLMod_BoneForName(model_t *mod, char *name);
int HLMod_FrameForName(model_t *mod, char *name);
typedef struct {
int ofs_indexes;
@ -65,6 +67,8 @@ typedef struct {
int ofsverts;
#ifndef SERVERONLY
int ofsnormals;
int ofstvector;
int ofssvector;
#endif
vec3_t scale;
@ -101,24 +105,13 @@ typedef struct {
char name [MAX_QPATH];
} galiasskin_t;
typedef struct {
int base;
int bump;
int fullbright;
int upperoverlay;
int loweroverlay;
#ifdef Q3SHADERS
shader_t *shader;
#endif
} galiastexnum_t;
typedef struct {
char name[MAX_QPATH];
galiastexnum_t texnum;
texnums_t texnum;
unsigned int tcolour;
unsigned int bcolour;
int skinnum;
unsigned int subframe;
bucket_t bucket;
} galiascolourmapped_t;
#endif
@ -148,3 +141,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer);
qboolean Mod_LoadMD5MeshModel(model_t *mod, void *buffer);
qboolean Mod_LoadCompositeAnim(model_t *mod, void *buffer);
#endif
void Mod_AccumulateTextureVectors(vecV_t *vc, vec2_t *tc, vec3_t *nv, vec3_t *sv, vec3_t *tv, index_t *idx, int numidx);
void Mod_AccumulateMeshTextureVectors(mesh_t *mesh);
void Mod_NormaliseTextureVectors(vec3_t *n, vec3_t *s, vec3_t *t, int v);

View File

@ -56,7 +56,6 @@ qboolean static_registered = true; // only for startup check, then set
qboolean msg_suppress_1 = false;
void COM_InitFilesystem (void);
void COM_Path_f (void);
void COM_Dir_f (void);
void COM_Locate_f (void);
@ -1619,6 +1618,8 @@ void COM_DefaultExtension (char *path, char *extension, int maxlen)
src--;
}
if (*extension != '.')
Q_strncatz (path, ".", maxlen);
Q_strncatz (path, extension, maxlen);
}
@ -1755,7 +1756,7 @@ static int dehex(int i)
//Takes a q3-style fun string, and returns an expanded string-with-flags (actual return value is the null terminator)
//outsize parameter is in _BYTES_ (so sizeof is safe).
conchar_t *COM_ParseFunString(conchar_t defaultflags, char *str, conchar_t *out, int outsize, qboolean keepmarkup)
conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t *out, int outsize, qboolean keepmarkup)
{
conchar_t extstack[4];
int extstackdepth = 0;
@ -2078,6 +2079,7 @@ messedup:
int COM_FunStringLength(unsigned char *str)
{
//FIXME:
int len = 0;
while(*str)
@ -3213,7 +3215,7 @@ int COM_Effectinfo_Add(const char *effectname)
void COM_Effectinfo_Reload(void)
{
int i;
char *f;
char *f, *buf;
static const char *dpnames[] =
{
"TE_GUNSHOT",
@ -3263,6 +3265,7 @@ void COM_Effectinfo_Reload(void)
FS_LoadFile("effectinfo.txt", &f);
if (!f)
return;
buf = f;
while (*f)
{
f = COM_ParseToken(f, NULL);
@ -3281,7 +3284,7 @@ void COM_Effectinfo_Reload(void)
} while(*f && strcmp(com_token, "\n"));
}
}
FS_FreeFile(f);
FS_FreeFile(buf);
}
unsigned int COM_Effectinfo_ForName(const char *efname)
@ -3314,6 +3317,71 @@ char *COM_Effectinfo_ForNumber(unsigned int efnum)
return "";
}
/*************************************************************************/
/*remaps map checksums from known non-cheat GPL maps to authentic id1 maps*/
unsigned int COM_RemapMapChecksum(unsigned int checksum)
{
static const struct {
char *name;
unsigned int gpl2;
unsigned int id11;
unsigned int id12;
} sums[] =
{
{"maps/start.bsp", -603735309, 714749795, 493454459},
{"maps/e1m1.bsp", -1213097692, 523840258, -1391994750},
{"maps/e1m2.bsp", -2134038629, 1561595172, 1729102119},
{"maps/e1m3.bsp", 526593427, 1008794158, 893792842},
{"maps/e1m4.bsp", -1218723400, -442162482, -304478603},
{"maps/e1m5.bsp", 1709090059, 1856217547, -1473504118},
{"maps/e1m6.bsp", 1014375998, 1304756164, 738207971},
{"maps/e1m7.bsp", 1375393448, -1396746908, -1747518694},
{"maps/e1m8.bsp", 1470379688, -163803419, 79095617},
{"maps/e2m1.bsp", -1725230579, -797758554, -587894734},
{"maps/e2m2.bsp", -1573837115, -355822557, -1349116595},
{"maps/e2m3.bsp", 156655662, 1203005272, -57072303},
{"maps/e2m4.bsp", -1530012474, -1629664024, -1021928503},
{"maps/e3m5.bsp", -594001393, -1405673977, -1854273999},
{"maps/e2m6.bsp", 1041933133, 583875451, -1851573375},
{"maps/e2m7.bsp", -1583122652, 1814005234, 2051006488},
{"maps/e3m1.bsp", -1118143869, -457270773, -1867379423},
{"maps/e3m2.bsp", -469484146, 723435606, -1670613704},
{"maps/e3m3.bsp", -300762423, -540030088, -1009754856},
{"maps/e3m4.bsp", -214067894, 1107310161, -1317466952},
{"maps/e3m5.bsp", -594001393, -1405673977, -1854273999},
{"maps/e3m6.bsp", -1664550468, 1631142730, 767655416},
{"maps/e3m7.bsp", 781051658, -1513131760, 272220593},
{"maps/e4m1.bsp", 1548541253, 1254243660, -1141873840},
{"maps/e4m2.bsp", -1400585206, 92253388, -472296},
{"maps/e4m3.bsp", -1230693918, 1961442781, 1505685644},
{"maps/e4m4.bsp", 842253404, -374904516, 758847551},
{"maps/e4m5.bsp", -439098147, 389110272, 1771890676},
{"maps/e4m6.bsp", 1518024640, 1714857656, 102825880},
{"maps/e4m7.bsp", -381063035, -585362206, -1645477460},
{"maps/e4m8.bsp", 844770132, 1063417045, 1018457175},
{"maps/gpl_dm1.bsp", 2100781454, -1548219590, -976758093},
{"maps/gpl_dm2.bsp", 2066969664, 392410074, 1710634548},
{"maps/gpl_dm3.bsp", -1859681874, 2060033246, 367136248},
{"maps/gpl_dm4.bsp", -1015750775, 326737183, -1670388545},
{"maps/gpl_dm5.bsp", 2009758949, 766929852, -1339209475},
{"maps/gpl_dm6.bsp", 537693021, 247150701, 1376311851},
{"maps/end.bsp", -124054866, -1503553320, -1143688027}
};
unsigned int i;
for (i = 0; i < sizeof(sums)/sizeof(sums[0]); i++)
{
if (checksum == sums[i].gpl2)
return sums[i].id12;
}
return checksum;
}
/*
=====================================================================

View File

@ -187,7 +187,7 @@ int wildcmp(const char *wild, const char *string); //1 if match
#define Q_strcmp(s1, s2) strcmp((s1), (s2))
#define Q_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
void VARGS Q_snprintfz (char *dest, size_t size, char *fmt, ...);
void VARGS Q_snprintfz (char *dest, size_t size, char *fmt, ...) LIKEPRINTF(3);
#define Q_strncpyS(d, s, n) do{const char *____in=(s);char *____out=(d);int ____i; for (____i=0;*(____in); ____i++){if (____i == (n))break;*____out++ = *____in++;}if (____i < (n))*____out='\0';}while(0) //only use this when it should be used. If undiciided, use N
#define Q_strncpyN(d, s, n) do{if (n < 0)Sys_Error("Bad length in strncpyz");Q_strncpyS((d), (s), (n));((char *)(d))[n] = '\0';}while(0) //this'll stop me doing buffer overflows. (guarenteed to overflow if you tried the wrong size.)
@ -258,18 +258,19 @@ void COM_ParsePlusSets (void);
typedef unsigned int conchar_t;
void COM_DeFunString(conchar_t *str, char *out, int outsize, qboolean ignoreflags);
conchar_t *COM_ParseFunString(conchar_t defaultflags, char *str, conchar_t *out, int outsize, qboolean keepmarkup); //ext is usually CON_WHITEMASK, returns its null terminator
conchar_t *COM_ParseFunString(conchar_t defaultflags, const char *str, conchar_t *out, int outsize, qboolean keepmarkup); //ext is usually CON_WHITEMASK, returns its null terminator
int COM_FunStringLength(unsigned char *str);
char *COM_SkipPath (const char *pathname);
void COM_StripExtension (const char *in, char *out, int outlen);
void COM_StripAllExtensions (char *in, char *out, int outlen);
void COM_FileBase (const char *in, char *out, int outlen);
int COM_FileSize(const char *path);
void COM_DefaultExtension (char *path, char *extension, int maxlen);
char *COM_FileExtension (const char *in);
void COM_CleanUpPath(char *str);
char *VARGS va(char *format, ...);
char *VARGS va(char *format, ...) LIKEPRINTF(1);
// does a varargs printf into a temp buffer
//============================================================================
@ -338,7 +339,7 @@ typedef struct vfsfile_s {
#define VFS_FLUSH(vf) do{if(vf->Flush)vf->Flush(vf);}while(0)
#define VFS_PUTS(vf,s) do{const char *t=s;vf->WriteBytes(vf,t,strlen(t));}while(0)
char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen);
void VARGS VFS_PRINTF(vfsfile_t *vf, char *fmt, ...);
void VARGS VFS_PRINTF(vfsfile_t *vf, char *fmt, ...) LIKEPRINTF(2);
enum fs_relative{
FS_GAME, //standard search (not generally valid for save/rename/delete/etc)
@ -371,13 +372,18 @@ qbyte *COM_LoadTempFile2 (const char *path); //allocates a little bit more witho
qbyte *COM_LoadHunkFile (const char *path);
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu);
void COM_CreatePath (char *path);
void COM_Gamedir (const char *dir);
void FS_ForceToPure(const char *str, const char *crcs, int seed);
char *COM_GetPathInfo (int i, int *crc);
char *COM_NextPath (char *prevpath);
void COM_FlushFSCache(void); //a file was written using fopen
void COM_RefreshFSCache_f(void);
void COM_InitFilesystem (void);
void FS_Shutdown(void);
void COM_Gamedir (const char *dir);
char *FS_GetGamedir(void);
qbyte *FS_LoadMallocFile (const char *path);
int FS_LoadFile(char *name, void **file);
void FS_FreeFile(void *file);
@ -393,6 +399,8 @@ void COM_Effectinfo_Clear(void);
unsigned int COM_Effectinfo_ForName(const char *efname);
char *COM_Effectinfo_ForNumber(unsigned int efnum);
unsigned int COM_RemapMapChecksum(unsigned int checksum);
#define MAX_INFO_KEY 64
char *Info_ValueForKey (char *s, const char *key);
void Info_RemoveKey (char *s, const char *key);

View File

@ -124,13 +124,15 @@ extern int con_notifylines; // scan lines to clear for notify lines
void Con_DrawCharacter (int cx, int line, int num);
void Con_CheckResize (void);
void Con_ForceActiveNow(void);
void Con_Init (void);
void Con_DrawConsole (int lines, qboolean noback);
char *Con_CopyConsole(void);
void Con_Print (char *txt);
void VARGS Con_Printf (const char *fmt, ...);
void VARGS Con_Printf (const char *fmt, ...) LIKEPRINTF(1);
void VARGS Con_TPrintf (translation_t text, ...);
void VARGS Con_DPrintf (char *fmt, ...);
void VARGS Con_SafePrintf (char *fmt, ...);
void VARGS Con_DPrintf (char *fmt, ...) LIKEPRINTF(1);
void VARGS Con_SafePrintf (char *fmt, ...) LIKEPRINTF(1);
void Con_Clear_f (void);
void Con_DrawNotify (void);
void Con_ClearNotify (void);

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cvar.c -- dynamic variable tracking
#include "quakedef.h"
#include "shader.h"
cvar_group_t *cvar_groups;
@ -305,7 +306,7 @@ void Cvar_List_f (void)
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
{
// list only non-restricted cvars
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
continue;
// list only cvars with search substring
@ -481,7 +482,7 @@ void Cvar_Reset_f (void)
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
{
// reset only non-restricted cvars
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
continue;
// don't reset cvars with matched flags
@ -654,6 +655,12 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
}
#endif
#ifndef SERVERONLY
if (var->flags & CVAR_SHADERSYSTEM)
{
if (var->string && value)
if (strcmp(var->string, value))
Shader_NeedReload();
}
if (var->flags & CVAR_USERINFO)
{
char *old = Info_ValueForKey(cls.userinfo, var->name);
@ -1037,7 +1044,7 @@ qboolean Cvar_Command (int level)
if (!v)
return false;
if ((v->restriction?v->restriction:rcon_level.value) > level)
if ((v->restriction?v->restriction:rcon_level.ival) > level)
{
Con_Printf ("You do not have the priveledges for %s\n", v->name);
return true;

View File

@ -116,6 +116,7 @@ typedef struct cvar_group_s
#define CVAR_RENDERERCALLBACK (1<<13) //force callback for cvars on renderer change
#define CVAR_NOUNSAFEEXPAND (1<<14) // do not expand cvar value when command is from gamecode
#define CVAR_RULESETLATCH (1<<15) //latched by the ruleset
#define CVAR_SHADERSYSTEM (1<<16) //change flushes shaders.
#define CVAR_LASTFLAG CVAR_RULESETLATCH

View File

@ -13,6 +13,10 @@
#include "./mingw-libs/SDL_syswm.h" // mingw sdl cross binary complains off sys_parentwindow
#endif
#ifdef _MSC_VER
#pragma comment(lib, MSVCLIBSPATH "zlib.lib")
#endif
hashtable_t filesystemhash;
qboolean com_fschanged = true;
extern cvar_t com_fs_cache;
@ -769,9 +773,6 @@ typedef struct {
#define GZ_RESERVED (32|64|128)
#include <zlib.h>
#ifdef _WIN32
#pragma comment( lib, "../libs/zlib.lib" )
#endif
vfsfile_t *FS_DecompressGZip(vfsfile_t *infile, gzheader_t *header)
{
@ -1231,7 +1232,7 @@ qbyte *COM_LoadFile (const char *path, int usehunk)
return buf;
}
qbyte *COM_LoadMallocFile (const char *path) //used for temp info along side temp hunk
qbyte *FS_LoadMallocFile (const char *path)
{
return COM_LoadFile (path, 5);
}
@ -1272,7 +1273,7 @@ qbyte *COM_LoadStackFile (const char *path, void *buffer, int bufsize)
/*warning: at some point I'll change this function to return only read-only buffers*/
int FS_LoadFile(char *name, void **file)
{
*file = COM_LoadMallocFile(name);
*file = FS_LoadMallocFile(name);
if (!*file)
return -1;
return com_filesize;
@ -1638,6 +1639,7 @@ void COM_Gamedir (const char *dir)
searchpath_t *next;
int plen, dlen;
char *p;
qboolean isbase;
if (!*dir || !strcmp(dir, ".") || strstr(dir, "..") || strstr(dir, "/")
|| strstr(dir, "\\") || strstr(dir, ":") )
@ -1646,9 +1648,12 @@ void COM_Gamedir (const char *dir)
return;
}
isbase = false;
dlen = strlen(dir);
for (next = com_base_searchpaths; next; next = next->next)
for (next = com_searchpaths; next; next = next->next)
{
if (next == com_base_searchpaths)
isbase = true;
if (next->funcs == &osfilefuncs)
{
p = next->handle;
@ -1657,14 +1662,32 @@ void COM_Gamedir (const char *dir)
{
//no basedir, maybe
if (!strcmp(p, dir))
return;
{
if (isbase && com_searchpaths == com_base_searchpaths)
{
Q_strncpyz (gamedirfile, dir, sizeof(gamedirfile));
return;
}
if (!isbase)
return;
break;
}
}
else if (plen > dlen)
{
if (*(p+plen-dlen-1) == '/')
{
if (!strcmp(p+plen-dlen, dir))
return;
{
if (isbase && com_searchpaths == com_base_searchpaths)
{
Q_strncpyz (gamedirfile, dir, sizeof(gamedirfile));
return;
}
if (!isbase)
return;
break;
}
}
}
@ -1677,7 +1700,7 @@ void COM_Gamedir (const char *dir)
Host_WriteConfiguration(); //before we change anything.
#endif
strcpy (gamedirfile, dir);
Q_strncpyz (gamedirfile, dir, sizeof(gamedirfile));
#ifndef CLIENTONLY
sv.gamedirchanged = true;
@ -1746,12 +1769,10 @@ void COM_Gamedir (const char *dir)
}
}
#ifdef Q3SHADERS
{
extern void Shader_Init(void);
Shader_Init(); //FIXME!
}
#endif
COM_Effectinfo_Clear();

View File

@ -1,11 +1,16 @@
#include "quakedef.h"
#include "fs.h"
#ifdef WEBSVONLY
#define Z_Free free
#define Z_Malloc malloc
#else
#if !defined(_WIN32) || defined(_SDL)
#define VFSSTDIO_Open VFSOS_Open
#define stdiofilefuncs osfilefuncs
#endif
#define FSSTDIO_OpenTemp FS_OpenTemp
#endif
typedef struct {
vfsfile_t funcs;
@ -118,6 +123,8 @@ vfsfile_t *VFSSTDIO_Open(const char *osname, const char *mode)
return (vfsfile_t*)file;
}
#ifndef WEBSVONLY
static vfsfile_t *FSSTDIO_OpenVFS(void *handle, flocation_t *loc, const char *mode)
{
char diskname[MAX_OSPATH];
@ -131,7 +138,7 @@ static vfsfile_t *FSSTDIO_OpenVFS(void *handle, flocation_t *loc, const char *mo
static void FSSTDIO_PrintPath(void *handle)
{
Con_Printf("%s\n", handle);
Con_Printf("%s\n", (char*)handle);
}
static void FSSTDIO_ClosePath(void *handle)
{
@ -230,3 +237,4 @@ searchpathfuncs_t stdiofilefuncs = {
NULL,
FSSTDIO_OpenVFS
};
#endif

View File

@ -6,10 +6,6 @@
#include <zlib.h>
#include "unzip.c"
#ifdef _WIN32
#pragma comment( lib, "../libs/zlib.lib" )
#endif
typedef struct
{
char name[MAX_QPATH];

View File

@ -1,11 +1,8 @@
#include "quakedef.h"
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"
#include "shader.h"
#endif
#ifdef D3DQUAKE
#include "d3dquake.h"
#endif
#include "com_mesh.h"
#define MAX_Q3MAP_INDICES 0x80000
#define MAX_Q3MAP_VERTEXES 0x80000
@ -22,18 +19,18 @@
#define Q3SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes
#define Q3SURF_NONSOLID 0x4000 // don't collide against curves with this set
#if Q3SURF_NODRAW != SURF_NODRAW
#if Q3SURF_NODRAW != TI_NODRAW
#error "nodraw isn't constant"
#endif
extern cvar_t r_shadow_bumpscale_basetexture;
//these are in model.c (or gl_model.c)
qboolean GLMod_LoadVertexes (lump_t *l);
qboolean GLMod_LoadEdges (lump_t *l);
qboolean GLMod_LoadMarksurfaces (lump_t *l);
qboolean GLMod_LoadSurfedges (lump_t *l);
void GLMod_LoadLighting (lump_t *l);
qboolean RMod_LoadVertexes (lump_t *l);
qboolean RMod_LoadEdges (lump_t *l);
qboolean RMod_LoadMarksurfaces (lump_t *l);
qboolean RMod_LoadSurfedges (lump_t *l);
void RMod_LoadLighting (lump_t *l);
qboolean SWMod_LoadVertexes (lump_t *l);
qboolean SWMod_LoadEdges (lump_t *l);
@ -48,7 +45,6 @@ qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t star
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];
extern char loadname[32];
@ -333,15 +329,16 @@ int c_pointcontents;
int c_traces, c_brush_traces;
vec3_t *map_verts; //3points
vecV_t *map_verts; //3points
int numvertexes;
vec2_t *map_vertstmexcoords;
vec2_t *map_vertlstmexcoords;
byte_vec4_t *map_colors_array;
vec4_t *map_colors4f_array;
vec3_t *map_normals_array;
vec3_t *map_svector_array;
vec3_t *map_tvector_array;
#ifdef Q3SHADERS
typedef struct {
char shader[MAX_QPATH];
int brushNum;
@ -350,7 +347,6 @@ typedef struct {
mfog_t *map_fogs;
int map_numfogs;
#endif
q3cface_t *map_faces;
int numfaces;
@ -425,12 +421,6 @@ qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2
maxs1[0] >= mins2[0] && maxs1[1] >= mins2[1] && maxs1[2] >= mins2[2]);
}
#define VectorAvg(a,b,c) ((c)[0]=((a)[0]+(b)[0])*0.5f,(c)[1]=((a)[1]+(b)[1])*0.5f, (c)[2]=((a)[2]+(b)[2])*0.5f)
#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
#define Vector4Scale(in,scale,out) ((out)[0]=(in)[0]*scale,(out)[1]=(in)[1]*scale,(out)[2]=(in)[2]*scale,(out)[3]=(in)[3]*scale)
#define Vector4Add(a,b,c) ((c)[0]=(((a[0])+(b[0]))),(c)[1]=(((a[1])+(b[1]))),(c)[2]=(((a[2])+(b[2]))),(c)[3]=(((a[3])+(b[3]))))
/*
===============
Patch_FlatnessTest
@ -1032,17 +1022,19 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey);
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
void *Mod_LoadWall(char *name)
texture_t *Mod_LoadWall(char *name)
{
qbyte *in, *oin;
texture_t *tex;
q2miptex_t *wal;
int width, height;
int j;
char ln[32];
texnums_t tn;
memset(&tn, 0, sizeof(tn));
COM_FileBase(name, ln, sizeof(ln));
wal = (void *)COM_LoadMallocFile (name);
wal = (void *)FS_LoadMallocFile (name);
if (!wal)
{
//they will download eventually...
@ -1063,73 +1055,36 @@ void *Mod_LoadWall(char *name)
wal->contents = LittleLong(wal->contents);
wal->value = LittleLong(wal->value);
//FIXME: Is this needed?
oin = in = ReadPCXFile((qbyte *)wal, com_filesize, &width, &height);
if (!in)
oin = in = ReadTargaFile((qbyte *)wal, com_filesize, &width, &height, false);
if (in) //this is a pcx.
tex = Hunk_AllocName(sizeof(texture_t), ln);
tex->offsets[0] = wal->offsets[0];
tex->width = wal->width;
tex->height = wal->height;
tn.base = R_LoadReplacementTexture(wal->name, loadname, IF_NOALPHA);
if (!TEXVALID(tn.base))
{
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
{
tex = Hunk_AllocName(sizeof(texture_t), ln);
tex->offsets[0] = sizeof(*tex);
tex->width = width;
tex->height = height;
if (!(tex->tn.base = Mod_LoadReplacementTexture(name, loadname, true, false, true)))
if (!(tex->tn.base = Mod_LoadReplacementTexture(name, "bmodels", true, false, true)))
tex->tn.base = GL_LoadTexture32 (name, width, height, (unsigned int *)in, true, false);
}
else
#endif
{
Sys_Error("Mod_LoadWall with bad renderer\n");
tex = NULL;
}
BZ_Free(oin);
BZ_Free(wal);
return tex;
tn.base = R_LoadReplacementTexture(wal->name, "bmodels", IF_NOALPHA);
if (!TEXVALID(tn.base))
tn.base = R_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, IF_NOALPHA|IF_NOGAMMA);
}
#if defined(RGLQUAKE) || defined(D3DQUAKE)
if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
{
int j;
tex = Hunk_AllocName(sizeof(texture_t), ln);
tex->offsets[0] = wal->offsets[0];
tex->width = wal->width;
tex->height = wal->height;
if (!(tex->tn.base = Mod_LoadReplacementTexture(wal->name, loadname, true, false, true)))
if (!(tex->tn.base = Mod_LoadReplacementTexture(wal->name, "bmodels", true, false, true)))
tex->tn.base = R_LoadTexture8Pal24 (wal->name, tex->width, tex->height, (qbyte *)wal+wal->offsets[0], d_q28to24table, true, false);
in = Hunk_TempAllocMore(wal->width*wal->height);
oin = (qbyte *)wal+wal->offsets[0];
for (j = 0; j < wal->width*wal->height; j++)
in[j] = (d_q28to24table[oin[j]*3+0] + d_q28to24table[oin[j]*3+1] + d_q28to24table[oin[j]*3+2])/3;
tex->tn.bump = R_LoadTexture8Bump (va("%s_bump", wal->name), tex->width, tex->height, in, true, r_shadow_bumpscale_basetexture.value);
}
else
#endif
{
Sys_Error("Mod_LoadWall with bad renderer\n");
tex = NULL;
}
in = Hunk_TempAllocMore(wal->width*wal->height);
oin = (qbyte *)wal+wal->offsets[0];
for (j = 0; j < wal->width*wal->height; j++)
in[j] = (d_q28to24table[oin[j]*3+0] + d_q28to24table[oin[j]*3+1] + d_q28to24table[oin[j]*3+2])/3;
tn.bump = R_LoadTexture8Bump (va("%s_bump", wal->name), tex->width, tex->height, in, true, r_shadow_bumpscale_basetexture.value);
BZ_Free(wal);
tex->shader = R_RegisterShader_Lightmap(name);
R_BuildDefaultTexnums(&tn, tex->shader);
return tex;
}
qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place
{
extern cvar_t gl_shadeq2;
q2texinfo_t *in;
mtexinfo_t *out;
int i, j, count;
@ -1152,10 +1107,6 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
loadmodel->texinfo = out;
loadmodel->numtexinfo = count;
#if !defined(SERVERONLY) && (defined(RGLQUAKE) || defined(D3DQUAKE))
skytexturenum = -1;
#endif
for ( i=0 ; i<count ; i++, in++, out++)
{
out->flags = LittleLong (in->flags);
@ -1174,7 +1125,7 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
else
out->mipadjust = 1;
//damn q2...
//damn q2... compact the textures.
for (j=0; j < texcount; j++)
{
if (!strcmp(in->texture, loadmodel->textures[j]->name))
@ -1203,38 +1154,13 @@ qboolean CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same plac
// out->flags = 0;
}
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
if (gl_shadeq2.value)
out->texture->shader = R_RegisterCustom (name, NULL, NULL);
#endif
Q_strncpyz(out->texture->name, in->texture, sizeof(out->texture->name));
#if !defined(SERVERONLY) && defined(RGLQUAKE)
if (out->flags & SURF_SKY)
skytexturenum = texcount;
#endif
loadmodel->textures[texcount++] = out->texture;
}
#if !defined(SERVERONLY) && defined(RGLQUAKE)
else if (out->flags & SURF_SKY && skytexturenum>=0)
out->texture = loadmodel->textures[skytexturenum];
#endif
}
loadmodel->numtextures = texcount;
// count animation frames
/*
for (i=0 ; i<count ; i++)
{
out = &loadmodel->texinfo[i];
// out->numframes = 1;
// for (step = out->next ; step && step != out ; step=step->next)
// out->numframes++;
}
*/
return true;
}
#endif
@ -1335,11 +1261,11 @@ qboolean CMod_LoadFaces (lump_t *l)
out->texinfo = loadmodel->texinfo + ti;
#ifndef SERVERONLY
if (out->texinfo->flags & SURF_SKY)
if (out->texinfo->flags & TI_SKY)
{
out->flags |= SURF_DRAWSKY;
}
if (out->texinfo->flags & SURF_WARP)
if (out->texinfo->flags & TI_WARP)
{
out->flags |= SURF_DRAWTURB|SURF_DRAWTILED;
}
@ -1354,7 +1280,7 @@ qboolean CMod_LoadFaces (lump_t *l)
i = LittleLong(in->lightofs);
if (i == -1)
out->samples = NULL;
#ifdef RGLQUAKE
#ifdef GLQUAKE
else if (qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D)
out->samples = loadmodel->lightdata + i;
#endif
@ -1363,7 +1289,7 @@ qboolean CMod_LoadFaces (lump_t *l)
// set the drawing flags
if (out->texinfo->flags & SURF_WARP)
if (out->texinfo->flags & TI_WARP)
{
out->flags |= SURF_DRAWTURB;
for (i=0 ; i<2 ; i++)
@ -1550,6 +1476,7 @@ qboolean CMod_LoadLeafs (lump_t *l)
out->cluster = (unsigned short)LittleShort (in->cluster);
if (out->cluster == 0xffff)
out->cluster = -1;
out->area = LittleShort (in->area);
out->firstleafbrush = (unsigned short)LittleShort (in->firstleafbrush);
out->numleafbrushes = (unsigned short)LittleShort (in->numleafbrushes);
@ -1965,7 +1892,7 @@ qboolean CModQ3_LoadSubmodels (lump_t *l)
return true;
}
qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
qboolean CModQ3_LoadShaders (lump_t *l)
{
dq3shader_t *in;
q2mapsurface_t *out;
@ -1990,10 +1917,6 @@ qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
numtexinfo = count;
out = map_surfaces = Hunk_Alloc(count*sizeof(*out));
#if !defined(SERVERONLY) && (defined(RGLQUAKE) || defined(D3DQUAKE))
skytexturenum = -1;
#endif
loadmodel->texinfo = Hunk_Alloc(sizeof(mtexinfo_t)*count);
loadmodel->numtextures = count;
loadmodel->textures = Hunk_Alloc(sizeof(texture_t*)*count);
@ -2002,22 +1925,6 @@ qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
{
loadmodel->texinfo[i].texture = Hunk_Alloc(sizeof(texture_t));
Q_strncpyz(loadmodel->texinfo[i].texture->name, in->shadername, sizeof(loadmodel->texinfo[i].texture->name));
#if defined(RGLQUAKE) || defined(D3DQUAKE)
if ((qrenderer == QR_OPENGL || qrenderer == QR_DIRECT3D) && !useshaders)
{
loadmodel->texinfo[i].texture->tn.base = Mod_LoadHiResTexture(in->shadername, loadname, true, false, true);
if (!loadmodel->texinfo[i].texture->tn.base)
loadmodel->texinfo[i].texture->tn.base = Mod_LoadHiResTexture(in->shadername, "bmodels", true, false, true);
loadmodel->texinfo[i].texture->tn.fullbright = 0;
loadmodel->texinfo[i].texture->tn.bump = 0;
if (!strncmp(in->shadername, "textures/skies/", 15))
{
loadmodel->texinfo[i].flags |= SURF_SKY;
skytexturenum = i;
}
}
#endif
loadmodel->textures[i] = loadmodel->texinfo[i].texture;
out->c.flags = LittleLong ( in->surfflags );
@ -2030,11 +1937,11 @@ qboolean CModQ3_LoadShaders (lump_t *l, qboolean useshaders)
qboolean CModQ3_LoadVertexes (lump_t *l)
{
q3dvertex_t *in;
vec3_t *out;
vec3_t *nout;
vecV_t *out;
vec3_t *nout, *sout, *tout;
int i, count, j;
vec2_t *lmout, *stout;
byte_vec4_t *cout;
vec4_t *cout;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
@ -2055,11 +1962,15 @@ qboolean CModQ3_LoadVertexes (lump_t *l)
lmout = Hunk_Alloc ( count*sizeof(*lmout) );
cout = Hunk_Alloc ( count*sizeof(*cout) );
nout = Hunk_Alloc ( count*sizeof(*nout) );
sout = Hunk_Alloc ( count*sizeof(*nout) );
tout = Hunk_Alloc ( count*sizeof(*nout) );
map_verts = out;
map_vertstmexcoords = stout;
map_vertlstmexcoords = lmout;
map_colors_array = cout;
map_colors4f_array = cout;
map_normals_array = nout;
map_svector_array = sout;
map_tvector_array = tout;
numvertexes = count;
for ( i=0 ; i<count ; i++, in++)
@ -2076,7 +1987,7 @@ qboolean CModQ3_LoadVertexes (lump_t *l)
}
for ( j=0 ; j < 4 ; j++)
{
cout[i][j] = in->color[j];
cout[i][j] = in->color[j]/255.0f;
}
}
@ -2086,11 +1997,11 @@ qboolean CModQ3_LoadVertexes (lump_t *l)
qboolean CModRBSP_LoadVertexes (lump_t *l)
{
rbspvertex_t *in;
vec3_t *out;
vec3_t *nout;
vecV_t *out;
vec3_t *nout, *sout, *tout;
int i, count, j;
vec2_t *lmout, *stout;
byte_vec4_t *cout;
vec4_t *cout;
in = (void *)(cmod_base + l->fileofs);
if (l->filelen % sizeof(*in))
@ -2111,11 +2022,15 @@ qboolean CModRBSP_LoadVertexes (lump_t *l)
lmout = Hunk_Alloc ( count*sizeof(*lmout) );
cout = Hunk_Alloc ( count*sizeof(*cout) );
nout = Hunk_Alloc ( count*sizeof(*nout) );
sout = Hunk_Alloc ( count*sizeof(*sout) );
tout = Hunk_Alloc ( count*sizeof(*tout) );
map_verts = out;
map_vertstmexcoords = stout;
map_vertlstmexcoords = lmout;
map_colors_array = cout;
map_colors4f_array = cout;
map_normals_array = nout;
map_svector_array = sout;
map_tvector_array = tout;
numvertexes = count;
for ( i=0 ; i<count ; i++, in++)
@ -2257,14 +2172,13 @@ qboolean CModRBSP_LoadFaces (lump_t *l)
return true;
}
#ifdef RGLQUAKE
#ifdef GLQUAKE
/*
=================
Mod_LoadFogs
=================
*/
#ifdef Q3SHADERS
qboolean CModQ3_LoadFogs (lump_t *l)
{
dfog_t *in;
@ -2297,7 +2211,8 @@ qboolean CModQ3_LoadFogs (lump_t *l)
visibleside = brushsides + LittleLong ( in->visibleSide );
out->visibleplane = visibleside->plane;
out->shader = R_RegisterShader ( in->shader );
out->shader = R_RegisterShader_Lightmap ( in->shader );
R_BuildDefaultTexnums(&out->shader->defaulttextures, out->shader);
out->numplanes = brush->numsides;
out->planes = Hunk_Alloc ( out->numplanes*sizeof(cplane_t *) );
@ -2336,56 +2251,11 @@ mfog_t *CM_FogForOrigin(vec3_t org)
return NULL;
}
#endif
//Convert a patch in to a list of glpolys
#define MAX_ARRAY_VERTS 2048
glpoly_t *GL_MeshToGLPoly(mesh_t *mesh)
{
int polysize = sizeof(glpoly_t) - (VERTEXSIZE)*sizeof(float);
int gv;
int v;
int rv;
glpoly_t *p, *ret;
int numindx;
if (!mesh)
return NULL;
numindx = mesh->numindexes;
ret = NULL;
p = Hunk_Alloc(polysize * numindx/3);
for (gv = 0; gv < numindx; )
{
for (v = gv; v < gv+3; v++)
{
rv = mesh->indexes[v];
p->verts[v%3][0] = mesh->xyz_array[rv][0];
p->verts[v%3][1] = mesh->xyz_array[rv][1];
p->verts[v%3][2] = mesh->xyz_array[rv][2];
p->verts[v%3][3] = mesh->st_array[rv][0];
p->verts[v%3][4] = mesh->st_array[rv][1];
p->verts[v%3][5] = mesh->lmst_array[rv][0];
p->verts[v%3][6] = mesh->lmst_array[rv][1];
}
gv+=3;
p->next = ret;
p->numverts = 3;
ret = p;
p = (glpoly_t *)((char *)p + polysize);
}
return ret;
}
#define Vector2Copy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];}
index_t tempIndexesArray[MAX_ARRAY_VERTS*3];
vec4_t tempxyz_array[MAX_ARRAY_VERTS]; //structure is used only at load.
vec3_t tempnormals_array[MAX_ARRAY_VERTS]; //so what harm is there in doing this?
@ -2393,17 +2263,13 @@ vec2_t tempst_array[MAX_ARRAY_VERTS];
vec2_t templmst_array[MAX_ARRAY_VERTS];
byte_vec4_t tempcolors_array[MAX_ARRAY_VERTS];
#ifdef Q3SHADERS
#define Hunk_TempAllocMore Hunk_Alloc
#endif
//mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, int numverts, int firstvert)
{
int numindexes, patch_cp[2], step[2], size[2], flat[2], i, u, v, p;
vec4_t colors[MAX_ARRAY_VERTS], points[MAX_ARRAY_VERTS], normals[MAX_ARRAY_VERTS],
lm_st[MAX_ARRAY_VERTS], tex_st[MAX_ARRAY_VERTS];
vec4_t c, colors2[MAX_ARRAY_VERTS], points2[MAX_ARRAY_VERTS], normals2[MAX_ARRAY_VERTS], lm_st2[MAX_ARRAY_VERTS], tex_st2[MAX_ARRAY_VERTS];
vec4_t colors2[MAX_ARRAY_VERTS], points2[MAX_ARRAY_VERTS], normals2[MAX_ARRAY_VERTS], lm_st2[MAX_ARRAY_VERTS], tex_st2[MAX_ARRAY_VERTS];
mesh_t *mesh;
index_t *indexes;
float subdivlevel;
@ -2423,7 +2289,7 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
for ( i = 0; i < numverts; i++ ) {
VectorCopy ( map_verts[firstvert + i], points[i] );
VectorCopy ( map_normals_array[firstvert + i], normals[i] );
Vector4Scale ( map_colors_array[firstvert + i], (1.0 / 255.0), colors[i] );
Vector4Copy ( map_colors4f_array[firstvert + i], colors[i] );
Vector2Copy ( map_vertstmexcoords[firstvert + i], tex_st[i] );
Vector2Copy ( map_vertlstmexcoords[firstvert + i], lm_st[i] );
}
@ -2442,17 +2308,16 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
return NULL;
}
mesh = (mesh_t *)Hunk_TempAllocMore ( sizeof(mesh_t));
mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->numvertexes = numverts;
mesh->xyz_array = Hunk_TempAllocMore ( numverts * sizeof(vec3_t));
mesh->normals_array = Hunk_TempAllocMore ( numverts * sizeof(vec3_t));
mesh->st_array = Hunk_TempAllocMore ( numverts * sizeof(vec2_t));
mesh->lmst_array = Hunk_TempAllocMore ( numverts * sizeof(vec2_t));
mesh->colors_array = Hunk_TempAllocMore ( numverts * sizeof(byte_vec4_t));
mesh->patchWidth = size[0];
mesh->patchHeight = size[1];
mesh->xyz_array = Hunk_Alloc ( numverts * sizeof(vec3_t));
mesh->normals_array = Hunk_Alloc ( numverts * sizeof(vec3_t));
mesh->snormals_array = Hunk_Alloc ( numverts * sizeof(vec3_t));
mesh->tnormals_array = Hunk_Alloc ( numverts * sizeof(vec3_t));
mesh->st_array = Hunk_Alloc ( numverts * sizeof(vec2_t));
mesh->lmst_array = Hunk_Alloc ( numverts * sizeof(vec2_t));
mesh->colors4f_array = Hunk_Alloc ( numverts * sizeof(vec4_t));
// fill in
Patch_Evaluate ( (const vec4_t *)points, patch_cp, step, points2 );
@ -2465,8 +2330,7 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
{
VectorCopy ( points2[i], mesh->xyz_array[i] );
VectorNormalize2 ( normals2[i], mesh->normals_array[i] );
ColorNormalize ( colors2[i], c );
Vector4Scale ( c, 255.0, mesh->colors_array[i] );
ColorNormalize ( colors2[i], mesh->colors4f_array[i] );
Vector2Copy ( tex_st2[i], mesh->st_array[i] );
Vector2Copy ( lm_st2[i], mesh->lmst_array[i] );
}
@ -2505,24 +2369,19 @@ mesh_t *GL_CreateMeshForPatch (model_t *mod, int patchwidth, int patchheight, in
// allocate and fill index table
mesh->numindexes = numindexes;
mesh->indexes = (index_t *)Hunk_TempAllocMore ( numindexes * sizeof(index_t));
mesh->indexes = (index_t *)Hunk_Alloc ( numindexes * sizeof(index_t));
memcpy (mesh->indexes, tempIndexesArray, numindexes * sizeof(index_t) );
return mesh;
}
#ifdef Q3SHADERS
#undef Hunk_TempAllocMore
#endif
void CModQ3_SortShaders(void)
{
texture_t *textemp;
int i, j;
//sort loadmodel->textures
//correct pointers in loadmodel->texinfo
//sort loadmodel->textures
for (i = 0; i < numtexinfo; i++)
{
for (j = i+1; j < numtexinfo; j++)
@ -2532,25 +2391,14 @@ void CModQ3_SortShaders(void)
textemp = loadmodel->textures[j];
loadmodel->textures[j] = loadmodel->textures[i];
loadmodel->textures[i] = textemp;
if (skytexturenum==i)
skytexturenum=j;
else if (skytexturenum==j)
skytexturenum=i;
}
}
}
}
mesh_t nullmesh;
qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
qboolean CModQ3_LoadRFaces (lump_t *l)
{
#ifndef Q3SHADERS
int polysize = sizeof(glpoly_t) - VERTEXSIZE*sizeof(float);
glpoly_t *p;
int rv, fi;
int gv, v;
#endif
q3dface_t *in;
msurface_t *out;
mplane_t *pl;
@ -2607,11 +2455,10 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
//q3dm10's thingie is 0
out->flags |= SURF_DRAWALPHA;
if (loadmodel->texinfo[LittleLong(in->shadernum)].flags & SURF_SKY)
if (loadmodel->texinfo[LittleLong(in->shadernum)].flags & TI_SKY)
out->flags |= SURF_DRAWSKY;
#ifdef Q3SHADERS
if (!out->texinfo->texture->shader && useshaders)
if (!out->texinfo->texture->shader)
{
extern cvar_t r_vertexlight;
if (LittleLong(in->facetype) == MST_FLARE)
@ -2619,21 +2466,16 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
else if (LittleLong(in->facetype) == MST_TRIANGLE_SOUP || r_vertexlight.value)
out->texinfo->texture->shader = R_RegisterShader_Vertex (out->texinfo->texture->name);
else
out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name);
out->texinfo->texture->shader = R_RegisterShader_Lightmap(out->texinfo->texture->name);
if (out->texinfo->texture->shader->flags & SHADER_SKY)
{
out->texinfo->flags |= SURF_SKY;
skytexturenum = out->texinfo - loadmodel->texinfo;
}
R_BuildDefaultTexnums(&out->texinfo->texture->shader->defaulttextures, out->texinfo->texture->shader);
}
if (LittleLong(in->fognum) == -1 || !map_numfogs)
out->fog = NULL;
else
out->fog = map_fogs + LittleLong(in->fognum);
#endif
if (map_surfaces[LittleLong(in->shadernum)].c.flags & (Q3SURF_NODRAW | Q3SURF_SKIP))
{
out->mesh = &nullmesh;
@ -2641,6 +2483,8 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
else if (LittleLong(in->facetype) == MST_PATCH)
{
out->mesh = GL_CreateMeshForPatch(loadmodel, LittleLong(in->patchwidth), LittleLong(in->patchheight), LittleLong(in->num_vertices), LittleLong(in->firstvertex));
Mod_AccumulateMeshTextureVectors(out->mesh);
Mod_NormaliseTextureVectors(out->mesh->normals_array, out->mesh->snormals_array, out->mesh->tnormals_array, out->mesh->numvertexes);
}
else if (LittleLong(in->facetype) == MST_PLANAR || LittleLong(in->facetype) == MST_TRIANGLE_SOUP)
{
@ -2652,14 +2496,12 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
return false;
}
out->mesh = Hunk_Alloc(sizeof(mesh_t) + (sizeof(vec3_t)) * numverts);
out->mesh = Hunk_Alloc(sizeof(mesh_t));
out->mesh->normals_array= map_normals_array + LittleLong(in->firstvertex);
out->mesh->snormals_array = map_svector_array + LittleLong(in->firstvertex);
out->mesh->tnormals_array = map_tvector_array + LittleLong(in->firstvertex);
#pragma message("s/t vectors not calculated for q3bsp")
out->mesh->snormals_array = out->mesh->normals_array;
out->mesh->tnormals_array = out->mesh->normals_array;
out->mesh->colors_array = map_colors_array + LittleLong(in->firstvertex);
out->mesh->colors4f_array = map_colors4f_array + LittleLong(in->firstvertex);
out->mesh->indexes = map_surfindexes + LittleLong(in->firstindex);
out->mesh->xyz_array = map_verts + LittleLong(in->firstvertex);
out->mesh->st_array = map_vertstmexcoords + LittleLong(in->firstvertex);
@ -2667,14 +2509,22 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
out->mesh->numindexes = numindexes;
out->mesh->numvertexes = numverts;
if (LittleLong(in->facetype) == MST_PLANAR)
if (out->mesh->numindexes == (out->mesh->numvertexes-2)*3)
out->mesh->istrifan = true;
Mod_AccumulateMeshTextureVectors(out->mesh);
}
else
{
//flare
// int r, g, b;
extern index_t r_quad_indexes[6];
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->xyz_array = (vec3_t *)Hunk_Alloc ( sizeof(vec3_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_t));
mesh->numvertexes = 1;
mesh->indexes = r_quad_indexes;
mesh->numindexes = 6;
@ -2694,20 +2544,15 @@ qboolean CModQ3_LoadRFaces (lump_t *l, qboolean useshaders)
*/ }
}
if (useshaders)
CModQ3_SortShaders();
Mod_NormaliseTextureVectors(map_normals_array, map_svector_array, map_tvector_array, numvertexes);
CModQ3_SortShaders();
return true;
}
qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
qboolean CModRBSP_LoadRFaces (lump_t *l)
{
#ifndef Q3SHADERS
int polysize = sizeof(glpoly_t) - VERTEXSIZE*sizeof(float);
glpoly_t *p;
int rv, fi;
int gv, v;
#endif
rbspface_t *in;
msurface_t *out;
mplane_t *pl;
@ -2766,11 +2611,11 @@ qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
//q3dm10's thingie is 0
out->flags |= SURF_DRAWALPHA;
if (loadmodel->texinfo[in->shadernum].flags & SURF_SKY)
if (loadmodel->texinfo[in->shadernum].flags & TI_SKY)
out->flags |= SURF_DRAWSKY;
#ifdef Q3SHADERS
if (!out->texinfo->texture->shader && useshaders)
if (!out->texinfo->texture->shader)
{
extern cvar_t r_vertexlight;
if (in->facetype == MST_FLARE)
@ -2778,7 +2623,9 @@ qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
else if (in->facetype == MST_TRIANGLE_SOUP || r_vertexlight.value)
out->texinfo->texture->shader = R_RegisterShader_Vertex (out->texinfo->texture->name);
else
out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name);
out->texinfo->texture->shader = R_RegisterShader_Lightmap(out->texinfo->texture->name);
R_BuildDefaultTexnums(&out->texinfo->texture->shader->defaulttextures, out->texinfo->texture->shader);
}
if (in->fognum < 0 || in->fognum >= map_numfogs)
@ -2808,7 +2655,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
out->mesh = Hunk_Alloc(sizeof(mesh_t) + (sizeof(vec3_t)) * numverts);
out->mesh->normals_array= map_normals_array + LittleLong(in->firstvertex);
out->mesh->colors_array = map_colors_array + LittleLong(in->firstvertex);
out->mesh->colors4f_array = map_colors4f_array + LittleLong(in->firstvertex);
out->mesh->indexes = map_surfindexes + LittleLong(in->firstindex);
out->mesh->xyz_array = map_verts + LittleLong(in->firstvertex);
out->mesh->st_array = map_vertstmexcoords + LittleLong(in->firstvertex);
@ -2823,7 +2670,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
extern index_t r_quad_indexes[6];
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->xyz_array = (vec3_t *)Hunk_Alloc ( sizeof(vec3_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_t));
mesh->numvertexes = 1;
mesh->indexes = r_quad_indexes;
mesh->numindexes = 6;
@ -2842,8 +2689,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l, qboolean useshaders)
*/ }
}
if (useshaders)
CModQ3_SortShaders();
CModQ3_SortShaders();
return true;
}
@ -3355,7 +3201,8 @@ qboolean CModRBSP_LoadLightgrid (lump_t *elements, lump_t *indexes)
qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out);
int CM_GetQ2Palette (void)
{
char *f = (void *)COM_LoadMallocFile("pics/colormap.pcx");
char *f;
FS_LoadFile("pics/colormap.pcx", &f);
if (!f)
{
Con_Printf (CON_WARNING "Couldn't find pics/colormap.pcx\n");
@ -3364,13 +3211,13 @@ int CM_GetQ2Palette (void)
if (!ReadPCXPalette(f, com_filesize, d_q28to24table))
{
Con_Printf (CON_WARNING "Couldn't read pics/colormap.pcx\n");
BZ_Free(f);
FS_FreeFile(f);
return -1;
}
BZ_Free(f);
FS_FreeFile(f);
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
{
float inf;
qbyte palette[768];
@ -3471,7 +3318,7 @@ void CMQ3_CalcPHS (void)
vcount = 0;
for (i=0 ; i<numclusters ; i++)
{
scan = CM_ClusterPVS (sv.worldmodel, i, NULL, 0);
scan = CM_ClusterPVS (sv.world.worldmodel, i, NULL, 0);
for (j=0 ; j<numclusters ; j++)
{
if ( scan[j>>3] & (1<<(j&7)) )
@ -3584,7 +3431,7 @@ void Q2BSP_MarkLights (dlight_t *light, int bit, mnode_t *node)
}
#ifndef SERVERONLY
#ifdef RGLQUAKE
#ifdef GLQUAKE
void GLR_StainSurf (msurface_t *surf, float *parms);
void GLR_Q2BSP_StainNode (mnode_t *node, float *parms)
{
@ -3627,11 +3474,6 @@ void GLR_Q2BSP_StainNode (mnode_t *node, float *parms)
#endif
#ifndef CLIENTONLY
unsigned int Q2BSP_FatPVS (model_t *mod, vec3_t org, qbyte *buffer, unsigned int buffersize, qboolean add);
qboolean Q2BSP_EdictInFatPVS(model_t *mod, edict_t *ent, qbyte *pvs);
void Q2BSP_FindTouchedLeafs(model_t *mod, edict_t *ent, float *mins, float *maxs);
#endif
void GLQ2BSP_LightPointValues(model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir);
void SWQ2BSP_LightPointValues(model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir);
@ -3649,7 +3491,6 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
q2dheader_t header;
int length;
static unsigned last_checksum;
qboolean useshaders;
qboolean noerrors = true;
int start;
@ -3697,7 +3538,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
switch(header.version)
{
default:
Con_Printf (CON_ERROR "Quake 2 or Quake 3 based BSP with unknown header (%i should be %i or %i)\n"
Con_Printf (CON_ERROR "Quake 2 or Quake 3 based BSP with unknown header (%s: %i should be %i or %i)\n"
, name, header.version, Q2BSPVERSION, Q3BSPVERSION);
return NULL;
break;
@ -3705,16 +3546,6 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
case 1: //rbsp
case Q3BSPVERSION+1: //rtcw
case Q3BSPVERSION:
#ifdef Q3SHADERS
{
extern cvar_t gl_shadeq3;
useshaders = qrenderer == QR_OPENGL && gl_shadeq3.value;
}
#else
useshaders = false;
#endif
mapisq3 = true;
loadmodel->fromgame = fg_quake3;
for (i=0 ; i<Q3LUMPS_TOTAL ; i++)
@ -3753,7 +3584,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
switch(qrenderer)
{
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
case QR_OPENGL:
#endif
#if defined(D3DQUAKE)
@ -3761,7 +3592,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
#endif
case QR_NONE: //dedicated only
mapisq3 = true;
noerrors = noerrors && CModQ3_LoadShaders (&header.lumps[Q3LUMP_SHADERS], useshaders);
noerrors = noerrors && CModQ3_LoadShaders (&header.lumps[Q3LUMP_SHADERS]);
noerrors = noerrors && CModQ3_LoadPlanes (&header.lumps[Q3LUMP_PLANES]);
noerrors = noerrors && CModQ3_LoadLeafBrushes (&header.lumps[Q3LUMP_LEAFBRUSHES]);
noerrors = noerrors && CModQ3_LoadBrushes (&header.lumps[Q3LUMP_BRUSHES]);
@ -3779,26 +3610,26 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
noerrors = noerrors && CModRBSP_LoadFaces (&header.lumps[Q3LUMP_SURFACES]);
else
noerrors = noerrors && CModQ3_LoadFaces (&header.lumps[Q3LUMP_SURFACES]);
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
if (qrenderer != QR_NONE)
{
if (noerrors)
GLMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
RMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
if (header.version == 1)
noerrors = noerrors && CModRBSP_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID], &header.lumps[RBSPLUMP_LIGHTINDEXES]);
else
noerrors = noerrors && CModQ3_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID]);
noerrors = noerrors && CModQ3_LoadIndexes (&header.lumps[Q3LUMP_DRAWINDEXES]);
#ifdef Q3SHADERS
if (header.version != Q3BSPVERSION+1)
noerrors = noerrors && CModQ3_LoadFogs (&header.lumps[Q3LUMP_FOGS]);
else
map_numfogs = 0;
#endif
if (header.version == 1)
noerrors = noerrors && CModRBSP_LoadRFaces (&header.lumps[Q3LUMP_SURFACES], useshaders);
noerrors = noerrors && CModRBSP_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]);
else
noerrors = noerrors && CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES], useshaders);
noerrors = noerrors && CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]);
noerrors = noerrors && CModQ3_LoadMarksurfaces (&header.lumps[Q3LUMP_LEAFSURFACES]); //fixme: duplicated loading.
}
#endif
@ -3829,7 +3660,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
loadmodel->funcs.LeafPVS = CM_LeafnumPVS;
loadmodel->funcs.LeafnumForPoint = CM_PointLeafnum;
#if defined(RGLQUAKE) || defined(D3DQUAKE)
#if defined(GLQUAKE) || defined(D3DQUAKE)
loadmodel->funcs.LightPointValues = GLQ3_LightGrid;
loadmodel->funcs.StainNode = GLR_Q2BSP_StainNode;
loadmodel->funcs.MarkLights = Q2BSP_MarkLights;
@ -3937,15 +3768,15 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
loadmodel->funcs.NativeContents = CM_NativeContents;
break;
#if defined(RGLQUAKE)
#if defined(GLQUAKE)
case QR_OPENGL:
// load into heap
#ifndef SERVERONLY
noerrors = noerrors && GLMod_LoadVertexes (&header.lumps[Q2LUMP_VERTEXES]);
noerrors = noerrors && GLMod_LoadEdges (&header.lumps[Q2LUMP_EDGES]);
noerrors = noerrors && GLMod_LoadSurfedges (&header.lumps[Q2LUMP_SURFEDGES]);
noerrors = noerrors && RMod_LoadVertexes (&header.lumps[Q2LUMP_VERTEXES]);
noerrors = noerrors && RMod_LoadEdges (&header.lumps[Q2LUMP_EDGES]);
noerrors = noerrors && RMod_LoadSurfedges (&header.lumps[Q2LUMP_SURFEDGES]);
if (noerrors)
GLMod_LoadLighting (&header.lumps[Q2LUMP_LIGHTING]);
RMod_LoadLighting (&header.lumps[Q2LUMP_LIGHTING]);
#endif
noerrors = noerrors && CMod_LoadSurfaces (&header.lumps[Q2LUMP_TEXINFO]);
noerrors = noerrors && CMod_LoadLeafBrushes (&header.lumps[Q2LUMP_LEAFBRUSHES]);
@ -3953,7 +3784,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
#ifndef SERVERONLY
noerrors = noerrors && CMod_LoadTexInfo (&header.lumps[Q2LUMP_TEXINFO]);
noerrors = noerrors && CMod_LoadFaces (&header.lumps[Q2LUMP_FACES]);
noerrors = noerrors && GLMod_LoadMarksurfaces (&header.lumps[Q2LUMP_LEAFFACES]);
noerrors = noerrors && RMod_LoadMarksurfaces (&header.lumps[Q2LUMP_LEAFFACES]);
#endif
noerrors = noerrors && CMod_LoadVisibility (&header.lumps[Q2LUMP_VISIBILITY]);
noerrors = noerrors && CMod_LoadBrushes (&header.lumps[Q2LUMP_BRUSHES]);
@ -4819,7 +4650,6 @@ void CM_TestBoxInBrush (vec3_t mins, vec3_t maxs, vec3_t p1,
// inside this brush
trace->startsolid = trace->allsolid = true;
trace->fraction = 0;
trace->contents |= brush->contents;
}
@ -4875,7 +4705,6 @@ void CM_TestBoxInPatch (vec3_t mins, vec3_t maxs, vec3_t p1,
// inside this patch
trace->startsolid = trace->allsolid = true;
trace->fraction = 0;
trace->contents = brush->contents;
}

View File

@ -408,7 +408,7 @@ void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
}
}
int VectorCompare (vec3_t v1, vec3_t v2)
int VectorCompare (const vec3_t v1, const vec3_t v2)
{
int i;
@ -526,13 +526,6 @@ void VectorInverse (vec3_t v)
v[2] = -v[2];
}
void VectorScale (vec3_t in, vec_t scale, vec3_t out)
{
out[0] = in[0]*scale;
out[1] = in[1]*scale;
out[2] = in[2]*scale;
}
int Q_log2(int val)
{
@ -732,11 +725,11 @@ fixed16_t Invert24To16(fixed16_t val)
void VectorTransform (const vec3_t in1, matrix3x4 in2, vec3_t out)
void VectorTransform (const vec3_t in1, const matrix3x4 in2, vec3_t out)
{
out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3];
}
#ifdef HALFLIFEMODELS
@ -953,9 +946,9 @@ void Matrix4_ModelViewMatrix(float *modelview, vec3_t viewangles, vec3_t vieworg
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
}
void Matrix4x4_CreateTranslate (matrix4x4_t *out, float x, float y, float z)
void Matrix4x4_CreateTranslate (float *out, float x, float y, float z)
{
memcpy(out, Matrix4_NewTranslation(x, y, z), sizeof(*out));
memcpy(out, Matrix4_NewTranslation(x, y, z), 16*sizeof(float));
}
void Matrix4_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
@ -983,6 +976,42 @@ void Matrix4_ModelViewMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right,
}
void Matrix4x4_ToVectors(const matrix4x4_t *in, float vx[3], float vy[3], float vz[3], float t[3])
{
vx[0] = in->m[0][0];
vx[1] = in->m[0][1];
vx[2] = in->m[0][2];
vy[0] = in->m[1][0];
vy[1] = in->m[1][1];
vy[2] = in->m[1][2];
vz[0] = in->m[2][0];
vz[1] = in->m[2][1];
vz[2] = in->m[2][2];
t [0] = in->m[3][0];
t [1] = in->m[3][1];
t [2] = in->m[3][2];
}
void Matrix4x4_FromVectors(matrix4x4_t *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
{
out->m[0][0] = vx[0];
out->m[1][0] = vy[0];
out->m[2][0] = vz[0];
out->m[3][0] = t[0];
out->m[0][1] = vx[1];
out->m[1][1] = vy[1];
out->m[2][1] = vz[1];
out->m[3][1] = t[1];
out->m[0][2] = vx[2];
out->m[1][2] = vy[2];
out->m[2][2] = vz[2];
out->m[3][2] = t[2];
out->m[0][3] = 0.0f;
out->m[1][3] = 0.0f;
out->m[2][3] = 0.0f;
out->m[3][3] = 1.0f;
}
void Matrix4_ModelMatrixFromAxis(float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg)
{
float tempmat[16];
@ -1163,7 +1192,29 @@ void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymax, float
proj[11] = 0;
proj[15] = 1;
}
void Matrix4_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
float znear, float zfar)
{
proj[0] = 2/(xmax-xmin);
proj[4] = 0;
proj[8] = 0;
proj[12] = (xmax+xmin)/(xmax-xmin);
proj[1] = 0;
proj[5] = 2/(ymax-ymin);
proj[9] = 0;
proj[13] = (ymax+ymin)/(ymax-ymin);
proj[2] = 0;
proj[6] = 0;
proj[10] = -2/(zfar-znear);
proj[14] = (zfar+znear)/(zfar-znear);
proj[3] = 0;
proj[7] = 0;
proj[11] = 0;
proj[15] = 1;
}
/*
* Compute inverse of 4x4 transformation matrix.
* Code contributed by Jacques Leroy jle@star.be
@ -1450,7 +1501,7 @@ void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out)
out[2][2] = in1[2][0]*in2[0][2] + in1[2][1]*in2[1][2] + in1[2][2]*in2[2][2];
}
vec_t VectorNormalize2 (vec3_t v, vec3_t out)
vec_t VectorNormalize2 (const vec3_t v, vec3_t out)
{
float length, ilength;

View File

@ -25,7 +25,24 @@ typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef vec_t vec5_t[5];
/*16-byte aligned vectors, for auto-vectorising, should propogate to structs
sse and altivec can unroll loops using aligned reads, which should be faster... 4 at once.
*/
#ifdef _MSC_VER
typedef __declspec(align(16)) vec3_t avec3_t;
typedef __declspec(align(16)) vec4_t avec4_t;
typedef __declspec(align(4)) qbyte byte_vec4_t[4];
#elif __GNUC__ >= 3
typedef __attribute__((aligned(16))) vec3_t avec3_t;
typedef __attribute__((aligned(16))) vec4_t avec4_t;
typedef __attribute__((aligned(4))) qbyte byte_vec4_t[4];
#else
typedef vec3_t avec3_t;
typedef vec4_t avec4_t;
typedef qbyte byte_vec4_t[4];
#endif
#define vecV_t avec4_t
typedef int fixed4_t;
typedef int fixed8_t;
@ -48,12 +65,21 @@ extern int nanmask;
#define VectorSubtract(a,b,c) do{(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}while(0)
#define VectorAdd(a,b,c) do{(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}while(0)
#define VectorCopy(a,b) do{(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}while(0)
#define VectorScale(a,s,b) do{(b)[0]=(s)*(a)[0];(b)[1]=(s)*(a)[1];(b)[2]=(s)*(a)[2];}while(0)
#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
#define VectorSet(r,x,y,z) {(r)[0] = x; (r)[1] = y;(r)[2] = z;}
#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
#define VectorLength(a) Length(a)
#define VectorMA(a,s,b,c) do{(c)[0] = (a)[0] + (s)*(b)[0];(c)[1] = (a)[1] + (s)*(b)[1];(c)[2] = (a)[2] + (s)*(b)[2];}while(0)
#define VectorEquals(a,b) ((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2])
#define VectorAvg(a,b,c) ((c)[0]=((a)[0]+(b)[0])*0.5f,(c)[1]=((a)[1]+(b)[1])*0.5f, (c)[2]=((a)[2]+(b)[2])*0.5f)
#define Vector2Copy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];}
#define Vector2Set(r,x,y) {(r)[0] = x; (r)[1] = y;}
#define Vector4Copy(a,b) do{(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];(b)[3]=(a)[3];}while(0)
#define Vector4Scale(in,scale,out) ((out)[0]=(in)[0]*scale,(out)[1]=(in)[1]*scale,(out)[2]=(in)[2]*scale,(out)[3]=(in)[3]*scale)
#define Vector4Add(a,b,c) ((c)[0]=(((a[0])+(b[0]))),(c)[1]=(((a[1])+(b[1]))),(c)[2]=(((a[2])+(b[2]))),(c)[3]=(((a[3])+(b[3]))))
typedef float matrix3x4[3][4];
typedef float matrix3x3[3][3];
@ -105,10 +131,11 @@ float Q_rsqrt(float number);
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
void Matrix4_Identity(float *outm);
qboolean Matrix4_Invert(const float *m, float *out);
void Matrix4x4_CreateTranslate (matrix4x4_t *out, float x, float y, float z);
void Matrix4_CreateTranslate (float *out, float x, float y, float z);
void Matrix4_ModelMatrixFromAxis (float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
void Matrix4_ModelViewMatrix (float *modelview, vec3_t viewangles, vec3_t vieworg);
void Matrix4_ModelViewMatrixFromAxis (float *modelview, vec3_t pn, vec3_t right, vec3_t up, vec3_t vieworg);
void Matrix4_CreateFromQuakeEntity (float *matrix, float x, float y, float z, float pitch, float yaw, float roll, float scale);
void Matrix4_Multiply (float *a, float *b, float *out);
void Matrix4_Project (vec3_t in, vec3_t out, vec3_t viewangles, vec3_t vieworg, float fovx, float fovy);
void Matrix4_Transform3 (float *matrix, float *vector, float *product);
@ -132,12 +159,11 @@ void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatRotationsPad (float in1[3][4], float in2[3][4], float out[3][4]);
void R_ConcatTransforms (matrix3x4 in1, matrix3x4 in2, matrix3x4 out);
void RotatePointAroundVector (vec3_t dst, const vec3_t dir, const vec3_t point, float degrees);
int VectorCompare (vec3_t v1, vec3_t v2);
int VectorCompare (const vec3_t v1, const vec3_t v2);
void VectorInverse (vec3_t v);
void _VectorMA (const vec3_t veca, const float scale, const vec3_t vecb, vec3_t vecc);
float VectorNormalize (vec3_t v); // returns vector length
vec_t VectorNormalize2 (vec3_t v, vec3_t out);
vec_t VectorNormalize2 (const vec3_t v, vec3_t out);
void VectorNormalizeFast(vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
void VectorTransform (const vec3_t in1, matrix3x4 in2, vec3_t out);
void VectorTransform (const vec3_t in1, const matrix3x4 in2, vec3_t out);
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up);

View File

@ -100,6 +100,10 @@ char *NET_AdrToStringMasked (char *s, int len, netadr_t a, netadr_t amask);
void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits);
qboolean NET_CompareAdrMasked(netadr_t a, netadr_t b, netadr_t mask);
struct ftenet_generic_connection_s *FTENET_IRCConnect_EstablishConnection(qboolean isserver, const char *address);
qboolean FTENET_AddToCollection(struct ftenet_connections_s *col, const char *name, const char *address, struct ftenet_generic_connection_s *(*establish)(qboolean isserver, const char *address), qboolean islisten);
//============================================================================
#define OLD_AVG 0.99 // total = oldtotal*OLD_AVG + new*(1-OLD_AVG)
@ -171,12 +175,13 @@ extern int net_drop; // packets dropped before this one
void Netchan_Init (void);
int Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate);
void Netchan_OutOfBand (netsrc_t sock, netadr_t adr, int length, qbyte *data);
void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ...);
void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ...) LIKEPRINTF(3);
void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language, translation_t text, ...);
qboolean Netchan_Process (netchan_t *chan);
void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport);
qboolean Netchan_CanPacket (netchan_t *chan, int rate);
void Netchan_Block (netchan_t *chan, int bytes, int rate);
qboolean Netchan_CanReliable (netchan_t *chan, int rate);
#ifdef NQPROT
nqprot_t NQNetChan_Process(netchan_t *chan);
@ -228,6 +233,7 @@ void Huff_EmitByte(int ch, qbyte *buffer, int *count);
#endif
int UDP_OpenSocket (int port, qboolean bcast);
int UDP6_OpenSocket (int port, qboolean bcast);
int IPX_OpenSocket (int port, qboolean bcast);
int NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s);
void SockadrToNetadr (struct sockaddr_qstorage *s, netadr_t *a);

View File

@ -2611,7 +2611,7 @@ void FTENET_IRCConnect_Close(ftenet_generic_connection_t *gcon)
FTENET_Generic_Close(gcon);
}
ftenet_generic_connection_t *FTENET_IRCConnect_EstablishConnection(qboolean isserver, const char *address)
struct ftenet_generic_connection_s *FTENET_IRCConnect_EstablishConnection(qboolean isserver, const char *address)
{
//this is written to support either ipv4 or ipv6, depending on the remote addr.
ftenet_ircconnect_connection_t *newcon;

View File

@ -116,7 +116,6 @@ void P_EmitEffect (vec3_t pos, int type, trailstate_t **tsk);//this is just a wr
#define P_DelinkTrailstate pe->DelinkTrailstate
#define P_ClearParticles pe->ClearParticles
#define P_DrawParticles pe->DrawParticles
#define P_FlushRenderer pe->FlushRenderer
typedef struct {
char *name1;
@ -143,7 +142,6 @@ typedef struct {
void (*DelinkTrailstate) (trailstate_t **tsk);
void (*ClearParticles) (void);
void (*DrawParticles) (void);
void (*FlushRenderer) (void);
} particleengine_t;
extern particleengine_t *pe;

View File

@ -98,7 +98,7 @@ qboolean Init_GNUTLS(void) {return true;}
cvar_t plug_sbar = SCVAR("plug_sbar", "1");
cvar_t plug_loaddefault = SCVAR("plug_loaddefault", "1");
#ifdef RGLQUAKE
#ifdef GLQUAKE
#include "glquake.h"
#endif
@ -1626,7 +1626,7 @@ void Plug_SBar(void)
return;
ret = 0;
if (!plug_sbar.value || cl.splitclients > 1)
if (!plug_sbar.ival || cl.splitclients > 1)
currentplug = NULL;
else
{

View File

@ -112,6 +112,7 @@ void PM_InitBoxHull (void);
void PM_CategorizePosition (void);
int PM_HullPointContents (hull_t *hull, int num, vec3_t p);
int PM_ExtraBoxContents (vec3_t p); //Peeks for HL-style water.
int PM_PointContents (vec3_t point);
qboolean PM_TestPlayerPosition (vec3_t point);
#ifndef __cplusplus

View File

@ -515,11 +515,11 @@ void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
switch (fmode)
{
case 0: //read
pf_fopen_files[i].data = COM_LoadMallocFile(pf_fopen_files[i].name);
pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name);
if (!pf_fopen_files[i].data)
{
Q_strncpyz(pf_fopen_files[i].name, name, sizeof(pf_fopen_files[i].name));
pf_fopen_files[i].data = COM_LoadMallocFile(pf_fopen_files[i].name);
pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name);
}
if (pf_fopen_files[i].data)
@ -534,7 +534,7 @@ void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
pf_fopen_files[i].ofs = 0;
break;
case 1: //append
pf_fopen_files[i].data = COM_LoadMallocFile(pf_fopen_files[i].name);
pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name);
pf_fopen_files[i].ofs = pf_fopen_files[i].bufferlen = pf_fopen_files[i].len = com_filesize;
if (pf_fopen_files[i].data)
{
@ -736,7 +736,10 @@ void PF_whichpack (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (FS_FLocateFile(srcname, FSLFRT_IFFOUND, &loc))
{
RETURN_TSTRING(FS_WhichPackForLocation(&loc));
srcname = FS_WhichPackForLocation(&loc);
if (srcname == NULL)
srcname = "";
RETURN_TSTRING(srcname);
}
else
{

View File

@ -12,6 +12,37 @@ typedef struct edict_s {
} edict_t;
#endif
struct wedict_s
{
qboolean isfree;
float freetime; // sv.time when the object was freed
int entnum;
qboolean readonly; //world
#ifdef VM_Q1
comentvars_t *v;
comextentvars_t *xv;
#else
union {
comentvars_t *v;
comentvars_t *xv;
};
#endif
/*the above is shared with qclib*/
link_t area;
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
#ifdef Q2BSPS
int areanum; //q2bsp
int areanum2; //q2bsp
int headnode; //q2bsp
#endif
#ifdef USEODE
entityode_t ode;
#endif
qbyte solidtype;
/*the above is shared with ssqc*/
};
#define PF_cin_open PF_Fixme
#define PF_cin_close PF_Fixme
#define PF_cin_setstate PF_Fixme
@ -50,7 +81,7 @@ typedef struct edict_s {
typedef struct lh_extension_s {
char *name;
int numbuiltins;
qboolean *enabled;
qboolean *queried;
char *builtinnames[21]; //extend freely
} lh_extension_t;
@ -72,9 +103,10 @@ extern cvar_t pr_tempstringsize;
extern cvar_t pr_tempstringcount;
int MP_TranslateFTEtoDPCodes(int code);
int MP_TranslateDPtoFTECodes(int code);
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...);
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void PF_print (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_dprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_error (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -157,7 +189,7 @@ char *PF_VarString (progfuncs_t *prinst, int first, struct globalvars_s *pr_glob
//pr_cmds.c builtins that need to be moved to a common.
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...);
void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...) LIKEPRINTF(2);
void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -294,6 +326,43 @@ void PF_Common_RegisterCvars(void);
/*these are server ones, provided by pr_cmds.c, as required by pr_q1qvm.c*/
void PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_svtraceline (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_changelevel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_applylightstyle(int style, char *val, int col);
void PF_ambientsound_Internal (float *pos, char *samp, float vol, float attenuation);
void PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ForceInfoKey(progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_precache_vwep_model(progfuncs_t *prinst, struct globalvars_s *pr_globals);
int PF_checkclient_Internal (progfuncs_t *prinst);
void PF_precache_sound_Internal (progfuncs_t *prinst, char *s);
int PF_precache_model_Internal (progfuncs_t *prinst, char *s);
void PF_setmodel_Internal (progfuncs_t *prinst, edict_t *e, char *m);
char *PF_infokey_Internal (int entnum, char *value);
void PF_centerprint_Internal (int entnum, char *s);
void PF_WriteString_Internal (int target, char *str);
pbool ED_CanFree (edict_t *ed);
// edict->solid values
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
@ -309,22 +378,28 @@ void PF_Common_RegisterCvars(void);
#define DAMAGE_AIM 2
// edict->flags
#define FL_FLY 1
#define FL_SWIM 2
#define FL_GLIMPSE 4
#define FL_CLIENT 8
#define FL_INWATER 16
#define FL_MONSTER 32
#define FL_GODMODE 64
#define FL_NOTARGET 128
#define FL_ITEM 256
#define FL_ONGROUND 512
#define FL_PARTIALGROUND 1024 // not all corners are valid
#define FL_WATERJUMP 2048 // player jumping out of water
#define FL_FINDABLE_NONSOLID 16384 //a cpqwsv feature
#define FL_MOVECHAIN_ANGLE 32768 // when in a move chain, will update the angle
#define FL_CLASS_DEPENDENT 2097152
#define FL_FLY (1<<0)
#define FL_SWIM (1<<1)
#define FL_GLIMPSE (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_ITEM (1<<8)
#define FL_ONGROUND (1<<9)
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
//12
//13
#define FL_FINDABLE_NONSOLID (1<<14) //a cpqwsv feature
#define FL_MOVECHAIN_ANGLE (1<<15) // when in a move chain, will update the angle
#define FL_LAGGEDMOVE (1<<16)
//17
//18
//19
//20
#define FL_CLASS_DEPENDENT (1<<21)

View File

@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef SIDEVIEWS
#define PEXT_VIEW2 0x00000010
#endif
#define PEXT_BULLETENS 0x00000020
//#define PEXT_BULLETENS 0x00000020
#define PEXT_ACCURATETIMINGS 0x00000040
#define PEXT_SOUNDDBL 0x00000080 //revised startsound protocol
#define PEXT_FATNESS 0x00000100 //GL only (or servers)
@ -52,10 +52,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PEXT_SPAWNSTATIC2 0x00400000 //Sends an entity delta instead of a baseline.
#define PEXT_CUSTOMTEMPEFFECTS 0x00800000 //supports custom temp ents.
#define PEXT_256PACKETENTITIES 0x01000000 //Client can recieve 256 packet entities.
//#define PEXT_64PLAYERS 0x02000000 //Client is able to cope with 64 players. Wow.
//#define PEXT_NEVERUSED 0x02000000 //Client is able to cope with 64 players. Wow.
#define PEXT_SHOWPIC 0x04000000
#define PEXT_SETATTACHMENT 0x08000000 //md3 tags (needs networking, they need to lerp).
//#define PEXT_PK3DOWNLOADS 0x10000000 //retrieve a list of pk3s/pk3s/paks for downloading (with optional URL and crcs)
//#define PEXT2_NEVERUSED 0x10000000 //retrieve a list of pk3s/pk3s/paks for downloading (with optional URL and crcs)
#define PEXT_CHUNKEDDOWNLOADS 0x20000000 //alternate file download method. Hopefully it'll give quadroupled download speed, especially on higher pings.
#ifdef CSQC_DAT
@ -70,6 +70,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PEXT_BIGUSERINFOS 0xffffffff
#endif
#define PEXT2_PRYDONCURSOR 0x00000001
//#define PEXT2_64PLAYERS 0x02000000 //Client is able to cope with 64 players. Wow.
//#define PEXT2_PK3DOWNLOADS 0x10000000 //retrieve a list of pk3s/pk3s/paks for downloading (with optional URL and crcs)
//ZQuake transparent protocol extensions.
#define Z_EXT_PM_TYPE (1<<0) // basic PM_TYPE functionality (reliable jump_held)
#define Z_EXT_PM_TYPE_NEW (1<<1) // adds PM_FLY, PM_SPECTATOR
@ -87,6 +91,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PROTOCOL_VERSION_FTE (('F'<<0) + ('T'<<8) + ('E'<<16) + ('X' << 24)) //fte extensions.
#define PROTOCOL_VERSION_FTE2 (('F'<<0) + ('T'<<8) + ('E'<<16) + ('2' << 24)) //fte extensions.
#define PROTOCOL_VERSION_HUFFMAN (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)) //packet compression
#define PROTOCOL_VERSION_QW 28
@ -908,7 +913,7 @@ typedef struct q1usercmd_s
#define Q2RF_USE_DISGUISE 0x00040000
//ROGUE
#define Q2RF_ADDATIVE 0x00080000
#define Q2RF_ADDITIVE 0x00080000
#define RF_NOSHADOW 0x00100000
#define RF_NODEPTHTEST 0x00200000

View File

@ -1,5 +1,6 @@
#include "quakedef.h"
#include "pr_common.h"
/*
============================================================================
@ -675,13 +676,13 @@ void Fragment_Mesh (fragmentdecal_t *dec, mesh_t *mesh)
vec3_t verts[3];
/*if its a triangle fan/poly/quad then we can just submit the entire thing without generating extra fragments*/
if (0)//mesh->istrifan)
if (mesh->istrifan)
{
Fragment_ClipPoly(dec, mesh->numvertexes, mesh->xyz_array[0]);
return;
}
//Fixme: optimise q3 patches
//Fixme: optimise q3 patches (quad strips with bends between each strip)
/*otherwise it goes in and out in weird places*/
for (i = 0; i < mesh->numindexes; i+=3)
@ -741,6 +742,12 @@ void Q1BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node)
Q1BSP_ClipDecalToNodes (dec, node->children[1]);
}
#ifdef RTLIGHTS
extern int sh_shadowframe;
#else
static int sh_shadowframe;
#endif
#ifdef Q3BSPS
void Q3BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node)
{
mplane_t *splitplane;
@ -758,16 +765,12 @@ void Q3BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node)
for (i=0 ; i<leaf->nummarksurfaces ; i++, msurf++)
{
surf = *msurf;
/*if (surf->flags & SURF_PLANEBACK)
{
if (-DotProduct(surf->plane->normal, dec->normal) > -0.5)
continue;
}
else
{
if (DotProduct(surf->plane->normal, dec->normal) > -0.5)
continue;
}*/
//only check each surface once. it can appear in multiple leafs.
if (surf->shadowframe == sh_shadowframe)
continue;
surf->shadowframe = sh_shadowframe;
Fragment_Mesh(dec, surf->mesh);
}
return;
@ -789,6 +792,7 @@ void Q3BSP_ClipDecalToNodes (fragmentdecal_t *dec, mnode_t *node)
Q3BSP_ClipDecalToNodes (dec, node->children[0]);
Q3BSP_ClipDecalToNodes (dec, node->children[1]);
}
#endif
int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent1, vec3_t tangent2, float size, float **out)
{ //quad marks a full, independant quad
@ -810,10 +814,14 @@ int Q1BSP_ClipDecal(vec3_t center, vec3_t normal, vec3_t tangent1, vec3_t tangen
dec.planedist[p] = -(dec.radius - DotProduct(dec.center, dec.planenorm[p]));
dec.numplanes = 6;
if (cl.worldmodel->fromgame == fg_quake3)
Q3BSP_ClipDecalToNodes(&dec, cl.worldmodel->nodes);
else
sh_shadowframe++;
if (cl.worldmodel->fromgame == fg_quake)
Q1BSP_ClipDecalToNodes(&dec, cl.worldmodel->nodes);
#ifdef Q3BSPS
else if (cl.worldmodel->fromgame == fg_quake3)
Q3BSP_ClipDecalToNodes(&dec, cl.worldmodel->nodes);
#endif
*out = (float *)decalfragmentverts;
return dec.numtris;
@ -970,7 +978,7 @@ unsigned int Q1BSP_FatPVS (model_t *mod, vec3_t org, qbyte *pvsbuffer, unsigned
return fatbytes;
}
qboolean Q1BSP_EdictInFatPVS(model_t *mod, edict_t *ent, qbyte *pvs)
qboolean Q1BSP_EdictInFatPVS(model_t *mod, wedict_t *ent, qbyte *pvs)
{
int i;
@ -991,7 +999,7 @@ SV_FindTouchedLeafs
Links the edict to the right leafs so we can get it's potential visability.
===============
*/
void Q1BSP_RFindTouchedLeafs (edict_t *ent, mnode_t *node, float *mins, float *maxs)
void Q1BSP_RFindTouchedLeafs (world_t *w, wedict_t *ent, mnode_t *node, float *mins, float *maxs)
{
mplane_t *splitplane;
mleaf_t *leaf;
@ -1012,7 +1020,7 @@ void Q1BSP_RFindTouchedLeafs (edict_t *ent, mnode_t *node, float *mins, float *m
}
leaf = (mleaf_t *)node;
leafnum = leaf - sv.worldmodel->leafs - 1;
leafnum = leaf - w->worldmodel->leafs - 1;
ent->leafnums[ent->num_leafs] = leafnum;
ent->num_leafs++;
@ -1026,16 +1034,16 @@ void Q1BSP_RFindTouchedLeafs (edict_t *ent, mnode_t *node, float *mins, float *m
// recurse down the contacted sides
if (sides & 1)
Q1BSP_RFindTouchedLeafs (ent, node->children[0], mins, maxs);
Q1BSP_RFindTouchedLeafs (w, ent, node->children[0], mins, maxs);
if (sides & 2)
Q1BSP_RFindTouchedLeafs (ent, node->children[1], mins, maxs);
Q1BSP_RFindTouchedLeafs (w, ent, node->children[1], mins, maxs);
}
void Q1BSP_FindTouchedLeafs(model_t *mod, edict_t *ent, float *mins, float *maxs)
void Q1BSP_FindTouchedLeafs(world_t *w, model_t *mod, wedict_t *ent, float *mins, float *maxs)
{
ent->num_leafs = 0;
if (ent->v->modelindex)
Q1BSP_RFindTouchedLeafs (ent, mod->nodes, mins, maxs);
Q1BSP_RFindTouchedLeafs (w, ent, mod->nodes, mins, maxs);
}
#endif

View File

@ -369,7 +369,7 @@ void PMQ2_Friction (void)
drop = 0;
// apply ground friction
if ((q2pm->groundentity && q2pml.groundsurface && !(q2pml.groundsurface->flags & SURF_SLICK) ) || (q2pml.ladder) )
if ((q2pm->groundentity && q2pml.groundsurface && !(q2pml.groundsurface->flags & TI_SLICK) ) || (q2pml.ladder) )
{
friction = pm_friction;
control = speed < pm_stopspeed ? pm_stopspeed : speed;

View File

@ -45,7 +45,7 @@ int VM_fopen (char *name, int *handle, int fmode, int owner)
switch (fmode)
{
case VM_FS_READ:
vm_fopen_files[i].data = COM_LoadMallocFile(name);
vm_fopen_files[i].data = FS_LoadMallocFile(name);
vm_fopen_files[i].bufferlen = vm_fopen_files[i].len = com_filesize;
vm_fopen_files[i].ofs = 0;
if (vm_fopen_files[i].data)
@ -56,7 +56,7 @@ int VM_fopen (char *name, int *handle, int fmode, int owner)
/*
case VM_FS_APPEND:
case VM_FS_APPEND2:
vm_fopen_files[i].data = COM_LoadMallocFile(name);
vm_fopen_files[i].data = FS_LoadMallocFile(name);
vm_fopen_files[i].ofs = vm_fopen_files[i].bufferlen = vm_fopen_files[i].len = com_filesize;
if (vm_fopen_files[i].data)
break;

View File

@ -36,12 +36,12 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
//
// system IO
//
int VARGS Sys_DebugLog(char *file, char *fmt, ...);
int VARGS Sys_DebugLog(char *file, char *fmt, ...) LIKEPRINTF(2);
void VARGS Sys_Error (const char *error, ...);
NORETURN void VARGS Sys_Error (const char *error, ...) LIKEPRINTF(1);
// an error will cause the entire program to exit
void VARGS Sys_Printf (char *fmt, ...);
void VARGS Sys_Printf (char *fmt, ...) LIKEPRINTF(1);
// send text to the console
void Sys_Quit (void);
@ -51,9 +51,9 @@ typedef struct {
char *name;
} dllfunction_t;
typedef void *dllhandle_t;
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs);
dllhandle_t *Sys_LoadLibrary(const char *name, dllfunction_t *funcs);
void Sys_CloseLibrary(dllhandle_t *lib);
void *Sys_GetAddressForName(dllhandle_t *module, char *exportname);
void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname);
char *Sys_GetNameForAddress(dllhandle_t *module, void *address);
unsigned int Sys_Milliseconds (void);

Some files were not shown because too many files have changed in this diff Show More