--------------------------------------------------------------------------------
function mm_texture.init()
- mm_texture.defaulttexturedir = engine.get_texturepath() .. DIR_DELIM .. "base" ..
+ mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
mm_texture.basetexturedir = mm_texture.defaulttexturedir
- mm_texture.texturepack = engine.setting_get("texture_path")
+ mm_texture.texturepack = core.setting_get("texture_path")
mm_texture.gameid = nil
end
mm_texture.clear("header")
mm_texture.clear("footer")
- engine.set_clouds(false)
+ core.set_clouds(false)
mm_texture.set_generic("footer")
mm_texture.set_generic("header")
- if not have_bg and
- engine.setting_getbool("enable_clouds") then
- engine.set_clouds(true)
+ if not have_bg then
+ if core.setting_getbool("menu_clouds") then
+ core.set_clouds(true)
+ else
+ mm_texture.set_dirt_bg()
+ end
end
end
return
end
- local have_bg = false
+ local have_bg = false
local have_overlay = mm_texture.set_game("overlay",gamedetails)
if not have_overlay then
mm_texture.clear("header")
mm_texture.clear("footer")
- engine.set_clouds(false)
-
- if not have_bg and
- engine.setting_getbool("enable_clouds") then
- engine.set_clouds(true)
+ core.set_clouds(false)
+
+ if not have_bg then
+
+ if core.setting_getbool("menu_clouds") then
+ core.set_clouds(true)
+ else
+ mm_texture.set_dirt_bg()
+ end
end
mm_texture.set_game("footer",gamedetails)
--------------------------------------------------------------------------------
function mm_texture.clear(identifier)
- engine.set_background(identifier,"")
+ core.set_background(identifier,"")
end
--------------------------------------------------------------------------------
function mm_texture.set_generic(identifier)
--try texture pack first
if mm_texture.texturepack ~= nil then
- local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
+ local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
identifier .. ".png"
- if engine.set_background(identifier,path) then
+ if core.set_background(identifier,path) then
return true
end
end
if mm_texture.defaulttexturedir ~= nil then
- local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
+ local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
identifier .. ".png"
- if engine.set_background(identifier,path) then
+ if core.set_background(identifier,path) then
return true
end
end
end
--------------------------------------------------------------------------------
-function mm_texture.set_game(identifier,gamedetails)
+function mm_texture.set_game(identifier, gamedetails)
if gamedetails == nil then
return false
if mm_texture.texturepack ~= nil then
local path = mm_texture.texturepack .. DIR_DELIM ..
- gamedetails.id .. "_menu_" .. identifier .. ".png"
- if engine.set_background(identifier,path) then
+ gamedetails.id .. "_menu_" .. identifier .. ".png"
+ if core.set_background(identifier, path) then
return true
end
end
- local path = gamedetails.path .. DIR_DELIM .."menu" ..
- DIR_DELIM .. identifier .. ".png"
- if engine.set_background(identifier,path) then
+ -- Find out how many randomized textures the subgame provides
+ local n, filename
+ local menu_files = core.get_dir_list(gamedetails.path .. DIR_DELIM .. "menu", false)
+ for i = 1, #menu_files do
+ local filename = identifier .. "." .. i .. ".png"
+ if table.indexof(menu_files, filename) == -1 then
+ n = i - 1
+ break
+ end
+ end
+ -- Select random texture, 0 means standard texture
+ n = math.random(0, n)
+ if n == 0 then
+ filename = identifier .. ".png"
+ else
+ filename = identifier .. "." .. n .. ".png"
+ end
+
+ local path = gamedetails.path .. DIR_DELIM .. "menu" ..
+ DIR_DELIM .. filename
+ if core.set_background(identifier, path) then
return true
end
return false
end
+
+function mm_texture.set_dirt_bg()
+ if mm_texture.texturepack ~= nil then
+ local path = mm_texture.texturepack .. DIR_DELIM .."default_dirt.png"
+ if core.set_background("background", path, true, 128) then
+ return true
+ end
+ end
+
+ --use base pack
+ local minimalpath = defaulttexturedir .. "dirt_bg.png"
+ core.set_background("background", minimalpath, true, 128)
+end