2020-11-04 13:47:52 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* Random resident structure stuff
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma option -2 -Z-
|
|
|
|
|
2020-11-07 19:18:37 +00:00
|
|
|
extern "C" {
|
|
|
|
#include "platform.h"
|
|
|
|
#include "master.hpp"
|
2020-11-07 19:16:17 +00:00
|
|
|
#include "th01/common.h"
|
|
|
|
#include "th01/resident.hpp"
|
2020-11-04 13:47:52 +00:00
|
|
|
|
|
|
|
extern const char res_id[] /* = RES_ID */;
|
|
|
|
|
|
|
|
void resident_stuff_set(
|
|
|
|
char rank, char bgm_mode, char bombs, char start_lives_extra, long rand
|
|
|
|
)
|
|
|
|
{
|
2020-11-07 19:18:37 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(res_id);
|
|
|
|
if(!sgm) {
|
|
|
|
sgm = ResData<resident_t>::create(res_id);
|
|
|
|
resident = sgm;
|
2020-11-04 13:47:52 +00:00
|
|
|
resident->stage = 0;
|
|
|
|
resident->continues_total = 0;
|
|
|
|
}
|
2020-11-07 19:18:37 +00:00
|
|
|
if(sgm) {
|
|
|
|
resident = sgm;
|
2020-11-04 13:47:52 +00:00
|
|
|
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(
|
|
|
|
char *rank,
|
|
|
|
char *bgm_mode,
|
|
|
|
char *bombs,
|
|
|
|
char *start_lives_extra,
|
|
|
|
long *rand,
|
|
|
|
long *continues_total,
|
|
|
|
int *stage
|
|
|
|
)
|
|
|
|
{
|
2020-11-07 19:18:37 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(res_id);
|
|
|
|
if(sgm) {
|
|
|
|
resident = sgm;
|
2020-11-04 13:47:52 +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 = resident->stage;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void resident_free(void)
|
|
|
|
{
|
2020-11-07 19:18:37 +00:00
|
|
|
resident_t __seg *sgm = ResData<resident_t>::exist(res_id);
|
|
|
|
if(sgm) {
|
|
|
|
resdata_free(sgm);
|
2020-11-04 13:47:52 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-07 19:18:37 +00:00
|
|
|
|
|
|
|
}
|