2015-09-16 03:02:29 +00:00
|
|
|
/* ReC98
|
|
|
|
* -----
|
|
|
|
* 2nd part of ZUN_RES.COM. Initializes the high score lists.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "th02/th02.h"
|
|
|
|
|
2019-12-26 15:07:35 +00:00
|
|
|
extern scoredat_section_t hi;
|
|
|
|
extern const char *SCOREDAT_FN;
|
2015-09-16 03:02:29 +00:00
|
|
|
|
|
|
|
char rank;
|
|
|
|
|
|
|
|
// Slightly differs from the same function in MAINE.EXE!
|
|
|
|
// And seriously, I wasted half a week trying to figure out how to get these
|
|
|
|
// exact same instructions out of the compiler, and it just didn't work.
|
2019-12-26 15:07:35 +00:00
|
|
|
void pascal scoredat_defaults_set(void)
|
2015-09-16 03:02:29 +00:00
|
|
|
{
|
|
|
|
_SI = 0;
|
2019-12-26 15:07:35 +00:00
|
|
|
_DI = 1000 * SCOREDAT_PLACES;
|
2015-09-16 03:02:29 +00:00
|
|
|
goto place_loop;
|
|
|
|
|
|
|
|
place_set:
|
|
|
|
hi.score.cleared = 0;
|
|
|
|
hi.score.points[_SI] = _DI;
|
|
|
|
_DI -= 1000;
|
|
|
|
hi.score.stage[_SI] = 5 - ((int)_SI >> 1);
|
|
|
|
_BX = _SI;
|
|
|
|
asm {
|
|
|
|
imul bx, bx, 7
|
|
|
|
mov cx, 6
|
|
|
|
|
|
|
|
name_loop:
|
2019-12-26 15:07:35 +00:00
|
|
|
mov byte ptr hi.(scoredat_section_t)score.g_name[bx], gs_BULLET
|
2015-09-16 03:02:29 +00:00
|
|
|
inc bx
|
|
|
|
loop name_loop
|
2019-12-26 15:07:35 +00:00
|
|
|
mov byte ptr hi.(scoredat_section_t)score.g_name[bx], 0
|
2015-09-16 03:02:29 +00:00
|
|
|
}
|
|
|
|
_BX = _SI;
|
|
|
|
_BX <<= 2;
|
|
|
|
asm {
|
2019-12-26 15:07:35 +00:00
|
|
|
mov word ptr hi.(scoredat_section_t)score.date[bx].da_year, 1900
|
|
|
|
mov byte ptr hi.(scoredat_section_t)score.date[bx].da_day, 1
|
|
|
|
mov byte ptr hi.(scoredat_section_t)score.date[bx].da_mon, 1
|
|
|
|
mov byte ptr hi.(scoredat_section_t)score.shottype[si], 1
|
2015-09-16 03:02:29 +00:00
|
|
|
inc si
|
|
|
|
|
|
|
|
place_loop:
|
2019-12-26 15:07:35 +00:00
|
|
|
cmp si, SCOREDAT_PLACES
|
2015-09-16 03:02:29 +00:00
|
|
|
jge end
|
|
|
|
jmp place_set
|
|
|
|
}
|
|
|
|
end:
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "th02/scoreenc.c"
|
|
|
|
|
2019-12-26 15:07:35 +00:00
|
|
|
void pascal scoredat_create(void)
|
2015-09-16 03:02:29 +00:00
|
|
|
{
|
2019-12-26 15:07:35 +00:00
|
|
|
SCOREDAT_ENCODE();
|
|
|
|
file_create(SCOREDAT_FN);
|
2015-09-16 03:02:29 +00:00
|
|
|
file_write(&hi, sizeof(hi));
|
|
|
|
file_write(&hi, sizeof(hi));
|
|
|
|
file_write(&hi, sizeof(hi));
|
|
|
|
file_write(&hi, sizeof(hi));
|
|
|
|
file_write(&hi, sizeof(hi));
|
|
|
|
file_close();
|
|
|
|
}
|
|
|
|
|
2019-12-26 15:07:35 +00:00
|
|
|
void pascal scoredat_recreate(void)
|
2015-09-16 03:02:29 +00:00
|
|
|
{
|
2019-12-26 15:07:35 +00:00
|
|
|
scoredat_defaults_set();
|
|
|
|
scoredat_create();
|
2015-09-16 03:02:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "th02\scorelod.c"
|