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/common.h"
|
|
|
|
#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
|
|
|
|
|
|
|
void resident_stuff_set(
|
|
|
|
char rank, char bgm_mode, char bombs, char start_lives_extra, long rand
|
|
|
|
)
|
|
|
|
{
|
2022-08-10 16:01:03 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(RES_ID);
|
2021-12-25 15:18:17 +00:00
|
|
|
if(!sgm) {
|
2022-08-10 16:01:03 +00:00
|
|
|
sgm = ResData<resident_t>::create(RES_ID);
|
2021-12-25 15:18:17 +00:00
|
|
|
resident = sgm;
|
2022-08-14 04:21:01 +00:00
|
|
|
resident->stage_id = 0;
|
2021-12-25 15:18:17 +00:00
|
|
|
resident->continues_total = 0;
|
|
|
|
}
|
|
|
|
if(sgm) {
|
|
|
|
resident = sgm;
|
|
|
|
resident->rank = rank;
|
|
|
|
resident->bgm_mode = bgm_mode;
|
|
|
|
resident->bombs = bombs;
|
|
|
|
resident->start_lives_extra = start_lives_extra;
|
|
|
|
resident->rand = rand;
|
|
|
|
resident->score = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int resident_stuff_get(
|
2022-08-14 04:21:01 +00:00
|
|
|
char& rank,
|
|
|
|
char& bgm_mode,
|
|
|
|
char& bombs,
|
|
|
|
char& start_lives_extra,
|
|
|
|
long& rand,
|
|
|
|
long& continues_total,
|
|
|
|
int& stage_id
|
2021-12-25 15:18:17 +00:00
|
|
|
)
|
|
|
|
{
|
2022-08-10 16:01:03 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(RES_ID);
|
2021-12-25 15:18:17 +00:00
|
|
|
if(sgm) {
|
|
|
|
resident = sgm;
|
2022-08-14 04:21:01 +00:00
|
|
|
rank = resident->rank;
|
|
|
|
bgm_mode = resident->bgm_mode;
|
|
|
|
bombs = resident->bombs;
|
|
|
|
start_lives_extra = resident->start_lives_extra;
|
|
|
|
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)
|
|
|
|
{
|
2022-08-10 16:01:03 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(RES_ID);
|
2021-12-25 15:18:17 +00:00
|
|
|
if(sgm) {
|
|
|
|
resdata_free(sgm);
|
|
|
|
}
|
|
|
|
}
|