Added back collision manager and AAS builder to dmap

This commit is contained in:
Robert Beckebans 2024-06-19 21:33:41 +02:00
parent 869e6994b4
commit b01e7b003a
12 changed files with 482 additions and 86 deletions

View file

@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
#pragma hdrstop
#include "CollisionModel_local.h"
#include "renderer/Model_gltf.h"
#include "../renderer/Model_gltf.h"
#define CM_FILE_EXT "cm"
#define CM_BINARYFILE_EXT "bcm"

View file

@ -50,7 +50,7 @@ If you have questions concerning this license or the applicable additional terms
#pragma hdrstop
#include "CollisionModel_local.h"
#include "renderer/Model_gltf.h"
#include "../renderer/Model_gltf.h"
#define CMODEL_BINARYFILE_EXT "bcmodel"

View file

@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
#include "../Game_local.h"
#include "renderer/Model_gltf.h"
#include "../../renderer/Model_gltf.h"
idCVar binaryLoadAnim( "binaryLoadAnim", "1", 0, "enable binary load/write of idMD5Anim" );
@ -228,7 +228,9 @@ bool idMD5Anim::LoadAnim( const char* filename, const idImportOptions* options )
if( fileptr == nullptr )
{
#if !defined( DMAP )
fileptr = idRenderModelGLTF::GetAnimBin( filenameStr, sourceTimeStamp, options );
#endif
doWrite = fileptr != nullptr;
}
}
@ -1130,6 +1132,7 @@ void idMD5Anim::GetSingleFrame( int framenum, idJointQuat* joints, const int* in
idMD5Anim::CheckModelHierarchy
====================
*/
#if !defined( DMAP )
void idMD5Anim::CheckModelHierarchy( const idRenderModel* model ) const
{
// RB
@ -1172,6 +1175,7 @@ void idMD5Anim::CheckModelHierarchy( const idRenderModel* model ) const
}
}
}
#endif
/***********************************************************************
@ -1240,7 +1244,11 @@ idMD5Anim* idAnimManager::GetAnim( const char* name, const idImportOptions* opti
anim = new( TAG_ANIM ) idMD5Anim();
if( !anim->LoadAnim( filename, options ) )
{
#if defined( DMAP )
common->Warning( "Couldn't load anim: '%s'", filename.c_str() );
#else
gameLocal.Warning( "Couldn't load anim: '%s'", filename.c_str() );
#endif
delete anim;
anim = NULL;
}
@ -1330,6 +1338,7 @@ const char* idAnimManager::JointName( int index ) const
return jointnames[ index ];
}
#if !defined( DMAP )
/*
================
idAnimManager::ListAnims
@ -1369,6 +1378,7 @@ void idAnimManager::ListAnims() const
gameLocal.Printf( "\n%d memory used in %d anims\n", size, num );
gameLocal.Printf( "%d memory used in %d joint names\n", namesize, jointnames.Num() );
}
#endif
/*
================

View file

@ -29,8 +29,13 @@ If you have questions concerning this license or the applicable additional terms
#include "precompiled.h"
#pragma hdrstop
#if defined( DMAP )
#include "Anim.h"
#include "../Game_local.h"
idAnimManager animationLib;
#else
#include "../Game_local.h"
#endif
static const char* channelNames[ ANIM_NumAnimChannels ] =
{
@ -342,11 +347,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_SCRIPTFUNCTION;
#if !defined( DMAP )
fc.function = gameLocal.program.FindFunction( token );
if( !fc.function )
{
return va( "Function '%s' not found", token.c_str() );
}
#endif
}
else if( token == "object_call" )
{
@ -364,6 +371,7 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_EVENTFUNCTION;
#if !defined( DMAP )
const idEventDef* ev = idEventDef::FindEvent( token );
if( !ev )
{
@ -373,6 +381,7 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
{
return va( "Event '%s' has arguments", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "sound" )
@ -388,11 +397,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_voice" )
@ -408,11 +419,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_voice2" )
@ -428,11 +441,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_body" )
@ -448,11 +463,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_body2" )
@ -468,11 +485,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_body3" )
@ -488,11 +507,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_weapon" )
@ -508,11 +529,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_global" )
@ -528,11 +551,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_item" )
@ -548,11 +573,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "sound_chatter" )
@ -568,11 +595,13 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
}
else
{
#if !defined( DMAP )
fc.soundShader = declManager->FindSound( token );
if( fc.soundShader->GetState() == DS_DEFAULTED )
{
gameLocal.Warning( "Sound '%s' not found", token.c_str() );
}
#endif
}
}
else if( token == "skin" )
@ -602,10 +631,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_FX;
#if !defined( DMAP )
if( !declManager->FindType( DECL_FX, token.c_str() ) )
{
return va( "fx '%s' not found", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "trigger" )
@ -624,10 +655,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_TRIGGER_SMOKE_PARTICLE;
#if !defined( DMAP )
if( !declManager->FindType( DECL_PARTICLE, token.c_str() ) )
{
return va( "Particle '%s' not found", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "melee" )
@ -637,10 +670,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_MELEE;
#if !defined( DMAP )
if( !gameLocal.FindEntityDef( token.c_str(), false ) )
{
return va( "Unknown entityDef '%s'", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "direct_damage" )
@ -650,10 +685,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_DIRECTDAMAGE;
#if !defined( DMAP )
if( !gameLocal.FindEntityDef( token.c_str(), false ) )
{
return va( "Unknown entityDef '%s'", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "attack_begin" )
@ -663,10 +700,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return "Unexpected end of line";
}
fc.type = FC_BEGINATTACK;
#if !defined( DMAP )
if( !gameLocal.FindEntityDef( token.c_str(), false ) )
{
return va( "Unknown entityDef '%s'", token.c_str() );
}
#endif
fc.string = new( TAG_ANIM ) idStr( token );
}
else if( token == "attack_end" )
@ -760,10 +799,12 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
{
return "Unexpected end of line";
}
#if !defined( DMAP )
if( !declManager->FindType( DECL_FX, token, false ) )
{
return "Unknown FX def";
}
#endif
fc.type = FC_TRIGGER_FX;
fc.string = new( TAG_ANIM ) idStr( token );
@ -941,6 +982,7 @@ const char* idAnim::AddFrameCommand( const idDeclModelDef* modelDef, int framenu
return NULL;
}
#if !defined( DMAP )
/*
=====================
idAnim::CallFrameCommands
@ -1347,6 +1389,7 @@ void idAnim::CallFrameCommands( idEntity* ent, int from, int to ) const
}
}
}
#endif // #if !defined( DMAP )
/*
=====================
@ -1430,6 +1473,8 @@ const animFlags_t& idAnim::GetAnimFlags() const
***********************************************************************/
#if !defined( DMAP )
/*
=====================
idAnimBlend::idAnimBlend
@ -2687,6 +2732,8 @@ bool idAnimBlend::AddBounds( int currentTime, idBounds& bounds, bool removeOrigi
return true;
}
#endif
/***********************************************************************
idDeclModelDef
@ -2833,6 +2880,7 @@ idDeclModelDef::GetJointList
*/
void idDeclModelDef::GetJointList( const char* jointnames, idList<jointHandle_t>& jointList ) const
{
#if !defined( DMAP )
const char* pos;
idStr jointname;
const jointInfo_t* joint;
@ -2938,6 +2986,7 @@ void idDeclModelDef::GetJointList( const char* jointnames, idList<jointHandle_t>
}
}
}
#endif
}
/*
@ -2980,6 +3029,7 @@ idDeclModelDef::SetupJoints
*/
void idDeclModelDef::SetupJoints( int* numJoints, idJointMat** jointList, idBounds& frameBounds, bool removeOriginOffset ) const
{
#if !defined( DMAP )
int num;
const idJointQuat* pose;
idJointMat* list;
@ -3031,6 +3081,7 @@ void idDeclModelDef::SetupJoints( int* numJoints, idJointMat** jointList, idBoun
// get the bounds of the default pose
frameBounds = modelHandle->Bounds( NULL );
#endif
}
/*
@ -3174,7 +3225,9 @@ bool idDeclModelDef::ParseAnim( idLexer& src, int numDefaultAnims, const idStr&
return false;
}
#if !defined( DMAP )
md5anim->CheckModelHierarchy( modelHandle );
#endif
if( numAnims > 0 )
{
@ -3728,6 +3781,7 @@ const idAnim* idDeclModelDef::GetAnim( int index ) const
idDeclModelDef::GetAnim
=====================
*/
#if !defined( DMAP )
int idDeclModelDef::GetAnim( const char* name ) const
{
int i;
@ -3768,6 +3822,7 @@ int idDeclModelDef::GetAnim( const char* name ) const
which = gameLocal.random.RandomInt( numAnims );
return animList[ which ] + 1;
}
#endif
/*
=====================
@ -3826,6 +3881,8 @@ int idDeclModelDef::NumJoints() const
return joints.Num();
}
#if !defined( DMAP )
/*
=====================
idDeclModelDef::GetJoint
@ -3903,12 +3960,16 @@ const idVec3& idDeclModelDef::GetVisualOffset() const
return offset;
}
#endif // #if !defined( DMAP )
/***********************************************************************
idAnimator
***********************************************************************/
#if !defined( DMAP )
/*
=====================
idAnimator::idAnimator
@ -5866,12 +5927,16 @@ const idVec3& idAnimator::TotalMovementDelta( int animNum ) const
}
}
#endif // #if !defined( DMAP )
/***********************************************************************
Util functions
***********************************************************************/
#if !defined( DMAP )
/*
=====================
ANIM_GetModelDefFromEntityDef
@ -6275,3 +6340,5 @@ idRenderModel* idGameEdit::ANIM_CreateMeshForAnim( idRenderModel* model, const c
return newmodel;
}
#endif // #if !defined( DMAP )

View file

@ -141,10 +141,12 @@ bool idDeclEntityDef::Parse( const char* text, const int textLength, bool allowB
// precache all referenced media
// do this as long as we arent in modview
#if !defined( DMAP )
if( !( com_editors & ( EDITOR_AAS | EDITOR_EXPORTDEFS ) ) )
{
game->CacheDictionaryMedia( &dict );
}
#endif
return true;
}

View file

@ -192,6 +192,7 @@ class idDeclManagerLocal : public idDeclManager
public:
virtual void Init();
virtual void Init2();
virtual void InitTool();
virtual void Shutdown();
virtual void Reload( bool force );
virtual void BeginLevelLoad();
@ -223,10 +224,10 @@ public:
virtual const idMaterial* FindMaterial( const char* name, bool makeDefault = true );
virtual const idMaterial* MaterialByIndex( int index, bool forceParse = true );
#if !defined( DMAP )
virtual const idDeclSkin* FindSkin( const char* name, bool makeDefault = true );
virtual const idDeclSkin* SkinByIndex( int index, bool forceParse = true );
#if !defined( DMAP )
virtual const idSoundShader* FindSound( const char* name, bool makeDefault = true );
virtual const idSoundShader* SoundByIndex( int index, bool forceParse = true );
#endif
@ -916,12 +917,11 @@ void idDeclManagerLocal::Init()
// decls used throughout the engine
RegisterDeclType( "table", DECL_TABLE, idDeclAllocator<idDeclTable> );
RegisterDeclType( "material", DECL_MATERIAL, idDeclAllocator<idMaterial> );
RegisterDeclType( "skin", DECL_SKIN, idDeclAllocator<idDeclSkin> );
RegisterDeclType( "entityDef", DECL_ENTITYDEF, idDeclAllocator<idDeclEntityDef> );
#if !defined( DMAP )
RegisterDeclType( "skin", DECL_SKIN, idDeclAllocator<idDeclSkin> );
RegisterDeclType( "sound", DECL_SOUND, idDeclAllocator<idSoundShader> );
RegisterDeclType( "entityDef", DECL_ENTITYDEF, idDeclAllocator<idDeclEntityDef> );
RegisterDeclType( "mapDef", DECL_MAPDEF, idDeclAllocator<idDeclEntityDef> );
RegisterDeclType( "fx", DECL_FX, idDeclAllocator<idDeclFX> );
RegisterDeclType( "particle", DECL_PARTICLE, idDeclAllocator<idDeclParticle> );
@ -995,6 +995,46 @@ void idDeclManagerLocal::Init2()
RegisterDeclFolder( "sound", ".sndshd", DECL_SOUND );
}
/*
===================
idDeclManagerLocal::InitTool
RB: only called by rbdmap
===================
*/
#include "../d3xp/anim/Anim.h"
void idDeclManagerLocal::InitTool()
{
common->Printf( "----- Initializing Decls -----\n" );
checksum = 0;
#ifdef USE_COMPRESSED_DECLS
SetupHuffman();
#endif
#ifdef GET_HUFFMAN_FREQUENCIES
ClearHuffmanFrequencies();
#endif
// decls used throughout the engine
RegisterDeclType( "table", DECL_TABLE, idDeclAllocator<idDeclTable> );
RegisterDeclType( "material", DECL_MATERIAL, idDeclAllocator<idMaterial> );
RegisterDeclType( "model", DECL_MODELDEF, idDeclAllocator<idDeclModelDef> );
RegisterDeclType( "export", DECL_MODELEXPORT, idDeclAllocator<idDecl> );
RegisterDeclType( "skin", DECL_SKIN, idDeclAllocator<idDeclSkin> );
RegisterDeclType( "entityDef", DECL_ENTITYDEF, idDeclAllocator<idDeclEntityDef> );
RegisterDeclType( "mapDef", DECL_MAPDEF, idDeclAllocator<idDeclEntityDef> );
RegisterDeclFolder( "materials", ".mtr", DECL_MATERIAL );
RegisterDeclFolder( "skins", ".skin", DECL_SKIN );
RegisterDeclFolder( "def", ".def", DECL_ENTITYDEF );
common->Printf( "------------------------------\n" );
}
/*
===================
idDeclManagerLocal::Shutdown
@ -1791,8 +1831,6 @@ const idMaterial* idDeclManagerLocal::MaterialByIndex( int index, bool forcePars
return static_cast<const idMaterial*>( DeclByIndex( DECL_MATERIAL, index, forceParse ) );
}
#if !defined( DMAP )
/********************************************************************/
const idDeclSkin* idDeclManagerLocal::FindSkin( const char* name, bool makeDefault )
@ -1805,6 +1843,8 @@ const idDeclSkin* idDeclManagerLocal::SkinByIndex( int index, bool forceParse )
return static_cast<const idDeclSkin*>( DeclByIndex( DECL_SKIN, index, forceParse ) );
}
#if !defined( DMAP )
/********************************************************************/
const idSoundShader* idDeclManagerLocal::FindSound( const char* name, bool makeDefault )

View file

@ -334,6 +334,7 @@ public:
virtual void Init() = 0;
virtual void Init2() = 0;
virtual void InitTool() = 0;
virtual void Shutdown() = 0;
virtual void Reload( bool force ) = 0;

View file

@ -20,6 +20,15 @@ else()
list(APPEND MC_SOURCES main_posix.cpp)
endif()
file(GLOB MC_AAS_INCLUDES ../../aas/*.h)
file(GLOB MC_AAS_SOURCES ../../aas/*.cpp)
file(GLOB MC_AASBUILD_INCLUDES aas/*.h)
file(GLOB MC_AASBUILD_SOURCES aas/*.cpp)
file(GLOB MC_CM_INCLUDES ../../cm/*.h)
file(GLOB MC_CM_SOURCES ../../cm/*.cpp)
set(MC_FRAMEWORK_INCLUDES
../../framework/CmdSystem.h
../../framework/CVarSystem.h
@ -29,6 +38,8 @@ set(MC_FRAMEWORK_INCLUDES
../../framework/FileSystem.h
../../framework/Licensee.h
../../framework/DeclManager.h
../../framework/DeclEntityDef.h
../../framework/DeclSkin.h
../../framework/DeclTable.h
../../idlib/precompiled.h
)
@ -40,6 +51,8 @@ set(MC_FRAMEWORK_SOURCES
../../framework/File_Resource.cpp
../../framework/FileSystem.cpp
../../framework/DeclManager.cpp
../../framework/DeclEntityDef.cpp
../../framework/DeclSkin.cpp
../../framework/DeclTable.cpp
)
@ -82,16 +95,28 @@ set(MC_RENDERER_SOURCES
../../renderer/Model_ma.cpp
../../renderer/Model_obj.cpp
)
set(MC_GAME_INCLUDES
../../d3xp/anim/Anim.h
)
set(MC_GAME_SOURCES
../../d3xp/anim/Anim.cpp
../../d3xp/anim/Anim_Blend.cpp
)
file(GLOB MIKKTSPACE_INCLUDES ../../libs/mikktspace/*.h)
file(GLOB MIKKTSPACE_SOURCES ../../libs/mikktspace/*.c)
file(GLOB MC_MIKKTSPACE_INCLUDES ../../libs/mikktspace/*.h)
file(GLOB MC_MIKKTSPACE_SOURCES ../../libs/mikktspace/*.c)
set(MC_INCLUDES_ALL
${MC_INCLUDES}
${MC_FRAMEWORK_INCLUDES}
${MC_RENDERER_INCLUDES}
${MC_DMAP_INCLUDES}
${MIKKTSPACE_INCLUDES}
${MC_AAS_INCLUDES}
${MC_AASBUILD_INCLUDES}
${MC_CM_INCLUDES}
${MC_MIKKTSPACE_INCLUDES}
${MC_GAME_INCLUDES}
)
set(MC_SOURCES_ALL
@ -99,22 +124,35 @@ set(MC_SOURCES_ALL
${MC_FRAMEWORK_SOURCES}
${MC_RENDERER_SOURCES}
${MC_DMAP_SOURCES}
${MIKKTSPACE_SOURCES}
${MC_AAS_SOURCES}
${MC_AASBUILD_SOURCES}
${MC_CM_SOURCES}
${MC_MIKKTSPACE_SOURCES}
${MC_GAME_SOURCES}
)
source_group("main" FILES ${MC_INCLUDES})
source_group("main" FILES ${MC_SOURCES})
source_group("dmap" FILES ${DMAP_INCLUDES})
source_group("dmap" FILES ${DMAP_SOURCES})
source_group("dmap" FILES ${MC_DMAP_INCLUDES})
source_group("dmap" FILES ${MC_DMAP_SOURCES})
source_group("framework" FILES ${MC_FRAMEWORK_INCLUDES})
source_group("framework" FILES ${MC_FRAMEWORK_SOURCES})
source_group("renderer" FILES ${MC_RENDERER_INCLUDES})
source_group("renderer" FILES ${MC_RENDERER_SOURCES})
source_group("libs\\mikktspace" FILES ${MIKKTSPACE_INCLUDES})
source_group("libs\\mikktspace" FILES ${MIKKTSPACE_SOURCES})
source_group("aas" FILES ${MC_AAS_INCLUDES})
source_group("aas" FILES ${MC_AAS_SOURCES})
source_group("aasbuild" FILES ${MC_AASBUILD_INCLUDES})
source_group("aasbuild" FILES ${MC_AASBUILD_SOURCES})
source_group("cm" FILES ${MC_CM_INCLUDES})
source_group("cm" FILES ${MC_CM_SOURCES})
source_group("libs\\mikktspace" FILES ${MC_MIKKTSPACE_INCLUDES})
source_group("libs\\mikktspace" FILES ${MC_MIKKTSPACE_SOURCES})
source_group("anim" FILES ${MC_GAME_INCLUDES})
source_group("anim" FILES ${MC_GAME_SOURCES})
set(MC_PRECOMPILED_SOURCES ${MC_SOURCES_ALL})
list(REMOVE_ITEM MC_PRECOMPILED_SOURCES ${MIKKTSPACE_SOURCES})
list(REMOVE_ITEM MC_PRECOMPILED_SOURCES ${MC_MIKKTSPACE_SOURCES})
include_directories(
.
@ -149,7 +187,7 @@ if(MSVC)
# set MSVC default debug directory on executable
if(CMAKE_MAJOR_VERSION EQUAL 3 AND CMAKE_MINOR_VERSION GREATER_EQUAL 8)
set_target_properties(rbdmap PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/../../..")
set_target_properties(rbdmap PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/..")
endif()
else()

View file

@ -1069,6 +1069,18 @@ int ParseOptions( const idCmdArgs& args, idAASSettings& settings )
return args.Argc() - 1;
}
// RB begin
static const idDict* FindEntityDefDict( const char* name, bool makeDefault )
{
#if defined( DMAP )
const idDeclEntityDef* decl = static_cast<const idDeclEntityDef*>( declManager->FindType( DECL_ENTITYDEF, name, makeDefault ) );
return decl ? &decl->dict : NULL;
#else
return gameEdit->FindEntityDefDict( name, makeDefault );
#endif
}
// RB end
/*
============
RunAAS_f
@ -1096,7 +1108,7 @@ void RunAAS_f( const idCmdArgs& args )
common->SetRefreshOnPrint( true );
// get the aas settings definitions
const idDict* dict = gameEdit->FindEntityDefDict( "aas_types", false );
const idDict* dict = FindEntityDefDict( "aas_types", false );
if( !dict )
{
common->Error( "Unable to find entityDef for 'aas_types'" );
@ -1105,7 +1117,7 @@ void RunAAS_f( const idCmdArgs& args )
const idKeyValue* kv = dict->MatchPrefix( "type" );
while( kv != NULL )
{
const idDict* settingsDict = gameEdit->FindEntityDefDict( kv->GetValue(), false );
const idDict* settingsDict = FindEntityDefDict( kv->GetValue(), false );
if( !settingsDict )
{
common->Warning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );
@ -1156,7 +1168,7 @@ void RunAASDir_f( const idCmdArgs& args )
common->SetRefreshOnPrint( true );
// get the aas settings definitions
const idDict* dict = gameEdit->FindEntityDefDict( "aas_types", false );
const idDict* dict = FindEntityDefDict( "aas_types", false );
if( !dict )
{
common->Error( "Unable to find entityDef for 'aas_types'" );
@ -1176,7 +1188,7 @@ void RunAASDir_f( const idCmdArgs& args )
const idKeyValue* kv = dict->MatchPrefix( "type" );
while( kv != NULL )
{
const idDict* settingsDict = gameEdit->FindEntityDefDict( kv->GetValue(), false );
const idDict* settingsDict = FindEntityDefDict( kv->GetValue(), false );
if( !settingsDict )
{
common->Warning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );
@ -1223,7 +1235,7 @@ void RunReach_f( const idCmdArgs& args )
common->SetRefreshOnPrint( true );
// get the aas settings definitions
const idDict* dict = gameEdit->FindEntityDefDict( "aas_types", false );
const idDict* dict = FindEntityDefDict( "aas_types", false );
if( !dict )
{
common->Error( "Unable to find entityDef for 'aas_types'" );
@ -1232,7 +1244,7 @@ void RunReach_f( const idCmdArgs& args )
const idKeyValue* kv = dict->MatchPrefix( "type" );
while( kv != NULL )
{
const idDict* settingsDict = gameEdit->FindEntityDefDict( kv->GetValue(), false );
const idDict* settingsDict = FindEntityDefDict( kv->GetValue(), false );
if( !settingsDict )
{
common->Warning( "Unable to find '%s' in def/aas.def", kv->GetValue().c_str() );

View file

@ -445,13 +445,14 @@ void Dmap( const idCmdArgs& args )
common->Printf( "-----------------------\n" );
common->Printf( "%5.0f seconds for dmap\n", ( end - start ) * 0.001f );
#if 0 // DMAP TODO
if( !leaked )
{
if( !noCM )
{
#if !defined( DMAP )
// make sure the collision model manager is not used by the game
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" );
#endif
// create the collision map
start = Sys_Milliseconds();
@ -471,7 +472,6 @@ void Dmap( const idCmdArgs& args )
RunAAS_f( args );
}
}
#endif
// free the common .map representation
delete dmapGlobals.dmapFile;

View file

@ -25,8 +25,9 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include "precompiled.h"
#pragma hdrstop
#include "../sys/sys_local.h"
#include "../framework/EventLoop.h"
#include "../framework/DeclManager.h"
@ -35,7 +36,6 @@ If you have questions concerning this license or the applicable additional terms
#include <io.h>
idEventLoop* eventLoop;
idSys* sys = NULL;
@ -84,6 +84,21 @@ void Sys_DebugPrintf( const char* fmt, ... )
OutputDebugString( msg );
}
/*
==============
Sys_DebugVPrintf
==============
*/
void Sys_DebugVPrintf( const char* fmt, va_list arg )
{
char msg[MAXPRINTMSG];
idStr::vsnPrintf( msg, MAXPRINTMSG - 1, fmt, arg );
msg[ sizeof( msg ) - 1 ] = '\0';
printf( msg );
OutputDebugString( msg );
}
/*
==============
@ -247,6 +262,38 @@ ID_TIME_T Sys_FileTimeStamp( idFileHandle fp )
return itime.QuadPart;
}
/*
================
Sys_GetClockTicks
================
*/
double Sys_GetClockTicks()
{
LARGE_INTEGER li;
QueryPerformanceCounter( &li );
return ( double ) li.LowPart + ( double ) 0xFFFFFFFF * li.HighPart;
}
/*
================
Sys_ClockTicksPerSecond
================
*/
double Sys_ClockTicksPerSecond()
{
static double ticks = 0;
if( !ticks )
{
LARGE_INTEGER li;
QueryPerformanceFrequency( &li );
ticks = li.QuadPart;
}
return ticks;
}
/*
==============
Sys_Cwd
@ -288,6 +335,95 @@ int Sys_Milliseconds()
return timeGetTime() - sys_timeBase;
}
class idSysCmdline : public idSys
{
public:
virtual void DebugPrintf( VERIFY_FORMAT_STRING const char* fmt, ... )
{
va_list argptr;
va_start( argptr, fmt );
Sys_DebugVPrintf( fmt, argptr );
va_end( argptr );
}
virtual void DebugVPrintf( const char* fmt, va_list arg )
{
Sys_DebugVPrintf( fmt, arg );
}
virtual double GetClockTicks()
{
return Sys_GetClockTicks();
}
virtual double ClockTicksPerSecond()
{
return Sys_ClockTicksPerSecond();
}
virtual cpuid_t GetProcessorId()
{
return CPUID_NONE;
}
virtual const char* GetProcessorString()
{
return NULL;
}
virtual const char* FPU_GetState()
{
return NULL;
}
virtual bool FPU_StackIsEmpty()
{
return NULL;
}
virtual void FPU_SetFTZ( bool enable ) {}
virtual void FPU_SetDAZ( bool enable ) {}
virtual void FPU_EnableExceptions( int exceptions ) {}
virtual bool LockMemory( void* ptr, int bytes )
{
return false;
}
virtual bool UnlockMemory( void* ptr, int bytes )
{
return false;
}
virtual int DLL_Load( const char* dllName )
{
return 0;
}
virtual void* DLL_GetProcAddress( int dllHandle, const char* procName )
{
return NULL;
}
virtual void DLL_Unload( int dllHandle ) {}
virtual void DLL_GetFileName( const char* baseName, char* dllName, int maxLength ) {}
virtual sysEvent_t GenerateMouseButtonEvent( int button, bool down )
{
sysEvent_t ev;
ev.evType = SE_NONE;
return ev;
}
virtual sysEvent_t GenerateMouseMoveEvent( int deltax, int deltay )
{
sysEvent_t ev;
ev.evType = SE_NONE;
return ev;
}
virtual void OpenURL( const char* url, bool quit ) {}
virtual void StartProcess( const char* exeName, bool quit ) {}
};
idSysCmdline idSysLocal;
idSys* sys = &idSysLocal;
/*
==============================================================
@ -306,16 +442,16 @@ public:
virtual void Init( int argc, const char* const* argv, const char* cmdline ) { };
// Shuts down everything.
virtual void Shutdown() { };
virtual void Shutdown() {}
virtual bool IsShuttingDown() const
{
return false;
};
virtual void CreateMainMenu() { };
virtual void CreateMainMenu() {}
// Shuts down everything.
virtual void Quit() { };
virtual void Quit() {}
// Returns true if common initialization is complete.
virtual bool IsInitialized() const
@ -324,28 +460,28 @@ public:
};
// Called repeatedly as the foreground thread for rendering and game logic.
virtual void Frame() { };
virtual void Frame() {}
// Redraws the screen, handling games, guis, console, etc
// in a modal manner outside the normal frame loop
virtual void UpdateScreen() { };
virtual void UpdateScreen() {}
virtual void UpdateLevelLoadPacifier() { };
virtual void UpdateLevelLoadPacifier() {}
// Checks for and removes command line "+set var arg" constructs.
// If match is NULL, all set commands will be executed, otherwise
// only a set with the exact name.
virtual void StartupVariable( const char* match ) { };
virtual void StartupVariable( const char* match ) {}
// Begins redirection of console output to the given buffer.
virtual void BeginRedirect( char* buffer, int buffersize, void ( *flush )( const char* ) ) { };
// Stops redirection of console output.
virtual void EndRedirect() { };
virtual void EndRedirect() {}
// Update the screen with every message printed.
virtual void SetRefreshOnPrint( bool set ) { };
virtual void SetRefreshOnPrint( bool set ) {}
virtual void Printf( const char* fmt, ... )
{
@ -369,10 +505,10 @@ public:
}
// Prints all queued warnings.
virtual void PrintWarnings() { };
virtual void PrintWarnings() {}
// Removes all queued warnings.
virtual void ClearWarnings( const char* reason ) { };
virtual void ClearWarnings( const char* reason ) {}
virtual void Error( const char* fmt, ... )
{
@ -481,14 +617,14 @@ public:
return useless;
};
virtual void OnSaveCompleted( idSaveLoadParms& parms ) { };
virtual void OnLoadCompleted( idSaveLoadParms& parms ) { };
virtual void OnLoadFilesCompleted( idSaveLoadParms& parms ) { };
virtual void OnEnumerationCompleted( idSaveLoadParms& parms ) { };
virtual void OnDeleteCompleted( idSaveLoadParms& parms ) { };
virtual void TriggerScreenWipe( const char* _wipeMaterial, bool hold ) { };
virtual void OnSaveCompleted( idSaveLoadParms& parms ) {}
virtual void OnLoadCompleted( idSaveLoadParms& parms ) {}
virtual void OnLoadFilesCompleted( idSaveLoadParms& parms ) {}
virtual void OnEnumerationCompleted( idSaveLoadParms& parms ) {}
virtual void OnDeleteCompleted( idSaveLoadParms& parms ) {}
virtual void TriggerScreenWipe( const char* _wipeMaterial, bool hold ) {}
virtual void OnStartHosting( idMatchParameters& parms ) { };
virtual void OnStartHosting( idMatchParameters& parms ) {}
virtual int GetGameFrame()
{
@ -514,7 +650,7 @@ public:
return useless;
};
virtual void ResetPlayerInput( int playerIndex ) { };
virtual void ResetPlayerInput( int playerIndex ) {}
virtual bool JapaneseCensorship() const
{
@ -523,26 +659,27 @@ public:
virtual void QueueShowShell() { }; // Will activate the shell on the next frame.
virtual void UpdateScreen( bool, bool ) { }
void InitTool( const toolFlag_t, const idDict*, idEntity* ) { }
void InitTool( const toolFlag_t, const idDict*, idEntity* ) {}
//virtual currentGame_t GetCurrentGame() const {
// return DOOM_CLASSIC;
//};
//virtual void SwitchToGame(currentGame_t newGame) { };
//virtual void SwitchToGame(currentGame_t newGame) {}
void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) { };
void LoadPacifierBinarizeInfo( const char* info ) { };
void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) { };
void LoadPacifierBinarizeProgress( float progress ) { };
void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) {}
void LoadPacifierBinarizeInfo( const char* info ) {}
void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) {}
void LoadPacifierBinarizeProgress( float progress ) {}
void LoadPacifierBinarizeEnd() { };
// for images in particular we can measure more accurately this way (to deal with mipmaps)
void LoadPacifierBinarizeProgressTotal( int total ) { };
void LoadPacifierBinarizeProgressIncrement( int step ) { };
void LoadPacifierBinarizeProgressTotal( int total ) {}
void LoadPacifierBinarizeProgressIncrement( int step ) {}
};
idCommonLocal commonLocal;
idCommon* common = &commonLocal;
int com_editors = 0;
/*
==============================================================
@ -564,7 +701,7 @@ int main( int argc, char** argv )
cvarSystem->Init();
idCVar::RegisterStaticVars();
fileSystem->Init();
declManager->Init();
declManager->InitTool();
idCmdArgs args;
for( int i = 0; i < argc; i++ )

View file

@ -327,6 +327,94 @@ int Sys_Milliseconds()
return curtime;
// DG end
}
class idSysCmdline : public idSys
{
public:
virtual void DebugPrintf( VERIFY_FORMAT_STRING const char* fmt, ... )
{
va_list argptr;
va_start( argptr, fmt );
Sys_DebugVPrintf( fmt, argptr );
va_end( argptr );
}
virtual void DebugVPrintf( const char* fmt, va_list arg )
{
Sys_DebugVPrintf( fmt, arg );
}
virtual double GetClockTicks()
{
return Sys_GetClockTicks();
}
virtual double ClockTicksPerSecond()
{
return Sys_ClockTicksPerSecond();
}
virtual cpuid_t GetProcessorId()
{
return CPUID_NONE;
}
virtual const char* GetProcessorString()
{
return NULL;
}
virtual const char* FPU_GetState()
{
return NULL;
}
virtual bool FPU_StackIsEmpty()
{
return NULL;
}
virtual void FPU_SetFTZ( bool enable ) {}
virtual void FPU_SetDAZ( bool enable ) {}
virtual void FPU_EnableExceptions( int exceptions ) {}
virtual bool LockMemory( void* ptr, int bytes )
{
return false;
}
virtual bool UnlockMemory( void* ptr, int bytes )
{
return false;
}
virtual int DLL_Load( const char* dllName )
{
return 0;
}
virtual void* DLL_GetProcAddress( int dllHandle, const char* procName )
{
return NULL;
}
virtual void DLL_Unload( int dllHandle ) {}
virtual void DLL_GetFileName( const char* baseName, char* dllName, int maxLength ) {}
virtual sysEvent_t GenerateMouseButtonEvent( int button, bool down )
{
sysEvent_t ev;
ev.evType = SE_NONE;
return ev;
}
virtual sysEvent_t GenerateMouseMoveEvent( int deltax, int deltay )
{
sysEvent_t ev;
ev.evType = SE_NONE;
return ev;
}
virtual void OpenURL( const char* url, bool quit ) {}
virtual void StartProcess( const char* exeName, bool quit ) {}
};
idSysCmdline idSysLocal;
idSys* sys = &idSysLocal;
/*
==============================================================
@ -346,16 +434,16 @@ public:
virtual void Init( int argc, const char* const* argv, const char* cmdline ) { };
// Shuts down everything.
virtual void Shutdown() { };
virtual void Shutdown() {}
virtual bool IsShuttingDown() const
{
return false;
};
virtual void CreateMainMenu() { };
virtual void CreateMainMenu() {}
// Shuts down everything.
virtual void Quit() { };
virtual void Quit() {}
// Returns true if common initialization is complete.
virtual bool IsInitialized() const
@ -364,28 +452,28 @@ public:
};
// Called repeatedly as the foreground thread for rendering and game logic.
virtual void Frame() { };
virtual void Frame() {}
// Redraws the screen, handling games, guis, console, etc
// in a modal manner outside the normal frame loop
virtual void UpdateScreen() { };
virtual void UpdateScreen() {}
virtual void UpdateLevelLoadPacifier() { };
virtual void UpdateLevelLoadPacifier() {}
// Checks for and removes command line "+set var arg" constructs.
// If match is NULL, all set commands will be executed, otherwise
// only a set with the exact name.
virtual void StartupVariable( const char* match ) { };
virtual void StartupVariable( const char* match ) {}
// Begins redirection of console output to the given buffer.
virtual void BeginRedirect( char* buffer, int buffersize, void ( *flush )( const char* ) ) { };
// Stops redirection of console output.
virtual void EndRedirect() { };
virtual void EndRedirect() {}
// Update the screen with every message printed.
virtual void SetRefreshOnPrint( bool set ) { };
virtual void SetRefreshOnPrint( bool set ) {}
virtual void Printf( const char* fmt, ... )
{
@ -409,10 +497,10 @@ public:
}
// Prints all queued warnings.
virtual void PrintWarnings() { };
virtual void PrintWarnings() {}
// Removes all queued warnings.
virtual void ClearWarnings( const char* reason ) { };
virtual void ClearWarnings( const char* reason ) {}
virtual void Error( const char* fmt, ... )
{
@ -521,14 +609,14 @@ public:
return useless;
};
virtual void OnSaveCompleted( idSaveLoadParms& parms ) { };
virtual void OnLoadCompleted( idSaveLoadParms& parms ) { };
virtual void OnLoadFilesCompleted( idSaveLoadParms& parms ) { };
virtual void OnEnumerationCompleted( idSaveLoadParms& parms ) { };
virtual void OnDeleteCompleted( idSaveLoadParms& parms ) { };
virtual void TriggerScreenWipe( const char* _wipeMaterial, bool hold ) { };
virtual void OnSaveCompleted( idSaveLoadParms& parms ) {}
virtual void OnLoadCompleted( idSaveLoadParms& parms ) {}
virtual void OnLoadFilesCompleted( idSaveLoadParms& parms ) {}
virtual void OnEnumerationCompleted( idSaveLoadParms& parms ) {}
virtual void OnDeleteCompleted( idSaveLoadParms& parms ) {}
virtual void TriggerScreenWipe( const char* _wipeMaterial, bool hold ) {}
virtual void OnStartHosting( idMatchParameters& parms ) { };
virtual void OnStartHosting( idMatchParameters& parms ) {}
virtual int GetGameFrame()
{
@ -554,7 +642,7 @@ public:
return useless;
};
virtual void ResetPlayerInput( int playerIndex ) { };
virtual void ResetPlayerInput( int playerIndex ) {}
virtual bool JapaneseCensorship() const
{
@ -563,26 +651,27 @@ public:
virtual void QueueShowShell() { }; // Will activate the shell on the next frame.
virtual void UpdateScreen( bool, bool ) { }
void InitTool( const toolFlag_t, const idDict*, idEntity* ) { }
void InitTool( const toolFlag_t, const idDict*, idEntity* ) {}
//virtual currentGame_t GetCurrentGame() const {
// return DOOM_CLASSIC;
//};
//virtual void SwitchToGame(currentGame_t newGame) { };
//virtual void SwitchToGame(currentGame_t newGame) {}
void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) { };
void LoadPacifierBinarizeInfo( const char* info ) { };
void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) { };
void LoadPacifierBinarizeProgress( float progress ) { };
void LoadPacifierBinarizeFilename( const char* filename, const char* reason ) {}
void LoadPacifierBinarizeInfo( const char* info ) {}
void LoadPacifierBinarizeMiplevel( int level, int maxLevel ) {}
void LoadPacifierBinarizeProgress( float progress ) {}
void LoadPacifierBinarizeEnd() { };
// for images in particular we can measure more accurately this way (to deal with mipmaps)
void LoadPacifierBinarizeProgressTotal( int total ) { };
void LoadPacifierBinarizeProgressIncrement( int step ) { };
void LoadPacifierBinarizeProgressTotal( int total ) {}
void LoadPacifierBinarizeProgressIncrement( int step ) {}
};
idCommonLocal commonLocal;
idCommon* common = &commonLocal;
int com_editors = 0;
/*
==============================================================
@ -604,7 +693,7 @@ int main( int argc, char** argv )
cvarSystem->Init();
idCVar::RegisterStaticVars();
fileSystem->Init();
declManager->Init();
declManager->InitTool();
idCmdArgs args;
for( int i = 0; i < argc; i++ )