Added a few things that I forgot

This commit is contained in:
Calvin Balke 2015-06-30 15:52:39 -07:00
parent 8c1723d6ba
commit 2ee8c36a90
5 changed files with 42 additions and 20 deletions

View file

@ -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
};
}
}

View file

@ -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);
}
}