summaryrefslogtreecommitdiff
path: root/csrc/media_init.c
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-08-28 10:38:31 +0800
committerIru Cai <mytbk920423@gmail.com>2018-08-28 10:38:31 +0800
commit44dd43bd73af28df7bd7afd8374c0a449cea6870 (patch)
tree673cbde37c2cbc73ed31387fd0e42e2a8f507060 /csrc/media_init.c
parent17f4aa710c5c6241343a3e01dd9a4931c812536c (diff)
downloadrich4-44dd43bd73af28df7bd7afd8374c0a449cea6870.tar.xz
load_sound_from_mkf
Diffstat (limited to 'csrc/media_init.c')
-rw-r--r--csrc/media_init.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/csrc/media_init.c b/csrc/media_init.c
index dc0eafe..abac41d 100644
--- a/csrc/media_init.c
+++ b/csrc/media_init.c
@@ -40,7 +40,7 @@ struct riff_header
struct riff_chunk chunk1;
};
-LPDIRECTSOUNDBUFFER* fcn_00453dcf(void *a1)
+LPDIRECTSOUNDBUFFER* dsound_load_wav(void *a1)
{
struct riff_header *wvbuf = (struct riff_header*)a1;
struct riff_chunk *aubuf;
@@ -121,7 +121,7 @@ void fcn_004541e3()
break;
data = read_mkf(mkf_effect, t, NULL, NULL);
- ptr[1] = fcn_00453dcf(data);
+ ptr[1] = dsound_load_wav(data);
free(data);
ptr += 2;
}
@@ -221,6 +221,27 @@ void fcn_0045175d()
dw_47637c = 3;
}
+void load_sound_from_mkf(int32_t *a1)
+{
+ int32_t *t = a1;
+ if (pdsound == NULL)
+ return;
+
+ while (t[0] != -1) {
+ char *data = read_mkf(mkf_effect, t[0], NULL, NULL);
+ t[1] = dsound_load_wav(data);
+ free(data);
+ t += 2;
+ }
+
+ for (int i = 0; i < 16; i++) {
+ if (array_48cae8[i] != NULL)
+ continue;
+ array_48cae8[i] = a1;
+ break;
+ }
+}
+
bool initialize()
{
direct_sound_init(0);
@@ -255,11 +276,11 @@ bool initialize()
mkf_speaking = load_mkf("speaking.mkf");
mkf_panel = load_mkf("panel.mkf");
mkf_effect = load_mkf("effect.mkf");
- fcn_00454176(0x48231a);
+ load_sound_from_mkf(0x48231a);
config_rich4();
- ghook = SetWindowsHookExA(WH_KEYBOARD, fcn_401010, ghInstance, 0);
- ShowCursor_fa();
- mciSendStringA_5ba();
+ ghook = SetWindowsHookExA(WH_KEYBOARD, KbdProc /* @ 0x401010 */, ghInstance, 0);
+ ShowCursor_fa(); /* 0x4020fa */
+ mciSendStringA_5ba(); /* 0x4545ba */
fcn_004021f8(0x29, 1, 0);
b_46caf8 = 0;
b_46caf9 = 0;