diff --git a/cgame/cg_main.c b/cgame/cg_main.c index 5d8ebc4..a85c987 100644 --- a/cgame/cg_main.c +++ b/cgame/cg_main.c @@ -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 ) { diff --git a/cgame/cg_marks.c b/cgame/cg_marks.c index 6e9ad29..0fd06ed 100644 --- a/cgame/cg_marks.c +++ b/cgame/cg_marks.c @@ -44,6 +44,8 @@ CG_FreeMarkPoly ================== */ void CG_FreeMarkPoly( markPoly_t *le ) { + if(!le) return; + if ( !le->prevMark ) { CG_Error( "CG_FreeLocalEntity: not active" ); } diff --git a/cgame/cg_players.c b/cgame/cg_players.c index 911d32e..f51e0d9 100644 --- a/cgame/cg_players.c +++ b/cgame/cg_players.c @@ -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 //============================== diff --git a/stefgame.suo b/stefgame.suo index 1dbaaee..b1c8b0c 100644 Binary files a/stefgame.suo and b/stefgame.suo differ