-------------------------------------------------------------------------------
-- This deals with the notoriety icons around the minimap.
---------------------------------------------------------------------------------
--Notoriety States
local NOTO_STATE_INITIALIZE = -1
local NOTO_STATE_HIDDEN = 0
local NOTO_STATE_VISIBLE = 1
local NOTO_STATE_ADD = 2
local NOTO_STATE_REMOVE = 3
local NOTO_STATE_DECAYING = 4
local NOTO_STATE_INCREASING = 5
-------------------------------------------------------------------------------
-- Hud notoriety data.
--
Hud_noto_data = {
--[[gangs = {
cur_team = 0,
cur_level = -1,
teams = {
["brotherhood"] = {icon_image = "ui_hud_not_syndicate", noto_level = -1, meter = -1},
["ronin"] = {icon_image = "ui_hud_not_syndicate", noto_level = -1, meter = -1},
["samedi"] = {icon_image = "ui_hud_not_syndicate", noto_level = -1, meter = -1},
},
icons = {
[1] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[2] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[3] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[4] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[5] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0}
},
meter = { meter_fill_h = 0, meter_bg_h = 0, start_angle = 3.141592654, end_angle = 6.283185307, cw = true, tween = 0 },
},]]--
police = {
cur_team = 0,
cur_level = -1,
teams = {
["police"] = {icon_image = "ui_hud_not_police", noto_level = -1, meter = -1},
},
icons = {
[1] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[2] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[3] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[4] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[5] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
[6] = {state = -1, state_prev = -1, tween_end = 0, anim_0 = 0, anim_1 = 0, anim_2 = 0, anim_3 = 0, bmp_clone_0 = 0, bmp_clone_1 = 0},
},
meter = { meter_fill_h = 0, meter_bg_h = 0, start_angle = 5.327, end_angle = 6.18, cw = false, tween = 0 }, --3.141592654 --6.28318
},
}
-------------------------------------------------------------------------
-- Initialize and subscribe to data.
--
function hud_noto_init()
--Notoriety Meters
--Hud_noto_data.gangs.meter.meter_fill_h = vint_object_find("noto_bar_gang")
Hud_noto_data.police.meter.meter_fill_h = vint_object_find("noto_bar_police")
--Hud_noto_data.gangs.meter.meter_bg_h = vint_object_find("noto_bar_gang_bg")
--Hud_noto_data.police.meter.meter_bg_h = vint_object_find("noto_bar_police_bg")
--vint_set_property(Hud_noto_data.gangs.meter.meter_fill_h, "visible", false)
vint_set_property(Hud_noto_data.police.meter.meter_fill_h, "visible", false)
--vint_set_property(Hud_noto_data.gangs.meter.meter_bg_h, "visible", false)
--vint_set_property(Hud_noto_data.police.meter.meter_bg_h, "visible", false)
--the top of the map barely peaks out on pc for some reason
local map_pc_move_grp_h = vint_object_find("map_pc_move_grp")
if game_get_platform() == "PC" then
vint_set_property(map_pc_move_grp_h, "anchor", 0, -1)
else
vint_set_property(map_pc_move_grp_h, "anchor", 0, 0)
end
------
--find reference base icons
for i = 1, 6 do
local police_icon_h = vint_object_find("police_noto_icon_" .. i)
--Hud_noto_data.gangs.icons[i].icon_h = gang_icon_h
Hud_noto_data.police.icons[i].icon_h = police_icon_h
end
--decay tweens must play at the same time. so we start the animation but disable the tweens and enable them as we go.
local decaying_anim_h = vint_object_find("noto_decaying_anim")
local noto_decaying_twn_h = vint_object_find("noto_decaying_twn", decaying_anim_h)
vint_set_property(noto_decaying_twn_h, "state", VINT_TWEEN_STATE_DISABLED)
lua_play_anim(decaying_anim_h)
--Notoriety
vint_datagroup_add_subscription("sr2_notoriety", "update", "hud_noto_change")
vint_datagroup_add_subscription("sr2_notoriety", "insert", "hud_noto_change")
end
-------------------------------------------------------------------------------
-- Datagroup callback
--
function hud_noto_change(data_item_h, event_name)
local team_name, noto_level, noto_icon = vint_dataitem_get(data_item_h)
local noto_data, display_data, icon_data, meter_data, team_data
-- find the interesting data for team
for key, noto_type in pairs(Hud_noto_data) do
if noto_type.teams[team_name] ~= nil then
noto_data = noto_type
display_data = noto_type.teams[team_name]
icon_data = noto_type.icons
meter_data = noto_type.meter
break
end
end
if noto_data == nil then
-- not an interesting team so outta here
return
end
-- update the notoriety table
display_data.noto_level = noto_level
-- find the team in this group with highest notoriety
noto_level = -1
team_name = nil
for key, value in pairs(noto_data.teams) do
if value.noto_level > noto_level then
team_name = key
noto_level = value.noto_level
team_data = value
end
end
-- better safe then sorry
if team_name == nil then
return
end
local base_new_noto = floor(noto_level)
local base_old_noto = floor(noto_data.cur_level)
local icon_h = 0
-- new team, animate in all icons
if team_name ~= noto_data.cur_team then
--update current image
for i = 1, 6 do
--Set image of icon...
vint_set_property(noto_data.icons[i], "image", team_data.icon_image)
--set the proper state for the icon...
if base_new_noto >= i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_ADD)
else
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_REMOVE)
end
end
noto_data.cur_team = team_name
--Make sure we are visible...
hud_player_notoriety_show()
-- noto on the rise, animate in all new icons
elseif base_new_noto > base_old_noto then
for i = 1, 6 do
icon_h = noto_data.icons[i].icon_h
if base_new_noto >= i and base_old_noto < i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_ADD)
elseif base_new_noto < i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_REMOVE)
else
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_VISIBLE)
end
end
--Make sure we are visible...
hud_player_notoriety_show()
-- noto falling, animate the highest active icon
elseif base_new_noto < base_old_noto then
for i = 1, 6 do
if base_new_noto == i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_ADD)
elseif base_new_noto < i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_REMOVE)
end
end
end
-- update meter
local part_new_noto = noto_level - base_new_noto
if meter_data.cw == false then
-- Lower Bar Update
local start_angle = meter_data.end_angle + ((meter_data.start_angle - meter_data.end_angle) * part_new_noto)
vint_set_property(meter_data.meter_fill_h, "start_angle", start_angle)
--vint_set_property(meter_data.meter_bg_h, "start_angle", start_angle - 0.02)
else
-- Upper Bar Update
local end_angle = meter_data.start_angle + ((meter_data.end_angle - meter_data.start_angle) * part_new_noto)
vint_set_property(meter_data.meter_fill_h, "end_angle", end_angle)
--vint_set_property(meter_data.meter_bg_h, "end_angle", end_angle + 0.02)
debug_print("vint","NOTO end_angle = "..var_to_string(end_angle).."\n")
end
if part_new_noto == 0 then
-- If the meter is at 0 then we should hide it
vint_set_property(meter_data.meter_fill_h, "visible", false)
--vint_set_property(meter_data.meter_bg_h, "visible", false)
else
--If the meter isn't at zero then make it visible
vint_set_property(meter_data.meter_fill_h, "visible", true)
--vint_set_property(meter_data.meter_bg_h, "visible", true)
end
if base_new_noto >= 1 then
vint_set_property(meter_data.meter_fill_h, "rotation", (base_new_noto - 1) * (60 * DEG_TO_RAD))
vint_set_property(meter_data.meter_fill_h, "visible", true)
else
vint_set_property(meter_data.meter_fill_h, "visible", false)
end
--determine if we are still, decaying or increasing
local noto_diff = noto_level - noto_data.cur_level
if base_new_noto == base_old_noto then
if noto_diff < -0.001 then
--decaying...
for i = 1, 6 do
icon_h = noto_data.icons[i].icon_h
if base_new_noto == i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_DECAYING)
end
end
elseif noto_diff > 0.001 then
--Increase...
for i = 1, 6 do
icon_h = noto_data.icons[i].icon_h
if base_new_noto == i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_INCREASING)
end
end
elseif abs(noto_level) > 0.0001 then
--probably the same level again just make sure we are visible...
for i = 1, 6 do
icon_h = noto_data.icons[i].icon_h
if base_new_noto == i then
hud_noto_icon_set_state(noto_data.icons[i], NOTO_STATE_VISIBLE)
end
end
end
end
--store the current level to the notoriety type(gang or police)
noto_data.cur_level = noto_level
noto_data.base_new_noto = base_new_noto
--Process the states...
hud_noto_icon_process_state(noto_data)
-- find lowest notoriety value
local lowest_noto_level = 0
local x_data = Hud_noto_data
for key, noto_type in pairs(Hud_noto_data) do
if noto_type.cur_level ~= -1 then
if noto_type.cur_level > lowest_noto_level then
lowest_noto_level = noto_type.cur_level
end
end
end
--hide notoriety if we are less than 1.
if lowest_noto_level < 1 then
hud_player_notoriety_hide()
end
end
-------------------------------------------------------------------------------
-- Icon set state
--
function hud_noto_icon_set_state(icon, state)
if state == NOTO_STATE_ADD then
if icon.state == NOTO_STATE_VISIBLE then
--Don't try to re-add an icon.
icon.state = NOTO_STATE_VISIBLE
else
icon.state = NOTO_STATE_ADD
end
elseif state == NOTO_STATE_REMOVE then
if icon.state == NOTO_STATE_HIDDEN then
--Don't try to re-hide an icon
icon.state = NOTO_STATE_HIDDEN
else
icon.state = NOTO_STATE_REMOVE
end
elseif state == NOTO_STATE_VISIBLE then
if icon.state == NOTO_STATE_ADD then
--If the state is already adding, we just keep it that way instead of trying to force visible.
icon.state = NOTO_STATE_ADD
else
icon.state = NOTO_STATE_VISIBLE
end
elseif state == NOTO_STATE_INCREASING then
if icon.state == NOTO_STATE_ADD then
--can't change to increasing if we are currently adding.
icon.state = NOTO_STATE_ADD
else
icon.state = NOTO_STATE_INCREASING
end
else
icon.state = state
end
end
-------------------------------------------------------------------------------
-- Silenetly resets the state. This happens after our ADD, REMOVE and PULSE
-- callbacks. This way we don't reprocess a hidden state.
--
function hud_noto_icon_set_state_silent(icon, state)
icon.state = state
icon.state_prev = state
end
-------------------------------------------------------------------------------
-- Processes the state for the specific noto type.
-- noto_type (gang or police) Hud_noto_data.gang or Hud_noto_data.police
-- process_icon_id if icon# is specified, we will only process that icon.
--
function hud_noto_icon_process_state(noto_type)
-- Loop through our icons and change state...
for icon_id = 1, 6 do
local level = noto_type.base_new_noto
local icon = noto_type.icons[icon_id]
local icon_h = icon.icon_h
if (icon_id < level) or (icon_id == level and level == 6) then
vint_set_property(icon_h, "tint", COLOR_HUD_NOTO_FULL_SECTION.R, COLOR_HUD_NOTO_FULL_SECTION.G, COLOR_HUD_NOTO_FULL_SECTION.B)
elseif icon_id == level then
vint_set_property(icon_h, "tint", COLOR_HUB_NOTO_RISING_SECTION.R, COLOR_HUD_NOTO_FULL_SECTION.G, COLOR_HUD_NOTO_FULL_SECTION.B)
end
if icon.state ~= icon.state_prev then
-- We need to change states now...
if icon.state == NOTO_STATE_ADD then
hud_noto_icon_add(icon_h, icon, icon_id, level)
elseif icon.state == NOTO_STATE_DECAYING then
hud_noto_icon_decay(icon_h, icon)
elseif icon.state == NOTO_STATE_INCREASING then
hud_noto_icon_pulse(icon_h, icon)
elseif icon.state == NOTO_STATE_REMOVE then
hud_noto_icon_remove(icon_h, icon)
elseif icon.state == NOTO_STATE_VISIBLE then
hud_noto_icon_visible(icon_h, icon, icon_id, level)
elseif icon.state == NOTO_STATE_HIDDEN then
hud_noto_icon_hide(icon_h, icon)
end
icon.state_prev = icon.state
end
end
end
-------------------------------------------------------------------------------
-- Hides icons with animation...
--
function hud_noto_icon_remove(icon_h, icon)
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
--ANIMATE: Fade Icon Away
local anim_3 = vint_object_find("noto_fade_out_anim")
local anim_clone_3 = vint_object_clone(anim_3)
--Targets
local anim_3_alpha_tween = vint_object_find("noto_alpha_3", anim_clone_3)
vint_set_property(anim_3_alpha_tween, "target_handle", icon_h)
local anim_3_alpha_b_tween = vint_object_find("noto_alpha_3b", anim_clone_3)
vint_set_property(anim_3_alpha_b_tween, "target_handle", icon_h)
--Reset Tween value
local tint_r, tint_g, tint_b = vint_get_property(icon_h, "tint")
vint_set_property(anim_3_alpha_tween, "start_value", tint_r, tint_g, tint_b)
--Callback
vint_set_property(anim_3_alpha_tween, "end_event", "hud_noto_icon_hide_end")
lua_play_anim(anim_clone_3, 0);
icon.bmp_clone_0 = 0
icon.bmp_clone_1 = 0
icon.anim_0 = 0
icon.anim_1 = 0
icon.anim_2 = 0
icon.anim_3 = anim_clone_3
icon.tween_end = anim_3_alpha_tween
end
function hud_noto_icon_hide_end(tween_h, event_name)
-- search for indicated tween and clean up
for k, noto_data in pairs(Hud_noto_data) do
for key, icon in pairs(noto_data.icons) do
if icon.tween_alpha_out == tween_h then
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
icon.bmp_clone_0 = 0
icon.bmp_clone_1 = 0
icon.anim_0 = 0
icon.anim_1 = 0
icon.anim_2 = 0
icon.anim_3 = 0
icon.tween_show = 0
hud_noto_icon_set_state_silent(icon, NOTO_STATE_HIDDEN)
return
end
end
end
end
-------------------------------------------------------------------------------
-- Shows icons with animation...
--
function hud_noto_icon_add(icon_h, icon, icon_id, level)
vint_set_property(icon_h, "visible", true)
--vint_set_property(Hud_noto_data.police.meter.meter_fill_h, "visible", false)
--Destroy all objects if there are any currently being animated
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
--Create bitmap clones for animation
local bmp_clone_0 = vint_object_clone(icon_h)
vint_set_property(bmp_clone_0, "depth", -1)
--Clone the notoriety anim and adjust the childs targets
--ANIMATION: Blink white
local anim_0 = vint_object_find("noto_pulse_anim")
local anim_clone_0 = vint_object_clone(anim_0)
--Target Tweens
local noto_pulse_1 = vint_object_find("noto_pulse_1", anim_clone_0)
local noto_pulse_2 = vint_object_find("noto_pulse_2", anim_clone_0)
local noto_pulse_3 = vint_object_find("noto_pulse_3", anim_clone_0)
local noto_pulse_4 = vint_object_find("noto_pulse_4", anim_clone_0)
local noto_pulse_end = vint_object_find("noto_pulse_end", anim_clone_0)
vint_set_property(noto_pulse_1, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_2, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_3, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_4, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_end, "target_handle", bmp_clone_0)
--ANIMATION: Small To Large
local anim_1 = vint_object_find("noto_add_up_anim");
local anim_clone_1 = vint_object_clone(anim_1)
--[[
--ANIMATION: BASIC FADE IN
local anim_2 = vint_object_find("noto_fade_in_anim")
local anim_clone_2 = vint_object_clone(anim_2)
--Target Tweens
local anim_2_alpha_tween = vint_object_find("noto_alpha_2", anim_clone_2)
vint_set_property(anim_2_alpha_tween, "target_handle", icon_h)
local anim_2_alpha_b_tween = vint_object_find("noto_alpha_2b", anim_clone_2)
vint_set_property(anim_2_alpha_b_tween, "target_handle", icon_h)
--Reset Properties to current value
local tint_r, tint_g, tint_b = vint_get_property(icon_h, "tint")
vint_set_property(anim_2_alpha_tween, "start_value", tint_r, tint_g, tint_b)
]]
if (icon_id == level and level == 6) then
vint_set_property(icon_h, "tint", 220/255, 0, 0)
elseif icon_id == level then
vint_set_property(icon_h, "tint", 100/255, 0, 0)
end
vint_set_property(icon_h, "alpha", 1)
--Setup callback
vint_set_property(noto_pulse_end, "end_event", "hud_noto_icon_add_end")
--vint_set_property(anim_1, "end_event", "hud_noto_clear_map_fill")
--vint_set_property(anim_clone_1, "end_event", "hud_noto_clear_map_fill")
--play anims
lua_play_anim(anim_clone_0, 0);
lua_play_anim(anim_clone_1, 0);
--lua_play_anim(anim_clone_2, 0);
icon.bmp_clone_0 = bmp_clone_0
icon.bmp_clone_1 = 0
icon.anim_0 = anim_clone_0
icon.anim_1 = anim_clone_1
icon.anim_2 = 0
icon.anim_3 = 0
icon.tween_end = noto_pulse_end
end
function hud_noto_icon_add_end(tween_h, event_name)
-- search for indicated tween and clean up
for k, noto_data in pairs(Hud_noto_data) do
for key, icon in pairs(noto_data.icons) do
if icon.tween_end == tween_h then
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
icon.bmp_clone_0 = 0
icon.bmp_clone_1 = 0
icon.anim_0 = 0
icon.anim_1 = 0
icon.anim_2 = 0
icon.tween_show = 0
icon.tween_end = 0
hud_noto_icon_set_state_silent(icon, NOTO_STATE_VISIBLE)
return
end
end
end
end
function hud_noto_clear_map_fill(tween_h, event_name)
-- HVS_JPM HS 7354 - manually set the alpha of this obejct back to zero so we dont get the grayed out minimap
local map_fill_h = vint_object_find("map_fill")
vint_set_property(map_fill_h, "alpha", 0)
end
-------------------------------------------------------------------------------
-- Starts decaying looping animation on specific icon.
--
function hud_noto_icon_decay(icon_h, icon)
--vint_set_property(Hud_noto_data.police.meter.meter_fill_h, "visible", true)
--make sure we aren't already playing an animation...
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
vint_set_property(icon_h, "visible", true)
--This one is a little bit different because we want the tweens to stay in sync... so we just clone the tween.
--Animation is already playing, cloning the tweens will keep them in sync.
local decaying_anim_h = vint_object_find("noto_decaying_anim")
local decay_twn_h = vint_object_find("noto_decaying_twn", decaying_anim_h)
local decay_clone_twn_h = vint_object_clone(decay_twn_h)
vint_set_property(decay_clone_twn_h, "state", VINT_TWEEN_STATE_RUNNING)
vint_set_property(decay_clone_twn_h, "target_handle", icon_h)
--Store options to globals...
icon.bmp_clone_0 = 0
icon.bmp_clone_1 = 0
icon.anim_0 = decay_clone_twn_h
icon.anim_1 = 0
icon.anim_2 = 0
icon.anim_3 = 0
icon.tween_end = 0
end
-------------------------------------------------------------------------------
-- Pleys pulse up animation on icon
--
function hud_noto_icon_pulse(icon_h, icon)
--vint_set_property(Hud_noto_data.police.meter.meter_fill_h, "visible", false)
--make sure we aren't already playing an animation, nuke it...
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
--make sure our notoriety icon is visible.
vint_set_property(icon_h, "visible", true)
--vint_set_property(icon_h, "tint", 100/255, 0, 0)
--Create bitmap clones for animation
local bmp_clone_0 = vint_object_clone(icon_h)
vint_set_property(bmp_clone_0, "depth", -1)
--Clone the notoriety anim and adjust the childs targets
--ANIMATION: Blink white
local anim_0 = vint_object_find("noto_pulse_anim")
local anim_clone_0 = vint_object_clone(anim_0)
--Target Tweens
local noto_pulse_1 = vint_object_find("noto_pulse_1", anim_clone_0)
local noto_pulse_2 = vint_object_find("noto_pulse_2", anim_clone_0)
local noto_pulse_3 = vint_object_find("noto_pulse_3", anim_clone_0)
local noto_pulse_4 = vint_object_find("noto_pulse_4", anim_clone_0)
local noto_pulse_end = vint_object_find("noto_pulse_end", anim_clone_0)
vint_set_property(noto_pulse_1, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_2, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_3, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_4, "target_handle", bmp_clone_0)
vint_set_property(noto_pulse_end, "target_handle", bmp_clone_0)
--Setup callback
vint_set_property(noto_pulse_end, "end_event", "hud_noto_icon_pulse_end")
--play anims
lua_play_anim(anim_clone_0, 0)
icon.bmp_clone_0 = bmp_clone_0
icon.anim_0 = anim_clone_0
icon.tween_end = noto_pulse_end
end
function hud_noto_icon_pulse_end(tween_h, event)
-- search for indicated tween and clean up
for k, noto_data in pairs(Hud_noto_data) do
for key, icon in pairs(noto_data.icons) do
if icon.tween_end == tween_h then
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
icon.bmp_clone_0 = 0
icon.bmp_clone_1 = 0
icon.anim_0 = 0
icon.anim_1 = 0
icon.anim_2 = 0
icon.tween_show = 0
hud_noto_icon_set_state_silent(icon, NOTO_STATE_VISIBLE)
return
end
end
end
end
-------------------------------------------------------------------------------
-- Force show icon...
--
function hud_noto_icon_visible(icon_h, icon, icon_id, level)
--make sure we aren't already playing an animation...
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
vint_set_property(icon_h, "visible", true)
if (icon_id < level) or (icon_id == level and level == 6) then
vint_set_property(icon_h, "tint", 220/255, 0, 0)
end
end
-------------------------------------------------------------------------------
-- Force hide icon.
--
function hud_noto_icon_hide(icon_h, icon)
--make sure we aren't already playing an animation...
vint_object_destroy(icon.bmp_clone_0)
vint_object_destroy(icon.bmp_clone_1)
vint_object_destroy(icon.anim_0)
vint_object_destroy(icon.anim_1)
vint_object_destroy(icon.anim_2)
vint_object_destroy(icon.anim_3)
vint_set_property(icon_h, "visible", false)
vint_set_property(icon_h, "tint", 0, 0, 0)
end
-------------------------------------------------------------------------------
-- Expand notoriety bars...
--
function hud_player_notoriety_show()
if Hud_notoriety.is_expanded ~= true then
vint_set_property(vint_object_find("map_noteriety_contract"), "is_paused", true)
lua_play_anim(vint_object_find("map_noteriety_expand"))
local mask = vint_object_find("map_mask")
--vint_set_property(mask, "visible", true)
Hud_notoriety.is_expanded = true
end
end
-------------------------------------------------------------------------------
-- Retract notoriety bars...
--
function hud_player_notoriety_hide()
if Hud_notoriety.is_expanded ~= false then
vint_set_property(vint_object_find("map_noteriety_expand"), "is_paused", true)
lua_play_anim(vint_object_find("map_noteriety_contract"))
local mask = vint_object_find("map_mask")
--vint_set_property(mask, "visible", false)
Hud_notoriety.is_expanded = false
end
end