diff --git a/CommonAPI/Common/include/DXAPI/NetObject.h b/CommonAPI/Common/include/DXAPI/NetObject.h index f8868eb..81032b9 100644 --- a/CommonAPI/Common/include/DXAPI/NetObject.h +++ b/CommonAPI/Common/include/DXAPI/NetObject.h @@ -16,7 +16,8 @@ namespace DX { public: NetObject(unsigned int obj); - + void NetObject::setMaskBits(unsigned int bits); + void NetObject::clearMaskBits(unsigned int bits); unsigned int &net_flags; }; } // End NameSpace DX diff --git a/CommonAPI/Common/include/DXAPI/SceneObject.h b/CommonAPI/Common/include/DXAPI/SceneObject.h index f27fd40..fa5df3c 100644 --- a/CommonAPI/Common/include/DXAPI/SceneObject.h +++ b/CommonAPI/Common/include/DXAPI/SceneObject.h @@ -9,8 +9,8 @@ namespace DX { public: SceneObject(unsigned int obj); - float * SceneObject::getPosition(); - float * SceneObject::getRotation(); + void SceneObject::getPosition(float * pos); + void SceneObject::getRotation(float * rot); void SceneObject::setRotation(float []); void SceneObject::setPosition(float []); void * worldtoobj; diff --git a/CommonAPI/Common/source/DXAPI/NetObject.cpp b/CommonAPI/Common/source/DXAPI/NetObject.cpp index 22f5864..427fc16 100644 --- a/CommonAPI/Common/source/DXAPI/NetObject.cpp +++ b/CommonAPI/Common/source/DXAPI/NetObject.cpp @@ -5,5 +5,28 @@ namespace DX NetObject::NetObject(unsigned int obj) : net_flags(*(unsigned int*)(obj + 64)), SimObject(obj) { + + } + void NetObject::setMaskBits(unsigned int bits){ + unsigned int localbits=bits; + unsigned int bpv = this->base_pointer_value; + void * setmaskbitptr = (void *)(unsigned int)0x585BE0; + __asm { + push localbits + mov ecx,bpv + mov eax,setmaskbitptr + call eax + }; + } + void NetObject::clearMaskBits(unsigned int bits){ + unsigned int localbits=bits; + unsigned int bpv = this->base_pointer_value; + void * clearmaskbitptr = (void *)(unsigned int)0x585C10; + __asm { + push localbits + mov ecx,bpv + mov eax,clearmaskbitptr + call eax + }; } } \ No newline at end of file diff --git a/CommonAPI/Common/source/DXAPI/SceneObject.cpp b/CommonAPI/Common/source/DXAPI/SceneObject.cpp index 54944dd..488b150 100644 --- a/CommonAPI/Common/source/DXAPI/SceneObject.cpp +++ b/CommonAPI/Common/source/DXAPI/SceneObject.cpp @@ -3,43 +3,41 @@ namespace DX { //This is required to make these update properly over the network - //memPatch("602D1E","9090"); + //memPatch("602D19","9090"); SceneObject::SceneObject(unsigned int obj) : position(*(float*)(obj + 168), *(float*)(obj + 184), *(float*)(obj + 200)), scale(*(float*)(obj + 284), *(float*)(obj + 288), *(float*)(obj + 292)), worldtoobj((void*)(obj+0xdc)),objtoworld((void*)(obj+0x9c)),renderobjtoworld((void*)(obj+360)),renderworldtoobj((void*)(obj+424)), NetObject(obj) { } - float * SceneObject::getPosition(){ + void SceneObject::getPosition(float * pos){ if (this->base_pointer_value) { const char * results = Con::getMatrixPosition(objtoworld,NULL,0); - float pos[3]; - sscanf (results,"%g %g %g", &pos[0], &pos[1], &pos[2]); - return pos; + sscanf (results,"%f %f %f", &pos[0], &pos[1], &pos[2]); } } - float * SceneObject::getRotation(){ + void SceneObject::getRotation(float * rot){ if (this->base_pointer_value) { const char * results = Con::getMatrixRotation(objtoworld,NULL,0); - float pos[4]; - sscanf (results,"%g %g %g %g", &pos[0], &pos[1], &pos[2], &pos[3]); - return pos; + sscanf (results,"%f %f %f %f", &rot[0], &rot[1], &rot[2], &rot[3]); } } void SceneObject::setRotation(float rot []) { char arg0[128] = ""; - sprintf (arg0,"%g %g %g %g", rot[0], rot[1], rot[2], rot[3]); + sprintf (arg0,"%f %f %f %f", rot[0], rot[1], rot[2], rot[3]); char * argv[] = { &arg0[0], NULL }; int argc = 1; Con::setMatrixRotation(objtoworld,argc,(const char **)argv,NULL,0); - Con::setMatrixRotation(renderobjtoworld,argc,(const char **)argv,NULL,0); + this->setMaskBits(0x2000000); + //Con::setMatrixRotation(renderobjtoworld,argc,(const char **)argv,NULL,0); } void SceneObject::setPosition(float pos []) { char arg0[128] = ""; - sprintf (arg0,"%g %g %g", pos[0], pos[1], pos[2]); + sprintf (arg0,"%f %f %f %f", pos[0], pos[1], pos[2], 1.0f); char * argv[] = { &arg0[0], NULL }; int argc = 1; Con::setMatrixPosition(objtoworld,argc,(const char **)argv,NULL,0); - Con::setMatrixPosition(renderobjtoworld,argc,(const char **)argv,NULL,0); + this->setMaskBits(0x2000000); + //Con::setMatrixPosition(renderobjtoworld,argc,(const char **)argv,NULL,0); } } \ 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 cac7405..5a79b86 100644 --- a/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp @@ -30,16 +30,16 @@ extern "C" __declspec(dllexport) void ServerProcess(unsigned int deltaTime) { //memPatch("602D1E","9090"); - float *pos; - float *rot; + float pos[3]; + float rot[4]; if (gravid!=0) { if (movespeed != 0.0) { float timeinseconds=(deltaTime/1000.0f); void * objptr = Sim::findObject(gravid); if ((unsigned int)(objptr)) { DX::SceneObject newobj=DX::SceneObject((unsigned int)objptr); - pos=newobj.getPosition(); - rot=newobj.getRotation(); + newobj.getPosition(pos); + newobj.getRotation(rot); pos[2]+=(movespeed*timeinseconds); newobj.setPosition(pos); }