somewhat unclean code, sorry... but it allows opening brushPrimitives maps in nonBrushPrimitives mode (experimental) by temp toggling to the correct mode
This commit is contained in:
parent
652a2d36fb
commit
2b0a97c814
|
|
@ -61,6 +61,7 @@ class MapFormat
|
||||||
public:
|
public:
|
||||||
INTEGER_CONSTANT(Version, 2);
|
INTEGER_CONSTANT(Version, 2);
|
||||||
STRING_CONSTANT(Name, "map");
|
STRING_CONSTANT(Name, "map");
|
||||||
|
mutable bool wrongFormat;
|
||||||
|
|
||||||
/// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities.
|
/// \brief Read a map graph into \p root from \p outputStream, using \p entityTable to create entities.
|
||||||
virtual void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const = 0;
|
virtual void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const = 0;
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,7 @@ public:
|
||||||
else if(!detectedFormat && string_equal(primitive, "("))
|
else if(!detectedFormat && string_equal(primitive, "("))
|
||||||
{
|
{
|
||||||
detectedFormat = true;
|
detectedFormat = true;
|
||||||
|
wrongFormat = true;
|
||||||
Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-texdef");
|
Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-texdef");
|
||||||
return g_nullNode;
|
return g_nullNode;
|
||||||
}
|
}
|
||||||
|
|
@ -306,6 +307,7 @@ public:
|
||||||
else if(!detectedFormat && string_equal(primitive, "("))
|
else if(!detectedFormat && string_equal(primitive, "("))
|
||||||
{
|
{
|
||||||
detectedFormat = true;
|
detectedFormat = true;
|
||||||
|
wrongFormat = true;
|
||||||
Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-brush-primitives");
|
Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-brush-primitives");
|
||||||
return g_nullNode;
|
return g_nullNode;
|
||||||
}
|
}
|
||||||
|
|
@ -319,6 +321,7 @@ public:
|
||||||
void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
|
void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
|
||||||
{
|
{
|
||||||
detectedFormat = false;
|
detectedFormat = false;
|
||||||
|
wrongFormat = false;
|
||||||
Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
|
Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
|
||||||
Map_Read(root, tokeniser, entityTable, *this);
|
Map_Read(root, tokeniser, entityTable, *this);
|
||||||
tokeniser.release();
|
tokeniser.release();
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,17 @@ void Brush_unlatchPreferences()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Brush_toggleProjection()
|
||||||
|
{
|
||||||
|
if(g_showAlternativeTextureProjectionOption)
|
||||||
|
{
|
||||||
|
g_useAlternativeTextureProjection.m_value = !g_useAlternativeTextureProjection.m_value;
|
||||||
|
globalErrorStream() << "Toggled g_useAlternativeTextureProjection (" << g_useAlternativeTextureProjection.m_value << ")\n";
|
||||||
|
Brush::destroyStatic();
|
||||||
|
Brush::constructStatic(g_useAlternativeTextureProjection.m_value ? eBrushTypeQuake3BP : eBrushTypeQuake3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Brush_Construct(EBrushType type)
|
void Brush_Construct(EBrushType type)
|
||||||
{
|
{
|
||||||
if(type == eBrushTypeQuake3)
|
if(type == eBrushTypeQuake3)
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
void Brush_clipperColourChanged();
|
void Brush_clipperColourChanged();
|
||||||
void Brush_unlatchPreferences();
|
void Brush_unlatchPreferences();
|
||||||
|
void Brush_toggleProjection();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#include "debugging/debugging.h"
|
#include "debugging/debugging.h"
|
||||||
|
|
||||||
#include "imap.h"
|
#include "imap.h"
|
||||||
|
MapModules& ReferenceAPI_getMapModules();
|
||||||
#include "iselection.h"
|
#include "iselection.h"
|
||||||
#include "iundo.h"
|
#include "iundo.h"
|
||||||
#include "ibrush.h"
|
#include "ibrush.h"
|
||||||
|
|
@ -1038,7 +1039,20 @@ void Map_LoadFile (const char *filename)
|
||||||
ScopeTimer timer("map load");
|
ScopeTimer timer("map load");
|
||||||
|
|
||||||
g_map.m_resource = GlobalReferenceCache().capture(g_map.m_name.c_str());
|
g_map.m_resource = GlobalReferenceCache().capture(g_map.m_name.c_str());
|
||||||
|
|
||||||
|
const MapFormat* format = ReferenceAPI_getMapModules().findModule("mapq3");
|
||||||
|
format->wrongFormat = false;
|
||||||
g_map.m_resource->attach(g_map);
|
g_map.m_resource->attach(g_map);
|
||||||
|
if(format->wrongFormat)
|
||||||
|
{
|
||||||
|
// try toggling BrushPrimitives
|
||||||
|
Map_Free();
|
||||||
|
Brush_toggleProjection();
|
||||||
|
g_map.m_name = filename;
|
||||||
|
Map_UpdateTitle(g_map);
|
||||||
|
g_map.m_resource = GlobalReferenceCache().capture(g_map.m_name.c_str());
|
||||||
|
g_map.m_resource->attach(g_map);
|
||||||
|
}
|
||||||
|
|
||||||
Node_getTraversable(GlobalSceneGraph().root())->traverse(entity_updateworldspawn());
|
Node_getTraversable(GlobalSceneGraph().root())->traverse(entity_updateworldspawn());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user