Skip to content

Commit

Permalink
Updated icons, splash, menu images, readme and changelog for v0.16
Browse files Browse the repository at this point in the history
Fixed bugs with List Screen and Grid Screen cache #47
  • Loading branch information
lvcabral committed Jul 18, 2019
1 parent e7d700d commit 4d80dd2
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 55 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,6 +1,6 @@
## Lode Runner Changelog

### v0.16 15-July-2019 - Removed Deprecated SDK v1 Objects
### v0.16 18-Jul-2019 - Added new versions and support for 15 custom levels

* Add: Version "Revenge of Lode Runner" (1986) - 17 levels #50
* Add: Version "Lode Runner Fan Book" - 66 levels #50
Expand Down
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -8,21 +8,21 @@ I developed this project during the nights and weekends of September/2016, after

If you have a Roku or Roku TV you can install the preview channel using this link: https://my.roku.com/add/LodeRunnerPreview

There are six selectable sprite modes, the original Apple II, the Commodore 64, IBM-DOS CGA, Atari 8 bits, Sinclair ZX Spectrum and Nintendo Entertainment System. The sound effects are from the Commodore 64 port.
There are six selectable sprite modes, the original Apple II, the Commodore 64, IBM-DOS CGA, Atari 8 bits, Sinclair ZX Spectrum and NES. The sound effects are from the Commodore 64 port.

The player can also select from three different versions of the game (level sets): the Classic (150 levels), Championship (50 levels) and Professional (150 levels).
The player can also select from five different versions of the game (level sets): the Classic (150 levels), Championship (50 levels), Professional (150 levels), Revenge (17 levels) and Fan Book (66 levels).
The level sets, guards AI and some assets were converted from the [Javascript Lode Runner](https://github.com/SimonHung/LodeRunner_TotalRecall) project by Simon Hung.

The version 0.11 introduced a Customel Level Editor, so the user can create up to 5 personalized maps.
Using the Custom Level Editor is now possible to create up to 15 personalized maps.

Click the image below to watch a video with the functionality up to version 0.11:

[![Lode Runner for Remake for Roku (v0.11)](http://lvcabral.com/LodeRunner/images/LodeRunnerYoutubeVideo011.png)](https://www.youtube.com/watch?v=PizGMcdjIqQ)

Disclaimer: This source code shall not be used commercially or sold in any form, the objective of this project is educational.
Any usage/publication of this code should be explicitly authorized by the author.
Any usage and/or publication of this source code, or any derivative work, should be explicitly authorized by the author.

Copyright (C) 2016 Marcelo Lv Cabral<br/>
Copyright (C) 2016-2019 Marcelo Lv Cabral<br/>
http://lvcabral.com <br/>

Twitter: [@lvcabral](https://twitter.com/lvcabral)
Binary file modified images/apple_ii.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/atari_400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/brick_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/commodore_64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/control_horizontal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/control_vertical.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/cover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ibm_pc.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/icon_focus_hd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/icon_side_hd.png
Binary file not shown.
Binary file modified images/nes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/randomize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/splash_hd.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/splash_sd.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/zx_spectrum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions manifest
@@ -1,16 +1,13 @@
title=Lode Runner
major_version=0
minor_version=16
build_version=595
build_version=623
mm_icon_focus_fhd=pkg:/images/icon_focus_hd.png
mm_icon_focus_hd=pkg:/images/icon_focus_hd.png
mm_icon_focus_sd=pkg:/images/icon_side_hd.png
mm_icon_focus_sd=pkg:/images/icon_focus_hd.png
screensaver_private=1
requires_audiometadata=0
splash_screen_sd=pkg:/images/splash_sd.jpg
splash_screen_hd=pkg:/images/splash_hd.jpg
splash_color=#000000
splash_min_time=3000
bs_prof_enabled=false
bs_prof_sample_ratio=0.1
game=1
24 changes: 12 additions & 12 deletions source/gameMenu.brs
Expand Up @@ -23,11 +23,11 @@ Function StartMenu(focus as integer) as integer
this.spriteImage = ["pkg:/images/apple_ii.png", "pkg:/images/commodore_64.png",
"pkg:/images/ibm_pc.png", "pkg:/images/atari_400.png",
"pkg:/images/zx_spectrum.png", "pkg:/images/nes.png","pkg:/images/randomize.png"]
this.versionModes = ["Classic (1983)", "Championship (1984)", "Professional (1985)", "Revenge (1986)", "Fan Book", "Custom Levels"]
this.versionModes = ["Classic (1983)", "Championship (1984)", "Professional (1985)", "Revenge (1986)", "LR Fan Book", "Custom Levels"]
this.startLevels = [1, 1, 1, 1, 1, 1]
this.startLevels[m.settings.version] = m.settings.startLevel
this.versionHelp = ["150 original levels", "50 difficult levels created by fans", "150 new levels by Dodosoft",
"17 levels", "66 levels", "Edit your own custom levels"]
this.versionHelp = ["150 original levels", "50 hard levels created by fans", "150 levels by Dodosoft",
"17 levels by Mad Man", "66 levels", "Create up to 15 custom levels"]
this.controlModes = ["Vertical Mode", "Horizontal Mode"]
this.controlHelp = ["", ""]
this.controlImage = ["pkg:/images/control_vertical.png", "pkg:/images/control_horizontal.png"]
Expand Down Expand Up @@ -261,10 +261,10 @@ Function SelectStartLevel(spriteMode as integer, versionId as integer, levelId a
screen.Show()
for l = 1 to m.maps.levels.total
if l <= 15
imgPath = GetLevelMapImage(m.settings.spriteMode, m.settings.version, l)
imgPath = GetLevelMapImage(m.settings.spriteMode, m.settings.version, l, 210)
content.Push({id: l, HDPosterUrl: imgPath})
else
imgPath = LevelMapImageExists(m.settings.spriteMode, m.settings.version, l)
imgPath = LevelMapImageExists(m.settings.spriteMode, m.settings.version, l, 210)
if imgPath = ""
content.Push(invalid)
else
Expand All @@ -285,8 +285,8 @@ Function SelectStartLevel(spriteMode as integer, versionId as integer, levelId a
sps = idx mod 5
first = idx-sps
last = idx-sps+4
for i = first to last
imgPath = GetLevelMapImage(m.settings.spriteMode, m.settings.version, i+1)
for i = first to Min(last, content.Count()-1)
imgPath = GetLevelMapImage(m.settings.spriteMode, m.settings.version, i+1, 210)
screen.SetContentItem(i, {id: i+1, HDPosterUrl: imgPath})
next
end if
Expand All @@ -300,10 +300,10 @@ Function SelectStartLevel(spriteMode as integer, versionId as integer, levelId a
return selected
End Function

Function GetLevelMapImage(spriteMode as integer, versionId as integer, levelId as integer) as string
Function GetLevelMapImage(spriteMode as integer, versionId as integer, levelId as integer, size = 300 as integer) as string
LoadGameSprites(spriteMode)
mapName = GetVersionMap(versionId)
tmpFile = "cachefs:/" + mapName + itostr(spriteMode) + zeroPad(levelId, 3) + ".png"
tmpFile = "cachefs:/" + mapName + itostr(spriteMode) + zeroPad(levelId, 3) + size.toStr() + ".png"
if not m.files.Exists(tmpFile) or versionId = m.const.VERSION_CUSTOM
'Load level map
level = CreateLevel(mapName, levelId)
Expand All @@ -328,16 +328,16 @@ Function GetLevelMapImage(spriteMode as integer, versionId as integer, levelId a
font = reg.GetDefaultFont(30, true, false)
bmp.DrawText(zeroPad(levelId, 3), (m.gameWidth - 60) / 2, m.gameHeight - 32, m.colors.white, font)
bmp.Finish()
pst = ScaleToSize(bmp, 210, 157)
pst = ScaleToSize(bmp, size, size)
png = pst.GetPng(0, 0, pst.GetWidth(), pst.GetHeight())
png.WriteFile(tmpFile)
end if
return tmpFile
End Function

Function LevelMapImageExists(spriteMode as integer, versionId as integer, levelId as integer) as string
Function LevelMapImageExists(spriteMode as integer, versionId as integer, levelId as integer, size = 300 as integer) as string
mapName = GetVersionMap(versionId)
tmpFile = "cachefs:/" + mapName + itostr(spriteMode) + zeroPad(levelId, 3) + ".png"
tmpFile = "cachefs:/" + mapName + itostr(spriteMode) + zeroPad(levelId, 3) + size.toStr() + ".png"
if not m.files.Exists(tmpFile) then tmpFile = ""
return tmpFile
End Function
2 changes: 1 addition & 1 deletion source/libGridScreen.brs
Expand Up @@ -145,7 +145,7 @@ Function wait_grid_screen(port) as object
else if index = m.codes.BUTTON_DOWN_PRESSED
if m.content.Count() > 0
m.focus += 5
if m.focus > m.content.Count() - 1
if m.focus > m.content.Count() - 1
m.focus -= 5
m.sounds.deadend.Trigger(50)
else
Expand Down
21 changes: 9 additions & 12 deletions source/libListScreen.brs
Expand Up @@ -58,8 +58,8 @@ Sub show_list_screen()
TargetRect: {x:170, y:156, w:524, h:32}})
if m.content.Count() > 0
imgArray.Push({
url: CachedFile(m.content[m.focus].HDPosterUrl + "250x250")
TargetRect: {x: 804, y: 255}})
url: m.content[m.focus].HDPosterUrl 'CachedFile(m.content[m.focus].HDPosterUrl + "250x250")
TargetRect: {x: 782, y: 200}})
txtArray.Push({
Text: m.content[m.focus].ShortDescriptionLine1
TextAttrs: {color: m.theme.ListScreenDescriptionText, font: "Medium", HAlign: "Center"}
Expand Down Expand Up @@ -111,16 +111,7 @@ End Sub
Sub set_list_content(list as object)
m.content = list
for i = 0 to m.content.Count() - 1
bmp = CreateObject("roBitmap",{width:250, height:250, alphaenable:true})
pst = ScaleToSize(CreateObject("roBitmap", m.content[i].HDPosterUrl), 250, 250)
if pst <> invalid
if pst.GetWidth() < 250 then offX = (250 - pst.GetWidth()) / 2 else offX = 0
if pst.GetHeight() < 250 then offY = (250 - pst.GetHeight()) / 2 else offY = 0
bmp.DrawObject(offX, offY, pst)
else
print "invalid list image:"; m.content[i].HDPosterUrl
end if
AddToCache(m.content[i].HDPosterUrl + "250x250", bmp)
m.content[i].HDPosterUrl = CenterImage(m.content[i].HDPosterUrl, 300, 300)
next
m.first = 0
m.focus = 0
Expand All @@ -132,6 +123,12 @@ Sub set_list_content(list as object)
if m.visible then m.Show()
End Sub

Sub set_content_item(index as integer, item as object, refresh = true as boolean)
item.HDPosterUrl = CenterImage(item.HDPosterUrl, 300, 300)
m.content[index] = item
if m.visible and refresh then m.Show()
End Sub

Function wait_list_screen(port) as object
if port = invalid then port = m.canvas.screen.port
while true
Expand Down
2 changes: 1 addition & 1 deletion source/libMessageDialog.brs
Expand Up @@ -90,7 +90,7 @@ Sub show_msg_dialog()
TargetRect: {x:254, y:menuPos.y}})
m.canvas.SetLayer(91, imgArray)
m.canvas.SetLayer(92, txtArray)
m.canvas.Show() '["91","92"])
m.canvas.Show()
m.visible = true
End Sub

Expand Down
38 changes: 20 additions & 18 deletions source/libScreens.brs
Expand Up @@ -50,21 +50,6 @@ Sub set_focused_item(index as integer)
if m.visible then m.Show()
End Sub

Sub set_content_item(index as integer, item as object, refresh = true as boolean)
bmp = CreateObject("roBitmap",{width:250, height:250, alphaenable:true})
pst = ScaleToSize(CreateObject("roBitmap", item.HDPosterUrl), 250, 250)
if pst <> invalid
if pst.GetWidth() < 250 then offX = (250 - pst.GetWidth()) / 2 else offX = 0
if pst.GetHeight() < 250 then offY = (250 - pst.GetHeight()) / 2 else offY = 0
bmp.DrawObject(offX, offY, pst)
else
print "invalid content image:"; item.HDPosterUrl
end if
AddToCache(item.HDPosterUrl + "250x250", bmp)
m.content[index] = item
if m.visible and refresh then m.Show()
End Sub

Function get_content_list() as object
return m.content
End Function
Expand Down Expand Up @@ -114,15 +99,15 @@ Sub InitCache()
end if
End Sub

Function AddToCache(fileName as string, bmp as object) as string
Function AddToCache(fileName as string, bmp as object, update = false as boolean) as string
g = GetGlobalAA()
tmpFile = g.cache.Lookup(fileName)
if tmpFile = invalid
g.cacheId++
tmpFile = "tmp:/cached" + g.cacheId.toStr() + ".png"
g.cache.AddReplace(fileName,tmpFile)
end if
if not g.files.Exists(tmpFile)
if update or not g.files.Exists(tmpFile)
png = bmp.GetPng(0, 0, bmp.GetWidth(), bmp.GetHeight())
png.WriteFile(tmpFile)
end if
Expand All @@ -132,6 +117,23 @@ End Function
Function CachedFile(fileName as string) as string
g = GetGlobalAA()
tmpFile = g.cache.Lookup(fileName)
if tmpFile = invalid then tmpFile = ""
if tmpFile = invalid then tmpFile = fileName
return tmpFile
End Function

Function CenterImage(url as string, width as integer, height as integer) as string
por = CreateObject("roBitmap", url)
if por.GetWidth() <> width or por.GetHeight() <> height
bmp = CreateObject("roBitmap",{width:width, height:height, alphaenable:true})
pst = ScaleToSize(por, width, height)
if pst <> invalid
if pst.GetWidth() < width then offX = (width - pst.GetWidth()) / 2 else offX = 0
if pst.GetHeight() < height then offY = (height - pst.GetHeight()) / 2 else offY = 0
bmp.DrawObject(offX, offY, pst)
else
print "invalid image:"; url
end if
url = AddToCache(url + "300x300", bmp, true)
end if
return url
End Function

0 comments on commit 4d80dd2

Please sign in to comment.