ReC98/th02/scoreenc.c
nmlgc b7de999705 [Maintenance] Improve score data file-related type and function names
So many things named `score_*`, so many things named `hiscore_*`…
Let's go with `scoredat_*`, which clearly indicates that this stuff is
saved into a file, while still being only 8 characters.

Part of P0063, funded by -Tom-.
2019-12-28 12:14:02 +01:00

21 lines
573 B
C

/* ReC98
* -----
* TH02 high score pre-save encoding
*/
#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 < 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]; \
} \
for(i = 0; i < sizeof(hi.score); i++) { \
hi.score_sum += *((unsigned char*)(&hi.score) + i); \
*((unsigned char*)(&hi.score) + i) += 0x12; \
}