summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioScriptObject.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-25 11:41:22 +0100
committerSergeanur <s.anureev@yandex.ua>2020-01-25 11:48:27 +0100
commitda253837d162686627c64f0faaedd5549db444da (patch)
treed061108eccd39287c37ec09aa00af1eac5298b56 /src/audio/AudioScriptObject.cpp
parentPartial CBoat (diff)
downloadre3-da253837d162686627c64f0faaedd5549db444da.tar
re3-da253837d162686627c64f0faaedd5549db444da.tar.gz
re3-da253837d162686627c64f0faaedd5549db444da.tar.bz2
re3-da253837d162686627c64f0faaedd5549db444da.tar.lz
re3-da253837d162686627c64f0faaedd5549db444da.tar.xz
re3-da253837d162686627c64f0faaedd5549db444da.tar.zst
re3-da253837d162686627c64f0faaedd5549db444da.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioScriptObject.cpp47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp
index a8c645d4..c5115ddb 100644
--- a/src/audio/AudioScriptObject.cpp
+++ b/src/audio/AudioScriptObject.cpp
@@ -1,7 +1,48 @@
#include "common.h"
+#include "patcher.h"
#include "AudioScriptObject.h"
+#include "Pools.h"
-void PlayOneShotScriptObject(uint8 id, CVector const &pos)
+void
+cAudioScriptObject::Reset()
{
- ((void (__cdecl *)(uint8, CVector const &))0x57C5F0)(id, pos);
-} \ No newline at end of file
+ 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 \ No newline at end of file