Renamed **NO_SCRIPTENGINE** to **WITH_SCRIPT_ENGINE**

This commit is contained in:
OM 2023-05-29 01:33:07 +02:00
parent 6b1da4af57
commit e45289d28b
8 changed files with 58 additions and 57 deletions

View file

@ -167,7 +167,7 @@ file(GLOB_RECURSE SOURCES_GAME "code/game/*.c" "code/game/*.cpp" "code/parser/*.
set(SOURCES_GAME_LIB ${SOURCES_SHARED} ${SOURCES_GAME})
add_library(fgame SHARED ${SOURCES_GAME_LIB})
target_compile_definitions(fgame PRIVATE GAME_DLL ARCHIVE_SUPPORTED TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_definitions(fgame PRIVATE GAME_DLL WITH_SCRIPT_ENGINE ARCHIVE_SUPPORTED TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_include_directories(fgame PUBLIC "code/qcommon" "code/script" "code/game")
target_include_directories(fgame PRIVATE "code/parser")
target_compile_features(fgame PUBLIC cxx_nullptr)
@ -185,7 +185,7 @@ file(GLOB_RECURSE SOURCES_SERVER "code/server/*.c" "code/server/*.cpp")
set(SOURCES_SERVER_APP ${SOURCES_APP} ${SOURCES_SERVER})
add_executable(omohaaded ${SOURCES_PLATFORM_SPECIFIC} ${SOURCES_SERVER_APP} "code/null/null_client.c" "code/null/null_input.c" "code/null/null_snddma.c")
target_compile_definitions(omohaaded PRIVATE NO_SCRIPTENGINE APP_MODULE DEDICATED TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_definitions(omohaaded PRIVATE APP_MODULE DEDICATED TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_features(omohaaded PUBLIC cxx_nullptr)
target_compile_features(omohaaded PUBLIC c_variadic_macros)
# Gamespy dependency
@ -220,7 +220,7 @@ if (WITH_CLIENT)
set(SOURCES_CGAME_LIB ${SOURCES_SHARED} ${SOURCES_CGAME} ${SOURCES_BG})
add_library(cgame SHARED ${SOURCES_CGAME_LIB})
target_compile_definitions(cgame PRIVATE CGAME_DLL NO_SCRIPTENGINE TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_definitions(cgame PRIVATE CGAME_DLL TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_include_directories(cgame PUBLIC "code/qcommon" "code/cgame" "code/script")
target_compile_features(cgame PUBLIC cxx_nullptr)
target_compile_features(cgame PUBLIC c_variadic_macros)
@ -247,7 +247,7 @@ if (WITH_CLIENT)
set(SOURCES_CLIENT_APP ${SOURCES_APP} ${SOURCES_SERVER} ${SOURCES_CLIENT} ${SOURCES_UILIB} ${SOURCES_LIBS} ${SOURCES_RENDERER} ${SHADER_SRCS})
add_executable(openmohaa ${SOURCES_PLATFORM_SPECIFIC} ${SOURCES_CLIENT_APP} ${SOURCES_CLIENT_PLATFORM_SPECIFIC})
target_compile_definitions(openmohaa PRIVATE NO_SCRIPTENGINE APP_MODULE TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
target_compile_definitions(openmohaa PRIVATE APP_MODULE TARGET_GAME_TYPE=${TARGET_GAME_TYPE})
if (USE_OPENAL)
# Try to use OpenAL
@ -307,8 +307,9 @@ if (WITH_CLIENT)
elseif(UNIX)
find_package(Threads)
target_link_libraries(openmohaa PRIVATE m)
target_link_libraries(openmohaa PRIVATE m rt)
target_link_libraries(openmohaa PRIVATE stdc++)
target_link_libraries(openmohaa PRIVATE ${CMAKE_THREAD_LIBS_INIT})
find_package(SDL2 REQUIRED)
target_include_directories(openmohaa PUBLIC ${SDL2_INCLUDE_DIRS})

View file

@ -401,7 +401,7 @@ Listener *SpawnArgs::SpawnInternal( void )
qboolean tikiWasStatic; // used to determine if entity was intentionally suppressed
const char *key, *value;
str keyname;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
unsigned int eventnum;
EventDef *def;
ScriptVariable *var;
@ -482,7 +482,7 @@ Listener *SpawnArgs::SpawnInternal( void )
// don't count the prefix
keyname = ( key + 1 );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
// initialize the object vars
varList = obj->Vars();
@ -537,7 +537,7 @@ Listener *SpawnArgs::SpawnInternal( void )
{
keyname = ( key + 1 );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
varList = obj->Vars();
var = varList->GetVariable( keyname );

View file

@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
#include "scriptmaster.h"
@ -369,7 +369,7 @@ ClassDef::ClassDef()
this->prev = this;
this->next = this;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
this->waitTillSet = NULL;
#endif
}
@ -393,7 +393,7 @@ ClassDef::ClassDef( const char *classname, const char *classID, const char *supe
this->classSize = classSize;
this->super = getClass( superclass );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
this->waitTillSet = NULL;
#endif
@ -411,7 +411,7 @@ ClassDef::ClassDef( const char *classname, const char *classID, const char *supe
}
// Add to front of list
LL_Add( classlist, this, prev, next );
LL_AddFirst( classlist, this, prev, next );
numclasses++;
}
@ -446,7 +446,7 @@ ClassDef::~ClassDef()
}
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
void ClassDef::AddWaitTill( str s )
{

View file

@ -38,7 +38,7 @@ class Event;
#define isSubclassOf(classname) inheritsFrom(&classname::ClassInfo)
#define isSuperclassOf(classname) isInheritedBy(&classname::ClassInfo)
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
#define CLASS_DECLARATION(parentclass, classname, classid) \
ClassDef classname::ClassInfo(#classname, classid, #parentclass, \
@ -154,7 +154,7 @@ public:
ClassDef* next;
ClassDef* prev;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
con_set<const_str, const_str>* waitTillSet;
#endif
@ -178,7 +178,7 @@ public:
static int compareClasses(const void* arg1, const void* arg2);
static void SortClassList(Container<ClassDef*>* sortedList);
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
void AddWaitTill(str s);
void AddWaitTill(const_str s);
void RemoveWaitTill(str s);

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "scriptexception.h"
#include "Linklist.h"
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
#include "archive.h"
#include "scriptmaster.h"
#include "scriptthread.h"
@ -56,7 +56,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
con_map< Event *, EventDef > Event::eventDefList;
con_arrayset< command_t, command_t > Event::commandList;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
con_map< const_str, unsigned int > Event::normalCommandList;
con_map< const_str, unsigned int > Event::returnCommandList;
@ -1435,7 +1435,7 @@ void Event::PendingEvents
EVENT_Printf( "%d pending events as of %.2f\n", num, EVENT_time );
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -1991,7 +1991,7 @@ Event::Event( str command )
#endif
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -2116,7 +2116,7 @@ void Event::AddNil( void )
variable.Clear();
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -2228,7 +2228,7 @@ bool Event::GetBoolean( int pos )
return variable.booleanNumericValue();
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -2293,7 +2293,7 @@ Listener * Event::GetListener( int pos )
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -2468,7 +2468,7 @@ qboolean Event::IsNumericAt( int pos )
return data[ pos - 1 ].IsNumeric();
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -2581,7 +2581,7 @@ Listener
*/
Listener::Listener()
{
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
m_EndList = NULL;
@ -2602,7 +2602,7 @@ Listener::~Listener()
{
CancelPendingEvents();
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
Unregister( "delete" );
Unregister( "remove" );
@ -2631,7 +2631,7 @@ void Listener::Archive( Archiver &arc )
{
Class::Archive( arc );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
byte flag = 0;
@ -3205,7 +3205,7 @@ Listener *Listener::GetScriptOwner( void )
return NULL;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -4092,7 +4092,7 @@ void Listener::CommandDelay( Event *ev )
PostEvent( e, ev->GetFloat( 1 ) );
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/*
=======================
@ -4614,7 +4614,7 @@ CLASS_DECLARATION( Class, Listener, NULL )
{ &EV_Listener_InheritsFrom, &Listener::EventInheritsFrom },
{ &EV_Listener_IsInheritedBy, &Listener::EventIsInheritedBy },
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
{ &EV_Listener_CancelFor, &Listener::CancelFor },
{ &EV_Listener_CreateReturnThread, &Listener::CreateReturnThread },
{ &EV_Listener_CreateThread, &Listener::CreateThread },

View file

@ -235,7 +235,7 @@ inline bool operator==( const str &name, const command_t &command )
return command.command == name;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
inline bool operator==( const command_t &cmd1, const command_t &cmd2 )
{
return ( cmd2.command == cmd1.command && ( cmd2.type == ( uchar )-1 || cmd2.type == cmd1.type ) );
@ -372,7 +372,7 @@ public:
class PathNode *GetPathNode( int pos );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
SimpleEntity *GetSimpleEntity( int pos );
#endif
@ -389,7 +389,7 @@ public:
qboolean IsListenerAt( int pos );
qboolean IsNilAt( int pos );
qboolean IsNumericAt( int pos );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
qboolean IsSimpleEntityAt( int pos );
#endif
qboolean IsStringAt( int pos );
@ -446,7 +446,7 @@ using ListenerPtr = SafePtr< Listener >;
class Listener : public Class
{
public:
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
con_set< const_str, ConList > *m_NotifyList;
con_set< const_str, ConList > *m_WaitForList;
con_set< const_str, ConList > *m_EndList;
@ -456,7 +456,7 @@ public:
static bool EventSystemStarted;
private:
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
void ExecuteScriptInternal( Event *ev, ScriptVariable& scriptVariable );
void ExecuteThreadInternal( Event *ev, ScriptVariable& returnValue );
void WaitExecuteScriptInternal( Event *ev, ScriptVariable& returnValue );
@ -468,7 +468,7 @@ private:
public:
CLASS_PROTOTYPE( Listener );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
/* Game functions */
virtual ScriptThread *CreateThreadInternal( const ScriptVariable& label );
virtual ScriptThread *CreateScriptInternal( const ScriptVariable& label );
@ -509,7 +509,7 @@ public:
bool ProcessScriptEvent( Event &ev );
bool ProcessScriptEvent( Event *ev );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
void CreateVars( void );
void ClearVars( void );
@ -564,7 +564,7 @@ public:
void EventIsInheritedBy( Event *ev );
void GetClassname( Event *ev );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
void CancelFor( Event *ev );
void CreateReturnThread( Event *ev );
void CreateThread( Event *ev );

View file

@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../game/navigate.h"
#endif
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
#include "world.h"
#include "scriptmaster.h"
#include "simpleentity.h"
@ -93,7 +93,7 @@ void Entry< short3, ScriptVariable >::Archive
if( arc.Loading() )
{
value.Archive( arc );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
key = value.GetKey();
#endif
}
@ -226,7 +226,7 @@ void ScriptPointer::Archive( Archiver& arc, ScriptPointer *& pointerValue )
void ScriptVariable::Archive(Archiver& arc)
{
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
const_str s;
if (arc.Loading())
@ -277,7 +277,7 @@ void ScriptVariable::ArchiveInternal(Archiver& arc)
arc.ArchiveChar(&m_data.charValue);
break;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
case VARIABLE_CONSTSTRING:
if (arc.Loading())
{
@ -688,7 +688,7 @@ qboolean ScriptVariable::IsConstArray() const
|| type == VARIABLE_SAFECONTAINER;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
qboolean ScriptVariable::IsSimpleEntity( void )
{
@ -725,7 +725,7 @@ void ScriptVariable::PrintValue( void )
printf("None");
break;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
case VARIABLE_CONSTSTRING:
printf("%s", Director.GetString(m_data.intValue).c_str());
break;
@ -953,7 +953,7 @@ ScriptVariable *ScriptVariable::constArrayValue( void )
return m_data.constArrayValue->constArrayValue;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
str getname_null = "";
@ -1138,7 +1138,7 @@ Listener *ScriptVariable::listenerValue( void ) const
{
switch( type )
{
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
case VARIABLE_CONSTSTRING:
return world->GetScriptTarget( Director.GetString( m_data.intValue ) );
@ -1183,7 +1183,7 @@ void ScriptVariable::newPointer( void )
m_data.pointerValue->add( this );
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
SimpleEntity *ScriptVariable::simpleEntityValue( void ) const
{
@ -1201,7 +1201,7 @@ str ScriptVariable::stringValue() const
case VARIABLE_NONE:
return "NIL";
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
case VARIABLE_CONSTSTRING:
return Director.GetString( m_data.intValue );
#endif
@ -1221,7 +1221,7 @@ str ScriptVariable::stringValue() const
case VARIABLE_LISTENER:
if( m_data.listenerValue->Pointer() )
{
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
if( m_data.listenerValue->Pointer()->isSubclassOf( SimpleEntity ) )
{
SimpleEntity *s = ( SimpleEntity * )m_data.listenerValue->Pointer();
@ -1297,7 +1297,7 @@ Vector ScriptVariable::vectorValue( void ) const
throw ScriptException( "Cannot cast NULL to vector" );
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
if( !checkInheritance( &SimpleEntity::ClassInfo, m_data.listenerValue->Pointer()->classinfo() ) )
{
throw ScriptException( "Cannot cast '%s' to vector", GetTypeName() );
@ -1485,7 +1485,7 @@ void ScriptVariable::setConstArrayValue( ScriptVariable *pVar, unsigned int size
m_data.constArrayValue = constArray;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
const_str ScriptVariable::constStringValue( void ) const
{
@ -2444,7 +2444,7 @@ ScriptVariable ScriptVariable::operator--( int )
return *this;
}
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
ScriptVariableList::ScriptVariableList()
{

View file

@ -132,7 +132,7 @@ public:
qboolean IsListener( void );
qboolean IsNumeric( void );
qboolean IsConstArray() const;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
qboolean IsSimpleEntity( void );
#endif
qboolean IsString( void );
@ -149,7 +149,7 @@ public:
bool booleanNumericValue( void );
bool booleanValue( void ) const;
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
str& getName( void );
short3& GetKey();
@ -170,7 +170,7 @@ public:
ScriptVariable *constArrayValue( void );
void setConstArrayValue( ScriptVariable *pVar, unsigned int size );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
const_str constStringValue( void ) const;
void setConstStringValue( const_str s );
#endif
@ -197,7 +197,7 @@ public:
str stringValue( void ) const;
void setStringValue( str newvalue );
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
SimpleEntity *simpleEntityValue( void ) const;
#endif
@ -278,7 +278,7 @@ public:
void setValue( const ScriptVariable& var );
};
#ifndef NO_SCRIPTENGINE
#ifdef WITH_SCRIPT_ENGINE
class ScriptVariableList : public Class
{