ui_outline( ctx, box, 1, GUI_COL_NORM, 0 );
ctx->font = &vgf_default_title;
- ui_rect title = { box[0], box[1] + 16, box[2], box[3]-16 };
- ui_text( ctx, box, "Retry?", 1, k_ui_align_center, 0 );
+ ui_rect title = { box[0], box[1] + 12, box[2], box[3]-16 };
+ ui_text( ctx, title, "Retry?", 1, k_ui_align_center, 0 );
ui_rect bar = { box[0] + 8, (box[1] + box[3]) - (24+8), box[2] - 16, 24 };
ui_fill( ctx, bar, ui_opacity( GUI_COL_DARK, 0.8f ) );
_cutscene.state = k_cutscene_state_unloading;
_cutscene.player_binding = NULL;
_cutscene.subtitle = NULL;
+ _cutscene.subtitle_length_warning = 0;
_cutscene.subtitle_list = NULL;
_cutscene.subtitle_index = 0;
_cutscene.fadeout = 0;
_cutscene.state = k_cutscene_state_none;
_cutscene.marker_this_frame = NULL;
_cutscene.subtitle = NULL;
+ _cutscene.subtitle_length_warning = 0;
return;
}
if( vg_str_eq( marker, next->key ) )
{
_cutscene.subtitle = next->value;
+ _cutscene.subtitle_length_warning = 0;
_cutscene.subtitle_index ++;
absorbed = 1;
}
else if( vg_str_eq( marker, "$clear_subtitles" ) )
{
_cutscene.subtitle = NULL;
+ _cutscene.subtitle_length_warning = 0;
absorbed = 1;
}
}
{
if( _cutscene.subtitle )
{
- ui_rect box = { 0,0, 800, 40 };
+ ctx->font = &vgf_default_small;
+ ctx->kern[1] = 16;
+ ui_px scale = 2;
+
+ ui_rect box = { 0,0, 1000, 80*2 };
ui_rect_center( (ui_rect){0,0,vg.window_x,vg.window_y}, box );
box[1] = vg.window_y - (box[3] + 8);
- ui_fill( ctx, box, ui_opacity( GUI_COL_DARK, 0.36f ) );
- ctx->font = &vgf_default_large;
- ui_text( ctx, box, _cutscene.subtitle, 1, k_ui_align_middle_center, 0 );
+ i32 lines = 1;
+
+ const char *_c = _cutscene.subtitle;
+ u8 c;
+
+ i32 length = 0;
+ ui_px y = box[1];
+
+ while(1)
+ {
+ c = *(_c ++);
+
+ /* TODO: This is pasted straight from vg_ui, maybe create a vg_ui_text_iter() ...? */
+ if( c == '\x1B' )
+ {
+ while( (c = *(_c ++)) )
+ {
+ if( c == 'm' )
+ break;
+ }
+
+ if( c == 0 )
+ break;
+ else
+ continue;
+ }
+
+ if( c >= 32 )
+ length ++;
+ else if( c == '\n' || c == '\0' )
+ {
+ ui_px w = length * ctx->font->sx*scale + 16;
+ ui_rect background_rect = { vg.window_x/2 - w/2, y-8, w, ctx->font->sy*scale+16 };
+
+ ui_fill( ctx, background_rect, ui_opacity( GUI_COL_DARK, 0.75f ) );
+ y += (ctx->font->sy)*scale + 16;
+
+ if( !_cutscene.subtitle_length_warning && (length > 50) )
+ {
+ vg_warn( "Subtitle text too long; '%s'\nLine limit 50chs, line was: %u\n", _cutscene.subtitle, length );
+ _cutscene.subtitle_length_warning = 1;
+ }
+ length = 0;
+
+ if( !_cutscene.subtitle_length_warning && (lines == 2) && (c != '\0') )
+ {
+ vg_warn( "Subtitle contains more than 2 lines; '%s'\n", _cutscene.subtitle );
+ _cutscene.subtitle_length_warning = 1;
+ }
+ lines ++;
+ }
+
+ if( c == '\0' )
+ break;
+ }
+ ui_text( ctx, box, _cutscene.subtitle, scale, k_ui_align_center, 0 );
ctx->font = &vgf_default_small;
+ ctx->kern[1] = 0;
}
}
static bool _skaterift_script_ch1s5( ent_script_event *event )
{
static const struct cs_subtitle EN[] = {
- { "j1", KCOL_JOHN "Alright, well then" },
- { "j2", KCOL_JOHN "You're gonna need to play close attention to this part" },
- { "j3", KCOL_JOHN "because its difficult.." },
- { "j4", KCOL_JOHN "It's gonna take some practice until it clicks" },
- { "j5", KCOL_JOHN "Right as you like, go across the transition of the ramp," },
- { "j6", KCOL_JOHN "Right here," },
- { "j7", KCOL_JOHN "you need to pump to gain some momentum." },
- { "j8", KCOL_JOHN "What I mean right, watch" },
- { "j9", KCOL_JOHN "just as I'm going into the base of the ramp" },
- { "j10",KCOL_JOHN "I'm storing up some energy here by crouching down" },
- { "j11",KCOL_JOHN "Right as I go across this point" },
- { "j12",KCOL_JOHN "I'm almost jumping back up, adding some uwpwards momentum" },
+/* 50ch| set cc=70 |################################################| */
+{ "j1", KCOL_JOHN "Alright, well then" },
+{ "j2", KCOL_JOHN "You're gonna need to play close attention to\n"
+ "this part" },
- { "j13",KCOL_JOHN "Then as the board comes up to this angle.." },
- { "j14",KCOL_JOHN "that upwards momentum is transferred into my speed" },
+{ "j3", KCOL_JOHN "because its difficult.." },
+{ "j4", KCOL_JOHN "It's gonna take some practice until it clicks" },
+{ "j5", KCOL_JOHN "Right as you like, go across the transition \n"
+ "of the ramp," },
- { "j15",KCOL_JOHN "Same principle works, same way in the other direction" },
+{ "j6", KCOL_JOHN "Right here," },
+{ "j7", KCOL_JOHN "you need to pump to gain some momentum." },
+{ "j8", KCOL_JOHN "What I mean right, watch" },
+{ "j9", KCOL_JOHN "just as I'm going into the base of the ramp" },
+{ "j10",KCOL_JOHN "I'm storing up some energy here by crouching down" },
+{ "j11",KCOL_JOHN "Right as I go across this point" },
+{ "j12",KCOL_JOHN "I'm almost jumping back up, adding some uwpwards\n"
+ "momentum" },
- { "j16",KCOL_JOHN "Now, like I'm saying" },
- { "j17",KCOL_JOHN "this might take you a little bit until it clicks" },
+{ "j13",KCOL_JOHN "Then as the board comes up to this angle.." },
+{ "j14",KCOL_JOHN "that upwards momentum is transferred \n"
+ "into my speed" },
- { "j18",KCOL_JOHN "But once it does you'll feel it. You'll know!" },
+{ "j15",KCOL_JOHN "Same principle works, same way in the \n"
+ "other direction" },
- { "j19",KCOL_JOHN "And I uhh, set a target for you" },
- { "j20",KCOL_JOHN "right up there.." },
- { "j21",KCOL_JOHN "Thats how we'll know you're back on form." },
+{ "j16",KCOL_JOHN "Now, like I'm saying" },
+{ "j17",KCOL_JOHN "this might take you a little bit until it clicks" },
- { "j22",KCOL_JOHN "Come see me at the docks once you've got it." },
+{ "j18",KCOL_JOHN "But once it does you'll feel it. You'll know!" },
- { NULL, NULL },
+{ "j19",KCOL_JOHN "And I uhh, set a target for you" },
+{ "j20",KCOL_JOHN "right up there.." },
+{ "j21",KCOL_JOHN "Thats how we'll know you're back on form." },
+
+{ "j22",KCOL_JOHN "Come see me at the docks once you've got it." },
+
+{ NULL, NULL },
};
+
static const struct generic_cutscene cutscene =
{
.metascene_path = "metascenes/ch1s5.ms",