mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-03-06 05:50:21 +00:00
Merge Bahke's latest changes in
This commit is contained in:
parent
752155db59
commit
bdca76020c
10 changed files with 351 additions and 53 deletions
|
|
@ -39,7 +39,7 @@ namespace DX
|
|||
|
||||
const char *GetModPaths(void);
|
||||
bool IsFile(const char *filename);
|
||||
|
||||
const char * StringTableInsert(const char * str,bool casesensitive) ;
|
||||
bool GetRelativePath(const char *filename, char *ret, int buffer_length);
|
||||
bool GetRunningMod(char *ret, int buffer_length);
|
||||
bool memPatch(unsigned int addr, unsigned char * data, unsigned int size);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ namespace DX
|
|||
S32 getGhostIndex(NetObject obj);
|
||||
unsigned char getGhostFrom();
|
||||
unsigned char getGhostTo();
|
||||
NetObject resolveGhostParent(S32 id);
|
||||
NetObject resolveGhost(S32 id);
|
||||
unsigned int resolveGhostParent(S32 id);
|
||||
unsigned int resolveGhost(S32 id);
|
||||
unsigned int actualbaseptr;
|
||||
GhostInfo * mGhostRefs;
|
||||
NetObject **mLocalGhosts;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ namespace DX
|
|||
|
||||
void deleteObject(void);
|
||||
const char *CallMethod(const char *name, unsigned int argc, ...);
|
||||
|
||||
const char *getFieldValue(const char *slotname);
|
||||
void setDataField(const char *slotname, const char *array, const char *value);
|
||||
const unsigned int &fieldDictionary;
|
||||
const unsigned int &identifier;
|
||||
const unsigned int base_pointer_value;
|
||||
const unsigned int &dataBlock;
|
||||
};
|
||||
} // End NameSpace DX
|
||||
|
|
@ -19,6 +19,20 @@
|
|||
|
||||
namespace DX
|
||||
{
|
||||
const char * StringTableInsert(const char * str,bool casesensitive) {
|
||||
const char* retval;
|
||||
unsigned int * StringTablePtr=(unsigned int *)0x9e618c;
|
||||
unsigned int StrTableAddr=*StringTablePtr;
|
||||
__asm {
|
||||
mov ecx,StrTableAddr
|
||||
push casesensitive
|
||||
push str
|
||||
mov eax,0x441A00
|
||||
call eax
|
||||
mov retval,eax
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
bool memPatch(unsigned int addr, unsigned char * data, unsigned int size){
|
||||
DWORD oldprotect=0;
|
||||
DWORD oldnewprotect=0;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace DX
|
|||
{
|
||||
GameBase::GameBase(unsigned int obj) : SceneObject(obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,18 +24,24 @@ namespace DX
|
|||
}
|
||||
return ghostid;
|
||||
}
|
||||
NetObject NetConnection::resolveGhostParent(S32 id) {
|
||||
unsigned int NetConnection::resolveGhostParent(S32 id) {
|
||||
if (this->getGhostFrom()) {
|
||||
if (this->mGhostRefs[id].obj)
|
||||
{
|
||||
return NetObject((unsigned int)(this->mGhostRefs[id].obj));
|
||||
return (unsigned int)(this->mGhostRefs[id].obj);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
NetObject NetConnection::resolveGhost(S32 id) {
|
||||
unsigned int NetConnection::resolveGhost(S32 id) {
|
||||
if (id == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (this->getGhostTo()) {
|
||||
return NetObject((unsigned int)this->mLocalGhosts[id]);
|
||||
if ((unsigned int)this->mLocalGhosts[id] == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return (unsigned int)this->mLocalGhosts[id];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace DX
|
||||
{
|
||||
SimObject::SimObject(unsigned int obj) : identifier(*(unsigned int*)(obj + 32)),
|
||||
SimObject::SimObject(unsigned int obj) : identifier(*(unsigned int*)(obj + 32)), fieldDictionary(*(unsigned int*)(obj + 0x2C)), dataBlock(*(unsigned int*)(obj + 0x248)),
|
||||
base_pointer_value(obj)
|
||||
{
|
||||
}
|
||||
|
|
@ -45,4 +45,39 @@ namespace DX
|
|||
|
||||
return result;
|
||||
}
|
||||
const char *SimObject::getFieldValue(const char *slotname)
|
||||
{
|
||||
void * getfieldvalueptr=(void *)0x435210;
|
||||
const char* retptr;
|
||||
void * thisptr=(void *)this->base_pointer_value;
|
||||
void * fieldDictPtr=(void*)this->fieldDictionary;
|
||||
if (this->base_pointer_value!=0 && this->fieldDictionary!=0) {
|
||||
__asm {
|
||||
push slotname
|
||||
mov ecx,fieldDictPtr
|
||||
call getfieldvalueptr
|
||||
mov retptr,eax
|
||||
};
|
||||
if (retptr != NULL) {
|
||||
return retptr;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
void SimObject::setDataField(const char *slotname, const char *array, const char *value)
|
||||
{
|
||||
void * setfieldptr=(void *)0x4364E0;
|
||||
void * retptr;
|
||||
void * thisptr=(void *)this->base_pointer_value;
|
||||
__asm {
|
||||
push value
|
||||
push array
|
||||
push slotname
|
||||
mov ecx,thisptr
|
||||
call setfieldptr
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,11 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma check_stack(off)
|
||||
#include <LinkerAPI.h>
|
||||
#ifdef NEW_DB_CODE
|
||||
#undef NEW_DB_CODE
|
||||
#endif
|
||||
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[]);
|
||||
|
|
@ -22,7 +25,7 @@ const char *conGetAddressDec(Linker::SimObject *obj, S32 argc, const char *argv[
|
|||
const char *conDumpHex(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
||||
const char *conDumpUInt(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
||||
const char *conDumpFloat(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
||||
|
||||
const char *conFloatToHex(Linker::SimObject *obj, S32 argc, const char *argv[]);
|
||||
// Player Commands -----------------------------------
|
||||
bool conPlayerGetJumpingState(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||
bool conPlayerGetJettingState(Linker::SimObject *obj, S32 argc, const char* argv[]);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ const char *conDumpFloat(Linker::SimObject *obj, S32 argc, const char *argv[])
|
|||
return result;
|
||||
|
||||
}
|
||||
const char *conFloatToHex(Linker::SimObject *obj, S32 argc, const char *argv[])
|
||||
{
|
||||
char result[256];
|
||||
float input=atof(argv[1]);
|
||||
float * inputptr=&input;
|
||||
void * inputptr2 = (void *)inputptr;
|
||||
unsigned int * inputptr3=(unsigned int*)inputptr2;
|
||||
sprintf (result,"%08X",*inputptr3);
|
||||
return result;
|
||||
}
|
||||
const char *conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[])
|
||||
{
|
||||
// Hmm...
|
||||
|
|
@ -104,6 +114,9 @@ bool conProjectileMakeNerf(Linker::SimObject *obj, S32 argc, const char* argv[])
|
|||
return true;
|
||||
}
|
||||
bool conForceUpdate(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||
if (obj == NULL || (unsigned int)Sim::findObjectc(argv[2]) == NULL) {
|
||||
return 0;
|
||||
}
|
||||
DX::NetConnection conn = DX::NetConnection((unsigned int)obj);
|
||||
DX::NetObject netobj = DX::NetObject((unsigned int)Sim::findObjectc(argv[2]));
|
||||
GhostInfo * mGhostRefs=conn.mGhostRefs;
|
||||
|
|
@ -120,35 +133,64 @@ bool conForceUpdate(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
|||
}
|
||||
}
|
||||
const char* conGetGhostIndex(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||
char outint[20]="";
|
||||
char outint[20]="4231";
|
||||
char returnvar[255]="";
|
||||
Con::printf("%s\n",argv[2]);
|
||||
unsigned int objptr2=(unsigned int)Sim::findObjectc(argv[2]);
|
||||
if ((unsigned int)obj == NULL || objptr2==NULL) {
|
||||
strcpy(returnvar,"-1");
|
||||
return returnvar;
|
||||
}
|
||||
DX::NetConnection conn = DX::NetConnection((unsigned int)obj);
|
||||
DX::NetObject netobj = DX::NetObject((unsigned int)Sim::findObjectc(argv[2]));
|
||||
char aicommand[255]="";
|
||||
sprintf (aicommand,"return (%d.isAIControlled());",conn.identifier);
|
||||
if (dAtob(Con::evaluate(aicommand,false,NULL,false))==true) {
|
||||
strcpy(returnvar,"-1");
|
||||
return returnvar;
|
||||
}
|
||||
char command[255]="";
|
||||
sprintf (command,"return (%d.getAddress());",conn.identifier);
|
||||
if (strcmp(Con::evaluate(command,false,NULL,false),"local")==0) {
|
||||
strncpy(returnvar,argv[2],255);
|
||||
returnvar[255]=0x0;
|
||||
return returnvar;
|
||||
}
|
||||
|
||||
DX::NetObject netobj = DX::NetObject(objptr2);
|
||||
if (netobj.base_pointer_value!=0) {
|
||||
S32 index = conn.getGhostIndex(netobj);
|
||||
Con::printf("%d",index);
|
||||
itoa(index,outint,10);
|
||||
return outint;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
const char* conResolveGhost(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||
char outint[20]="";
|
||||
if (obj==NULL) {
|
||||
return "";
|
||||
}
|
||||
DX::NetConnection conn = DX::NetConnection((unsigned int)obj);
|
||||
S32 id = atoi(argv[2]);
|
||||
DX::NetObject realobject = conn.resolveGhost(id);
|
||||
if (realobject.base_pointer_value) {
|
||||
return itoa(realobject.identifier,outint,10);
|
||||
if (id==-1) {
|
||||
return "";
|
||||
}
|
||||
if (conn.resolveGhost(id)!=NULL) {
|
||||
itoa(DX::NetObject(conn.resolveGhost(id)).identifier,outint,10);
|
||||
return outint;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
const char* conResolveGhostParent(Linker::SimObject *obj, S32 argc, const char* argv[]) {
|
||||
char outint[20]="";
|
||||
if (((unsigned int)obj)==NULL) {
|
||||
return "";
|
||||
}
|
||||
DX::NetConnection conn = DX::NetConnection((unsigned int)obj);
|
||||
S32 ghostindex = atoi(argv[2]);
|
||||
if (conn.base_pointer_value!=0) {
|
||||
if (conn.resolveGhostParent(ghostindex).base_pointer_value)
|
||||
if (conn.resolveGhostParent(ghostindex))
|
||||
{
|
||||
S32 objid = conn.resolveGhostParent(ghostindex).identifier;
|
||||
S32 objid = DX::NetObject(conn.resolveGhostParent(ghostindex)).identifier;
|
||||
if (objid != 0) {
|
||||
itoa(objid,outint,10);
|
||||
return outint;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <Windows.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
//#define TORNADO_ENABLE
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
|
|
@ -25,8 +26,9 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
|||
#include <DXConCmds.h>
|
||||
static DX::Move curmove;
|
||||
static unsigned int tmpobjptr=0;
|
||||
unsigned char movemem[500];
|
||||
static DX::Move mechchangedmove;
|
||||
static char test[100];
|
||||
static DX::Move *mechchangedmove;
|
||||
static char test2[100];
|
||||
static void * moveptrmech;
|
||||
unsigned int updatemoveretptr=0x5d2d7c;
|
||||
float maxrot=2.9;
|
||||
|
|
@ -37,9 +39,164 @@ static float turnStrength = 1.0;
|
|||
extern "C"
|
||||
{
|
||||
static DX::AIMove aimoves[1024];
|
||||
|
||||
#define MECH_TURNING_SPEED 0.4
|
||||
static char command[256]="";
|
||||
static const char * dataBlock;
|
||||
static char buf[256]="";
|
||||
//#define MECH_TURNING_SPEED 0.4
|
||||
|
||||
// Maximum radians per 32ms tick
|
||||
void * readIntptr=(void *)0x43BF10;
|
||||
void * writeIntptr=(void *)0x43BF60;
|
||||
void * writeStringptr=(void *)0x43C6D0;
|
||||
void * readStringptr=(void *)0x43C630;
|
||||
int streamReadInt(void * stream,int bitcount) {
|
||||
int retvalue=0x0;
|
||||
__asm {
|
||||
mov ecx,stream
|
||||
push bitcount
|
||||
call readIntptr
|
||||
mov retvalue,eax
|
||||
}
|
||||
return retvalue;
|
||||
}
|
||||
void streamWriteInt(void * stream,int value,int bitcount) {
|
||||
__asm {
|
||||
mov ecx,stream
|
||||
push bitcount
|
||||
push value
|
||||
call writeIntptr
|
||||
}
|
||||
return;
|
||||
}
|
||||
void streamWriteString(void * stream,const char * stringvar,int maxlen) {
|
||||
__asm {
|
||||
mov ecx,stream
|
||||
push maxlen
|
||||
push stringvar
|
||||
call writeStringptr
|
||||
}
|
||||
return;
|
||||
}
|
||||
void streamReadString(void * stream,char *stringvar) {
|
||||
__asm {
|
||||
mov ecx,stream
|
||||
push stringvar
|
||||
call readStringptr
|
||||
}
|
||||
return;
|
||||
}
|
||||
static char fieldnames[127][256];
|
||||
static char fieldvalues[127][256];
|
||||
static DX::Player *playervar;
|
||||
static DX::SimObject *playerdatavar;
|
||||
unsigned int gamebaseretptr=0x5E2A13;
|
||||
unsigned int gboaparentptr=0x58c1e0;
|
||||
static DX::GameBase *gb;
|
||||
static DX::SimObject * gbdb;
|
||||
static const char * gbfieldvalue;
|
||||
void __declspec (naked) GameBaseOnAddHook() {
|
||||
void * gamebaseptr;
|
||||
__asm {
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
push ebx
|
||||
push esi
|
||||
mov esi,ecx
|
||||
mov gamebaseptr,esi
|
||||
call [gboaparentptr]
|
||||
test al,al
|
||||
jz gboaparentfailed
|
||||
mov edx,[esi+0x248]
|
||||
test edx,edx
|
||||
jnz gboaworked
|
||||
gboaparentfailed:
|
||||
lea esp,[ebp-0x8]
|
||||
xor al,al
|
||||
pop esi
|
||||
pop ebx
|
||||
pop ebp
|
||||
retn
|
||||
gboaworked:
|
||||
pushad
|
||||
};
|
||||
gb = &DX::GameBase((unsigned int)gamebaseptr);
|
||||
gbdb = &DX::SimObject(gb->dataBlock);
|
||||
gbfieldvalue=gbdb->getFieldValue(DX::StringTableInsert("subClass",false));
|
||||
if (gbfieldvalue!=NULL) {
|
||||
#ifdef TORNADO_ENABLE
|
||||
if (stricmp(gbfieldvalue,"tornado")==0) {
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
__asm {
|
||||
popad
|
||||
jmp [gamebaseretptr]
|
||||
}
|
||||
|
||||
}
|
||||
void DBpackData(void *stream) {
|
||||
void* thisptr;
|
||||
__asm {
|
||||
mov thisptr,ecx
|
||||
};
|
||||
DX::SimObject dbobj = DX::SimObject((unsigned int)thisptr);
|
||||
char readcommand[255]="";
|
||||
sprintf (readcommand,"return getWordCount(%d.extraNetFields);",dbobj.identifier);
|
||||
char str[255]="";
|
||||
strncpy(str,Con::evaluate(readcommand,false,NULL,true),254);
|
||||
Con::printf ("GWC returned %s\n",str);
|
||||
int realcount=atoi(str);
|
||||
int i=0;
|
||||
int counter=0;
|
||||
for (i; (i<126 && i<realcount); i++) {
|
||||
sprintf (readcommand,"return getWord(%d.extraNetFields,%d);",dbobj.identifier,i);
|
||||
strncpy(fieldnames[i],Con::evaluate(readcommand,false,NULL,true),254);
|
||||
Con::printf (fieldnames[i]);
|
||||
_snprintf (readcommand,255,"return(%d.%s);",dbobj.identifier,fieldnames[i]);
|
||||
strncpy(fieldvalues[i],Con::evaluate(readcommand,false,NULL,true),254);
|
||||
strcpy(buf,dbobj.getFieldValue(DX::StringTableInsert(fieldnames[i],false)));
|
||||
Con::printf ("fieldvalues[i]:%s GDF: %s\n",fieldvalues[i],buf);
|
||||
|
||||
}
|
||||
counter=i;
|
||||
Con::printf("Sending %d extra fields",counter);
|
||||
streamWriteInt(stream,counter,7);
|
||||
for (int x=0; x < counter; x++ ) {
|
||||
streamWriteString(stream,fieldnames[x],254);
|
||||
streamWriteString(stream,fieldvalues[x],254);
|
||||
}
|
||||
|
||||
}
|
||||
void DBunpackData(void *stream) {
|
||||
void* thisptr;
|
||||
__asm {
|
||||
mov thisptr,ecx
|
||||
};
|
||||
|
||||
char setcommand[255]="";
|
||||
DX::SimObject dbobj = DX::SimObject((unsigned int)thisptr);
|
||||
int counter=streamReadInt(stream,7);
|
||||
char buf[256]="";
|
||||
Con::printf ("Receiving %d extra fields",counter);
|
||||
for (int i=0; i < counter; i++) {
|
||||
streamReadString(stream,buf);
|
||||
strcpy(fieldnames[i],buf);
|
||||
streamReadString(stream,buf);
|
||||
strcpy(fieldvalues[i],buf);
|
||||
}
|
||||
for (int i=0; i < counter; i++ ){
|
||||
Con::printf (fieldnames[i]);
|
||||
Con::printf (fieldvalues[i]);
|
||||
dbobj.setDataField(DX::StringTableInsert(fieldnames[i],false),NULL,fieldvalues[i]);
|
||||
//_snprintf (setcommand,255,"%d.%s=\"%s\";",dbobj.identifier,fieldnames[i],fieldvalues[i]);
|
||||
//Con::evaluate(setcommand,false,NULL,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float MECH_TURNING_SPEED=0.4;
|
||||
static unsigned int playerptr2;
|
||||
__declspec(naked) void updateMoveHook()
|
||||
{
|
||||
// this gets run from 0x5D2D6E
|
||||
|
|
@ -48,41 +205,57 @@ __declspec(naked) void updateMoveHook()
|
|||
mov playerptr,ebx
|
||||
mov eax,[ebp+0x8]
|
||||
mov moveptrmech,eax
|
||||
pusha
|
||||
};
|
||||
MECH_TURNING_SPEED=0.4;
|
||||
//=NULL;
|
||||
unsigned int dbptr;
|
||||
if (playerptr!=0) {
|
||||
playervar=&DX::Player(playerptr);
|
||||
mechchangedmove=(DX::Move*) moveptrmech;
|
||||
//_snprintf (command,255,"return(%d.getDataBlock());",playervar->identifier);
|
||||
//strncpy(buf,Con::evaluate(command,false,NULL,true),255);
|
||||
if (playervar->dataBlock!=NULL) {
|
||||
|
||||
unsigned playerptr2;
|
||||
DX::Player *playervar;
|
||||
playerptr2=playerptr;
|
||||
playervar=&(DX::Player(playerptr2));
|
||||
memcpy((void *)&mechchangedmove,(void *)(moveptrmech),sizeof(DX::Move));
|
||||
playerdatavar = &DX::SimObject(playervar->dataBlock);
|
||||
//Con::printf("Datablock is %s\n",buf);
|
||||
if (playerdatavar->base_pointer_value!=0) {
|
||||
strcpy(buf,playerdatavar->getFieldValue(DX::StringTableInsert("mechControlEnabled",false)));
|
||||
Con::printf("mechControlEnabled: %s",buf);
|
||||
if ((mechchangedmove)->freelook && ((mechchangedmove)->y>0.0) && dAtob(buf))
|
||||
{
|
||||
//sprintf (command,"return (%d.getDataBlock().mechTurnSpeed);",playervar->identifier);
|
||||
strcpy(buf,playerdatavar->getFieldValue(DX::StringTableInsert("mechTurnSpeed",false)));
|
||||
Con::printf("mechTurnSpeed: %s",buf);
|
||||
MECH_TURNING_SPEED=atof(buf);
|
||||
// FIXME: The 3 here should reference the datablock's maximum turning angle -- we're essentially normalizing our rotation here.
|
||||
// FIXME: The 3 here should reference the datablock's maximum turning angle -- we're essentially normalizing our rotation here.
|
||||
float turnStrength = playervar->headRotationZ / 3;
|
||||
// Use whatever is leftover in our forward movement
|
||||
float forwardStrength = 1 - fabs(turnStrength);
|
||||
// Calculate a new turn value that we use for both the main body and the head.
|
||||
float newTurn = turnStrength * MECH_TURNING_SPEED;
|
||||
float newHeadTurn = turnStrength * (MECH_TURNING_SPEED/20);
|
||||
|
||||
if (dAtob((playervar->CallMethod("isMechControlEnabled",0))) && mechchangedmove.freelook && (mechchangedmove.y>0.0))
|
||||
{
|
||||
// FIXME: The 3 here should reference the datablock's maximum turning angle -- we're essentially normalizing our rotation here.
|
||||
float turnStrength = playervar->headRotationZ / 3;
|
||||
// Use whatever is leftover in our forward movement
|
||||
float forwardStrength = 1 - fabs(turnStrength);
|
||||
// Calculate a new turn value that we use for both the main body and the head.
|
||||
float newTurn = turnStrength * MECH_TURNING_SPEED;
|
||||
float newHeadTurn = turnStrength * (MECH_TURNING_SPEED/20);
|
||||
(mechchangedmove)->y = forwardStrength;
|
||||
(mechchangedmove)->x += turnStrength;
|
||||
// FIXME: Is the yaw value definitely in radians?
|
||||
playervar->mRotZ += newTurn + (mechchangedmove)->yaw;
|
||||
|
||||
mechchangedmove.y = forwardStrength;
|
||||
mechchangedmove.x += turnStrength;
|
||||
// FIXME: Is the yaw value definitely in radians?
|
||||
playervar->mRotZ += newTurn + mechchangedmove.yaw;
|
||||
// Now, we must translate the turning strength into an appropriate subtraction for our
|
||||
// head rotation.
|
||||
playervar->headRotationZ += -newTurn;
|
||||
|
||||
// Now, we must translate the turning strength into an appropriate subtraction for our
|
||||
// head rotation.
|
||||
playervar->headRotationZ += -newTurn;
|
||||
|
||||
mechchangedmove.pitch = 0;
|
||||
mechchangedmove.yaw = 0;
|
||||
mechchangedmove.roll = 0;
|
||||
mechchangedmove.freelook = true;
|
||||
(mechchangedmove)->pitch = 0;
|
||||
(mechchangedmove)->yaw = 0;
|
||||
(mechchangedmove)->roll = 0;
|
||||
(mechchangedmove)->freelook = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
__asm {
|
||||
mov eax,offset mechchangedmove
|
||||
mov [ebp+8],eax
|
||||
popa
|
||||
mov ebx,playerptr
|
||||
mov eax,[ebp+8]
|
||||
mov edx,[eax]
|
||||
|
|
@ -214,6 +387,7 @@ __declspec(naked) void updateMoveHook()
|
|||
|
||||
}
|
||||
}
|
||||
static unsigned int gboaptr =(unsigned int ) &GameBaseOnAddHook;
|
||||
__declspec(dllexport) void ModInitialize(void)
|
||||
{
|
||||
// Init WSA
|
||||
|
|
@ -262,6 +436,7 @@ __declspec(naked) void updateMoveHook()
|
|||
Con::addMethodS("NetConnection","getGhostIndex", &conGetGhostIndex, "Gets a ghost index for an object id", 3, 3);
|
||||
Con::addMethodB("NetConnection","forceUpdate", &conForceUpdate,"Forces an initial update for an object id", 3, 3);
|
||||
Con::addMethodS("NetConnection","resolveGhostParent",&conResolveGhostParent,"Resolves a ghost index parent", 3, 3);
|
||||
Con::addMethodS(NULL,"floatToHex",&conFloatToHex,"converts float to hex",2,3);
|
||||
Con::addMethodS("NetConnection","resolveGhost",&conResolveGhost,"Resolves an object from a ghost ID for ServerConnection", 3, 3);
|
||||
Con::addMethodB(NULL,"clientCmdSetGhostTicks",&conclientCmdSetGhostTicks,"Client Command for disabling tick processing on ghost index",2,10);
|
||||
Con::addMethodB(NULL,"clientCmdsetProcessTicks",&conclientCmdSetProcessTicks,"Client Command for disabling tick processing on ghost object",2,10);
|
||||
|
|
@ -278,8 +453,27 @@ __declspec(naked) void updateMoveHook()
|
|||
Con::addVariable("$TSExtension::UberId",TypeS32, &gravid);
|
||||
Con::addVariable("$TSExtension::isActive", TypeBool, &is_active);
|
||||
char mechcode[8]="\xA1\xAA\xAA\xAA\xAA\xFF\xE0";
|
||||
|
||||
char dbrwcode[8]="\xC7\x42\x18\x80\x01\x00\x00";
|
||||
char dbpack[8]= "\xB8\xAA\xAA\xAA\xAA\xFF\xE0";
|
||||
char dbunpack[8]="\xB8\xAA\xAA\xAA\xAA\xFF\xE0";
|
||||
char dbpatch3[8]="\xC7\x42\x18\x80\x01\x00\x00";
|
||||
char dbclient2[2]="\xEB";
|
||||
char dbclient[3]="\x90\x90";
|
||||
char gboaonadd[8]="FF\x25\xAA\xAA\xAA\xAA";
|
||||
//memPatch("42e05f",
|
||||
*((unsigned int*)(mechcode+1))=(unsigned int)&updatemovehookptr;
|
||||
*((unsigned int*)(dbpack+1))=(unsigned int)&DBpackData;
|
||||
*((unsigned int*)(dbunpack+1))=(unsigned int)&DBunpackData;
|
||||
*((unsigned int*)(gboaonadd+2))=(unsigned int)&gboaptr;
|
||||
#ifdef NEW_DB_CODE
|
||||
DX::memPatch(0x5D2D6E,(unsigned char *)mechcode,7);
|
||||
DX::memPatch(0x438415,(unsigned char *)dbrwcode,7);
|
||||
DX::memPatch(0x436DF0,(unsigned char *)dbpack,7);
|
||||
DX::memPatch(0x436E00,(unsigned char *)dbunpack,7);
|
||||
DX::memPatch(0x42e05f,(unsigned char *)dbclient,2);
|
||||
DX::memPatch(0x66E1ED,(unsigned char *)dbclient2,1);
|
||||
DX::memPatch(0x438415,(unsigned char *)dbpatch3,7);
|
||||
DX::memPatch(0x5E29F0,(unsigned char *)gboaonadd,7);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue