cleaned up patching of virtual functions; started CAutomobile

This commit is contained in:
aap
2019-07-08 08:46:42 +02:00
parent 6ec421fe7b
commit 12af85ca3d
64 changed files with 771 additions and 278 deletions

13
src/core/Instance.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "common.h"
#include "patcher.h"
#include "Instance.h"
class CInstance_ : public CInstance
{
public:
void dtor() { CInstance::~CInstance(); }
};
STARTPATCHES
InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP);
ENDPATCHES

10
src/core/Instance.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include "Placeable.h"
// unused
class CInstance : CPlaceable
{
public:
};

View File

@ -63,9 +63,17 @@ CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float
z1 <= GetPosition().z && GetPosition().z <= z2;
}
class CPlaceable_ : public CPlaceable
{
public:
CPlaceable *ctor(void) { return ::new (this) CPlaceable(); }
void dtor(void) { CPlaceable::~CPlaceable(); }
};
STARTPATCHES
InjectHook(0x49F9A0, &CPlaceable::ctor, PATCH_JUMP);
InjectHook(0x49F9E0, &CPlaceable::dtor, PATCH_JUMP);
InjectHook(0x49F9A0, &CPlaceable_::ctor, PATCH_JUMP);
InjectHook(0x49F9E0, &CPlaceable_::dtor, PATCH_JUMP);
InjectHook(0x49FA00, &CPlaceable::SetHeading, PATCH_JUMP);
InjectHook(0x49FA50, (bool (CPlaceable::*)(float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP);
InjectHook(0x49FAF0, (bool (CPlaceable::*)(float, float, float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP);

View File

@ -19,8 +19,5 @@ public:
void SetHeading(float angle);
bool IsWithinArea(float x1, float y1, float x2, float y2);
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
CPlaceable *ctor(void) { return ::new (this) CPlaceable(); }
void dtor(void) { this->CPlaceable::~CPlaceable(); }
};
static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");