[4.1.5] Jane Jones, Poet Detective Design Document

tornotlukin

Member
Now that I have submitted the game I want to talk about the methodology and code edits to the no scroll adventure module.

My idea was create an homage to the AGI Sierra game interpreter (the non-vga Sierra games). A character walk around and observes and interacts with the environment (if I had more time, characters too). For the demo, a character would walk around and interact with the environment. The character could also "observe" by pressing the A button. When the character interacts with important, story advancing objects, there would be a cutscene comic panel, then a return to player control.

Editing the code base is needed to get some uniqueness. At the start of the process I had zero knowledge of ASM6. Now I can follow along very basic logic. The community help is excellent and many are patient (Dale!) given the amount of asks that happen.

The primary code changes were to how text is shown, called upon, and removed from the screen. I also had much screen space set aside for text, so about half my screen was the HUD. I also had to tweak the timing of the buttons so that multiple button presses before the text finished drawing to screen, wouldn't skip parts.

[Please note that code pieces were cobbled together from research and asks to NESMaker forum coders. Hug your nearest programmer.]
 

tornotlukin

Member
NESMaker Text entries:
6a7e3977351435.5c85785035b9f.png

You are given space to input text entries. They are then organized in groups of 4, called text groups. The NPCs (monster sprites) can access the text from these groups. Four different monsters are allowed per screen so that gives 1 text entry for each of them to say stuff when interacted with. I understand there is triggered and day/night for each screen, so potentially there could 16 text entries used for one screen, albeit 4 at a time. I did not have enough time during the contest period to delve into that.

I used the NPC tile type as a basis for how the character/play interacts with the environment. To access specific entries, the tile asks for a specific entry by number in the code. This is used with some variation throughout the game.
 

tornotlukin

Member
(If I misrepresent the code, please give me a correction and I will edit what I wrote)

A1 EXPLAIN:
Putting this here will prevent repeated B button presses from prematurely clearing the text. The whole text will be drawn to screen then it can be cleared with a B press. This applies to any text that is created from any source. (a button, automatically, etc)

Code:
   ;;; Press B to check for text.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN  
   ; This set of code check to see that text is finish displaying before you can press B again
   LDA textboxHandler  
	AND #%11000000 
	BEQ +
	RTS
	+   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN END
   LDA textboxHandler
    AND #%00010000 ;; if the b button is pressed
                    ;; but the box + text have been activated
                    ;; and also the 'do box' bit is OFF
                    ;; that means this is ready to "go away".
                    
    BEQ checkToTurnTheTextboxOn ;; hasn't started yet
    
    ;; begin turning the textbox off.
    LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.
  
    LDA #$00
    STA updateNT_offset
    STA updateNT_H_offset
    STA updateNT_V_offset
    
    LDA #%10001000
    STA textboxHandler
    RTS
   
checkToTurnTheTextboxOn:  
   LDA npc_collision
    BEQ noNPCcollision
    LDA textboxHandler
    AND #%10000000
    BNE noNPCcollision
   LDA gameHandler
    ORA #%00100000
    STA gameHandler
    ;;; are we turning this on or off?
    ;;; check for more
    ;;; check for 'choice'.

turnTheTextboxOn:
  
    LDA #%10000000
    STA textboxHandler
    
noNPCcollision:
    RTS
 

tornotlukin

Member
This input script is activated with an A button, the text that appears does not freeze the movement of player sprite (the last two lines of code).

A1 Explain:
This is a check for game cutscene/story frames. I will have a link to the post that describes the cutscene method. For a later post.

A2 Explain:
This is the check to keep the A or B button from skipping text too prematurely.

A3 Explain:
These lines of code chooses which text box to show in the text box, independent of monster sprite position in screen details.

Code:
;;; USE A BUTTON == #%00100000
;;; activates the text box for "observational" text
;;; This code accesses TEXT 04
;;; does not freeze player1 sprite in place, allows for free movement
;;; B BUTTON clears text       

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN
; check to see that we are in a cutscene. cutsceneCheck == 1. Hide sprites for cutscene.
	LDA cutsceneCheck
	BNE ++	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN END

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A2 EXPLAIN
    LDA textboxHandler  
	AND #%10000000 
	BEQ +
	RTS
	+   

    LDA textboxHandler
    AND #%00100000 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A2 EXPLAIN END

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A3 EXPLAIN
	; Uncomment the TEXT BOX you want to show. TEXT BOX 1="$00", 2="$01", 3="$02", 4="$03"
	;LDA #$00
	;LDA #$01
	;LDA #$02
	LDA #$03
	STA textVar
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A3 EXPLAIN END

	;; activate the text-box, this doesnt freeze the player1 sprite in place
	LDA #%10000000
	STA textboxHandler
    
    ++
    RTS
 

tornotlukin

Member
6a7e3977351435.5c85785035b9f.png


This piece of code is place in scripts that initiates text. In an input or tile script.

The text in "Text 1" would appear in the text box when LDA #$00 is uncommented. "Text 2" for LDA #$01, "Text 3" for LDA #$02, "Text 4" for LDA #$03.

The example below shows the text in "Text 2"

Code:
	; Uncomment the TEXT BOX you want to show. TEXT BOX 1="$00", 2="$01", 3="$02", 4="$03"
	;LDA #$00
	LDA #$01
	;LDA #$02
	;LDA #$03
	STA textVar
When you uncomment one of the LDAs, the other three must be commented out.
 

tornotlukin

Member
Cutscene Setup
The cutscene is performed on a game screen. The order of operation is:
1. player sprite is warped to a position over an automatic text tile
2. the player sprite is hidden
3. text is drawn to the screen
4. button press to clear text
5. player sprite is made visible
6. player sprite warped to other game screen

First there needs to be a user variable called cutsceneCheck. Make it equal to 0.
In scripts that initiate text, use this:
Code:
LDA #$01
STA cutsceneCheck
By changing the value it tells the HandleTextBox to perform the HideSprite, ShowSprite, and warp for the cutscene. In the code snippet below

78b2d977351435.5c85b8e0605ae.png


My player sprite is 3 high, so placement was tricky for me. I had to put the autoTextBox a space under player placement. I noticed that placement originates from the top left of the sprite, so the player parts may actually intersect with spaces other than where the sprite was warped. The square space outlined in red is the tile with the automatic code.
76edcf77351435.5c85b6576f453.png


A1 Explain:
This check to see if the value of cutsceneCheck has changed. This value should of been modified outside of the HandleTextBox. If cutsceneCheck is 0, it skips the hideSprite command.

A2 Explain:
This part comes in after most of the text has been handled. If the value of cutsceneCheck is still changed it will showSprite and then revert the cutsceneCheck value back to 0. Otherwise, it skips this part and the warping part.

A3 Explain:
Continuing from the previous set of code, the player sprite will now be warped to the screen designated by the current screen details dialog box.

Code:
;;; A modifcation to the standard HandleTextBox which includes
;;; a user variable cutsceneCheck, if it is 1 it will
;;; hideSprite, show text, showSprite, then warpToScreen

HandleTextBox:

	LDA textboxHandler
	AND #%10000000
	BNE textboxIsActive
	RTS ;; textbox is inactive.
textboxIsActive:
	LDA updateNametable
	BEQ notAlreadyWritingToNT
	RTS
notAlreadyWritingToNT

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN
	; check to see that we are in a cutscene. cutsceneCheck == 1. Hide sprites for cutscene.
	LDA cutsceneCheck
	BNE +
	JMP letsContinue
	+
	HideSprites
	
	letsContinue:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A1 EXPLAIN END

THE MAJORITY OF THE HandleTextBox SCRIPT...
...	
...
...
	STA textboxHandler
	STA updateHUD_offset
	LDA gameHandler
	AND #%11011111
	STA gameHandler
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A2 EXPLAIN
	; check to see that we are in a cutscene. cutsceneCheck == 1. Show the sprites and warp to next scene
	LDA cutsceneCheck
	BNE +
	JMP dontReturnToGame
	+
	
	ShowSprites
	
	; this reverts the variable back to 0
	LDA #$00
	STA cutsceneCheck
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A2 EXPLAIN END	

	; This resets the tileCollisionFLag in a way to
	; allow for continuous cutscene frames (going from overworld map to next overworld map)
	LDA #$00
	STA tileCollisionFlag

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A3 EXPLAIN
 LDA warpMap
 sta currentMap
 clc
 ADC #$01
 STA temp
 GoToScreen warpToScreen, temp, #$02
 LDA #$00
 STA playerToSpawn
 LDX player1_object
 DeactivateCurrentObject
 LDA #$01
 STA loadObjectFlag
 
LDA mapPosX
STA newX
LDA mapPosY
STA newY
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; A3 EXPLAIN END
	
dontReturnToGame:
	RTS
			
isWritingTextboxAttributes:
	;; handle all four quadrants of the attribute.	
	RTS
	
notStoryObject:
RTS

My method was to have multiple screens setup so that the player is warped one after the other to tell a story.
 
Top Bottom