Progress on story mode.

This commit is contained in:
Martin Haye 2019-01-24 08:52:02 -08:00
parent 63f40d60b5
commit 0139adca30
4 changed files with 107 additions and 14 deletions

View File

@ -2387,6 +2387,7 @@ class A2PackPartitions
compileModule("automap", "src/plasma/")
//compileModule("sndseq", "src/plasma/") // not yet
compileModule("questlog", "src/plasma/")
compileModule("story", "src/plasma/")
lastSysModule = modules.size() // used only for reporting
compileModule("gen_enemies", "src/plasma/")
compileModule("gen_enemies0", "src/plasma/")

View File

@ -56,6 +56,7 @@ include "intimate.plh"
include "godmode.plh"
include "automap.plh"
include "questlog.plh"
include "story.plh"
///////////////////////////////////////////////////////////////////////////////////////////////////
// Data structures
@ -155,6 +156,7 @@ word animPauseCt
byte showingLamp = TRUE
byte lampFrame = 0
word lampDir = 1
byte storyMode = FALSE
// Time and clock
byte prevClockColor, prevClockHour, prevClockMinute
@ -1810,6 +1812,8 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
def resetAnimPause()#0
anyAnims = TRUE // for now; might get cleared if we discover otherwise on advance
animDirCt = 1
animPauseCt = ANIM_PAUSE_MAX
showingLamp = mapIs3D and (skyNum == 0 or skyNum == 8)
lampFrame = 0
@ -1837,8 +1841,6 @@ export def loadFrameImg(img)#0
curFullscreenImg = auxMmgr(QUEUE_LOAD, img<<8 | RES_TYPE_SCREEN)
auxMmgr(FINISH_LOAD, 0)
anyAnims = TRUE // for now; might get cleared if we discover otherwise on advance
animDirCt = 1
resetAnimPause()
// And show the first frame of the screen image
@ -2281,8 +2283,6 @@ def initMap(x, y, dir)#0
fin
// Assume there might be animations until we learn otherwise
anyAnims = TRUE // for now; might get cleared if we discover otherwise on advance
animDirCt = 1
resetAnimPause
// Populate script handlers for the current square, so that leave handlers will trigger right.
@ -2769,12 +2769,16 @@ end
def showAnimFrame()#0
byte top
if curPortrait
// Blit portrait to the appropriate area on the screen
top = 32 // start at 4th text line in 2D
if frameLoaded == 3 // 3D-mode frame? Note: don't check mapIs3D, because we might be in an engine
top = 24 // start at 4th text line in 3D
if storyMode
blit(1, curPortrait + 2, getScreenLine(0)+20, 128, 18)
else
// Blit portrait to the appropriate area on the screen
top = 32 // start at 4th text line in 2D
if frameLoaded == 3 // 3D-mode frame? Note: don't check mapIs3D, because we might be in an engine
top = 24 // start at 4th text line in 3D
fin
blit(1, curPortrait + 2, getScreenLine(top)+2, 128, 18)
fin
blit(1, curPortrait + 2, getScreenLine(top)+2, 128, 18)
needRender = FALSE // suppress display of map for this frame
if showingLamp; nextLampFrame(); fin
elsif curFullscreenImg
@ -2843,8 +2847,6 @@ export def setPortrait(portraitNum)#0
curPortrait = auxMmgr(QUEUE_LOAD, portraitNum<<8 | RES_TYPE_PORTRAIT)
curPortraitNum = portraitNum
mmgr(FINISH_LOAD, 0)
anyAnims = TRUE // for now; might get cleared if we discover otherwise on advance
animDirCt = 1
resetAnimPause
// And show the first frame
@ -3653,12 +3655,27 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
export def setStoryMode(enable)#0
// TODO
// Story mode only exists on 800K or hard drive builds
if !isFloppyVer
storyMode = enable
if enable
loadEngine(MOD_STORY)
curEngine()=>story_mode(TRUE, preEnginePortraitNum)
needRender = FALSE
frameLoaded = 0 // since we just destroyed it
textDrawn = FALSE
textClearCountdown = 0
else
curEngine()=>story_mode(FALSE, 0)
preEnginePortraitNum = 0 // so we don't restore it
returnFromEngine(TRUE)
fin
fin
end
///////////////////////////////////////////////////////////////////////////////////////////////////
export def displayStory(num)#0
// TODO
export def displayStory(storyNum)#0
curEngine()=>story_display(storyNum)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -3718,6 +3735,7 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Main code.
//
isFloppyVer = FALSE // FIXME
scriptDisplayStr(@_scriptDisplayStr) // 1-time init
startGame(TRUE, TRUE) // first time init; ask whether new or load
kbdLoop()

View File

@ -0,0 +1,61 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 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"
// 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 the header.
predef _story_mode(enable, portraitNum)#1, _story_display(storyNum)#1
word[] funcTbl = @_story_mode, @_story_display
///////////////////////////////////////////////////////////////////////////////////////////////////
def setBlock1()#0
setWindow(0, 192, 7, 133)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def setBlock2()#0
setWindow(135, 192, 140, 266)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Set up (or clear) story mode
def _story_mode(enable, portraitNum)#1
if enable
setWindow(0, 192, 0, 280)
clearWindow
setPortrait(portraitNum)
setBlock1
else
// nothing yet
fin
return 0
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Display string on a blank screen, with blanking follow-up
def _story_display(storyNum)#1
displayStr("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah.")
displayStr("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah.")
setBlock2
displayStr("More story goes here. Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah, blah blabh.")
getUpperKey
return 0
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Boilerplate module initialization code
return @funcTbl
done

View File

@ -0,0 +1,13 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 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.
///////////////////////////////////////////////////////////////////////////////////////////////////
// Each module-exported function needs its own constant, 0..n
const story_mode = 0
const story_display = 2