--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)
function cmp_stronghold_populate(unlockables_to_follow, mission_name, layout, cash_reward, cash_multiplier, cash_reward_inc_multiplier, mission_internal_name)
--[[
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
--Do we show rewards or not?
if unlockables_to_follow > 0 then
Cmp_stronghold_seq[3] = {}
Cmp_stronghold_seq[3].type = CMP_SCREEN_REWARD_INDEX
Cmp_stronghold_seq[3].rewards_count = unlockables_to_follow
else
--Swap out unlockables with Completion...
Cmp_stronghold_seq[3] = table_clone(Cmp_stronghold_seq[4])
Cmp_stronghold_seq[4] = 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_REWARD_INDEX,
rewards_count = 0
},
[4] = {
type = CMP_SCREEN_COOP_WAIT_INDEX,
},
}