2021-12-25 15:18:17 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Random resident structure stuff
|
|
|
|
*/
|
|
|
|
|
2024-05-20 18:02:24 +00:00
|
|
|
#include "libs/master.lib/master.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
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-11 11:02:26 +00:00
|
|
|
int resident_stuff_get(uint8_t& rank, unsigned long& rand, 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;
|
|
|
|
rand = resident->rand;
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|