- moved the script compiler's backend to 'common'.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:33:06 +02:00
parent 3454314bb1
commit a28182fe35
16 changed files with 44 additions and 39 deletions

View file

@ -624,6 +624,7 @@ file( GLOB HEADER_FILES
common/scripting/vm/*h common/scripting/vm/*h
common/scripting/jit/*h common/scripting/jit/*h
common/scripting/interface/*.h common/scripting/interface/*.h
common/scripting/backend/*.h
utility/*.h utility/*.h
scripting/*.h scripting/*.h
scripting/backend/*.h scripting/backend/*.h
@ -1043,9 +1044,7 @@ set (PCH_SOURCES
scripting/thingdef.cpp scripting/thingdef.cpp
scripting/thingdef_data.cpp scripting/thingdef_data.cpp
scripting/thingdef_properties.cpp scripting/thingdef_properties.cpp
scripting/backend/codegen.cpp
scripting/backend/codegen_doom.cpp scripting/backend/codegen_doom.cpp
scripting/backend/vmbuilder.cpp
scripting/decorate/olddecorations.cpp scripting/decorate/olddecorations.cpp
scripting/decorate/thingdef_exp.cpp scripting/decorate/thingdef_exp.cpp
scripting/decorate/thingdef_parse.cpp scripting/decorate/thingdef_parse.cpp
@ -1147,6 +1146,7 @@ set (PCH_SOURCES
common/engine/renderstyle.cpp common/engine/renderstyle.cpp
common/engine/v_colortables.cpp common/engine/v_colortables.cpp
common/engine/serializer.cpp common/engine/serializer.cpp
common/engine/m_random.cpp
common/objects/dobject.cpp common/objects/dobject.cpp
common/objects/dobjgc.cpp common/objects/dobjgc.cpp
common/objects/dobjtype.cpp common/objects/dobjtype.cpp
@ -1159,8 +1159,9 @@ set (PCH_SOURCES
common/scripting/vm/vmexec.cpp common/scripting/vm/vmexec.cpp
common/scripting/vm/vmframe.cpp common/scripting/vm/vmframe.cpp
common/scripting/interface/stringformat.cpp common/scripting/interface/stringformat.cpp
common/scripting/backend/vmbuilder.cpp
common/scripting/backend/codegen.cpp
utility/m_random.cpp
utility/nodebuilder/nodebuild.cpp utility/nodebuilder/nodebuild.cpp
utility/nodebuilder/nodebuild_classify_nosse2.cpp utility/nodebuilder/nodebuild_classify_nosse2.cpp
utility/nodebuilder/nodebuild_events.cpp utility/nodebuilder/nodebuild_events.cpp
@ -1252,6 +1253,8 @@ include_directories( .
common/scripting/vm common/scripting/vm
common/scripting/jit common/scripting/jit
common/scripting/core common/scripting/core
common/scripting/interface
common/scripting/backend
g_statusbar g_statusbar
console console
playsim playsim

View file

@ -59,7 +59,6 @@
#include <assert.h> #include <assert.h>
#include "doomstat.h"
#include "m_random.h" #include "m_random.h"
#include "serializer.h" #include "serializer.h"
#include "m_crc32.h" #include "m_crc32.h"
@ -80,11 +79,7 @@
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern FRandom pr_spawnmobj; FRandom pr_exrandom("EX_Random");
extern FRandom pr_acs;
extern FRandom pr_chase;
extern FRandom pr_exrandom;
extern FRandom pr_damagemobj;
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
@ -260,25 +255,6 @@ void FRandom::Init(uint32_t seed)
SFMTObj::Init(NameCRC, seed); SFMTObj::Init(NameCRC, seed);
} }
//==========================================================================
//
// FRandom :: StaticSumSeeds
//
// This function produces a uint32_t that can be used to check the consistancy
// of network games between different machines. Only a select few RNGs are
// used for the sum, because not all RNGs are important to network sync.
//
//==========================================================================
uint32_t FRandom::StaticSumSeeds ()
{
return
pr_spawnmobj.sfmt.u[0] + pr_spawnmobj.idx +
pr_acs.sfmt.u[0] + pr_acs.idx +
pr_chase.sfmt.u[0] + pr_chase.idx +
pr_damagemobj.sfmt.u[0] + pr_damagemobj.idx;
}
//========================================================================== //==========================================================================
// //
// FRandom :: StaticWriteRNGState // FRandom :: StaticWriteRNGState

View file

@ -48,6 +48,11 @@ public:
FRandom (const char *name); FRandom (const char *name);
~FRandom (); ~FRandom ();
int Seed() const
{
return sfmt.u[0] + idx;
}
// Returns a random number in the range [0,255] // Returns a random number in the range [0,255]
int operator()() int operator()()
{ {
@ -163,7 +168,6 @@ public:
// Static interface // Static interface
static void StaticClearRandom (); static void StaticClearRandom ();
static uint32_t StaticSumSeeds ();
static void StaticReadRNGState (FSerializer &arc); static void StaticReadRNGState (FSerializer &arc);
static void StaticWriteRNGState (FSerializer &file); static void StaticWriteRNGState (FSerializer &file);
static FRandom *StaticFindRNG(const char *name); static FRandom *StaticFindRNG(const char *name);

View file

@ -1047,7 +1047,29 @@ bool G_Responder (event_t *ev)
ev->type == EV_Mouse); ev->type == EV_Mouse);
} }
//==========================================================================
//
// FRandom :: StaticSumSeeds
//
// This function produces a uint32_t that can be used to check the consistancy
// of network games between different machines. Only a select few RNGs are
// used for the sum, because not all RNGs are important to network sync.
//
//==========================================================================
extern FRandom pr_spawnmobj;
extern FRandom pr_acs;
extern FRandom pr_chase;
extern FRandom pr_damagemobj;
static uint32_t StaticSumSeeds()
{
return
pr_spawnmobj.Seed() +
pr_acs.Seed() +
pr_chase.Seed() +
pr_damagemobj.Seed();
}
// //
// G_Ticker // G_Ticker
@ -1166,7 +1188,7 @@ void G_Ticker ()
// [RH] Include some random seeds and player stuff in the consistancy // [RH] Include some random seeds and player stuff in the consistancy
// check, not just the player's x position like BOOM. // check, not just the player's x position like BOOM.
uint32_t rngsum = FRandom::StaticSumSeeds (); uint32_t rngsum = StaticSumSeeds ();
//Added by MC: For some of that bot stuff. The main bot function. //Added by MC: For some of that bot stuff. The main bot function.
primaryLevel->BotInfo.Main (primaryLevel); primaryLevel->BotInfo.Main (primaryLevel);

View file

@ -62,7 +62,7 @@
#include "serializer.h" #include "serializer.h"
#include "thingdef.h" #include "thingdef.h"
#include "v_text.h" #include "v_text.h"
#include "backend/vmbuilder.h" #include "vmbuilder.h"
#include "types.h" #include "types.h"
#include "m_argv.h" #include "m_argv.h"
#include "actorptrselect.h" #include "actorptrselect.h"

View file

@ -41,7 +41,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "decallib.h" #include "decallib.h"
#include "thingdef.h" #include "thingdef.h"
#include "backend/codegen.h" #include "codegen.h"
// TYPES ------------------------------------------------------------------- // TYPES -------------------------------------------------------------------

View file

@ -42,10 +42,10 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "a_pickups.h" #include "a_pickups.h"
#include "thingdef.h" #include "thingdef.h"
#include "backend/codegen.h" #include "codegen.h"
#include "backend/codegen_doom.h" #include "backend/codegen_doom.h"
FRandom pr_exrandom ("EX_Random"); extern FRandom pr_exrandom;
static FxExpression *ParseRandom(FScanner &sc, FName identifier, PClassActor *cls); static FxExpression *ParseRandom(FScanner &sc, FName identifier, PClassActor *cls);
static FxExpression *ParseRandomPick(FScanner &sc, FName identifier, PClassActor *cls); static FxExpression *ParseRandomPick(FScanner &sc, FName identifier, PClassActor *cls);

View file

@ -43,7 +43,7 @@
#include "a_pickups.h" #include "a_pickups.h"
#include "thingdef.h" #include "thingdef.h"
#include "a_morph.h" #include "a_morph.h"
#include "backend/codegen.h" #include "codegen.h"
#include "backend/codegen_doom.h" #include "backend/codegen_doom.h"
#include "filesystem.h" #include "filesystem.h"
#include "v_text.h" #include "v_text.h"

View file

@ -43,7 +43,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_local.h" #include "p_local.h"
#include "thingdef.h" #include "thingdef.h"
#include "backend/codegen.h" #include "codegen.h"
#include "backend/codegen_doom.h" #include "backend/codegen_doom.h"
#ifndef _MSC_VER #ifndef _MSC_VER
#include "i_system.h" // for strlwr() #include "i_system.h" // for strlwr()

View file

@ -49,7 +49,7 @@
#include "a_weapons.h" #include "a_weapons.h"
#include "p_conversation.h" #include "p_conversation.h"
#include "v_text.h" #include "v_text.h"
#include "backend/codegen.h" #include "codegen.h"
#include "stats.h" #include "stats.h"
#include "info.h" #include "info.h"
#include "thingdef.h" #include "thingdef.h"

View file

@ -50,7 +50,7 @@
#include "thingdef.h" #include "thingdef.h"
#include "a_morph.h" #include "a_morph.h"
#include "teaminfo.h" #include "teaminfo.h"
#include "backend/vmbuilder.h" #include "vmbuilder.h"
#include "a_keys.h" #include "a_keys.h"
#include "g_levellocals.h" #include "g_levellocals.h"
#include "types.h" #include "types.h"

View file

@ -2,7 +2,7 @@
#define ZCC_COMPILE_H #define ZCC_COMPILE_H
#include <memory> #include <memory>
#include "backend/codegen.h" #include "codegen.h"
struct Baggage; struct Baggage;
struct FPropertyInfo; struct FPropertyInfo;