--Global Mission Sequence Table...
Player_exit_animation_done = false
Player_exit_animation_has_played = false
Cmp_activity_seq = {}
Cmp_activity_anim_event_listener = 0
Player_exit_anim_has_played = false
function cmp_activity_init()
Cmp_specific_doc = vint_document_find("cmp_activity")
--Populate data...
vint_dataresponder_request("cmp_activity_success", "cmp_activity_populate", 0)
vint_dataresponder_request("cmp_activity_success", "cmp_activity_populate_tiers", 0, "tiers")
--Set sequence...
cmp_common_screen_set_data(Cmp_activity_seq)
Cmp_activity_anim_event_listener = vint_scriptevent_listen( "completion_activity_anim", "cmp_activity_anim_finished" )
end
function cmp_activity_cleanup()
if CMP_TEST_MODE then
debug_print("vint", "cleanup cmp_activity_cleanup()\n")
end
--game_peg_unload(Cmp_image)
screen_fade_unhide()
vint_scriptevent_stop_listening( Cmp_activity_anim_event_listener )
end
-------------------------------------------------------------------------------
-- on the first from of title sequence, this gets called via callback
--
function cmp_activity_first_frame()
--Do nothing
local h = vint_object_find("background_force_black", 0, Cmp_common_doc)
vint_set_property(h, "visible", true)
--h = vint_object_find("background_base", 0, Cmp_common_doc)
--h = vint_object_find("safe_frame", 0, Cmp_common_doc)
--vint_set_property(h, "background", true)
h = vint_object_find( "safe_frame" )
vint_set_property(h, "background", true)
screen_fade_hide()
-- distance, height, pitch, lateral, fov
vint_scriptevent_post( "completion_activity", "start_anim" )
--vint_scriptevent_post( "completion_activity", "finish_anim" )
end
--Start exit anim, play only once
function cmp_activity_play_exit_anim()
if Player_exit_anim_has_played == false then
vint_scriptevent_post( "completion_activity", "finish_anim" )
end
Player_exit_animation_has_played = true
end
--Wait for the exit animation to finish before we show the reward screen
function cmp_activity_anim_finished()
Player_exit_animation_done = true
--hide the player character...
local h = vint_object_find("background_base", 0, Cmp_common_doc)
vint_set_property(h, "background", false)
end
-------------------------------------------------------------
--Populates the script from the dataresponder...
-------------------------------------------------------------
-- @param mission_name This is the mission name... "DEATH AT SMILING JACKS"
-- @param layout "Left" or "Right" formats (Not used by cmp_common JMH, it is sent in as a paremeter 11/3/2010)
-- @param num_unlockables_to_follow # of unlockables in the mission flow... ? not sure if this is relevant at this stage... I have no problem doing the unlockable data_responder once and logging all the data from the game.
-- @param cash_reward This is the cash reward... "4000"
-- @param cash_multiplier Multiplier for cash "4.0"
-- @param cash_reward_inc_multiplier Cash_reward with the multiplier... "12000" (This could be calculated internally)
-- @param respect_points_old Respect points before...
-- @param respect_pct_old Respect percentage before...
-- @param respect_level_old Respect level before...
-- @param respect_points_new Respect points after...
-- @param respect_pct_new Respect percent after...
-- @param respect_level_new Respect level after...
-- @param respect_multiplier Respect multiplier "2.0"
-- @param respect_points_multiplier Respect points after multiplier
-- @param respect_pct_multiplier Respect percent after multiplier
-- @param respect_level_multiplier Respect level after multiplier
-- @param district_pct_old District percent before...
-- @param district_pct_new District percent after...
-- @param district_cash_per_day Cash per day...
function cmp_activity_populate(unlockables_to_follow, mission_number, mission_name, layout, cash_reward, cash_multiplier, cash_reward_inc_multiplier, respect_points_old, respect_pct_old, respect_level_old, respect_points_new, respect_pct_new, respect_level_new, respect_multiplier, respect_points_multiplier, respect_pct_multiplier, respect_level_multiplier, district_pct_old, district_pct_new, district_cash_per_day, district_team_name, image)
--[[
debug_print("vint", "unlockable# = " .. var_to_string(unlockables_to_follow).."\n")
debug_print("vint", "mission number = " .. var_to_string(mission_number).."\n")
debug_print("vint", "mission name = " .. var_to_string(mission_name).."\n")
debug_print("vint", "layout number = " .. var_to_string(layout).."\n")
debug_print("vint", "cash_reward" .. var_to_string(cash_reward).."\n")
debug_print("vint", "cash_multiplier = " .. var_to_string(cash_multiplier).."\n")
debug_print("vint", "cash_reward_inc_multiplier = " .. var_to_string(cash_reward_inc_multiplier).."\n")
debug_print("vint", "respect_points_old = " .. var_to_string(respect_points_old).."\n")
debug_print("vint", "respect_pct_old = " .. var_to_string(respect_pct_old).."\n")
debug_print("vint", "respect_level_old = " .. var_to_string(respect_level_old).."\n")
debug_print("vint", "respect points_new = " .. var_to_string(respect_points_new).."\n")
debug_print("vint", "respect_pct_new = " .. var_to_string(respect_pct_new).."\n")
debug_print("vint", "respect_level_new = " .. var_to_string(respect_level_new).."\n")
debug_print("vint", "respect_multiplier = " .. var_to_string(respect_multiplier).."\n")
debug_print("vint", "respect_points_multiplier = " .. var_to_string(respect_points_multiplier).."\n")
debug_print("vint", "respect_pct_multiplier = " .. var_to_string(respect_pct_multiplier).."\n")
debug_print("vint", "respect_level_multiplier = " .. var_to_string(respect_level_multiplier).."\n")
debug_print("vint", "district_pct_old = " .. var_to_string(district_pct_new).."\n")
debug_print("vint", "district_pct_new = " .. var_to_string(district_pct_new).."\n")
debug_print("vint", "district_cash_per_day = " .. var_to_string(district_cash_per_day).."\n")
debug_print("vint", "district_team_name = " .. var_to_string(district_team_name).."\n")
]]
if image == nil or image == "" then
image = "ui_cmp_tank_mayhem"
end
-- Store our image name to global...
--Cmp_image = image
--Callback with image...
--game_peg_load_with_cb("cmp_common_image_loaded", 1, image)
Cmp_activity_seq[1].type = CMP_SCREEN_TITLE_INDEX
Cmp_activity_seq[1].title_string = mission_name
Cmp_activity_seq[1].image = image
--[[
Cmp_activity_seq[2].tiers_bronze_goal = tiers_bronze_goal
Cmp_activity_seq[2].tiers_silver_goal = tiers_silver_goal
Cmp_activity_seq[2].tiers_gold_goal = tiers_gold_goal
Cmp_activity_seq[2].tier_completed = tier_completed
Cmp_activity_seq[2].tier_is_new = tier_is_new
--test data for tiers
Cmp_activity_seq[2].tiers_bronze_goal = "$20,000"
Cmp_activity_seq[2].tiers_silver_goal = "$50,000"
Cmp_activity_seq[2].tiers_gold_goal = "$100,000"
Cmp_activity_seq[2].tier_completed = 3
Cmp_activity_seq[2].tier_is_new = true
]]
Cmp_activity_seq[3].type = CMP_SCREEN_CASH_INDEX
Cmp_activity_seq[3].cash_reward = cash_reward
Cmp_activity_seq[3].cash_multiplier = cash_multiplier
Cmp_activity_seq[3].cash_reward_inc_multiplier = cash_reward_inc_multiplier
Cmp_activity_seq[4].respect_points_old = respect_points_old
Cmp_activity_seq[4].respect_pct_old = respect_pct_old
Cmp_activity_seq[4].respect_level_old = respect_level_old
Cmp_activity_seq[4].respect_points_new = respect_points_new
Cmp_activity_seq[4].respect_pct_new = respect_pct_new
Cmp_activity_seq[4].respect_level_new = respect_level_new
Cmp_activity_seq[4].respect_multiplier = respect_multiplier
Cmp_activity_seq[4].respect_points_multiplier = respect_points_multiplier
Cmp_activity_seq[4].respect_pct_multiplier = respect_pct_multiplier
Cmp_activity_seq[4].respect_level_multiplier = respect_level_multiplier
Cmp_activity_seq[5].district_pct_old = district_pct_old
Cmp_activity_seq[5].district_pct_new = district_pct_new
Cmp_activity_seq[5].district_cash_per_day = district_cash_per_day
Cmp_activity_seq[5].district_team_name = district_team_name
-- Cmp_activity_seq[4].district_pct_old = .22 --district_pct_new --.22
-- Cmp_activity_seq[4].district_pct_new = .325 --district_pct_new --.325
-- Cmp_activity_seq[4].district_cash_per_day = 3000 --district_cash_per_day -- 3000
-- Cmp_activity_seq[4].district_team_name = "Luchador" --"Luchador"
--Do we show rewards or not?
if unlockables_to_follow > 0 then
Cmp_activity_seq[6] = {}
Cmp_activity_seq[6].type = CMP_SCREEN_REWARD_INDEX
Cmp_activity_seq[6].rewards_count = unlockables_to_follow
else
--Swap out unlockables with Completion...
Cmp_activity_seq[6] = table_clone(Cmp_activity_seq[7])
Cmp_activity_seq[7] = nil
end
end
function cmp_activity_populate_tiers(tier_index, tier_goal, tier_goal_text, percent, best_prev_percent, reward_unlocked, just_completed, current_score, prev_best_score, score_type)
debug_print("vint", "\n\n cmp_activity_populate_tiers()\n")
local function debug_quick_print(name, value)
debug_print("vint", name ..":" .. var_to_string(value) .. "\n")
end
debug_quick_print("tier_index", tier_index)
debug_quick_print("tier_goal", tier_goal)
debug_quick_print("tier_goal_text", tier_goal_text )
debug_quick_print("percent", percent)
debug_quick_print("best_prev_percent", best_prev_percent )
debug_quick_print("reward_unlocked", reward_unlocked)
debug_quick_print("just_completed", just_completed)
debug_quick_print("current_score", current_score)
debug_quick_print("prev_best_score", prev_best_score)
debug_print("vint", "\n")
if Cmp_activity_seq[2].tier_data == nil then
Cmp_activity_seq[2].tier_data = { }
Cmp_activity_seq[2].tier_is_new = false
Cmp_activity_seq[2].tier_completed = false
end
Cmp_activity_seq[2].tier_data[ tier_index ] = {
[ "tier_goal" ] = tier_goal,
[ "percent" ] = percent,
[ "best_prev_percent" ] = best_prev_percent,
[ "reward_unlocked" ] = reward_unlocked,
[ "just_completed" ] = just_completed,
[ "score_type" ] = score_type,
}
if just_completed == true then
Cmp_activity_seq[2].tier_is_new = true
end
--if tier_index > 1 and percent >= 1 then
-- Cmp_activity_seq[2].tier_data[ tier_index ].tier_completed = true
--end
Cmp_activity_seq[2].current_score = current_score
Cmp_activity_seq[2].prev_best_score = prev_best_score
end
Cmp_activity_seq = {
[1] = {
type = CMP_SCREEN_TITLE_INDEX,
title_string = "DEATH AT SMILING JACKS",
image = 0,
on_start = cmp_activity_first_frame,
},
[2] = {
type = CMP_SCREEN_TIERS_INDEX,
on_start = nil,
},
[3] = {
type = CMP_SCREEN_CASH_INDEX,
cash_reward = 20000,
cash_multiplier = 45,
cash_reward_inc_multiplier = 38000,
on_start = nil,
},
[4] = {
type = CMP_SCREEN_RESPECT_INDEX,
on_start = nil,
respect_points_old = 200,
respect_pct_old = .4,
respect_level_old = 2,
respect_points_new = 2000,
respect_pct_new = .5,
respect_level_new = 3,
respect_multiplier = 40,
respect_points_multiplier = 2000,
respect_pct_multiplier = .5,
respect_level_multiplier = 5,
},
[5] = {
type = CMP_SCREEN_CONTROL_INDEX,
on_start = nil,
district_pct_old = .22,
district_pct_new = .325,
district_cash_per_day = 3000,
district_team_name = "Luchador",
},
[6] = {
type = CMP_SCREEN_REWARD_INDEX,
rewards_count = 0
},
[7] = {
type = CMP_SCREEN_COOP_WAIT_INDEX,
},
}