mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] [th03/th04/th05] Cutscene: Resolve fade command inconsistencies
Saves 4 pieces of ZUN bloat and allows the implementation code to be shared with the upcoming TH04/TH05 dialog system. Part of P0258, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
parent
0709533ca7
commit
2cb65157f0
|
@ -558,6 +558,16 @@ void near cursor_advance_and_animate(void)
|
||||||
// Called with [script_p] at the character past [c].
|
// Called with [script_p] at the character past [c].
|
||||||
script_ret_t pascal near script_op(unsigned char c)
|
script_ret_t pascal near script_op(unsigned char c)
|
||||||
{
|
{
|
||||||
|
// ZUN bloat: Needed for code generation reasons. The structure of the
|
||||||
|
// conditional branches below ensures that the `return`s have no actual
|
||||||
|
// effect, so this block can just be deleted.
|
||||||
|
#if (GAME == 5)
|
||||||
|
#define palette_black_in(x) palette_black_in(x); return CONTINUE;
|
||||||
|
#define palette_black_out(x) palette_black_out(x); return CONTINUE;
|
||||||
|
#define palette_white_in(x) palette_white_in(x); return CONTINUE;
|
||||||
|
#define palette_white_out(x) palette_white_out(x); return CONTINUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int p1;
|
int p1;
|
||||||
int p2;
|
int p2;
|
||||||
|
@ -641,23 +651,8 @@ script_ret_t pascal near script_op(unsigned char c)
|
||||||
case 'w':
|
case 'w':
|
||||||
c = tolower(*script_p);
|
c = tolower(*script_p);
|
||||||
if((c == 'o') || (c == 'i')) {
|
if((c == 'o') || (c == 'i')) {
|
||||||
script_p++;
|
script_op_fade(c, palette_white_in, palette_white_out, p1);
|
||||||
script_param_read_number_first(p1, 1);
|
|
||||||
if(c == 'i') {
|
|
||||||
palette_white_in(p1);
|
|
||||||
#if (GAME == 5) // ZUN bloat: `break` or `return`, pick one!
|
|
||||||
return CONTINUE;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
palette_white_out(p1);
|
|
||||||
#if (GAME == 5) // ZUN bloat: `break` or `return`, pick one!
|
|
||||||
return CONTINUE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#if (GAME <= 4)
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#if (GAME >= 4)
|
#if (GAME >= 4)
|
||||||
box_1_to_0_animate();
|
box_1_to_0_animate();
|
||||||
#endif
|
#endif
|
||||||
|
@ -690,8 +685,8 @@ script_ret_t pascal near script_op(unsigned char c)
|
||||||
script_param_read_number_first(p1);
|
script_param_read_number_first(p1);
|
||||||
script_param_read_number_second(p2);
|
script_param_read_number_second(p2);
|
||||||
if(!fast_forward) {
|
if(!fast_forward) {
|
||||||
// ZUN landmine: Does not prevent the potential deadlock issue
|
// ZUN landmine: Does not prevent the potential deadlock
|
||||||
// with this function.
|
// issue with this function.
|
||||||
#if (GAME >= 4)
|
#if (GAME >= 4)
|
||||||
snd_delay_until_measure(p1, p2);
|
snd_delay_until_measure(p1, p2);
|
||||||
#else
|
#else
|
||||||
|
@ -703,6 +698,7 @@ script_ret_t pascal near script_op(unsigned char c)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
|
@ -728,19 +724,7 @@ script_ret_t pascal near script_op(unsigned char c)
|
||||||
c = *script_p;
|
c = *script_p;
|
||||||
if(c != 'm') {
|
if(c != 'm') {
|
||||||
if((c == 'i') || (c == 'o')) {
|
if((c == 'i') || (c == 'o')) {
|
||||||
script_p++;
|
script_op_fade(c, palette_black_in, palette_black_out, p1);
|
||||||
script_param_read_number_first(p1, 1);
|
|
||||||
if(c == 'i') {
|
|
||||||
palette_black_in(p1);
|
|
||||||
#if (GAME == 5) // ZUN bloat: `break` or `return`, pick one!
|
|
||||||
return CONTINUE;
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
palette_black_out(p1);
|
|
||||||
#if (GAME == 5) // ZUN bloat: `break` or `return`, pick one!
|
|
||||||
return CONTINUE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
script_p++;
|
script_p++;
|
||||||
|
|
|
@ -86,4 +86,18 @@ extern int script_param_number_default;
|
||||||
} \
|
} \
|
||||||
ret[temp_len] = '\0'; \
|
ret[temp_len] = '\0'; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Commands shared between the cutscene and dialog systems
|
||||||
|
// -------------------------------------------------------
|
||||||
|
|
||||||
|
#define script_op_fade(c, func_in, func_out, temp_p1) { \
|
||||||
|
script_p++; \
|
||||||
|
script_param_read_number_first(temp_p1, 1); \
|
||||||
|
if(c == 'i') { \
|
||||||
|
func_in(p1); \
|
||||||
|
} else { \
|
||||||
|
func_out(p1); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
// -------------------------------------------------------
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue