mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
hotfix: ComputerCraft term.blit
Former-commit-id: d1aa5e39ad8c5c871f09f737a061a456791203b1 Former-commit-id: 863ab15a947055c3a8be27051a81363a7c63ef88
This commit is contained in:
@@ -87,7 +87,7 @@ end
|
||||
|
||||
|
||||
local function normaliseCCcol(cccol)
|
||||
if cccol >= 0x1 and cccol <= 0x8FFF then
|
||||
if cccol >= 0x1 and cccol <= 0xFFFF then
|
||||
return intLog2(cccol)
|
||||
else
|
||||
error("invalid CC Colors: "..cccol)
|
||||
@@ -110,9 +110,9 @@ local function cHexToInt(c)
|
||||
if c >= 48 and c <= 57 then
|
||||
return c - 48
|
||||
elseif c >= 65 and c <= 70 then
|
||||
return c - 65
|
||||
return c - 65 + 10
|
||||
elseif c >= 97 and c <= 102 then
|
||||
return c - 97
|
||||
return c - 97 + 10
|
||||
else
|
||||
return 0
|
||||
end
|
||||
@@ -120,9 +120,9 @@ local function cHexToInt(c)
|
||||
if c:byte(1) >= 48 and c:byte(1) <= 57 then
|
||||
return c:byte(1) - 48
|
||||
elseif c:byte(1) >= 65 and c:byte(1) <= 70 then
|
||||
return c:byte(1) - 65
|
||||
return c:byte(1) - 65 + 10
|
||||
elseif c:byte(1) >= 97 and c:byte(1) <= 102 then
|
||||
return c:byte(1) - 97
|
||||
return c:byte(1) - 97 + 10
|
||||
else
|
||||
--error("unrepresentable: " .. c)
|
||||
-- return black, as defined in http://www.computercraft.info/wiki/Term.blit
|
||||
@@ -144,8 +144,8 @@ term.blit = function(text, foreCol, backCol)
|
||||
end
|
||||
|
||||
for i = 1, #text do
|
||||
term.setForeCol(cHexToInt(foreCol:byte(i)))
|
||||
term.setBackCol(cHexToInt(backCol:byte(i)))
|
||||
term.setForeCol(ccToGameCol[1 + cHexToInt(foreCol:byte(i))])
|
||||
term.setBackCol(ccToGameCol[1 + cHexToInt(backCol:byte(i))])
|
||||
term.emit(text:byte(i))
|
||||
term.moveCursor(term.getX() + 1, term.getY())
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ _COMPUTER.DC2 = string.char(18) -- white
|
||||
_COMPUTER.DC3 = string.char(19) -- dim grey
|
||||
_COMPUTER.DC4 = string.char(20) -- light grey
|
||||
_COMPUTER.prompt = function()
|
||||
io.write(_COMPUTER.DC3 .. "> " .. _COMPUTER.DC4)
|
||||
io.write(_COMPUTER.DC3.."> ".._COMPUTER.DC4)
|
||||
end
|
||||
_COMPUTER.verbose = true -- print debug info
|
||||
_COMPUTER.loadedCLayer = {} -- list of loaded compatibility layers
|
||||
@@ -28,12 +28,14 @@ require("ROMLIB")
|
||||
|
||||
-- load bios, if any
|
||||
if fs.exists(_COMPUTER.bootloader) then shell.run(_COMPUTER.bootloader) end
|
||||
-- halt/run luaprompt upon the termination of bios.
|
||||
-- Valid BIOS should load OS and modify 'shell.status' to 'shell.halt' before terminated.
|
||||
if shell.status == shell.halt then
|
||||
__haltsystemexplicit__()
|
||||
else
|
||||
-- load Lua prompt, if bios is not found
|
||||
if (#_COMPUTER.OEM > 0) then print(_COMPUTER.OEM) end
|
||||
print("Rom basic " .. _COMPUTER.DC2 .. _VERSION .. _COMPUTER.DC4)
|
||||
-- print(_COMPUTER.DC2 .. freemem .. _COMPUTER.DC4 .. " bytes free"
|
||||
print("Rom basic ".._COMPUTER.DC2.._VERSION.._COMPUTER.DC4)
|
||||
-- print(_COMPUTER.DC2..freemem.._COMPUTER.DC4.." bytes free"
|
||||
print("Ok")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user