diff --git a/CommonAPI/Common/Common.vcxproj b/CommonAPI/Common/Common.vcxproj
index e7773ef..170e613 100644
--- a/CommonAPI/Common/Common.vcxproj
+++ b/CommonAPI/Common/Common.vcxproj
@@ -84,6 +84,7 @@
+
@@ -104,6 +105,7 @@
+
diff --git a/CommonAPI/Common/Common.vcxproj.filters b/CommonAPI/Common/Common.vcxproj.filters
index 22dc68d..2bbd762 100644
--- a/CommonAPI/Common/Common.vcxproj.filters
+++ b/CommonAPI/Common/Common.vcxproj.filters
@@ -69,6 +69,9 @@
Header Files
+
+ Header Files
+
@@ -125,5 +128,8 @@
Source Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/CommonAPI/Common/include/DXAPI/DXAPI.h b/CommonAPI/Common/include/DXAPI/DXAPI.h
index 93105e1..9e57c59 100644
--- a/CommonAPI/Common/include/DXAPI/DXAPI.h
+++ b/CommonAPI/Common/include/DXAPI/DXAPI.h
@@ -18,6 +18,7 @@
#include
#include
+#include
#include
#include
#include
@@ -31,7 +32,6 @@
#include
#include
#include
-
namespace DX
{
//! A typedef referring to some type of unresolved object in the game.
diff --git a/CommonAPI/Common/include/DXAPI/Move.h b/CommonAPI/Common/include/DXAPI/Move.h
new file mode 100644
index 0000000..0dd7b59
--- /dev/null
+++ b/CommonAPI/Common/include/DXAPI/Move.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include
+#include
+
+#include
+namespace DX
+{
+
+ struct Move {
+ int px;
+ int py;
+ int pz;
+ int pyaw;
+ int ppitch;
+ int proll;
+ float x;
+ float y;
+ float z;
+ float yaw;
+ float pitch;
+ float roll;
+ int unused;
+ int count;
+ bool freelook;
+ bool triggers[6];
+
+ };
+ struct AIMove {
+ unsigned int id;
+ Move move;
+ bool used;
+ };
+ float clampFloat(float in);
+ float clampMove(float in);
+ void generateNullMove(Move * ret);
+
+};
\ No newline at end of file
diff --git a/CommonAPI/Common/source/DXAPI/Move.cpp b/CommonAPI/Common/source/DXAPI/Move.cpp
new file mode 100644
index 0000000..f5464eb
--- /dev/null
+++ b/CommonAPI/Common/source/DXAPI/Move.cpp
@@ -0,0 +1,55 @@
+#include
+#define M_PI 3.14159265358979323846
+#define M_2PI 6.28318530717958647692528676655900576
+namespace DX
+{
+ void generateNullMove(Move * ret) {
+ DX::Move nullmove = {
+ 16,
+ 16,
+ 16,
+
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ 0,
+
+ 0,
+ 0,
+ false,false,false,false,false,false
+
+
+};
+ ret = &nullmove;
+ }
+ float clamp(float in, float min, float max) {
+ if (in < min) {
+ return min;
+ } else if (in > max) {
+ return max;
+ }
+ return in;
+ }
+ float clip(float n, float lower, float upper) {
+ return std::max(lower, std::min(n, upper));
+ }
+ float clampFloat(float in){
+ return clip(in,-1.0f,1.0f);
+ }
+
+ float clampMove(float in) {
+ float tmpfloat = clamp(in,-M_PI,M_PI);
+ if (tmpfloat < 0.0) {
+ return tmpfloat + M_2PI;
+ } else {
+ return tmpfloat;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp
index 5a79b86..70bc65e 100644
--- a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp
+++ b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp
@@ -20,11 +20,116 @@ BOOL APIENTRY DllMain( HMODULE hModule,
#include
#include
-
+#include
#include
+static DX::Move curmove;
+static unsigned int tmpobjptr=0;
+
extern "C"
{
+ static DX::AIMove aimoves[1024];
+
+ DX::AIMove * getAIMovePtr(unsigned int id) {
+ int moveindex=0;
+ bool foundindex=false;
+ for (int x=0; x<1024; x++) {
+ if (aimoves[x].id==id && aimoves[x].used==true) {
+ moveindex=x;
+ foundindex=true;
+ break;
+ }
+ if (aimoves[x].used==false) {
+ moveindex=x;
+ break;
+ }
+ }
+ if (foundindex==true) {
+ return &aimoves[moveindex];
+ } else {
+ aimoves[moveindex].id=id;
+ aimoves[moveindex].used=true;
+ DX::generateNullMove(&(aimoves[moveindex].move));
+ return &aimoves[moveindex];
+ }
+ }
+ DX::Move tmpmove;
+ __declspec(dllexport) void __cdecl newAIMoveListGenerator(DX::Move** moves, unsigned int * moveCount) {
+ __asm {
+ mov tmpobjptr,ecx
+ }
+
+ unsigned int * origobjptr;
+ origobjptr=(unsigned int *) tmpobjptr;
+ DX::AIMove * aimove;
+ DX::GameConnection * aiconn;
+ //Con::printf ("Possible offsets for ID starting at 0x4\n");
+ if (origobjptr !=0 ) {
+ //unsigned int * idptr;
+ //unsigned int offset=0x4;
+ //for (offset=0x4; offset<0x100; offset+=0x4) {
+
+ //idptr=(unsigned int *)((* (origobjptr))+offset);
+ //Con::printf ("Offset: %08X Addr: %08X Data: %d",offset, idptr, *idptr);
+
+ //}
+ aiconn = &DX::GameConnection((unsigned int)origobjptr+0xA0);
+ aimove = getAIMovePtr(aiconn->identifier);
+ char movecallback[120]="";
+ sprintf (movecallback,"AIMoveCallback(%d);",aiconn->identifier);
+ Con::evaluate(movecallback,false,NULL,NULL);
+ //Con::printf ("BasePointer: %08X", aiconn.base_pointer_value);
+ //Con::printf ("Ecx Value: %08X", origobjptr);
+ //Con::printf("ID: %d\n",aiconn.identifier);
+ //Con::evaluate ("listPlayers();",true,NULL,NULL);
+
+ //Con::printf("orig: %08X obj: %08X\n",origobjptr,0xBADABEEB);
+
+
+
+ //Con::printf("Move processed for %08X\n",(aicon.identifier));
+ }
+ //memcpy (&tmpmove,&(aimove->move),sizeof(DX::Move));
+ //DX::generateNullMove(&(aimove->move));
+ *moves = &(aimove->move);
+ *moveCount=1;
+ return;
+
+
+ }
+ bool consetTrigger(Linker::SimObject *obj, S32 argc, const char *argv[]) {
+ unsigned int aiconid = atoi(argv[1]);
+ unsigned int index = atoi(argv[2]);
+ if (index < 6) {
+ DX::AIMove * aimove = getAIMovePtr(aiconid);
+ bool value = dAtob(argv[3]);
+ aimove->move.triggers[index]=value;
+ return true;
+ }
+ return false;
+ }
+ bool consetMove(Linker::SimObject *obj, S32 argc, const char *argv[]) {
+ // setMove(%aicon, x, y, z, yaw, pitch, roll);
+ unsigned int aiconid = atoi(argv[1]);
+ DX::AIMove * aimove = getAIMovePtr(aiconid);
+ aimove->move.x=DX::clampFloat(atof(argv[2]));
+ aimove->move.y=DX::clampFloat(atof(argv[3]));
+ aimove->move.z=DX::clampFloat(atof(argv[4]));
+ aimove->move.yaw=DX::clampMove(atof(argv[5]));
+ aimove->move.pitch=DX::clampMove(atof(argv[6]));
+ aimove->move.roll=DX::clampMove(atof(argv[7]));
+ //Con::printf ("Set move variables for %d to x:%f y:%f z:%f yaw:%f pitch:%f roll:%f\n",aimove->id,aimove->move.x,aimove->move.y,aimove->move.z,aimove->move.yaw,aimove->move.pitch,aimove->move.roll);
+ return true;
+ }
+
+
+ bool conEnableNewAI(Linker::SimObject *obj, S32 argc, const char *argv[])
+ {
+
+ (*((unsigned int *)0x75e360))=(unsigned int)newAIMoveListGenerator;
+ return true;
+ }
+
static S32 gravid=0;
static float movespeed=0.0;
__declspec(dllexport) void ServerProcess(unsigned int deltaTime)
@@ -60,7 +165,9 @@ extern "C"
Con::addMethodB("GrenadeProjectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5);
Con::addMethodB("GameBase","setProcessTicks",&conSetProcessTicks,"Sets the flag for processing ticks or not", 3, 3);
Con::addMethodB("Projectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5);
-
+ Con::addMethodB(NULL,"enableNewAI",&conEnableNewAI,"Enables the new Move Generation code for the AI", 1,4);
+ Con::addMethodB(NULL,"setAIMove",&consetMove,"setAIMove(%aicon, x, y, z, yaw, pitch, roll)", 2,10);
+ Con::addMethodB(NULL,"setAITrigger", &consetTrigger, "setAITrigger(%aicon,triggerid,value);",2,5);
Con::addMethodS("GrenadeProjectile", "getposition", &conGrenadeProjectileGetPosition,"Accurately gets the position of the GrenadeProjectile", 2, 2);
Con::addMethodS("GrenadeProjectile", "getvelocity", &conGrenadeProjectileGetVelocity,"Gets the velocity of the GrenadeProjectile", 2, 2);
Con::addMethodB("Projectile", "makeNerf", &conProjectileMakeNerf,"Makes the Projectile deal no damage", 2, 2);
diff --git a/Mod Sources/Watchdog/Watchdog/source/dllmain.cpp b/Mod Sources/Watchdog/Watchdog/source/dllmain.cpp
index da749fb..294118a 100644
--- a/Mod Sources/Watchdog/Watchdog/source/dllmain.cpp
+++ b/Mod Sources/Watchdog/Watchdog/source/dllmain.cpp
@@ -27,6 +27,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
static bool sDogPetted = false;
static DWORD mainthreadid=0;
static bool evaldone=1;
+
void overrideputhex(unsigned char hex) {
char hexstr[40]="";
char outchar=' ';