summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-10-04 17:06:11 +0800
committerIru Cai <mytbk920423@gmail.com>2018-10-04 17:06:11 +0800
commit14a900f2088b3b8b073ebee910f4c2ad7872e209 (patch)
treec2e09d35f3cbe96d138286cc1c217726ea66a41a
parent2ed4415f8e05543a6d16920515d0bcad8ae2bfc0 (diff)
downloadrich4-14a900f2088b3b8b073ebee910f4c2ad7872e209.tar.xz
data0, deinit_data_and_timer
-rw-r--r--csrc/fcn_4021f8.c2
-rw-r--r--csrc/main.c2
-rw-r--r--csrc/media_init.c18
3 files changed, 18 insertions, 4 deletions
diff --git a/csrc/fcn_4021f8.c b/csrc/fcn_4021f8.c
index 89aa1c3..9ffcc95 100644
--- a/csrc/fcn_4021f8.c
+++ b/csrc/fcn_4021f8.c
@@ -7,7 +7,7 @@
void fcn_004021f8(int a1, int a2, int a3)
{
- dw_48a0f4 = dw_46cb10 + 12 + a1 * 12;
+ dw_48a0f4 = &data0->chunk_tab[a1];
w_48a170 = a2;
w_48a174 = a3;
w_48a172 = w_48a176 = 0;
diff --git a/csrc/main.c b/csrc/main.c
index 1038bae..9e78a86 100644
--- a/csrc/main.c
+++ b/csrc/main.c
@@ -233,7 +233,7 @@ void deinit_game()
if (mid_status[5] == 0) {
sub.WINMM.dll_timeGetTime_3c4();
free(dw_474938);
- sub.WINMM.dll_timeKillEvent_1b2();
+ deinit_data_and_timer();
sub.WINMM.dll_mciSendStringA_8ef();
unload_mkf(mkf_effect);
unload_mkf(mkf_panel);
diff --git a/csrc/media_init.c b/csrc/media_init.c
index c8680c6..87f7158 100644
--- a/csrc/media_init.c
+++ b/csrc/media_init.c
@@ -8,6 +8,7 @@
#include "player_info.h"
#include "sound_struct.h"
#include "window_util.h"
+#include "mkf/mkf.h"
DDSURFACEDESC sfdesc1; // 0x0048a068
DDSURFACEDESC sfdesc2; // 0x0048a0f8
@@ -36,6 +37,7 @@ int32_t dw_48a164, dw_48a168;
MMRESULT gTimerEvent; // 0x48a16c
uint16_t modded_key; // 0x46cb07
+struct spr_smp *data0; // 0x46cb10
struct graph_st st_46cb14 = {640, 480, 0, 0, NULL}; // 0x46cb14, 12 bytes
uint8_t speed_tab[3] = {6, 4, 2}; // 0x64cb20
uint32_t dw_46cb23 = 0;
@@ -609,11 +611,11 @@ void load_sound_from_mkf(int32_t *a1)
void init_data_and_timer()
{
- if (dw_46cb10 != 0)
+ if (data0 != NULL)
return;
/* edx = 0 */
- dw_46cb10 = read_mkf(mkf_data, 0, NULL, NULL);
+ data0 = read_mkf(mkf_data, 0, NULL, NULL);
dw_48a0e8 = allocate_graph_st(32, 32, 0, 0);
b_48a179 = b_48a17a = b_48a178 = 0;
dw_48a168 = -1;
@@ -626,6 +628,18 @@ void init_data_and_timer()
0 /* dwUser */, 1 /* fuEvent */);
}
+void deinit_data_and_timer()
+{
+ if (data0 == NULL)
+ return;
+
+ b_48a179 = 0;
+ free(data0);
+ free(dw_48a0e8);
+ timeKillEvent(gTimerEvent);
+ ShowCursor(1);
+}
+
bool initialize()
{
direct_sound_init(0);