mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] Macros: Update to current coding standards
Less fancy token pasting, replacing them with inline functions where possible, entirely removing unnecessary ones, and fixing smaller issues here and there. Part of P0186, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
parent
ea54e59f93
commit
9432e0d2bf
|
@ -915,6 +915,7 @@ struct mcb_t {
|
|||
uint8_t m_fill[3];
|
||||
uint8_t m_name[8];
|
||||
};
|
||||
static const uint16_t MCB_PARAS = (sizeof(mcb_t) / 16);
|
||||
|
||||
respal_t __seg* z_respal_exist(void)
|
||||
{
|
||||
|
@ -925,7 +926,6 @@ respal_t __seg* z_respal_exist(void)
|
|||
int i;
|
||||
|
||||
#define MCB reinterpret_cast<mcb_t __seg *>(mcb) /* For easy derefencing */
|
||||
#define MCB_PARAS (sizeof(mcb_t) / 16) /* For segment pointer arithmetic */
|
||||
|
||||
// "Get list of lists"
|
||||
segread(&sregs);
|
||||
|
@ -950,7 +950,6 @@ respal_t __seg* z_respal_exist(void)
|
|||
mcb += MCB_PARAS + MCB->m_size;
|
||||
};
|
||||
|
||||
#undef MCB_PARAS
|
||||
#undef MCB
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,6 @@ void z_text_putsa(tram_x_t x, tram_y_t y, int z_atrb, const char *str)
|
|||
int p = ((y * text_width()) + x) * 2;
|
||||
int hw_atrb = 1;
|
||||
|
||||
#define tx_chars(byte) ((char*)MK_FP(0xA000, p + byte))
|
||||
#define tx_chars(byte) ((char*)MK_FP(0xA000, p + byte))
|
||||
#define tx_atrbs(byte) ((int16_t*)MK_FP(0xA200, p + byte))
|
||||
|
||||
|
|
|
@ -290,10 +290,8 @@ void regist_put_initial(
|
|||
table_stage_left(3),
|
||||
top,
|
||||
col_and_fx_text,
|
||||
(i == entered_place)
|
||||
? entered_route[0] : scoredat_routes[i * SCOREDAT_ROUTE_LEN],
|
||||
(i == entered_place)
|
||||
? entered_route[1] : scoredat_route_byte(i, 1)
|
||||
(i == entered_place) ? entered_route[0] : scoredat_route_byte(i, 0),
|
||||
(i == entered_place) ? entered_route[1] : scoredat_route_byte(i, 1)
|
||||
);
|
||||
if(entered_place == i) {
|
||||
entered_name_left = table_name_left(0);
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
static const unsigned int PELLET_DESTROY_SCORE = 10;
|
||||
static const int PELLET_DECAY_FRAMES = 20;
|
||||
static const int PELLET_DECAY_CELS = 2;
|
||||
|
||||
inline int decay_frames_for_cel(int cel) {
|
||||
return ((PELLET_DECAY_FRAMES / PELLET_DECAY_CELS) * cel);
|
||||
}
|
||||
/// ---------
|
||||
|
||||
/// Globals
|
||||
|
@ -630,8 +634,6 @@ void CPellets::unput_update_render(void)
|
|||
p->not_rendered = false;
|
||||
}
|
||||
#define render pellet_render
|
||||
#define decay_frames_for_cel(cel) \
|
||||
((PELLET_DECAY_FRAMES / PELLET_DECAY_CELS) * cel)
|
||||
if(p->decay_frame == 0) {
|
||||
render(p->cur_left.to_pixel(), p->cur_top.to_pixel(), 0);
|
||||
} else if(p->decay_frame <= decay_frames_for_cel(1)) {
|
||||
|
@ -639,7 +641,6 @@ void CPellets::unput_update_render(void)
|
|||
} else if(p->decay_frame < decay_frames_for_cel(2)) {
|
||||
render(p->cur_left.to_pixel(), p->cur_top.to_pixel(), 2);
|
||||
}
|
||||
#undef decay_frames_for_cel
|
||||
#undef render
|
||||
} else {
|
||||
p->not_rendered = true;
|
||||
|
|
|
@ -183,62 +183,59 @@ void pascal score_enter(void)
|
|||
input_locked = 1;
|
||||
input_delay = 0;
|
||||
|
||||
#define alphabet_cursor_move(coord, max, direction, col, row) \
|
||||
#define alphabet_cursor_move(coord, coord_max, ring_direction, col, row) \
|
||||
alphabet_putca(col, row, TX_WHITE); \
|
||||
RING_##direction(coord, ALPHABET_##max - 1); \
|
||||
ring_direction(coord, coord_max - 1); \
|
||||
alphabet_putca(col, row, TX_GREEN | TX_REVERSE);
|
||||
|
||||
// Otherwise, this leads to more levels of indentation than I would like.
|
||||
#define INPUTS if(key_det & INPUT_UP) { \
|
||||
alphabet_cursor_move(row, ROWS, DEC, col, row); \
|
||||
} \
|
||||
if(key_det & INPUT_DOWN) { \
|
||||
alphabet_cursor_move(row, ROWS, INC, col, row); \
|
||||
} \
|
||||
if(key_det & INPUT_LEFT) { \
|
||||
alphabet_cursor_move(col, COLS, DEC, col, row); \
|
||||
} \
|
||||
if(key_det & INPUT_RIGHT) { \
|
||||
alphabet_cursor_move(col, COLS, INC, col, row); \
|
||||
} \
|
||||
if(key_det & INPUT_SHOT || key_det & INPUT_OK) { \
|
||||
/* Yeah, it sucks that ZUN checks against the indices into the
|
||||
* alphabet structure rather than against the gaiji values. */ \
|
||||
if(row != 2 || col < 13) { \
|
||||
hi.score.g_name[place][name_pos] = gALPHABET[row][col]; \
|
||||
if(name_pos == 5) { \
|
||||
alphabet_putca(col, row, TX_WHITE); \
|
||||
col = ALPHABET_ENTER_COL; \
|
||||
row = ALPHABET_ENTER_ROW; \
|
||||
alphabet_putca(col, row, TX_GREEN | TX_REVERSE); \
|
||||
} \
|
||||
clamp_inc(name_pos, 5); \
|
||||
} else if(col == 13) { \
|
||||
hi.score.g_name[place][name_pos] = gb_SP; \
|
||||
clamp_inc(name_pos, 5); \
|
||||
} else if(col == 14) { \
|
||||
clamp_dec(name_pos, 0); \
|
||||
hi.score.g_name[place][name_pos] = gb_SP; \
|
||||
} else if(col == 15) { \
|
||||
clamp_inc(name_pos, 5); \
|
||||
} else if(col == 16) { \
|
||||
break; \
|
||||
} \
|
||||
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); \
|
||||
scoredat_name_puts(place, name_pos); \
|
||||
} \
|
||||
if(key_det & INPUT_CANCEL) { \
|
||||
break; \
|
||||
}
|
||||
|
||||
do {
|
||||
input_sense();
|
||||
if(!input_locked) {
|
||||
INPUTS;
|
||||
if(key_det & INPUT_UP) {
|
||||
alphabet_cursor_move(row, ALPHABET_ROWS, RING_DEC, col, row);
|
||||
}
|
||||
if(key_det & INPUT_DOWN) {
|
||||
alphabet_cursor_move(row, ALPHABET_ROWS, RING_INC, col, row);
|
||||
}
|
||||
if(key_det & INPUT_LEFT) {
|
||||
alphabet_cursor_move(col, ALPHABET_COLS, RING_DEC, col, row);
|
||||
}
|
||||
if(key_det & INPUT_RIGHT) {
|
||||
alphabet_cursor_move(col, ALPHABET_COLS, RING_INC, col, row);
|
||||
}
|
||||
if(key_det & INPUT_SHOT || key_det & INPUT_OK) {
|
||||
/* Yeah, it sucks that ZUN checks against the indices into the
|
||||
* alphabet structure rather than against the gaiji values. */
|
||||
if(row != 2 || col < 13) {
|
||||
hi.score.g_name[place][name_pos] = gALPHABET[row][col];
|
||||
if(name_pos == 5) {
|
||||
alphabet_putca(col, row, TX_WHITE);
|
||||
col = ALPHABET_ENTER_COL;
|
||||
row = ALPHABET_ENTER_ROW;
|
||||
alphabet_putca(col, row, TX_GREEN | TX_REVERSE);
|
||||
}
|
||||
clamp_inc(name_pos, 5);
|
||||
} else if(col == 13) {
|
||||
hi.score.g_name[place][name_pos] = gb_SP;
|
||||
clamp_inc(name_pos, 5);
|
||||
} else if(col == 14) {
|
||||
clamp_dec(name_pos, 0);
|
||||
hi.score.g_name[place][name_pos] = gb_SP;
|
||||
} else if(col == 15) {
|
||||
clamp_inc(name_pos, 5);
|
||||
} else if(col == 16) {
|
||||
break;
|
||||
}
|
||||
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);
|
||||
scoredat_name_puts(place, name_pos);
|
||||
}
|
||||
if(key_det & INPUT_CANCEL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
frame_delay(1);
|
||||
input_locked = key_det;
|
||||
|
|
|
@ -537,21 +537,21 @@ void option_update_and_render(void)
|
|||
static bool input_allowed = false;
|
||||
static bool initialized = false;
|
||||
|
||||
#define OPTION_CHANGE(direction) \
|
||||
#define option_change(ring_direction) \
|
||||
option_put(menu_sel, TX_YELLOW); \
|
||||
switch(menu_sel) { \
|
||||
case 0: \
|
||||
RING_##direction##(rank, option_rank_max()); \
|
||||
ring_direction(rank, option_rank_max()); \
|
||||
break; \
|
||||
case 1: \
|
||||
RING_##direction##((char)snd_bgm_mode, option_bgm_max()); \
|
||||
ring_direction((char)snd_bgm_mode, option_bgm_max()); \
|
||||
snd_bgm_restart(); \
|
||||
break; \
|
||||
case 2: \
|
||||
RING_##direction##(lives, option_lives_max()); \
|
||||
ring_direction(lives, option_lives_max()); \
|
||||
break; \
|
||||
case 3: \
|
||||
RING_##direction##(bombs, option_bombs_max()); \
|
||||
ring_direction(bombs, option_bombs_max()); \
|
||||
break; \
|
||||
case 4: \
|
||||
resident->perf = 1 - resident->perf; \
|
||||
|
@ -584,10 +584,10 @@ void option_update_and_render(void)
|
|||
menu_sel_move(6, 1);
|
||||
}
|
||||
if(key_det & INPUT_RIGHT) {
|
||||
OPTION_CHANGE(INC);
|
||||
option_change(RING_INC);
|
||||
}
|
||||
if(key_det & INPUT_LEFT) {
|
||||
OPTION_CHANGE(DEC);
|
||||
option_change(RING_DEC);
|
||||
}
|
||||
if(key_det & INPUT_SHOT || key_det & INPUT_OK) {
|
||||
switch(menu_sel) {
|
||||
|
|
|
@ -126,14 +126,14 @@ void pascal draw_header(void)
|
|||
|
||||
void pascal shottype_menu_init(void)
|
||||
{
|
||||
#define DRAW_CLEARED_FOR(mode) \
|
||||
if(cleared_##mode##_with[0]) { \
|
||||
#define draw_cleared_for(cleared_mode_with) \
|
||||
if(cleared_mode_with[0]) { \
|
||||
graph_putsa_fx(16, 112, (15 | FX_WEIGHT_BOLD), CLEARED); \
|
||||
} \
|
||||
if(cleared_##mode##_with[1]) { \
|
||||
if(cleared_mode_with[1]) { \
|
||||
graph_putsa_fx(224, 112, (15 | FX_WEIGHT_BOLD), CLEARED); \
|
||||
} \
|
||||
if(cleared_##mode##_with[2]) { \
|
||||
if(cleared_mode_with[2]) { \
|
||||
graph_putsa_fx(432, 112, (15 | FX_WEIGHT_BOLD), CLEARED); \
|
||||
}
|
||||
|
||||
|
@ -143,9 +143,9 @@ void pascal shottype_menu_init(void)
|
|||
graph_copy_page(1);
|
||||
graph_accesspage(0);
|
||||
if(resident->stage != 5) {
|
||||
DRAW_CLEARED_FOR(game);
|
||||
draw_cleared_for(cleared_game_with);
|
||||
} else {
|
||||
DRAW_CLEARED_FOR(extra);
|
||||
draw_cleared_for(cleared_extra_with);
|
||||
}
|
||||
pi_put_8( 24, 136, 0);
|
||||
pi_put_8(224, 224, 1);
|
||||
|
@ -162,6 +162,12 @@ void pascal shottype_menu_init(void)
|
|||
palette_black_in(2);
|
||||
}
|
||||
|
||||
inline void draw_new_sel(const screen_x_t pic_x[3], const screen_y_t pic_y[3]) {
|
||||
frame_delay(1); copy_pic_back(sel, 1);
|
||||
frame_delay(1); draw_shottype_desc(sel, 12);
|
||||
frame_delay(1); pi_put_8(pic_x[sel], pic_y[sel], sel);
|
||||
}
|
||||
|
||||
void pascal shottype_menu(void)
|
||||
{
|
||||
int input_locked = 0;
|
||||
|
@ -170,11 +176,6 @@ void pascal shottype_menu(void)
|
|||
unsigned int input_delay = 0;
|
||||
shottype_menu_init();
|
||||
|
||||
#define DRAW_NEW_SEL() \
|
||||
frame_delay(1); copy_pic_back(sel, 1); \
|
||||
frame_delay(1); draw_shottype_desc(sel, 12); \
|
||||
frame_delay(1); pi_put_8(pic_x[sel], pic_y[sel], sel);
|
||||
|
||||
do {
|
||||
input_sense();
|
||||
if(!input_locked) {
|
||||
|
@ -188,7 +189,7 @@ void pascal shottype_menu(void)
|
|||
darken_pic_at(pic_x[sel] + 8, pic_y[sel] + 8);
|
||||
|
||||
RING_DEC(sel, sel_ring_end());
|
||||
DRAW_NEW_SEL();
|
||||
draw_new_sel(pic_x, pic_y);
|
||||
}
|
||||
if(key_det & INPUT_RIGHT) {
|
||||
copy_pic_back(sel, 0);
|
||||
|
@ -200,7 +201,7 @@ void pascal shottype_menu(void)
|
|||
darken_pic_at(pic_x[sel] + 8, pic_y[sel] + 8);
|
||||
|
||||
RING_INC(sel, sel_ring_end());
|
||||
DRAW_NEW_SEL();
|
||||
draw_new_sel(pic_x, pic_y);
|
||||
}
|
||||
if(key_det & INPUT_SHOT || key_det & INPUT_OK) {
|
||||
resident->shottype = sel;
|
||||
|
|
|
@ -128,35 +128,38 @@ void pascal near polygon_build(
|
|||
pts[i].y = pts[0].y;
|
||||
}
|
||||
|
||||
#define polygon_init(i, y_, velocity_x) { \
|
||||
pos[i].x = (rand() % RES_X); \
|
||||
pos[i].y = y_; \
|
||||
move_speed[i].x = velocity_x; \
|
||||
if(move_speed[i].x == 0) { \
|
||||
move_speed[i].x = 1; \
|
||||
} \
|
||||
move_speed[i].y = (((rand() & 3) << 4) + 32); \
|
||||
angle[i] = rand(); \
|
||||
rot_speed[i] = 0x04 - (rand() & 0x07); \
|
||||
if(rot_speed[i] == 0x00) { \
|
||||
rot_speed[i] = 0x04; \
|
||||
} \
|
||||
}
|
||||
|
||||
inline int polygon_vertex_count(int i) {
|
||||
return ((i / 4) + 3);
|
||||
}
|
||||
|
||||
void pascal near polygons_update_and_render(void)
|
||||
{
|
||||
#define VERTICES(i) (i / 4) + 3
|
||||
|
||||
#define POLYGON_INIT_PART2 \
|
||||
if(move_speed[i].x == 0) { \
|
||||
move_speed[i].x = 1; \
|
||||
} \
|
||||
move_speed[i].y = ((rand() & 3) << 4) + 32; \
|
||||
angle[i] = rand(); \
|
||||
rot_speed[i] = 0x04 - (rand() & 0x07); \
|
||||
if(rot_speed[i] == 0) { \
|
||||
rot_speed[i] = 0x04; \
|
||||
}
|
||||
|
||||
int i;
|
||||
if(!initialized) {
|
||||
for(i = 0; i < MUSIC_POLYGONS; i++) {
|
||||
pos[i].x = rand() % 640;
|
||||
pos[i].y = rand() % (400 * 16);
|
||||
move_speed[i].x = 4 - (rand() & 7);
|
||||
POLYGON_INIT_PART2;
|
||||
polygon_init(i, (rand() % (RES_Y * 16)), (4 - (rand() & 7)));
|
||||
}
|
||||
initialized = 1;
|
||||
}
|
||||
for(i = 0; i < MUSIC_POLYGONS; i++) {
|
||||
polygon_build(
|
||||
points, pos[i].x, pos[i].y,
|
||||
((i & 3) << 4) + 64, VERTICES(i), angle[i]
|
||||
(((i & 3) << 4) + 64), polygon_vertex_count(i), angle[i]
|
||||
);
|
||||
pos[i].x += move_speed[i].x;
|
||||
pos[i].y += move_speed[i].y;
|
||||
|
@ -164,13 +167,12 @@ void pascal near polygons_update_and_render(void)
|
|||
if(pos[i].x <= 0 || pos[i].x >= 639) {
|
||||
move_speed[i].x *= -1;
|
||||
}
|
||||
if(pos[i].y >= (400 * 20)) {
|
||||
pos[i].x = rand() % 640;
|
||||
pos[i].y = -1600;
|
||||
move_speed[i].x = 8 - (rand() & 15);
|
||||
POLYGON_INIT_PART2;
|
||||
if(pos[i].y >= (RES_Y * 20)) {
|
||||
polygon_init(i, -(RES_Y * 4), (8 - (rand() & 15)));
|
||||
}
|
||||
grcg_polygon_c(reinterpret_cast<Point *>(points), VERTICES(i));
|
||||
grcg_polygon_c(
|
||||
reinterpret_cast<Point *>(points), polygon_vertex_count(i)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
# define INITIALIZED "それでは、よろしくお願いします"
|
||||
#endif
|
||||
|
||||
#define arg_is(arg, capital, small) \
|
||||
((arg[0] == '-' ) || (arg[0] == '/' )) && \
|
||||
((arg[1] == capital) || (arg[1] == small))
|
||||
|
||||
int main(int argc, const unsigned char **argv)
|
||||
{
|
||||
resident_t __seg *sgm;
|
||||
|
@ -29,10 +33,7 @@ int main(int argc, const unsigned char **argv)
|
|||
RES_INIT_TOP;
|
||||
#endif
|
||||
if(argc == 2) {
|
||||
#define arg1_is(capital, small) \
|
||||
(argv[1][0] == '-' || argv[1][0] == '/') \
|
||||
&& (argv[1][1] == (capital) || argv[1][1] == (small))
|
||||
if(arg1_is('R', 'r')) {
|
||||
if(arg_is(argv[1], 'R', 'r')) {
|
||||
if(!sgm) {
|
||||
dos_puts2(ERROR_NOT_RESIDENT "\n\n");
|
||||
return 1;
|
||||
|
@ -40,7 +41,7 @@ int main(int argc, const unsigned char **argv)
|
|||
dos_free(sgm);
|
||||
dos_puts2(REMOVED "\n\n");
|
||||
return 0;
|
||||
} else if(arg1_is('D', 'd')) {
|
||||
} else if(arg_is(argv[1], 'D', 'd')) {
|
||||
debug = 1;
|
||||
} else {
|
||||
dos_puts2("そんなオプション付けられても、困るんですけど\n\n");
|
||||
|
|
|
@ -50,7 +50,6 @@ bool16 snd_determine_mode(void);
|
|||
// Calls the interrupt handler of the installed sound driver with AX = [ax],
|
||||
// if any. If BGM is disabled, the return value is undefined.
|
||||
int16_t DEFCONV snd_kaja_interrupt(int16_t ax);
|
||||
#define snd_kaja_func(func, param) snd_kaja_interrupt((func) << 8 | (param))
|
||||
|
||||
// Blocks until the active sound driver reports the given [volume] via
|
||||
// KAJA_GET_VOLUME. The behavior is undefined if no sound driver is active.
|
||||
|
@ -61,6 +60,11 @@ void snd_delay_until_volume(uint8_t volume);
|
|||
#endif
|
||||
|
||||
#if defined(PMD) /* requires kaja.h */
|
||||
#if defined(__cplusplus)
|
||||
inline int16_t snd_kaja_func(kaja_func_t func, int8_t param) {
|
||||
return snd_kaja_interrupt((func) << 8 | (param));
|
||||
}
|
||||
#endif
|
||||
#if defined(__cplusplus) && (GAME <= 4)
|
||||
static inline uint16_t snd_load_size() {
|
||||
// ZUN bug: Should rather retrieve the maximum data size for song
|
||||
|
@ -95,8 +99,11 @@ void snd_se_reset(void);
|
|||
void DEFCONV snd_se_play(int new_se);
|
||||
void snd_se_update(void);
|
||||
|
||||
// Cancels any currently playing sound effect to play the given one.
|
||||
#define snd_se_play_force(new_se) \
|
||||
snd_se_reset(); \
|
||||
snd_se_play(new_se); \
|
||||
snd_se_update();
|
||||
#ifdef __cplusplus
|
||||
// Cancels any currently playing sound effect to play the given one.
|
||||
inline void snd_se_play_force(int new_se) {
|
||||
snd_se_reset();
|
||||
snd_se_play(new_se);
|
||||
snd_se_update();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@ void pascal sprite16_sprites_commit(void)
|
|||
#define sprite_offset_local (_DI)
|
||||
#define putpos_left static_cast<int>(_DX)
|
||||
#define putpos_right static_cast<int>(_BX)
|
||||
#define putpos_right_high (_BH)
|
||||
#define clip_left static_cast<int>(_SI)
|
||||
#define clip_right static_cast<int>(_CX)
|
||||
#define put_w_words (_AL)
|
||||
|
@ -37,7 +38,7 @@ void pascal sprite16_sprites_commit(void)
|
|||
sprite_offset_local = sprite_offset; \
|
||||
putpos_left = left; \
|
||||
put_w_words = sprite16_put_w.v; \
|
||||
_BH ^= _BH; /* upper 8 bits of putpos_right */ \
|
||||
putpos_right_high ^= putpos_right_high; \
|
||||
static_cast<char>(putpos_right) = put_w_words; \
|
||||
putpos_right <<= 4; \
|
||||
putpos_right += putpos_left; \
|
||||
|
@ -148,7 +149,7 @@ void pascal sprite16_put_noclip(
|
|||
// assignment, which actually makes it incorrect...
|
||||
sprite_offset_local = sprite_offset;
|
||||
putpos_left = left;
|
||||
_BH ^= _BH; /* upper 8 bits of putpos_right */
|
||||
putpos_right_high ^= putpos_right_high;
|
||||
static_cast<char>(putpos_right) = put_w_words;
|
||||
putpos_right <<= 4;
|
||||
putpos_right += putpos_left;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
// A completely filled, 128-pixel bar, stored in 8 consecutive gaiji
|
||||
// characters. TH05 has *MAX♡ drawn on the last three.
|
||||
#define G_BAR_MAX(sprite)
|
||||
#define gaiji_bar_max(start) \
|
||||
g_BAR_MAX_0 = start, \
|
||||
g_BAR_MAX_1, \
|
||||
|
|
|
@ -24,7 +24,7 @@ extern "C" {
|
|||
#include "th04/formats/cdg.h"
|
||||
#include "th04/snd/snd.h"
|
||||
#include "th04/sprites/op_cdg.h"
|
||||
#include "th04/op/op.h"
|
||||
#include "th04/op/op.hpp"
|
||||
|
||||
#include "th04/shiftjis/m_char.cpp"
|
||||
|
||||
|
@ -249,15 +249,13 @@ void near raise_bg_free(void)
|
|||
void near pascal pic_darken(playchar_t playchar)
|
||||
{
|
||||
vram_offset_t vo;
|
||||
vram_byte_amount_t x;
|
||||
pixel_t y;
|
||||
|
||||
if(playchar == PLAYCHAR_REIMU) {
|
||||
vo = vram_offset_shift(REIMU_LEFT, REIMU_TOP);
|
||||
} else {
|
||||
vo = vram_offset_shift(MARISA_LEFT, MARISA_TOP);
|
||||
}
|
||||
darken(vo, x, y, PIC_W, PIC_H, 1);
|
||||
darken(vo, PIC_W, PIC_H, 1);
|
||||
}
|
||||
|
||||
#define playchar_title_left_for(left, playchar) \
|
||||
|
@ -486,7 +484,7 @@ bool16 near playchar_menu(void)
|
|||
for(rank = RANK_NORMAL; rank < RANK_EXTRA; rank++) { \
|
||||
extra_unlocked |= cleared_with[playchar][rank] & flag; \
|
||||
} \
|
||||
selectable_with[playchar][shottype] = (extra_unlocked) != false;
|
||||
selectable_with[playchar][shottype] = (extra_unlocked != false);
|
||||
|
||||
set_selectable_with(playchar, SHOTTYPE_A, SCOREDAT_CLEARED_A);
|
||||
set_selectable_with(playchar, SHOTTYPE_B, SCOREDAT_CLEARED_B);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// Darkens the [w]×[h] area starting at [vram_offset], by writing an
|
||||
// alternating dot pattern in the given [col]. [x] and [y] store the currently
|
||||
// iterated position.
|
||||
#define darken(vram_offset, x, y, w, h, col) \
|
||||
// alternating dot pattern in the given [col].
|
||||
#define darken(vram_offset, w, h, col) \
|
||||
vram_byte_amount_t x; \
|
||||
pixel_t y; \
|
||||
grcg_setcolor(GC_RMW, col); \
|
||||
dots32_t pattern = 0xAAAAAAAA; \
|
||||
\
|
||||
|
|
|
@ -25,14 +25,17 @@ void near cleardata_and_regist_view_sprites_load(void);
|
|||
// return to the main menu (true).
|
||||
bool16 near playchar_menu(void);
|
||||
|
||||
// Synchronizes both VRAM pages within a 2-frame delay.
|
||||
#define sync_pages_and_delay() \
|
||||
vsync_reset1(); \
|
||||
frame_delay(1); \
|
||||
\
|
||||
graph_showpage(1); \
|
||||
graph_copy_page(0); \
|
||||
vsync_reset1(); \
|
||||
frame_delay(1); \
|
||||
\
|
||||
graph_showpage(0);
|
||||
#ifdef X86REAL_H
|
||||
// Synchronizes both VRAM pages within a 2-frame delay.
|
||||
inline void sync_pages_and_delay() {
|
||||
vsync_reset1();
|
||||
frame_delay(1);
|
||||
|
||||
graph_showpage(1);
|
||||
graph_copy_page(0);
|
||||
vsync_reset1();
|
||||
frame_delay(1);
|
||||
|
||||
graph_showpage(0);
|
||||
}
|
||||
#endif
|
|
@ -19,7 +19,7 @@ extern "C" {
|
|||
#include "th04/common.h"
|
||||
#include "th05/playchar.h"
|
||||
#include "th05/resident.hpp"
|
||||
#include "th05/op/op.h"
|
||||
#include "th05/op/op.hpp"
|
||||
#include "th05/sprites/op_cdg.h"
|
||||
#include "th05/snd/snd.h"
|
||||
#include "th05/hardware/input.h"
|
||||
|
@ -59,8 +59,6 @@ bool selectable_with[PLAYCHAR_COUNT];
|
|||
void pascal near pic_darken(unsigned char playchar)
|
||||
{
|
||||
vram_offset_t vram_offset;
|
||||
vram_byte_amount_t x;
|
||||
pixel_t y;
|
||||
|
||||
switch(playchar) {
|
||||
case PLAYCHAR_REIMU:
|
||||
|
@ -76,7 +74,7 @@ void pascal near pic_darken(unsigned char playchar)
|
|||
vram_offset = vram_offset_shift(YUUKA_LEFT, YUUKA_TOP);
|
||||
break;
|
||||
}
|
||||
darken(vram_offset, x, y, PIC_W, PIC_H, 1);
|
||||
darken(vram_offset, PIC_W, PIC_H, 1);
|
||||
}
|
||||
|
||||
void pascal near pic_put(bool16 darkened)
|
||||
|
@ -86,17 +84,17 @@ void pascal near pic_put(bool16 darkened)
|
|||
screen_x_t cleared_left;
|
||||
vram_y_t cleared_top;
|
||||
|
||||
#define set_coords_for(playchar) \
|
||||
pic_left = playchar##_LEFT; \
|
||||
pic_top = playchar##_TOP; \
|
||||
cleared_left = (playchar##_LEFT + (PIC_W - CLEARED_W)); \
|
||||
cleared_top = (playchar##_TOP + (PIC_H - CLEARED_H));
|
||||
#define set_coords(left, top) \
|
||||
pic_left = left; \
|
||||
pic_top = top; \
|
||||
cleared_left = (left + (PIC_W - CLEARED_W)); \
|
||||
cleared_top = (top + (PIC_H - CLEARED_H));
|
||||
|
||||
switch(playchar_menu_sel) {
|
||||
case PLAYCHAR_REIMU: set_coords_for(REIMU); break;
|
||||
case PLAYCHAR_MARISA: set_coords_for(MARISA); break;
|
||||
case PLAYCHAR_MIMA: set_coords_for(MIMA); break;
|
||||
case PLAYCHAR_YUUKA: set_coords_for(YUUKA); break;
|
||||
case PLAYCHAR_REIMU: set_coords(REIMU_LEFT, REIMU_TOP); break;
|
||||
case PLAYCHAR_MARISA: set_coords(MARISA_LEFT, MARISA_TOP); break;
|
||||
case PLAYCHAR_MIMA: set_coords(MIMA_LEFT, MIMA_TOP); break;
|
||||
case PLAYCHAR_YUUKA: set_coords(YUUKA_LEFT, YUUKA_TOP); break;
|
||||
}
|
||||
|
||||
#define pic_raised_left (pic_left - RAISE_W)
|
||||
|
@ -156,7 +154,7 @@ void pascal near pic_put(bool16 darkened)
|
|||
pic_darken(playchar_menu_sel);
|
||||
}
|
||||
|
||||
#undef set_coords_for
|
||||
#undef set_coords
|
||||
#undef pic_raised_top
|
||||
#undef pic_raised_left
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#include "th04/op/op.h"
|
||||
#include "th04/op/op.hpp"
|
||||
|
||||
extern bool extra_playable_with[PLAYCHAR_COUNT];
|
|
@ -16,7 +16,7 @@ extern "C" {
|
|||
#include "th04/score.h"
|
||||
#include "th04/end/end.h"
|
||||
#include "th05/playchar.h"
|
||||
#include "th05/op/op.h"
|
||||
#include "th05/op/op.hpp"
|
||||
#include "th05/snd/snd.h"
|
||||
#include "th05/resident.hpp"
|
||||
#include "th05/hardware/input.h"
|
||||
|
|
|
@ -13,7 +13,7 @@ extern "C" {
|
|||
#include "th04/formats/scoredat.h"
|
||||
#include "th05/playchar.h"
|
||||
#include "th05/resident.hpp"
|
||||
#include "th05/op/op.h"
|
||||
#include "th05/op/op.hpp"
|
||||
|
||||
scoredat_section_t hi;
|
||||
scoredat_section_t hi2;
|
||||
|
|
|
@ -11,14 +11,16 @@ extern "C" {
|
|||
|
||||
#pragma option -a2
|
||||
|
||||
#define STAR_DISTANCE (16)
|
||||
#define STAR_OFFSET(count) (8 - ((count / 2) * STAR_DISTANCE))
|
||||
static const subpixel_t STAR_DISTANCE = TO_SP(16);
|
||||
inline subpixel_t star_offset(int count) {
|
||||
return (to_sp(8.0f) - ((count / 2) * STAR_DISTANCE));
|
||||
}
|
||||
|
||||
#define marisa_stars(shot, dmg) \
|
||||
shot->pos.cur.x.v += star_distance; \
|
||||
shot->damage = dmg; \
|
||||
shot->pos.velocity.y.set(-12.0f); \
|
||||
star_distance += to_sp(STAR_DISTANCE);
|
||||
star_distance += STAR_DISTANCE;
|
||||
|
||||
void pascal near shot_marisa_l2(void)
|
||||
{
|
||||
|
@ -48,8 +50,8 @@ void pascal near shot_marisa_l3(void)
|
|||
shot_func_init(shot, sai, cycle, STAR_COUNT, SC_3X, SC_1X, i += 4);
|
||||
while(( shot = shots_add() ) != NULL) {
|
||||
if(sai.i <= STAR_COUNT) {
|
||||
if(sai.i == STAR_COUNT) { shot->pos.cur.x -= STAR_OFFSET(0); }
|
||||
else /* sai_i == 1 */ { shot->pos.cur.x += STAR_OFFSET(0); }
|
||||
if(sai.i == STAR_COUNT) { shot->pos.cur.x.v -= star_offset(0); }
|
||||
else /* sai_i == 1 */ { shot->pos.cur.x.v += star_offset(0); }
|
||||
shot->damage = 7;
|
||||
} else {
|
||||
switch(sai.i - 3u) {
|
||||
|
@ -131,7 +133,7 @@ void pascal near shot_marisa_l6(void)
|
|||
#undef STAR_COUNT
|
||||
#define STAR_COUNT 4
|
||||
shot_func_init(shot, sai, cycle, STAR_COUNT, SC_3X, SC_1X, i += 8);
|
||||
subpixel_t star_distance = to_sp(STAR_OFFSET(STAR_COUNT));
|
||||
subpixel_t star_distance = star_offset(STAR_COUNT);
|
||||
while(( shot = shots_add() ) != NULL) {
|
||||
if(sai.i <= STAR_COUNT) {
|
||||
marisa_stars(shot, 5);
|
||||
|
@ -158,7 +160,7 @@ void pascal near shot_marisa_l6(void)
|
|||
shot_func_init( \
|
||||
shot, sai, cycle, star_count, SC_3X, SC_1X, i += missile_count \
|
||||
); \
|
||||
subpixel_t star_distance = to_sp(STAR_OFFSET(star_count)); \
|
||||
subpixel_t star_distance = star_offset(star_count); \
|
||||
while(( shot = shots_add() ) != NULL) { \
|
||||
if(sai.i <= star_count) { \
|
||||
marisa_stars(shot, star_damage); \
|
||||
|
@ -198,7 +200,7 @@ void pascal near shot_marisa_l9(void)
|
|||
#define STAR_COUNT 6
|
||||
|
||||
shot_func_init(shot, sai, cycle, STAR_COUNT, SC_3X, SC_1X, i += 12);
|
||||
subpixel_t star_distance = to_sp(STAR_OFFSET(STAR_COUNT));
|
||||
subpixel_t star_distance = star_offset(STAR_COUNT);
|
||||
while(( shot = shots_add() ) != NULL) {
|
||||
if(sai.i <= STAR_COUNT) {
|
||||
marisa_stars(shot, 4);
|
||||
|
|
Loading…
Reference in New Issue