2019-05-28 20:52:30 -04:00
|
|
|
#include "common.h"
|
2020-01-25 05:41:22 -05:00
|
|
|
#include "patcher.h"
|
2019-05-28 20:52:30 -04:00
|
|
|
#include "AudioScriptObject.h"
|
2020-01-25 05:41:22 -05:00
|
|
|
#include "Pools.h"
|
2019-05-28 20:52:30 -04:00
|
|
|
|
2020-01-25 05:41:22 -05:00
|
|
|
void
|
|
|
|
cAudioScriptObject::Reset()
|
2019-05-28 20:52:30 -04:00
|
|
|
{
|
2020-01-25 05:41:22 -05:00
|
|
|
AudioId = 125;
|
|
|
|
Posn = CVector(0.0f, 0.0f, 0.0f);
|
|
|
|
AudioEntity = AEHANDLE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
cAudioScriptObject::operator new(size_t sz)
|
|
|
|
{
|
|
|
|
return CPools::GetAudioScriptObjectPool()->New();
|
|
|
|
}
|
|
|
|
void *
|
|
|
|
cAudioScriptObject::operator new(size_t sz, int handle)
|
|
|
|
{
|
|
|
|
return CPools::GetAudioScriptObjectPool()->New(handle);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
cAudioScriptObject::operator delete(void *p, size_t sz)
|
|
|
|
{
|
|
|
|
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
cAudioScriptObject::operator delete(void *p, int handle)
|
|
|
|
{
|
|
|
|
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PlayOneShotScriptObject(uint8 id, CVector const &pos)
|
|
|
|
{
|
|
|
|
cAudioScriptObject *audioScriptObject = new cAudioScriptObject();
|
|
|
|
audioScriptObject->Posn = pos;
|
|
|
|
audioScriptObject->AudioId = id;
|
|
|
|
audioScriptObject->AudioEntity = AEHANDLE_NONE;
|
|
|
|
DMAudio.CreateOneShotScriptObject(audioScriptObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
STARTPATCHES
|
|
|
|
InjectHook(0x57C430, &cAudioScriptObject::Reset, PATCH_JUMP);
|
|
|
|
InjectHook(0x57C5F0, &PlayOneShotScriptObject, PATCH_JUMP);
|
|
|
|
ENDPATCHES
|