Skip to content

Commit

Permalink
Merged v0.17.3770
Browse files Browse the repository at this point in the history
  • Loading branch information
lvcabral committed Oct 24, 2019
2 parents 181599f + f0fdd1e commit e8c68b2
Show file tree
Hide file tree
Showing 34 changed files with 834 additions and 163 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Prince of Persia Changelog

### v0.17 - 24-Oct-2019 - SD Mode Support
- Add: Support for SD Mode
- Change: Removed remaining SDK1 objects (MessageBox and Keyboard)
- Several small fixes

### v0.16 - 15-Sep-2019 - Emulator Support
- Change: Restored crossfade effect on menu and cut scenes
- Fix: Crash on Palace strings (emulator only) #96
Expand Down
Binary file added assets/fonts/Gotham-Medium.otf
Binary file not shown.
Binary file added images/dialog-back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dialog-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dialog-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dialog-bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dialog-top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-backspace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-bullet-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-bullet-sel-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-caps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-clear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-long.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-shift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/keyboard-space.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/paragraph-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/paragraph-bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions manifest
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
title=Prince of Persia
subtitle=Port for Roku by Marcelo Lv Cabral
major_version=0
minor_version=16
build_version=3730
minor_version=17
build_version=3770
mm_icon_focus_hd=pkg:/images/icon_focus_hd.png
mm_icon_focus_sd=pkg:/images/icon_focus_hd.png
screensaver_private=1
Expand Down
16 changes: 10 additions & 6 deletions source/gameMain.brs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,28 @@ Sub Main()
m.files = CreateObject("roFileSystem")
m.fonts = {reg:CreateObject("roFontRegistry")}
m.fonts.reg.Register("pkg:/assets/fonts/PoP.ttf")
m.fonts.reg.Register("pkg:/assets/fonts/Gotham-Medium.otf")
m.fonts.KeysFont = m.fonts.reg.getFont("Gotham Medium", 30, false, false)
m.bitmapFont = LoadBitmapFont()
m.prandom = CreatePseudoRandom()
m.manifest = GetManifestArray()
m.status = []
'Check Roku model for performance alert
if not IsOpenGL()
m.mainScreen = CreateObject("roScreen")
m.mainScreen.SetMessagePort(m.port)
MessageDialog("Prince of Persia", "Warning: Your Roku device doesn't support accelerated graphics, this game will not perform well.")
m.mainScreen = CreateObject("roScreen", true, 1280, 720)
canvas = CreateCanvas()
MessageDialog(m.port, "Prince of Persia", "Warning: Your Roku device doesn't support accelerated" + chr(10) + "graphics, this game will not perform well.")
else if IsRokuStick()
m.mainScreen = CreateObject("roScreen")
m.mainScreen.SetMessagePort(m.port)
MessageDialog("Prince of Persia", "Warning: Your Roku Stick device has limited memory, this game only works properly on the 4 rooms mode.")
m.mainScreen = CreateObject("roScreen", true, 1280, 720)
canvas = CreateCanvas()
MessageDialog(m.port, "Prince of Persia", "Warning: Your Roku Stick device has limited memory," + chr(10) + "this game only works properly on the 4 rooms mode.")
end if
'Initialize Screen
if isHD()
print "HD Mode"
m.mainScreen = CreateObject("roScreen", true, 854, 480)
else
print "SD Mode"
m.mainScreen = CreateObject("roScreen", true, 640, 480)
end if
m.mainScreen.SetMessagePort(m.port)
Expand Down
207 changes: 106 additions & 101 deletions source/gameMenu.brs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions source/gameMods.brs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ Function GetModImage(modId as dynamic) as string
End Function

Sub ModsAndCheatsScreen()
m.mainScreen = CreateObject("roScreen", true, 1280, 720)
m.mainScreen.SetMessagePort(m.port)
this = {
screen: CreateListScreen()
port: m.port
}
this.screen.SetMessagePort(this.port)
this.screen.SetHeader("Mods and Cheats")
this.screen.SetHeader("Mods an d Cheats")
this.modArray = [{name: "(none)", author:"", levels: false, sprites: false, sounds: false}]
this.modIndex = 0
for each modId in m.mods.Keys()
Expand Down Expand Up @@ -300,7 +302,6 @@ Sub ModsAndCheatsScreen()
end if
end if
end while
return
End Sub

Function GetMenuItems(menu as object)
Expand Down
1 change: 1 addition & 0 deletions source/gameSound.brs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Function LoadSounds(enable as boolean) as object
wav: {clip:"", priority:0, cycles:0},
metadata : ParseJson(ReadAsciiFile("pkg:/assets/sounds/sounds.json")),
navSingle : CreateObject("roAudioResource", "navsingle"),
roll : CreateObject("roAudioResource", "navmulti"),
deadend : CreateObject("roAudioResource", "deadend"),
select : CreateObject("roAudioResource", "select")
}
Expand Down
82 changes: 50 additions & 32 deletions source/gameUtil.brs
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ End Function

Function IsHD()
di = CreateObject("roDeviceInfo")
return (di.GetUIResolution().name <> "sd")
return (di.GetUIResolution().height >= 720)
End Function

Function IsfHD()
di = CreateObject("roDeviceInfo")
return(di.GetUIResolution() = "fhd")
return(di.GetUIResolution().name.lcase() = "fhd")
End Function

Function ConvertX(x)
Expand Down Expand Up @@ -488,16 +488,16 @@ Function FormatTime(seconds as integer) as string
end if
' Hours
if seconds >= 3600
textTime = textTime + (seconds / 3600).toStr() + ":"
textTime = textTime + int(seconds / 3600).toStr() + ":"
hasHours = true
seconds = seconds Mod 3600
end if
' Minutes
if seconds >= 60
if hasHours
textTime = textTime + ZeroPad((seconds / 60).toStr()) + ":"
textTime = textTime + ZeroPad(int(seconds / 60).toStr()) + ":"
else
textTime = textTime + (seconds / 60).toStr() + ":"
textTime = textTime + int(seconds / 60).toStr() + ":"
end if
seconds = seconds Mod 60
else
Expand Down Expand Up @@ -592,31 +592,44 @@ Function seq_prandom(seed as integer, n as integer, p as integer, max as integer
return r1
End Function

'------- Roku Screens Functions ----
Sub MessageDialog(title, text, port = invalid) As Integer
if port = invalid then port = CreateObject("roMessagePort")
d = CreateObject("roMessageDialog")
d.SetTitle(title)
d.SetText(text)
d.SetMessagePort(port)
d.AddButton(1, "Okay")
d.Show()
Function MessageDialog(port, title, text, buttons = ["OK"], default = 0, overlay = false) As Integer
if port = invalid
if m.port = invalid
port = CreateObject("roMessagePort")
else
port = m.port
end if
end if
s = CreateMessageDialog()
s.SetTitle(title)
s.SetText(text)
s.SetMessagePort(port)
s.EnableOverlay(overlay)
for b = 0 to buttons.Count()-1
s.AddButton(b, buttons[b])
next
s.SetFocusedMenuItem(default)
s.Show()
result = 99 'nothing pressed
while true
msg = wait(0, port)
if msg.isScreenClosed()
exit while
else if msg.isButtonPressed()
msg = s.wait(port)
if msg.isButtonPressed()
result = msg.GetIndex()
exit while
else if msg.isScreenClosed()
exit while
end if
end while
End Sub
return result
End Function

Function KeyboardScreen(title = "", prompt = "", text = "", button1 = "Okay", button2= "Cancel", secure = false, port = invalid) as string
m.mainScreen = CreateObject("roScreen", true, 1280, 720)
m.mainScreen.SetMessagePort(m.port)
m.mainScreen.SetAlphaEnable(true)
if port = invalid then port = CreateObject("roMessagePort")
result = ""
port = CreateObject("roMessagePort")
screen = CreateObject("roKeyboardScreen")
screen = CreateKeyBoardScreen()
screen.SetMessagePort(port)
screen.SetTitle(title)
screen.SetDisplayText(prompt)
Expand All @@ -626,22 +639,27 @@ Function KeyboardScreen(title = "", prompt = "", text = "", button1 = "Okay", bu
screen.SetSecureText(secure)
screen.Show()
while true
msg = wait(0, port)
if type(msg) = "roKeyboardScreenEvent"
if msg.isScreenClosed()
msg = screen.wait(port)
if msg.isScreenClosed()
exit while
else if msg.isButtonPressed()
if msg.GetIndex() = 1 and screen.GetText().Trim() <> "" 'Ok
result = screen.GetText()
exit while
else if msg.GetIndex() = 2 'Cancel
result = ""
exit while
else if msg.isButtonPressed()
if msg.GetIndex() = 1 and screen.GetText().Trim() <> "" 'Ok
result = screen.GetText()
exit while
else if msg.GetIndex() = 2 'Cancel
result = ""
exit while
end if
end if
end if
end while
screen.Close()
if isHD()
m.mainScreen = CreateObject("roScreen", true, 854, 480)
else
m.mainScreen = CreateObject("roScreen", true, 640, 480)
end if
m.mainScreen.SetMessagePort(m.port)
m.mainScreen.SetAlphaEnable(true)
return result
End function

Expand Down
3 changes: 3 additions & 0 deletions source/libCanvas.brs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Function CreateCanvas() as object
m.fonts.AddReplace("big", m.fonts.reg.GetDefaultFont(40 * this.scale, false, false))
m.fonts.AddReplace("huge", m.fonts.reg.GetDefaultFont(46 * this.scale, false, false))
end if
' Initialize Cache
InitCache()

this.stackId = m.stack.Count()
m.stack.Push(this)
return this
Expand Down
Loading

0 comments on commit e8c68b2

Please sign in to comment.