mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-01-19 18:14:44 +00:00
Added a few things that I forgot
This commit is contained in:
parent
8c1723d6ba
commit
2ee8c36a90
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue