mirror of
https://github.com/UberGames/RPG-X2.git
synced 2024-11-14 08:51:05 +00:00
more fixes as result of code analysis
This commit is contained in:
parent
18b101c4b6
commit
f4b86b4576
4 changed files with 83 additions and 2 deletions
|
@ -1957,6 +1957,7 @@ void CG_LoadIngameText(void)
|
|||
CG_LoadObjectivesForMap
|
||||
=================
|
||||
*/
|
||||
#ifdef QVM
|
||||
void CG_LoadObjectivesForMap(void)
|
||||
{
|
||||
int len, objnum = 0;
|
||||
|
@ -2022,6 +2023,82 @@ void CG_LoadObjectivesForMap(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void CG_LoadObjectivesForMap(void)
|
||||
{
|
||||
int len, objnum = 0;
|
||||
char *token;
|
||||
char *buf;
|
||||
fileHandle_t f;
|
||||
char fileName[MAX_QPATH];
|
||||
char fullFileName[MAX_QPATH];
|
||||
char *objtext;
|
||||
|
||||
objtext = (char *)malloc(sizeof(char)*MAX_OBJ_TEXT_LENGTH));
|
||||
if(!objtext) {
|
||||
CG_Printf("CG_LoadObjectivesForMap: couldn't allocate %u byte\n", sizeof(char)*MAX_OBJ_TEXT_LENGTH);
|
||||
return;
|
||||
}
|
||||
|
||||
COM_StripExtension( cgs.mapname, fileName );
|
||||
CG_LanguageFilename( fileName, "efo", fullFileName);
|
||||
|
||||
len = trap_FS_FOpenFile( fullFileName, &f, FS_READ );
|
||||
|
||||
if ( len > MAX_OBJ_TEXT_LENGTH )
|
||||
{
|
||||
Com_Printf( S_COLOR_RED "CG_LoadObjectivesForMap : %s file bigger than %d!\n", fileName, MAX_OBJ_TEXT_LENGTH );
|
||||
free(objtext);
|
||||
return;
|
||||
}
|
||||
|
||||
trap_FS_Read( objtext, len, f );
|
||||
|
||||
trap_FS_FCloseFile( f );
|
||||
|
||||
buf = objtext;
|
||||
//Now parse out each objective
|
||||
while ( 1 )
|
||||
{
|
||||
token = COM_ParseExt( &buf, qtrue );
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Normal objective text
|
||||
if ( !Q_strncmp( token, "obj", 3 ) )
|
||||
{
|
||||
objnum = atoi( &token[3] );
|
||||
|
||||
if ( objnum < 1 || objnum == MAX_OBJECTIVES ) {
|
||||
Com_Printf( "Invalid objective number (%d), valid range is 1 to %d\n", objnum, MAX_OBJECTIVES );
|
||||
break;
|
||||
}
|
||||
|
||||
//Now read the objective text into the current objective
|
||||
token = COM_ParseExt( &buf, qfalse );
|
||||
Q_strncpyz( cgs.objectives[objnum-1].text, token, sizeof(cgs.objectives[objnum-1].text) );
|
||||
}
|
||||
|
||||
else if ( !Q_strncmp( token, "abridged_obj", 12 ) )
|
||||
{
|
||||
objnum = atoi( &token[12] );
|
||||
|
||||
if ( objnum < 1 || objnum == MAX_OBJECTIVES )
|
||||
{
|
||||
Com_Printf( "Invalid objective number (%d), valid range is 1 to %d\n", objnum, MAX_OBJECTIVES );
|
||||
break;
|
||||
}
|
||||
|
||||
//Now read the objective text into the current objective
|
||||
token = COM_ParseExt( &buf, qfalse );
|
||||
Q_strncpyz( cgs.objectives[objnum-1].abridgedText, token, sizeof(cgs.objectives[objnum-1].abridgedText) );
|
||||
}
|
||||
}
|
||||
free(objtext);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
qboolean CG_LoadClasses( void )
|
||||
{
|
||||
|
|
|
@ -44,6 +44,8 @@ CG_FreeMarkPoly
|
|||
==================
|
||||
*/
|
||||
void CG_FreeMarkPoly( markPoly_t *le ) {
|
||||
if(!le) return;
|
||||
|
||||
if ( !le->prevMark ) {
|
||||
CG_Error( "CG_FreeLocalEntity: not active" );
|
||||
}
|
||||
|
|
|
@ -3147,7 +3147,7 @@ static qboolean CG_RunLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnima
|
|||
|
||||
// get the next frame based on the animation
|
||||
anim = lf->animation;
|
||||
if ( !anim->frameLerp ) {
|
||||
if ( !anim || !anim->frameLerp ) {
|
||||
return qfalse; // shouldn't happen
|
||||
}
|
||||
//RPG-X Check. Anims with lengths < 0 are emote stubs.
|
||||
|
@ -3220,6 +3220,8 @@ CG_ClearLerpFrame
|
|||
//This function has been rpg-x'ed®! (by RedTechie)
|
||||
void CG_ClearLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int animationNumber ) { //RPG-X: RedTechie - Changed type from static void to void
|
||||
|
||||
if(!lf) return;
|
||||
|
||||
lf->frameTime = lf->oldFrameTime = cg.time;
|
||||
lf->animation = 0;
|
||||
CG_SetLerpFrameAnimation( ci, lf, animationNumber );
|
||||
|
@ -4952,7 +4954,7 @@ void CG_AddBeamFX( centity_t *cent ) {
|
|||
return;
|
||||
}
|
||||
|
||||
isDecoy = (cent->currentState.eFlags & EF_ITEMPLACEHOLDER );
|
||||
isDecoy = (qboolean)(cent->currentState.eFlags & EF_ITEMPLACEHOLDER );
|
||||
|
||||
//Get origin to render effect
|
||||
//==============================
|
||||
|
|
BIN
stefgame.suo
BIN
stefgame.suo
Binary file not shown.
Loading…
Reference in a new issue