Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	code/cgame/cg_ents.cpp
#	code/client/cl_main.cpp
#	code/client/snd_music.cpp
#	code/game/g_client.cpp
#	code/game/g_public.h
#	code/game/genericparser2.h
#	code/game/wp_melee.cpp
#	code/qcommon/cm_load.cpp
#	code/qcommon/cm_local.h
#	code/qcommon/common.cpp
#	code/qcommon/sstring.h
#	code/rd-common/tr_public.h
#	code/rd-common/tr_types.h
#	code/rd-vanilla/tr_backend.cpp
#	code/rd-vanilla/tr_shade.cpp
#	code/server/sv_savegame.cpp
#	code/ui/ui_main.cpp
#	codeJK2/game/g_public.h
  • Loading branch information
Dan authored and Dan committed Jul 24, 2016
2 parents c780a5f + 3930571 commit 90e8023
Show file tree
Hide file tree
Showing 26 changed files with 480 additions and 308 deletions.
2 changes: 2 additions & 0 deletions codemp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ if(BuildMPEngine OR BuildMPDed)
"${MPDir}/qcommon/huffman.cpp"
"${MPDir}/qcommon/md4.cpp"
"${MPDir}/qcommon/md5.cpp"
"${MPDir}/qcommon/md5.h"
"${MPDir}/qcommon/MiniHeap.h"
"${MPDir}/qcommon/msg.cpp"
"${MPDir}/qcommon/matcomp.h"
Expand Down Expand Up @@ -312,6 +313,7 @@ if(BuildMPEngine OR BuildMPDed)
"${MPDir}/server/server.h"
"${MPDir}/server/sv_bot.cpp"
"${MPDir}/server/sv_ccmds.cpp"
"${MPDir}/server/sv_challenge.cpp"
"${MPDir}/server/sv_client.cpp"
"${MPDir}/server/sv_game.cpp"
"${MPDir}/server/sv_init.cpp"
Expand Down
11 changes: 6 additions & 5 deletions codemp/botlib/l_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "l_log.h"
#include "l_memory.h"
#include "be_interface.h"
#include <cstddef>

//#define MEMDEBUG
//#define MEMORYMANEGER
Expand Down Expand Up @@ -351,11 +352,11 @@ void *GetMemory(unsigned long size)
void *ptr;
unsigned long int *memid;

ptr = botimport.GetMemory(size + sizeof(unsigned long int));
ptr = botimport.GetMemory(size + sizeof(qmax_align_t));
if (!ptr) return NULL;
memid = (unsigned long int *) ptr;
*memid = MEM_ID;
return (unsigned long int *) ((char *) ptr + sizeof(unsigned long int));
return (unsigned long int *) ((char *) ptr + sizeof(qmax_align_t));
} //end of the function GetMemory
//===========================================================================
//
Expand Down Expand Up @@ -393,11 +394,11 @@ void *GetHunkMemory(unsigned long size)
void *ptr;
unsigned long int *memid;

ptr = botimport.HunkAlloc(size + sizeof(unsigned long int));
ptr = botimport.HunkAlloc(size + sizeof(qmax_align_t));
if (!ptr) return NULL;
memid = (unsigned long int *) ptr;
*memid = HUNK_ID;
return (unsigned long int *) ((char *) ptr + sizeof(unsigned long int));
return (unsigned long int *) ((char *) ptr + sizeof(qmax_align_t));
} //end of the function GetHunkMemory
//===========================================================================
//
Expand Down Expand Up @@ -430,7 +431,7 @@ void FreeMemory(void *ptr)
{
unsigned long int *memid;

memid = (unsigned long int *) ((char *) ptr - sizeof(unsigned long int));
memid = (unsigned long int *) ((char *) ptr - sizeof(qmax_align_t));

if (*memid == MEM_ID)
{
Expand Down
4 changes: 3 additions & 1 deletion codemp/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -5387,7 +5387,9 @@ void CG_SaberClashFlare( void )
v = 0.001f;
}

CG_WorldCoordToScreenCoord( cg_saberFlashPos, &x, &y );
if ( !CG_WorldCoordToScreenCoord( cg_saberFlashPos, &x, &y ) ) {
return;
}

VectorSet4( color, 0.8f, 0.8f, 0.8f, 1.0f );
trap->R_SetColor( color );
Expand Down
2 changes: 1 addition & 1 deletion codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,7 @@ void CL_Init( void ) {
cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE, "Use a unique guid value per server" );

// ~ and `, as keys and characters
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE, "Which keys are used to toggle the console");
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60 0xb2", CVAR_ARCHIVE, "Which keys are used to toggle the console");

// userinfo
cl_name = Cvar_Get ("name", "Padawan", CVAR_USERINFO | CVAR_ARCHIVE, "Player name" );
Expand Down
5 changes: 0 additions & 5 deletions codemp/game/bg_panimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2557,9 +2557,6 @@ static void BG_StartLegsAnim( playerState_t *ps, int anim )
{
if ( ps->pm_type >= PM_DEAD )
{
assert(!BG_InDeathAnim(anim));
//please let me know if this assert fires on you (ideally before you close/ignore it) -rww

//vehicles are allowed to do this.. IF it's a vehicle death anim
if (ps->clientNum < MAX_CLIENTS || anim != BOTH_VT_DEATH1)
{
Expand Down Expand Up @@ -2633,8 +2630,6 @@ void BG_StartTorsoAnim( playerState_t *ps, int anim )
{
if ( ps->pm_type >= PM_DEAD )
{
assert(!BG_InDeathAnim(anim));
//please let me know if this assert fires on you (ideally before you close/ignore it) -rww
return;
}

Expand Down
16 changes: 16 additions & 0 deletions codemp/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -2755,6 +2755,22 @@ void Cmd_SaberAttackCycle_f(gentity_t *ent)
{
return;
}

if ( level.intermissionQueued || level.intermissiontime )
{
trap->SendServerCommand( ent-g_entities, va( "print \"%s (saberAttackCycle)\n\"", G_GetStringEdString( "MP_SVGAME", "CANNOT_TASK_INTERMISSION" ) ) );
return;
}

if ( ent->health <= 0
|| ent->client->tempSpectate >= level.time
|| ent->client->sess.sessionTeam == TEAM_SPECTATOR )
{
trap->SendServerCommand( ent-g_entities, va( "print \"%s\n\"", G_GetStringEdString( "MP_SVGAME", "MUSTBEALIVE" ) ) );
return;
}


if ( ent->client->ps.weapon != WP_SABER )
{
return;
Expand Down
2 changes: 2 additions & 0 deletions codemp/qcommon/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "qcommon/cm_public.h"
#include "qcommon/game_version.h"
#include "../server/NPCNav/navigator.h"
#include "../shared/sys/sys_local.h"
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
Expand Down Expand Up @@ -1516,6 +1517,7 @@ void Com_Frame( void ) {
else
NET_Sleep(timeVal - 1);
} while( (timeVal = Com_TimeVal(minMsec)) != 0 );
IN_Frame();

lastTime = com_frameTime;
com_frameTime = Com_EventLoop();
Expand Down
81 changes: 21 additions & 60 deletions codemp/qcommon/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ qboolean FS_Initialized( void ) {
return (qboolean)(fs_searchpaths != NULL);
}

static void FS_AssertInitialised( void ) {
if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
}

/*
=================
FS_PakIsPure
Expand Down Expand Up @@ -780,9 +786,7 @@ fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
char *ospath;
fileHandle_t f;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

ospath = FS_BuildOSPath( fs_homepath->string, filename, "" );
ospath[strlen(ospath)-1] = '\0';
Expand Down Expand Up @@ -823,9 +827,7 @@ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp ) {
char *ospath;
fileHandle_t f = 0;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

f = FS_HandleForFile();
fsh[f].zipFile = qfalse;
Expand Down Expand Up @@ -906,9 +908,7 @@ FS_SV_Rename
void FS_SV_Rename( const char *from, const char *to, qboolean safe ) {
char *from_ospath, *to_ospath;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

// don't let sound stutter
S_ClearSoundBuffer();
Expand Down Expand Up @@ -942,9 +942,7 @@ FS_Rename
void FS_Rename( const char *from, const char *to ) {
char *from_ospath, *to_ospath;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

// don't let sound stutter
S_ClearSoundBuffer();
Expand Down Expand Up @@ -985,9 +983,7 @@ There are three cases handled:
===========
*/
void FS_FCloseFile( fileHandle_t f ) {
if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if (fsh[f].zipFile == qtrue) {
unzCloseCurrentFile( fsh[f].handleFiles.file.z );
Expand Down Expand Up @@ -1015,9 +1011,7 @@ fileHandle_t FS_FOpenFileWrite( const char *filename, qboolean safe ) {
char *ospath;
fileHandle_t f;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

f = FS_HandleForFile();
fsh[f].zipFile = qfalse;
Expand Down Expand Up @@ -1060,9 +1054,7 @@ fileHandle_t FS_FOpenFileAppend( const char *filename ) {
char *ospath;
fileHandle_t f;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

f = FS_HandleForFile();
fsh[f].zipFile = qfalse;
Expand Down Expand Up @@ -1278,9 +1270,7 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique

hash = 0;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( file == NULL ) {
Com_Error( ERR_FATAL, "FS_FOpenFileRead: NULL 'file' parameter passed\n" );
Expand Down Expand Up @@ -1620,9 +1610,7 @@ int FS_Read( void *buffer, int len, fileHandle_t f ) {
byte *buf;
int tries;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( !f ) {
return 0;
Expand Down Expand Up @@ -1674,9 +1662,7 @@ int FS_Write( const void *buffer, int len, fileHandle_t h ) {
int tries;
FILE *f;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( !h ) {
return 0;
Expand Down Expand Up @@ -1734,10 +1720,7 @@ FS_Seek
int FS_Seek( fileHandle_t f, long offset, int origin ) {
int _origin;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
return -1;
}
FS_AssertInitialised();

if (fsh[f].zipFile == qtrue) {
//FIXME: this is really, really crappy
Expand Down Expand Up @@ -1835,9 +1818,7 @@ int FS_FileIsInPAK(const char *filename, int *pChecksum ) {
fileInPack_t *pakFile;
long hash = 0;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( !filename ) {
Com_Error( ERR_FATAL, "FS_FOpenFileRead: NULL 'filename' parameter passed\n" );
Expand Down Expand Up @@ -1903,9 +1884,7 @@ long FS_ReadFile( const char *qpath, void **buffer ) {
qboolean isConfig;
long len;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( !qpath || !qpath[0] ) {
Com_Error( ERR_FATAL, "FS_ReadFile with empty name\n" );
Expand Down Expand Up @@ -1984,9 +1963,6 @@ long FS_ReadFile( const char *qpath, void **buffer ) {
}

fs_loadCount++;
/*
buf = (unsigned char *)Hunk_AllocateTempMemory(len+1);
*buffer = buf;*/

buf = (byte*)Z_Malloc( len+1, TAG_FILESYS, qfalse);
buf[len]='\0'; // because we're not calling Z_Malloc with optional trailing 'bZeroIt' bool
Expand Down Expand Up @@ -2016,20 +1992,7 @@ FS_FreeFile
=============
*/
void FS_FreeFile( void *buffer ) {
/*
if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
if ( !buffer ) {
Com_Error( ERR_FATAL, "FS_FreeFile( NULL )" );
}
Hunk_FreeTempMemory( buffer );
*/

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();
if ( !buffer ) {
Com_Error( ERR_FATAL, "FS_FreeFile( NULL )" );
}
Expand All @@ -2047,9 +2010,7 @@ Filename are reletive to the quake search path
void FS_WriteFile( const char *qpath, const void *buffer, int size ) {
fileHandle_t f;

if ( !fs_searchpaths ) {
Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
}
FS_AssertInitialised();

if ( !qpath || !buffer ) {
Com_Error( ERR_FATAL, "FS_WriteFile: NULL parameter" );
Expand Down
Loading

0 comments on commit 90e8023

Please sign in to comment.