mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-02-23 08:33:37 +00:00
ModLoader sources didn't add?
This commit is contained in:
parent
44e5f33ee7
commit
c1e04ef0a6
13 changed files with 582 additions and 1 deletions
84
ModLoader/source/t2ConCmds.cpp
Executable file
84
ModLoader/source/t2ConCmds.cpp
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* t2ConCmds.cpp
|
||||
* Original code by Linker
|
||||
* Modified by Robert MacGregor
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "t2ConCmds.h"
|
||||
|
||||
// Linker's implementations
|
||||
const char* conGuiTsCtrlProject(SimObject *obj,S32 argc, const char* argv[]) {
|
||||
Point3F pt;
|
||||
Point3F rt;
|
||||
dSscanf(argv[2],"%g %g %g",&pt.x,&pt.y,&pt.z);
|
||||
GuiTSCtrl_project(reinterpret_cast<GuiTSCtrl *>(obj),pt,&rt);
|
||||
|
||||
char* buffer = Con::getReturnBuffer(255);
|
||||
dSprintf(buffer,255,"%g %g %g",rt.x,rt.y,rt.z);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool conNetObjectSetGhostable(SimObject *obj,S32 argc, const char* argv[]) {
|
||||
if (dAtob(argv[2])) {
|
||||
__asm {
|
||||
push ecx
|
||||
mov ecx, [obj]
|
||||
mov eax,[ecx+40h]
|
||||
or eax, 100h
|
||||
mov [ecx+40h], eax
|
||||
pop ecx
|
||||
}
|
||||
} else {
|
||||
__asm {
|
||||
xor eax, eax
|
||||
or eax, 100h
|
||||
not eax
|
||||
push ecx
|
||||
mov ecx,[obj]
|
||||
and eax, [ecx+40h]
|
||||
mov [ecx+40h],eax
|
||||
push 40h
|
||||
mov eax, 0x585BE0
|
||||
call eax
|
||||
pop ecx
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* conGetVariable(SimObject *obj,S32 argc, const char* argv[]) {
|
||||
return Con::getVariable(argv[1]);
|
||||
}
|
||||
|
||||
// Mod Loader Implementation
|
||||
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
||||
{
|
||||
typedef void (*LPMODINIT)(void);
|
||||
HINSTANCE hDLL = NULL;
|
||||
LPMODINIT lpInitMod = NULL;
|
||||
|
||||
std::string raw = argv[1];
|
||||
|
||||
std::wstring input(raw.begin(), raw.end());
|
||||
std::wstring modification = L"mods/";
|
||||
modification += input;
|
||||
modification += L".dll";
|
||||
|
||||
hDLL = LoadLibrary(modification.c_str()); // AfxLoadLibrary is probably better.
|
||||
|
||||
if (hDLL == NULL)
|
||||
return false; // The DLL doesn't exist
|
||||
else
|
||||
lpInitMod = (LPMODINIT)GetProcAddress(hDLL, "?ModInitialize@@YAXXZ"); // Attempt to load our entry point
|
||||
|
||||
if (lpInitMod == NULL)
|
||||
return false; // Unable to load entry point
|
||||
else
|
||||
lpInitMod(); // The function was loaded, call TribesNext and move on to postTN Startup
|
||||
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue