Added a working setMaskBits and a cloaking test command

This commit is contained in:
Calvin Balke 2015-03-28 21:04:07 -07:00
parent 4c716d90c8
commit 831d49cc20
6 changed files with 30 additions and 4 deletions

View file

@ -8,8 +8,10 @@ namespace DX
{ {
public: public:
ShapeBase(unsigned int obj); ShapeBase(unsigned int obj);
float &cloak_level;
bool &cloaked;
//! Heat Level //! Heat Level
float &heat_level; float &heat_level;
void setMaskBits(int value);
}; };
} // End NameSpace DX } // End NameSpace DX

View file

@ -14,6 +14,7 @@
#include <LinkerAPI.h> #include <LinkerAPI.h>
void serverProcessReplacement(unsigned int timeDelta) ; void serverProcessReplacement(unsigned int timeDelta) ;
bool conShapeBaseSetCloakValue(Linker::SimObject *obj, S32 argc, const char* argv[]);
const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]); const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]);
// Returns the address of an object in memory // Returns the address of an object in memory
const char* conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[]); const char* conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[]);

View file

@ -1,9 +1,21 @@
#include <DXAPI/ShapeBase.h> #include <DXAPI/ShapeBase.h>
#define CloakMask 0x40
namespace DX namespace DX
{ {
ShapeBase::ShapeBase(unsigned int obj) : GameBase(obj), ShapeBase::ShapeBase(unsigned int obj) : GameBase(obj),
heat_level(*(float*)(obj + 1972)) heat_level(*(float*)(obj + 1972)), cloak_level(*(float*)(obj+0x810)), cloaked(*(bool*)(obj+0x80D))
{ {
} }
void ShapeBase::setMaskBits(int value){
unsigned int addr=this->base_pointer_value;
unsigned int bits=value;
unsigned int funcaddr=0x585BE0;
__asm {
mov eax,bits
push eax
mov ecx,addr
mov eax,funcaddr
call eax
};
}
} }

View file

@ -42,7 +42,18 @@ const char *conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[])
sprintf(result, "%x", obj); sprintf(result, "%x", obj);
return result; return result;
} }
bool conShapeBaseSetCloakValue(Linker::SimObject *obj, S32 argc, const char* argv[])
{
DX::ShapeBase operand = DX::ShapeBase((unsigned int)obj);
operand.cloaked=dAtob(argv[2]);
if (operand.cloaked==true) {
operand.cloak_level=atof(argv[3]);
} else {
operand.cloak_level=atof(argv[3]);
}
operand.setMaskBits(0x40);
}
bool conPlayerGetJumpingState(Linker::SimObject *obj, S32 argc, const char* argv[]) bool conPlayerGetJumpingState(Linker::SimObject *obj, S32 argc, const char* argv[])
{ {
DX::Player operand = DX::Player((unsigned int)obj); DX::Player operand = DX::Player((unsigned int)obj);

View file

@ -34,7 +34,7 @@ extern "C"
Con::addMethodB("Player", "isjumping", &conPlayerGetJumpingState,"Returns whether or not the player is jumping", 2, 2); Con::addMethodB("Player", "isjumping", &conPlayerGetJumpingState,"Returns whether or not the player is jumping", 2, 2);
Con::addMethodB("Player", "isjetting", &conPlayerGetJettingState,"Returns whether or not the player is jetting", 2, 2); Con::addMethodB("Player", "isjetting", &conPlayerGetJettingState,"Returns whether or not the player is jetting", 2, 2);
Con::addMethodB("GameConnection", "setheat", &conGameConnectionSetHeatLevel,"Sets the heat level", 3, 3); Con::addMethodB("GameConnection", "setheat", &conGameConnectionSetHeatLevel,"Sets the heat level", 3, 3);
Con::addMethodB("ShapeBase","setcloakvalue",&conShapeBaseSetCloakValue,"Sets the cloak value ex: setcloakvalue(1,0.5)",3,4);
Con::addMethodB("GrenadeProjectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5); 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("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("Projectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5);