// CustomDialogGui // global vars struct CDG_Arrow { int x1; int y1; int x2; int y2; }; struct CustomDialogGui_Options { DialogOptionsRenderingInfo *dialog_window; bool hide_gui_while_dialog; int gui_xpos; int gui_ypos; int gui_width; int gui_height; bool autosize_height; bool autosize_width; int yscreenborder; int xscreenborder; int autosize_minheight; int autosize_maxheight; int autosize_minwidth; int autosize_maxwidth; int auto_arrow_align; int auto_arrow_up_offset_x; int auto_arrow_up_offset_y; int auto_arrow_down_offset_x; int auto_arrow_down_offset_y; int bullet; int uparrow_img; int uparrow_hi_img; int uparrow_push_img; int uparrow_xpos; int uparrow_ypos; int downarrow_img; int downarrow_hi_img; int downarrow_push_img; int downarrow_xpos; int downarrow_ypos; float scroll_btn_delay; int border_top; int border_bottom; int border_left; int border_right; int border_visible; int border_color; bool mousewheel; bool reset_scrollstate; bool dialog_options_upwards; int bg_img; int bg_img_scaling; int bg_img_transparency; int bg_color; int scroll_rows; int text_font; int text_color; int text_color_active; int text_color_chosen; int text_alignment; int text_bg; int text_bg_xpos; int text_bg_scaling; int text_bg_transparency; int text_line_space; int text_numbering; int scroll_from; int scroll_to; int max_option_height; int max_option_width; int active_options_count; int locked_xpos; int locked_ypos; int uparrow_current_img; int downarrow_current_img; }; CustomDialogGui_Options CDG_options; int CDG_active_options[]; int CDG_active_options_height[]; int CDG_active_options_width[]; String CDG_active_options_text[]; bool in_speech; /*********************************************************************** * seti_DialogGuiOptions(static CustomDialogGui, eDialogGuiOptions index, int value) * sets the options for the dialog GUI ***********************************************************************/ bool seti_DialogGuiOptions(static CustomDialogGui, eDialogGuiOptions index, int value) { if (index == eDialogGui_hide_gui_while_dialog) CDG_options.hide_gui_while_dialog = value; if (index == eDialogGui_gui_xpos) CDG_options.gui_xpos = value; if (index == eDialogGui_gui_ypos) CDG_options.gui_ypos = value; if (index == eDialogGui_gui_width) CDG_options.gui_width = value; if (index == eDialogGui_gui_height) CDG_options.gui_height = value; if (index == eDialogGui_yscreenborder) CDG_options.yscreenborder = value; if (index == eDialogGui_xscreenborder) CDG_options.xscreenborder = value; if (index == eDialogGui_text_font) CDG_options.text_font = value; if (index == eDialogGui_text_alignment) CDG_options.text_alignment = value; if (index == eDialogGui_text_color) CDG_options.text_color = value; if (index == eDialogGui_text_color_active) CDG_options.text_color_active = value; if (index == eDialogGui_text_color_chosen) CDG_options.text_color_chosen = value; if (index == eDialogGui_text_bg) CDG_options.text_bg = value; if (index == eDialogGui_text_bg_xpos) CDG_options.text_bg_xpos = value; if (index == eDialogGui_text_bg_scaling) CDG_options.text_bg_scaling = value; if (index == eDialogGui_text_bg_transparency) CDG_options.text_bg_transparency = value; if (index == eDialogGui_text_line_space) CDG_options.text_line_space = value; if (index == eDialogGui_text_numbering) CDG_options.text_numbering = value; if (index == eDialogGui_scroll_rows) CDG_options.scroll_rows = value; if (index == eDialogGui_bullet) CDG_options.bullet = value; if (index == eDialogGui_mousewheel) CDG_options.mousewheel = value; if (index == eDialogGui_reset_scrollstate) CDG_options.reset_scrollstate = value; if (index == eDialogGui_dialog_options_upwards) CDG_options.dialog_options_upwards = value; if (index == eDialogGui_uparrow_img) CDG_options.uparrow_img = value; if (index == eDialogGui_uparrow_hi_img) CDG_options.uparrow_hi_img = value; if (index == eDialogGui_uparrow_xpos) CDG_options.uparrow_xpos = value; if (index == eDialogGui_uparrow_ypos) CDG_options.uparrow_ypos = value; if (index == eDialogGui_downarrow_img) CDG_options.downarrow_img = value; if (index == eDialogGui_downarrow_hi_img) CDG_options.downarrow_hi_img = value; if (index == eDialogGui_downarrow_xpos) CDG_options.downarrow_xpos = value; if (index == eDialogGui_downarrow_ypos) CDG_options.downarrow_ypos = value; if (index == eDialogGui_auto_arrow_align) CDG_options.auto_arrow_align = value; if (index == eDialogGui_auto_arrow_up_offset_x) CDG_options.auto_arrow_up_offset_x = value; if (index == eDialogGui_auto_arrow_up_offset_y) CDG_options.auto_arrow_up_offset_y = value; if (index == eDialogGui_auto_arrow_down_offset_x) CDG_options.auto_arrow_down_offset_x = value; if (index == eDialogGui_auto_arrow_down_offset_y) CDG_options.auto_arrow_down_offset_y = value; if (index == eDialogGui_border_top) CDG_options.border_top = value; if (index == eDialogGui_border_bottom) CDG_options.border_bottom = value; if (index == eDialogGui_border_left) CDG_options.border_left = value; if (index == eDialogGui_border_right) CDG_options.border_right = value; if (index == eDialogGui_border_visible) CDG_options.border_visible = value; if (index == eDialogGui_border_color) CDG_options.border_color = value; if (index == eDialogGui_bg_img) CDG_options.bg_img = value; if (index == eDialogGui_bg_img_scaling) CDG_options.bg_img_scaling = value; if (index == eDialogGui_bg_img_transparency) CDG_options.bg_img_transparency = value; if (index == eDialogGui_bg_color) CDG_options.bg_color = value; if (index == eDialogGui_autosize_height) CDG_options.autosize_height = value; if (index == eDialogGui_autosize_width) CDG_options.autosize_width = value; if (index == eDialogGui_autosize_minheight) CDG_options.autosize_minheight = value; if (index == eDialogGui_autosize_maxheight) CDG_options.autosize_maxheight = value; if (index == eDialogGui_autosize_minwidth) CDG_options.autosize_minwidth = value; if (index == eDialogGui_autosize_maxwidth) CDG_options.autosize_maxwidth = value; } /*********************************************************************** * geti_DialogGuiOptions(static CustomDialogGui, eDialogGuiOptions index, int value) * gets the options for the dialog GUI ***********************************************************************/ int geti_DialogGuiOptions(static CustomDialogGui, eDialogGuiOptions index) { if (index == eDialogGui_hide_gui_while_dialog) return CDG_options.hide_gui_while_dialog; if (index == eDialogGui_gui_xpos) return CDG_options.gui_xpos; if (index == eDialogGui_gui_ypos) return CDG_options.gui_ypos; if (index == eDialogGui_gui_width) return CDG_options.gui_width; if (index == eDialogGui_gui_height) return CDG_options.gui_height; if (index == eDialogGui_yscreenborder) return CDG_options.yscreenborder; if (index == eDialogGui_xscreenborder) return CDG_options.xscreenborder; if (index == eDialogGui_text_font) return CDG_options.text_font; if (index == eDialogGui_text_alignment) return CDG_options.text_alignment; if (index == eDialogGui_text_color) return CDG_options.text_color; if (index == eDialogGui_text_color_active) return CDG_options.text_color_active; if (index == eDialogGui_text_color_chosen) return CDG_options.text_color_chosen; if (index == eDialogGui_text_bg) return CDG_options.text_bg; if (index == eDialogGui_text_bg_xpos) return CDG_options.text_bg_xpos; if (index == eDialogGui_text_bg_scaling) return CDG_options.text_bg_scaling; if (index == eDialogGui_text_bg_transparency) return CDG_options.text_bg_transparency; if (index == eDialogGui_text_line_space) return CDG_options.text_line_space; if (index == eDialogGui_text_numbering) return CDG_options.text_numbering; if (index == eDialogGui_scroll_rows) return CDG_options.scroll_rows; if (index == eDialogGui_bullet) return CDG_options.bullet; if (index == eDialogGui_mousewheel) return CDG_options.mousewheel; if (index == eDialogGui_reset_scrollstate) return CDG_options.reset_scrollstate; if (index == eDialogGui_dialog_options_upwards) return CDG_options.dialog_options_upwards; if (index == eDialogGui_uparrow_img) return CDG_options.uparrow_img; if (index == eDialogGui_uparrow_hi_img) return CDG_options.uparrow_hi_img; if (index == eDialogGui_uparrow_xpos) return CDG_options.uparrow_xpos; if (index == eDialogGui_uparrow_ypos) return CDG_options.uparrow_ypos; if (index == eDialogGui_downarrow_img) return CDG_options.downarrow_img; if (index == eDialogGui_downarrow_hi_img) return CDG_options.downarrow_hi_img; if (index == eDialogGui_downarrow_xpos) return CDG_options.downarrow_xpos; if (index == eDialogGui_downarrow_ypos) return CDG_options.downarrow_ypos; if (index == eDialogGui_auto_arrow_align) return CDG_options.auto_arrow_align; if (index == eDialogGui_auto_arrow_up_offset_x) return CDG_options.auto_arrow_up_offset_x; if (index == eDialogGui_auto_arrow_up_offset_y) return CDG_options.auto_arrow_up_offset_y; if (index == eDialogGui_auto_arrow_down_offset_x) return CDG_options.auto_arrow_down_offset_x; if (index == eDialogGui_auto_arrow_down_offset_y) return CDG_options.auto_arrow_down_offset_y; if (index == eDialogGui_border_top) return CDG_options.border_top; if (index == eDialogGui_border_bottom) return CDG_options.border_bottom; if (index == eDialogGui_border_left) return CDG_options.border_left; if (index == eDialogGui_border_right) return CDG_options.border_right; if (index == eDialogGui_border_visible) return CDG_options.border_visible; if (index == eDialogGui_border_color) return CDG_options.border_color; if (index == eDialogGui_bg_img) return CDG_options.bg_img; if (index == eDialogGui_bg_img_scaling) return CDG_options.bg_img_scaling; if (index == eDialogGui_bg_img_transparency) return CDG_options.bg_img_transparency; if (index == eDialogGui_bg_color) return CDG_options.bg_color; if (index == eDialogGui_autosize_height) return CDG_options.autosize_height; if (index == eDialogGui_autosize_width) return CDG_options.autosize_width; if (index == eDialogGui_autosize_minheight) return CDG_options.autosize_minheight; if (index == eDialogGui_autosize_maxheight) return CDG_options.autosize_maxheight; if (index == eDialogGui_autosize_minwidth) return CDG_options.autosize_minwidth; if (index == eDialogGui_autosize_maxwidth) return CDG_options.autosize_maxwidth; } /*********************************************************************** * prepare(DialogOptionsRenderingInfo) * Sets some global vars * ***********************************************************************/ void prepare(static CustomDialogGui, DialogOptionsRenderingInfo *info) { int i = 1; CDG_options.active_options_count = 1; in_speech = true; if (CDG_options.hide_gui_while_dialog == true && gMain.Visible == true && gAction.Visible == true) { gMain.Visible = false; gAction.Visible = false; } // count active options while (i <= info.DialogToRender.OptionCount) { if (info.DialogToRender.GetOptionState(i) == eOptionOn) CDG_options.active_options_count++; i++; } // prepare dynamic arrays CDG_active_options = new int[CDG_options.active_options_count]; CDG_active_options_height = new int[CDG_options.active_options_count]; CDG_active_options_width = new int[CDG_options.active_options_count]; CDG_active_options_text = new String[CDG_options.active_options_count]; } /*********************************************************************** * addOption(DialogOptionsRenderingInfo *info) * sets Dialog options up. * ***********************************************************************/ void addOption(static CustomDialogGui, int position, int optionNumber, String optionText) { String temp_option; int temp_text_height; CDG_active_options[position] = optionNumber; if (CDG_options.text_numbering) { if (CDG_options.dialog_options_upwards) temp_option = String.Format ("%d.",CDG_options.active_options_count-position); else temp_option = String.Format ("%d.",position); temp_option = temp_option.Append(" "); temp_option = temp_option.Append(optionText); } else temp_option = optionText; CDG_active_options_text[position] = temp_option; CDG_active_options_height[position]= GetTextHeight(temp_option, CDG_options.text_font, CDG_options.gui_width - CDG_options.border_left - CDG_options.border_right)+CDG_options.text_line_space; CDG_active_options_width[position] = GetTextWidth(temp_option, CDG_options.text_font)+ CDG_options.border_left + CDG_options.border_right +2; if (CDG_options.bullet!=0) CDG_active_options_width[position] += Game.SpriteWidth[CDG_options.bullet]; } /*********************************************************************** * getOptionDetails(DialogOptionsRenderingInfo *info) * Get active option numbers, texts and their max height * ***********************************************************************/ void getOptionDetails(static CustomDialogGui, DialogOptionsRenderingInfo *info) { int i = 1, j = 1, option_count; String temp_option, temp_string; option_count = info.DialogToRender.OptionCount; // Normal Sorting if (!CDG_options.dialog_options_upwards) { while (i <= option_count) { if (info.DialogToRender.GetOptionState(i) == eOptionOn) { temp_string = info.DialogToRender.GetOptionText(i); CustomDialogGui.addOption(j, i, temp_string); j++; } i++; } } // Bottom-Up sorting else { i = option_count; while (i >= 1) { if (info.DialogToRender.GetOptionState(i) == eOptionOn) { temp_string = info.DialogToRender.GetOptionText(i); CustomDialogGui.addOption(j, i, temp_string); j++; } i--; } } } /*********************************************************************** * getRowCount() * Get the Number of Rows * ***********************************************************************/ void getRowCount(static CustomDialogGui, int width) { int i, j, k = 1, temp_height; bool first_call=false; j = 0; if ( CDG_options.scroll_from ==0) { CDG_options.scroll_from =1; first_call = true; } i = CDG_options.scroll_from; temp_height =CDG_options.max_option_height; // How many options fit in the max_height? while (i < CDG_options.active_options_count) { if (temp_height > CDG_active_options_height[i]) { temp_height -= CDG_active_options_height[i]; j++; } else i = CDG_options.active_options_count-1; CDG_options.scroll_to = j; i++; } CDG_options.scroll_to += CDG_options.scroll_from-1; if (CDG_options.scroll_to >= CDG_options.active_options_count) CDG_options.scroll_to = CDG_options.active_options_count-1; // Reverse counting to scroll down to the last option if (CDG_options.dialog_options_upwards && first_call) { i = CDG_options.active_options_count-1; j = 0; temp_height = CDG_options.max_option_height; while (i > 0) { if (temp_height > CDG_active_options_height[i]) { temp_height -= CDG_active_options_height[i]; j++; }else i=0; i--; } CDG_options.scroll_to = CDG_options.active_options_count-1; if (j >= CDG_options.active_options_count-1) CDG_options.scroll_from = 1; else CDG_options.scroll_from = CDG_options.active_options_count -j; } } /*********************************************************************** * resetScrollPosition(static CustomDialogGui) * Sets the scrolling state back to the first option * ***********************************************************************/ void resetScrollPosition(static CustomDialogGui) { if (CDG_options.dialog_options_upwards) CDG_options.scroll_from = CDG_options.active_options_count; else CDG_options.scroll_from = 1; } /*********************************************************************** * AGS SUPPLIED FUNCTION * dialog_options_get_dimensions * ***********************************************************************/ function dialog_options_get_dimensions(DialogOptionsRenderingInfo *info) { int i=1, j=1, option_count=0, max_height=0, autoheight=0, active_options=1, autowidth=0, max_width = 0, temp_width = 0, xpos, ypos, vp_width, vp_height; String temp_option, temp_string; // Get viewpoint #ifdef SCRIPT_API_v3507 vp_width = Screen.Width; vp_height = Screen.Height; #else vp_width = System.ViewportWidth; vp_height = System.ViewportHeight; #endif if ((CDG_options.bg_img_transparency > 0 || CDG_options.bg_img_transparency == -1) && CDG_options.bg_img!=0 ) { info.HasAlphaChannel = true; } // Reserve space for bullet in textmode, if needed. if (CDG_options.bullet!=0) { if (CDG_options.border_left < Game.SpriteWidth[CDG_options.bullet]) { CDG_options.border_left += Game.SpriteWidth[CDG_options.bullet]; } } // calculate autowidth and autoheight if (CDG_options.autosize_height) CDG_options.max_option_height = CDG_options.autosize_maxheight - CDG_options.border_bottom - CDG_options.border_top; else CDG_options.max_option_height = CDG_options.gui_height - CDG_options.border_bottom - CDG_options.border_top; if (CDG_options.autosize_height || CDG_options.autosize_width) { option_count = info.DialogToRender.OptionCount; CustomDialogGui.prepare(info); CustomDialogGui.getOptionDetails(info); while (i <= CDG_options.active_options_count-1) { max_height += CDG_active_options_height[i]; temp_width = CDG_active_options_width[i]; if (max_width < temp_width) max_width = temp_width; i++; } i=1; // check for min and max sizes autoheight = max_height + CDG_options.border_top + CDG_options.border_bottom +2; if (autoheight > CDG_options.autosize_maxheight) autoheight = CDG_options.autosize_maxheight; else if (autoheight <= CDG_options.autosize_minheight) autoheight = CDG_options.autosize_minheight; autowidth = max_width + CDG_options.border_left+CDG_options.border_right +2; if (autowidth > CDG_options.autosize_maxwidth) autowidth = CDG_options.autosize_maxwidth; else if (autowidth <= CDG_options.autosize_minwidth) autowidth = CDG_options.autosize_minwidth; } if (!CDG_options.autosize_height) autoheight = CDG_options.gui_height; if (!CDG_options.autosize_width) autowidth = CDG_options.gui_width; xpos = CDG_options.gui_xpos; ypos = CDG_options.gui_ypos; // Check on Screenborders if ((ypos + autoheight + CDG_options.yscreenborder) > vp_height) { ypos = vp_height - autoheight - CDG_options.yscreenborder; } else if (ypos < CDG_options.yscreenborder) ypos = CDG_options.yscreenborder; if ((xpos + autowidth + CDG_options.xscreenborder) > vp_width) { xpos = vp_width - autowidth - CDG_options.xscreenborder; } else if (xpos < CDG_options.xscreenborder) xpos = CDG_options.xscreenborder; // Set GUI sizes if (CDG_options.autosize_height) { CDG_options.gui_height = autoheight; if ((autoheight + ypos + CDG_options.yscreenborder) > vp_height) { CDG_options.gui_height = vp_height - ypos - CDG_options.yscreenborder; } else if ((CDG_options.gui_height + ypos + CDG_options.yscreenborder) > vp_height) { CDG_options.gui_height = vp_height - ypos - CDG_options.yscreenborder; } } if (CDG_options.autosize_width) { CDG_options.gui_width = autowidth; if (autowidth + xpos + CDG_options.xscreenborder > vp_width) { CDG_options.gui_width = vp_width- xpos - CDG_options.xscreenborder; } else if (CDG_options.gui_width + xpos + CDG_options.xscreenborder > vp_width) { CDG_options.gui_width = vp_width - xpos - CDG_options.xscreenborder; } } // Arrow alignment if (CDG_options.auto_arrow_align >0) { CDG_options.uparrow_ypos = CDG_options.auto_arrow_up_offset_y; CDG_options.downarrow_ypos = CDG_options.gui_height - Game.SpriteHeight[CDG_options.downarrow_img] - CDG_options.auto_arrow_down_offset_y; if (CDG_options.auto_arrow_align == 1) { CDG_options.uparrow_xpos = CDG_options.border_left+ CDG_options.auto_arrow_up_offset_x; CDG_options.downarrow_xpos = CDG_options.border_left+ CDG_options.auto_arrow_down_offset_x; } else if (CDG_options.auto_arrow_align == 2) { CDG_options.uparrow_xpos = CDG_options.gui_width / 2 - Game.SpriteWidth[CDG_options.downarrow_img] / 2; CDG_options.downarrow_xpos = CDG_options.uparrow_xpos; } else if (CDG_options.auto_arrow_align ==3) { CDG_options.uparrow_xpos = CDG_options.gui_width - Game.SpriteWidth[CDG_options.uparrow_img] - CDG_options.auto_arrow_up_offset_x; CDG_options.downarrow_xpos = CDG_options.gui_width - Game.SpriteWidth[CDG_options.downarrow_img] - CDG_options.auto_arrow_down_offset_x; } } //Position of GUI info.X = xpos ; info.Y = ypos ; //Size of GUI info.Width = CDG_options.gui_width ; info.Height = CDG_options.gui_height; } /*********************************************************************** * AGS SUPPLIED FUNCTION * dialog_options_render * ***********************************************************************/ function dialog_options_render(DialogOptionsRenderingInfo *info) { int i = 1, j = 1, k = 1, ypos = CDG_options.border_top, ypos_offset, xpos = CDG_options.border_left, xpos_offset, current_height, option_count=0, current_option, temp_height, temp_text_height; String temp_option; bool linefeed_done; option_count = info.DialogToRender.OptionCount; // Draw GUI decorations CDG_options.dialog_window = info; // Fill GUI Background if (CDG_options.bg_img==0) info.Surface.Clear(CDG_options.bg_color); else { if (CDG_options.bg_img_scaling==1) { if (CDG_options.bg_img_transparency == -1) info.Surface.DrawImage(0, 0, CDG_options.bg_img, 0, info.Width, info.Height); else info.Surface.DrawImage(0, 0, CDG_options.bg_img, CDG_options.bg_img_transparency, info.Width, info.Height); } else { if (CDG_options.bg_img_transparency == -1) info.Surface.DrawImage(0, 0, CDG_options.bg_img); else info.Surface.DrawImage(0, 0, CDG_options.bg_img, CDG_options.bg_img_transparency); } } // Outline if (CDG_options.border_visible) { info.Surface.DrawingColor = CDG_options.border_color; info.Surface.DrawLine(0, 0, info.Width, 0); info.Surface.DrawLine(0, 0, 0, info.Height); info.Surface.DrawLine(0, info.Height, info.Width, info.Height); info.Surface.DrawLine(info.Width, 0, info.Width, info.Height); } CustomDialogGui.prepare(info); CustomDialogGui.getOptionDetails(info); // Calculate, how many options fit in the GUI CustomDialogGui.getRowCount(CDG_options.gui_width); // begin drawing the options i = CDG_options.scroll_from; while (i <= CDG_options.scroll_to) { current_option = CDG_active_options[i]; if (info.DialogToRender.GetOptionState(current_option) == eOptionOn) { if (info.ActiveOptionID == current_option) info.Surface.DrawingColor = CDG_options.text_color_active; else if (CDG_options.text_color_chosen > -1 && info.DialogToRender.HasOptionBeenChosen(current_option) ) info.Surface.DrawingColor = CDG_options.text_color_chosen; else info.Surface.DrawingColor = CDG_options.text_color; if (CDG_options.text_bg!=0) { if (CDG_options.text_bg_scaling==1) info.Surface.DrawImage(CDG_options.text_bg_xpos, ypos, CDG_options.text_bg, CDG_options.text_bg_transparency, CDG_options.gui_width - CDG_options.text_bg_xpos - CDG_options.border_left , CDG_active_options_height[i]); else info.Surface.DrawImage(CDG_options.text_bg_xpos, ypos, CDG_options.text_bg, CDG_options.text_bg_transparency); } if (CDG_options.bullet!=0) info.Surface.DrawImage (CDG_options.border_left - Game.SpriteWidth[CDG_options.bullet], ypos, CDG_options.bullet); info.Surface.DrawStringWrapped(CDG_options.border_left, ypos, CDG_options.gui_width - CDG_options.border_left-CDG_options.border_right, CDG_options.text_font, CDG_options.text_alignment, CDG_active_options_text[i]); ypos += CDG_active_options_height[i]; } i++; } // Remove pushed state, if the mouse has left the buttons CDG_Arrow uparrow; CDG_Arrow downarrow; // Up-Arrow coordinates uparrow.x1 = info.X + CDG_options.uparrow_xpos; uparrow.y1 = info.Y + CDG_options.uparrow_ypos ; uparrow.x2 = uparrow.x1 + Game.SpriteWidth[CDG_options.uparrow_img]; uparrow.y2 = uparrow.y1 + Game.SpriteHeight[CDG_options.uparrow_img]; // Down-Arrow coordinates downarrow.x1 = info.X + CDG_options.downarrow_xpos; downarrow.y1 = info.Y + CDG_options.downarrow_ypos ; downarrow.x2 = downarrow.x1 + Game.SpriteWidth[CDG_options.downarrow_img]; downarrow.y2 = downarrow.y1 + Game.SpriteHeight[CDG_options.downarrow_img]; if (!((mouse.x >= uparrow.x1 && mouse.y >= uparrow.y1)&&(mouse.x <= uparrow.x2 && mouse.y <= uparrow.y2)) && !((mouse.x >= downarrow.x1 && mouse.y >= downarrow.y1) && (mouse.x <= downarrow.x2 && mouse.y <= downarrow.y2))){ CDG_options.uparrow_current_img = CDG_options.uparrow_img; CDG_options.downarrow_current_img = CDG_options.downarrow_img; } // Draw scrolling sprites if (CDG_options.scroll_from!=1 ){ info.Surface.DrawImage(CDG_options.uparrow_xpos, CDG_options.uparrow_ypos, CDG_options.uparrow_current_img); } if (CDG_options.scroll_to != CDG_options.active_options_count-1 ) info.Surface.DrawImage(CDG_options.downarrow_xpos, CDG_options.downarrow_ypos, CDG_options.downarrow_current_img); } /*********************************************************************** * AGS SUPPLIED FUNCTION in 3.4 * dialog_options_repexec * repexec for custom dialog rendering * ***********************************************************************/ function dialog_options_repexec(DialogOptionsRenderingInfo *info) { int i=0, ypos = CDG_options.border_top, xpos = CDG_options.border_left, xpos_offset, j=1, current_option; CDG_Arrow uparrow; CDG_Arrow downarrow; String temp_string, temp_option; bool linefeed_done; // Up-Arrow coordinates uparrow.x1 = info.X + CDG_options.uparrow_xpos; uparrow.y1 = info.Y + CDG_options.uparrow_ypos ; uparrow.x2 = uparrow.x1 + Game.SpriteWidth[CDG_options.uparrow_img]; uparrow.y2 = uparrow.y1 + Game.SpriteHeight[CDG_options.uparrow_img]; // Down-Arrow coordinates downarrow.x1 = info.X + CDG_options.downarrow_xpos; downarrow.y1 = info.Y + CDG_options.downarrow_ypos ; downarrow.x2 = downarrow.x1 + Game.SpriteWidth[CDG_options.downarrow_img]; downarrow.y2 = downarrow.y1 + Game.SpriteHeight[CDG_options.downarrow_img]; // scroll up-down: highlight // Scroll up if ((mouse.x >= uparrow.x1 && mouse.y >= uparrow.y1)&&(mouse.x <= uparrow.x2 && mouse.y <= uparrow.y2)) { if (CDG_options.uparrow_current_img !=CDG_options.uparrow_hi_img && CDG_options.uparrow_hi_img!=0) { CDG_options.uparrow_current_img = CDG_options.uparrow_hi_img; CDG_options.downarrow_current_img = CDG_options.downarrow_img; info.Update(); return; } } // Scroll down else if ((mouse.x >= downarrow.x1 && mouse.y >= downarrow.y1) && (mouse.x <= downarrow.x2 && mouse.y <= downarrow.y2)) { if (CDG_options.downarrow_current_img !=CDG_options.downarrow_hi_img && CDG_options.downarrow_hi_img !=0) { CDG_options.downarrow_current_img = CDG_options.downarrow_hi_img; CDG_options.uparrow_current_img = CDG_options.uparrow_img; info.Update(); return; } } //Nothing else { if ((CDG_options.downarrow_current_img !=CDG_options.downarrow_img ) ||(CDG_options.uparrow_current_img !=CDG_options.uparrow_img)) { CDG_options.uparrow_current_img = CDG_options.uparrow_img; CDG_options.downarrow_current_img = CDG_options.downarrow_img; info.Update(); return; } } i = CDG_options.scroll_from; // Active option for vertical alignment while (i <= CDG_options.scroll_to) { ypos += CDG_active_options_height[i]; if ((mouse.y - info.Y) < ypos && (mouse.y > info.Y + CDG_options.border_top) && ((mouse.x > info.X + CDG_options.border_left)) && (mouse.x < info.X+ CDG_options.gui_width - CDG_options.border_right)) { info.ActiveOptionID = CDG_active_options[i]; return; } else if ((mouse.y - info.Y) < ypos || (mouse.y - info.Y > info.Height - CDG_options.border_bottom) || ((mouse.x >info.X + CDG_options.gui_width - CDG_options.border_right))|| (mouse.x= uparrow.x1 && mouse.y >= uparrow.y1) && (mouse.x <= uparrow.x2 && mouse.y <= uparrow.y2))|| (button == eMouseWheelNorth && CDG_options.mousewheel); bool isClickScrollDown = ((mouse.x >= downarrow.x1 && mouse.y >= downarrow.y1) && (mouse.x <= downarrow.x2 && mouse.y <= downarrow.y2)) || (button == eMouseWheelSouth && CDG_options.mousewheel); // scroll up if (isClickScrollUp) { i=0; while (i1) CDG_options.scroll_from --; i++; } } // scroll down else if (isClickScrollDown) { i=0; while (i