summaryrefslogtreecommitdiff
path: root/src/objects/DummyObject.cpp
blob: ba09ac3e8b860d6d047d8f3efc4a2e2ce2c00f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "common.h"
#include "patcher.h"
#include "DummyObject.h"
#include "Pools.h"

CDummyObject::CDummyObject(CObject *obj)
{
	SetModelIndexNoCreate(obj->GetModelIndex());
	if(obj->m_rwObject)
		AttachToRwObject(obj->m_rwObject);
	obj->DetachFromRwObject();
	m_level = obj->m_level;
}

#include <new>

class CDummyObject_ : public CDummyObject
{
public:
	void dtor(void) { CDummyObject::~CDummyObject(); }
	CDummyObject *ctor(void) { return ::new (this) CDummyObject(); }
	CDummyObject *ctor(CObject *obj) { return ::new (this) CDummyObject(obj); }
};

STARTPATCHES
	InjectHook(0x4BAAF0, (CDummyObject* (CDummyObject::*)(void)) &CDummyObject_::ctor, PATCH_JUMP);
	InjectHook(0x4BAB10, (CDummyObject* (CDummyObject::*)(CObject*)) &CDummyObject_::ctor, PATCH_JUMP);
	InjectHook(0x4BAB70, &CDummyObject_::dtor, PATCH_JUMP);
ENDPATCHES