mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-10-05 19:54:38 +00:00
Oversized window for buy and sell.
This commit is contained in:
parent
3611b8ebb5
commit
142f50a695
@ -2578,7 +2578,7 @@ end
|
|||||||
|
|
||||||
def outCodeToFuncTbl(prefix, codeToFunc, out)
|
def outCodeToFuncTbl(prefix, codeToFunc, out)
|
||||||
{
|
{
|
||||||
codeToFunc.sort().each { code, funcs ->
|
codeToFunc.sort { ent -> ent.key.toLowerCase() }.each { code, funcs ->
|
||||||
funcs.eachWithIndex { func, index ->
|
funcs.eachWithIndex { func, index ->
|
||||||
out.println(
|
out.println(
|
||||||
"${index==0 ? "word[] $prefix${humanNameToSymbol(code, false)} = " : "word = "}@$func")
|
"${index==0 ? "word[] $prefix${humanNameToSymbol(code, false)} = " : "word = "}@$func")
|
||||||
|
@ -51,7 +51,8 @@
|
|||||||
|
|
||||||
DEBUG = 0 ; 1=some logging, 2=lots of logging
|
DEBUG = 0 ; 1=some logging, 2=lots of logging
|
||||||
|
|
||||||
T1_Val = $D ;zero page Temporary variables
|
pTmp = $4 ;zero page Temporary variables
|
||||||
|
T1_Val = $D
|
||||||
T1_vLo = $E
|
T1_vLo = $E
|
||||||
T1_vHi = $F
|
T1_vHi = $F
|
||||||
zTmp1 = $10
|
zTmp1 = $10
|
||||||
@ -108,6 +109,12 @@ RestCursor JMP RsCurs
|
|||||||
;left arrow or delete key to backspace.
|
;left arrow or delete key to backspace.
|
||||||
GetStr JMP In_Str
|
GetStr JMP In_Str
|
||||||
|
|
||||||
|
;Get the address of a line on the screen
|
||||||
|
GetScreenLine JMP GetScLn
|
||||||
|
|
||||||
|
;Advance to next line on the screen
|
||||||
|
NextScreenLine JMP NxtScLn
|
||||||
|
|
||||||
;If you know which of the {0..110} bitmapped characters
|
;If you know which of the {0..110} bitmapped characters
|
||||||
;you want plotted, you can bypass testing for control
|
;you want plotted, you can bypass testing for control
|
||||||
;codes, making this a faster way to plot.
|
;codes, making this a faster way to plot.
|
||||||
@ -1716,6 +1723,38 @@ Wp_rCmb STX Wp_Dig2 ;save digit
|
|||||||
STA CharRate ;store the rate parameter
|
STA CharRate ;store the rate parameter
|
||||||
JMP Wpr_Clr
|
JMP Wpr_Clr
|
||||||
|
|
||||||
|
; Get pointer to screen line A into A=lo/Y=hi (and to pTmp)
|
||||||
|
GetScLn TAX
|
||||||
|
LDA HgrTbHi,X
|
||||||
|
STA pTmp+1
|
||||||
|
TAY
|
||||||
|
LDA HgrTbLo,X
|
||||||
|
STA pTmp
|
||||||
|
RTS
|
||||||
|
|
||||||
|
; Fun code to advance pTmp to the next hi-res line. Destroys A and Y
|
||||||
|
NxtScLn LDY pTmp+1
|
||||||
|
INY
|
||||||
|
INY
|
||||||
|
INY
|
||||||
|
INY
|
||||||
|
CPY #$40
|
||||||
|
BCC .ok2
|
||||||
|
TYA
|
||||||
|
SBC #$20 ; carry already set
|
||||||
|
TAY
|
||||||
|
LDA pTmp
|
||||||
|
EOR #$80
|
||||||
|
BMI .ok
|
||||||
|
INY
|
||||||
|
CPY #$24
|
||||||
|
BCC .ok
|
||||||
|
LDY #$20
|
||||||
|
ADC #$27 ; carry was set, so actually adding $28
|
||||||
|
.ok STA pTmp
|
||||||
|
.ok2 STY pTmp+1
|
||||||
|
RTS
|
||||||
|
|
||||||
HgrTbHi !byte $20,$24,$28,$2C,$30,$34,$38,$3C
|
HgrTbHi !byte $20,$24,$28,$2C,$30,$34,$38,$3C
|
||||||
!byte $20,$24,$28,$2C,$30,$34,$38,$3C
|
!byte $20,$24,$28,$2C,$30,$34,$38,$3C
|
||||||
!byte $21,$25,$29,$2D,$31,$35,$39,$3D
|
!byte $21,$25,$29,$2D,$31,$35,$39,$3D
|
||||||
|
@ -24,4 +24,6 @@ DisplayStr = DisplayChar+3
|
|||||||
CalcWidth = DisplayStr+3
|
CalcWidth = DisplayStr+3
|
||||||
SaveCursor = CalcWidth+3
|
SaveCursor = CalcWidth+3
|
||||||
RestCursor = SaveCursor+3
|
RestCursor = SaveCursor+3
|
||||||
GetStr = RestCursor+3
|
GetStr = RestCursor+3
|
||||||
|
GetScreenLine = GetStr+3
|
||||||
|
NextScreenLine = GetScreenLine+3
|
@ -30,7 +30,7 @@ import gamelib
|
|||||||
predef addPlayerToParty, removePlayerFromParty, partyHasPlayer, loadFrameImg, loadMainFrameImg
|
predef addPlayerToParty, removePlayerFromParty, partyHasPlayer, loadFrameImg, loadMainFrameImg
|
||||||
predef scriptSwapTile, setIntimateMode, fontCmd, setIntimateMode
|
predef scriptSwapTile, setIntimateMode, fontCmd, setIntimateMode
|
||||||
predef callGlobalFunc, getCharResponse, memcpy, checkEncounter, finalWin, addUnique
|
predef callGlobalFunc, getCharResponse, memcpy, checkEncounter, finalWin, addUnique
|
||||||
predef benchPlayer, unbenchPlayer, buyFromStore, sellToStore
|
predef benchPlayer, unbenchPlayer, buyFromStore, sellToStore, setOversizeWindow, convertDec
|
||||||
|
|
||||||
// This pointer is the root of all heap-tracked (and garbage collected) objects.
|
// This pointer is the root of all heap-tracked (and garbage collected) objects.
|
||||||
// See playtype.plh for definitions of all the datastructures and how they interconnect.
|
// See playtype.plh for definitions of all the datastructures and how they interconnect.
|
||||||
|
@ -268,6 +268,39 @@ export asm memcpy // params: pSrc, pDst, len. Non-overlapping only!
|
|||||||
rts
|
rts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
export asm memset // params: pDst, val, len.
|
||||||
|
+asmPlasm 3
|
||||||
|
ldy #0
|
||||||
|
lda evalStkL+2,x ; dest ptr
|
||||||
|
sta pTmp
|
||||||
|
lda evalStkH+2,x
|
||||||
|
sta pTmp+1
|
||||||
|
lda evalStkL+1,x ; value
|
||||||
|
sta tmp
|
||||||
|
lda evalStkL,x ; len lo
|
||||||
|
pha
|
||||||
|
lda evalStkH,x ; len hi
|
||||||
|
tax
|
||||||
|
beq +
|
||||||
|
lda tmp
|
||||||
|
- sta (pTmp),y
|
||||||
|
iny
|
||||||
|
bne -
|
||||||
|
inc pTmp+1
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
+ pla
|
||||||
|
beq +
|
||||||
|
tax
|
||||||
|
lda tmp
|
||||||
|
- sta (pTmp),y
|
||||||
|
iny
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
+ rts
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
asm readAuxByte // params: ptr; ret: char
|
asm readAuxByte // params: ptr; ret: char
|
||||||
+asmPlasm 1
|
+asmPlasm 1
|
||||||
@ -487,47 +520,48 @@ asm blit // params: srcData, dstScreenPtr, nLines, lineSize
|
|||||||
lda #$60
|
lda #$60
|
||||||
sta $1D
|
sta $1D
|
||||||
|
|
||||||
; Outer copy loop
|
|
||||||
pla ; line count
|
pla ; line count
|
||||||
tax
|
tax
|
||||||
.loop
|
- ldy ysav ; byte count minus 1. There are 18 bytes per line
|
||||||
ldy ysav ; byte count minus 1. There are 18 bytes per line
|
|
||||||
dey
|
dey
|
||||||
jsr $10 ; copy pixel bytes
|
jsr $10 ; copy pixel bytes
|
||||||
|
lda tmp ; advance to next row of data
|
||||||
; Advance to next row of data
|
|
||||||
lda tmp
|
|
||||||
clc
|
clc
|
||||||
adc ysav
|
adc ysav
|
||||||
sta tmp
|
sta tmp
|
||||||
bcc +
|
bcc +
|
||||||
inc tmp+1
|
inc tmp+1
|
||||||
+ ; Fun code to advance to the next hi-res line
|
+ jsr NextScreenLine ; and next screen line
|
||||||
ldy pTmp+1
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
cpy #$40
|
|
||||||
bcc .ok2
|
|
||||||
tya
|
|
||||||
sbc #$20 ; carry already set
|
|
||||||
tay
|
|
||||||
lda pTmp
|
|
||||||
eor #$80
|
|
||||||
bmi .ok
|
|
||||||
iny
|
|
||||||
cpy #$24
|
|
||||||
bcc .ok
|
|
||||||
ldy #$20
|
|
||||||
adc #$27 ; carry was set, so actually adding $28
|
|
||||||
.ok
|
|
||||||
sta pTmp
|
|
||||||
.ok2
|
|
||||||
sty pTmp+1
|
|
||||||
; Loop until we've done all rows.
|
|
||||||
dex
|
dex
|
||||||
bne .loop
|
bne - ; Loop until we've done all rows.
|
||||||
|
rts
|
||||||
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
asm vline // params: dstScreenPtr, val, nLines
|
||||||
|
+asmPlasm 3
|
||||||
|
|
||||||
|
; Save number of lines
|
||||||
|
pha
|
||||||
|
|
||||||
|
; Save value
|
||||||
|
lda evalStkL+1,x
|
||||||
|
sta tmp
|
||||||
|
|
||||||
|
; Save the dest pointer
|
||||||
|
lda evalStkL+2,x
|
||||||
|
sta pTmp
|
||||||
|
lda evalStkH+2,x
|
||||||
|
sta pTmp+1
|
||||||
|
|
||||||
|
pla ; line count
|
||||||
|
tax
|
||||||
|
- ldy #0
|
||||||
|
lda tmp
|
||||||
|
sta (pTmp),y
|
||||||
|
jsr NextScreenLine
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
rts
|
rts
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -816,6 +850,13 @@ export asm calcWidth
|
|||||||
jmp CalcWidth
|
jmp CalcWidth
|
||||||
end
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Get the address of the given hi-res screen line
|
||||||
|
export asm getScreenLine
|
||||||
|
+asmPlasm_bank2 1
|
||||||
|
jmp GetScreenLine
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Display a string using the font engine but not its parser.
|
// Display a string using the font engine but not its parser.
|
||||||
// Params: pStr
|
// Params: pStr
|
||||||
@ -969,7 +1010,7 @@ end
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Convert signed decimal to string in decimalBuf (@decimalBuf returned)
|
// Convert signed decimal to string in decimalBuf (@decimalBuf returned)
|
||||||
def convertDec(n)
|
export def convertDec(n)
|
||||||
word n0
|
word n0
|
||||||
word p
|
word p
|
||||||
p = @decimalBuf + 1
|
p = @decimalBuf + 1
|
||||||
@ -1257,6 +1298,32 @@ export def getMapWindow(width, height)
|
|||||||
fin
|
fin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
def hline(addr, startByte, midByte, midSize, endByte)
|
||||||
|
^addr = startByte
|
||||||
|
memset(addr+1, midByte, midSize)
|
||||||
|
^(addr+midSize+1) = endByte
|
||||||
|
end
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Window that covers the entire inner area (destroys frame image, so be sure to loadMainFrame
|
||||||
|
// afterwards)
|
||||||
|
export def setOversizeWindow()
|
||||||
|
hline(getScreenLine(5)+1, 0, 0, 36, 0)
|
||||||
|
hline(getScreenLine(6)+1, $F8, $FF, 36, $8F)
|
||||||
|
hline(getScreenLine(7)+1, $FC, $FF, 36, $9F)
|
||||||
|
hline(getScreenLine(8)+1, $8C, 0, 36, $98)
|
||||||
|
vline(getScreenLine(9)+1, $8C, 174)
|
||||||
|
vline(getScreenLine(9)+38, $98, 174)
|
||||||
|
hline(getScreenLine(182)+1, $8C, 0, 36, $98)
|
||||||
|
hline(getScreenLine(183)+1, $FC, $FF, 36, $9F)
|
||||||
|
hline(getScreenLine(184)+1, $F8, $FF, 36, $8F)
|
||||||
|
hline(getScreenLine(185)+1, 0, 0, 36, 0)
|
||||||
|
setWindow(10, 183, 14, 267) // Top, Bottom, Left, Right
|
||||||
|
clearWindow()
|
||||||
|
frameLoaded = 0
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
export def fontCmd(code, coord)
|
export def fontCmd(code, coord)
|
||||||
tabBuf[0] = 4 // length
|
tabBuf[0] = 4 // length
|
||||||
@ -1391,7 +1458,6 @@ end
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
export def loadMainFrameImg()
|
export def loadMainFrameImg()
|
||||||
mmgr(START_LOAD, 1) // partition 1 is where code lives
|
|
||||||
loadFrameImg(mapIs3D+2)
|
loadFrameImg(mapIs3D+2)
|
||||||
if curFullscreenImg
|
if curFullscreenImg
|
||||||
auxMmgr(FREE_MEMORY, curFullscreenImg)
|
auxMmgr(FREE_MEMORY, curFullscreenImg)
|
||||||
@ -1835,13 +1901,13 @@ def showAnimFrame()
|
|||||||
if curPortrait
|
if curPortrait
|
||||||
// Blit portrait to the appropriate area on the screen
|
// Blit portrait to the appropriate area on the screen
|
||||||
if frameLoaded == 3 // 3D-mode frame? Note: don't check mapIs3D, because we might be in an engine
|
if frameLoaded == 3 // 3D-mode frame? Note: don't check mapIs3D, because we might be in an engine
|
||||||
blit(curPortrait + 2, $2182, 128, 18) // start at 3rd text line
|
blit(curPortrait + 2, getScreenLine(24)+2, 128, 18) // start at 3rd text line
|
||||||
else
|
else
|
||||||
blit(curPortrait + 2, $2202, 128, 18) // start at 4th text line
|
blit(curPortrait + 2, getScreenLine(32)+2, 128, 18) // start at 4th text line
|
||||||
fin
|
fin
|
||||||
needRender = FALSE // suppress display of map for this frame
|
needRender = FALSE // suppress display of map for this frame
|
||||||
elsif curFullscreenImg
|
elsif curFullscreenImg
|
||||||
blit(curFullscreenImg + 2, $2000, 192, 40) // the +2 is to skip anim hdr offset
|
blit(curFullscreenImg + 2, getScreenLine(0), 192, 40) // the +2 is to skip anim hdr offset
|
||||||
needRender = FALSE // suppress display of map for this frame
|
needRender = FALSE // suppress display of map for this frame
|
||||||
elsif mapIs3D
|
elsif mapIs3D
|
||||||
if textDrawn and mapIs3D and texturesLoaded; copyWindow(); fin
|
if textDrawn and mapIs3D and texturesLoaded; copyWindow(); fin
|
||||||
@ -2020,6 +2086,7 @@ def returnFromEngine()
|
|||||||
if curEngine
|
if curEngine
|
||||||
mmgr(FREE_MEMORY, curEngine)
|
mmgr(FREE_MEMORY, curEngine)
|
||||||
curEngine = NULL
|
curEngine = NULL
|
||||||
|
loadMainFrameImg()
|
||||||
clearPortrait()
|
clearPortrait()
|
||||||
if renderLoaded; texControl(1); fin
|
if renderLoaded; texControl(1); fin
|
||||||
mapNameHash = 0; showMapName(global=>s_mapName)
|
mapNameHash = 0; showMapName(global=>s_mapName)
|
||||||
@ -2285,6 +2352,25 @@ def loadTitle()
|
|||||||
|
|
||||||
puts("Loading game.\n")
|
puts("Loading game.\n")
|
||||||
|
|
||||||
|
// Allocate and permanently lock mem for the font engine and its font (up in LC ram)
|
||||||
|
mmgr(START_LOAD, 1) // partition 1 is where code lives
|
||||||
|
mmgr(SET_MEM_TARGET, fontEngine)
|
||||||
|
mmgr(REQUEST_MEMORY, fontEngineLen)
|
||||||
|
mmgr(LOCK_MEMORY, fontEngine)
|
||||||
|
|
||||||
|
mmgr(SET_MEM_TARGET, fontData)
|
||||||
|
mmgr(REQUEST_MEMORY, fontDataLen)
|
||||||
|
mmgr(LOCK_MEMORY, fontData)
|
||||||
|
|
||||||
|
// Load them into lo mem
|
||||||
|
pEngine = mmgr(QUEUE_LOAD, CODE_FONT_ENGINE<<8 | RES_TYPE_CODE)
|
||||||
|
pFont = mmgr(QUEUE_LOAD, 1<<8 | RES_TYPE_FONT)
|
||||||
|
mmgr(FINISH_LOAD, 0)
|
||||||
|
|
||||||
|
// Relocate font engine and font data to their final spots up in the language card
|
||||||
|
memcpy(pEngine, fontEngine, fontEngineLen)
|
||||||
|
memcpy(pFont, fontData, fontDataLen)
|
||||||
|
|
||||||
// Load the title screen and show it.
|
// Load the title screen and show it.
|
||||||
loadFrameImg(1) // title screen is fixed at #1
|
loadFrameImg(1) // title screen is fixed at #1
|
||||||
^$C050 // graphics
|
^$C050 // graphics
|
||||||
@ -2296,19 +2382,6 @@ def loadTitle()
|
|||||||
^$C07E=0 // disable double-hi-res
|
^$C07E=0 // disable double-hi-res
|
||||||
^$C05F // disable double-hi-res
|
^$C05F // disable double-hi-res
|
||||||
|
|
||||||
// Allocate and permanently lock mem for the font engine and its font (up in LC ram)
|
|
||||||
mmgr(SET_MEM_TARGET, fontEngine)
|
|
||||||
mmgr(REQUEST_MEMORY, fontEngineLen)
|
|
||||||
mmgr(LOCK_MEMORY, fontEngine)
|
|
||||||
|
|
||||||
mmgr(SET_MEM_TARGET, fontData)
|
|
||||||
mmgr(REQUEST_MEMORY, fontDataLen)
|
|
||||||
mmgr(LOCK_MEMORY, fontData)
|
|
||||||
|
|
||||||
// Load them into lo mem
|
|
||||||
pEngine = mmgr(QUEUE_LOAD, CODE_FONT_ENGINE<<8 | RES_TYPE_CODE)
|
|
||||||
pFont = mmgr(QUEUE_LOAD, 1<<8 | RES_TYPE_FONT)
|
|
||||||
|
|
||||||
// While we're loading, let's get the expander into aux RAM.
|
// While we're loading, let's get the expander into aux RAM.
|
||||||
auxMmgr(SET_MEM_TARGET, expandVec)
|
auxMmgr(SET_MEM_TARGET, expandVec)
|
||||||
auxMmgr(QUEUE_LOAD, CODE_EXPAND<<8 | RES_TYPE_CODE)
|
auxMmgr(QUEUE_LOAD, CODE_EXPAND<<8 | RES_TYPE_CODE)
|
||||||
@ -2319,10 +2392,6 @@ def loadTitle()
|
|||||||
|
|
||||||
mmgr(FINISH_LOAD, 0)
|
mmgr(FINISH_LOAD, 0)
|
||||||
|
|
||||||
// Relocate font engine and font data to their final spots up in the language card
|
|
||||||
memcpy(pEngine, fontEngine, fontEngineLen)
|
|
||||||
memcpy(pFont, fontData, fontDataLen)
|
|
||||||
|
|
||||||
// Tell the font engine where to find its font
|
// Tell the font engine where to find its font
|
||||||
setFont(fontData)
|
setFont(fontData)
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ include "globalDefs.plh"
|
|||||||
include "gen_modules.plh"
|
include "gen_modules.plh"
|
||||||
include "gen_items.plh"
|
include "gen_items.plh"
|
||||||
|
|
||||||
const NUM_COLUMN = 14
|
const PAGE_SIZE = 19
|
||||||
const PRICE_COLUMN = 125
|
|
||||||
|
|
||||||
// Exported functions go here. First a predef for each one, then a table with function pointers
|
// 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 header.
|
// in the same order as the constants are defined in the header.
|
||||||
@ -27,6 +26,8 @@ const MAX_PAGE_ITEMS = 20 // should be plenty
|
|||||||
word pageItems[MAX_PAGE_ITEMS]
|
word pageItems[MAX_PAGE_ITEMS]
|
||||||
word pagePrices[MAX_PAGE_ITEMS]
|
word pagePrices[MAX_PAGE_ITEMS]
|
||||||
|
|
||||||
|
byte selStrBuf[2]
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Definitions used by assembly code
|
// Definitions used by assembly code
|
||||||
asm _defs
|
asm _defs
|
||||||
@ -111,51 +112,32 @@ def unloadItems()
|
|||||||
mmgr(FREE_MEMORY, pItemsModule)
|
mmgr(FREE_MEMORY, pItemsModule)
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
def calcPageSize()
|
|
||||||
word hMap, vMap
|
|
||||||
getMapWindow(@hMap, @vMap)
|
|
||||||
printf1("vMap=%d\n", vMap)
|
|
||||||
return vMap / 9 // nine scanlines per character line
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def displayBuyTitle()
|
def displayBuyTitle()
|
||||||
rawDisplayStr("^L")
|
rawDisplayStr("^T108Buying\n\n")
|
||||||
rightJustifyStr("#", NUM_COLUMN)
|
rawDisplayStr("^LSel^T025Price^T060Item^L")
|
||||||
rawDisplayStr(".^L ^LItem")
|
|
||||||
rightJustifyStr("Price", PRICE_COLUMN)
|
|
||||||
rawDisplayStr("^L")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def displayBuyLine(num, name, price)
|
def displayBuyLine(num, name, price)
|
||||||
|
word buf
|
||||||
rawDisplayStr("\n")
|
rawDisplayStr("\n")
|
||||||
rightJustifyNum(num, NUM_COLUMN)
|
^(@buf) = 1
|
||||||
rawDisplayStr(". ")
|
^(@buf + 1) = num + 'A'
|
||||||
|
rawDisplayStr(@buf)
|
||||||
|
rawDisplayStr(".^T025")
|
||||||
|
rawDisplayStr(convertDec(price))
|
||||||
|
rawDisplayStr("^T060")
|
||||||
rawDisplayStr(name)
|
rawDisplayStr(name)
|
||||||
rightJustifyNum(price, PRICE_COLUMN)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def _buyFromStore(storeCode, markupRatio)
|
def displayBuyPage(pItemFunc, markupRatio)
|
||||||
word pItemTbl, pItemFunc, pageNum, itemNum, pageSize
|
byte itemNum
|
||||||
|
|
||||||
clearWindow()
|
|
||||||
showMapName("Buy items")
|
|
||||||
|
|
||||||
setMapWindow()
|
|
||||||
clearWindow()
|
|
||||||
|
|
||||||
loadItems()
|
|
||||||
pItemTbl = pItemsModule()=>items_forStoreCode(storeCode)
|
|
||||||
pageSize = calcPageSize()
|
|
||||||
|
|
||||||
pItemFunc = pItemTbl
|
|
||||||
|
|
||||||
itemNum = 0
|
itemNum = 0
|
||||||
displayBuyTitle()
|
displayBuyTitle()
|
||||||
while itemNum < pageSize-1 // 1 for the title line
|
mmgr(HEAP_COLLECT, 0)
|
||||||
|
while itemNum < PAGE_SIZE-5
|
||||||
pageItems[itemNum] = (*pItemFunc)()
|
pageItems[itemNum] = (*pItemFunc)()
|
||||||
pagePrices[itemNum] = max(1, pageItems[itemNum]=>w_price + calcMarkup(pageItems[itemNum]=>w_price, markupRatio))
|
pagePrices[itemNum] = max(1, pageItems[itemNum]=>w_price + calcMarkup(pageItems[itemNum]=>w_price, markupRatio))
|
||||||
if pageItems[itemNum]->t_type == TYPE_STUFF // show plural for countable stuff like ammo, pelts
|
if pageItems[itemNum]->t_type == TYPE_STUFF // show plural for countable stuff like ammo, pelts
|
||||||
@ -163,15 +145,31 @@ def _buyFromStore(storeCode, markupRatio)
|
|||||||
else
|
else
|
||||||
setPlural(FALSE)
|
setPlural(FALSE)
|
||||||
fin
|
fin
|
||||||
displayBuyLine(itemNum+1, pageItems[itemNum]=>s_name, pagePrices[itemNum])
|
displayBuyLine(itemNum, pageItems[itemNum]=>s_name, pagePrices[itemNum])
|
||||||
itemNum++
|
itemNum++
|
||||||
pItemFunc = pItemFunc + 2
|
pItemFunc = pItemFunc + 2
|
||||||
if !*pItemFunc; break; fin
|
if !*pItemFunc; break; fin
|
||||||
loop
|
loop
|
||||||
|
return itemNum
|
||||||
|
end
|
||||||
|
|
||||||
setWindow2()
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
rawDisplayStr("Select item to buy.\n")
|
def _buyFromStore(storeCode, markupRatio)
|
||||||
getUpperKey()
|
word pItemTbl, topItem, choice
|
||||||
|
|
||||||
|
setOversizeWindow()
|
||||||
|
clearWindow()
|
||||||
|
|
||||||
|
loadItems()
|
||||||
|
pItemTbl = pItemsModule()=>items_forStoreCode(storeCode)
|
||||||
|
topItem = pItemTbl
|
||||||
|
|
||||||
|
while TRUE
|
||||||
|
displayBuyPage(topItem, markupRatio)
|
||||||
|
rawDisplayStr("\n\nSelect item, Return for next pg, Esc to leave")
|
||||||
|
choice = readStr()
|
||||||
|
break
|
||||||
|
loop
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user