summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-30 20:56:12 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-30 20:58:04 +0800
commit25e61a9776fd0bf58cd6de9ff30f4ae1640147a6 (patch)
treec4ca840746b1990018fe2a41819cb56dc491cd3d
parent21de0fcbdbf66897c831a88202fc9a28d670ee0a (diff)
downloadrich4-25e61a9776fd0bf58cd6de9ff30f4ae1640147a6.tar.xz
game_init.c: rewrite stock things
-rw-r--r--csrc/game_init.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/csrc/game_init.c b/csrc/game_init.c
index 37adf9a..5c271d2 100644
--- a/csrc/game_init.c
+++ b/csrc/game_init.c
@@ -5,6 +5,7 @@
#include "player_info.h"
#include "window_util.h"
+#include "stock.h"
int mkf_jump; // 0x48a3b0
@@ -198,19 +199,13 @@ int init_new_game(int a0)
dword [ecx + eax*4 + 0x497328] = 0;
}
}
- eax = game_stage * 4; // sign ext
- edx = w_4991b8 + eax; // sign ext
- eax = edx * 48;
- edx = eax;
- eax = edx * 9;
- eax += 0x47f072;
- memcpy(0x496980, eax, 432);
+ int _m = game_stage * 4 + w_4991b8; // sign ext
+ memcpy(stocks, &game_stocks[_m * 12], sizeof(stock_info) * 12);
float sum = 0; /* esp + 8 */
- for (ebx = 0; ebx < 12; ebx++) {
- sum += *(float*)(ebx * 36 + 0x49698c);
- }
+ for (int i = 0; i < 12; i++)
+ sum += stocks[i].f12;
dw_49907c = trunc(sum * 10.0);
memset(0x4967e0, 0, 336);