Shauing wrote: ↑August 25th, 2018, 10:22 am
Could it be possible to modify the Prince actions (and of guards/bosses too if posible) during the demo and recap sequences?
Practically in every recap, the prince gets killed by guards or other hazards and in the demo (that I have modified) he does some actions that are unnecessary.
The Prince's actions are stored here:
Code: Select all
demo keys:
01:E49B: WORD $0300,$1202,$0300,$0520,$0122,$0620,$0300,$000a,$0900,$0820,$0628,$0408,$0a00,$1102,$0e00,$0a02,$0200,$0520,$0122,$0120,$0700,$000a,[CLIPPED]
demo 1 keys:
01:E75B: WORD $1201,$1700,$0120,$0800,$ffff
demo 3 keys:
01:E765: WORD $0801,$1600,$0208,$0120,$0200,$ffff
demo 5 keys:
01:E771: WORD $0e00,$0c02,$0a00,$0920,$0000,$0201,$0800,$0a01,$1002,$000a,$002a,$010a,$0700,$ffff
demo 6 keys:
01:E78D: WORD $2d00,$ffff
demo 9 keys:
01:E791: WORD $0602,$1000,$0002,$0400,$0008,$0120,$0000,$0108,$0120,$0100,$0008,$0028,$0220,$0000,$0008,$0028,$0120,$0100,$0008,$0220,$ffff
demo 11 keys:
01:E7BB: WORD $0701,$0500,$0320,$0221,$1120,$0321,$1a20,$0221,$0020,$0c00,$ffff
demo 13 keys:
01:E7D1: WORD $1902,$1400,$0108,$0320,$0400,$0102,$0000,$0108,$0028,$0220,$0300,$0008,$0102,$0208,$0028,$ffff
demo 15 keys:
01:E7F1: WORD $0701,$1300,$0108,$0320,$0500,$0101,$0000,$0008,$0028,$0220,$0800,$0104,$1a00,$0701,$0400,$ffff
demo 18 keys:
01:E811: WORD $0901,$1000,$0008,$0120,$0100,$0008,$0220,$0000,$0008,$0220,$0000,$0008,$0220,$ffff
demo 20 keys:
01:E82D: WORD $4000,$ffff
The format of these tables are as following:
In each 2-byte item, the lower (first) byte stores the keys pressed, and the upper (second) byte stores the number of frames (minus 1) for which these keys are pressed.
(Remember, two-byte numbers are stored with swapped bytes, so $0300 is stored as 00 03, etc.)
The following keys are possible:
$00 = none
$01 = right
$02 = left
$04 = down
$08 = up
$20 = A ("shift")
$FF = end
You can combine multiple pressed keys by adding different numbers together. (It's actually a bitwise OR.)
For example shift+left/right for a safe step, or up+left/right for a jump.
As an example, here is the beginning of the demo level key sequence at xE49B:
00 03 = For 3+1 frames, press no keys.
02 12 = For $12+1=18+1 frames, hold left ($02). (run left)
00 03 = For 3+1 frames, press no keys again.
20 05 = For 5+1 frames, hold A ($20).
22 01 = For 1+1 frame, press left, while still holding A ($22 = $20 + $02). (step left)
20 06 = For 6+1 frames, hold A ($20).
00 03 = For 3+1 frames, press no keys.
0A 00 = For 0+1 frames, press up and left ($0A = $08 + $02). (standing jump left)
And so on.
There is this table for locating the key sequences for the recaps:
Code: Select all
end demo keys address:
01:E473: WORD $e75b,$e49b,$e765,$e49b,$e771,$e78d,$e49b,$e49b,$e791,$e49b,$e7bb,$e49b,$e7d1,$e49b,$e7f1,$e49b,$e49b,$e811,$e49b,$e82d
The table contains data for every level from 1 to 20, even for those levels that don't appear in the recap.
It seems that unused entries point to the key sequence of the demo level.
The following data are used for initializing the recap sequences:
Code: Select all
end demo direction:
01:E0FF: BYTE $ff,$00,$ff,$00,$00,$ff,$00,$00,$00,$00,$ff,$00,$00,$00,$ff,$00,$00,$ff,$00,$00
end demo room:
01:E113: BYTE $14,$00,$0d,$00,$0f,$15,$00,$00,$10,$00,$16,$00,$12,$00,$11,$00,$00,$0b,$00,$04
end demo tile:
01:E127: BYTE $0a,$00,$00,$00,$09,$15,$00,$00,$13,$00,$16,$00,$09,$00,$0a,$00,$00,$14,$00,$11
end demo HP:
01:E13B: BYTE $03,$00,$04,$00,$05,$05,$00,$00,$06,$00,$07,$00,$08,$00,$09,$00,$00,$0a,$00,$0f
end demo kid sequence:
01:E157: BYTE $02,$02,$54,$02,$54,$54,$02,$02,$54,$02,$54,$02,$54,$02,$02,$02,$54,$54,$02,$01
These tables tell where does the prince start on each level in the recaps.
Again, the tables contain data for every level from 1 to 20, even for those levels that don't appear in the recap.
Recaps are activated by the code at x1AF64..x1AFDB.
For each recap there is data in this format:
Code: Select all
03:AF64: a9 01 LDA #$01
03:AF66: 20 0d b0 JSR $b00d ; load level A-1 for memory scenes
03:AF69: a2 80 LDX #$80
03:AF6B: a0 a0 LDY #$a0
03:AF6D: 20 27 b0 JSR $b027 ; frame circle
That is: A9 LL 20 0D B0 A2 XX A0 YY 20 SS SS
Where:
LL is the level number.
At the end of the recap, a shape will appear.
XX and YY are the X and Y coordinates (in pixels) of the center of the shape (after it stops moving).
The origin of the coordinate system is in the top left corner. X increases rightwards, Y increases downwards.
SS SS determines which shape will appear.
The following shapes exist:
$b027 = circle
$b0a2 = square
$b166 = diamond
$b23f = hexagon
$b24d = hexagon (without fade out) -- This is used for the last recap, because it has its own, slower fade out.
If anything is unclear, just ask.