2021-12-25 15:18:17 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Random resident structure stuff
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma option -2 -Z-
|
|
|
|
|
|
|
|
#include "platform.h"
|
|
|
|
#include "master.hpp"
|
|
|
|
#include "th01/resident.hpp"
|
2022-08-14 04:21:01 +00:00
|
|
|
#include "th01/core/resstuff.hpp"
|
2021-12-25 15:18:17 +00:00
|
|
|
|
2022-08-10 16:01:03 +00:00
|
|
|
resident_t far *resident;
|
2021-12-25 15:18:17 +00:00
|
|
|
|
2022-08-15 01:17:54 +00:00
|
|
|
void resident_create_and_stuff_set(
|
2022-08-14 05:41:03 +00:00
|
|
|
int8_t rank,
|
2022-08-15 07:50:42 +00:00
|
|
|
bgm_mode_t bgm_mode,
|
2023-02-05 03:32:10 +00:00
|
|
|
int8_t rem_bombs,
|
2023-02-04 20:35:26 +00:00
|
|
|
int8_t credit_lives_extra,
|
2022-08-14 05:41:03 +00:00
|
|
|
long rand
|
2021-12-25 15:18:17 +00:00
|
|
|
)
|
|
|
|
{
|
2023-06-27 20:10:47 +00:00
|
|
|
resident_t __seg *seg = ResData<resident_t>::exist(RES_ID);
|
|
|
|
if(!seg) {
|
|
|
|
seg = ResData<resident_t>::create(RES_ID);
|
|
|
|
resident = seg;
|
2022-08-14 04:21:01 +00:00
|
|
|
resident->stage_id = 0;
|
2021-12-25 15:18:17 +00:00
|
|
|
resident->continues_total = 0;
|
|
|
|
}
|
2023-06-27 20:10:47 +00:00
|
|
|
if(seg) {
|
|
|
|
resident = seg;
|
2021-12-25 15:18:17 +00:00
|
|
|
resident->rank = rank;
|
|
|
|
resident->bgm_mode = bgm_mode;
|
2023-02-05 03:32:10 +00:00
|
|
|
resident->rem_bombs = rem_bombs;
|
2023-02-04 20:35:26 +00:00
|
|
|
resident->credit_lives_extra = credit_lives_extra;
|
2021-12-25 15:18:17 +00:00
|
|
|
resident->rand = rand;
|
|
|
|
resident->score = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int resident_stuff_get(
|
2022-08-14 05:41:03 +00:00
|
|
|
int8_t& rank,
|
2022-08-15 07:50:42 +00:00
|
|
|
bgm_mode_t& bgm_mode,
|
2023-02-05 03:32:10 +00:00
|
|
|
int8_t& rem_bombs,
|
2023-02-04 20:35:26 +00:00
|
|
|
int8_t& credit_lives_extra,
|
2022-08-14 05:41:03 +00:00
|
|
|
unsigned long& rand,
|
2023-01-31 02:43:24 +00:00
|
|
|
int32_t& continues_total,
|
2022-08-14 04:21:01 +00:00
|
|
|
int& stage_id
|
2021-12-25 15:18:17 +00:00
|
|
|
)
|
|
|
|
{
|
2023-06-27 20:10:47 +00:00
|
|
|
resident_t __seg *seg = ResData<resident_t>::exist(RES_ID);
|
|
|
|
if(seg) {
|
|
|
|
resident = seg;
|
2022-08-14 04:21:01 +00:00
|
|
|
rank = resident->rank;
|
|
|
|
bgm_mode = resident->bgm_mode;
|
2023-02-05 03:32:10 +00:00
|
|
|
rem_bombs = resident->rem_bombs;
|
2023-02-04 20:35:26 +00:00
|
|
|
credit_lives_extra = resident->credit_lives_extra;
|
2022-08-14 04:21:01 +00:00
|
|
|
rand = resident->rand;
|
|
|
|
continues_total = resident->continues_total;
|
|
|
|
stage_id = resident->stage_id;
|
2021-12-25 15:18:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void resident_free(void)
|
|
|
|
{
|
2023-06-27 20:10:47 +00:00
|
|
|
resident_t __seg *seg = ResData<resident_t>::exist(RES_ID);
|
|
|
|
if(seg) {
|
|
|
|
resdata_free(seg);
|
2021-12-25 15:18:17 +00:00
|
|
|
}
|
|
|
|
}
|