mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-22 04:31:15 +00:00
Improve some messages in game code
- TestHugeTranslation() prints positions (and asserts only afterwards), from "Work around assertion in alphalabs4, fix #409" - idCompiler::CompileFile() prints proper filename from "Fix usage of invalid pointer in idCompiler::CompileFile()"
This commit is contained in:
parent
a16895aca6
commit
d0062f4a82
4 changed files with 32 additions and 11 deletions
|
@ -965,14 +965,6 @@ idClip::TestHugeTranslation
|
|||
*/
|
||||
ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, const idVec3 &start, const idVec3 &end, const idMat3 &trmAxis ) {
|
||||
if ( mdl != NULL && ( end - start ).LengthSqr() > Square( CM_MAX_TRACE_DIST ) ) {
|
||||
#ifndef CTF
|
||||
// May be important: This occurs in CTF when a player connects and spawns
|
||||
// in the PVS of a player that has a flag that is spawning the idMoveableItem
|
||||
// "nuggets". The error seems benign and the assert was getting in the way
|
||||
// of testing.
|
||||
assert( 0 );
|
||||
#endif
|
||||
|
||||
results.fraction = 0.0f;
|
||||
results.endpos = start;
|
||||
results.endAxis = trmAxis;
|
||||
|
@ -984,6 +976,15 @@ ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, co
|
|||
} else {
|
||||
gameLocal.Printf( "huge translation for clip model %d\n", mdl->GetId() );
|
||||
}
|
||||
gameLocal.Printf( " from (%.2f %.2f %.2f) to (%.2f %.2f %.2f)\n", start.x, start.y, start.z, end.x, end.y, end.z);
|
||||
|
||||
#ifndef CTF
|
||||
// May be important: This occurs in CTF when a player connects and spawns
|
||||
// in the PVS of a player that has a flag that is spawning the idMoveableItem
|
||||
// "nuggets". The error seems benign and the assert was getting in the way
|
||||
// of testing.
|
||||
assert( 0 );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/Timer.h"
|
||||
#include "framework/FileSystem.h"
|
||||
|
||||
#include "script/Script_Thread.h"
|
||||
#include "Game_local.h"
|
||||
|
@ -2620,6 +2621,8 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon
|
|||
|
||||
compile_time.Start();
|
||||
|
||||
idStr origFileName = filename; // DG: filename pointer might become invalid when calling NextToken() below
|
||||
|
||||
scope = &def_namespace;
|
||||
basetype = NULL;
|
||||
callthread = false;
|
||||
|
@ -2687,6 +2690,11 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon
|
|||
|
||||
compile_time.Stop();
|
||||
if ( !toConsole ) {
|
||||
gameLocal.Printf( "Compiled '%s': %u ms\n", filename, compile_time.Milliseconds() );
|
||||
// DG: filename can be overwritten by NextToken() (via gameLocal.program.GetFilenum()), so
|
||||
// use a copy, origFileName, that's still valid here. Furthermore, the path is nonsense,
|
||||
// as idProgram::CompileText() called fileSystem->RelativePathToOSPath() on it
|
||||
// which does not return the *actual* full path of that file but invents one,
|
||||
// so revert that to the relative filename which at least isn't misleading
|
||||
gameLocal.Printf( "Compiled '%s': %u ms\n", fileSystem->OSPathToRelativePath(origFileName), compile_time.Milliseconds() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -965,7 +965,7 @@ idClip::TestHugeTranslation
|
|||
*/
|
||||
ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, const idVec3 &start, const idVec3 &end, const idMat3 &trmAxis ) {
|
||||
if ( mdl != NULL && ( end - start ).LengthSqr() > Square( CM_MAX_TRACE_DIST ) ) {
|
||||
assert( 0 );
|
||||
|
||||
|
||||
results.fraction = 0.0f;
|
||||
results.endpos = start;
|
||||
|
@ -979,6 +979,10 @@ ID_INLINE bool TestHugeTranslation( trace_t &results, const idClipModel *mdl, co
|
|||
} else {
|
||||
gameLocal.Printf( "huge translation for clip model %d\n", mdl->GetId() );
|
||||
}
|
||||
|
||||
gameLocal.Printf( " from (%.2f %.2f %.2f) to (%.2f %.2f %.2f)\n", start.x, start.y, start.z, end.x, end.y, end.z);
|
||||
|
||||
assert( 0 );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,6 +28,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/Timer.h"
|
||||
#include "framework/FileSystem.h"
|
||||
|
||||
#include "script/Script_Thread.h"
|
||||
#include "Game_local.h"
|
||||
|
@ -2620,6 +2621,8 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon
|
|||
|
||||
compile_time.Start();
|
||||
|
||||
idStr origFileName = filename; // DG: filename pointer might become invalid when calling NextToken() below
|
||||
|
||||
scope = &def_namespace;
|
||||
basetype = NULL;
|
||||
callthread = false;
|
||||
|
@ -2687,6 +2690,11 @@ void idCompiler::CompileFile( const char *text, const char *filename, bool toCon
|
|||
|
||||
compile_time.Stop();
|
||||
if ( !toConsole ) {
|
||||
gameLocal.Printf( "Compiled '%s': %u ms\n", filename, compile_time.Milliseconds() );
|
||||
// DG: filename can be overwritten by NextToken() (via gameLocal.program.GetFilenum()), so
|
||||
// use a copy, origFileName, that's still valid here. Furthermore, the path is nonsense,
|
||||
// as idProgram::CompileText() called fileSystem->RelativePathToOSPath() on it
|
||||
// which does not return the *actual* full path of that file but invents one,
|
||||
// so revert that to the relative filename which at least isn't misleading
|
||||
gameLocal.Printf( "Compiled '%s': %u ms\n", fileSystem->OSPathToRelativePath(origFileName), compile_time.Milliseconds() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue