Shauing wrote: ↑April 28th, 2020, 11:40 am
5. Can the HP of the demo be modified? The Prince has 4 HP.
We need to change this part:
Code: Select all
3 hp: (CHECKED: level 1, demo AND training):
01:ED4A: a9 03 LDA #$03
01:ED4C: 8d 1d 05 STA $051d ; HP at beginning of level ; checkpoint max HP
At 0xED4C write: 20 F0 FD
At 0xFDF0 write: AE 79 05 E0 15 D0 02 A9 04 8D 1D 05 60
The meaning of the new code:
Code: Select all
At 0xED4C write:
20 F0 FD JSR $FDF0
At 0xFDF0 write:
AE 79 05 LDX $0579 ; current level
E0 15 CPX #$15 ; demo level
D0 02 BNE :1
A9 04 LDA #$04 ; HP on demo level
:1
8D 1D 05 STA $051D ; HP at beginning of level
60 RTS
Shauing wrote: ↑May 1st, 2020, 8:03 pm
Also I noticed that the Shadow on Level 4 doesn't stop and turn back after being released from the mirror. Can he just keep running?
EDIT: Figured this one via disassembly and guessing I should modify the Shadow moves at 01:8000.
You're right.
Here's what the bytes there mean.
The first number of each pair is the time (number of frames after the moves started), and the second number is the action.
$00,$00, -- stop
$01,$01, -- run
$05,$00, -- stop
$14,$02, -- turn around
$19,$00, -- stop
$3c,$02, -- turn around
$41,$00, -- stop
$46,$01, -- run
$ff,$fe -- end
At 0x8004 write: FF FE
This overwrites the second "stop" with an "end" (at frame 255), so the shadow will keep running until he exits the room.
Shauing wrote: ↑May 1st, 2020, 8:03 pm
This makes me wonder if in the cutscenes there is something that manipulates how long each frame of animation will play. For example, in DOS the Princess stands for 16 seconds before turning to see Jaffar. On SNES, she only stands for around two seconds. Is there something similar to this? Couldn't find it in the disassembly. This is what I have been asking by ''timing'' of each cutscene, but couldn't word it properly.
EDIT: I think I found them at 02:CC1D. I'm not sure of the coding language, but it seems that either A9 XX and A2 XX, modify the timing between one set of sprite animations and the next one. I don't know the timing measure but I think it's probably frames.
You're correct about the offset, the lengths are indeed after A9 and A2, and they are in frames.
There are actually three delays before the Princess turns around. (See the disassembly below.)
You could change the length of any of them. (At 0x14C1E, 0x14C23, 0x14C28.)
The difference between the delays is whether the animations of the characters are paused or played during the delay.
But since these three delays are before any animation, there is no difference between the two.
Code: Select all
02:CC1D: a9 04 LDA #$04 ; <-- here
02:CC1F: 20 5e cd JSR $cd5e ; play A frames from cutscene (play animations)
02:CC22: a2 08 LDX #$08 ; <-- here
02:CC24: 20 55 cd JSR $cd55 ; play X frames from cutscene (pause animations)
02:CC27: a9 05 LDA #$05 ; <-- here
02:CC29: 20 5e cd JSR $cd5e ; play A frames from cutscene (play animations)
02:CC2C: a9 62 LDA #$62 ; sequence ID: Princess turns around
02:CC2E: 20 61 c9 JSR $c961 ; shadow jump to sequence
02:CC31: a9 09 LDA #$09 ; length of turn around animation
02:CC33: 20 5e cd JSR $cd5e ; play A frames from cutscene (play animations)
Shauing wrote: ↑May 1st, 2020, 8:03 pm
Also, for some odd reason, the falling tiles do not hurt the Prince when he's running, only when he doesn't move.
Yes, there is a
special event in the DOS version to specifically make the falling floors hurt the Prince when he's running, only on level 13.
(First mentioned
in this post.)
(In SDLPoP:
https://github.com/NagyD/SDLPoP/blob/ma ... 07.c#L1209 )
The SNES version doesn't have this, here is how to add it:
At 0xDC3E write: 20 E0 FD
At 0xFDE0 write: AD 79 05 C9 0C D0 03 4C 8D DC 4C 82 DC
Here is the existing code:
Code: Select all
01:DC3E: 20 82 dc JSR $dc82 ; fell_on_your_head
fell_on_your_head:
01:DC82: ad 57 04 LDA $0457 ; Char ; Char.frame ; CharPosn
01:DC85: c9 05 CMP #$05
01:DC87: 90 04 BCC $dc8d
01:DC89: c9 0f CMP #$0f
01:DC8B: 90 4d BCC $dcda ; return
01:DC8D: ad 5d 04 LDA $045d ; Char.action
01:DC90: c9 02 CMP #$02
01:DC92: 90 04 BCC $dc98
01:DC94: c9 07 CMP #$07
01:DC96: d0 42 BNE $dcda ; return
01:DC98: ae 5c 04 LDX $045c ; Char.row ; CharBlockY
01:DC9B: e8 INX
01:DC9C: bd fe ec LDA $ecfe,X ; y_land ; FloorY
The meaning of the new code:
Code: Select all
At 0xDC3E write:
20 E0 FD JSR $FDE0
At 0xFDE0 write:
AD 79 05 LDA $0579 ; current level
C9 0C CMP #$0C ; level 13
D0 03 BNE :1
4C 8D DC JMP $DC8D ; fell_on_your_head, but skip the Char.frame checks
:1
4C 82 DC JMP $DC82 ; fell_on_your_head