local Image_sets = {
beach = {frames = {"ui_txt_adv_beach_1", "ui_txt_adv_beach_2"}, sheet = "ui_bms_txt_adv_beach"},
space = {frames = {"ui_txt_adv_space_1", "ui_txt_adv_space_2"}, sheet = "ui_bms_txt_adv_space"},
computer = {frames = {"ui_txt_adv_computer_1", "ui_txt_adv_computer_2"}, sheet = "ui_bms_txt_adv_computer"},
phone = {frames = {"ui_txt_adv_phone_1", "ui_txt_adv_phone_2"}, sheet = "ui_bms_txt_adv_phone"},
terror = {frames = {"ui_txt_adv_terror_1", "ui_txt_adv_terror_2"}, sheet = "ui_bms_txt_adv_terror"},
arch = {frames = {"ui_txt_adv_arch_1", "ui_txt_adv_arch_2"}, sheet = "ui_bms_txt_adv_arch"},
matt_enter = {frames = {"ui_txt_adv_matt_enter_1", "ui_txt_adv_matt_enter_2"}, sheet = "ui_bms_txt_adv_matt_enter"},
matt_punch = {frames = {"ui_txt_adv_matt_punch_1", "ui_txt_adv_matt_punch_2"}, sheet = "ui_bms_txt_adv_matt_punch"},
kill_enter = {frames = {"ui_txt_adv_kill_enter_1", "ui_txt_adv_kill_enter_2"}, sheet = "ui_bms_txt_adv_kill_enter"},
kill_punch = {frames = {"ui_txt_adv_kill_punch_1", "ui_txt_adv_kill_punch_2"}, sheet = "ui_bms_txt_adv_kill_punch"},
matt_win = {frames = {"ui_txt_adv_matt_win_1", "ui_txt_adv_matt_win_2"}, sheet = "ui_bms_txt_adv_matt_win"},
sizing = {frames = {"ui_txt_adv_sizing_1", "ui_txt_adv_sizing_2"}, sheet = "ui_bms_txt_adv_sizing"},
}
local Data = {
[1] = {
scenario = "M02_TXT_ADV_SC_01",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_01_CH1",
target = 2,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_01_CH2",
target = 3,
type = TYPE_BUTTON,
},
},
sfx = "Scenario",
},
[2] = {
scenario = "M02_TXT_ADV_SC_02",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_02_CH1",
target = 2,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_02_CH2",
target = 3,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[3] = {
scenario = "M02_TXT_ADV_SC_03",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_03_CH1",
target = 5,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_03_CH2",
target = 4,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_03_CH3",
target = 5,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_03_CH4",
target = 5,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[4] = {
scenario = "M02_TXT_ADV_SC_04",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_04_CH1",
target = 5,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_04_CH2",
target = 4,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_04_CH3",
target = 5,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_04_CH4",
target = 5,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[5] = {
scenario = "M02_TXT_ADV_SC_05",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_05_CH1",
target = 8,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_05_CH2",
target = 6,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_05_CH3",
target = 7,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_05_CH4",
target = 7,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[6] = {
scenario = "M02_TXT_ADV_SC_06",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_06_CH1",
target = 8,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_06_CH2",
target = 6,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_06_CH3",
target = 7,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_06_CH4",
target = 7,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[7] = {
scenario = "M02_TXT_ADV_SC_07",
image = Image_sets.computer,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_07_CH1",
target = 8,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_07_CH2",
target = 6,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_07_CH3",
target = 7,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_07_CH4",
target = 7,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[8] = {
scenario = "M02_TXT_ADV_SC_08",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_08_CH1",
target = 9,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_08_CH2",
target = 10,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_08_CH3",
target = 13,
type = TYPE_BUTTON,
},
},
sfx = "Progress",
},
[9] = {
scenario = "M02_TXT_ADV_SC_09",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_09_CH1",
target = 9,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_09_CH2",
target = 10,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_09_CH3",
target = 13,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[10] = {
scenario = "M02_TXT_ADV_SC_10",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_10_CH1",
target = 11,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_10_CH2",
target = 9,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_10_CH3",
target = 13,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[11] = {
scenario = "M02_TXT_ADV_SC_11",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_11_CH1",
target = 12,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_11_CH2",
target = 9,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_11_CH3",
target = 13,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[12] = {
scenario = "M02_TXT_ADV_SC_12",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_12_CH1",
target = 9,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_12_CH2",
target = 13,
type = TYPE_BUTTON,
},
},
sfx = "Scenario",
},
[13] = {
scenario = "M02_TXT_ADV_SC_13",
image = Image_sets.space,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_13_CH1",
target = 14,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[14] = {
scenario = "M02_TXT_ADV_SC_14",
image = Image_sets.terror,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_14_CH1",
target = 15,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_14_CH2",
target = 16,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_14_CH3",
target = 17,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_14_CH4",
target = 18,
type = TYPE_BUTTON,
},
},
sfx = "Progress",
},
[15] = {
scenario = "M02_TXT_ADV_SC_15",
image = Image_sets.terror,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_15_CH1",
target = 16,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_15_CH2",
target = 17,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_15_CH3",
target = 18,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[16] = {
scenario = "M02_TXT_ADV_SC_16",
image = Image_sets.terror,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_16_CH1",
target = 15,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_16_CH2",
target = 16,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_16_CH3",
target = 17,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_16_CH4",
target = 18,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[17] = {
scenario = "M02_TXT_ADV_SC_17",
image = Image_sets.terror,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_17_CH1",
target = 15,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_17_CH2",
target = 16,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_17_CH3",
target = 18,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[18] = {
scenario = "M02_TXT_ADV_SC_18",
image = Image_sets.terror,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_18_CH1",
target = 19,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[19] = {
scenario = "M02_TXT_ADV_SC_19",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_19_CH1",
target = 20,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_19_CH2",
target = 21,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_19_CH3",
target = 22,
type = TYPE_BUTTON,
},
[4] = {
label = "M02_TXT_ADV_SC_19_CH4",
target = 23,
type = TYPE_BUTTON,
},
},
sfx = "Progress",
},
[20] = {
scenario = "M02_TXT_ADV_SC_20",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_20_CH1",
target = 19,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[21] = {
scenario = "M02_TXT_ADV_SC_21",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_21_CH1",
target = 20,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_21_CH2",
target = 22,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_21_CH3",
target = 23,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[22] = {
scenario = "M02_TXT_ADV_SC_22",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_22_CH1",
target = 20,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_22_CH2",
target = 21,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_22_CH3",
target = 23,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[23] = {
scenario = "M02_TXT_ADV_SC_23",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_23_CH1",
target = 24,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_23_CH2",
target = 25,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[24] = {
scenario = "M02_TXT_ADV_SC_24",
image = Image_sets.beach,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_24_CH1",
target = 24,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_24_CH2",
target = 25,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[25] = {
scenario = "M02_TXT_ADV_SC_25",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_25_CH1",
target = 26,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_25_CH2",
target = 34,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_25_CH3",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Progress",
},
[26] = {
scenario = "M02_TXT_ADV_SC_26",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_26_CH1",
target = 27,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_26_CH2",
target = 34,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_26_CH3",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[27] = {
scenario = "M02_TXT_ADV_SC_27",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_27_CH1",
target = 28,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_27_CH2",
target = 34,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_27_CH3",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[28] = {
scenario = "M02_TXT_ADV_SC_28",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_28_CH1",
target = 29,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_28_CH2",
target = 34,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_28_CH3",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[29] = {
scenario = "M02_TXT_ADV_SC_29",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_29_CH1",
target = 31,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_29_CH2",
target = 30,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[30] = {
scenario = "M02_TXT_ADV_SC_30",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_30_CH1",
target = 31,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_30_CH2",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[31] = {
scenario = "M02_TXT_ADV_SC_31",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_31_CH1",
target = 32,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_31_CH2",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[32] = {
scenario = "M02_TXT_ADV_SC_32",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_32_CH1",
target = 35,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_32_CH2",
target = 33,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[33] = {
scenario = "M02_TXT_ADV_SC_33",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_33_CH1",
target = 35,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_33_CH2",
target = 33,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[34] = {
scenario = "M02_TXT_ADV_SC_34",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_34_CH1",
target = 26,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_34_CH2",
target = 29,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[35] = {
scenario = "M02_TXT_ADV_SC_35",
image = Image_sets.arch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_35_CH1",
target = 36,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_35_CH2",
target = 33,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[36] = {
scenario = "M02_TXT_ADV_SC_36",
image = Image_sets.kill_enter,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_36_CH1",
target = 38,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_36_CH2",
target = 37,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[37] = {
scenario = "M02_TXT_ADV_SC_37",
image = Image_sets.kill_enter,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_37_CH1",
target = 37,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_37_CH2",
target = 38,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[38] = {
scenario = "M02_TXT_ADV_SC_38",
image = Image_sets.matt_enter,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_38_CH1",
target = 39,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_38_CH2",
target = 38,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[39] = {
scenario = "M02_TXT_ADV_SC_39",
image = Image_sets.sizing,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_39_CH1",
target = 39,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_39_CH2",
target = 40,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[40] = {
scenario = "M02_TXT_ADV_SC_40",
image = Image_sets.sizing,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_40_CH1",
target = 39,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_40_CH2",
target = 42,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_40_CH3",
target = 39,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[41] = {
scenario = "M02_TXT_ADV_SC_41",
image = Image_sets.kill_punch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_41_CH1",
target = 41,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_41_CH2",
target = 42,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_41_CH3",
target = 39,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[42] = {
scenario = "M02_TXT_ADV_SC_42",
image = Image_sets.matt_punch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_42_CH1",
target = 43,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_42_CH2",
target = 44,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_42_CH3",
target = 39,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[43] = {
scenario = "M02_TXT_ADV_SC_43",
image = Image_sets.kill_punch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_43_CH1",
target = 41,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_43_CH2",
target = 42,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_43_CH3",
target = 39,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[44] = {
scenario = "M02_TXT_ADV_SC_44",
image = Image_sets.matt_punch,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_44_CH1",
target = 43,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_44_CH2",
target = 45,
type = TYPE_BUTTON,
},
[3] = {
label = "M02_TXT_ADV_SC_44_CH3",
target = 39,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[45] = {
scenario = "M02_TXT_ADV_SC_45",
image = Image_sets.matt_win,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_45_CH1",
target = 46,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_45_CH2",
target = 47,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[46] = {
scenario = "M02_TXT_ADV_SC_46",
image = Image_sets.matt_win,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_46_CH1",
target = 46,
type = TYPE_BUTTON,
},
[2] = {
label = "M02_TXT_ADV_SC_46_CH2",
target = 47,
type = TYPE_BUTTON,
},
},
sfx = "Neutral",
},
[47] = {
scenario = "M02_TXT_ADV_SC_47",
image = Image_sets.phone,
choices = {
[1] = {
label = "M02_TXT_ADV_SC_47_CH1",
target = -1,
type = TYPE_BUTTON,
},
},
sfx = "Win",
},
}
local COLOR_TEXT_ADVENTURE_PRIMARY = {R = 220/255, G = 220/255, B = 220/255}
local COLOR_TEXT_ADVENTURE_SECONDARY = {R = 120/255, G = 120/255, B = 120/255}
local COLOR_TEXT_ADVENTURE_TERTIARY = {R = 90/255, G = 90/255, B = 90/255}
local Text_buffer = {}
local Max_text_buffer_length = 6
local Input_tracker
local Mouse_input_tracker
local Msn_text_adventure_doc_handle = -1
local Cur_scen = 1
local Cur_audio_id = -1
local Action = {}
local Image_h = -1
local Prev_image = {}
local Image_frames_table = -1
Msn_text_adventure_list = -1
function msn_text_adventure_init()
pause_map_dump()
--start audio
ui_audio_post_event("Music_Text_Adv") -- This is overriding our conversations
--Get doc handle
Msn_text_adventure_doc_handle = vint_document_find("msn_text_adventure")
--Handle Input Tracker
Input_tracker = Vdo_input_tracker:new()
Input_tracker:add_input("nav_up", "msn_text_adventure_nav_up", 50)
Input_tracker:add_input("nav_down", "msn_text_adventure_nav_down", 50)
Input_tracker:add_input("select", "msn_text_adventure_button_a", 50)
Input_tracker:subscribe(true)
-- Add mouse input subscriptions for the PC
if game_get_platform() == "PC" then
Mouse_input_tracker = Vdo_input_tracker:new()
end
--Setup megalist
Msn_text_adventure_list = Vdo_mega_list:new("choice_list", 0, Msn_text_adventure_doc_handle, "msn_text_adventure.lua", "Msn_text_adventure_list")
Msn_text_adventure_list:set_highlight_color(COLOR_TEXT_ADVENTURE_TERTIARY,COLOR_STORE_VEHICLE_SECONDARY,COLOR_STORE_VEHICLE_TERTIARY)
--set up image
Image_h = vint_object_find("image", 0, Msn_text_adventure_doc_handle)
--Hide base text
local base_text = vint_object_find("base_text", 0, Msn_text_adventure_doc_handle)
vint_set_property(base_text, "visible", false)
local cursor_blink = Vdo_anim_object:new("cursor_blink", 0, Msn_text_adventure_doc_handle)
cursor_blink:play(0)
msn_text_adventure_update(Data)
end
function msn_text_adventure_cleanup()
for i = 1, #Text_buffer do
Text_buffer[i]:object_destroy()
end
vint_bitmap_animator_unregister_animation( Image_h )
for idx, val in pairs(Image_sets) do
if val.sheet ~= -1 and val.sheet ~= nil then
game_peg_unload(val.sheet)
end
end
--stop audio
ui_audio_post_event("Music_Text_Adv_Stop")
pause_map_restore()
end
function msn_text_adventure_update(data)
--show image
if Prev_image ~= Data[Cur_scen].image then
vint_set_property(Image_h, "visible", false)
vint_bitmap_animator_unregister_animation( Image_h )
if Prev_image.sheet ~= -1 and Prev_image.sheet ~= nil then
game_peg_unload(Prev_image.sheet)
end
Image_frames_table = Data[Cur_scen].image.frames
game_peg_load_with_cb("msn_text_adventure_peg_load_complete",1, Data[Cur_scen].image.sheet)
Prev_image = Data[Cur_scen].image
end
local base_text = vint_object_find("base_txt", 0, Msn_text_adventure_doc_handle)
vint_set_property(base_text, "visible", false)
--If we're on the first page play typing audio
if Cur_scen == 1 then
audio_stop(Cur_audio_id)
Cur_audio_id = audio_object_post_event("Text_Adventure", "Mission_16_Text_Adventure", Data[Cur_scen].sfx)
end
--Make current text first in the queue
if Text_buffer[1] ~= nil then
for i = Max_text_buffer_length, 1, -1 do
if Text_buffer[i] ~= nil then
Text_buffer[i+1] = Text_buffer[i]
end
end
end
Text_buffer[1] = Vdo_base_object:clone(base_text)
Text_buffer[1]:set_text(data[Cur_scen].scenario)
Text_buffer[1]:set_visible(true)
local move_width, move_height = Text_buffer[1]:get_actual_size()
local text_x, text_y
--Scroll text up if text exist
if Text_buffer[2] ~= nil then
text_x, text_y = Text_buffer[2]:get_anchor()
Text_buffer[2]:set_anchor(text_x, text_y - move_height)
Text_buffer[2]:set_color(COLOR_TEXT_ADVENTURE_TERTIARY.R,COLOR_TEXT_ADVENTURE_TERTIARY.G,COLOR_TEXT_ADVENTURE_TERTIARY.B)
--Delete items that go off the screen
if text_y < -200 then
Text_buffer[2]:object_destroy()
end
end
--Populate megalist
Msn_text_adventure_list:draw_items(data[Cur_scen].choices, 1, 500, 4, LIST_FONT_SCALE, true, false)
--Update inputs if on pc...
if game_get_platform() == "PC" then
Mouse_input_tracker:remove_all()
Msn_text_adventure_list:add_mouse_inputs("msn_text_adventure", Mouse_input_tracker)
Mouse_input_tracker:subscribe(true)
end
end
function msn_text_adventure_peg_load_complete(image_set)
vint_set_property(Image_h, "visible", true)
--vint_set_property(Image_h, "image", Data[Cur_scen].image.frame_1)
--Image_frames_table = {Data[Cur_scen].image.frame_1, Data[Cur_scen].image.frame_2}
--Image_frames_table = {"ui_store_lineup_mugshot_07", "ui_store_lineup_mugshot_08"}
vint_bitmap_animator_register_animation(--[[target handle]]Image_h, --[[loop type see game_ui_globals.lua]]ANIMATED_BITMAP_PLAYBACK_TYPE_LOOPING, --[[playback reverse]] false,
--[[frametime]].7, --[[duration (negative means forever)]]-1.0, --[[start paused]]false, --[[starting frame]] 1, --[[frames table]]Image_frames_table, --[[end event]] "")
end
function msn_text_adventure_button_a(event, acceleration)
if Msn_text_adventure_list:list_is_playing() == false then
--What choice did they pick?
local user_choice = Msn_text_adventure_list:get_selection()
local previous_scen = Cur_scen
--Set cur_scene to target
Cur_scen = Data[Cur_scen].choices[user_choice].target
if Cur_scen == -1 then
msn_text_adventure_set_screen(47) -- count the success as a 35th screen
pop_screen()
return
end
msn_text_adventure_set_screen(Cur_scen)
audio_stop(Cur_audio_id)
Cur_audio_id = audio_object_post_event("Text_Adventure", "Mission_16_Text_Adventure", Data[Cur_scen].sfx)
--What is the string for that choice?
Action = Msn_text_adventure_list:return_selected_data()
Text_buffer[1]:set_text(Action.label)
if Text_buffer[2] ~= nil then
Text_buffer[2]:object_destroy()
end
--Update text
msn_text_adventure_update(Data)
end
end
function msn_text_adventure_nav_up(event, acceleration)
Msn_text_adventure_list:move_cursor(-1)
Cur_audio_id = audio_object_post_event("Text_Adventure", "Mission_16_Text_Adventure", "Navigation")
end
function msn_text_adventure_nav_down(event, acceleration)
Msn_text_adventure_list:move_cursor(1)
Cur_audio_id = audio_object_post_event("Text_Adventure", "Mission_16_Text_Adventure", "Navigation")
end
-------------------------------------------------------------------------------
-- Mouse inputs
--
function msn_text_adventure_mouse_click(event, target_handle)
if Msn_text_adventure_list:list_is_playing() == false then
--Click item in megalist...
local new_index = Msn_text_adventure_list:get_button_index(target_handle)
if new_index ~= 0 then
-- Enter an option if the target_handle is in the List
Msn_text_adventure_list:set_selection(new_index)
msn_text_adventure_button_a()
end
end
end
function msn_text_adventure_mouse_move(event, target_handle)
if Msn_text_adventure_list:list_is_playing() == false then
--nav item in megalist...
local new_index = Msn_text_adventure_list:get_button_index(target_handle)
if new_index ~= 0 then
-- Set the button as the new selected highlight
Msn_text_adventure_list:set_selection(new_index)
Msn_text_adventure_list:move_cursor(0, true)
end
end
end