Advertisement
Guest User

obj_textbox_create

a guest
Mar 1st, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// Initialize some variables
  2. parent_id = noone;
  3. parent_obj_index = noone; // The object index of the origin of this textbox (so we can tell if it came from an NPC/Sign or not)
  4. depth = -10001;
  5. image_speed = 0.15; // Only spr_textbox_continue relies on this
  6. font = Game.dlg_fnt;
  7. n_font = Game.nametag_fnt;
  8.  
  9. line_time = 0; // How long we've been reading this current line/message box for. (So we can control mouth movement)
  10.  
  11. image_speed = 0.15; // Only spr_textbox_continue relies on this
  12. font = 0;
  13. end_early = false; // Cuts off the dialogue as if it were the last line.
  14. cutscene = false; // Flag marking whether or not the player should be allowed to move throughout this dialogue.
  15. moving_cutscene = false; // Flag marking whether or not the textbox should hop up/down based on player's position (Bottom Textbox should be the only active textbox)
  16. moving_bottom = player_above_or_below_textbox(); // For moving cutscenes, textbox will be set to display on the bottom by default.
  17.  
  18. bottom = true; // Update the text on the lower textbox. Otherwise, update the text on the upper textbox
  19. enable_voice = false; // Allows NPC talking sound to play per character
  20. subtext_mode = false; // Alternate mode of drawing text for visual effect
  21.  
  22. //Animation stuff
  23. alt_port_mode = false; // Use PropNPCPortLeft and PropNPCPortRight instead of the square portraits
  24.  
  25. blink_wait_timer_bottom = get_frames(0.5 + random(3.5));
  26. blink_wait_timer_top = get_frames(0.5 + random(3.5));
  27. eye_frame_index_bottom = 0;
  28. eye_frame_index_top = 0;
  29. mouth_frame_index_bottom = 0;
  30. mouth_frame_index_top = 0;
  31.  
  32. eye_frames_bottom[0] = 0;
  33. eye_frames_bottom[1] = 1;
  34. eye_frames_bottom[2] = 2;
  35. eye_frames_bottom[3] = 3;
  36. eye_frames_top[0] = 0;
  37. eye_frames_top[1] = 1;
  38. eye_frames_top[2] = 2;
  39. eye_frames_top[3] = 3;
  40.  
  41. mouth_frames_bottom[0] = 0;
  42. mouth_frames_bottom[1] = 1;
  43. mouth_frames_bottom[2] = 2;
  44. mouth_frames_bottom[3] = 3;
  45. mouth_frames_top[0] = 0;
  46. mouth_frames_top[1] = 1;
  47. mouth_frames_top[2] = 2;
  48. mouth_frames_top[3] = 3;
  49. init_portraits(); // Creates a ton of arrays that portraits refer to when drawn
  50. curr_port_ind = PortInds.BLANK;
  51. curr_port_ind_t = PortInds.BLANK;
  52. continueBottomIndex = 0; // sprTextboxContinue animation for bottom textbox
  53. continueTopIndex = 0; // sprTextboxContinue animation for top textbox
  54. terminate = false; // Abort or conclude the textbox
  55.  
  56.  
  57. loaded_text_line_count = 0;         // Used for debugging where we are in the script (passed from Game upon creation)
  58. lines_skipped = 0;                          // Used for debugging where we are in the script (passed from Game upon creation)
  59.  
  60. curr_drawn_text_b = ""; // The actual text to show up on the screen (bottom)
  61. curr_drawn_text_t = ""; // The actual text to show up on the screen (top)
  62. linebreak_count = 0;
  63. curr_loaded_line_count = 0;
  64. curr_line_dchar_count = 0; // Current number of characters in the currently drawing line.
  65. curr_line_char_count = 0; // Current number of characters we've read on the given segment of dialogue.
  66. curr_line = ""; // The current line the parser is reading.
  67. edited_line = ""; // Whenever curr_line has been edited in amend_dialogue(), display this text instead
  68.  
  69. loaded_text = ""; // This contains all the text we loaded from the .txt. Passed from Game (or wherever you want to do it)
  70. broke = false; // Show debug text if the game fails to load the correct text
  71.  
  72. // These are passed to the parallel arrays below as the text is being read, character by character
  73. monospace = false; // false = enable VWF instead
  74. color = c_white; // Text color
  75. x_offset = 0;
  76. y_offset = 0;
  77. curr_font = Fonts.DLG;
  78. curr_max_width = 6; // Font max dimensions are 6x12 by default.
  79. curr_max_height = string_height("A");
  80. shake_magnitude = 0; // For shaky text (0 = don't move at all)
  81. sin_tick = 0; // Ticker so we can freeze the shakey text in place during pausing
  82.  
  83. // Parallel arrays for loaded_text to store data for every character for drawing
  84. char_font = ds_create("char_font", DS.LIST);
  85. char_max_width = ds_create("char_max_width", DS.LIST);
  86. char_max_height = ds_create("char_max_height", DS.LIST);
  87. char_color = ds_create("char_color", DS.LIST);
  88. char_x_offset = ds_create("char_x_offset", DS.LIST);
  89. char_y_offset = ds_create("char_y_offset", DS.LIST);
  90. char_shake_magnitude = ds_create("char_shake_magnitude", DS.LIST);
  91. char_shake_x = ds_create("char_shake_x", DS.LIST);
  92. char_shake_y = ds_create("char_shake_y", DS.LIST);
  93. char_sine_x = ds_create("char_sine_x", DS.LIST);
  94. char_sine_y = ds_create("char_sine_y", DS.LIST);
  95. char_sine_amp_x = ds_create("char_sine_amp_x", DS.LIST);
  96. char_sine_amp_y = ds_create("char_sine_amp_y", DS.LIST);
  97. char_sine_per_x = ds_create("char_sine_per_x", DS.LIST);
  98. char_sine_per_y = ds_create("char_sine_per_y", DS.LIST);
  99.  
  100. tbox_sine_amp_x = 0;
  101. tbox_sine_amp_y = 0;
  102. tbox_sine_per_x = 0;
  103. tbox_sine_per_y = 0;
  104. tbox_shake_x = 0;
  105. tbox_shake_y = 0;
  106. tbox_shake_mag = 0;
  107.  
  108. end_early = false; // Flag that ends the dialogue (so we can abort a script within the script itself)
  109. curr_spd = 2; // Higher = slower
  110. curr_nametag = "???"; // Nametag to default to
  111. curr_voice = "none"; // Sound to type characters with
  112. curr_port_ind = PortInds.BLANK;
  113. port_on = false;    // Hide/show the portrait box
  114. nametag_on = false; // Hide/show the nametag box
  115. max_len = 4; // Number of characters it can display per line (+2 leeway)
  116. end_of_line = false; // Flag to know when to wait for the next action
  117. advance = true; // Flag to continue the dialogue
  118. continue_bottom = true; // Flag to prompt to continue the dialogue from the bottom or top textbox (bottom = true)
  119. delay_timer = 0; // Counts down to when we're allowed to check the next character. Affected by speed, too.
  120. new_line = true; // Flag to re-initiate the textbox every line.
  121. can_control = true; // Flag to allow player to advance/speed up the dialogue
  122. slide_in = false;
  123. tbox_x_offset = 0;
  124. tbox_y_offset = 128;
  125.  
  126. force_color_b = false;
  127. color_f_b = c_white;  // Forced-color value to use for flag directly above this variable
  128.  
  129. //Upper textbox stuff
  130. port_on_t = false;
  131. curr_port_ind_t = PortInds.BLANK;
  132. nametag_on_t = false;
  133. curr_nametag_t = "???"; // Nametag to default to
  134. color_t = c_white;
  135. force_color_t = false;
  136. color_f_t = c_white;  // Forced-color value to use for flag directly above this variable
  137. slide_in_t = false;
  138. tbox_x_offset_t = 0;
  139. tbox_y_offset_t = -128;
  140.  
  141. char_font_t = ds_create("char_font_t", DS.LIST);
  142. char_max_width_t = ds_create("char_max_width_t", DS.LIST);
  143. char_max_height_t = ds_create("char_max_height_t", DS.LIST);
  144. char_color_t = ds_create("char_color_t", DS.LIST);
  145. char_x_offset_t = ds_create("char_x_offset_t", DS.LIST);
  146. char_y_offset_t = ds_create("char_y_offset_t", DS.LIST);
  147. char_shake_magnitude_t = ds_create("char_shake_magnitude_t", DS.LIST);
  148. char_shake_x_t = ds_create("char_shake_x_t", DS.LIST);
  149. char_shake_y_t = ds_create("char_shake_y_t", DS.LIST);
  150. char_sine_x_t = ds_create("char_sine_x_t", DS.LIST);
  151. char_sine_y_t = ds_create("char_sine_y_t", DS.LIST);
  152. char_sine_amp_x_t = ds_create("char_sine_amp_x_t", DS.LIST);
  153. char_sine_amp_y_t = ds_create("char_sine_amp_y_t", DS.LIST);
  154. char_sine_per_x_t = ds_create("char_sine_per_x_t", DS.LIST);
  155. char_sine_per_y_t = ds_create("char_sine_per_y_t", DS.LIST);
  156.  
  157.  
  158. time_alive = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement