Nox import now working. Only todo is skills mapping

This commit is contained in:
Martin Haye 2022-06-23 10:28:14 -07:00
parent cdbbb8fae9
commit 73211ae242
4 changed files with 89 additions and 17 deletions

View File

@ -2024,7 +2024,7 @@ openPartition: !zone
ora floppyDrive ; $80 for drive 2
sta tmp
clc
!if DEBUG { jsr dbgrwts } else { jsr callProRWTS }
!if DEBUG >= 2 { jsr dbgrwts } else { jsr callProRWTS }
; jsr callProRWTS ; opendir
bne .flip ; status: zero=ok, 1=err
sta curMarkPos+1 ; by opening we did an implicit seek to zero
@ -2187,7 +2187,7 @@ disk_queueLoad: !zone
readAndAdj:
sta tmp ; store cmd num
sec ; calling rdwrpart (not opendir)
!if DEBUG { jsr dbgrwts } else { jsr callProRWTS }
!if DEBUG >= 2 { jsr dbgrwts } else { jsr callProRWTS }
; jsr callProRWTS ; and seek or read on the underlying file
; Advance our record of the mark position by the specified # of bytes.
; reqLen is still intact, because ProRWTS changes its copy in aux zp only
@ -2202,7 +2202,7 @@ readAndAdj:
inc curMarkPos+2
+ rts
!if DEBUG {
!if DEBUG >= 2 {
dbgrwts:
+prStr : !text $8d," rwts c/a=",0
bcs +
@ -2298,7 +2298,7 @@ disk_finishLoad: !zone
beq + ; not aux, skip
inc isAuxCmd ; set aux flag
+ sty .ysave ; Save Y so we can resume scanning later.
!if DEBUG >= 1 { jsr .debug1 }
!if DEBUG >= 2 { jsr .debug1 }
jsr disk_seek ; move the file pointer to the current block
ldy .ysave
lda (pTmp),y ; grab resource length on disk
@ -2321,7 +2321,7 @@ disk_finishLoad: !zone
ldy tSegAdrHi,x ; hi byte too
sta pDst ; and save it for later
sty pDst+1
!if DEBUG >= 1 { jsr .debug2 }
!if DEBUG >= 2 { jsr .debug2 }
plp ; retrieve isCompressed flag
bmi .readAndDecomp ; if so, go do read/decompress thing
lda #cmdread ; else, just read.
@ -2384,7 +2384,7 @@ disk_finishLoad: !zone
; Now read the raw (compressed) data
lda #cmdread
jsr readAndAdj
!if DEBUG >= 1 { jsr .debug3 }
!if DEBUG >= 2 { jsr .debug3 }
; Stuff was read to into pDst. Now that becomes the source. Decompressor is set up
; to decompress *from* our pDst to our pSrc. Its labels are swapped.
ldx isAuxCmd
@ -2405,7 +2405,7 @@ disk_finishLoad: !zone
.ysave: !byte 0
.nFixups: !byte 0
!if DEBUG >= 1 {
!if DEBUG >= 2 {
.debug1:+prStr : !text "Ld t=",0
pha
lda resType

View File

@ -700,10 +700,13 @@ def newOrLoadGame(ask)#1
break
is 'I'
clearWindow
if pImportModule()=>import_getGame(@funcTbl)
ret = 0
else
ret = pImportModule()=>import_getGame(@funcTbl)
if ret == 0
displayMenu(existing)
elsif ret == 1
ret = 0 // imported LL, which is like Loading a game
else
ret = 1 // imported Nox, which is like a New game
fin
break
is 'R'

View File

@ -12,6 +12,7 @@ include "gamelib.plh"
include "globalDefs.plh"
include "playtype.plh"
include "diskops.plh"
include "gen_modules.plh"
const NOX_LEN = $80 // max size of the data block we care about
@ -217,9 +218,76 @@ def printNox()#0
rdkey
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Stats should be converted like nox 8-20 = 5 LL / 21-60 = 6 / 61+ =7
def calcAttrBonus(noxOffset)#1
word val
val = ^(noxData+noxOffset)
if val <= 20
return 1
elsif val <= 60
return 2
fin
return 3
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Levels : 1-2= 2 /3-5 =3/5-8=4/9+=5
def calcLevelBonus(noxOffset)#1
word val
val = ^(noxData+noxOffset)
if val <= 2
return 1
elsif val <= 5
return 2
elsif val <= 8
return 3
fin
return 4
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def noxMod()#1
global=>p_players=>s_name = parseNoxName()
word pl
byte intBonus, strBonus, dexBonus, lvlBonus, skpBonus, i
word hpBonus, healthBefore
pl = global=>p_players
pl=>s_name = parseNoxName()
displayf1("Nox import bonuses:\n\n", pl=>s_name)
lvlBonus = calcLevelBonus(1)
intBonus = calcAttrBonus($12)
strBonus = calcAttrBonus($10)
dexBonus = calcAttrBonus($11)
skpBonus = 0
for i = 1 to lvlBonus
skpBonus = skpBonus + callGlobalFunc(GS_LEVEL_S_P, i+1, 0, 0)
next
hpBonus = lvlBonus * 12
displayf1("+%d Level\n", lvlBonus)
displayf1("+%d Intelligence\n", intBonus)
displayf1("+%d Strength\n", strBonus)
displayf1("+%d Agility\n", dexBonus)
displayf1("+%d Stamina\n", lvlBonus)
displayf1("+%d Skill points\n", skpBonus)
displayf1("+%d Health\n", lvlBonus*12)
displayStr("\nApply these bonuses?")
if getYN
healthBefore = pl=>w_maxHealth
for i = 1 to lvlBonus
pl->b_stamina++
setStat(pl, @S_XP, pl=>w_nextXP)
next
pl->b_strength = pl->b_strength + strBonus
pl->b_intelligence = pl->b_intelligence + intBonus
pl->b_agility = pl->b_agility + dexBonus
pl=>w_maxHealth = healthBefore + hpBonus
pl=>w_health = pl=>w_maxHealth
fin
return 0
end
@ -325,6 +393,7 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Load and display the title screen, set up everything in memory
def _getGame(_pDiskOps)#1
byte ret
pDiskOps = _pDiskOps
// May want to use graphic font someday, but mixed-text mode for now
@ -348,13 +417,13 @@ def _getGame(_pDiskOps)#1
rdkey
loop
^$c052 // no text
return FALSE
return 0
fin
if importNox; break; fin
if importLL; break; fin
if importNox; ret = 2; break; fin // like a New game
if importLL; ret = 1; break; fin // like a Load game
loop
^$c052 // no text
return TRUE
return ret
end
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -222,10 +222,10 @@ def showSkills(player)#0
nSkills = 0
if canBumpSkills
x1 = 10
x2 = STAT_X - 30
x2 = STAT_X - 35
else
x1 = 0
x2 = STAT_X - 40
x2 = STAT_X - 45
fin
showColumnTitle(25, "SKILLS", 0, 0)
if player->b_aiming; displaySkill(x1, @S_AIMING, @player->b_aiming, TRUE); fin