mahlendur/_work/Data/Scripts/Content/neclib/General.d
Daniel Heße 892a40ff0f Initial commit with Subversion-codebase from 13/05/2022.
Cleaned up the mess, at this time, only viable data get synced (_work directory for Gothic-data, miranda for mdc-scripts.
Need to symlink files to a working directory.
2022-05-13 17:38:52 +02:00

72 lines
No EOL
2.2 KiB
D

const string NEC_relativeLibraryPath = ".\neclib\neclib.dll";
// flags for lib config
const int NEC_DII = 1 << 0;
const int NEC_LEVITATION = 1 << 1;
const int NEC_TELEKINESIS = 1 << 2;
const int NEC_ALL = NEC_DII | NEC_LEVITATION | NEC_TELEKINESIS;
// Keeps track of initialized modules
const int NEC_Init_Modules = 0;
// *****************************************************************
// Provides the version number of the DynItemInst_Ikarus library.
// Important: The version number is a float digit, that is returned
// as an integer. Therefore you should use this function along with
// e.g. the float package of Ikarus.
// *****************************************************************
FUNC INT NEC_GetLibVersion() {
var int adr;
adr = GetProcAddress (LoadLibrary (NEC_relativeLibraryPath), "GetLibVersion");
//library couldn't be found?
if (!adr) {
MEM_Error(ConcatStrings("neclib: NEC_GetLibVersion(): Library couldn't be loaded: ", NEC_relativeLibraryPath));
return 0;
};
var int ret;
CALL_RetValIsFloat();
CALL_PutRetValTo(_@(ret));
CALL__cdecl(adr);
return +ret;
};
// ****************************************************************
// Returns the expected version of the used DynItemInst_Ikarus.dll.
// The return value will be float stored in an integer.
// ****************************************************************
FUNC INT _NEC_GetExpectedLibVersion() {
//expected lib version: 1.03
var int integral;
var int fraction;
integral = mkf(1);
fraction = divf(3, 100);
return addf(integral, fraction);
};
//.text:006BCEF0 ; public: int __thiscall oCNpc::CanTalk(void)
func int oCNpcCanTalk(var C_NPC npc) {
const int adr = 7065328;
var int ret;
CALL_PutRetValTo(_@(ret));
CALL__thiscall(_@(npc), adr);
return +ret;
};
//.text:00602930 ; public: void __thiscall zCVob::SetSleeping(int)
func void zCVobSetSleeping(var int czvobPtr, var int setToSleep) {
const int adr = 6302000;
CALL_IntParam(setToSleep);
CALL__thiscall(czvobPtr, adr);
};
//.text:0061D190 ; public: void __thiscall zCVob::SetPhysicsEnabled(int)
func void zCVobSetPhysicsEnabled(var int czvobPtr, var int enablePhysics) {
const int adr = 6410640;
CALL_IntParam(enablePhysics);
CALL__thiscall(czvobPtr, adr);
};