1
0
Fork 0
forked from fte/fteqw

CSQC_DAT and MENU_DAT can now be enabled in CLIENTONLY/MINIMAL builds (so long as both are enabled).

Tweeked a statement that was causing crashes with msvc2008.
Dedicated servers should build again.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3139 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-03-07 05:05:54 +00:00
parent 75fb5f5398
commit 76f6ad0345
11 changed files with 363 additions and 161 deletions

View file

@ -904,7 +904,8 @@ float CalcFov (float fov_x, float width, float height)
if (fov_x < 1 || fov_x > 179)
Sys_Error ("Bad fov: %f", fov_x);
x = width/tan(fov_x/360*M_PI);
x = fov_x/360*M_PI;
x = width/tan(x);
a = atan (height/x);

View file

@ -21,40 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
// This is the standard RGBI palette used in CGA text mode
consolecolours_t consolecolours[MAXCONCOLOURS] = {
{0, 0, 0 }, // black
{0, 0, 0.67}, // blue
{0, 0.67, 0 }, // green
{0, 0.67, 0.67}, // cyan
{0.67, 0, 0 }, // red
{0.67, 0, 0.67}, // magenta
{0.67, 0.33, 0 }, // brown
{0.67, 0.67, 0.67}, // light gray
{0.33, 0.33, 0.33}, // dark gray
{0.33, 0.33, 1 }, // light blue
{0.33, 1, 0.33}, // light green
{0.33, 1, 1 }, // light cyan
{1, 0.33, 0.33}, // light red
{1, 0.33, 1 }, // light magenta
{1, 1, 0.33}, // yellow
{1, 1, 1 } // white
};
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
conchar_t con_ormask;
console_t con_main;
console_t *con_current; // point to either con_main

View file

@ -25,6 +25,12 @@
#include "pr_common.h"
#ifdef CLIENTONLY
//client only builds don't have a qc debugger
#define QCEditor NULL
#endif
#define ANGLE2SHORT(x) ((x/360.0)*65535)
static progfuncs_t *csqcprogs;
@ -797,6 +803,7 @@ static void PF_cs_makevectors (progfuncs_t *prinst, struct globalvars_s *pr_glob
Host_EndGame("PF_makevectors: one of v_forward, v_right or v_up was not defined\n");
AngleVectors (G_VECTOR(OFS_PARM0), csqcg.forward, csqcg.right, csqcg.up);
}
/*
void QuaternainToAngleMatrix(float *quat, vec3_t *mat)
{
@ -2637,6 +2644,94 @@ static void PF_cs_findradius (progfuncs_t *prinst, struct globalvars_s *pr_globa
RETURN_EDICT(prinst, (void*)chain);
}
//entity(string field, float match) findchainflags = #450
//chained search for float, int, and entity reference fields
void PF_cs_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
int s;
csqcedict_t *ent, *chain;
chain = (csqcedict_t *) *prinst->parms->sv_edicts;
f = G_INT(OFS_PARM0)+prinst->fieldadjust;
s = G_FLOAT(OFS_PARM1);
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
{
ent = (csqcedict_t*)EDICT_NUM(prinst, i);
if (ent->isfree)
continue;
if (!((int)((float *)ent->v)[f] & s))
continue;
ent->v->chain = EDICT_TO_PROG(prinst, (edict_t*)chain);
chain = ent;
}
RETURN_EDICT(prinst, (edict_t*)chain);
}
//entity(string field, float match) findchainfloat = #403
void PF_cs_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
float s;
csqcedict_t *ent, *chain;
chain = (csqcedict_t *) *prinst->parms->sv_edicts;
f = G_INT(OFS_PARM0)+prinst->fieldadjust;
s = G_FLOAT(OFS_PARM1);
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
{
ent = (csqcedict_t*)EDICT_NUM(prinst, i);
if (ent->isfree)
continue;
if (((float *)ent->v)[f] != s)
continue;
ent->v->chain = EDICT_TO_PROG(prinst, (edict_t*)chain);
chain = ent;
}
RETURN_EDICT(prinst, (edict_t*)chain);
}
//entity(string field, string match) findchain = #402
//chained search for strings in entity fields
void PF_cs_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
char *s;
string_t t;
csqcedict_t *ent, *chain;
chain = (csqcedict_t *) *prinst->parms->sv_edicts;
f = G_INT(OFS_PARM0)+prinst->fieldadjust;
s = PR_GetStringOfs(prinst, OFS_PARM1);
for (i = 1; i < *prinst->parms->sv_num_edicts; i++)
{
ent = (csqcedict_t*)EDICT_NUM(prinst, i);
if (ent->isfree)
continue;
t = *(string_t *)&((float*)ent->v)[f];
if (!t)
continue;
if (strcmp(PR_GetString(prinst, t), s))
continue;
ent->v->chain = EDICT_TO_PROG(prinst, (edict_t*)chain);
chain = ent;
}
RETURN_EDICT(prinst, (edict_t*)chain);
}
static void PF_cl_te_gunshot (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
float *pos = G_VECTOR(OFS_PARM0);
@ -2981,6 +3076,8 @@ static void PF_cs_OpenPortal (progfuncs_t *prinst, struct globalvars_s *pr_globa
#endif
}
#ifndef NOMEDIA
// #487 float(string name) gecko_create( string name )
static void PF_cs_gecko_create (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -3094,6 +3191,7 @@ static void PF_cs_gecko_get_texture_extent (progfuncs_t *prinst, struct globalva
ret[1] = sy;
ret[2] = 0;
}
#endif
static void PF_cs_droptofloor (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -4568,8 +4666,8 @@ static struct {
//400
{"copyentity", PF_cs_copyentity, 400}, // #400 void(entity from, entity to) copyentity (DP_QC_COPYENTITY)
{"setcolors", PF_NoCSQC, 401}, // #401 void(entity cl, float colours) setcolors (DP_SV_SETCOLOR) (don't implement)
{"findchain", PF_findchain, 402}, // #402 entity(string field, string match) findchain (DP_QC_FINDCHAIN)
{"findchainfloat", PF_findchainfloat, 403}, // #403 entity(float fld, float match) findchainfloat (DP_QC_FINDCHAINFLOAT)
{"findchain", PF_cs_findchain, 402}, // #402 entity(string field, string match) findchain (DP_QC_FINDCHAIN)
{"findchainfloat", PF_cs_findchainfloat, 403}, // #403 entity(float fld, float match) findchainfloat (DP_QC_FINDCHAINFLOAT)
{"effect", PF_cl_effect, 404}, // #404 void(vector org, string modelname, float startframe, float endframe, float framerate) effect (DP_SV_EFFECT)
{"te_blood", PF_cl_te_blooddp, 405}, // #405 void(vector org, vector velocity, float howmany) te_blood (DP_TE_BLOOD)
@ -4626,7 +4724,7 @@ static struct {
{"dp_cvar_string", PF_cvar_string, 448}, // #448 string(float n) cvar_string (DP_QC_CVAR_STRING)
{"findflags", PF_FindFlags, 449}, // #449 entity(entity start, .entity fld, float match) findflags (DP_QC_FINDFLAGS)
{"findchainflags", PF_findchainflags, 450}, // #450 entity(.float fld, float match) findchainflags (DP_QC_FINDCHAINFLAGS)
{"findchainflags", PF_cs_findchainflags, 450}, // #450 entity(.float fld, float match) findchainflags (DP_QC_FINDCHAINFLAGS)
{"gettagindex", PF_cs_gettagindex, 451}, // #451 float(entity ent, string tagname) gettagindex (DP_MD3_TAGSINFO)
{"gettaginfo", PF_cs_gettaginfo, 452}, // #452 vector(entity ent, float tagindex) gettaginfo (DP_MD3_TAGSINFO)
{"dropclient", PF_NoCSQC, 453}, // #453 void(entity player) dropclient (DP_SV_BOTCLIENT) (don't implement)
@ -4695,6 +4793,7 @@ static struct {
//DP_QC_GETSURFACEPOINTATTRIBUTE
{"getsurfacepointattribute",PF_getsurfacepointattribute, 486}, // #486vector(entity e, float s, float n, float a) getsurfacepointattribute
#ifndef NOMEDIA
//DP_GECKO_SUPPORT
{"gecko_create", PF_cs_gecko_create, 487}, // #487 float(string name) gecko_create( string name )
{"gecko_destroy", PF_cs_gecko_destroy, 488}, // #488 void(string name) gecko_destroy( string name )
@ -4703,6 +4802,7 @@ static struct {
{"gecko_mousemove", PF_cs_gecko_mousemove, 491}, // #491 void gecko_mousemove( string name, float x, float y )
{"gecko_resize", PF_cs_gecko_resize, 492}, // #492 void gecko_resize( string name, float w, float h )
{"gecko_get_texture_extent",PF_cs_gecko_get_texture_extent, 493}, // #493 vector gecko_get_texture_extent( string name )
#endif
//DP_QC_CRC16
{"crc16", PF_crc16, 494}, // #494 float(float caseinsensitive, string s, ...) crc16

View file

@ -123,7 +123,7 @@ char *Sys_GetNameForAddress(dllhandle_t *module, void *address)
}
#endif
#ifdef Q2SERVER
static HINSTANCE game_library;
/*
@ -235,10 +235,7 @@ void *Sys_GetGameAPI (void *parms)
return GetGameAPI (parms);
}
#endif
#define MINIMUM_WIN_MEMORY 0x0800000
@ -310,6 +307,7 @@ int VARGS Sys_DebugLog(char *file, char *fmt, ...)
int *debug;
#ifndef SERVERONLY
#if (_WIN32_WINNT < 0x0400)
#define LLKHF_ALTDOWN 0x00000020
@ -394,6 +392,7 @@ void SetHookState(qboolean state)
llkeyboardhook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(NULL), 0);
}
#endif
/*
===============================================================================
@ -427,8 +426,10 @@ int Sys_FileTime (char *path)
FILE *f;
int t=0, retval;
#ifndef SERVERONLY
if (qrenderer)
t = VID_ForceUnlockedAndReturnState ();
#endif
f = fopen(path, "rb");
@ -442,8 +443,10 @@ int Sys_FileTime (char *path)
retval = -1;
}
#ifndef SERVERONLY
if (qrenderer)
VID_ForceLockState (t);
#endif
return retval;
}
@ -569,10 +572,10 @@ void Sys_Init (void)
// unsigned int lowpart, highpart;
OSVERSIONINFO vinfo;
#ifndef SERVERONLY
Cvar_Register(&sys_disableWinKeys, "System vars");
Cvar_Register(&sys_disableTaskSwitch, "System vars");
#ifndef SERVERONLY
#ifndef CLIENTONLY
if (!isDedicated && !COM_CheckParm("-nomutex"))
#else
@ -600,8 +603,10 @@ void Sys_Init (void)
#endif
#ifndef SERVERONLY
MaskExceptions ();
Sys_SetFPCW ();
#endif
#if 0
if (!QueryPerformanceFrequency (&PerformanceFreq))
@ -659,16 +664,20 @@ void VARGS Sys_Error (const char *error, ...)
vsnprintf (text, sizeof(text), error, argptr);
va_end (argptr);
#ifndef SERVERONLY
SetHookState(false);
Host_Shutdown ();
#else
SV_Shutdown();
#endif
MessageBox(NULL, text, "Error", 0);
#ifndef SERVERONLY
CloseHandle (qwclsemaphore);
SetHookState(false);
#endif
SetHookState(false);
exit (1);
}
@ -690,24 +699,25 @@ void VARGS Sys_Printf (char *fmt, ...)
void Sys_Quit (void)
{
#ifndef SERVERONLY
if (VID_ForceUnlockedAndReturnState)
VID_ForceUnlockedAndReturnState ();
SetHookState(false);
Host_Shutdown();
Host_Shutdown ();
#ifndef SERVERONLY
if (tevent)
CloseHandle (tevent);
if (qwclsemaphore)
CloseHandle (qwclsemaphore);
#endif
SetHookState(false);
#else
SV_Shutdown();
#endif
exit (0);
}
@ -1037,6 +1047,12 @@ qboolean Sys_InitTerminal (void)
{
if (!AllocConsole())
return false;
//if we still have the splash screen, kill it
if (hwnd_dialog)
DestroyWindow(hwnd_dialog);
hwnd_dialog = NULL;
SetConsoleCtrlHandler (HandlerRoutine, TRUE);
SetConsoleTitle (FULLENGINENAME " dedicated server");
hinput = GetStdHandle (STD_INPUT_HANDLE);
@ -1089,7 +1105,9 @@ void Sys_SendKeyEvents (void)
void Sys_ServerActivity(void)
{
#ifndef SERVERONLY
FlashWindow(mainwindow, true);
#endif
}
/*
@ -1122,7 +1140,7 @@ char *argv[MAX_NUM_ARGVS];
static char exename[256];
HWND hwnd_dialog;
#ifndef CLIENTONLY
#if !defined(CLIENTONLY) && !defined(SERVERONLY)
qboolean isDedicated = false;
#endif
/*
@ -1248,17 +1266,21 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
parms.argc = com_argc;
parms.argv = com_argv;
#ifndef CLIENTONLY
#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
#endif
hwnd_dialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);
if (hwnd_dialog)
@ -1336,8 +1358,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
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 ();
@ -1350,9 +1377,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
/* main window message loop */
while (1)
{
#ifndef CLIENTONLY
if (isDedicated)
{
#ifndef CLIENTONLY
NET_Sleep(50, false);
// find time passed since last cycle
@ -1361,10 +1388,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
oldtime = newtime;
SV_Frame ();
#else
Sys_Error("wut?");
#endif
}
else
#endif
{
#ifndef SERVERONLY
// yield the CPU for a little while when paused, minimized, or not the focus
if (((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing) && !Media_PlayingFullScreen())
{
@ -1384,6 +1414,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
SetHookState(sys_disableWinKeys.value);
// Sleep(0);
#else
Sys_Error("wut?");
#endif
}
}
@ -1391,6 +1424,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
return TRUE;
}
int __cdecl main(void)
{
FreeConsole();
return WinMain(GetModuleHandle(NULL), NULL, GetCommandLine(), SW_NORMAL);
}
qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate)
{
HDC hdc;

View file

@ -110,10 +110,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PSET_CLASSIC
#pragma message("temp")
#define CSQC_DAT
#define MENU_DAT
#ifndef SERVERONLY //don't be stupid, stupid.
#define CLIENTONLY
#endif
@ -206,6 +202,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef SERVERONLY //remove options that don't make sense on only a server
#undef Q2CLIENT
#undef Q3CLIENT
#undef HLCLIENT
#undef VM_UI
#undef VM_CG
#undef WEBCLIENT
@ -221,12 +218,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef CLIENTONLY //remove optional server components that make no sence on a client only build.
#undef Q2SERVER
#undef Q3SERVER
#undef HLSERVER
#undef WEBSERVER
#undef VM_Q1
//this is regretable, but the csqc/ssqc needs a cleanup to move common builtins to a common c file.
#undef CSQC_DAT
#undef MENU_DAT
#endif
//remove any options that depend upon GL.

View file

@ -1628,7 +1628,39 @@ void COM_DefaultExtension (char *path, char *extension, int maxlen)
///=====================================
// This is the standard RGBI palette used in CGA text mode
consolecolours_t consolecolours[MAXCONCOLOURS] = {
{0, 0, 0 }, // black
{0, 0, 0.67}, // blue
{0, 0.67, 0 }, // green
{0, 0.67, 0.67}, // cyan
{0.67, 0, 0 }, // red
{0.67, 0, 0.67}, // magenta
{0.67, 0.33, 0 }, // brown
{0.67, 0.67, 0.67}, // light gray
{0.33, 0.33, 0.33}, // dark gray
{0.33, 0.33, 1 }, // light blue
{0.33, 1, 0.33}, // light green
{0.33, 1, 1 }, // light cyan
{1, 0.33, 0.33}, // light red
{1, 0.33, 1 }, // light magenta
{1, 1, 0.33}, // yellow
{1, 1, 1 } // white
};
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
//Strips out the flags

View file

@ -103,7 +103,7 @@ cvar_t plug_loaddefault = SCVAR("plug_loaddefault", "1");
#endif
//custom plugin builtins.
typedef int (VARGS *Plug_Builtin_t)(void *offset, unsigned int mask, const int *arg);
typedef int (EXPORT_FN *Plug_Builtin_t)(void *offset, unsigned int mask, const int *arg);
void Plug_RegisterBuiltin(char *name, Plug_Builtin_t bi, int flags);
#define PLUG_BIF_DLLONLY 1
#define PLUG_BIF_QVMONLY 2

View file

@ -164,6 +164,15 @@ pbool QC_WriteFile(char *name, void *data, int len)
return true;
}
//a little loop so we can keep track of used mem
void *VARGS PR_CB_Malloc(int size)
{
return BZ_Malloc(size);//Z_TagMalloc (size, 100);
}
void VARGS PR_CB_Free(void *mem)
{
BZ_Free(mem);
}
////////////////////////////////////////////////////
//Finding
@ -198,33 +207,6 @@ void PF_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
*/
//EXTENSION: DP_QC_FINDFLAGS
//entity(entity start, float fld, float match) findflags = #449
void PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int e, f;
int s;
edict_t *ed;
e = G_EDICTNUM(prinst, OFS_PARM0);
f = G_INT(OFS_PARM1)+prinst->fieldadjust;
s = G_FLOAT(OFS_PARM2);
for (e++; e < *prinst->parms->sv_num_edicts; e++)
{
ed = EDICT_NUM(prinst, e);
if (ed->isfree)
continue;
if ((int)((float *)ed->v)[f] & s)
{
RETURN_EDICT(prinst, ed);
return;
}
}
RETURN_EDICT(prinst, *prinst->parms->sv_edicts);
}
/*
//entity(string field, float match) findchainfloat = #403
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -288,6 +270,33 @@ void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
*/
//EXTENSION: DP_QC_FINDFLAGS
//entity(entity start, float fld, float match) findflags = #449
void PF_FindFlags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int e, f;
int s;
edict_t *ed;
e = G_EDICTNUM(prinst, OFS_PARM0);
f = G_INT(OFS_PARM1)+prinst->fieldadjust;
s = G_FLOAT(OFS_PARM2);
for (e++; e < *prinst->parms->sv_num_edicts; e++)
{
ed = EDICT_NUM(prinst, e);
if (ed->isfree)
continue;
if ((int)((float *)ed->v)[f] & s)
{
RETURN_EDICT(prinst, ed);
return;
}
}
RETURN_EDICT(prinst, *prinst->parms->sv_edicts);
}
//entity(entity start, float fld, float match) findfloat = #98
void PF_FindFloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -2295,33 +2304,6 @@ void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
/*
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_findchainflags
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_findchainfloat
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_findchain
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_cl_getkeybind
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_cl_stringtokeynum
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_cl_keynumtostring
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawresetcliparea
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawsetcliparea
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawfill
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawpic
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawstring
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawcharacter
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_free_pic
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawgetimagesize
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_precache_pic
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_is_cached_pic
pr_csqc.obj : error LNK2001: unresolved external symbol _PF_CL_drawline
pr_csqc.obj : error LNK2001: unresolved external symbol _checkfteextensionsv
pr_csqc.obj : error LNK2001: unresolved external symbol _checkextension
pr_csqc.obj : error LNK2001: unresolved external symbol _QCEditor
pr_csqc.obj : error LNK2001: unresolved external symbol _PR_CB_Free
pr_csqc.obj : error LNK2001: unresolved external symbol _PR_CB_Malloc
pr_csqc.obj : error LNK2001: unresolved external symbol _QC_WriteFile
pr_csqc.obj : error LNK2001: unresolved external symbol _MP_TranslateFTEtoDPCodes
*/

View file

@ -331,15 +331,6 @@ void QC_Clear(void);
builtin_t pr_builtin[];
extern int pr_numbuiltins;
//a little loop so we can keep track of used mem
void *VARGS PR_CB_Malloc(int size)
{
return BZ_Malloc(size);//Z_TagMalloc (size, 100);
}
void VARGS PR_CB_Free(void *mem)
{
BZ_Free(mem);
}
int QCLibEditor(progfuncs_t *prinst, char *filename, int line, int nump, char **parms);
int QCEditor (progfuncs_t *prinst, char *filename, int line, int nump, char **parms)
{
@ -6439,7 +6430,7 @@ static void PF_copyentity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//entity(string field, string match) findchain = #402
//chained search for strings in entity fields
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_sv_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
char *s;
@ -6473,7 +6464,7 @@ void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//entity(string field, float match) findchainfloat = #403
//chained search for float, int, and entity reference fields
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_sv_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
float s;
@ -6503,7 +6494,7 @@ void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals)
//entity(string field, float match) findchainflags = #450
//chained search for float, int, and entity reference fields
void PF_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_sv_findchainflags (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int i, f;
int s;
@ -8995,9 +8986,9 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
//DP_SV_SETCOLOR
{"setcolors", PF_setcolors, 0, 0, 0, 401},// #401 void(entity from, entity to) setcolors
//DP_QC_FINDCHAIN
{"findchain", PF_findchain, 0, 0, 0, 402},// #402 entity(string field, string match) findchain (DP_QC_FINDCHAIN)
{"findchain", PF_sv_findchain, 0, 0, 0, 402},// #402 entity(string field, string match) findchain (DP_QC_FINDCHAIN)
//DP_QC_FINDCHAINFLOAT
{"findchainfloat", PF_findchainfloat, 0, 0, 0, 403},// #403 entity(float fld, float match) findchainfloat (DP_QC_FINDCHAINFLOAT)
{"findchainfloat", PF_sv_findchainfloat, 0, 0, 0, 403},// #403 entity(float fld, float match) findchainfloat (DP_QC_FINDCHAINFLOAT)
//DP_SV_EFFECT
{"effect", PF_effect, 0, 0, 0, 404},// #404 void(vector org, string modelname, float startframe, float endframe, float framerate) effect (DP_SV_EFFECT)
//DP_TE_BLOOD
@ -9069,7 +9060,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
//DP_QC_FINDFLAGS
{"findflags", PF_FindFlags, 0, 0, 0, 449},// #449 entity(entity start, .entity fld, float match) findflags
//DP_QC_FINDCHAINFLAGS
{"findchainflags", PF_findchainflags, 0, 0, 0, 450},// #450 entity(.float fld, float match) findchainflags
{"findchainflags", PF_sv_findchainflags, 0, 0, 0, 450},// #450 entity(.float fld, float match) findchainflags
//DP_MD3_TAGSINFO
{"gettagindex", PF_gettagindex, 0, 0, 0, 451},// #451 float(entity ent, string tagname) gettagindex (DP_MD3_TAGSINFO)
{"gettaginfo", PF_sv_gettaginfo, 0, 0, 0, 452},// #452 vector(entity ent, float tagindex) gettaginfo (DP_MD3_TAGSINFO)

View file

@ -51,20 +51,6 @@ cvar_t sys_linebuffer = SCVARC("sys_linebuffer", "1", Sys_Linebuffer_Callback);
qboolean stdin_ready;
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
struct termios orig, changes;
/*
@ -817,6 +803,38 @@ int Sys_EnumerateFiles (char *gpath, char *match, int (*func)(char *, int, void
return true;
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
dlclose((void*)lib);
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
dllhandle_t lib;
lib = dlopen (name, RTLD_LAZY);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = dlsym(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
static void *game_library;
void Sys_UnloadGame(void)

View file

@ -35,21 +35,99 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#define SERVICENAME DISTRIBUTION"SV"
// This is for remapping the Q3 color codes to character masks, including ^9
conchar_t q3codemasks[MAXQ3COLOURS] = {
0x00000000, // 0, black
0x0c000000, // 1, red
0x0a000000, // 2, green
0x0e000000, // 3, yellow
0x09000000, // 4, blue
0x0b000000, // 5, cyan
0x0d000000, // 6, magenta
0x0f000000, // 7, white
0x0f100000, // 8, half-alpha white (BX_COLOREDTEXT)
0x07000000 // 9, "half-intensity" (BX_COLOREDTEXT)
};
static HANDLE hconsoleout;
void Sys_CloseLibrary(dllhandle_t *lib)
{
FreeLibrary((HMODULE)lib);
}
dllhandle_t *Sys_LoadLibrary(char *name, dllfunction_t *funcs)
{
int i;
HMODULE lib;
lib = LoadLibrary(name);
if (!lib)
return NULL;
for (i = 0; funcs[i].name; i++)
{
*funcs[i].funcptr = GetProcAddress(lib, funcs[i].name);
if (!*funcs[i].funcptr)
break;
}
if (funcs[i].name)
{
Sys_CloseLibrary((dllhandle_t*)lib);
lib = NULL;
}
return (dllhandle_t*)lib;
}
void *Sys_GetAddressForName(dllhandle_t *module, char *exportname)
{
if (!module)
return NULL;
return GetProcAddress((HINSTANCE)module, exportname);
}
#ifdef HLSERVER
char *Sys_GetNameForAddress(dllhandle_t *module, void *address)
{
//windows doesn't provide a function to do this, so we have to do it ourselves.
//this isn't the fastest way...
//halflife needs this function.
char *base = (char *)module;
IMAGE_DATA_DIRECTORY *datadir;
IMAGE_EXPORT_DIRECTORY *block;
IMAGE_NT_HEADERS *ntheader;
IMAGE_DOS_HEADER *dosheader = (void*)base;
int i, j;
DWORD *funclist;
DWORD *namelist;
SHORT *ordilist;
if (!dosheader || dosheader->e_magic != IMAGE_DOS_SIGNATURE)
return NULL; //yeah, that wasn't an exe
ntheader = (void*)(base + dosheader->e_lfanew);
if (!dosheader->e_lfanew || ntheader->Signature != IMAGE_NT_SIGNATURE)
return NULL; //urm, wait, a 16bit dos exe?
datadir = &ntheader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT];
block = (IMAGE_EXPORT_DIRECTORY *)(base + datadir->VirtualAddress);
funclist = (DWORD*)(base+block->AddressOfFunctions);
namelist = (DWORD*)(base+block->AddressOfNames);
ordilist = (SHORT*)(base+block->AddressOfNameOrdinals);
for (i = 0; i < block->NumberOfFunctions; i++)
{
if (base+funclist[i] == address)
{
for (j = 0; j < block->NumberOfNames; j++)
{
if (ordilist[j] == i)
{
return base+namelist[i];
}
}
//it has no name. huh?
return NULL;
}
}
return NULL;
}
#endif
#ifdef Q2SERVER
static HINSTANCE game_library;
/*
@ -162,6 +240,7 @@ void *Sys_GetGameAPI (void *parms)
return GetGameAPI (parms);
}
#endif