diff --git a/th02/maine_04.c b/th02/maine_04.c index fde19a74..e528616f 100644 --- a/th02/maine_04.c +++ b/th02/maine_04.c @@ -9,19 +9,19 @@ #include "th02\scoreenc.c" long score_highest; -score_file_t hi; +scoredat_section_t hi; -void pascal score_defaults_set(void) +void pascal scoredat_defaults_set(void) { int i; - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { int c; hi.score.points[i] = 10000 - (i * 1000); hi.score.stage[i] = 5 - (i >> 1); - for(c = 0; c < SCORE_NAME_LEN; c++) { + for(c = 0; c < SCOREDAT_NAME_LEN; c++) { hi.score.g_name[i][c] = gs_BULLET; } - hi.score.g_name[i][SCORE_NAME_LEN] = 0; + hi.score.g_name[i][SCOREDAT_NAME_LEN] = 0; hi.score.date[i].da_year = 1900; hi.score.date[i].da_day = 1; hi.score.date[i].da_mon = 1; @@ -31,11 +31,11 @@ void pascal score_defaults_set(void) #include "th02\scorelod.c" -#define score_init() \ - if(!file_exist(SCORE_FN)) { \ - score_defaults_set(); \ +#define scoredat_init() \ + if(!file_exist(SCOREDAT_FN)) { \ + scoredat_defaults_set(); \ } else { \ - score_load(); \ + scoredat_load(); \ } // Slightly differs from the same function in OP.EXE! @@ -79,7 +79,7 @@ void pascal near scores_put(int place_to_highlight) } ALPHABET_PUTCA(0, 0, TX_GREEN | TX_REVERSE); } - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); gaiji_putsa(10, 6+i, (const char*)hi.score.g_name[i], atrb); score_points_put(6+i, hi.score.points[i], atrb); @@ -89,7 +89,7 @@ void pascal near scores_put(int place_to_highlight) gaiji_putca(44, 6+i, gs_ALL, atrb); } } - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); if(i != 9) { gaiji_putca(6, 6+i, GB_DIGITS+i+1, atrb); @@ -105,7 +105,7 @@ void pascal near alphabet_putca(int col, int row, unsigned atrb) ALPHABET_PUTCA(col, row, atrb); } -void pascal near score_name_puts(int place, int char_to_highlight) +void pascal near scoredat_name_puts(int place, int char_to_highlight) { gaiji_putsa(10, 6 + place, (const char*)hi.score.g_name[place], TX_GREEN); gaiji_putca( @@ -116,10 +116,10 @@ void pascal near score_name_puts(int place, int char_to_highlight) ); } -void pascal score_save(void) +void pascal scoredat_save(void) { - HI_SCORE_ENCODE(); - file_append(SCORE_FN); + SCOREDAT_ENCODE(); + file_append(SCOREDAT_FN); file_seek(rank * sizeof(hi), 0); file_write(&hi, sizeof(hi)); file_close(); @@ -135,20 +135,20 @@ void pascal score_enter(void) int col; int input_locked; unsigned char input_delay; - score_init(); - if(hi.score.points[SCORE_PLACES - 1] > score) { + scoredat_init(); + if(hi.score.points[SCOREDAT_PLACES - 1] > score) { scores_put(-1); key_delay(); return; } - for(place = SCORE_PLACES - 1; place > 0; place--) { + for(place = SCOREDAT_PLACES - 1; place > 0; place--) { if(hi.score.points[place-1] > score) { break; } } - for(shift = SCORE_PLACES - 1; shift > place; shift--) { + for(shift = SCOREDAT_PLACES - 1; shift > place; shift--) { hi.score.points[shift] = hi.score.points[shift-1]; - for(c = 0; c < SCORE_NAME_LEN; c++) { + for(c = 0; c < SCOREDAT_NAME_LEN; c++) { hi.score.g_name[shift][c] = hi.score.g_name[shift-1][c]; } hi.score.stage[shift] = hi.score.stage[shift-1]; @@ -161,7 +161,7 @@ void pascal score_enter(void) hi.score.stage[place] = STAGE_ALL; getdate(&hi.score.date[place]); hi.score.shottype[place] = mikoconfig->shottype; - for(c = 0; c < SCORE_NAME_LEN; c++) { + for(c = 0; c < SCOREDAT_NAME_LEN; c++) { hi.score.g_name[shift][c] = gs_BULLET; } scores_put(place); @@ -213,12 +213,12 @@ void pascal score_enter(void) } else if(col == 16) { \ break; \ } \ - score_name_puts(place, name_pos); \ + scoredat_name_puts(place, name_pos); \ } \ if(key_det & INPUT_BOMB) { \ hi.score.g_name[place][name_pos] = gb_SP; \ CLAMP_DEC(name_pos, 0); \ - score_name_puts(place, name_pos); \ + scoredat_name_puts(place, name_pos); \ } \ if(key_det & INPUT_CANCEL) { \ break; \ @@ -240,21 +240,21 @@ void pascal score_enter(void) input_delay = 0; } } while(1); - score_save(); + scoredat_save(); } void pascal score_highest_get(void) { - score_init(); + scoredat_init(); score_highest = hi.score.points[0] >= score ? hi.score.points[0] : score; } -int pascal score_extra_unlocked(void) +int pascal scoredat_is_extra_unlocked(void) { int game_clear_constants[SHOTTYPE_COUNT] = GAME_CLEAR_CONSTANTS; char rank_save = rank; for(rank = 0; (int)rank < SHOTTYPE_COUNT; rank++) { - score_load(); + scoredat_load(); if(game_clear_constants[rank] != hi.score.cleared) { rank = rank_save; return 0; diff --git a/th02/op_01.c b/th02/op_01.c index 6c944e78..d56b74de 100644 --- a/th02/op_01.c +++ b/th02/op_01.c @@ -606,7 +606,7 @@ int main(void) zun_error(ERROR_OUT_OF_MEMORY); return 1; } - extra_unlocked = score_cleared_load(); + extra_unlocked = scoredat_cleared_load(); if(cfg_load() == 1) { return 1; } diff --git a/th02/op_04.c b/th02/op_04.c index 2a0c490f..f791b55e 100644 --- a/th02/op_04.c +++ b/th02/op_04.c @@ -22,7 +22,7 @@ const char *SHOTTYPES[] = {" int logo_step = 0; char need_op_h_bft = 1; -score_file_t hi; +scoredat_section_t hi; char extra_unlocked; unsigned int score_duration; @@ -72,7 +72,7 @@ void int_to_string(char *str, int val, int chars) str[c] = 0; } -void pascal near score_date_put(int y, int place, int atrb) +void pascal near scoredat_date_put(int y, int place, int atrb) { char str[6]; int_to_string(str, hi.score.date[place].da_year, 4); @@ -96,7 +96,7 @@ void pascal near scores_put(int place_to_highlight) " お名前      得点    STAGE TYPE 日付", TX_GREEN ); - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); gaiji_putsa(12, 7+i, hi.score.g_name[i], atrb); score_points_put(7+i, hi.score.points[i], atrb); @@ -106,9 +106,9 @@ void pascal near scores_put(int place_to_highlight) gaiji_putca(44, 7+i, gs_ALL, atrb); } shottype_put(7+i, hi.score.shottype[i], atrb); - score_date_put(7+i, i, atrb); + scoredat_date_put(7+i, i, atrb); } - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { ATRB_SET(i); if(i != 9) { gaiji_putca(9, 7+i, GB_DIGITS+i+1, atrb); @@ -150,7 +150,7 @@ void pascal score_menu(void) int input_allowed = 0; char page = 0; - score_load(); + scoredat_load(); graph_accesspage(0); graph_clear(); graph_accesspage(1); graph_clear(); if(need_op_h_bft) { @@ -187,7 +187,7 @@ void pascal score_menu(void) grc_setclip(0, 0, 639, 399); } -int pascal score_cleared_load(void) +int pascal scoredat_cleared_load(void) { int game_clear_constants[SHOTTYPE_COUNT] = GAME_CLEAR_CONSTANTS; unsigned char extra_clear_flags[SHOTTYPE_COUNT] = EXTRA_CLEAR_FLAGS; @@ -195,7 +195,7 @@ int pascal score_cleared_load(void) int shottype; for(rank = 0; rank < 3; rank++) { - score_load(); + scoredat_load(); if(hi.score.cleared != game_clear_constants[rank]) { cleared_game_with[rank] = 0; extra_unlocked = 0; @@ -204,7 +204,7 @@ int pascal score_cleared_load(void) } } rank = 3; - score_load(); + scoredat_load(); for(shottype = 0; shottype < 3; shottype++) { if(hi.score.cleared & extra_clear_flags[shottype]) { cleared_extra_with[shottype] = 1; diff --git a/th02/score.c b/th02/score.c index 3a887168..df3e9d72 100644 --- a/th02/score.c +++ b/th02/score.c @@ -3,7 +3,7 @@ * Shared high score code */ -const char *SCORE_FN = "huuhi.dat"; +const char *SCOREDAT_FN = "huuhi.dat"; const unsigned char gbHI_SCORE[] = { gb_H_, gb_I_, gb_SP, gb_S_, gb_C_, gb_O_, gb_R_, gb_E_, 0 }; diff --git a/th02/scoreenc.c b/th02/scoreenc.c index ee83f990..8e9ca528 100644 --- a/th02/scoreenc.c +++ b/th02/scoreenc.c @@ -3,13 +3,13 @@ * TH02 high score pre-save encoding */ -#define HI_SCORE_ENCODE() \ +#define SCOREDAT_ENCODE() \ int i; \ hi.score.points_sum = 0; \ hi.score.g_name_first_sum = 0; \ hi.score.stage_sum = 0; \ hi.score_sum = 0; \ - for(i = 0; i < SCORE_PLACES; i++) { \ + for(i = 0; i < SCOREDAT_PLACES; i++) { \ hi.score.points_sum += hi.score.points[i]; \ hi.score.g_name_first_sum += hi.score.g_name[i][0]; \ hi.score.stage_sum += hi.score.stage[i]; \ diff --git a/th02/scorelod.c b/th02/scorelod.c index 9e122a34..658cb619 100644 --- a/th02/scorelod.c +++ b/th02/scorelod.c @@ -1,7 +1,7 @@ -void pascal near score_load(void) +void pascal near scoredat_load(void) { int byte; - file_ropen(SCORE_FN); + file_ropen(SCOREDAT_FN); file_seek(rank * sizeof(hi), 0); file_read(&hi, sizeof(hi)); for(byte = 0; byte < sizeof(hi.score); byte++) { diff --git a/th02/th02.h b/th02/th02.h index c567ff9e..9cfd7419 100644 --- a/th02/th02.h +++ b/th02/th02.h @@ -245,9 +245,9 @@ extern char lives; #define SHOTTYPE_COUNT 3 // Highscores -// --------- -#define SCORE_PLACES 10 -#define SCORE_NAME_LEN 6 /* excluding the terminating 0 */ +// ---------- +#define SCOREDAT_PLACES 10 +#define SCOREDAT_NAME_LEN 6 /* excluding the terminating 0 */ #define EXTRA_CLEAR_FLAGS {1, 2, 4} #define GAME_CLEAR_CONSTANTS {318, 118, 218} #define STAGE_ALL 127 @@ -270,26 +270,26 @@ typedef struct { */ int16_t cleared; - int32_t points[SCORE_PLACES]; + int32_t points[SCOREDAT_PLACES]; int32_t points_sum; - unsigned char g_name[SCORE_PLACES][SCORE_NAME_LEN + 1]; + unsigned char g_name[SCOREDAT_PLACES][SCOREDAT_NAME_LEN + 1]; unsigned char g_name_first_sum; - unsigned char stage[SCORE_PLACES]; + unsigned char stage[SCOREDAT_PLACES]; unsigned char stage_sum; - struct date date[SCORE_PLACES]; - unsigned char shottype[SCORE_PLACES]; -} score_t; + struct date date[SCOREDAT_PLACES]; + unsigned char shottype[SCOREDAT_PLACES]; +} scoredat_t; typedef struct { - score_t score; - int32_t score_sum; // Sum of all bytes in score, pre-encraption -} score_file_t; + scoredat_t score; + int32_t score_sum; // Sum of all bytes in [score], pre-encraption +} scoredat_section_t; extern char cleared_game_with[SHOTTYPE_COUNT]; extern char cleared_extra_with[SHOTTYPE_COUNT]; -int pascal score_cleared_load(void); -// --------- +int pascal scoredat_cleared_load(void); +// ---------- // Debugging // --------- @@ -299,7 +299,7 @@ typedef enum { ERROR_FILE_NOT_FOUND = 2, ERROR_OUT_OF_MEMORY = 3, ERROR_MISSING_DRIVER = 4, - ERROR_HISCORE_CORRUPT = 5 + ERROR_SCOREDAT_CORRUPT = 5 } zun_error_t; void pascal zun_error(zun_error_t err); diff --git a/th02/zun_res1.c b/th02/zun_res1.c index fcc6336d..f69f15f9 100644 --- a/th02/zun_res1.c +++ b/th02/zun_res1.c @@ -36,14 +36,14 @@ void cfg_write(seg_t mikoconfig_sgm) int main(int argc, const char **argv) { - int pascal score_verify(void); + int pascal scoredat_verify(void); static const char MIKOConfig[] = RES_ID; static const char LOGO[] = "\n" "\n" "東方封魔録用  常駐プログラム ZUN_RES.com Version1.01 (c)zun 1997\n"; - static const char ERROR_HISCORE[] = + static const char ERROR_SCOREDAT[] = "ハイスコアファイルがおかしいの、もう一度実行してね。\n"; static const char ERROR_NOT_RESIDENT[] = "わたし、まだいませんよぉ\n\n"; @@ -68,8 +68,8 @@ int main(int argc, const char **argv) graph_clear(); // No, I tried all permutations of command-line switches, // gotos and returns, and no pure C solution seems to work! - if(score_verify() == 1) __asm { - push offset ds:ERROR_HISCORE + if(scoredat_verify() == 1) __asm { + push offset ds:ERROR_SCOREDAT jmp error_puts } if(argc == 2) { @@ -117,29 +117,29 @@ error_ret: #pragma option -O- -k- extern char rank; -score_file_t hi; +scoredat_section_t hi; -void pascal score_recreate(void); -void pascal near score_load(void); +void pascal scoredat_recreate(void); +void pascal near scoredat_load(void); unsigned char unused_1 = 0; -const char *SCORE_FN = "huuhi.dat"; +const char *SCOREDAT_FN = "huuhi.dat"; unsigned char g_name_first_sum = 0; unsigned char stage_sum = 0; unsigned char unused_2 = 0; long points_sum = 0; long score_sum = 0; -int pascal score_verify(void) +int pascal scoredat_verify(void) { - if(!file_exist(SCORE_FN)) { - score_recreate(); + if(!file_exist(SCOREDAT_FN)) { + scoredat_recreate(); } else { for(rank = 0; rank < RANK_COUNT; rank++) { register int unused; register int i; - score_load(); + scoredat_load(); _AL = 0; g_name_first_sum = _AL; stage_sum = _AL; @@ -153,7 +153,7 @@ int pascal score_verify(void) for(i = 0; i < sizeof(hi.score); i++) { score_sum += *((unsigned char*)(&hi.score) + i); } - for(i = 0; i < SCORE_PLACES; i++) { + for(i = 0; i < SCOREDAT_PLACES; i++) { points_sum += hi.score.points[i]; g_name_first_sum += hi.score.g_name[i][0]; stage_sum += hi.score.stage[i]; @@ -170,7 +170,7 @@ int pascal score_verify(void) } return 0; delete: - file_delete(SCORE_FN); + file_delete(SCOREDAT_FN); return 1; } diff --git a/th02/zun_res2.c b/th02/zun_res2.c index ec9bf57a..f39c5629 100644 --- a/th02/zun_res2.c +++ b/th02/zun_res2.c @@ -5,18 +5,18 @@ #include "th02/th02.h" -extern score_file_t hi; -extern const char *SCORE_FN; +extern scoredat_section_t hi; +extern const char *SCOREDAT_FN; 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. -void pascal score_defaults_set(void) +void pascal scoredat_defaults_set(void) { _SI = 0; - _DI = 1000 * SCORE_PLACES; + _DI = 1000 * SCOREDAT_PLACES; goto place_loop; place_set: @@ -30,22 +30,22 @@ place_set: mov cx, 6 name_loop: - mov byte ptr hi.(score_file_t)score.g_name[bx], gs_BULLET + mov byte ptr hi.(scoredat_section_t)score.g_name[bx], gs_BULLET inc bx loop name_loop - mov byte ptr hi.(score_file_t)score.g_name[bx], 0 + mov byte ptr hi.(scoredat_section_t)score.g_name[bx], 0 } _BX = _SI; _BX <<= 2; asm { - mov word ptr hi.(score_file_t)score.date[bx].da_year, 1900 - mov byte ptr hi.(score_file_t)score.date[bx].da_day, 1 - mov byte ptr hi.(score_file_t)score.date[bx].da_mon, 1 - mov byte ptr hi.(score_file_t)score.shottype[si], 1 + 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 inc si place_loop: - cmp si, SCORE_PLACES + cmp si, SCOREDAT_PLACES jge end jmp place_set } @@ -54,10 +54,10 @@ end: #include "th02/scoreenc.c" -void pascal score_create(void) +void pascal scoredat_create(void) { - HI_SCORE_ENCODE(); - file_create(SCORE_FN); + SCOREDAT_ENCODE(); + file_create(SCOREDAT_FN); file_write(&hi, sizeof(hi)); file_write(&hi, sizeof(hi)); file_write(&hi, sizeof(hi)); @@ -66,10 +66,10 @@ void pascal score_create(void) file_close(); } -void pascal score_recreate(void) +void pascal scoredat_recreate(void) { - score_defaults_set(); - score_create(); + scoredat_defaults_set(); + scoredat_create(); } #include "th02\scorelod.c" diff --git a/th02_maine.asm b/th02_maine.asm index bdf25ea2..38d753d7 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -2859,7 +2859,7 @@ sub_A8FA endp sub_AFE7 proc far push bp mov bp, sp - call score_extra_unlocked + call scoredat_is_extra_unlocked or ax, ax jz loc_B07D les bx, _mikoconfig @@ -2896,7 +2896,7 @@ sub_AFE7 endp sub_B07F proc far push bp mov bp, sp - call score_extra_unlocked + call scoredat_is_extra_unlocked or ax, ax jz loc_B115 mov PaletteTone, 0 @@ -3057,7 +3057,7 @@ maine_03_TEXT ends ; =========================================================================== maine_04_TEXT segment byte public 'CODE' use16 - extern SCORE_EXTRA_UNLOCKED:proc + extern SCOREDAT_IS_EXTRA_UNLOCKED:proc extern SCORE_ENTER:proc maine_04_TEXT ends diff --git a/th04_op.asm b/th04_op.asm index 906762f8..d342fbd2 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -1493,7 +1493,7 @@ loc_B40D: loc_B420: call op_animate - call score_cleared_load + call scoredat_cleared_load call main_cdg_load mov _in_option, 0 mov _quit, 0 @@ -2702,8 +2702,8 @@ sub_C68C endp ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame -public SCORE_LOAD -score_load proc near +public SCOREDAT_LOAD +scoredat_load proc near push bp mov bp, sp push ds @@ -2748,7 +2748,7 @@ loc_C79A: mov al, 0 pop bp retn -score_load endp +scoredat_load endp ; =============== S U B R O U T I N E ======================================= @@ -3128,7 +3128,7 @@ sub_CA94 proc near assume es:nothing mov al, es:[bx+0Fh] mov _rank, al - call score_load + call scoredat_load call pi_slot_load pascal, 0, ds, offset aHi01_pi loc_CADA: @@ -3155,7 +3155,7 @@ loc_CAE4: dec _rank mov PaletteTone, 0 call far ptr palette_show - call score_load + call scoredat_load call score_menu push 1 call palette_black_in @@ -3168,7 +3168,7 @@ loc_CB36: inc _rank mov PaletteTone, 0 call far ptr palette_show - call score_load + call scoredat_load jmp short loc_CADA ; --------------------------------------------------------------------------- @@ -3204,8 +3204,8 @@ sub_CA94 endp ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame -public SCORE_CLEARED_LOAD -score_cleared_load proc near +public SCOREDAT_CLEARED_LOAD +scoredat_cleared_load proc near push bp mov bp, sp mov _rank, RANK_EASY @@ -3213,7 +3213,7 @@ score_cleared_load proc near ; --------------------------------------------------------------------------- loc_CBEE: - call score_load + call scoredat_load or al, al jnz loc_CC78 mov al, _rank @@ -3275,7 +3275,7 @@ loc_CC78: call super_entry_bfnt pascal, ds, offset aHi_m_bft ; "hi_m.bft" pop bp retn -score_cleared_load endp +scoredat_cleared_load endp ; =============== S U B R O U T I N E ======================================= diff --git a/th05_op.asm b/th05_op.asm index fcb0d3e8..dd02875e 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -1432,7 +1432,7 @@ loc_AFE1: loc_AFF4: call op_animate call main_cdg_load - call score_cleared_load + call scoredat_cleared_load mov _in_option, 0 mov _quit, 0 mov _menu_sel, 0 @@ -3228,8 +3228,8 @@ sub_C8E2 endp ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame -public SCORE_LOAD -score_load proc near +public SCOREDAT_LOAD +scoredat_load proc near arg_0 = word ptr 4 @@ -3273,7 +3273,7 @@ loc_CA15: mov al, 0 pop bp retn 2 -score_load endp +scoredat_load endp ; =============== S U B R O U T I N E ======================================= @@ -3571,7 +3571,7 @@ score_render proc near loc_CC13: push si - call score_load + call scoredat_load xor di, di jmp short loc_CC21 ; --------------------------------------------------------------------------- @@ -3693,8 +3693,8 @@ score_menu endp ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame -public SCORE_CLEARED_LOAD -score_cleared_load proc near +public SCOREDAT_CLEARED_LOAD +scoredat_cleared_load proc near push bp mov bp, sp push si @@ -3710,7 +3710,7 @@ loc_CDA1: loc_CDA8: push si - call score_load + call scoredat_load or al, al jnz short loc_CE0D mov bx, si @@ -3793,7 +3793,7 @@ loc_CE5D: pop si pop bp retn -score_cleared_load endp +scoredat_cleared_load endp ; =============== S U B R O U T I N E =======================================