- moved sc_man and palettecontainer to the 'common' folder.

This commit is contained in:
Christoph Oelckers 2020-04-11 13:46:15 +02:00
parent 98472d999b
commit c713850dac
18 changed files with 71 additions and 59 deletions

View file

@ -570,8 +570,8 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zcc-parse.c ${CMAKE_CURRE
DEPENDS lemon ${CMAKE_CURRENT_SOURCE_DIR}/scripting/zscript/zcc-parse.lemon )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h
COMMAND re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/utility/sc_man_scanner.re
DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/utility/sc_man_scanner.re )
COMMAND re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/common/engine/sc_man_scanner.re
DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/common/engine/sc_man_scanner.re )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
@ -725,7 +725,7 @@ set( NOT_COMPILED_SOURCE_FILES
${SWRENDER_SOURCES}
${POLYRENDER_SOURCES}
sc_man_scanner.h
utility/sc_man_scanner.re
common/engine/sc_man_scanner.re
g_statusbar/sbarinfo_commands.cpp
gamedata/xlat/xlat_parser.y
xlat_parser.c
@ -1110,7 +1110,6 @@ set (PCH_SOURCES
rendering/swrenderer/textures/warptexture.cpp
rendering/swrenderer/textures/swcanvastexture.cpp
events.cpp
utility/palettecontainer.cpp
common/thirdparty/sfmt/SFMT.cpp
common/utility/engineerrors.cpp
common/utility/i_module.cpp
@ -1141,6 +1140,8 @@ set (PCH_SOURCES
common/filesystem/file_whres.cpp
common/filesystem/file_directory.cpp
common/filesystem/resourcefile.cpp
common/engine/sc_man.cpp
common/engine/palettecontainer.cpp
utility/m_png.cpp
utility/m_random.cpp
@ -1150,7 +1151,6 @@ set (PCH_SOURCES
utility/nodebuilder/nodebuild_extract.cpp
utility/nodebuilder/nodebuild_gl.cpp
utility/nodebuilder/nodebuild_utility.cpp
utility/sc_man.cpp
utility/stats.cpp
utility/m_bbox.cpp
utility/v_collection.cpp
@ -1203,7 +1203,7 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
set_source_files_properties( ${FASTMATH_SOURCES} PROPERTIES COMPILE_FLAGS ${ZD_FASTMATH_FLAG} )
set_source_files_properties( xlat/parse_xlat.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c" )
set_source_files_properties( utility/sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" )
set_source_files_properties( common/engine/sc_man.cpp PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h" )
set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )
@ -1436,4 +1436,4 @@ source_group("Utility\\Node Builder" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE
source_group("Statusbar" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_statusbar/.+")
source_group("Versioning" FILES version.h win32/zdoom.rc)
source_group("Xlat" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/xlat/.+" FILES ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h)
source_group("Source Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h utility/sc_man_scanner.re)
source_group("Source Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h common/engine/sc_man_scanner.re)

View file

@ -37,14 +37,17 @@
#include <string.h>
#include <stdlib.h>
#include "doomtype.h"
#include "engineerrors.h"
#include "sc_man.h"
#include "filesystem.h"
#include "cmdlib.h"
#include "templates.h"
#include "doomstat.h"
#include "printf.h"
#include "name.h"
#include "v_text.h"
#include "templates.h"
#include "zstring.h"
#include "name.h"
#include "filesystem.h"
// MACROS ------------------------------------------------------------------
@ -1127,6 +1130,7 @@ void FScanner::CheckOpen()
//==========================================================================
int FScriptPosition::ErrorCounter;
int FScriptPosition::WarnCounter;
int FScriptPosition::Developer;
bool FScriptPosition::StrictErrors; // makes all OPTERROR messages real errors.
bool FScriptPosition::errorout; // call I_Error instead of printing the error itself.
@ -1156,19 +1160,17 @@ FScriptPosition &FScriptPosition::operator=(FScanner &sc)
//
//==========================================================================
CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
void FScriptPosition::Message (int severity, const char *message, ...) const
{
FString composed;
if (severity == MSG_DEBUGLOG && developer < DMSG_NOTIFY) return;
if (severity == MSG_DEBUGERROR && developer < DMSG_ERROR) return;
if (severity == MSG_DEBUGWARN && developer < DMSG_WARNING) return;
if (severity == MSG_DEBUGMSG && developer < DMSG_NOTIFY) return;
if (severity == MSG_DEBUGLOG && Developer < DMSG_NOTIFY) return;
if (severity == MSG_DEBUGERROR && Developer < DMSG_ERROR) return;
if (severity == MSG_DEBUGWARN && Developer < DMSG_WARNING) return;
if (severity == MSG_DEBUGMSG && Developer < DMSG_NOTIFY) return;
if (severity == MSG_OPTERROR)
{
severity = StrictErrors || strictdecorate ? MSG_ERROR : MSG_WARNING;
severity = StrictErrors? MSG_ERROR : MSG_WARNING;
}
// This is mainly for catching the error with an exception handler.
if (severity == MSG_ERROR && errorout) severity = MSG_FATAL;

View file

@ -1,7 +1,41 @@
#ifndef __SC_MAN_H__
#define __SC_MAN_H__
#include "doomtype.h"
#include "zstring.h"
#include "name.h"
#include "basics.h"
struct VersionInfo
{
uint16_t major;
uint16_t minor;
uint32_t revision;
bool operator <=(const VersionInfo& o) const
{
return o.major > this->major || (o.major == this->major && o.minor > this->minor) || (o.major == this->major && o.minor == this->minor && o.revision >= this->revision);
}
bool operator >=(const VersionInfo& o) const
{
return o.major < this->major || (o.major == this->major && o.minor < this->minor) || (o.major == this->major && o.minor == this->minor && o.revision <= this->revision);
}
bool operator > (const VersionInfo& o) const
{
return o.major < this->major || (o.major == this->major && o.minor < this->minor) || (o.major == this->major && o.minor == this->minor && o.revision < this->revision);
}
bool operator < (const VersionInfo& o) const
{
return o.major > this->major || (o.major == this->major && o.minor > this->minor) || (o.major == this->major && o.minor == this->minor && o.revision > this->revision);
}
void operator=(const char* string);
};
// Cannot be a constructor because Lemon would puke on it.
inline VersionInfo MakeVersion(unsigned int ma, unsigned int mi, unsigned int re = 0)
{
return{ (uint16_t)ma, (uint16_t)mi, (uint32_t)re };
}
class FScanner
{
@ -164,6 +198,7 @@ struct FScriptPosition
static int WarnCounter;
static int ErrorCounter;
static bool StrictErrors;
static int Developer;
static bool errorout;
FName FileName;
int ScriptLine;

View file

@ -53,7 +53,6 @@ void I_DebugPrint(const char *cp)
#endif
#include "engineerrors.h"
#include "printf.h"
//==========================================================================
//
@ -70,7 +69,7 @@ void I_Error(const char *error, ...)
char errortext[MAX_ERRORTEXT];
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);
@ -97,7 +96,7 @@ void I_FatalError(const char *error, ...)
char errortext[MAX_ERRORTEXT];
va_list argptr;
va_start(argptr, error);
myvsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
vsnprintf(errortext, MAX_ERRORTEXT, error, argptr);
va_end(argptr);
I_DebugPrint(errortext);

View file

@ -44,7 +44,7 @@
#include <malloc.h>
#endif
#include "printf.h"
#include "engineerrors.h"
#include "m_alloc.h"
#ifndef _MSC_VER

View file

@ -39,7 +39,6 @@
#include "basics.h"
#include "memarena.h"
#include "printf.h"
#include "cmdlib.h"
#include "m_alloc.h"

View file

@ -102,37 +102,6 @@ public:
};
struct VersionInfo
{
uint16_t major;
uint16_t minor;
uint32_t revision;
bool operator <=(const VersionInfo &o) const
{
return o.major > this->major || (o.major == this->major && o.minor > this->minor) || (o.major == this->major && o.minor == this->minor && o.revision >= this->revision);
}
bool operator >=(const VersionInfo &o) const
{
return o.major < this->major || (o.major == this->major && o.minor < this->minor) || (o.major == this->major && o.minor == this->minor && o.revision <= this->revision);
}
bool operator > (const VersionInfo &o) const
{
return o.major < this->major || (o.major == this->major && o.minor < this->minor) || (o.major == this->major && o.minor == this->minor && o.revision < this->revision);
}
bool operator < (const VersionInfo &o) const
{
return o.major > this->major || (o.major == this->major && o.minor > this->minor) || (o.major == this->major && o.minor == this->minor && o.revision > this->revision);
}
void operator=(const char *string);
};
// Cannot be a constructor because Lemon would puke on it.
inline VersionInfo MakeVersion(unsigned int ma, unsigned int mi, unsigned int re = 0)
{
return{ (uint16_t)ma, (uint16_t)mi, (uint32_t)re };
}
enum class ELightMode : int8_t
{
NotSet = -1,

View file

@ -51,7 +51,10 @@ CVAR(Float, gl_cachetime, 0.6f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR(Bool, alwaysapplydmflags, false, CVAR_SERVERINFO);
// Show developer messages if true.
CVAR(Int, developer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, developer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{
FScriptPosition::Developer = self;
}
// [RH] Feature control cvars
CVAR(Bool, var_friction, true, CVAR_SERVERINFO);

View file

@ -38,6 +38,8 @@
#include "c_cvars.h"
#include "scripting/vm/jit.h"
EXTERN_CVAR(Bool, strictdecorate);
struct VMRemap
{
uint8_t altOp, kReg, kType;
@ -832,7 +834,7 @@ void FFunctionBuildList::Build()
ctx.FunctionArgs.Push(local);
}
FScriptPosition::StrictErrors = !item.FromDecorate;
FScriptPosition::StrictErrors = !item.FromDecorate || strictdecorate;
item.Code = item.Code->Resolve(ctx);
// If we need extra space, load the frame pointer into a register so that we do not have to call the wasteful LFP instruction more than once.
if (item.Function->ExtraSpace > 0)
@ -910,7 +912,7 @@ void FFunctionBuildList::Build()
disasmdump.Flush();
}
VMFunction::CreateRegUseInfo();
FScriptPosition::StrictErrors = false;
FScriptPosition::StrictErrors = strictdecorate;
if (FScriptPosition::ErrorCounter == 0 && Args->CheckParm("-dumpjit")) DumpJit();
mItems.Clear();

View file

@ -53,7 +53,7 @@
#endif // !_MSC_VER
void ParseOldDecoration(FScanner &sc, EDefinitionType def, PNamespace *ns);
EXTERN_CVAR(Bool, strictdecorate);
CVAR(Bool, strictdecorate, false, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
//==========================================================================

View file

@ -1,6 +1,7 @@
// Note: This must not be included by anything but dobject.h!
#pragma once
#include "sc_man.h"
class VMFunction;
class PType;

View file

@ -62,6 +62,7 @@ void InitThingdef();
static TMap<FState *, FScriptPosition> StateSourceLines;
static FScriptPosition unknownstatesource("unknown file", 0);
EXTERN_CVAR(Bool, strictdecorate);
//==========================================================================
//
@ -462,7 +463,7 @@ void LoadActors()
FScriptPosition::StrictErrors = true;
ParseScripts();
FScriptPosition::StrictErrors = false;
FScriptPosition::StrictErrors = strictdecorate;
ParseAllDecorate();
SynthesizeFlagFields();

View file

@ -36,6 +36,7 @@
#include "sc_man.h"
#include "templates.h"
#include "m_misc.h"
#include "cmdlib.h"
FReverbField ReverbFields[] =