From 866292eb0f4eea0c9e4de5b7a2359eef0341b163 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Wed, 1 Jun 2022 09:08:22 -0700 Subject: [PATCH] Starting to be able to apply Nox attributes to new char --- Platform/Apple/virtual/src/plasma/diskops.pla | 20 +++++++++---- Platform/Apple/virtual/src/plasma/diskops.plh | 1 + Platform/Apple/virtual/src/plasma/import.pla | 29 ++++++++++++++++++- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Platform/Apple/virtual/src/plasma/diskops.pla b/Platform/Apple/virtual/src/plasma/diskops.pla index f266b136..23b15c5c 100644 --- a/Platform/Apple/virtual/src/plasma/diskops.pla +++ b/Platform/Apple/virtual/src/plasma/diskops.pla @@ -37,8 +37,9 @@ predef newOrLoadGame(ask)#1 predef pressAnyKey()#1 predef gameExists()#1 predef loadInternal()#1 +predef newGame(pImportFunc)#1 //AUTOMAP_CHECK// predef checkAutomap()#1 -word[] funcTbl = @startup, @loadGame, @newOrLoadGame, @pressAnyKey, @gameExists, @loadInternal +word[] funcTbl = @startup, @loadGame, @newOrLoadGame, @pressAnyKey, @gameExists, @loadInternal, @newGame //AUTOMAP_CHECK// word = @_checkAutomap word pImportModule @@ -561,10 +562,9 @@ def clearDiskMarks()#0 end /////////////////////////////////////////////////////////////////////////////////////////////////// -def newGame()#0 +def newGame(pImportFunc)#1 word playersModule, newGameModule, partyModule clearDiskMarks() - initHeap(0) // initially empty heap global->b_curAvatar = BASE_AVATAR global=>w_combatPauseCt = DEFAULT_COMBAT_PAUSE_CT global->b_hour = 12 // start at high noon @@ -583,12 +583,17 @@ def newGame()#0 setWindow2() newGameModule()() clearWindow() - getCharacterName() - getCharacterGender() + if pImportFunc + pImportFunc() + else + getCharacterName() + getCharacterGender() + fin if global=>p_players->b_skillPoints partyModule()=>party_showPlayerSheet(0) fin heapCollect() + return 0 end /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -669,6 +674,9 @@ def newOrLoadGame(ask)#1 ^$23 = 24 // Full text window until we're done displayMenu(existing) + // Import functions need a working heap, initially empty + initHeap(0) + ret = -1 while ret < 0 @@ -678,7 +686,7 @@ def newOrLoadGame(ask)#1 is 'N' clearWindow rawDisplayStr("\n^YStarting new game...^N") - newGame() + newGame(NULL) ret = 1 break is 'L' diff --git a/Platform/Apple/virtual/src/plasma/diskops.plh b/Platform/Apple/virtual/src/plasma/diskops.plh index c6d7aec5..d62c176f 100644 --- a/Platform/Apple/virtual/src/plasma/diskops.plh +++ b/Platform/Apple/virtual/src/plasma/diskops.plh @@ -15,4 +15,5 @@ const diskops_newOrLoadGame = 4 const diskops_pressAnyKey = 6 const diskops_gameExists = 8 const diskops_loadInternal = 10 +const diskops_newGame = 12 //AUTOMAP_CHECK// const diskops_checkAutomap = 8 diff --git a/Platform/Apple/virtual/src/plasma/import.pla b/Platform/Apple/virtual/src/plasma/import.pla index 40fb25b3..1ddd56bc 100644 --- a/Platform/Apple/virtual/src/plasma/import.pla +++ b/Platform/Apple/virtual/src/plasma/import.pla @@ -25,6 +25,8 @@ byte[] legendos_filename = "LEGENDOS.SYSTEM" word origChksum_0, origChksum_1 word curChksum_0, curChksum_1 +word noxName + byte[] S_NOX_FILENAME = "DATA.SAVE.GAME1" /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -223,10 +225,18 @@ def printNox()#0 len++ loop ^$200 = len - printf1("name=%s\n", $200) + noxName=mmgr(HEAP_INTERN, $200) + printf1("name=%s\n", noxName) rdkey end +/////////////////////////////////////////////////////////////////////////////////////////////////// +def noxMod()#1 + displayStr("Noxmod") + rdkey + return 0 +end + /////////////////////////////////////////////////////////////////////////////////////////////////// def importNox()#1 @@ -250,6 +260,23 @@ def importNox()#1 printNox ^$c050 + + // Make sure the user wants to import this game + while True + textHome() + ^$25 = 19 + printf1("\nNox Archaist character imported:\n ==> %s <==\n", noxName) + puts("Re-insert disk 1 and press a key,\nor hit [Esc] to cancel import.") + if rdkey == $9B // esc + // To cancel, we need the original disk back in the drive + if reinserted; return FALSE; fin + else + if reinserted(); break; fin + fin + loop + + ^$c052 // all graphics now + pDiskOps=>diskops_newGame(@noxMod) return TRUE end