From 79097458a4c83852e5b3c03a034794b8b8460277 Mon Sep 17 00:00:00 2001 From: Jennifer Hogueison Date: Thu, 8 Jun 2023 23:55:41 -0700 Subject: [PATCH] Added log mode, cleaned up pause screen and auto/skip mode display --- objects/obj_dialogue/Draw_0.gml | 16 +++--- objects/obj_dialogue/Other_4.gml | 7 ++- objects/obj_dialogue/Step_0.gml | 12 ++++- objects/obj_pauser/Create_0.gml | 5 +- objects/obj_pauser/Draw_0.gml | 59 +++++++++++++++++++---- objects/obj_pauser/Step_0.gml | 22 ++++++++- scripts/scr_initialize/scr_initialize.gml | 3 ++ 7 files changed, 102 insertions(+), 22 deletions(-) diff --git a/objects/obj_dialogue/Draw_0.gml b/objects/obj_dialogue/Draw_0.gml index 6a7dca4..83a8218 100644 --- a/objects/obj_dialogue/Draw_0.gml +++ b/objects/obj_dialogue/Draw_0.gml @@ -41,22 +41,22 @@ if (global.dialogue_mode) { draw_set_alpha( (-10 - (80 * i) + textlinefadein) / 60 ); draw_text(camera_get_view_x(view_camera) + 320, camera_get_view_y(view_camera) + 180 - (20 * textlinecount) + (40 * (i-1)), textlines[i]); } + draw_set_alpha(1); } if (text_advance_ready == TEXT_READY && display_mode != DISPLAY_NOTEXT) { loopdoop++; - draw_set_alpha(1); draw_sprite( spr_text_arrow, round((loopdoop % 160) / 20), camera_get_view_x(view_camera) + 540, camera_get_view_y(view_camera) + 300 ); - } - if (text_auto_mode == AUTO_ON) { + } + if (text_auto_mode == AUTO_ON) { draw_sprite( spr_text_auto, 0, camera_get_view_x(view_camera) + 510, camera_get_view_y(view_camera) + 300 ); } if (keyboard_check(vk_control) ) { draw_sprite( spr_text_skip, 0, camera_get_view_x(view_camera) + 480, camera_get_view_y(view_camera) + 300 ); } - - + + //draw tutorial text - draw_set_font(fn_help); - draw_set_halign(fa_left); - draw_text_ext_transformed_color_border( 5, 345, "Z: advance text, C: toggle auto, CTRL: skip", 9, 620, 1, 1, 0, c_blue, c_blue, c_blue, c_blue, tutorial_fadeout / 20, 1, c_white); //6 + draw_set_font(fn_help); + draw_set_halign(fa_left); + draw_text_ext_transformed_color_border( 5, 345, "Z: advance text, C: toggle auto, CTRL: skip", 9, 620, 1, 1, 0, c_blue, c_blue, c_blue, c_blue, tutorial_fadeout / 20, 1, c_white); //6 } \ No newline at end of file diff --git a/objects/obj_dialogue/Other_4.gml b/objects/obj_dialogue/Other_4.gml index 297f3ce..de22806 100644 --- a/objects/obj_dialogue/Other_4.gml +++ b/objects/obj_dialogue/Other_4.gml @@ -36,6 +36,9 @@ actor_C_sprite = -1; actor_C_anim_frame = 0; actor_C_pos = POSITION_LEFT; +global.log_text[LOG_LIMIT] = array_create(LOG_LIMIT); +global.log_names[LOG_LIMIT] = array_create(LOG_LIMIT); + bg_test = ds_queue_create(); mus_test = ds_queue_create(); sound_test = ds_queue_create(); @@ -43,8 +46,8 @@ display_test = ds_queue_create(); sprite_test = ds_queue_create(); pos_test = ds_queue_create(); speaker_test = ds_queue_create(); -text_test = ds_queue_create(); - +text_test = ds_queue_create(); + loopdoop = 0; tutorial_fadeout = 400; diff --git a/objects/obj_dialogue/Step_0.gml b/objects/obj_dialogue/Step_0.gml index ebb29b2..a52d372 100644 --- a/objects/obj_dialogue/Step_0.gml +++ b/objects/obj_dialogue/Step_0.gml @@ -135,7 +135,7 @@ if (global.dialogue_mode) { //display modes display_mode = ds_queue_dequeue(display_test); - if ( display_mode == DISPLAY_NOTEXT && text_auto_mode == AUTO_OFF ) { + if ( display_mode == DISPLAY_NOTEXT && text_auto_mode == AUTO_OFF ) { //no text text_auto_mode = AUTO_NEXT; } @@ -358,6 +358,16 @@ if (global.dialogue_mode) { textload = ds_queue_dequeue(text_test); texttarget = string_replace_all(textload, "#", "\n" ); + //add text to log + if (global.log_text[0] != 0 && global.log_names[0] != 0) { + for( var r = LOG_LIMIT - 1; r >= 0; r--) { + global.log_text[r+1] = global.log_text[r]; + global.log_names[r+1] = global.log_names[r]; + } + } + global.log_text[0] = texttarget; + global.log_names[0] = speaker_name; + textspew = ""; textlines = [ "", "", "", "", "", "", "" ]; textlinecount = 1; diff --git a/objects/obj_pauser/Create_0.gml b/objects/obj_pauser/Create_0.gml index b66f46f..9592fc8 100644 --- a/objects/obj_pauser/Create_0.gml +++ b/objects/obj_pauser/Create_0.gml @@ -1,12 +1,15 @@ pause = false; paused_surface = -1; +log_surface = -1; menu_wait = MENU_DELAY; dx = 0; dy = 0; +log_dy = 0; surface_mult = global.options[? OPTIONS_WINDOWMULT]; save_check = false; save_allowed = false; unpause_allowed = false; save_display = 0; -escape_allowed = false; \ No newline at end of file +escape_allowed = false; +logmove_allowed = false; diff --git a/objects/obj_pauser/Draw_0.gml b/objects/obj_pauser/Draw_0.gml index 045d7c1..bf23cb1 100644 --- a/objects/obj_pauser/Draw_0.gml +++ b/objects/obj_pauser/Draw_0.gml @@ -6,29 +6,70 @@ if (pause) { if (paused_surface == -1) { instance_deactivate_all(true); } - surface_mult = 1; paused_surface = surface_create(view_get_wport(view_camera[0]) * surface_mult, view_get_wport(view_camera[0]) * surface_mult); surface_set_target(paused_surface); - draw_surface(application_surface, 0, 0); + draw_surface(application_surface, 0, 0); surface_reset_target(); } else { - draw_surface_ext(paused_surface, dx, dy, 0.5, 0.5, 0, c_white, 1); + draw_surface_ext(paused_surface, dx, dy, 1, 1, 0, c_white, 1); draw_set_alpha(0.5); draw_set_color(c_black); draw_rectangle(0, 0, room_width, room_height, false); draw_set_alpha(1); - draw_set_halign(fa_center); + draw_rectangle(dx - 1, dy - 1, dx + 641, dy + 30, false); + draw_rectangle(dx - 1, dy + 335, dx + 641, dy + 361, false); + draw_set_halign(fa_right); draw_set_color(c_fuchsia); - draw_text(dx + 320, dy + 170, "Paused, press P to continue"); - draw_text(dx + 320, dy + 220, "press S to save"); - draw_text(dx + 320, dy + 270, "press ESC to exit"); - draw_set_color(c_white); + draw_text(dx + 630, dy + 340, "Paused, press P to continue, press S to save, press ESC to exit"); + draw_set_color(c_orange); draw_set_halign(fa_left); + draw_text(dx + 10, dy + 10, "Log mode"); + if (!surface_exists(log_surface)) { + log_surface = surface_create(620,260); + } + surface_set_target(log_surface); + draw_clear_alpha(c_black, 1); + textlinescount = 0; + textline = ""; + for (var i = 0; i < 6; i++) { + if (log_dy + i < LOG_LIMIT) { + if (global.log_text[log_dy + i] != 0) { + draw_set_color(c_aqua); + draw_text(20, textlinescount * 20, global.log_names[log_dy + i]); + textlinescount++; + draw_set_color(c_ltgray); + draw_text(40, textlinescount * 20, global.log_text[log_dy + i]); + textlinescount++; + textline = global.log_text[log_dy + i]; + for(var j = 0; j < string_length(textline); j++) { + if (string_char_at(textline, j) == "\n") { + textlinescount++; + } + } + textlinescount++; + } + } + } + surface_reset_target(); + draw_set_color(c_black); + draw_set_alpha(0.5); + draw_rectangle(dx + 10, dy + 35, dx + 630, dy + 295, false); + draw_set_alpha(1); + gpu_set_blendmode(bm_add); + draw_surface_ext(log_surface, dx + 10, dy + 35, 1, 1, 0, c_white, 1); + gpu_set_blendmode(bm_normal); + surface_free(log_surface); + if ( log_dy > 0) { + draw_sprite(spr_uparrow, 0, 320, 10); + } + if ( log_dy < global.loaded_file[? SAVE_LINENUM] ) { + draw_sprite(spr_downarrow, 0, 320, 310); + } } } if (save_display > 0) { draw_set_halign(fa_right); - draw_text_ext_transformed_color_border(600, 320, "Saving...", 20, 150, 1, 1, 0, c_green, c_orange, c_green, c_orange, 1, 1, c_fuchsia); + draw_text_ext_transformed_color_border(dx + 600, dy + 10, "Saving...", 20, 150, 1, 1, 0, c_green, c_orange, c_green, c_orange, 1, 1, c_fuchsia); draw_set_halign(fa_left); } \ No newline at end of file diff --git a/objects/obj_pauser/Step_0.gml b/objects/obj_pauser/Step_0.gml index 011aa5c..2b1539d 100644 --- a/objects/obj_pauser/Step_0.gml +++ b/objects/obj_pauser/Step_0.gml @@ -5,6 +5,7 @@ if menu_wait <= 0 { save_allowed = true; unpause_allowed = true; escape_allowed = true; + logmove_allowed = true; } if (keyboard_check_pressed(ord("S")) && save_allowed == true) { @@ -42,4 +43,23 @@ if (keyboard_check_pressed(vk_escape) && escape_allowed == true) { paused_surface = -1; } room_goto(rm_title); -} \ No newline at end of file +} + +if (keyboard_check(vk_up) && logmove_allowed == true) { + menu_wait = MENU_DELAY; + logmove_allowed = false; + log_dy--; + if (log_dy < 0) { + log_dy = 0; + } +} + +if (keyboard_check(vk_down) && logmove_allowed == true) { + menu_wait = MENU_DELAY; + logmove_allowed = false; + log_dy++; + if (log_dy > global.loaded_file[? SAVE_LINENUM]) { + log_dy = global.loaded_file[? SAVE_LINENUM]; + } +} + diff --git a/scripts/scr_initialize/scr_initialize.gml b/scripts/scr_initialize/scr_initialize.gml index 55b114d..71fd6a7 100644 --- a/scripts/scr_initialize/scr_initialize.gml +++ b/scripts/scr_initialize/scr_initialize.gml @@ -195,6 +195,7 @@ #macro DISPLAY_ADV_SHOUT 4 #macro DISPLAY_WRITER 5 + #macro LOG_LIMIT 1000 #macro POSITION_LEFT -1 #macro POSITION_LEFTCENTER -0.5 @@ -268,6 +269,8 @@ function scr_initialize() { global.autosave_load = false; global.savepoint_numbers = 0; global.savepoint_instances[255] = 0; + global.log_text[LOG_LIMIT] = array_create(LOG_LIMIT); + global.log_names[LOG_LIMIT] = array_create(LOG_LIMIT); global.load_file_name = "defaults.json"; global.file_A_preview_line1 = "---"; global.file_B_preview_line1 = "---";