summaryrefslogtreecommitdiff
path: root/csrc
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-24 11:26:15 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-24 11:33:18 +0800
commitfb34c58fd636ff0adccdc6c170d0bd05095f2bfd (patch)
tree9e8f186ed88df3a4b39136e6db9a4f00eec10c16 /csrc
parentb4b4bfeb6bbc9ffcf226e231f5d83fb2eecbed09 (diff)
downloadrich4-fb34c58fd636ff0adccdc6c170d0bd05095f2bfd.tar.xz
move special players to 0x498e28 according loadsave.c
Diffstat (limited to 'csrc')
-rw-r--r--csrc/cards.c14
-rw-r--r--csrc/game_init.c8
-rw-r--r--csrc/loadsave.c2
-rw-r--r--csrc/player_action.c23
-rw-r--r--csrc/player_info.h19
5 files changed, 37 insertions, 29 deletions
diff --git a/csrc/cards.c b/csrc/cards.c
index 59c813d..68423a5 100644
--- a/csrc/cards.c
+++ b/csrc/cards.c
@@ -983,7 +983,7 @@ int stop_card()
fcn_41d546();
}
} else {
- special_players[selected_player].days_stopping = 1;
+ special_players[selected_player - 4].days_stopping = 1;
}
}
return edi;
@@ -1005,11 +1005,11 @@ int winter_sleep_card()
players[i].total_winter_sleep_days += 5;
continue;
} else {
- ch = special_players[i].f10;
+ ch = special_players[i - 4].f10;
if (ch != 0)
continue;
- special_players[i].days_sleep_walking = 0;
- special_players[i].days_winter_sleep = 5;
+ special_players[i - 4].days_sleep_walking = 0;
+ special_players[i - 4].days_winter_sleep = 5;
}
}
player_action_2(0, 0, 1);
@@ -1090,8 +1090,8 @@ int sleep_walking_card()
}
}
}
- } else if (ebx >= 4 && special_players[ebx].days_winter_sleep == 0) {
- special_players[ebx].days_sleep_walking = 5;
+ } else if (ebx >= 4 && special_players[ebx - 4].days_winter_sleep == 0) {
+ special_players[ebx - 4].days_sleep_walking = 5;
}
fcn_41d546();
}
@@ -1122,7 +1122,7 @@ int tortoise_walking_card()
}
if (selected_player >= 4) {
- special_players[selected_player].days_tortoise_walking = 3;
+ special_players[selected_player - 4].days_tortoise_walking = 3;
return edi;
}
diff --git a/csrc/game_init.c b/csrc/game_init.c
index 023c291..444dc7e 100644
--- a/csrc/game_init.c
+++ b/csrc/game_init.c
@@ -3,6 +3,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#include "player_info.h"
+
int mkf_jump; // 0x48a3b0
int initial_fund[6] = { 300000, 200000, 100000, 50000, 30000, 10000 }; // 0x46cb94
@@ -13,6 +15,10 @@ int winning_condition[6] = { 0, 100, 50, 10, 5, 3 }; // 0x46cc00
int game_initial_fund; // 0x49908c
int traffic_initial; // 0x46cb44
+struct special_player_info default_special_players[5] = {
+ { .f10 = 1 }, { .f10 = 1 }, { .f10 = 2 }, { .f10 = 2 }, { .f10 = 3 }
+}; // 0x47ecec
+
void fcn_00445a4d(int a1, int a2)
{
int t = a1 * 15;
@@ -182,7 +188,7 @@ int init_new_game(int a0)
goto 407210;
}
- memcpy(0x498e28, 0x47ecec, 80);
+ memcpy(special_players, default_special_players, sizeof(special_players));
memset(0x496b30, 0, 8);
memset(0x496b60, 0, 8);
b_496b34 = b_496b35 = b_496b66 = b_496b67 = 1;
diff --git a/csrc/loadsave.c b/csrc/loadsave.c
index 61f7d83..e46e037 100644
--- a/csrc/loadsave.c
+++ b/csrc/loadsave.c
@@ -311,7 +311,7 @@ int load_checkpoint(int n)
players[i].name_ptr = rich4_players[j].name_ptr;
}
- fread(0x498e28, 0x10, 5, fp);
+ fread(special_players, 0x10, 5, fp);
fread(0x496d08, 0x18, 0x2e, fp);
fread(player_cards, 1, 0x3c, fp);
fread(tool_amount, 1, 0x3c, fp);
diff --git a/csrc/player_action.c b/csrc/player_action.c
index 72d8fe3..7fe1ce5 100644
--- a/csrc/player_action.c
+++ b/csrc/player_action.c
@@ -20,24 +20,7 @@ void player_action_1(int a0)
dw_475110 = 0;
}
-/* still don't know what this means,
- * assume it's special players */
-typedef struct
-{
- uint16_t f0;
- uint16_t f2;
- uint16_t f4;
- uint16_t f6;
- uint8_t f8[2];
- uint8_t f10; // 0x498df2
- uint8_t f11;
- uint8_t days_winter_sleep; // 0x498df4
- uint8_t days_sleep_walking; // 0x498df5
- uint8_t days_stopping;
- uint8_t days_tortoise_walking;
-} special_player_info;
-
-special_player_info special_players[10]; // 0x498de8
+special_player_info special_players[5]; // 0x498e28
void player_action_2(int a0, int a1, int a2)
{
@@ -51,8 +34,8 @@ void player_action_2(int a0, int a1, int a2)
t0 = players[current_player].f8;
t1 = players[current_player].f10;
} else {
- t0 = special_players[current_player].f0;
- t1 = special_players[current_player].f2;
+ t0 = special_players[current_player - 4].f0;
+ t1 = special_players[current_player - 4].f2;
}
if (t0 == a0 && t1 == a1) {
dw_48be18 = 0;
diff --git a/csrc/player_info.h b/csrc/player_info.h
index 5afda53..9af94f0 100644
--- a/csrc/player_info.h
+++ b/csrc/player_info.h
@@ -72,3 +72,22 @@ extern int current_player; /* 0x49910c */
extern uint8_t player_cards[60]; /* 0x499120 */
extern uint8_t tool_amount[60]; /* 0x49915c */
+
+/* still don't know what this means,
+ * assume it's special players */
+typedef struct
+{
+ uint16_t f0;
+ uint16_t f2;
+ uint16_t f4;
+ uint16_t f6;
+ uint8_t f8[2];
+ uint8_t f10; // 0x498df2
+ uint8_t f11;
+ uint8_t days_winter_sleep; // 0x498df4
+ uint8_t days_sleep_walking; // 0x498df5
+ uint8_t days_stopping;
+ uint8_t days_tortoise_walking;
+} special_player_info;
+
+extern special_player_info special_players[5]; // 0x498e28