mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-09-29 11:55:21 +00:00
More work on quest log locations.
This commit is contained in:
parent
e1bc8de7f6
commit
a208b5b4a0
@ -3251,7 +3251,8 @@ class A2PackPartitions
|
||||
def map1Num = 0, map1X = 0, map1Y = 0
|
||||
if (map1Name) {
|
||||
assert mapNames.containsKey(map1Name) : "unrecognized map '$map1Name'"
|
||||
map1Num = mapNames[map1Name][1]
|
||||
assert mapNames[map1Name][0] =~ /^[23]D$/
|
||||
map1Num = mapNames[map1Name][1] | (mapNames[map1Name][0] == "3D" ? 0x80 : 0)
|
||||
map1X = row.@"Map1-X".toInteger()
|
||||
map1Y = row.@"Map1-Y".toInteger()
|
||||
}
|
||||
@ -3260,7 +3261,8 @@ class A2PackPartitions
|
||||
def map2Num = 0, map2X = 0, map2Y = 0
|
||||
if (map2Name) {
|
||||
assert mapNames.containsKey(map2Name) : "unrecognized map '$map2Name'"
|
||||
map2Num = mapNames[map2Name][1]
|
||||
assert mapNames[map2Name][0] =~ /^[23]D$/
|
||||
map2Num = mapNames[map2Name][1] | (mapNames[map2Name][0] == "3D" ? 0x80 : 0)
|
||||
map2X = row.@"Map2-X".toInteger()
|
||||
map2Y = row.@"Map2-Y".toInteger()
|
||||
}
|
||||
|
232
Platform/Apple/virtual/src/plasma/questlog.pla
Normal file
232
Platform/Apple/virtual/src/plasma/questlog.pla
Normal file
@ -0,0 +1,232 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
include "gamelib.plh"
|
||||
include "globalDefs.plh"
|
||||
include "playtype.plh"
|
||||
include "gen_images.plh"
|
||||
include "gen_items.plh"
|
||||
include "gen_enemies.plh"
|
||||
include "gen_modules.plh"
|
||||
include "combat.plh"
|
||||
|
||||
predef _showQuests()#1
|
||||
word[] funcTbl = @_showQuests
|
||||
|
||||
word pQuestsModule
|
||||
|
||||
byte nUnstarted, nActive, nDone
|
||||
byte nTriggeredSteps, lastTriggered, nSteps
|
||||
byte displayMode, curQuestNum
|
||||
word curQuestFunc, curStepFunc
|
||||
byte questMapNum[2]
|
||||
word questMapX[2]
|
||||
word questMapY[2]
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def loadExtraModules()#0
|
||||
mmgr(START_LOAD, 1) // code is in partition 1
|
||||
pQuestsModule = mmgr(QUEUE_LOAD, MOD_GEN_QUESTS<<8 | RES_TYPE_MODULE)
|
||||
mmgr(FINISH_LOAD, 0)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def unloadExtraModules()#0
|
||||
mmgr(FREE_MEMORY, pQuestsModule)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
def displayQuest_cb3(descrip, portraitNum, map1Num, map1X, map1Y, map2Num, map2X, map2Y)
|
||||
setPortrait(portraitNum)
|
||||
displayStr(descrip)
|
||||
questMapNum[0] = map1Num; questMapX[0] = map1X; questMapY[0] = map1Y
|
||||
questMapNum[1] = map2Num; questMapX[1] = map2X; questMapY[1] = map2Y
|
||||
return 0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
def displayQuest_cb2(stepNum, questName, triggerFlag, triggerItem, stepFunc)#1
|
||||
if stepNum == 0
|
||||
displayf1("Quest: %s\n\n", questName)
|
||||
fin
|
||||
if displayMode == 'A'
|
||||
nSteps++
|
||||
if triggerFlag
|
||||
if getGameFlag(triggerFlag); nTriggeredSteps++; fin
|
||||
elsif triggerItem
|
||||
if partyHasItem(triggerItem); nTriggeredSteps++; fin
|
||||
fin
|
||||
if nTriggeredSteps == nSteps
|
||||
curStepFunc = stepFunc
|
||||
fin
|
||||
fin
|
||||
return 0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def displayCurQuest()#0
|
||||
byte ct
|
||||
|
||||
questMapNum[0] = 0
|
||||
questMapNum[1] = 0
|
||||
|
||||
clearPortrait; useMapWindow; clearWindow
|
||||
setWindow2; clearWindow
|
||||
rawDisplayStr("^I^Y")
|
||||
if displayMode == 'A'
|
||||
rawDisplayStr("Active")
|
||||
ct = nActive
|
||||
else
|
||||
rawDisplayStr("Done")
|
||||
ct = nDone
|
||||
fin
|
||||
if !ct
|
||||
rawDisplayStr(" quests^N\n\nNone.")
|
||||
return
|
||||
fin
|
||||
rawDisplayf2(" %d of %d^N\n\n", curQuestNum+1, ct)
|
||||
|
||||
if !curQuestFunc; return; fin
|
||||
|
||||
nTriggeredSteps = 0
|
||||
nSteps = 0
|
||||
curQuestFunc(@displayQuest_cb2)
|
||||
if curStepFunc
|
||||
curStepFunc(@displayQuest_cb3)
|
||||
fin
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
def countQuests_cb2(stepNum, name, triggerFlag, triggerItem, stepFunc)#1
|
||||
lastTriggered = FALSE
|
||||
if triggerFlag
|
||||
if getGameFlag(triggerFlag); nTriggeredSteps++; lastTriggered = TRUE; fin
|
||||
elsif triggerItem
|
||||
if partyHasItem(triggerItem); nTriggeredSteps++; lastTriggered = TRUE; fin
|
||||
fin
|
||||
return 0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
def countQuests_cb1(questNum, questFunc)#1
|
||||
nTriggeredSteps = 0
|
||||
lastTriggered = FALSE
|
||||
questFunc(@countQuests_cb2)
|
||||
if lastTriggered
|
||||
if displayMode == 'D' and nDone == curQuestNum
|
||||
curQuestFunc = questFunc
|
||||
fin
|
||||
nDone++
|
||||
elsif nTriggeredSteps
|
||||
if displayMode == 'A' and nActive == curQuestNum
|
||||
curQuestFunc = questFunc
|
||||
fin
|
||||
nActive++
|
||||
else
|
||||
nUnstarted++
|
||||
fin
|
||||
return 0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
def countQuests()#0
|
||||
nUnstarted = 0
|
||||
nActive = 0
|
||||
nDone = 0
|
||||
curQuestFunc = NULL
|
||||
pQuestsModule()(@countQuests_cb1)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def showMenu()#0
|
||||
byte ct
|
||||
setWindow3
|
||||
clearWindow
|
||||
if questMapNum[0] or questMapNum[1]; displayStr("S)how on map,\n"); fin
|
||||
ct = displayMode=='A' ?? nActive :: nDone
|
||||
if curQuestNum+1 < ct; displayStr("N)ext, "); fin
|
||||
if curQuestNum; displayStr("P)rev, "); fin
|
||||
if curQuestNum+1 < ct or curQuestNum; displayStr("\n"); fin
|
||||
displayStr("T)oggle active/done,\n[Esc] to exit")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _showQuests()#1
|
||||
byte sel, resetup, redisplay
|
||||
|
||||
resetup = TRUE
|
||||
while TRUE
|
||||
if resetup
|
||||
// Setup
|
||||
showMapName("Quest Log")
|
||||
setWindow2; clearWindow
|
||||
setWindow3; clearWindow
|
||||
useMapWindow; clearWindow
|
||||
loadExtraModules
|
||||
|
||||
displayMode = 'A'
|
||||
curQuestNum = 0
|
||||
|
||||
// Main work
|
||||
redisplay = TRUE
|
||||
resetup = FALSE
|
||||
fin
|
||||
if redisplay
|
||||
countQuests // also sets current quest
|
||||
displayCurQuest
|
||||
showMenu
|
||||
redisplay = FALSE
|
||||
fin
|
||||
sel = getUpperKey
|
||||
when sel
|
||||
is 'S'
|
||||
// Show on map
|
||||
if questMapNum[0] or questMapNum[1]
|
||||
showOnMap; redisplay = TRUE
|
||||
else
|
||||
beep
|
||||
fin
|
||||
is 'N'
|
||||
// Next quest
|
||||
if displayMode == 'A' and curQuestNum+1 < nActive
|
||||
curQuestNum++; redisplay = TRUE
|
||||
elsif displayMode == 'D' and curQuestNum+1 < nDone
|
||||
curQuestNum++; redisplay = TRUE
|
||||
else
|
||||
beep
|
||||
fin
|
||||
break
|
||||
is 'P'
|
||||
// Prev quest
|
||||
if curQuestNum
|
||||
curQuestNum--; redisplay = TRUE
|
||||
else
|
||||
beep
|
||||
fin
|
||||
break
|
||||
is 'T'
|
||||
// Toggle active/done
|
||||
displayMode = displayMode=='D' ?? 'A' :: 'D'
|
||||
redisplay = TRUE
|
||||
break
|
||||
is $1B // Esc
|
||||
setWindow2; clearWindow
|
||||
unloadExtraModules
|
||||
return 0
|
||||
wend
|
||||
loop
|
||||
return 0
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// initialization code
|
||||
|
||||
return @funcTbl
|
||||
done
|
11
Platform/Apple/virtual/src/plasma/questlog.plh
Normal file
11
Platform/Apple/virtual/src/plasma/questlog.plh
Normal file
@ -0,0 +1,11 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2018 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const questlog_showQuests = 0
|
Loading…
Reference in New Issue
Block a user