--Global Mission Sequence Table...
Cmp_stronghold_seq = {}
local Cmp_stronghold_images = {
["sh01"] = "ui_cmp_sh01",
["sh02"] = "ui_cmp_sh02",
["sh03"] = "ui_cmp_sh03",
["sh04"] = "ui_cmp_sh04",
}
function cmp_stronghold_init()
Cmp_specific_doc = vint_document_find("cmp_stronghold")
--Populate data...
vint_dataresponder_request("cmp_stronghold_success", "cmp_stronghold_populate", 0)
--Set sequence...
cmp_common_screen_set_data(Cmp_stronghold_seq)
end
function cmp_stronghold_cleanup()
if CMP_TEST_MODE then
debug_print("vint", "cleanup cmp_stronghold_cleanup()\n")
end
end
function cmp_stronghold_first_frame()
--Do nothing
local h = vint_object_find("background_force_black", 0, Cmp_common_doc)
vint_set_property(h, "visible", true)
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 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 mission_internal_name This is the mission internal name "sh01", "sh02",
-- @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 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)
--[[
dr->set_element(0, Completion_info.awards.num_unlockables); // We have unlockables to do.
dr->set_element(1, encoded_string); // Activity Title
dr->set_element(2, Completion_info.layout); // layout format
// Award cash
dr->set_element(3, Completion_info.awards.cash); // Cash Award
dr->set_element(4, fl_floor((cash_multiplier + 0.005f - 1.0f) * 100.0f)); // cash multiplier
dr->set_element(5, Completion_info.awards.cash * cash_multiplier); // Cash reward including multiplier
dr->set_element(6, Completion_info.image_name_base);
// Respect
dr->set_element(7, curr_respect[0]);
dr->set_element(8, respect_pct[0]);
dr->set_element(9, respect_lvl[0]);
dr->set_element(10, curr_respect[1]);
dr->set_element(11, respect_pct[1]);
dr->set_element(12, respect_lvl[1]);
dr->set_element(13, fl_floor((completion_get_total_respect_multiplier() + 0.005f - 1.0f) * 100.0f)); // respect multiplier
dr->set_element(14, curr_respect[2]);
dr->set_element(15, respect_pct[2]);
dr->set_element(16, respect_lvl[2]);
]]
function cmp_stronghold_populate(unlockables_to_follow, mission_name, layout, cash_reward, cash_multiplier, cash_reward_inc_multiplier, mission_internal_name, 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)
--[[
debug_print("vint", "unlockable# = " .. var_to_string(unlockables_to_follow).."\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")
]]
local image = nil
if mission_internal_name ~= nil and mission_internal_name ~= "" then
image = Cmp_stronghold_images[mission_internal_name]
end
-- DAD - 4/8/11 - In the event you do get a mission_internal name, but theres no matching image in the table for it:
if image == nil then
--default
image = Cmp_stronghold_images["sh01"]
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_stronghold_seq[1].type = CMP_SCREEN_TITLE_INDEX
Cmp_stronghold_seq[1].title_string = mission_name
Cmp_stronghold_seq[1].image = image
Cmp_stronghold_seq[2].type = CMP_SCREEN_CASH_INDEX
Cmp_stronghold_seq[2].cash_reward = cash_reward
Cmp_stronghold_seq[2].cash_multiplier = cash_multiplier
Cmp_stronghold_seq[2].cash_reward_inc_multiplier = cash_reward_inc_multiplier
Cmp_stronghold_seq[3].respect_points_old = respect_points_old
Cmp_stronghold_seq[3].respect_pct_old = respect_pct_old
Cmp_stronghold_seq[3].respect_level_old = respect_level_old
Cmp_stronghold_seq[3].respect_points_new = respect_points_new
Cmp_stronghold_seq[3].respect_pct_new = respect_pct_new
Cmp_stronghold_seq[3].respect_level_new = respect_level_new
Cmp_stronghold_seq[3].respect_multiplier = respect_multiplier
Cmp_stronghold_seq[3].respect_points_multiplier = respect_points_multiplier
Cmp_stronghold_seq[3].respect_pct_multiplier = respect_pct_multiplier
Cmp_stronghold_seq[3].respect_level_multiplier = respect_level_multiplier
--Do we show rewards or not?
if unlockables_to_follow > 0 then
Cmp_stronghold_seq[4] = {}
Cmp_stronghold_seq[4].type = CMP_SCREEN_REWARD_INDEX
Cmp_stronghold_seq[4].rewards_count = unlockables_to_follow
else
--Swap out unlockables with Completion...
Cmp_stronghold_seq[4] = table_clone(Cmp_stronghold_seq[5])
Cmp_stronghold_seq[5] = nil
end
end
--Temp Function and variables can be removed once the peg is loaded from C++
function cmp_stronghold_image_loaded()
--image is loaded...
local img_grp_h = vint_object_find("img_grp", 0, Cmp_common_doc)
--replace all 4 images...
for i = 1, 4 do
local screen_image_h = vint_object_find("screen_image_" .. i, 0, Cmp_common_doc)
vint_set_property(screen_image_h, "image", Cmp_image)
end
end
Cmp_stronghold_seq = {
[1] = {
type = CMP_SCREEN_TITLE_INDEX,
title_string = "DEATH AT SMILING JACKS",
image = 0,
on_start = cmp_stronghold_first_frame,
},
[2] = {
type = CMP_SCREEN_CASH_INDEX,
cash_reward = 20000,
cash_multiplier = 45,
cash_reward_inc_multiplier = 38000,
on_start = nil,
},
[3] = {
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,
},
[4] = {
type = CMP_SCREEN_REWARD_INDEX,
rewards_count = 0
},
[5] = {
type = CMP_SCREEN_COOP_WAIT_INDEX,
},
}