From 7b4b2a8684f100425921f0f6e7d1293cfd4b894f Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Fri, 4 Jan 2019 20:29:38 +0100 Subject: [PATCH] Add first element (FT_IsDemo) to enum idCommon::FunctionType GetAdditionalFunction() will return a function that returns true if we're running the Doom3 demo version. Not really relevant for mods, but I use this to enable some Demo-specific hacks/workarounds in base.dll Adding this here anyway to make sure the next function type added will get another ID (maybe 2). --- framework/Common.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/Common.h b/framework/Common.h index 92542e6..f56146d 100644 --- a/framework/Common.h +++ b/framework/Common.h @@ -244,10 +244,7 @@ public: * * Similar to SetCallback() I've also added GetAdditionalFunction() to get a function pointer * from dhewm3 that Mods can call (and that's not exported via the normal interface classes). - * Right now GetAdditionalFunction() will always just return false and do nothing, but if - * some Mod needs some specific function in the future, it could be implemented with - * GetAdditionalFunction() - again without breaking the game API and ABI for all the other - * Mods that don't need that function. + * Right now it's only used for a Doom3 Demo specific hack only relevant for base.dll (not for Mods) */ typedef void* (*FunctionPointer)(void*); // needs to be cast to/from real type! @@ -265,13 +262,15 @@ public: virtual bool SetCallback(CallbackType cbt, FunctionPointer cb, void* userArg) = 0; enum FunctionType { - // None yet.. + // the function pointer's signature is bool fn(void) - no arguments. + // it returns true if we're currently running the doom3 demo + // not relevant for mods, only for game/ aka base.dll/base.so/... + FT_IsDemo = 1, }; // returns true if that function is available in this version of dhewm3 // *out_fnptr will be the function (you'll have to cast it probably) // *out_userArg will be an argument you have to pass to the function, if appropriate (else NULL) - // NOTE: this doesn't do anything yet, but allows to add ugly mod-specific hacks without breaking the Game interface virtual bool GetAdditionalFunction(FunctionType ft, FunctionPointer* out_fnptr, void** out_userArg) = 0; };