Compare commits

...
13 Commits
Author SHA1 Message Date
OM 79ce5261a5 Bumped version number 2023-06-27 00:28:58 +02:00
OM 9fdda882e5 Execute known commands in a separate function called CL_ProcessServerCommand
Also fixed crash with server quitting: Com_Error was called immediately with the cgame module in stack - Com_Error would call CL_Disconnect which would unload cgame module, invalidating stack frames and rendering longjmp impossible
2023-06-27 00:23:11 +02:00
OM 55e07205e3 Fixed sval_func1 not having a sourcepos (leading to invalid memory access) 2023-06-27 00:01:30 +02:00
OM 3ff4a7b8e4 Removed Quake III arena's boring call to Hunk_ClearTempMemory from FS_FreeFile 2023-06-27 00:01:12 +02:00
OM f6c25921dc Fixed linux compilation errors 2023-06-25 22:07:17 +02:00
OM f38645d19f Removed static variables from extern 2023-06-25 21:34:53 +02:00
OM 6134b150c1 ioq3 files backport 2023-06-25 20:26:47 +02:00
OM e275c4692e Fixed linked doors assertion failure 2023-06-25 20:04:11 +02:00
OM fdd4968ba9 Set homePath to an empty string 2023-06-25 19:35:53 +02:00
OM 02993eaa9b Backported ioq3 features 2023-06-25 19:35:41 +02:00
OM 7e44b955d7 newline 2023-06-25 19:35:13 +02:00
OM 1855bf1bd4 Removed cl_curl.cpp as there is cl_curl.c 2023-06-25 19:34:42 +02:00
pryon adc6a6579f Implement R_TerrainHeightForPoly (#45)
* Implement R_TerrainHeightForPoly

* Add back the original assert messages using the && va trick
2023-06-25 00:09:35 +02:00
23 changed files with 1726 additions and 1114 deletions

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ void CG_PlayerTeamIcon(refEntity_t* pModel, entityState_t* pPlayerState)
if (pPlayerState->number == cg.snap->ps.clientNum) {
return;
}
bInTeam = qfalse;
bSpecialIcon = qfalse;
if (cgs.gametype > GT_FFA
+55 -30
View File
@@ -290,19 +290,16 @@ void CL_CgameError( const char *string ) {
CL_ConfigstringModified
=====================
*/
void CL_ConfigstringModified( void ) {
char *old, *s;
int i, index;
void CL_ConfigstringModified(int index, char* s) {
char *old;
int i;
char *dup;
gameState_t oldGs;
size_t len;
index = atoi( Cmd_Argv(1) );
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
// get everything after "cs <num>"
s = Cmd_ArgsFrom(2);
old = cl.gameState.stringData + cl.gameState.stringOffsets[ index ];
if ( !strcmp( old, s ) ) {
@@ -346,6 +343,46 @@ void CL_ConfigstringModified( void ) {
}
/*
=====================
CL_ProcessServerCommand
=====================
*/
qboolean CL_ProcessServerCommand(const char* origString, const char* cmd, qboolean differentServer) {
if (!strcmp(cmd, "disconnect")) {
// Execute the disconnect command in the main loop
// Never call Com_Error there:
// because this function might be called from a module that would be unloaded
// inside Com_Error
UI_ForceMenuOff(1);
Cbuf_AddText("disconnect;pushmenu disconnected");
return qtrue;
}
if (!strcmp(cmd, "cs")) {
CL_ConfigstringModified(atoi(Cmd_Argv(1)), Cmd_ArgsFrom(2));
// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
Cmd_TokenizeString(origString);
return qtrue;
}
if (!strcmp(cmd, "fadesound")) {
Com_Printf("CL_ProcessServerCommand: fadesound '%s'\n", Cmd_Argv(1));
if (differentServer) {
Com_Printf("^~^~^ fadesound from previous map ignored\n");
return qfalse;
}
S_FadeSound(atof(Cmd_Argv(1)));
return qfalse;
}
// we may want to put a "connect to other server" command here
// cgame can now act on the command
return qtrue;
}
/*
===================
@@ -358,7 +395,6 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
char *s;
char *cmd;
static char bigConfigString[BIG_INFO_STRING];
int argc;
// if we have irretrievably lost a reliable command, drop the connection
if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) {
@@ -382,31 +418,10 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s );
}
rescan:
Cmd_TokenizeString( s );
cmd = Cmd_Argv(0);
argc = Cmd_Argc();
if ( !strcmp( cmd, "disconnect" ) ) {
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=552
// allow server to indicate why they were disconnected
if ( argc >= 2 )
Com_Error( ERR_SERVERDISCONNECT, "Server disconnected - %s", Cmd_Argv( 1 ) );
else
Com_Error( ERR_SERVERDISCONNECT, "Server disconnected\n" );
}
if ( !strcmp( cmd, "cs" ) ) {
CL_ConfigstringModified();
// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
Cmd_TokenizeString( s );
return qtrue;
}
// we may want to put a "connect to other server" command here
// cgame can now act on the command
return qtrue;
return CL_ProcessServerCommand(s, cmd, differentServer);
}
@@ -443,6 +458,16 @@ void CL_CG_Free( void *ptr )
Z_Free( ptr );
}
/*
====================
CL_CG_AddReliableCommand
====================
*/
void CL_CG_AddReliableCommand(const char* cmd)
{
CL_AddReliableCommand(cmd, qfalse);
}
/*
====================
CL_R_AddPolyToScene
@@ -572,7 +597,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
cgi->MSG_ReadCoord = CL_MSG_ReadCoord;
cgi->MSG_ReadDir = CL_MSG_ReadDir;
cgi->SendClientCommand = CL_AddReliableCommand;
cgi->SendClientCommand = CL_CG_AddReliableCommand;
cgi->CM_LoadMap = CL_CM_LoadMap;
cgi->CM_NumInlineModels = CM_NumInlineModels;
-330
View File
@@ -1,330 +0,0 @@
/*
===========================================================================
Copyright (C) 2006 Tony J. White (tjw@tjw.org)
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#ifdef USE_CURL
#include "client.h"
cvar_t *cl_cURLLib;
#ifdef USE_CURL_DLOPEN
#include "../sys/sys_loadlib.h"
char* (*qcurl_version)(void);
CURL* (*qcurl_easy_init)(void);
CURLcode (*qcurl_easy_setopt)(CURL *curl, CURLoption option, ...);
CURLcode (*qcurl_easy_perform)(CURL *curl);
void (*qcurl_easy_cleanup)(CURL *curl);
CURLcode (*qcurl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
CURL* (*qcurl_easy_duphandle)(CURL *curl);
void (*qcurl_easy_reset)(CURL *curl);
const char *(*qcurl_easy_strerror)(CURLcode);
CURLM* (*qcurl_multi_init)(void);
CURLMcode (*qcurl_multi_add_handle)(CURLM *multi_handle,
CURL *curl_handle);
CURLMcode (*qcurl_multi_remove_handle)(CURLM *multi_handle,
CURL *curl_handle);
CURLMcode (*qcurl_multi_fdset)(CURLM *multi_handle,
fd_set *read_fd_set,
fd_set *write_fd_set,
fd_set *exc_fd_set,
int *max_fd);
CURLMcode (*qcurl_multi_perform)(CURLM *multi_handle,
int *running_handles);
CURLMcode (*qcurl_multi_cleanup)(CURLM *multi_handle);
CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
int *msgs_in_queue);
const char *(*qcurl_multi_strerror)(CURLMcode);
static void *cURLLib = NULL;
/*
=================
GPA
=================
*/
static void *GPA(char *str)
{
void *rv;
rv = Sys_LoadFunction(cURLLib, str);
if(!rv)
{
Com_Printf("Can't load symbol %s\n", str);
clc.cURLEnabled = qfalse;
return NULL;
}
else
{
Com_DPrintf("Loaded symbol %s (0x%p)\n", str, rv);
return rv;
}
}
#endif /* USE_CURL_DLOPEN */
/*
=================
CL_cURL_Init
=================
*/
qboolean CL_cURL_Init()
{
#ifdef USE_CURL_DLOPEN
if(cURLLib)
return qtrue;
Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
if( (cURLLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
#endif /* _WIN32 */
}
clc.cURLEnabled = qtrue;
qcurl_version = GPA("curl_version");
qcurl_easy_init = GPA("curl_easy_init");
qcurl_easy_setopt = GPA("curl_easy_setopt");
qcurl_easy_perform = GPA("curl_easy_perform");
qcurl_easy_cleanup = GPA("curl_easy_cleanup");
qcurl_easy_getinfo = GPA("curl_easy_getinfo");
qcurl_easy_duphandle = GPA("curl_easy_duphandle");
qcurl_easy_reset = GPA("curl_easy_reset");
qcurl_easy_strerror = GPA("curl_easy_strerror");
qcurl_multi_init = GPA("curl_multi_init");
qcurl_multi_add_handle = GPA("curl_multi_add_handle");
qcurl_multi_remove_handle = GPA("curl_multi_remove_handle");
qcurl_multi_fdset = GPA("curl_multi_fdset");
qcurl_multi_perform = GPA("curl_multi_perform");
qcurl_multi_cleanup = GPA("curl_multi_cleanup");
qcurl_multi_info_read = GPA("curl_multi_info_read");
qcurl_multi_strerror = GPA("curl_multi_strerror");
if(!clc.cURLEnabled)
{
CL_cURL_Shutdown();
Com_Printf("FAIL One or more symbols not found\n");
return qfalse;
}
Com_Printf("OK\n");
return qtrue;
#else
clc.cURLEnabled = qtrue;
return qtrue;
#endif /* USE_CURL_DLOPEN */
}
/*
=================
CL_cURL_Shutdown
=================
*/
void CL_cURL_Shutdown( void )
{
CL_cURL_Cleanup();
#ifdef USE_CURL_DLOPEN
if(cURLLib)
{
Sys_UnloadLibrary(cURLLib);
cURLLib = NULL;
}
qcurl_easy_init = NULL;
qcurl_easy_setopt = NULL;
qcurl_easy_perform = NULL;
qcurl_easy_cleanup = NULL;
qcurl_easy_getinfo = NULL;
qcurl_easy_duphandle = NULL;
qcurl_easy_reset = NULL;
qcurl_multi_init = NULL;
qcurl_multi_add_handle = NULL;
qcurl_multi_remove_handle = NULL;
qcurl_multi_fdset = NULL;
qcurl_multi_perform = NULL;
qcurl_multi_cleanup = NULL;
qcurl_multi_info_read = NULL;
qcurl_multi_strerror = NULL;
#endif /* USE_CURL_DLOPEN */
}
void CL_cURL_Cleanup(void)
{
if(clc.downloadCURLM) {
if(clc.downloadCURL) {
qcurl_multi_remove_handle(clc.downloadCURLM,
clc.downloadCURL);
qcurl_easy_cleanup(clc.downloadCURL);
}
qcurl_multi_cleanup(clc.downloadCURLM);
clc.downloadCURLM = NULL;
clc.downloadCURL = NULL;
}
else if(clc.downloadCURL) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
}
}
static int CL_cURL_CallbackProgress( void *dummy, double dltotal, double dlnow,
double ultotal, double ulnow )
{
clc.downloadSize = (int)dltotal;
Cvar_SetValue( "cl_downloadSize", clc.downloadSize );
clc.downloadCount = (int)dlnow;
Cvar_SetValue( "cl_downloadCount", clc.downloadCount );
return 0;
}
static int CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
void *stream)
{
FS_Write( buffer, size*nmemb, ((fileHandle_t*)stream)[0] );
return size*nmemb;
}
void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
{
clc.cURLUsed = qtrue;
Com_Printf("URL: %s\n", remoteURL);
Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
"Localname: %s\n"
"RemoteURL: %s\n"
"****************************\n", localName, remoteURL);
CL_cURL_Cleanup();
Q_strncpyz(clc.downloadURL, remoteURL, sizeof(clc.downloadURL));
Q_strncpyz(clc.downloadName, localName, sizeof(clc.downloadName));
Com_sprintf(clc.downloadTempName, sizeof(clc.downloadTempName),
"%s.tmp", localName);
// Set so UI gets access to it
Cvar_Set("cl_downloadName", localName);
Cvar_Set("cl_downloadSize", "0");
Cvar_Set("cl_downloadCount", "0");
Cvar_SetValue("cl_downloadTime", cls.realtime);
clc.downloadBlock = 0; // Starting new file
clc.downloadCount = 0;
clc.downloadCURL = qcurl_easy_init();
if(!clc.downloadCURL) {
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_easy_init() "
"failed\n");
return;
}
clc.download = FS_SV_FOpenFileWrite(clc.downloadTempName);
if(!clc.download) {
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: failed to open "
"%s for writing\n", clc.downloadTempName);
return;
}
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
if(developer->integer)
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
NET_AdrToString(clc.serverAddress)));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
Q3_VERSION, qcurl_version()));
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
CL_cURL_CallbackWrite);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
CL_cURL_CallbackProgress);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
clc.downloadCURLM = qcurl_multi_init();
if(!clc.downloadCURLM) {
qcurl_easy_cleanup(clc.downloadCURL);
clc.downloadCURL = NULL;
Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_multi_init() "
"failed\n");
return;
}
qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
!clc.cURLDisconnected) {
CL_AddReliableCommand("disconnect");
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
clc.cURLDisconnected = qtrue;
}
}
void CL_cURL_PerformDownload(void)
{
CURLMcode res;
CURLMsg *msg;
int c;
int i = 0;
res = qcurl_multi_perform(clc.downloadCURLM, &c);
while(res == CURLM_CALL_MULTI_PERFORM && i < 100) {
res = qcurl_multi_perform(clc.downloadCURLM, &c);
i++;
}
if(res == CURLM_CALL_MULTI_PERFORM)
return;
msg = qcurl_multi_info_read(clc.downloadCURLM, &c);
if(msg == NULL) {
return;
}
FS_FCloseFile(clc.download);
if(msg->msg == CURLMSG_DONE && msg->data.result == CURLE_OK) {
FS_SV_Rename(clc.downloadTempName, clc.downloadName);
clc.downloadRestart = qtrue;
}
else {
long code;
qcurl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE,
&code);
Com_Error(ERR_DROP, "Download Error: %s Code: %ld URL: %s",
qcurl_easy_strerror(msg->data.result),
code, clc.downloadURL);
}
*clc.downloadTempName = *clc.downloadName = 0;
Cvar_Set( "cl_downloadName", "" );
CL_NextDownload();
}
#endif /* USE_CURL */
+17 -17
View File
@@ -206,7 +206,7 @@ The given command will be transmitted to the server, and is gauranteed to
not have future usercmd_t executed before it is executed
======================
*/
void CL_AddReliableCommand( const char *cmd ) {
void CL_AddReliableCommand( const char *cmd, qboolean isDisconnectCmd ) {
int index;
// if we would be losing an old command that hasn't been acknowledged,
@@ -756,7 +756,7 @@ void CL_NextDemo( void ) {
CL_ShutdownAll
=====================
*/
void CL_ShutdownAll(void) {
void CL_ShutdownAll(qboolean shutdownRef) {
#ifdef USE_CURL
CL_cURL_Shutdown();
@@ -927,7 +927,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
// send a disconnect message to the server
// send it a few times in case one is dropped
if ( clc.state >= CA_CONNECTED ) {
CL_AddReliableCommand( "disconnect" );
CL_AddReliableCommand( "disconnect", qtrue );
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
@@ -981,9 +981,9 @@ void CL_ForwardCommandToServer( const char *string ) {
}
if ( Cmd_Argc() > 1 ) {
CL_AddReliableCommand( string );
CL_AddReliableCommand( string, qfalse );
} else {
CL_AddReliableCommand( cmd );
CL_AddReliableCommand( cmd, qfalse );
}
}
@@ -1129,7 +1129,7 @@ void CL_ForwardToServer_f( void ) {
// don't forward the first argument
if ( Cmd_Argc() > 1 ) {
CL_AddReliableCommand( Cmd_Args() );
CL_AddReliableCommand( Cmd_Args(), qfalse );
}
}
@@ -1417,7 +1417,7 @@ void CL_SendPureChecksums( void ) {
for (i = 0; i < 2; i++) {
cMsg[i] += 10;
}
CL_AddReliableCommand( cMsg );
CL_AddReliableCommand( cMsg, qfalse );
}
/*
@@ -1426,7 +1426,7 @@ CL_ResetPureClientAtServer
=================
*/
void CL_ResetPureClientAtServer( void ) {
CL_AddReliableCommand( va("vdr") );
CL_AddReliableCommand( va("vdr"), qfalse );
}
qboolean CL_Allowed_Vid_Restart() {
@@ -1472,7 +1472,7 @@ void CL_Vid_Restart_f( void ) {
// unpause so the cgame definately gets a snapshot and renders a frame
Com_Unpause();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SV_FinishSvsTimeFixups();
@@ -1602,7 +1602,7 @@ void CL_DownloadsComplete( void ) {
FS_Restart(clc.checksumFeed); // We possibly downloaded a pak, restart the file system to load it
// inform the server so we get new gamestate info
CL_AddReliableCommand( "donedl" );
CL_AddReliableCommand( "donedl", qfalse );
// by sending the donedl command we request a new gamestate
// so we don't want to load stuff yet
@@ -1612,11 +1612,11 @@ void CL_DownloadsComplete( void ) {
// let the client game init and load data
clc.state = CA_LOADING;
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
// Pump the loop, this may change gamestate!
Com_EventLoop();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
}
/*
@@ -1646,7 +1646,7 @@ void CL_BeginDownload( const char *localName, const char *remoteName ) {
clc.downloadBlock = 0; // Starting new file
clc.downloadCount = 0;
CL_AddReliableCommand( va("download %s", remoteName) );
CL_AddReliableCommand( va("download %s", remoteName), qfalse );
}
/*
@@ -2345,7 +2345,7 @@ void CL_CheckUserinfo( void ) {
}
cvar_modifiedFlags &= ~CVAR_USERINFO;
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ) );
CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ), qfalse );
}
}
@@ -2566,7 +2566,7 @@ After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
void CL_StartHunkUsers( void ) {
void CL_StartHunkUsers( qboolean rendererOnly ) {
if( !com_cl_running ) {
return;
}
@@ -3278,7 +3278,7 @@ void CL_Init( void ) {
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
CL_InitConsoleCommands();
CL_InitRef();
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SCR_Init ();
@@ -3294,7 +3294,7 @@ void CL_Init( void ) {
Cvar_Get( "cl_guid", "", CVAR_USERINFO | CVAR_ROM );
CL_UpdateGUID( NULL, 0 );
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
end = Sys_Milliseconds();
+5 -5
View File
@@ -546,7 +546,7 @@ void CL_ParseGamestate( msg_t *msg ) {
CL_StopRecord_f();
// reinitialize the filesystem if the game directory has changed
FS_ConditionalRestart( clc.checksumFeed );
FS_ConditionalRestart( clc.checksumFeed, qfalse );
clc.state = CA_LOADING;
if (!com_sv_running->integer)
@@ -651,7 +651,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (!*clc.downloadTempName) {
Com_Printf("Server sending download, but no download was requested\n");
CL_AddReliableCommand( "stopdl" );
CL_AddReliableCommand( "stopdl", qfalse );
return;
}
@@ -693,7 +693,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (!clc.download) {
Com_Printf( "Could not create %s\n", clc.downloadTempName );
CL_AddReliableCommand( "stopdl" );
CL_AddReliableCommand( "stopdl", qfalse );
CL_NextDownload();
return;
}
@@ -702,7 +702,7 @@ void CL_ParseDownload ( msg_t *msg ) {
if (size)
FS_Write( data, size, clc.download );
CL_AddReliableCommand( va("nextdl %d", clc.downloadBlock) );
CL_AddReliableCommand( va("nextdl %d", clc.downloadBlock), qfalse );
clc.downloadBlock++;
clc.downloadCount += size;
@@ -716,7 +716,7 @@ void CL_ParseDownload ( msg_t *msg ) {
clc.download = 0;
// rename the file
FS_SV_Rename ( clc.downloadTempName, clc.downloadName );
FS_SV_Rename ( clc.downloadTempName, clc.downloadName, qfalse );
}
*clc.downloadTempName = *clc.downloadName = 0;
Cvar_Set( "cl_downloadName", "" );
+1 -1
View File
@@ -531,7 +531,7 @@ void SCR_UpdateScreen( void ) {
}
recursive = 1;
CL_StartHunkUsers();
CL_StartHunkUsers(qfalse);
SCR_SimpleUpdateScreen();
// set the fps value
+3 -3
View File
@@ -1114,7 +1114,7 @@ static void DMConsoleCommandHandler( const char *txt ) {
}
Com_sprintf(szStringOut, sizeof(szStringOut), "dmmessage %i %s\n", iMode, txt);
CL_AddReliableCommand(szStringOut);
CL_AddReliableCommand(szStringOut, qfalse);
}
/*
@@ -4399,7 +4399,7 @@ void StatsUpdater::UpdateStats( Event *ev )
}
if( paused && !paused->integer ) {
CL_AddReliableCommand( "stats" );
CL_AddReliableCommand( "stats", qfalse );
}
Event *event = new Event( EV_StatsUpdater_UpdateStats );
@@ -5019,7 +5019,7 @@ void UI_ShowStatistics_f() {
if( paused && !paused->integer )
{
statsRequestTime = cls.realtime;
CL_AddReliableCommand( "stats" );
CL_AddReliableCommand( "stats", qfalse );
Event *event = new Event( EV_StatsUpdater_UpdateStats );
statsUpdater.PostEvent( event, 2.0 );
}
+3 -6
View File
@@ -463,13 +463,10 @@ extern cvar_t* j_up_axis;
//
void CL_Init (void);
void CL_InitClientSavedData( void );
void CL_InitRef( void );
void CL_FlushMemory(void);
void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd );
void CL_InitClientSavedData(void);
void CL_AddReliableCommand(const char *cmd, qboolean isDisconnectCmd);
void CL_StartHunkUsers( void );
void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Connect( const char *server );
+6 -6
View File
@@ -1149,7 +1149,7 @@ void Door::LinkDoors
}
}
if (iNumTouching == 0)
if (!iNumTouching)
{
for (ent = (Door *)G_FindClass(NULL, getClassID()); ent; ent = (Door *)G_FindClass(ent, getClassID()))
{
@@ -1157,12 +1157,12 @@ void Door::LinkDoors
{
iNumTouching++;
}
}
}
}
if (iNumTouching != 0)
{
return;
if (iNumTouching != 0)
{
return;
}
}
cmins = absmin;
+1 -1
View File
@@ -416,7 +416,7 @@ typedef struct gameImport_s {
int ( *Argc )( void );
char *( *Argv )( int n );
const char *( *Args )();
int ( *FS_FOpenFile )( const char *qpath, fileHandle_t *f, fsMode_t mode );
long ( *FS_FOpenFile )( const char *qpath, fileHandle_t *f, fsMode_t mode );
void ( *FS_Read )( void *buffer, int len, fileHandle_t f );
int ( *FS_Write )( const void *buffer, int len, fileHandle_t f );
void ( *FS_FCloseFile )( fileHandle_t f );
+3 -2
View File
@@ -94,10 +94,11 @@ void CL_CDDialog( void ) {
void CL_FlushMemory( void ) {
}
void CL_StartHunkUsers( void ) {
void CL_StartHunkUsers( qboolean rendererOnly ) {
}
void CL_ShutdownAll(void) {}
void CL_ShutdownAll(qboolean shutdownRef) {
}
qboolean CL_CDKeyValidate( const char *key, const char *checksum ) { return qtrue; }
+2 -2
View File
@@ -153,8 +153,8 @@ statement:
| nonident_prim_expr TOKEN_OR_EQUALS expr { $$ = node3( sval_assignment, $1, node4( sval_operation, node1b( OP_BIN_BITWISE_OR ), $1, $3, YYLLOC ), YYLLOC ); }
| nonident_prim_expr TOKEN_SHIFT_LEFT_EQUALS expr { $$ = node3( sval_assignment, $1, node4( sval_operation, node1b( OP_BIN_SHIFT_LEFT ), $1, $3, YYLLOC ), YYLLOC ); }
| nonident_prim_expr TOKEN_SHIFT_RIGHT_EQUALS expr { $$ = node3( sval_assignment, $1, node4( sval_operation, node1b( OP_BIN_SHIFT_RIGHT ), $1, $3, YYLLOC ), YYLLOC ); }
| nonident_prim_expr TOKEN_INCREMENT { $$ = node3( sval_assignment, $1, node2( sval_func1, node1b( OP_UN_INC ), $1 ), YYLLOC ); }
| nonident_prim_expr TOKEN_DECREMENT { $$ = node3( sval_assignment, $1, node2( sval_func1, node1b( OP_UN_DEC ), $1 ), YYLLOC ); }
| nonident_prim_expr TOKEN_INCREMENT { $$ = node3( sval_assignment, $1, node3( sval_func1, node1b( OP_UN_INC ), $1, YYLLOC ), YYLLOC ); }
| nonident_prim_expr TOKEN_DECREMENT { $$ = node3( sval_assignment, $1, node3( sval_func1, node1b( OP_UN_DEC ), $1, YYLLOC ), YYLLOC ); }
| statement TOKEN_SEMICOLON
;
+102 -102
View File
@@ -1,6 +1,6 @@
#line 1 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 1 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
#line 3 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 3 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
#define YY_INT_ALIGNED short int
@@ -776,8 +776,8 @@ goto find_rule; \
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "Z:/openmohaa/code/parser/lex_source.txt"
#line 2 "Z:/openmohaa/code/parser/lex_source.txt"
#line 1 "E:/Src/openmohaa/code/parser/lex_source.txt"
#line 2 "E:/Src/openmohaa/code/parser/lex_source.txt"
/*
* ===========================================================================
* Copyright (C) 2015 the OpenMoHAA team
@@ -905,10 +905,10 @@ static bool UseField( void )
*yytext == '$' || *yytext == '-' || *yytext == '/' );
}
#line 908 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 908 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
/*%option debug*/
#line 911 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 911 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
#define INITIAL 0
#define C_COMMENT 1
@@ -1127,10 +1127,10 @@ YY_DECL
}
{
#line 148 "Z:/openmohaa/code/parser/lex_source.txt"
#line 148 "E:/Src/openmohaa/code/parser/lex_source.txt"
#line 1133 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 1133 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1204,71 +1204,71 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
#line 150 "Z:/openmohaa/code/parser/lex_source.txt"
#line 150 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( C_COMMENT ); }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 151 "Z:/openmohaa/code/parser/lex_source.txt"
#line 151 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( INITIAL ); }
YY_BREAK
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
#line 152 "Z:/openmohaa/code/parser/lex_source.txt"
#line 152 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ ; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 153 "Z:/openmohaa/code/parser/lex_source.txt"
#line 153 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ ; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 154 "Z:/openmohaa/code/parser/lex_source.txt"
#line 154 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ Compiler.CompileError( parsedata.pos - yyleng, "'*/' found outside of comment" ); }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
#line 157 "Z:/openmohaa/code/parser/lex_source.txt"
#line 157 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ ; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 158 "Z:/openmohaa/code/parser/lex_source.txt"
#line 158 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ if( prev_yylex != TOKEN_EOL ) YYLEX( TOKEN_EOL ); }
YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
#line 160 "Z:/openmohaa/code/parser/lex_source.txt"
#line 160 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( INITIAL ); YYLEX( TOKEN_EOL ); }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 161 "Z:/openmohaa/code/parser/lex_source.txt"
#line 161 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SIZE ); }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 162 "Z:/openmohaa/code/parser/lex_source.txt"
#line 162 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_PERIOD ); }
YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
#line 163 "Z:/openmohaa/code/parser/lex_source.txt"
#line 163 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLLOCSET; TextEscapeValue( yytext + 1, strlen( yytext ) - 2 ); YYLEX( TOKEN_STRING ); }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 164 "Z:/openmohaa/code/parser/lex_source.txt"
#line 164 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLLOCSET; TextValue( yytext, strlen( yytext ) ); YYLEX( TOKEN_IDENTIFIER ); }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 165 "Z:/openmohaa/code/parser/lex_source.txt"
#line 165 "E:/Src/openmohaa/code/parser/lex_source.txt"
{
for ( int i = yyleng - 1; i >= 0; --i )
unput( yytext[ i ] );
@@ -1281,338 +1281,338 @@ YY_RULE_SETUP
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
#line 174 "Z:/openmohaa/code/parser/lex_source.txt"
#line 174 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ if( prev_yylex != TOKEN_EOL ) YYLEX( TOKEN_EOL ); }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 175 "Z:/openmohaa/code/parser/lex_source.txt"
#line 175 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ ; }
YY_BREAK
case 16:
/* rule 16 can match eol */
YY_RULE_SETUP
#line 177 "Z:/openmohaa/code/parser/lex_source.txt"
#line 177 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLLOCSET; TextEscapeValue( yytext + 1, strlen( yytext ) - 2 ); YYLEX( TOKEN_STRING ); }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 180 "Z:/openmohaa/code/parser/lex_source.txt"
#line 180 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_TERNARY ); }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 181 "Z:/openmohaa/code/parser/lex_source.txt"
#line 181 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_IF ); }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 182 "Z:/openmohaa/code/parser/lex_source.txt"
#line 182 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_ELSE ); }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 183 "Z:/openmohaa/code/parser/lex_source.txt"
#line 183 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_WHILE ); }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 184 "Z:/openmohaa/code/parser/lex_source.txt"
#line 184 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_FOR ); }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 185 "Z:/openmohaa/code/parser/lex_source.txt"
#line 185 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_DO ); }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 187 "Z:/openmohaa/code/parser/lex_source.txt"
#line 187 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_game ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 188 "Z:/openmohaa/code/parser/lex_source.txt"
#line 188 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_group ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 189 "Z:/openmohaa/code/parser/lex_source.txt"
#line 189 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_level ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 190 "Z:/openmohaa/code/parser/lex_source.txt"
#line 190 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_local ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 191 "Z:/openmohaa/code/parser/lex_source.txt"
#line 191 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_parm ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 192 "Z:/openmohaa/code/parser/lex_source.txt"
#line 192 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_owner ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 193 "Z:/openmohaa/code/parser/lex_source.txt"
#line 193 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); yylval.s.val = node1_( method_self ); YYLEX( TOKEN_LISTENER ); }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 195 "Z:/openmohaa/code/parser/lex_source.txt"
#line 195 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ parsedata.braces_count++; YYLEX( TOKEN_LBRACKET ); }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 196 "Z:/openmohaa/code/parser/lex_source.txt"
#line 196 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ parsedata.braces_count--; YYLEX( TOKEN_RBRACKET ); }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 197 "Z:/openmohaa/code/parser/lex_source.txt"
#line 197 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLLOCSET; YYLEX( TOKEN_LPAREN ); }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 198 "Z:/openmohaa/code/parser/lex_source.txt"
#line 198 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); YYLLOCSET; YYLEX( TOKEN_RPAREN ); }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 199 "Z:/openmohaa/code/parser/lex_source.txt"
#line 199 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_LSQUARE ); }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 200 "Z:/openmohaa/code/parser/lex_source.txt"
#line 200 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); YYLEX( TOKEN_RSQUARE ); }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 202 "Z:/openmohaa/code/parser/lex_source.txt"
#line 202 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_ASSIGNMENT ); }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 203 "Z:/openmohaa/code/parser/lex_source.txt"
#line 203 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_COLON ); }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 204 "Z:/openmohaa/code/parser/lex_source.txt"
#line 204 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_DOUBLE_COLON ); }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 205 "Z:/openmohaa/code/parser/lex_source.txt"
#line 205 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SEMICOLON ); }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 207 "Z:/openmohaa/code/parser/lex_source.txt"
#line 207 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_EQUALITY ); }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 208 "Z:/openmohaa/code/parser/lex_source.txt"
#line 208 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_LOGICAL_OR ); }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 209 "Z:/openmohaa/code/parser/lex_source.txt"
#line 209 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_LOGICAL_AND ); }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 211 "Z:/openmohaa/code/parser/lex_source.txt"
#line 211 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_BITWISE_OR ); }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 212 "Z:/openmohaa/code/parser/lex_source.txt"
#line 212 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_BITWISE_EXCL_OR ); }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 213 "Z:/openmohaa/code/parser/lex_source.txt"
#line 213 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_BITWISE_AND ); }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 214 "Z:/openmohaa/code/parser/lex_source.txt"
#line 214 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_INEQUALITY ); }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 215 "Z:/openmohaa/code/parser/lex_source.txt"
#line 215 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_LESS_THAN ); }
YY_BREAK
case 48:
YY_RULE_SETUP
#line 216 "Z:/openmohaa/code/parser/lex_source.txt"
#line 216 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_GREATER_THAN ); }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 217 "Z:/openmohaa/code/parser/lex_source.txt"
#line 217 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_LESS_THAN_OR_EQUAL ); }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 218 "Z:/openmohaa/code/parser/lex_source.txt"
#line 218 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_GREATER_THAN_OR_EQUAL ); }
YY_BREAK
case 51:
YY_RULE_SETUP
#line 219 "Z:/openmohaa/code/parser/lex_source.txt"
#line 219 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_NEG ); }
YY_BREAK
case 52:
YY_RULE_SETUP
#line 221 "Z:/openmohaa/code/parser/lex_source.txt"
#line 221 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_PLUS ); }
YY_BREAK
case 53:
YY_RULE_SETUP
#line 222 "Z:/openmohaa/code/parser/lex_source.txt"
#line 222 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_PLUS_EQUALS ); }
YY_BREAK
case 54:
YY_RULE_SETUP
#line 223 "Z:/openmohaa/code/parser/lex_source.txt"
#line 223 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_INCREMENT ); }
YY_BREAK
case 55:
YY_RULE_SETUP
#line 224 "Z:/openmohaa/code/parser/lex_source.txt"
#line 224 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MINUS ); }
YY_BREAK
case 56:
YY_RULE_SETUP
#line 225 "Z:/openmohaa/code/parser/lex_source.txt"
#line 225 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MINUS_EQUALS ); }
YY_BREAK
case 57:
YY_RULE_SETUP
#line 226 "Z:/openmohaa/code/parser/lex_source.txt"
#line 226 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MINUS_EQUALS ); }
YY_BREAK
case 58:
YY_RULE_SETUP
#line 227 "Z:/openmohaa/code/parser/lex_source.txt"
#line 227 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_DECREMENT ); }
YY_BREAK
case 59:
YY_RULE_SETUP
#line 228 "Z:/openmohaa/code/parser/lex_source.txt"
#line 228 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MULTIPLY ); }
YY_BREAK
case 60:
YY_RULE_SETUP
#line 229 "Z:/openmohaa/code/parser/lex_source.txt"
#line 229 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MULTIPLY_EQUALS ); }
YY_BREAK
case 61:
YY_RULE_SETUP
#line 230 "Z:/openmohaa/code/parser/lex_source.txt"
#line 230 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_DIVIDE ); }
YY_BREAK
case 62:
YY_RULE_SETUP
#line 231 "Z:/openmohaa/code/parser/lex_source.txt"
#line 231 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_DIVIDE_EQUALS ); }
YY_BREAK
case 63:
YY_RULE_SETUP
#line 232 "Z:/openmohaa/code/parser/lex_source.txt"
#line 232 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MODULUS ); }
YY_BREAK
case 64:
YY_RULE_SETUP
#line 233 "Z:/openmohaa/code/parser/lex_source.txt"
#line 233 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MODULUS_EQUALS ); }
YY_BREAK
case 65:
YY_RULE_SETUP
#line 234 "Z:/openmohaa/code/parser/lex_source.txt"
#line 234 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SHIFT_LEFT ); }
YY_BREAK
case 66:
YY_RULE_SETUP
#line 235 "Z:/openmohaa/code/parser/lex_source.txt"
#line 235 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SHIFT_LEFT_EQUALS ); }
YY_BREAK
case 67:
YY_RULE_SETUP
#line 236 "Z:/openmohaa/code/parser/lex_source.txt"
#line 236 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SHIFT_RIGHT ); }
YY_BREAK
case 68:
YY_RULE_SETUP
#line 237 "Z:/openmohaa/code/parser/lex_source.txt"
#line 237 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SHIFT_RIGHT_EQUALS ); }
YY_BREAK
case 69:
YY_RULE_SETUP
#line 238 "Z:/openmohaa/code/parser/lex_source.txt"
#line 238 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_AND_EQUALS ); }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 239 "Z:/openmohaa/code/parser/lex_source.txt"
#line 239 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_EXCL_OR_EQUALS ); }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 240 "Z:/openmohaa/code/parser/lex_source.txt"
#line 240 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_OR_EQUALS ); }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 241 "Z:/openmohaa/code/parser/lex_source.txt"
#line 241 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ BEGIN( VARIABLES ); YYLEX( TOKEN_DOLLAR ); }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 242 "Z:/openmohaa/code/parser/lex_source.txt"
#line 242 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_NOT ); }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 243 "Z:/openmohaa/code/parser/lex_source.txt"
#line 243 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_COMPLEMENT ); }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 245 "Z:/openmohaa/code/parser/lex_source.txt"
#line 245 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_PERIOD ); }
YY_BREAK
case 76:
YY_RULE_SETUP
#line 247 "Z:/openmohaa/code/parser/lex_source.txt"
#line 247 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_COMMA ); }
YY_BREAK
case 77:
YY_RULE_SETUP
#line 248 "Z:/openmohaa/code/parser/lex_source.txt"
#line 248 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_NUMBER ); }
YY_BREAK
case 78:
YY_RULE_SETUP
#line 250 "Z:/openmohaa/code/parser/lex_source.txt"
#line 250 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_NULL ); }
YY_BREAK
case 79:
YY_RULE_SETUP
#line 251 "Z:/openmohaa/code/parser/lex_source.txt"
#line 251 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_NIL ); }
YY_BREAK
case 80:
YY_RULE_SETUP
#line 253 "Z:/openmohaa/code/parser/lex_source.txt"
#line 253 "E:/Src/openmohaa/code/parser/lex_source.txt"
{
char* p = nullptr;
yylval.s.val.intValue = std::strtoll(yytext, &p, 10);
@@ -1621,7 +1621,7 @@ YY_RULE_SETUP
YY_BREAK
case 81:
YY_RULE_SETUP
#line 258 "Z:/openmohaa/code/parser/lex_source.txt"
#line 258 "E:/Src/openmohaa/code/parser/lex_source.txt"
{
char* p = nullptr;
yylval.s.val.floatValue = std::strtof(yytext, &p);
@@ -1630,47 +1630,47 @@ YY_RULE_SETUP
YY_BREAK
case 82:
YY_RULE_SETUP
#line 264 "Z:/openmohaa/code/parser/lex_source.txt"
#line 264 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_TRY ); }
YY_BREAK
case 83:
YY_RULE_SETUP
#line 265 "Z:/openmohaa/code/parser/lex_source.txt"
#line 265 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_CATCH ); }
YY_BREAK
case 84:
YY_RULE_SETUP
#line 266 "Z:/openmohaa/code/parser/lex_source.txt"
#line 266 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_SWITCH ); }
YY_BREAK
case 85:
YY_RULE_SETUP
#line 268 "Z:/openmohaa/code/parser/lex_source.txt"
#line 268 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_CASE ); }
YY_BREAK
case 86:
YY_RULE_SETUP
#line 269 "Z:/openmohaa/code/parser/lex_source.txt"
#line 269 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_BREAK ); }
YY_BREAK
case 87:
YY_RULE_SETUP
#line 270 "Z:/openmohaa/code/parser/lex_source.txt"
#line 270 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_CONTINUE ); }
YY_BREAK
case 88:
YY_RULE_SETUP
#line 272 "Z:/openmohaa/code/parser/lex_source.txt"
#line 272 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_MAKEARRAY ); }
YY_BREAK
case 89:
YY_RULE_SETUP
#line 273 "Z:/openmohaa/code/parser/lex_source.txt"
#line 273 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ YYLEX( TOKEN_ENDARRAY ); }
YY_BREAK
case 90:
YY_RULE_SETUP
#line 275 "Z:/openmohaa/code/parser/lex_source.txt"
#line 275 "E:/Src/openmohaa/code/parser/lex_source.txt"
{
if( UseField() )
{
@@ -1687,7 +1687,7 @@ YY_RULE_SETUP
YY_BREAK
case 91:
YY_RULE_SETUP
#line 289 "Z:/openmohaa/code/parser/lex_source.txt"
#line 289 "E:/Src/openmohaa/code/parser/lex_source.txt"
{ yylexerror( "bad token:\n" ); }
YY_BREAK
@@ -1697,10 +1697,10 @@ YY_RULE_SETUP
case 92:
YY_RULE_SETUP
#line 297 "Z:/openmohaa/code/parser/lex_source.txt"
#line 297 "E:/Src/openmohaa/code/parser/lex_source.txt"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
#line 1703 "Z:/openmohaa/code/parser/generated/yyLexer.cpp"
#line 1703 "E:/Src/openmohaa/code/parser/generated/yyLexer.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(C_COMMENT):
case YY_STATE_EOF(C_LINE_COMMENT):
@@ -2694,6 +2694,6 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 297 "Z:/openmohaa/code/parser/lex_source.txt"
#line 297 "E:/Src/openmohaa/code/parser/lex_source.txt"
+4 -4
View File
@@ -2,9 +2,9 @@
#define yyHEADER_H 1
#define yyIN_HEADER 1
#line 5 "Z:/openmohaa/code/parser/generated/yyLexer.h"
#line 5 "E:/Src/openmohaa/code/parser/generated/yyLexer.h"
#line 7 "Z:/openmohaa/code/parser/generated/yyLexer.h"
#line 7 "E:/Src/openmohaa/code/parser/generated/yyLexer.h"
#define YY_INT_ALIGNED short int
@@ -465,9 +465,9 @@ extern int yylex (void);
#undef yyTABLES_NAME
#endif
#line 297 "Z:/openmohaa/code/parser/lex_source.txt"
#line 297 "E:/Src/openmohaa/code/parser/lex_source.txt"
#line 471 "Z:/openmohaa/code/parser/generated/yyLexer.h"
#line 471 "E:/Src/openmohaa/code/parser/generated/yyLexer.h"
#undef yyIN_HEADER
#endif /* yyHEADER_H */
+2 -2
View File
@@ -1992,13 +1992,13 @@ yyreduce:
case 34: /* statement: nonident_prim_expr TOKEN_INCREMENT */
#line 156 "E:/Src/openmohaa/code/parser/bison_source.txt"
{ (yyval.s.val) = node3( sval_assignment, (yyvsp[-1].s.val), node2( sval_func1, node1b( OP_UN_INC ), (yyvsp[-1].s.val) ), YYLLOC ); }
{ (yyval.s.val) = node3( sval_assignment, (yyvsp[-1].s.val), node3( sval_func1, node1b( OP_UN_INC ), (yyvsp[-1].s.val), YYLLOC ), YYLLOC ); }
#line 1997 "E:/Src/openmohaa/code/parser/generated/yyParser.cpp"
break;
case 35: /* statement: nonident_prim_expr TOKEN_DECREMENT */
#line 157 "E:/Src/openmohaa/code/parser/bison_source.txt"
{ (yyval.s.val) = node3( sval_assignment, (yyvsp[-1].s.val), node2( sval_func1, node1b( OP_UN_DEC ), (yyvsp[-1].s.val) ), YYLLOC ); }
{ (yyval.s.val) = node3( sval_assignment, (yyvsp[-1].s.val), node3( sval_func1, node1b( OP_UN_DEC ), (yyvsp[-1].s.val), YYLLOC ), YYLLOC ); }
#line 2003 "E:/Src/openmohaa/code/parser/generated/yyParser.cpp"
break;
+242 -6
View File
@@ -130,11 +130,13 @@ int time_frontend; // renderer frontend time
int time_backend; // renderer backend time
int com_frameTime;
int com_frameMsec;
int com_frameNumber;
int com_frameMsec;
qboolean com_errorEntered;
qboolean com_fullyInitialized;
qboolean com_errorEntered = qfalse;
qboolean com_fullyInitialized = qfalse;
qboolean com_gameRestarting = qfalse;
qboolean com_gameClientRestarting = qfalse;
char com_errorMessage[MAXPRINTMSG];
@@ -1273,6 +1275,128 @@ static void Com_Crash_f(void) {
*(int*)invalid_ptr = 0x12345678;
}
/*
==================
Com_Setenv_f
For controlling environment variables
==================
*/
void Com_Setenv_f(void)
{
int argc = Cmd_Argc();
char *arg1 = Cmd_Argv(1);
if(argc > 2)
{
char *arg2 = Cmd_ArgsFrom(2);
Sys_SetEnv(arg1, arg2);
}
else if(argc == 2)
{
char *env = getenv(arg1);
if(env)
Com_Printf("%s=%s\n", arg1, env);
else
Com_Printf("%s undefined\n", arg1);
}
}
/*
==================
Com_ExecuteCfg
For controlling environment variables
==================
*/
void Com_ExecuteCfg(void)
{
Cbuf_ExecuteText(EXEC_NOW, "exec default.cfg\n");
Cbuf_Execute(0); // Always execute after exec to prevent text buffer overflowing
if(!Com_SafeMode())
{
// skip the q3config.cfg and autoexec.cfg if "safe" is on the command line
Cbuf_ExecuteText(EXEC_NOW, "exec " Q3CONFIG_CFG "\n");
Cbuf_Execute(0);
Cbuf_ExecuteText(EXEC_NOW, "exec autoexec.cfg\n");
Cbuf_Execute(0);
}
}
/*
==================
Com_GameRestart
Change to a new mod properly with cleaning up cvars before switching.
==================
*/
void Com_GameRestart(int checksumFeed, qboolean disconnect)
{
// make sure no recursion can be triggered
if(!com_gameRestarting && com_fullyInitialized)
{
com_gameRestarting = qtrue;
com_gameClientRestarting = com_cl_running->integer;
// Kill server if we have one
if(com_sv_running->integer)
SV_Shutdown("Game directory changed");
if(com_gameClientRestarting)
{
if(disconnect)
CL_Disconnect(qfalse);
CL_Shutdown("Game directory changed", disconnect, qfalse);
}
FS_Restart(checksumFeed);
// Clean out any user and VM created cvars
Cvar_Restart(qtrue);
Com_ExecuteCfg();
if(disconnect)
{
// We don't want to change any network settings if gamedir
// change was triggered by a connect to server because the
// new network settings might make the connection fail.
NET_Restart_f();
}
if(com_gameClientRestarting)
{
CL_Init();
CL_StartHunkUsers(qfalse);
}
com_gameRestarting = qfalse;
com_gameClientRestarting = qfalse;
}
}
/*
==================
Com_GameRestart_f
Expose possibility to change current running mod to the user
==================
*/
void Com_GameRestart_f(void)
{
Cvar_Set("fs_game", Cmd_Argv(1));
Com_GameRestart(0, qtrue);
}
#ifndef STANDALONE
// TTimo: centralizing the cl_cdkey stuff after I discovered a buffer overflow problem with the dedicated server version
// not sure it's necessary to have different defaults for regular and dedicated, but I don't want to risk it
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=470
@@ -1282,6 +1406,118 @@ char cl_cdkey[34] = " ";
char cl_cdkey[34] = "123456789";
#endif
/*
=================
Com_ReadCDKey
=================
*/
qboolean CL_CDKeyValidate( const char *key, const char *checksum );
void Com_ReadCDKey( const char *filename ) {
fileHandle_t f;
char buffer[33];
char fbuffer[MAX_OSPATH];
Com_sprintf(fbuffer, sizeof(fbuffer), "%s/q3key", filename);
FS_SV_FOpenFileRead( fbuffer, &f );
if ( !f ) {
Com_Memset( cl_cdkey, '\0', 17 );
return;
}
Com_Memset( buffer, 0, sizeof(buffer) );
FS_Read( buffer, 16, f );
FS_FCloseFile( f );
if (CL_CDKeyValidate(buffer, NULL)) {
Q_strncpyz( cl_cdkey, buffer, 17 );
} else {
Com_Memset( cl_cdkey, '\0', 17 );
}
}
/*
=================
Com_AppendCDKey
=================
*/
void Com_AppendCDKey( const char *filename ) {
fileHandle_t f;
char buffer[33];
char fbuffer[MAX_OSPATH];
Com_sprintf(fbuffer, sizeof(fbuffer), "%s/q3key", filename);
FS_SV_FOpenFileRead( fbuffer, &f );
if (!f) {
Com_Memset( &cl_cdkey[16], '\0', 17 );
return;
}
Com_Memset( buffer, 0, sizeof(buffer) );
FS_Read( buffer, 16, f );
FS_FCloseFile( f );
if (CL_CDKeyValidate(buffer, NULL)) {
strcat( &cl_cdkey[16], buffer );
} else {
Com_Memset( &cl_cdkey[16], '\0', 17 );
}
}
#ifndef DEDICATED
/*
=================
Com_WriteCDKey
=================
*/
static void Com_WriteCDKey( const char *filename, const char *ikey ) {
fileHandle_t f;
char fbuffer[MAX_OSPATH];
char key[17];
#ifndef _WIN32
mode_t savedumask;
#endif
Com_sprintf(fbuffer, sizeof(fbuffer), "%s/q3key", filename);
Q_strncpyz( key, ikey, 17 );
if(!CL_CDKeyValidate(key, NULL) ) {
return;
}
#ifndef _WIN32
savedumask = umask(0077);
#endif
f = FS_SV_FOpenFileWrite( fbuffer );
if ( !f ) {
Com_Printf ("Couldn't write CD key to %s.\n", fbuffer );
goto out;
}
FS_Write( key, 16, f );
FS_Printf( f, "\n// generated by quake, do not modify\r\n" );
FS_Printf( f, "// Do not give this file to ANYONE.\r\n" );
FS_Printf( f, "// id Software and Activision will NOT ask you to send this file to them.\r\n");
FS_FCloseFile( f );
out:
#ifndef _WIN32
umask(savedumask);
#else
;
#endif
}
#endif
#endif // STANDALONE
static void Com_DetectAltivec(void)
{
// Only detect if user hasn't forcibly disabled it.
@@ -1342,7 +1578,9 @@ void Com_Init( char *commandLine ) {
// done early so bind command exists
CL_InitKeyCommands();
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT|CVAR_ROM);
com_standalone = Cvar_Get("com_standalone", "0", CVAR_ROM);
com_basegame = Cvar_Get("com_basegame", BASEGAME, CVAR_INIT);
com_homepath = Cvar_Get("com_homepath", "", CVAR_INIT|CVAR_PROTECTED);
FS_InitFilesystem ();
@@ -1517,8 +1755,6 @@ void Com_Init( char *commandLine ) {
com_fullyInitialized = qtrue;
SaveRegistryInfo( qtrue, "basepath", fs_basepath->string, 128 );
RecoverLostAutodialData();
iEnd = Sys_Milliseconds();
+1101 -566
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -92,6 +92,8 @@ extern "C" {
#define MAX_TEAMNAME 32
#define DEMOEXT "dm_" // standard demo extension
#ifdef _MSC_VER
#pragma warning(disable : 4018) // signed/unsigned mismatch
+1 -1
View File
@@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// These values are the only one that must be set for the version
#define PRODUCT_VERSION_MAJOR 0
#define PRODUCT_VERSION_MINOR 55
#define PRODUCT_VERSION_PATCH 2
#define PRODUCT_VERSION_PATCH 3
#define PRODUCT_VERSION_SUFFIX "alpha"
//
+44 -25
View File
@@ -629,9 +629,10 @@ char *Cvar_InfoString_Big( int bit );
// returns an info string containing all the cvars that have the given bit set
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void Cvar_SetDescription( cvar_t *var, const char *var_description );
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
void Cvar_SetDescription( cvar_t *var, const char *var_description );
void Cvar_Restart(qboolean unsetVM);
void Cvar_Restart_f( void );
void Cvar_SaveGameRestart_f( void );
@@ -666,20 +667,25 @@ issues.
#define MAX_FILE_HANDLES 64
#ifdef DEDICATED
# define Q3CONFIG_CFG "q3config_server.cfg"
#else
# define Q3CONFIG_CFG "q3config.cfg"
#endif
qboolean FS_Initialized( void );
void FS_InitFilesystem( void );
void FS_InitFilesystem2( void );
void FS_Shutdown( qboolean closemfp );
qboolean FS_ConditionalRestart( int checksumFeed );
qboolean FS_ConditionalRestart( int checksumFeed, qboolean disconnect );
void FS_Restart( int checksumFeed );
// shutdown and restart the filesystem so changes to fs_gamedir can take effect
void FS_AddGameDirectory(const char *path, const char *dir);
void FS_AddGameDirectory2(const char *path, const char *dir, qboolean original_paks_priority);
char **FS_ListFilteredFiles( const char *path, const char *extension, const char *filter, qboolean wantSubs, int *numfiles );
char **FS_ListFilteredFiles( const char *path, const char *extension, const char *filter, qboolean wantSubs, int *numfiles, qboolean allowNonPureFilesOnDisk );
char **FS_ListFiles( const char *directory, const char *extension, qboolean wantSubs, int *numfiles );
// directory should not have either a leading or trailing /
// if extension is "/", only subdirectories will be returned
@@ -705,14 +711,12 @@ fileHandle_t FS_FOpenFileWrite( const char *qpath );
fileHandle_t FS_FOpenTextFileWrite( const char *qpath );
// will properly create any needed paths and deal with seperater character issues
int FS_filelength( fileHandle_t f );
void FS_ReplaceSeparators( char *path );
void FS_DeleteFile( const char *filename );
void FS_CanonicalFilename( char *filename );
fileHandle_t FS_SV_FOpenFileWrite( const char *filename );
int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp );
void FS_SV_Rename( const char *from, const char *to );
int FS_FOpenFileRead( const char *qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet );
long FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp );
void FS_SV_Rename( const char *from, const char *to, qboolean safe );
long FS_FOpenFileRead(const char* filename, fileHandle_t* file, qboolean uniqueFILE, qboolean quiet);
// if uniqueFILE is true, then a new FILE will be fopened even if the file
// is found in an already open pak file. If uniqueFILE is false, you must call
// FS_FCloseFile instead of fclose, otherwise the pak FILE would be improperly closed
@@ -756,7 +760,7 @@ int FS_WriteFile( const char *qpath, const void *buffer, int size );
void FS_WriteTextFile( const char *qpath, const void *buffer, int size );
// writes a complete text file, creating any subdirectories needed
int FS_filelength( fileHandle_t f );
long FS_filelength(fileHandle_t f);
// doesn't work for files that are opened from a pack file
int FS_FTell( fileHandle_t f );
@@ -816,10 +820,8 @@ void FS_FilenameCompletion( const char *dir, const char *ext,
const char* FS_GetCurrentGameDir();
void FS_GetRelativeFilename( const char *currentDirectory, const char *absoluteFilename, char *out, size_t destlen );
extern char fs_gamedir[];
extern cvar_t *fs_debug;
extern cvar_t *fs_mapdir;
extern cvar_t *fs_basepath;
extern cvar_t* fs_debug;
extern cvar_t* fs_mapdir;
/*
==============================================================
@@ -915,7 +917,8 @@ void Com_EndRedirect( void );
void QDECL Com_Printf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_Error( int code, const char *fmt, ... ) __attribute__ ((noreturn, format(printf, 2, 3)));
void Com_Quit_f( void );
void Com_Quit_f( void ) __attribute__ ((noreturn));
void Com_GameRestart(int checksumFeed, qboolean disconnect);
int Com_Milliseconds( void ); // will be journaled properly
unsigned Com_BlockChecksum( const void *buffer, int length );
@@ -953,7 +956,12 @@ extern cvar_t *com_journal;
extern cvar_t *com_cameraMode;
extern cvar_t *com_ansiColor;
extern cvar_t *com_unfocused;
extern cvar_t *com_maxfpsUnfocused;
extern cvar_t *com_minimized;
extern cvar_t *com_maxfpsMinimized;
extern cvar_t *com_altivec;
extern cvar_t *com_standalone;
extern cvar_t *com_basegame;
extern cvar_t *com_homepath;
extern cvar_t *com_altivec;
@@ -1124,15 +1132,21 @@ void CL_ForwardCommandToServer( const char *string );
void CL_CDDialog( void );
// bring up the "need a cd to play" dialog
void CL_ShutdownAll( void );
// shutdown all the client stuff
void CL_FlushMemory( void );
// dump all memory on an error
void CL_StartHunkUsers( void );
void CL_ShutdownAll(qboolean shutdownRef);
// shutdown client
void CL_InitRef(void);
// initialize renderer interface
void CL_StartHunkUsers( qboolean rendererOnly );
// start all the client stuff using the hunk
void CL_Snd_Shutdown(void);
// Restart sound subsystem
void Key_KeynameCompletion( void(*callback)(const char *s) );
// for keyname autocompletion
@@ -1269,12 +1283,17 @@ qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
qboolean Sys_IsLANAddress (netadr_t adr);
void Sys_ShowIP(void);
qboolean Sys_Mkdir( const char *path );
char *Sys_Cwd( void );
void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath( void );
FILE *Sys_FOpen( const char *ospath, const char *mode );
qboolean Sys_Mkdir( const char *path );
FILE *Sys_Mkfifo( const char *ospath );
char *Sys_Cwd( void );
void Sys_SetDefaultInstallPath(const char *path);
char *Sys_DefaultInstallPath(void);
char *Sys_SteamPath(void);
char *Sys_GogPath(void);
char *Sys_MicrosoftStorePath(void);
#ifdef MACOS_X
#ifdef __APPLE__
char *Sys_DefaultAppPath(void);
#endif
+129 -2
View File
@@ -1340,10 +1340,137 @@ void R_AddTerrainSurfaces()
}
}
/**
* Calculates the height of a terrain polygon by interpolating the heights of its vertices.
* The function finds the triangle containing the given point (x, y) within the terrain patch,
* and then computes the height at each vertex of the polygon using barycentric interpolation.
* Finally, it updates the z-coordinate of each vertex to store the calculated height.
* Returns qtrue if the triangle was found and the height could be calculated and saved into its vertices.
*
* ToDo: try to use the Vector*(?) macros for the math operations below from q_shared.h and q_math.h, not sure which ones would be a good fit
*/
qboolean R_TerrainHeightForPoly(cTerraPatchUnpacked_t* pPatch, polyVert_t* pVerts, int nVerts)
{
// FIXME: unimplemented
return qfalse;
float x0 = 0;
float y0 = 0;
float x1 = 0;
float y1 = 0;
float x2 = 0;
float y2 = 0;
float fKx[3] = { 0 }, fKy[3] = { 0 }, fKz[3] = { 0 }, fArea[3] = { 0 };
float fAreaTotal = 0;
float x = pVerts->xyz[0];
float y = pVerts->xyz[1];
// Calculate the average of the x and y coordinates of all vertices
if (nVerts > 1)
{
for (int i = 1; i < nVerts; i++)
{
x += pVerts[i].xyz[0];
y += pVerts[i].xyz[1];
}
// Use the averaged values from this point onwards
x = x / nVerts;
y = y / nVerts;
}
// Get the first valid triangle in the patch
terraInt iTri = pPatch->drawinfo.iTriHead;
if (!iTri)
{
assert(!pPatch->drawinfo.iTriHead &&
va("R_TerrainHeightForPoly: point(%f %f) not in patch(%f %f %f)\n",
x, y, pPatch->x0, pPatch->y0, pPatch->z0));
return qfalse;
}
// Find a triangle that contains the point (x, y)
while (qtrue)
{
if (g_pTris[iTri].byConstChecks & 4)
{
// Get all three x-y coordinates of the current triangle's vertices
x0 = g_pVert[g_pTris[iTri].iPt[0]].xyz[0];
y0 = g_pVert[g_pTris[iTri].iPt[0]].xyz[1];
x1 = g_pVert[g_pTris[iTri].iPt[1]].xyz[0];
y1 = g_pVert[g_pTris[iTri].iPt[1]].xyz[1];
x2 = g_pVert[g_pTris[iTri].iPt[2]].xyz[0];
y2 = g_pVert[g_pTris[iTri].iPt[2]].xyz[1];
// Calculate the signed areas of the three sub-triangles
fArea[0] = (x - x1) * (y2 - y1) - (y - y1) * (x2 - x1);
if (fArea[0] < -0.1)
{
// The point is outside the triangle
continue;
}
fArea[1] = (x - x2) * (y0 - y2) - (y - y2) * (x0 - x2);
if (fArea[1] < -0.1)
{
// The point is outside the triangle
continue;
}
fArea[2] = (x - x0) * (y1 - y0) - (y - y0) * (x1 - x0);
if (fArea[2] < -0.1)
{
// The point is outside the triangle
continue;
}
fAreaTotal = fArea[0] + fArea[1] + fArea[2];
if (fAreaTotal > 0.0)
{
// Found it - the point is inside the triangle
break;
}
}
iTri = g_pTris[iTri].iNext;
if (!iTri)
{
// There's no triangle that contains point (x, y) - bail out
assert(!g_pTris[iTri].iNext &&
va("R_TerrainHeightForPoly: point(%f %f) not in patch(%f %f %f)\n",
x, y, pPatch->x0, pPatch->y0, pPatch->z0));
return qfalse;
}
}
// Calculate the barycentric coordinates (fKx, fKy, fKz) of the triangle
float z0 = g_pVert[g_pTris[iTri].iPt[0]].xyz[2] / fAreaTotal;
float z1 = g_pVert[g_pTris[iTri].iPt[1]].xyz[2] / fAreaTotal;
float z2 = g_pVert[g_pTris[iTri].iPt[2]].xyz[2] / fAreaTotal;
fKy[0] = z0 * (x2 - x1);
fKy[1] = z1 * (x0 - x2);
fKy[2] = z2 * (x1 - x0);
fKx[0] = z0 * (y2 - y1);
fKx[1] = z1 * (y0 - y2);
fKx[2] = z2 * (y1 - y0);
// Note: this could be done with the CrossProduct macro if everything were in a vector
fKz[0] = fKx[0] * x1 - y1 * fKy[0];
fKz[1] = fKx[1] * x2 - y2 * fKy[1];
fKz[2] = fKx[2] * x0 - y0 * fKy[2];
// Calculate the height for each vertex
for (int i = 0; i < nVerts; i++)
{
float fScaleX = pVerts[i].xyz[0] * (fKx[0] + fKx[1] + fKx[2]);
float fScaleY = pVerts[i].xyz[1] * (fKy[0] + fKy[1] + fKy[2]);
float fConstZ = fKz[0] + fKz[1] + fKz[2];
// Write back the calculated height into the vertex
pVerts[i].xyz[2] = fScaleY - fScaleX - fConstZ;
}
return qtrue;
}
void R_TerrainRestart_f(void)
+1 -1
View File
@@ -259,7 +259,7 @@ typedef struct {
void (*Clear)();
void (*Cvar_SetDefault)(cvar_t* var, const char* varValue);
int (*FS_OpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
long (*FS_OpenFile)(const char* qpath, fileHandle_t *file, qboolean uniqueFILE, qboolean quiet);
size_t (*FS_Read)(void* buffer, size_t len, fileHandle_t fileHandle);
void (*FS_CloseFile)(fileHandle_t fileHandle);
int (*FS_Seek)(fileHandle_t fileHandle, long offset, fsOrigin_t origin);
+1 -1
View File
@@ -70,7 +70,7 @@ cLocalization::cLocalization()
char szFilename[ MAX_QPATH ];
size_t iBasePos;
ppszFiles = FS_ListFilteredFiles( "global", "txt", "localization*.txt", qfalse, &iFileCount );
ppszFiles = FS_ListFilteredFiles( "global", "txt", "localization*.txt", qfalse, &iFileCount, qtrue );
strcpy( szFilename, "global/" );
memset( szFilename + 8, 0, sizeof( szFilename ) - 8 );
iBasePos = strlen( szFilename );