-- Inherited from Vdo_base_object
Vdo_weapon_radial = Vdo_base_object:new_base()
--Assign Audio IDs
local SOUND_RADIAL_OPEN
local SOUND_RADIAL_SELECT
local SOUND_RADIAL_EQUIP_WEAPON
local SOUND_RADIAL_EQUIP_GRENADE
local STICK_TRAVEL_DISTANCE = 10
local ANCHOR_DPAD_MENU_STORE_X = 238
local ANCHOR_DPAD_MENU_STORE_Y = 0
local STICK_IMG_PS3_X = 2
local STICK_IMG_PS3_Y = 2
local STICK_IMG_PS4_X = 2 -- HVS_JRP[PRINCE] 3/18/2014
local STICK_IMG_PS4_Y = 2 -- HVS_JRP[PRINCE] 3/18/2014
local WEAPON_HIGHLIGHT_PREVIOUS_SELECTED = -1
local WEAPON_HIGHLIGHT_SELECT_NONE = -2
local upgrade_slots = {}
--local Dpad_menu_is_enabled = true
function vdo_weapon_radial_init()
SOUND_RADIAL_OPEN = game_audio_get_audio_id("SYS_WEP_MENU")
SOUND_RADIAL_SELECT = game_audio_get_audio_id("SYS_WEP_SCROLL")
SOUND_RADIAL_EQUIP_WEAPON = game_audio_get_audio_id("SYS_RADIAL_WEAPON_EQUIP")
SOUND_RADIAL_EQUIP_GRENADE = game_audio_get_audio_id("SYS_RADIAL_DRUG_EQUIP")
end
function Vdo_weapon_radial:init()
--Member Variables
self.slots = {}
self.selected_weapon_slot = -1
self.selected_grenade_slot = -1
self.equipped_weapon_slot = -1
self.equipped_grenade_slot = -1
self.store_highlight = -1
self.slot_dpad_highlight_grp = -1
self.btn_hint = -1
self.store_mode_is_enabled = false
self.cache_is_enabled = false
self.last_selected_slot = -1
self.upgrades_grp = -1
self.upgrade_slots = {}
--Initialize all slots
local slot
for i = 0, 11 do
slot = "slot_" .. i
self.slots[i] = Vdo_weapon_radial_slot:new(slot, self.handle, self.doc_handle)
self.slots[i].anchor_x, self.slots[i].anchor_y = self.slots[i]:get_anchor()
end
-- Find objects to adjust for different platforms
local stick_grp_h = vint_object_find("control_stick", self.handle, self.doc_handle)
local stick_img_h = vint_object_find("base_stick_circle_img", self.handle, self.doc_handle)
local dpad_img_h = vint_object_find("dpad_img", self.handle, self.doc_handle)
local dots_grp_h = vint_object_find("dots_grp", self.handle, self.doc_handle)
local platform = game_get_platform()
if game_is_active_input_gamepad() == false then
--We're using keyboard and mouse, don't show stick and dpad
vint_set_property(stick_grp_h, "visible", false)
vint_set_property(dpad_img_h, "visible", false)
elseif platform == "PS3" then
--On PS3, hide the stick dots and change the dpad and stick image
vint_set_property(dots_grp_h, "visible", false)
vint_set_property(dpad_img_h, "image", "ui_ctrl_ps3_dpad_n")
vint_set_property(dpad_img_h, "tint", 1, 1, 1)
vint_set_property(dpad_img_h, "scale", 1.15, 1.15)
vint_set_property(stick_img_h, "image", "ui_hud_combo_thumb_ps3")
vint_set_property(stick_img_h, "anchor", STICK_IMG_PS3_X, STICK_IMG_PS3_Y)
vint_set_property(stick_img_h, "scale", 1, 1)
vint_set_property(stick_grp_h, "scale", 1, 1)
elseif platform == "PS4" then -- HVS_JRP[PRINCE] 3/18/2014
--On PS4, hide the stick dots and change the dpad and stick image
vint_set_property(dots_grp_h, "visible", false)
vint_set_property(dpad_img_h, "image", "ui_ctrl_ps4_dpad_n")
vint_set_property(dpad_img_h, "tint", 1, 1, 1)
vint_set_property(dpad_img_h, "scale", 1.15, 1.15)
vint_set_property(stick_img_h, "image", "ui_hud_combo_thumb_ps4")
vint_set_property(stick_img_h, "anchor", STICK_IMG_PS4_X, STICK_IMG_PS4_Y)
vint_set_property(stick_img_h, "scale", 1, 1)
vint_set_property(stick_grp_h, "scale", 1, 1)
elseif platform == "XBOX3" then -- HVS_JRP[PRINCE] 3/18/2014
--On XBox One, change the dpad image
vint_set_property(dpad_img_h, "image", "ui_ctrl_xbox3_dpad_n")
vint_set_property(dpad_img_h, "tint", 1, 1, 1)
vint_set_property(dpad_img_h, "scale", 1.15, 1.15)
end
--Clear out text fields on init...
local weapon_txt = Vdo_base_object:new("weapon_text", self.handle, self.doc_handle)
weapon_txt:set_text("")
local dpad_txt = Vdo_base_object:new("dpad_text", self.handle, self.doc_handle)
dpad_txt:set_text("")
--Hide weapon text grp until needed
self.weapon_text_grp_h = vint_object_find("weapon_text_grp", self.handle, self.doc_handle)
self.slot_highlight = Vdo_base_object:new("slot_highlight_grp", self.handle, self.doc_handle)
self.slot_dpad_highlight_grp = Vdo_base_object:new("slot_dpad_highlight_grp", self.handle, self.doc_handle)
self.btn_hint = Vdo_hint_button:new("btn_hint", self.handle, self.doc_handle)
self.arrow_bmp = Vdo_base_object:new("arrow", self.handle, self.doc_handle)
self.bg_grp_h = vint_object_find("bg_grp", self.handle, self.doc_handle)
vint_set_property(self.weapon_text_grp_h, "visible", false)
self.btn_hint:set_visible(false)
self.btn_hint:set_button(CTRL_MENU_BUTTON_A)
self.stick_grp = Vdo_base_object:new("control_stick", self.handle, self.doc_handle)
-- HVS_JPM handle the upgrade display
self.upgrades_grp = vint_object_find("weapon_upgrades_grp", self.handle, self.doc_handle)
vint_set_property(self.upgrades_grp, "visible", false)
for i = 1, 5 do
self.upgrade_slots[i] = Vdo_weapon_pips:new("pips_0" .. i, self.handle, self.doc_handle)
self.upgrade_slots[i]:hide_upgrade_info()
end
--Find stick imgs to set to highlight color
self.stick_img_grp_h = vint_object_find("stick_img_grp", self.handle, self.doc_handle)
-- PC: Hide dpad and control stick
local gamepad_in_use = game_is_active_input_gamepad()
self.stick_grp:set_visible(gamepad_in_use)
self.arrow_bmp:set_visible(gamepad_in_use)
local weapon_highlight_anim_h = vint_object_find("weapon_highlight_anim", self.handle, self.doc_handle)
local dpad_highlight_anim_h = vint_object_find("dpad_highlight_anim", self.handle, self.doc_handle)
lua_play_anim(weapon_highlight_anim_h)
lua_play_anim(dpad_highlight_anim_h)
end
function Vdo_weapon_radial:cleanup()
-- Temp: bitmap doesn't line up with triangle edges
end
function Vdo_weapon_radial:show(is_visible)
if is_visible == nil then
is_visible = false
end
self:stick_arrow_reset()
self:set_visible(is_visible)
local dpad_menu_h = vint_object_find("dpad_menu", self.handle, self.doc_handle)
local dpad_text_grp_h = vint_object_find("dpad_text_grp", self.handle, self.doc_handle)
local radial_dpad_grp_h = vint_object_find("radial_dpad_grp", self.handle, self.doc_handle)
local weapon_text_pos_grp_h = vint_object_find("weapon_text_pos_grp", self.handle, self.doc_handle)
local darken_scrim_img_h = vint_object_find("darken_scrim_img", self.handle, self.doc_handle)
local outer_circle_img_h = vint_object_find("outer_circle_img_1", self.handle, self.doc_handle)
local weapon_upgrades_group = vint_object_find("weapon_upgrades_grp", self.handle, self.doc_handle)
local WEAPON_RADIAL_NO_DPAD_OFFSET = 140
if self.hide_dpad ~= false then
--hide dpad group
vint_set_property(dpad_menu_h, "visible", false)
vint_set_property(dpad_text_grp_h, "visible", false)
--shift radial over
if self.store_mode_is_enabled == false then
vint_set_property(radial_dpad_grp_h, "anchor", WEAPON_RADIAL_NO_DPAD_OFFSET, 0)
vint_set_property(weapon_text_pos_grp_h, "anchor", WEAPON_RADIAL_NO_DPAD_OFFSET, 0)
end
else
--unhide dpad group
vint_set_property(dpad_menu_h, "visible", true)
vint_set_property(dpad_text_grp_h, "visible", true)
--shift radial back
vint_set_property(radial_dpad_grp_h, "anchor", 0, 0)
vint_set_property(weapon_text_pos_grp_h, "anchor", 0, 0)
-- Show only the available grenade slots. Slot 8 is always on, so check 9 through 11.
for i = 9, 11 do
local weapon_level_obj = Vdo_base_object:new("slot_" .. i, self.handle, self.doc_handle)
if self.slots[i].level >= 1 then
--show slot
weapon_level_obj:set_visible(true)
else
--hide slot
weapon_level_obj:set_visible(false)
end
end
end
if self.store_mode_is_enabled then
vint_set_property(darken_scrim_img_h, "visible", false)
vint_set_property(outer_circle_img_h, "visible", false)
vint_set_property(weapon_upgrades_group, "visible", false)
local radial_gradient_img_h = vint_object_find("radial_gradient_img", self.handle, self.doc_handle)
vint_set_property(radial_gradient_img_h, "visible", false)
else
if game_get_platform() == "PC" then
local screen_size_x, screen_size_y = vint_get_screen_size()
element_set_actual_size(darken_scrim_img_h, screen_size_x*2, screen_size_y*2)
local scanlines_grp_h = vint_object_find("scanlines_grp", self.handle, self.doc_handle)
if screen_size_x/screen_size_y >= 1.8 then
vint_set_property(scanlines_grp_h, "visible", false)
end
end
end
end
--Updates position of stick on the radial menu
--stick_x: -1 to 1 horizontal position of the stick on analog
--stick_y: -1 to 1 vertical position of the stick on analog
function Vdo_weapon_radial:stick_update_position(stick_x, stick_y)
local x = stick_x * STICK_TRAVEL_DISTANCE
local y = -stick_y * STICK_TRAVEL_DISTANCE
local stick_grp = Vdo_base_object:new("stick_grp", self.handle, self.doc_handle)
stick_grp:set_anchor(x, y)
end
--Updates the tag of the analog stick with the proper text (RS, LS, R, L)
function Vdo_weapon_radial:stick_update_tag()
local stick_txt = Vdo_base_object:new("stick_text", self.handle, self.doc_handle)
stick_txt:set_text(get_control_stick_text())
end
function Vdo_weapon_radial:stick_update_arrow(rotation_radians)
local new_radians = rotation_radians + (PI / 2)
self.arrow_bmp:set_rotation(-new_radians)
end
--Reset arrow to currently highlighted weapon...
function Vdo_weapon_radial:stick_arrow_reset()
local new_radians = 0
local offset = PI
new_radians = (self.selected_weapon_slot/8) * PI2 + offset
self.arrow_bmp:set_rotation(new_radians)
end
--Highlights a slot on the weapon radial
function Vdo_weapon_radial:weapon_highlight(slot_num, skip_audio, force_update)
local selector_grp
local weapon_txt
local selected_slot_old
local slot_old_obj
local slot_new_obj
local dpad_menu
local dpad_menu_x = 0
local dpad_menu_y = 0
local weapon_name_tag = ""
-- slot_num == -1 can be passed in to just update previous slot
if slot_num == -1 then
slot_num = self.selected_weapon_slot
end
if slot_num < 8 then
weapon_txt = Vdo_base_object:new("weapon_text", self.handle, self.doc_handle)
selector_grp = Vdo_base_object:new("slot_weapon_select", self.handle, self.doc_handle)
slot_old_obj = self.slots[self.selected_weapon_slot]
slot_new_obj = self.slots[slot_num]
--Store slot variables
selected_slot_old = self.selected_weapon_slot
self.selected_weapon_slot = slot_num
self:stick_arrow_reset()
--Set text
if slot_new_obj.weapon_name_crc ~= 0 then
--no level appended...
local base_weapon_string = "{0:text_tag_crc}\n{1:text_tag_crc}"
local values = {[0] = slot_new_obj.weapon_class_crc, [1] = slot_new_obj.weapon_name_crc}
weapon_name_tag = vint_insert_values_in_string(base_weapon_string, values)
else
--weapon has no name (fist)
if slot_num == 0 then
weapon_name_tag = "HUD_UNARMED"
end
end
vint_set_property(self.weapon_text_grp_h, "visible", true)
if self.store_mode_is_enabled then
vint_set_property(self.upgrades_grp, "visible", false)
else
-- HVS_JPM show the upgrade information for this weapon
if slot_num == 0 then
vint_set_property(self.upgrades_grp, "visible", false)
elseif slot_new_obj.weapon_name_crc ~= 0 then
vint_set_property(self.upgrades_grp, "visible", true)
for i = 1, 5 do
--Get upgrade data from code
--vint_dataresponder_request("ui_hud_weapon_upgrades_dr", "vdo_weapon_radial_set_upgrade_info", 0, slot_num, i )
local upgrade_name_crc, current_level, max_level, attribute_id, is_ultimate, upgrade_idx, fully_upgraded = ui_hud_get_weapon_upgrade_info(slot_num, i)
if upgrade_name_crc == 0 or upgrade_name_crc == nil then
self.upgrade_slots[upgrade_idx]:hide_upgrade_info()
else
self.upgrade_slots[upgrade_idx]:show_upgrade_info(upgrade_name_crc, max_level, current_level, is_ultimate, fully_upgraded)
end
end
end
end
else
--If powers are hidden don't play audio.
if self.hide_dpad == true then
skip_audio = true
end
--Powers
weapon_txt = Vdo_base_object:new("dpad_text", self.handle, self.doc_handle)
selector_grp = Vdo_base_object:new("slot_dpad_select_grp", self.handle, self.doc_handle)
dpad_menu = Vdo_base_object:new("dpad_menu", self.handle, self.doc_handle)
dpad_menu_x, dpad_menu_y = dpad_menu:get_anchor()
if self.slots[slot_num].level == 0 then
--grenade slot is not unlocked yet. Return early
return
end
slot_old_obj = self.slots[self.selected_grenade_slot]
slot_new_obj = self.slots[slot_num]
--Set Text
self.element = self.slots[slot_num].element
local base_weapon_string = "{0:text_tag_crc}\n{1}"
local values = {[0] = slot_new_obj.weapon_name_crc, [1] = POWERS_ELEMENTS_ENUMS[self.element].short_label }
if slot_new_obj.weapon_name_crc ~= 0 then
weapon_name_tag = vint_insert_values_in_string(base_weapon_string, values)
else
weapon_name_tag = ""
end
--Store slot variables
selected_slot_old = self.selected_grenade_slot
self.selected_grenade_slot = slot_num
end
--[[
--Update name and weapon level
local level = slot_new_obj.level + 1
if self.store_mode_is_enabled then
if slot_new_obj.weapon_name_crc ~= 0 then
--no level appended...
local base_weapon_string = "{0:text_tag_crc}"
local values = {[0] = slot_new_obj.weapon_name_crc}
weapon_name_tag = vint_insert_values_in_string(base_weapon_string, values)
else
--weapon has no name (fist)
weapon_name_tag = ""
end
else
--append level..
local values = {[0] = slot_new_obj.weapon_name_crc, [1] = level }
weapon_name_tag = vint_insert_values_in_string("MENU_WEAPON_LEVEL", values)
end
]]
--Stores handle their selected slots differently, only one item
--can be selected at a time...
if self.store_mode_is_enabled then
slot_old_obj = self.slots[self.last_selected_slot]
slot_new_obj = self.slots[slot_num]
selected_slot_old = self.last_selected_slot
self.last_selected_slot = slot_num
end
--Now do the menu update...
local skip_highlight = false
-- If in store use different highlight scheme
if self.store_mode_is_enabled then
--Hide weapon text
vint_set_property(self.weapon_text_grp_h, "visible", false)
--Show button hint in store
self.btn_hint:set_visible(game_is_active_input_gamepad())
--If in store and not selected slot then dim out
for i=0, #self.slots do
if i == slot_num then
-- This slot is highlighted
self.slots[i]:set_highlight(true)
end
end
else
self:set_highlight_color(COLOR_SAINTS_PURPLE)
end
--Reset previous slot
if selected_slot_old ~= -1 then
slot_old_obj:set_scale(1,1)
slot_old_obj:set_highlight(false)
end
--Scale up slot object
slot_new_obj:set_scale(1.25,1.25)
slot_new_obj:set_highlight(true)
--Move the selector to the new slot
--Offset A button so it doesn't cover ammo meter
local BUTTON_HINT_OFFSET_X = -15
local BUTTON_HINT_OFFSET_Y = 44
local selector_x, selector_y = slot_new_obj.anchor_x, slot_new_obj.anchor_y
--get parent scale of radial to offset btn hint
local radial_dpad_grp_h = vint_object_find("radial_dpad_grp", self.handle, self.doc_handle)
local parent_scale_x, parent_scale_y = vint_get_property(radial_dpad_grp_h, "scale")
selector_grp:set_anchor(selector_x, selector_y)
self.btn_hint:set_anchor(selector_x * parent_scale_x + BUTTON_HINT_OFFSET_X, selector_y * parent_scale_y + BUTTON_HINT_OFFSET_Y)
--Set name of weapon...
weapon_txt:set_text(weapon_name_tag)
--hide box if blank
local weapon_text_pos_grp_h = vint_object_find("weapon_text_pos_grp", self.handle, self.doc_handle)
local dpad_text_pos_grp_h = vint_object_find("dpad_text_pos_grp", self.handle, self.doc_handle)
if weapon_name_tag == "" then
if slot_num < 8 then
vint_set_property(weapon_text_pos_grp_h, "alpha", .3)
else
vint_set_property(dpad_text_pos_grp_h, "alpha", .3)
end
else
if slot_num < 8 then
vint_set_property(weapon_text_pos_grp_h, "alpha", 1)
else
vint_set_property(dpad_text_pos_grp_h, "alpha", 1)
end
end
--Update size of scrim behind weapon text...
local max_width, max_height = weapon_txt:get_actual_size()
local new_x = max(max_width/2 + 8, 87)
local new_width = max(max_width + 16, 174)
local corner_ne
local corner_se
local corner_nw
local corner_sw
local scrim
if slot_num < 8 then
corner_ne = vint_object_find("weapon_corner_ne_img")
corner_se = vint_object_find("weapon_corner_se_img")
corner_nw = vint_object_find("weapon_corner_nw_img")
corner_sw = vint_object_find("weapon_corner_sw_img")
scrim = vint_object_find("level_scrim_img")
else
corner_ne = vint_object_find("power_corner_ne_img")
corner_se = vint_object_find("power_corner_se_img")
corner_nw = vint_object_find("power_corner_nw_img")
corner_sw = vint_object_find("power_corner_sw_img")
scrim = vint_object_find("dpad_level_scrim_img")
end
local corner_ne_x, corner_ne_y = vint_get_property(corner_ne, "anchor")
local corner_se_x, corner_se_y = vint_get_property(corner_se, "anchor")
local corner_nw_x, corner_nw_y = vint_get_property(corner_nw, "anchor")
local corner_sw_x, corner_sw_y = vint_get_property(corner_sw, "anchor")
local scrim_width, scrim_height = element_get_actual_size(scrim)
vint_set_property(corner_ne, "anchor", new_x, corner_ne_y)
vint_set_property(corner_se, "anchor", new_x, corner_se_y)
vint_set_property(corner_nw, "anchor", -new_x, corner_nw_y)
vint_set_property(corner_sw, "anchor", -new_x, corner_sw_y)
element_set_actual_size(scrim, new_width ,scrim_height)
--Play audio
if ( (skip_audio == false or skip_audio == nil) and ( selected_slot_old ~= slot_num ) ) then
game_UI_audio_play("UI_HUD_Select_Weapon")
end
-- PC: Hide dpad and control stick
local gamepad_in_use = game_is_active_input_gamepad()
vint_set_property(vint_object_find("dpad_img", self.handle, self.doc_handle), "visible", gamepad_in_use)
self.stick_grp:set_visible(gamepad_in_use)
self.arrow_bmp:set_visible(gamepad_in_use)
end
function vdo_weapon_radial_set_upgrade_info( upgrade_name_crc, current_level, max_level, attribute_id, is_ultimate, upgrade_idx, fully_upgraded )
if upgrade_name_crc == 0 or upgrade_name_crc == nil then
self.upgrade_slots[upgrade_idx]:hide_upgrade_info()
else
self.upgrade_slots[upgrade_idx]:show_upgrade_info(upgrade_name_crc, max_level, current_level, is_ultimate, fully_upgraded)
end
end
---Equips currently selected slots in the radial menu for both weapons and grenades
function Vdo_weapon_radial:game_equip_selected_slots()
--Equip the Weapon First
--have we actually selected something
if self.selected_weapon_slot ~= -1 then
--is it available?
if self.slots[self.selected_weapon_slot].availability == true then
--is the selected slot not the same as the equipped slot?
if self.selected_weapon_slot ~= self.equipped_weapon_slot then
local success = game_use_radial_menu_item(self.selected_weapon_slot)
if success then
self.equipped_weapon_slot = self.selected_weapon_slot
end
end
end
end
--Set Power elements
for i=8, #self.slots do
game_set_grenade_ammo(i, self.slots[i].element)
end
--Equip Grenade Now
if self.selected_grenade_slot ~= -1 then
--is it available?
if self.slots[self.selected_grenade_slot].availability == true then
-- is this slot unlocked?
if self.slots[self.selected_grenade_slot].level >= 1 then
--is the selected slot not the same as the equipped slot?
if self.selected_grenade_slot ~= self.equipped_grenade_slot then
local success = game_set_equipped_grenade(self.selected_grenade_slot)
if success then
self.equipped_grenade_slot = self.selected_grenade_slot
end
end
end
end
end
end
--Updates the weapon radial from the dataitem subscription
--[[
Data Item Breakdown:
slot_num: Slot number of item
availability: Is the item available and can it be equipped?
weapon_name_crc: crc for the item name (if nil then the item is empty
bmp_name: bitmap representing the item
ammo_cur: current ammo for the item (Weapons Only)
ammo_max: max ammo for the item (Weapons Only)
dual_wield: bool (Weapons Only)
ammo_infinite: bool (Weapons Only)
is_current_wpn Bool (Is Current Weapon)
level: upgrade level of the weapon (0 is the base)
depleted: bool (Weapons Only)
element int (powers only)
weapon_class_crc crc for weapon class
]]
function Vdo_weapon_radial:slots_update(di_h)
--Retreive Data from Dataitem
local slot_num, availability, weapon_name_crc, bmp_name, ammo_cur, ammo_max, dual_wield, ammo_infinite, is_current_wpn, level, depleted, element, weapon_class_crc, weapon_name, is_seven_deadly_sin = vint_dataitem_get(di_h)
local ammo_type = nil -- removed from element list as it is no longer there
--Get slot
local slot = self.slots[slot_num]
--Force the fist icon if slot num is 0 and no bitmap name is provided
if slot_num == 0 and bmp_name == nil then
bmp_name = "ui_hud_inv_fist"
end
--Update slot
slot:update(slot_num, availability, weapon_name_crc, bmp_name, ammo_cur, ammo_max, dual_wield, ammo_infinite, level, depleted, ammo_type, self.store_mode_is_enabled, element, weapon_class_crc, self.cache_is_enabled, weapon_name, is_seven_deadly_sin)
--Set weapon currently equipped if it is the case
if slot_num < 8 then
if is_current_wpn == true then
self.equipped_weapon_slot = slot_num
end
else
if bmp_name ~= nil then
self.hide_dpad = false
end
if is_current_wpn == true then
self.equipped_grenade_slot = slot_num
end
end
end
function Vdo_weapon_radial:loop_anim_cb(tween_h, event)
local anim_h = vint_object_parent(tween_h)
lua_play_anim(anim_h)
end
function Vdo_weapon_radial:play_show_anim()
local radial_show_anim_h = vint_object_find("radial_show_anim", self.handle, self.doc_handle)
lua_play_anim(radial_show_anim_h)
local radial_bg_anim_h = vint_object_find("radial_bg_anim", self.handle, self.doc_handle)
lua_play_anim(radial_bg_anim_h)
vint_set_glitch_preset("hub")
vint_spike_glitch( 100, 0 )
end
function Vdo_weapon_radial:store_mode_enable(enable)
self.store_mode_is_enabled = enable
vint_set_property(self.bg_grp_h, "visible", false)
end
function Vdo_weapon_radial:cache_mode_enable(enable)
self.cache_is_enabled = enable
end
function Vdo_weapon_radial:show_dpad_menu(is_visible)
local dpad_menu = Vdo_base_object:new("dpad_menu", self.handle, self.doc_handle)
dpad_menu:set_visible(is_visible)
local dpad_text_grp_h = vint_object_find("dpad_text_grp", self.handle, self.doc_handle)
vint_set_property(dpad_text_grp_h, "visible", is_visible)
self.hide_dpad = not is_visible
end
--SEH this needs to eventually determine if we last selected weapons or grenades, and return the right one
--
function Vdo_weapon_radial:get_selected_slot()
return self.last_selected_slot
end
function Vdo_weapon_radial:set_highlight_color(color)
local platform = game_get_platform()
if (platform ~= "PS3") and (platform ~= "PS4") then -- HVS_JRP[PRINCE] 3/18/2014 Added PS4
vint_set_property(self.stick_img_grp_h, "tint", color.R, color.G, color.B)
end
self.arrow_bmp:set_property("tint", color.R, color.G, color.B)
self.slot_highlight:set_property("tint", color.R, color.G, color.B)
self.slot_dpad_highlight_grp:set_property("tint", color.R, color.G, color.B)
end
function Vdo_weapon_radial:slot_enable(slot_num)
self.slots[slot_num]:set_enabled(true)
end
function Vdo_weapon_radial:slot_disable(slot_num)
self.slots[slot_num]:set_enabled(false)
end
function Vdo_weapon_radial:slot_is_disabled(slot_num)
return not self.slots[slot_num].is_enabled
end
function Vdo_weapon_radial:slot_is_empty(slot_num)
if self.slots[slot_num].weapon_bmp_name ~= nil then
return false
else
return true
end
end
function Vdo_weapon_radial:get_weapon_name(slot_num)
if self.store_mode_is_enabled then
return self.slots[slot_num].weapon_bmp_name
end
end
function Vdo_weapon_radial:slot_show_ammo(slot_num, is_visible)
self.slots[slot_num]:show_ammo(is_visible)
end
function Vdo_weapon_radial:slot_has_infinite_ammo(slot_num)
return self.slots[slot_num]:has_infinite_ammo()
end
function Vdo_weapon_radial:transparent_bg(transparent)
local gradient_h = vint_object_find("radial_gradient_img", self.handle, self.doc_handle)
local bg_grp = vint_object_find("bg_grp", self.handle, self.doc_handle)
local anim_h = vint_object_find("radial_show_anim", self.handle, self.doc_handle)
local twn_h = vint_object_find("darken_scrim_twn", anim_h)
if transparent == true then
vint_set_property(gradient_h, "alpha", .3)
vint_set_property(bg_grp, "alpha", .8)
vint_set_property(twn_h, "end_value", .4)
else
vint_set_property(gradient_h, "alpha", 1)
vint_set_property(bg_grp, "alpha", 1)
vint_set_property(twn_h, "end_value", .8)
end
end
-- Adds mouse input subscriptions to the input tracker
--
-- @param func_prefix Name of the screen that is currently using the hint bar
-- @param input_tracker The input tracker to hold the mouse inputs events
-- @param priority THe priority of the input event
function Vdo_weapon_radial:add_mouse_inputs(func_prefix, input_tracker, priority)
if func_prefix == nil then
return
end
priority = priority or 50
local mouse_click_function = func_prefix.."_mouse_click"
local mouse_move_function = func_prefix.."_mouse_move"
for i = 1, #self.slots do
self.slots[i].slot_bmp_h = -1
-- Is this slot enabled
if self.slots[i].state == nil or self.slots[i].state == WEAPON_SLOT_STATE_ENABLED then
-- Is it visible
if self.hide_dpad or i < 8 then
-- Is it not disabled (for certain grendes) - This check probably not necessary
if i < 9 or self.slots[i].level >= 1 then
self.slots[i].slot_bmp_h = vint_object_find("base_bmp", self.slots[i].handle, self.doc_handle)
input_tracker:add_mouse_input("mouse_click", mouse_click_function, priority, self.slots[i].slot_bmp_h)
input_tracker:add_mouse_input("mouse_move", mouse_move_function, priority, self.slots[i].slot_bmp_h)
end
end
end
end
end
-- Mouse function: Return the slot matching the target_handle
function Vdo_weapon_radial:get_slot_index(target_handle)
for i = 1, #self.slots do
if target_handle == self.slots[i].slot_bmp_h then
return i
end
end
return 0
end
--SEH this needs to eventually determine if we last selected weapons or grenades, and return the right info.
-- This function finds the currently selected weapon, and return values related to ammo:
-- - current ammo count
-- - maximum ammo count
--
-- function Vdo_weapon_radial:get_selected_ammo_info()
-- --Get slot
-- local slot = self.slots[self.selected_weapon_slot]
-- return slot.ammo_cur, slot.ammo_max
-- end