mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-02 06:41:32 +00:00
More import refactoring
This commit is contained in:
parent
89db793516
commit
accf0d42fe
|
@ -31,15 +31,16 @@ const expandMax = $3600 // max size of unsplit expander
|
|||
|
||||
// Exported functions go here. First a predef for each one, then a table with function pointers
|
||||
// in the same order as the constants are defined in the the header.
|
||||
predef _startup()#1
|
||||
predef _loadGame()#1
|
||||
predef _newOrLoadGame(ask)#1
|
||||
//AUTOMAP_CHECK// predef _checkAutomap()#1
|
||||
word[] funcTbl = @_startup, @_loadGame, @_newOrLoadGame
|
||||
predef startup()#1
|
||||
predef loadGame()#1
|
||||
predef newOrLoadGame(ask)#1
|
||||
predef pressAnyKey()#1
|
||||
predef gameExists()#1
|
||||
predef loadInternal()#1
|
||||
//AUTOMAP_CHECK// predef checkAutomap()#1
|
||||
word[] funcTbl = @startup, @loadGame, @newOrLoadGame, @pressAnyKey, @gameExists, @loadInternal
|
||||
//AUTOMAP_CHECK// word = @_checkAutomap
|
||||
|
||||
byte[] legendos_filename = "LEGENDOS.SYSTEM"
|
||||
|
||||
word pImportModule
|
||||
|
||||
// For checking automap mark sizes
|
||||
|
@ -234,7 +235,7 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load and display the title screen, set up everything in memory
|
||||
def _startup()#1
|
||||
def startup()#1
|
||||
word pEngine, pFont, pMarks, pExpand, expanderSize, pSound
|
||||
|
||||
// Decide if we're running on Jace (if so, later we'll need to credit the music). This has
|
||||
|
@ -389,7 +390,7 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TEMPORARY FOR DISK MARK CHECKING
|
||||
//AUTOMAP_CHECK// def _checkAutomap()#1
|
||||
//AUTOMAP_CHECK// def checkAutomap()#1
|
||||
//AUTOMAP_CHECK// readDiskMarks; checkMarks
|
||||
//AUTOMAP_CHECK// return 0
|
||||
//AUTOMAP_CHECK// end
|
||||
|
@ -419,7 +420,7 @@ def loadInternal()#1
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _loadGame()#1
|
||||
def loadGame()#1
|
||||
useMapWindow()
|
||||
showMapName("Loading game...")
|
||||
|
||||
|
@ -477,22 +478,10 @@ end
|
|||
//end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def pressAnyKey()#0
|
||||
def pressAnyKey()#1
|
||||
puts("\n and press any key to continue.")
|
||||
getTextKey()
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def reinsert()#0
|
||||
while TRUE
|
||||
puts(" Re-insert disk 1")
|
||||
pressAnyKey()
|
||||
if callProRWTS(RWTS_READ | RWTS_OPENDIR, @legendos_filename, LOAD_SAVE_BUF, 512) == 0
|
||||
break
|
||||
fin
|
||||
puts("\n ")
|
||||
beep()
|
||||
loop
|
||||
return 0 // dummy value for exported func
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -671,7 +660,7 @@ def displayMenu(existing)#0
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _newOrLoadGame(ask)#1
|
||||
def newOrLoadGame(ask)#1
|
||||
byte key, existing
|
||||
word ret
|
||||
|
||||
|
@ -709,7 +698,7 @@ def _newOrLoadGame(ask)#1
|
|||
break
|
||||
is 'I'
|
||||
clearWindow
|
||||
if pImportModule()=>import_getGame()
|
||||
if pImportModule()=>import_getGame(@funcTbl)
|
||||
ret = 0
|
||||
else
|
||||
displayMenu(existing)
|
||||
|
|
|
@ -12,4 +12,7 @@
|
|||
const diskops_startup = 0
|
||||
const diskops_loadGame = 2
|
||||
const diskops_newOrLoadGame = 4
|
||||
const diskops_pressAnyKey = 6
|
||||
const diskops_gameExists = 8
|
||||
const diskops_loadInternal = 10
|
||||
//AUTOMAP_CHECK// const diskops_checkAutomap = 8
|
||||
|
|
|
@ -15,9 +15,13 @@ include "diskops.plh"
|
|||
|
||||
// Exported functions go here. First a predef for each one, then a table with function pointers
|
||||
// in the same order as the constants are defined in the the header.
|
||||
predef _getGame()#1
|
||||
predef _getGame(pDiskOps)#1
|
||||
word[] funcTbl = @_getGame
|
||||
|
||||
word pDiskOps
|
||||
|
||||
byte[] legendos_filename = "LEGENDOS.SYSTEM"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Definitions used by assembly code
|
||||
asm __defs
|
||||
|
@ -44,44 +48,59 @@ asm fooFunc(param)#0
|
|||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def reinsert()#0
|
||||
while TRUE
|
||||
puts(" Re-insert disk 1")
|
||||
pDiskOps=>diskops_pressAnyKey()
|
||||
if callProRWTS(RWTS_READ | RWTS_OPENDIR, @legendos_filename, LOAD_SAVE_BUF, 512) == 0
|
||||
break
|
||||
fin
|
||||
puts("\n ")
|
||||
beep()
|
||||
loop
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Load and display the title screen, set up everything in memory
|
||||
def _getGame()#1
|
||||
def _getGame(_pDiskOps)#1
|
||||
pDiskOps = _pDiskOps
|
||||
|
||||
// See if there's a Nox game in drive 2.
|
||||
^$c051
|
||||
puts("Insert nox\n")
|
||||
rdkey()
|
||||
puts("Insert nox")
|
||||
pDiskOps=>diskops_pressAnyKey()
|
||||
if callProRWTS(RWTS_READ | RWTS_OPENDIR, "NA", LOAD_SAVE_BUF, 512) == 0
|
||||
puts("op1 ok")
|
||||
puts("First open succeeded")
|
||||
rdkey()
|
||||
if callProRWTS(RWTS_READ | RWTS_READDIR, "DATA.SAVE.GAME1", LOAD_SAVE_BUF, 512) == 0
|
||||
puts("op2 ok")
|
||||
puts("Second open succeeded")
|
||||
else
|
||||
puts("f2")
|
||||
puts("Second open failed")
|
||||
fin
|
||||
else
|
||||
puts("f1")
|
||||
puts("First open failed")
|
||||
fin
|
||||
rdkey
|
||||
^$c050
|
||||
|
||||
// Old code
|
||||
//textHome
|
||||
//^$c053
|
||||
//^$25 = 20
|
||||
//puts("\n Insert disk for import")
|
||||
//pressAnyKey()
|
||||
//if gameExists()
|
||||
// loadInternal()
|
||||
// ^$25 = 20
|
||||
// puts("\n Game imported.")
|
||||
// reinsert()
|
||||
// memcpy(HEAP_BOTTOM, LOAD_SAVE_BUF, HEAP_SIZE, 0) // LC to low mem
|
||||
// rwGame(RWTS_WRITE)
|
||||
// return TRUE
|
||||
//fin
|
||||
//puts("\n Not found.")
|
||||
//reinsert()
|
||||
textHome
|
||||
^$c053
|
||||
^$25 = 20
|
||||
puts("\n Insert disk for import")
|
||||
pDiskOps=>diskops_pressAnyKey()
|
||||
if pDiskOps=>diskops_gameExists()
|
||||
pDiskOps=>diskops_loadInternal()
|
||||
^$25 = 20
|
||||
puts("\n Game imported.")
|
||||
reinsert()
|
||||
memcpy(HEAP_BOTTOM, LOAD_SAVE_BUF, HEAP_SIZE, 0) // LC to low mem
|
||||
rwGame(RWTS_WRITE)
|
||||
return TRUE
|
||||
fin
|
||||
puts("\n Not found.")
|
||||
reinsert()
|
||||
return FALSE
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user