{
// get basic movement from keyboard
CL_BaseMove(&cmd);
-
+
// OS independent code
IN_PreMove();
-
+
// allow mice or other external controllers to add to the move
IN_Move(&cmd);
-
+
// OS independent code
IN_PostMove();
-
+
// send the unreliable message
CL_SendMove(&cmd);
}
filenamelen = strlen (filename);
+ // search through the path, one element at a time
+ search = fs_searchpaths;
+
+ for( ; search ; search = search->next)
+ if(!search->pack)
+ {
+ snprintf (netpath, sizeof (netpath), "%s/%s",search->filename, filename);
+
+ if (!FS_SysFileExists (netpath))
+ continue;
+
+ if (!quiet)
+ Sys_Printf ("FindFile: %s\n",netpath);
+ return FS_OpenRead (netpath, -1, -1);
+ }
+
+#ifdef AKVERSION
+ search = fs_searchpaths;
+ for ( ; search ; search = search->next)
+ // is the element a pak file?
+ if (search->pack)
+ {
+ // look through all the pak file elements
+ pak = search->pack;
+ for (i=0 ; i<pak->numfiles ; i++)
+ {
+ if (pak->ignorecase)
+ matched = !strcasecmp (pak->files[i].name, filename);
+ else
+ matched = !strcmp (pak->files[i].name, filename);
+ if (matched) // found it?
+ {
+ qfile_t *file;
+
+ if (!quiet)
+ Sys_Printf ("PackFile: %s : %s\n",pak->filename, pak->files[i].name);
+
+ // If we don't have the true offset, get it now
+ if (! (pak->files[i].flags & FILE_FLAG_TRUEOFFS))
+ PK3_GetTrueFileOffset (&pak->files[i], pak);
+
+ // No Zlib DLL = no compressed files
+ if (!zlib_dll && (pak->files[i].flags & FILE_FLAG_DEFLATED))
+ {
+ Con_Printf ("WARNING: can't open the compressed file %s\n"
+ "You need the Zlib DLL to use compressed files\n", filename);
+ fs_filesize = -1;
+ return NULL;
+ }
+
+ // open a new file in the pakfile
+ file = FS_OpenRead (pak->filename, pak->files[i].offset, pak->files[i].packsize);
+ fs_filesize = pak->files[i].realsize;
+
+ if (pak->files[i].flags & FILE_FLAG_DEFLATED)
+ {
+ ztoolkit_t *ztk;
+
+ file->flags |= FS_FLAG_DEFLATED;
+
+ // We need some more variables
+ ztk = Mem_Alloc (fs_mempool, sizeof (*file->z));
+
+ ztk->real_length = pak->files[i].realsize;
+
+ // Initialize zlib stream
+ ztk->zstream.next_in = ztk->input;
+ ztk->zstream.avail_in = 0;
+
+ /* From Zlib's "unzip.c":
+ *
+ * windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+ * return Z_STREAM_END.
+ * In unzip, i don't wait absolutely Z_STREAM_END because I known the
+ * size of both compressed and uncompressed data
+ */
+ if (qz_inflateInit2 (&ztk->zstream, -MAX_WBITS) != Z_OK)
+ Sys_Error ("inflate init error (file: %s)", filename);
+
+ ztk->zstream.next_out = ztk->output;
+ ztk->zstream.avail_out = sizeof (ztk->output);
+
+ file->z = ztk;
+ }
+
+ return file;
+ }
+ }
+ }
+#else
// search through the path, one element at a time
search = fs_searchpaths;
return FS_OpenRead (netpath, -1, -1);
}
}
-
+#endif
+
if (!quiet)
Sys_Printf ("FindFile: can't find %s\n", filename);
extern cvar_t in_pitch_min;
extern cvar_t in_pitch_max;
+extern qboolean in_client_mouse;
+extern float in_mouse_x, in_mouse_y;
+
+//enum {input_game,input_message,input_menu} input_dest;
+
void IN_Commands (void);
// oportunity for devices to stick commands on the script buffer
}
}
- // AK What the fuck ?!?
+ // AK New WTF ?!?
// AK Changed so the code does what the comments tell
//
// 1. if console is active or not, always send the up events
+ // console only wants key down events
if (key_consoleactive && consolekeys[key] && down)
- {
- // console only wants key down events
- //if (!down)
- // return;
-
Key_Console (key, ascii);
- }
else
{
//
if ((key_consoleactive && !consolekeys[key])
|| (key_dest == key_menu && menubound[key])
|| key_dest == key_game)
+ if (!key_consoleactive && key_dest != key_menu)
{
kb = keybindings[key];
if (kb)
return;
}
- if (!down)
- return; // other systems only care about key down events
-
switch (key_dest)
{
case key_message:
string etos(entity)
float stof(...[string])
entity spawn()
-entity remove()
+ remove(entity e)
entity find(entity start, .string field, string match)
-entity findfloat(entity start, .float field, string match)
-entity findentity(entity start, .entity field, string match)
+entity findfloat(entity start, .float field, float match)
+entity findentity(entity start, .entity field, entity match)
entity findchain(.string field, string match)
coredump()
traceon()
traceoff()
- eprint(entity float)
+ eprint(entity e)
float rint(float)
float floor(float)
float ceil(float)
float sin(float)
float cos(float)
float sqrt(float)
- randomvec()
+vector randomvec()
float registercvar (string name, string value)
float min(float a, float b, ...[float])
float max(float a, float b, ...[float])
string fgets(float fhandle)
fputs(float fhandle, string s)
float strlen(string s)
-string strcat(string s1, string s2)
+string strcat(string,string,...[string])
string substring(string s, float start, float length)
vector stov(string s)
string strzone(string s)
- strzone(string s)
+ strunzone(string s)
+float tokenize(string s)
+string argv(float n)
float isserver()
float clientcount()
float clientstate()
clientcommand(float client, string s) (for client and menu)
-float tokenize(string s)
changelevel(string map)
localsound(string sample)
-
+vector getmousepos()
+
perhaps only : Menu : WriteMsg
===============================
float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
float drawfill(vector position, vector size, vector rgb, float alpha, float flag)
+
+==============================================================================
+menu cmd list:
+===============
+
+ setkeydest(float dest)
+float getkeydest
+ setmousetarget(float target)
+float getmousetarget(void)
*/
#include "quakedef.h"
=========
VM_findfloat
- entity findfloat(entity start, .float field, string match)
- entity findentity(entity start, .entity field, string match)
+ entity findfloat(entity start, .float field, float match)
+ entity findentity(entity start, .entity field, entity match)
=========
*/
// LordHavoc: added this for searching float, int, and entity reference fields
=========
VM_eprint
-eprint(entity float)
+eprint(entity e)
=========
*/
void VM_eprint (void)
Returns a vector of length < 1 and > 0
-randomvec()
+vector randomvec()
=================
*/
void VM_randomvec (void)
=========
VM_strcat
-string strcat(string s1, string s2)
+string strcat(string,string,...[string])
=========
*/
//string(string s1, string s2) strcat = #115;
{
char *s;
- VM_SAFEPARMCOUNT(2,VM_strcat);
-
+ if(prog->argc <= 2)
+ PRVM_ERROR("VM_strcat wrong parameter count (min. 2 expected ) !\n");
+
s = VM_GetTempString();
VM_VarString(0, s, STRINGTEMP_LENGTH);
PRVM_G_INT(OFS_RETURN) = PRVM_SetString(s);
=========
VM_strunzone
-strzone(string s)
+strunzone(string s)
=========
*/
//void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!)
/*
=========
-VM_serverstate
+VM_isserver
float isserver()
=========
PRVM_G_FLOAT(OFS_RETURN) = 1;
}
+/*
+=========
+VM_getmousepos
+
+vector getmousepos()
+=========
+*/
+void VM_getmousepos(void)
+{
+
+ VM_SAFEPARMCOUNT(0,VM_getmousepos);
+
+ PRVM_G_VECTOR(OFS_RETURN)[0] = in_mouse_x;
+ PRVM_G_VECTOR(OFS_RETURN)[1] = in_mouse_y;
+ PRVM_G_VECTOR(OFS_RETURN)[0] = 0;
+}
+
void VM_Cmd_Init(void)
{
// only init the stuff for the current prog
char *vm_m_extensions =
"";
-// void setkeydest(float dest)
+/*
+=========
+VM_M_setmousetarget
+
+setmousetarget(float target)
+=========
+*/
+void VM_M_setmousetarget(void)
+{
+ VM_SAFEPARMCOUNT(1, VM_M_setmousetarget);
+
+ switch((int)PRVM_G_FLOAT(OFS_PARM0))
+ {
+ case 1:
+ in_client_mouse = false;
+ break;
+ case 2:
+ in_client_mouse = true;
+ break;
+ default:
+ PRVM_ERROR("VM_M_setmousetarget: wrong destination %i !\n",PRVM_G_FLOAT(OFS_PARM0));
+ }
+}
+
+/*
+=========
+VM_M_getmousetarget
+
+float getmousetarget
+=========
+*/
+void VM_M_getmousetarget(void)
+{
+ VM_SAFEPARMCOUNT(0,VM_M_getmousetarget);
+
+ if(in_client_mouse)
+ PRVM_G_FLOAT(OFS_RETURN) = 2;
+ else
+ PRVM_G_FLOAT(OFS_RETURN) = 1;
+}
+
+
+
+/*
+=========
+VM_M_setkeydest
+
+setkeydest(float dest)
+=========
+*/
void VM_M_setkeydest(void)
{
VM_SAFEPARMCOUNT(1,VM_M_SetKeyDest);
// key_dest = key_message
// break;
default:
- PRVM_ERROR("VM_M_SetKeyDest: wrong destination %i !\n",prog->globals[OFS_PARM0]);
+ PRVM_ERROR("VM_M_setkeydest: wrong destination %i !\n",prog->globals[OFS_PARM0]);
}
-
- return;
}
-// float getkeydest(void)
+/*
+=========
+VM_M_getkeydest
+
+float getkeydest
+=========
+*/
void VM_M_getkeydest(void)
{
VM_SAFEPARMCOUNT(0,VM_M_GetKeyDest);
VM_stov,
VM_strzone,
VM_strunzone,
- VM_isserver,
- VM_clientcount,
- VM_clientstate, // 60
- VM_clcommand,
VM_tokenize,
+ VM_argv,
+ VM_isserver, // 60
+ VM_clientcount,
+ VM_clientstate,
+ VM_clcommand,
VM_changelevel,
- VM_localsound, // 64
- 0,
- 0,
+ VM_localsound,
+ VM_getmousepos, // 66
0,
0,
0,
e10, // 480
e10, // 490
e10, // 500
+ e100, // 600
// menu functions
VM_M_setkeydest,
- VM_M_getkeydest
+ VM_M_getkeydest,
+ VM_M_setmousetarget,
+ VM_M_getmousetarget
};
const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
qboolean isG200 = false; // LordHavoc: the Matrox G200 can't do per pixel alpha, and it uses a D3D driver for GL... ugh...
qboolean isRagePro = false; // LordHavoc: the ATI Rage Pro has limitations with per pixel alpha (the color scaler does not apply to per pixel alpha images...), although not as bad as a G200.
+// AK FIXME -> input_dest
+qboolean in_client_mouse = true;
+
+// AK where should it be placed ?
+float in_mouse_x, in_mouse_y;
+
// GL_ARB_multitexture
int gl_textureunits = 0;
// GL_ARB_texture_env_combine or GL_EXT_texture_env_combine
old_mouse_x = mx;
old_mouse_y = my;
+ in_mouse_x = mouse_x;
+ in_mouse_y = mouse_y;
+
+ // AK: eveything else is client stuff
+ // BTW, this should be seperated somewhen
+ if(!in_client_mouse)
+ return;
+
// LordHavoc: viewzoom affects mouse sensitivity for sniping
mouse_x *= sensitivity.value * cl.viewzoom;
mouse_y *= sensitivity.value * cl.viewzoom;