Bg_saints_doc_handle = 0 --Doc handle to bg saints...
BG_TYPE_DEFAULT = 0
BG_TYPE_STRONGHOLD = 1
BG_TYPE_COMPLETION = 2
BG_TYPE_CENTER = 3
BG_TYPE_FULLSCREEN = 4
BG_TYPE_PAUSE = 5
BG_TYPE_CRIB = 6
BG_TYPE_CRIB_USE = 7
BG_TYPE_FAIL = 8
BG_TYPE_VIDEO = 9
Bg_staints_play_logo_slide = false
local Bg_saints_scale = 1
local Bg_saints_type = BG_TYPE_PAUSE
local Bg_h
local Bg_saints_pause_grp_h
local Bg_saints_crib_grp_h
local Fail_grp_h
local Digits_grp_h = -1
local Video_grp_h
local Vignette_grp_h
local First_glitch_done = false
local Bg_saints_pause_grp_hell_h
local Tiled_grp_hell_h
local Gradient_bg_hell_h
local Video_grp_hell_h
-- BG Video frame times
local PRESS_START_LOOP_END = 186
local PRESS_START_TRANS_START = 200
local MAIN_MENU_LOOP_START = 291
local MAIN_MENU_LOOP_END = 2614
local HD_Templates = {
[BG_TYPE_COMPLETION] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_STRONGHOLD] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_DEFAULT] = { anchor_x = -6,
size_x = 1290,
use_background = true},
[BG_TYPE_CENTER] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_FULLSCREEN] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_PAUSE] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_CRIB] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_CRIB_USE] = { anchor_x = -6,
size_x = 1290,
use_background = true},
[BG_TYPE_FAIL] = { anchor_x = -6,
size_x = 1290,
use_background = false},
[BG_TYPE_VIDEO] = { anchor_x = -6,
size_x = 1290,
use_background = false},
}
local SD_Templates = {
[BG_TYPE_COMPLETION] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_STRONGHOLD] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_DEFAULT] = { anchor_x = -6,
size_x = 640,
use_background = true},
[BG_TYPE_CENTER] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_FULLSCREEN] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_PAUSE] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_CRIB] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_CRIB_USE] = { anchor_x = -6,
size_x = 640,
use_background = true},
[BG_TYPE_FAIL] = { anchor_x = -6,
size_x = 640,
use_background = false},
[BG_TYPE_VIDEO] = { anchor_x = -6,
size_x = 640,
use_background = false},
}
function bg_saints_init()
Bg_saints_doc_handle = vint_document_find("bg_saints")
--Play logo anim when main_menu_common inits
Bg_staints_play_logo_slide = true
local bg_pulse_anim_h = vint_object_find("bg_pulse_anim", 0, Bg_saints_doc_handle)
local bg_crib_anim_h = vint_object_find("bg_crib_anim", 0, Bg_saints_doc_handle)
vint_apply_start_values(bg_pulse_anim_h)
local bg_loop_twn_h = vint_object_find("end_event_twn", bg_crib_anim_h)
vint_set_property(bg_loop_twn_h, "end_event", "vint_anim_loop_callback")
lua_play_anim(bg_pulse_anim_h)
lua_play_anim(bg_crib_anim_h)
--local bg_loop_h = vint_object_find("bg_loop", 0, Bg_saints_doc_handle)
--lua_play_anim(bg_loop_h)
Bg_saints_pause_grp_h = vint_object_find( "pause_grp", 0, Bg_saints_doc_handle )
Bg_saints_crib_grp_h = vint_object_find( "crib_grp", 0, Bg_saints_doc_handle )
Fail_grp_h = vint_object_find( "fail_grp", 0, Bg_saints_doc_handle )
Digits_grp_h = vint_object_find( "digits_grp", 0, Bg_saints_doc_handle )
Video_grp_h = vint_object_find( "video_grp", 0, Bg_saints_doc_handle )
Vignette_grp_h = vint_object_find( "Vignette_grp", 0, Bg_saints_doc_handle )
-- hell background initialize
Bg_saints_pause_grp_hell_h = vint_object_find( "pause_grp_hell", 0, Bg_saints_doc_handle )
Tiled_grp_hell_h = vint_object_find( "bg_tiled_grp_hell", 0, Bg_saints_doc_handle )
Gradient_bg_hell_h = vint_object_find( "gradient_bg_hell", 0, Bg_saints_doc_handle )
Video_grp_hell_h = vint_object_find( "video_grp_hell", 0, Bg_saints_doc_handle )
vint_set_property( Bg_saints_pause_grp_h, "visible", false )
vint_set_property( Bg_saints_crib_grp_h, "visible", false )
vint_set_property( Fail_grp_h, "visible", false )
vint_set_property( Video_grp_h, "visible", false )
vint_set_property( Bg_saints_pause_grp_hell_h, "visible", false )
vint_set_property( Tiled_grp_hell_h, "visible", false )
vint_set_property( Gradient_bg_hell_h, "visible", false )
vint_set_property( Video_grp_hell_h, "visible", false )
Bg_h = vint_object_find("bg", 0, Bg_saints_doc_handle)
--Set default type...
bg_saints_set_type(BG_TYPE_PAUSE, false)
end
function bg_saints_cleanup()
local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
vint_set_property( bg_saints_video_h, "end_event", "" )
vint_ramp_glitch(0, 0)
end
-------------------------------------------------------------------------------
-- Sets type of background
-- @param screen_type Screen type: BG_TYPE_DEFAULT, BG_TYPE_STRONGHOLD, BG_TYPE_COMPLETION, BG_TYPE_CENTER
-- @param morph Bool: do morph animation or not
-- @param width width override for background
-- @param anchor anchor override for background
--
function bg_saints_set_type( screen_type, morph, width, anchor )
local screen_group_h = vint_object_find("screen_grp", 0, Bg_saints_doc_handle)
local templates = HD_Templates
if vint_is_std_res() then
templates = SD_Templates
end
Bg_saints_scale = vint_get_property(screen_group_h,"scale")
Bg_saints_type = screen_type
local template = templates[screen_type]
--Check to see if our template is valid...
if template == nil then
template = templates[BG_TYPE_PAUSE]
end
local use_background = template.use_background
bg_saints_set_background(use_background)
end
-------------------------------------------------------------------------------
-- Morphs background from previous size/position to the next...
-- @param screen_type Screen type: BG_TYPE_DEFAULT, BG_TYPE_STRONGHOLD, BG_TYPE_COMPLETION, BG_TYPE_CENTER
-- @param size_end_x width that the animation will end on
-- @param anchor_end_x x position that the animation will end on
--
function bg_saints_morph( screen_type, size_end_x, anchor_end_x )
end
-------------------------------------------------------------------------------
-- Animates background into view...
--
function bg_saints_animate()
bg_saints_show(true)
end
-------------------------------------------------------------------------------
-- Slides background into view...
--
function bg_saints_slide_in(width, anchor)
bg_saints_show(true)
end
-------------------------------------------------------------------------------
-- Slides background out of view...
--
function bg_saints_slide_out(new_end_x)
end
-------------------------------------------------------------------------------
-- Shows background
-- @param is_visible
--
function bg_saints_show( is_visible )
vint_set_property( Bg_h, "visible", is_visible )
if is_visible then
if Bg_saints_type == BG_TYPE_PAUSE then
vint_set_property( Bg_saints_pause_grp_h, "visible", false ) -- changed to false, showing new pause_grp_hell instead
vint_set_property( Bg_saints_crib_grp_h, "visible", false )
vint_set_property( Video_grp_h, "visible", false )
vint_set_property(Digits_grp_h, "tint", COLOR_BG_DIGITS_PAUSE.R, COLOR_BG_DIGITS_PAUSE.G, COLOR_BG_DIGITS_PAUSE.B)
vint_set_property(Digits_grp_h, "alpha", 0) -- changed alpha from 1 to 0 because we don't want to see the digits anymore on the pause screen
vint_set_property( Vignette_grp_h, "alpha", 0 ) -- changed alpha from .6 to 0
vint_set_property( Fail_grp_h, "visible", false )
if First_glitch_done ~= true then
vint_set_glitch_preset("hub")
vint_spike_glitch( 200, 0 )
First_glitch_done = true
end
-- new pause menu stuff
vint_set_property( Bg_saints_pause_grp_hell_h, "visible", true )
vint_set_property( Tiled_grp_hell_h, "visible", true )
vint_set_property( Gradient_bg_hell_h, "visible", true )
vint_set_property( Video_grp_hell_h, "visible", false ) -- no video on pause menu
elseif Bg_saints_type == BG_TYPE_VIDEO then
vint_set_property( Bg_saints_pause_grp_h, "visible", false ) -- changed to false, showing new pause_grp_hell instead
vint_set_property( Bg_saints_crib_grp_h, "visible", false )
vint_set_property(Digits_grp_h, "tint", COLOR_BG_DIGITS_VIDEO.R, COLOR_BG_DIGITS_VIDEO.G, COLOR_BG_DIGITS_VIDEO.B)
vint_set_property(Digits_grp_h, "alpha", 0)
vint_set_property( Video_grp_h, "visible", false ) -- changed to false, don't want this video grp show anymore
vint_set_property( Vignette_grp_h, "alpha", 0 ) -- changed alpha from 1 to 0, don't want the old vignette anymore
vint_set_property( Fail_grp_h, "visible", false )
if First_glitch_done ~= true then
vint_set_glitch_preset("hub")
vint_spike_glitch( 200, 0 )
First_glitch_done = true
end
--Reset the Video blocks so they don't show the video through the lines
--local video_block_l_h = vint_object_find("video_block_l", 0, Bg_saints_doc_handle)
--local video_block_r_h = vint_object_find("video_block_r", 0, Bg_saints_doc_handle)
--vint_set_property(video_block_l_h, "anchor", -104, -191)
--vint_set_property(video_block_r_h, "anchor", 998, -892)
-- new background stuff
vint_set_property( Bg_saints_pause_grp_hell_h, "visible", true )
vint_set_property( Tiled_grp_hell_h, "visible", true )
vint_set_property( Gradient_bg_hell_h, "visible", false )
vint_set_property( Video_grp_hell_h, "visible", true )
elseif Bg_saints_type == BG_TYPE_FAIL then
vint_set_property( Bg_saints_pause_grp_h, "visible", false ) -- changed to false, showing new pause_grp_hell instead
vint_set_property( Bg_saints_crib_grp_h, "visible", false )
vint_set_property( Video_grp_h, "visible", false )
vint_set_property( Vignette_grp_h, "alpha", .6 )
vint_set_property( Bg_saints_pause_grp_h, "saturation", 0 )
--vint_set_property( Bg_saints_pause_grp_h, "tint", 220/255, 37/255, 0/255 )
vint_set_property( Fail_grp_h, "visible", true )
vint_set_property(Digits_grp_h, "tint", COLOR_BG_DIGITS_FAIL.R, COLOR_BG_DIGITS_FAIL.G, COLOR_BG_DIGITS_FAIL.B)
vint_set_property(Digits_grp_h, "alpha", 1)
vint_ramp_glitch(0, 0)
-- new pause menu stuff
vint_set_property( Bg_saints_pause_grp_hell_h, "visible", true )
vint_set_property( Tiled_grp_hell_h, "visible", true )
vint_set_property( Gradient_bg_hell_h, "visible", true )
vint_set_property( Video_grp_hell_h, "visible", false ) -- no video on pause menu
elseif Bg_saints_type == BG_TYPE_CRIB or Bg_saints_type == BG_TYPE_CRIB_USE then
vint_set_property( Bg_saints_crib_grp_h, "visible", true )
vint_set_property( Bg_saints_pause_grp_h, "visible", false )
vint_set_property( Vignette_grp_h, "alpha", .6 )
vint_set_property( Video_grp_h, "visible", false )
vint_set_property( Fail_grp_h, "visible", false )
vint_set_property( Bg_saints_pause_grp_hell_h, "visible", false )
vint_set_property( Tiled_grp_hell_h, "visible", false )
vint_set_property( Gradient_bg_hell_h, "visible", false )
vint_set_property( Video_grp_hell_h, "visible", false )
vint_ramp_glitch(0, 0)
end
end
end
-------------------------------------------------------------------------------
-- Toggles the interface in background mode or not...
-- @param is_visible
--
function bg_saints_set_background(use_background)
vint_set_property(Bg_h, "background", use_background)
end
-------------------------------------------------------------------------------
-- Dims out everything behind bg saints...
-- @param is_visible
--
function bg_saints_dimmer_show( is_visible )
end
-------------------------------------------------------------------------------
-- Sets video
-- @param video_name
--
function bg_saints_set_video( video_name )
local bg_saints_video_h = vint_object_find( "bg_video01", 0, Bg_saints_doc_handle)
vint_set_property( bg_saints_video_h, "vid_name", video_name )
end
-------------------------------------------------------------------------------
-- Plays video
-- @param is_playing
--
function bg_saints_play_video( is_playing, stop_callback )
local bg_saints_video_h = vint_object_find( "bg_video01", 0, Bg_saints_doc_handle )
vint_set_property( bg_saints_video_h, "visible", is_playing )
vint_set_property( bg_saints_video_h, "end_event", stop_callback )
if is_playing == false then
-- needed so we can unload it and steal its memories
vint_set_property( bg_saints_video_h, "is_stopped", true )
else
vint_set_property( bg_saints_video_h, "is_paused", false )
end
end
-------------------------------------------------------------------------------
-- INTERFACE SPECIFIC FUNCTIONS
-------------------------------------------------------------------------------
function bg_saints_stronghold_drop_out()
end
-------------------------------------------------------------------------------
-- MAIN MENU VIDEO CALLBACKS
-------------------------------------------------------------------------------
-- Press Start
function bg_saints_press_start_setup()
--local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
--vint_set_property( bg_saints_video_h, "frame_event", "bg_saints_press_start_cb" )
--vint_set_property( bg_saints_video_h, "frame_event_num", PRESS_START_LOOP_END )
end
function bg_saints_press_start_cb()
--thread_new("bg_saints_press_start_loop")
end
function bg_saints_press_start_loop()
--delay(0.1)
--local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
--vint_set_property( bg_saints_video_h, "frame", 1 )
end
-- Main Menu
function bg_saints_main_menu_setup()
--local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
--bg_saints_delay_trans()
--vint_set_property( bg_saints_video_h, "frame", PRESS_START_TRANS_START)
--vint_set_property( bg_saints_video_h, "frame_event", "bg_saints_main_menu_cb" )
--vint_set_property( bg_saints_video_h, "frame_event_num", MAIN_MENU_LOOP_END )
end
-- function bg_saints_delay_trans()
-- thread_new("bg_saints_press_start_trans")
-- end
-- function bg_saints_press_start_trans()
-- delay(0.1)
-- local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
-- vint_set_property( bg_saints_video_h, "frame", PRESS_START_TRANS_START )
-- end
function bg_saints_main_menu_cb()
--thread_new("bg_saints_main_menu_loop")
end
function bg_saints_main_menu_loop()
--delay(0.005)
--local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
--vint_set_property( bg_saints_video_h, "frame", MAIN_MENU_LOOP_START )
end
function bg_saints_reset()
if game_get_platform() == "PC" then
local bg_saints_video_h = vint_object_find( "bg_video", 0, Bg_saints_doc_handle )
vint_set_property( bg_saints_video_h, "is_stopped", true )
vint_set_property( bg_saints_video_h, "is_stopped", false )
end
end