[General] Allow building custom maps

This commit is contained in:
momo5502 2017-04-15 16:48:43 +02:00
parent c0bb67f36d
commit 360729120c
7 changed files with 9 additions and 21 deletions

View File

@ -440,17 +440,12 @@ namespace Components
AssetHandler::RegisterInterface(new Assets::IRawFile());
AssetHandler::RegisterInterface(new Assets::IComWorld());
AssetHandler::RegisterInterface(new Assets::IGfxImage());
#ifdef ENABLE_EXPERIMENTAL_MAP_CODE
AssetHandler::RegisterInterface(new Assets::IGfxWorld());
#endif
AssetHandler::RegisterInterface(new Assets::ISndCurve());
AssetHandler::RegisterInterface(new Assets::IMaterial());
AssetHandler::RegisterInterface(new Assets::IMenuList());
AssetHandler::RegisterInterface(new Assets::ImenuDef_t());
#ifdef ENABLE_EXPERIMENTAL_MAP_CODE
AssetHandler::RegisterInterface(new Assets::IclipMap_t());
#endif
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
AssetHandler::RegisterInterface(new Assets::IFxEffectDef());

View File

@ -2,8 +2,6 @@
#define IW4X_GFXMAP_VERSION 1
#ifdef ENABLE_EXPERIMENTAL_MAP_CODE
namespace Assets
{
void IGfxWorld::loadGfxWorldDpvsStatic(Game::GfxWorld* world, Game::GfxWorldDpvsStatic* asset, Components::ZoneBuilder::Zone* builder, Utils::Stream::Reader* reader)
@ -1367,5 +1365,3 @@ namespace Assets
SaveLogExit();
}
}
#endif

View File

@ -21,7 +21,7 @@ namespace Assets
Game::LoadedSound* reference = nullptr;
if (!reference) reference = Game::DB_FindXAssetHeader(Game::ASSET_TYPE_LOADED_SOUND, "weapons/c4_detpack/c4_drop_dirt1.wav").loadSnd;
memcpy(sound, reference, sizeof(Game::LoadedSound));
std::memcpy(sound, reference, sizeof(Game::LoadedSound));
sound->sound.data = nullptr;
Utils::Stream::Reader reader(builder->getAllocator(), soundFile.getBuffer());
@ -68,7 +68,7 @@ namespace Assets
// skip any extra parameters
if (chunkSize > 16)
{
reader.seek(chunkSize - 16);
reader.seekRelative(chunkSize - 16);
}
}
break;
@ -81,7 +81,7 @@ namespace Assets
default:
if (chunkSize > 0)
{
reader.seek(chunkSize);
reader.seekRelative(chunkSize);
}
break;
}

View File

@ -2,8 +2,6 @@
#define IW4X_CLIPMAP_VERSION 1
#ifdef ENABLE_EXPERIMENTAL_MAP_CODE
namespace Assets
{
void IclipMap_t::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
@ -913,5 +911,3 @@ namespace Assets
header->clipMap = clipMap;
}
}
#endif

View File

@ -155,8 +155,3 @@ using namespace std::literals;
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
// Enables custom map code
#ifdef DEBUG
#define ENABLE_EXPERIMENTAL_MAP_CODE
#endif

View File

@ -59,6 +59,11 @@ namespace Utils
}
}
void Stream::Reader::seekRelative(unsigned int _position)
{
return this->seek(_position + this->position);
}
void* Stream::Reader::readPointer()
{
void* pointer = this->read<void*>();

View File

@ -54,6 +54,7 @@ namespace Utils
bool end();
void seek(unsigned int position);
void seekRelative(unsigned int position);
void* readPointer();
void mapPointer(void* oldPointer, void* newPointer);