mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-30 13:29:36 +00:00
Add godmode setting.
This commit is contained in:
parent
25901b9f01
commit
0e4b8ca8f8
|
@ -1312,8 +1312,8 @@ end
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Send an event to the script
|
// Send an event to the script
|
||||||
export def scriptEvent(event, param)
|
export def scriptEvent(event, param)
|
||||||
if global=>w_mapScript
|
if global=>p_mapScript
|
||||||
return global=>w_mapScript(event, param)
|
return global=>p_mapScript(event, param)
|
||||||
fin
|
fin
|
||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
@ -1327,7 +1327,7 @@ def checkScripts(x, y)
|
||||||
byte anyTriggered
|
byte anyTriggered
|
||||||
|
|
||||||
scriptEvent(EVENT_LEAVE, 0)
|
scriptEvent(EVENT_LEAVE, 0)
|
||||||
global=>w_mapScript = 0
|
global=>p_mapScript = 0
|
||||||
anyTriggered = FALSE
|
anyTriggered = FALSE
|
||||||
x = x - triggerOriginX
|
x = x - triggerOriginX
|
||||||
y = y - triggerOriginY
|
y = y - triggerOriginY
|
||||||
|
@ -1550,54 +1550,6 @@ def setMap(is3D, num, x, y, dir)
|
||||||
//NO:checkScripts()
|
//NO:checkScripts()
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
def kbdTeleport()
|
|
||||||
byte d3, num
|
|
||||||
word x, y
|
|
||||||
byte dir
|
|
||||||
|
|
||||||
flipToPage1()
|
|
||||||
^$c053
|
|
||||||
if ^$25 < 23; ^$25 = 23; fin
|
|
||||||
getPos(@x, @y)
|
|
||||||
dir = getDir()
|
|
||||||
printf3("\nCurrent: X=%d Y=%d Facing=%d\n", x, y, dir)
|
|
||||||
|
|
||||||
printf1("3D [%d]: ", mapIs3D)
|
|
||||||
d3 = parseDecWithDefault(readStr(), mapIs3D)
|
|
||||||
if d3 > 1; d3 = 1; fin
|
|
||||||
printf1("Map [%d]: ", mapNum)
|
|
||||||
num = parseDecWithDefault(readStr(), mapNum)
|
|
||||||
printf1("X [%d] : ", x)
|
|
||||||
x = parseDecWithDefault(readStr(), x)
|
|
||||||
printf1("Y [%d] : ", y)
|
|
||||||
y = parseDecWithDefault(readStr(), y)
|
|
||||||
printf1("Facing [%d]: ", dir)
|
|
||||||
dir = parseDecWithDefault(readStr(), dir)
|
|
||||||
|
|
||||||
^$c052
|
|
||||||
|
|
||||||
setMap(d3, num, x, y, dir)
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
def showPos()
|
|
||||||
word x, y
|
|
||||||
byte dir
|
|
||||||
|
|
||||||
flipToPage1()
|
|
||||||
^$c053
|
|
||||||
if ^$25 < 23; ^$25 = 23; fin
|
|
||||||
getPos(@x, @y)
|
|
||||||
printf2("\nX=%d Y=%d ", x, y)
|
|
||||||
if mapIs3D
|
|
||||||
printf3("Facing=%d Sky=%d Ground=%d", getDir(), skyNum, groundNum)
|
|
||||||
fin
|
|
||||||
puts("\nHit any key.\n")
|
|
||||||
getUpperKey()
|
|
||||||
^$c052
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
export def queue_setMap(is3D, num, x, y, dir)
|
export def queue_setMap(is3D, num, x, y, dir)
|
||||||
q_mapIs3D = is3D
|
q_mapIs3D = is3D
|
||||||
|
@ -1837,23 +1789,6 @@ export def setPortrait(portraitNum)
|
||||||
needRender = FALSE
|
needRender = FALSE
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Test out portrait drawing
|
|
||||||
def nextPortrait()
|
|
||||||
portraitNum = portraitNum + 1
|
|
||||||
printf1("Portrait #%d\n", portraitNum)
|
|
||||||
setPortrait(portraitNum)
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Test out portrait drawing
|
|
||||||
def prevPortrait()
|
|
||||||
if portraitNum > 1
|
|
||||||
portraitNum = portraitNum - 1
|
|
||||||
fin
|
|
||||||
setPortrait(portraitNum)
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
export def countList(p)
|
export def countList(p)
|
||||||
byte n
|
byte n
|
||||||
|
@ -2080,13 +2015,6 @@ def checkEncounter(x, y, force)
|
||||||
fin
|
fin
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
def testCombat
|
|
||||||
word x, y
|
|
||||||
getPos(@x, @y)
|
|
||||||
checkEncounter(x, y, TRUE)
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
def saveGame
|
def saveGame
|
||||||
loadEngine(MODULE_DISKOPS)=>diskops_saveGame()
|
loadEngine(MODULE_DISKOPS)=>diskops_saveGame()
|
||||||
|
@ -2112,7 +2040,83 @@ def help
|
||||||
scriptDisplayStr("Help not available.\n")
|
scriptDisplayStr("Help not available.\n")
|
||||||
fin
|
fin
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Godmode cheats
|
||||||
|
def kbdTeleport()
|
||||||
|
byte d3, num
|
||||||
|
word x, y
|
||||||
|
byte dir
|
||||||
|
|
||||||
|
flipToPage1()
|
||||||
|
^$c053
|
||||||
|
if ^$25 < 23; ^$25 = 23; fin
|
||||||
|
getPos(@x, @y)
|
||||||
|
dir = getDir()
|
||||||
|
printf3("\nCurrent: X=%d Y=%d Facing=%d\n", x, y, dir)
|
||||||
|
|
||||||
|
printf1("3D [%d]: ", mapIs3D)
|
||||||
|
d3 = parseDecWithDefault(readStr(), mapIs3D)
|
||||||
|
if d3 > 1; d3 = 1; fin
|
||||||
|
printf1("Map [%d]: ", mapNum)
|
||||||
|
num = parseDecWithDefault(readStr(), mapNum)
|
||||||
|
printf1("X [%d] : ", x)
|
||||||
|
x = parseDecWithDefault(readStr(), x)
|
||||||
|
printf1("Y [%d] : ", y)
|
||||||
|
y = parseDecWithDefault(readStr(), y)
|
||||||
|
printf1("Facing [%d]: ", dir)
|
||||||
|
dir = parseDecWithDefault(readStr(), dir)
|
||||||
|
|
||||||
|
^$c052
|
||||||
|
|
||||||
|
setMap(d3, num, x, y, dir)
|
||||||
|
end
|
||||||
|
def showPos()
|
||||||
|
word x, y
|
||||||
|
byte dir
|
||||||
|
|
||||||
|
flipToPage1()
|
||||||
|
^$c053
|
||||||
|
if ^$25 < 23; ^$25 = 23; fin
|
||||||
|
getPos(@x, @y)
|
||||||
|
printf2("\nX=%d Y=%d ", x, y)
|
||||||
|
if mapIs3D
|
||||||
|
printf3("Facing=%d Sky=%d Ground=%d", getDir(), skyNum, groundNum)
|
||||||
|
fin
|
||||||
|
puts("\nHit any key.\n")
|
||||||
|
getUpperKey()
|
||||||
|
^$c052
|
||||||
|
end
|
||||||
|
def nextPortrait()
|
||||||
|
portraitNum = portraitNum + 1
|
||||||
|
printf1("Portrait #%d\n", portraitNum)
|
||||||
|
setPortrait(portraitNum)
|
||||||
|
end
|
||||||
|
def prevPortrait()
|
||||||
|
if portraitNum > 1
|
||||||
|
portraitNum = portraitNum - 1
|
||||||
|
fin
|
||||||
|
setPortrait(portraitNum)
|
||||||
|
end
|
||||||
|
def testCombat
|
||||||
|
word x, y
|
||||||
|
getPos(@x, @y)
|
||||||
|
checkEncounter(x, y, TRUE)
|
||||||
|
end
|
||||||
|
def enableGodMode()
|
||||||
|
if ^$C061 >= 128 and ^$C062 >= 128
|
||||||
|
global->b_godmode = 1
|
||||||
|
// install cheat commands
|
||||||
|
cmdTbl['T'] = @kbdTeleport
|
||||||
|
cmdTbl['P'] = @showPos
|
||||||
|
cmdTbl['>'] = @nextPortrait
|
||||||
|
cmdTbl['<'] = @prevPortrait
|
||||||
|
cmdTbl['!'] = @testCombat
|
||||||
|
cmdTbl['Y'] = @nextSky
|
||||||
|
cmdTbl['G'] = @nextGround
|
||||||
|
beep; beep // A little audio feedback
|
||||||
|
fin
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Set up the command table for 3D mode
|
// Set up the command table for 3D mode
|
||||||
|
@ -2125,17 +2129,13 @@ def initCmds()
|
||||||
next
|
next
|
||||||
|
|
||||||
// Commands common to both 2D and 3D
|
// Commands common to both 2D and 3D
|
||||||
cmdTbl['T'] = @kbdTeleport
|
|
||||||
cmdTbl['P'] = @showPos
|
|
||||||
cmdTbl['/'] = @nextPortrait
|
|
||||||
cmdTbl['?'] = @prevPortrait
|
|
||||||
cmdTbl['!'] = @testCombat
|
|
||||||
cmdTbl['1'] = @showPlayer1
|
cmdTbl['1'] = @showPlayer1
|
||||||
cmdTbl['2'] = @showPlayer2
|
cmdTbl['2'] = @showPlayer2
|
||||||
cmdTbl['3'] = @showPlayer3
|
cmdTbl['3'] = @showPlayer3
|
||||||
cmdTbl[$13] = @saveGame // ctrl-S
|
cmdTbl[$13] = @saveGame // ctrl-S
|
||||||
cmdTbl[$0c] = @loadGame // ctrl-L
|
cmdTbl[$0c] = @loadGame // ctrl-L
|
||||||
cmdTbl['?'] = @help
|
cmdTbl['?'] = @help
|
||||||
|
cmdTbl['!'] = @enableGodMode
|
||||||
|
|
||||||
// Commands handled differently in 3D vs 2D
|
// Commands handled differently in 3D vs 2D
|
||||||
if mapIs3D
|
if mapIs3D
|
||||||
|
@ -2154,9 +2154,6 @@ def initCmds()
|
||||||
cmdTbl[','] = @moveBackward
|
cmdTbl[','] = @moveBackward
|
||||||
cmdTbl['M'] = @strafeLeft
|
cmdTbl['M'] = @strafeLeft
|
||||||
cmdTbl['.'] = @strafeRight
|
cmdTbl['.'] = @strafeRight
|
||||||
|
|
||||||
cmdTbl['Y'] = @nextSky
|
|
||||||
cmdTbl['G'] = @nextGround
|
|
||||||
else
|
else
|
||||||
cmdTbl['W'] = @moveNorth
|
cmdTbl['W'] = @moveNorth
|
||||||
cmdTbl['D'] = @moveEast
|
cmdTbl['D'] = @moveEast
|
||||||
|
|
|
@ -105,14 +105,17 @@ def showInventory(player, page, height, select)
|
||||||
word item
|
word item
|
||||||
byte s_item, n_item, n_page
|
byte s_item, n_item, n_page
|
||||||
|
|
||||||
setMapWindow()
|
|
||||||
clearWindow()
|
|
||||||
rawDisplayStr("^T040^LInventory^L\n^T018")
|
|
||||||
displayf1("Group Gold: %d", countGold())
|
|
||||||
item = player=>p_items
|
|
||||||
s_item = 0
|
s_item = 0
|
||||||
n_item = 0
|
n_item = 0
|
||||||
n_page = page * height
|
n_page = page * height
|
||||||
|
item = player=>p_items
|
||||||
|
setMapWindow()
|
||||||
|
clearWindow()
|
||||||
|
if page; rawDisplayStr("^T008<"); fin
|
||||||
|
rawDisplayStr("^T040^LInventory^L")
|
||||||
|
if countList(item) > n_page + height; rawDisplayStr("^T114>"); fin
|
||||||
|
rawDisplayStr("\n^T018")
|
||||||
|
displayf1("Group Gold: %d", countGold())
|
||||||
if page
|
if page
|
||||||
while item and n_item < n_page
|
while item and n_item < n_page
|
||||||
item = item=>p_nextObj
|
item = item=>p_nextObj
|
||||||
|
@ -311,8 +314,16 @@ def _party_doPlayerSheet(num)
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
// Other operations...
|
// Other operations...
|
||||||
is '!'; player=>w_health = player=>w_health + 10; break
|
is '&' // health cheat
|
||||||
is '$'; addGold(10); break
|
if global->b_godmode
|
||||||
|
player=>w_health = player=>w_health + 50
|
||||||
|
fin
|
||||||
|
break
|
||||||
|
is '$' // gold cheat
|
||||||
|
if global->b_godmode
|
||||||
|
addGold(500)
|
||||||
|
fin
|
||||||
|
break
|
||||||
// All done
|
// All done
|
||||||
otherwise return
|
otherwise return
|
||||||
wend
|
wend
|
||||||
|
|
|
@ -25,7 +25,7 @@ struc Global
|
||||||
word w_mapX
|
word w_mapX
|
||||||
word w_mapY
|
word w_mapY
|
||||||
byte b_mapDir
|
byte b_mapDir
|
||||||
word w_mapScript
|
word p_mapScript
|
||||||
|
|
||||||
// Shared player gold amount
|
// Shared player gold amount
|
||||||
word w_gold
|
word w_gold
|
||||||
|
@ -36,6 +36,9 @@ struc Global
|
||||||
// General flags maintained by scripts. Linked list of Modifiers.
|
// General flags maintained by scripts. Linked list of Modifiers.
|
||||||
word p_gameFlags
|
word p_gameFlags
|
||||||
byte b_curAvatar
|
byte b_curAvatar
|
||||||
|
|
||||||
|
// god mode flag
|
||||||
|
byte b_godmode
|
||||||
end
|
end
|
||||||
|
|
||||||
const PLAYER_FLAG_NPC = $01
|
const PLAYER_FLAG_NPC = $01
|
||||||
|
|
Loading…
Reference in New Issue
Block a user