News: 11 March 2016 - Forum Rules

Author Topic: Megaman 1 Checkpoint programming  (Read 2434 times)

Timaeus

  • Full Member
  • ***
  • Posts: 113
  • Noel <3
    • View Profile
Megaman 1 Checkpoint programming
« on: September 09, 2015, 09:39:07 pm »
 With rock and roll , I´ve finished all 10 levels in the game , now I have to fix the checkpoints , however I´m could find it how .  I already know about hexing , enemy checkpoints , seting the checkpoint and activate point in the same screen , set the scrolls and sprites , setting the checkpoint with the room order editor and the scrrol editor , this kind of thing . I also have some notes that I found in another forum and some others I found myself , which have some informations about it

 
Spoiler:
Cut stage

$153B0 ScrollPos                  Checkpoint scroll byte numbers
$153DF CheckPo1                   Table of values defining the slot number of the last enemy on the midpoint page (second checkpoint)
$1540A RoomOrderFix1Check         A table containing the first screen ID in the scroll byte selected for the checkpoint
$15422 RoomOrderFix2Check         A table containing the last screen ID in the scroll byte selected for the checkpoint?
$1C2E4 ScreenStartChk2Trig        Screen numbers which activate the checkpoint
$1C2FB RoomOrderPos               Where Mega Man respawns after dying
$1C52A BeamDown1Offset            Checkpoint y coordinates



"Checkpoint scroll byte numbers" tells the game which scroll byte to use when you start at that checkpoint. If the screen you're starting on is in the second scroll byte, you'd put 01.

The "slot number of the last enemy on the midpoint page" is calculated by just counting the sprites in the stage from the first sprite to the last sprite on the page where the checkpoint is (the first sprite in the stage is in slot 00). This tells the game how far into the sprite data to look for sprites that are 'active' when you beam in.

Everything else should be pretty self-explanatory. I think there's also something related to special objects, but it's not in my notes (but there is something about changing $150F7 to 4CF690 that might have to do with special objects)... Anyway, with this data, you should be able to get your checkpoints working just fine using a hex editor. The only thing I feel I need to add is that you must start Mega Man off at the beginning of a scroll area; if you start him off in the middle or end of a corridor, the game won't know to load any of the graphics for the prior screen, so scrolling backward will cause background graphic problems (you'd have to add a special case to the background loading routine or rewrite it entirely (depending on what you're trying to do) in order to make that work).

 About the Checkpoint scroll byte numbers thing , the first checkpoint is located in a up scrolling (like the original game) and the scrool byte is 80 (at least is what I could find) , so I put 80 , and it doesn´t work .

  I count all the sprites before the checkpoint and change the number , but the result was the same . Actually it only worked after setting the enemy checkpoints in rock and roll .

 I couldn´t find what ´´Where Mega Man respawns after dying ´´ and ´´Checkpoint y coordinates ´´ is supposet to be (in hex , is shows 00 and 94 , respective) .

 So if someone know some tips to solve those issues , please tell me

Timaeus

  • Full Member
  • ***
  • Posts: 113
  • Noel <3
    • View Profile
Re: Megaman 1 Checkpoint programming
« Reply #1 on: September 19, 2015, 04:21:06 pm »


This is the first checkpoint , showed in rock and roll . As you can see , to reach the next screen , you must go up . So is a up scrolling



Here is all the scrolls used in the level , with the checkpoint scroll circled (is writted ''up after 1'' , and disabling the simple mode shows 80 , which might be the scroll byte value)

´´Where Mega Man respawns after dying´´ apperrently doesn´t  have anything with the checkpoint , because  changing the number only affects where he spawn in the beggining of the level

The ''Checkpoint scroll byte numbers'' thing doesn´t change nothing in the checkpoint , it disabled where the level scrolls start



Here is what happens when I respawn . I PHYSICALLY appear in another screen , because as soon as I spawn , he launch himself in the wall , corrupting the scroll that should be used there (and the respawn position is NOT messed up ,  as you can see in the first image)





Here is the screen numbers in order . I don´t know if have something to do with checkpoints but here it is

I´m trying to be very specific here , because this is REALLY pissing me up  >:(


Bisqwit

  • Sr. Member
  • ****
  • Posts: 424
  • Polite, but politically incorrect.
    • View Profile
    • http://iki.fi/bisqwit/
Re: Megaman 1 Checkpoint programming
« Reply #2 on: November 18, 2015, 02:40:24 am »
Your native language probably is not English, because I have quite some difficulty in reading your posts and understanding what you mean.

But I have done a lot of work in reverse engineering Rockman. Perhaps I can help. Let’s speak of Rockman (Japanese) ROM. The Mega Man ROM is the same, but the ROM offsets are different, because of the lawyer-friendly text that they inserted in the beginning of the game for the USA release (because as you know, all USA children are future lawyers, and they need to be taught early).

Code: [Select]
StageCheckPointA ;at C2D4
        .byte $0A,$0A,$0E,$08,$07,$0A
        .byte $22,$24,$2F,$1D,$1D,$1D
StageCheckPointB
        .byte $14,$14,$14,$10,$14,$0F
        .byte $27,$29,$2F,$21,$1C
FirstScreenScreenTable ;at C2EB
; Initial screen start?
        .byte $00,$00,$00,$00,$00,$00
        .byte $18,$18,$18,$14,$18,$1E  ;Stored into ObjectPosScreen+0 or CurrentBeginScreen
; Restart point A
        .byte $0A,$0A,$0E,$08,$07,$0A
        .byte $22,$24,$2E,$1D,$1D,$1D
; Restart point B
        .byte $14,$14,$14,$10,$14,$0F
        .byte $26,$28,$2E,$21,$20

Let’s explain all of these five tables. The first table is at $C2D4.

When a stage is first loaded, 0 is stored to ObjectPosScreen (RAM $460, MegaMan’s current screen number).

When a stage is loaded (first time, or after a death), ObjectPosScreen is inspected.

* If it is less than StageCheckPointA[CurrentStage], FirstScreenScreenTable+0 is used as a table.
* If it is less than StageCheckPointB[CurrentStage], FirstScreenScreenTable+12 (RestartPointA) is used as a table.
* Else, FirstScreenScreenTable+24 (RestartPointB) is used as a table.
Additionally, LastRestartPointType (RAM $AB) records this offset (0, 12 or 24). This is used internally for some hackish purposes in some stages.

A byte is read from this table[CurrentStage]. This byte is stored into ObjectPosScreen (MegaMan’s current screen number).
It may also be stored into CurrentBeginScreen (RAM $27, which gives the screen number where you can’t scroll any more to the left).

Note that stages 6-10 do not start from screen number 0. This is because the map data for these stages is actually internally implemented as hidden sections of the first 6 stages. The first screen of stage 6 is actually screen 24 of stage 0.

Now, there are a few more tables to go through. These are in bank 5, I think, right after the "READY" text.

Code: [Select]
Label93FA:
        .byte $0A,$0A,$0E,$08,$07,$0A
        .byte $22,$1C,$1D,$14,$14,$14
        .byte $14,$14,$14,$10,$14,$0F
        .byte $26,$28,$1C,$21,$19,$14  ;Stored into CurrentBeginScreen
Label9412:
        .byte $0A,$0A,$0E,$0A,$08,$0A
        .byte $22,$24,$2E,$1D,$1D,$1D
        .byte $16,$16,$14,$12,$14,$11
        .byte $26,$28,$2E,$22,$20,$1E  ;Stored into CurrentEndScreen
The first table is actually just a duplicate of RestartPointA + RestartPointB, except for the last three stages, for a reason I can’t remember.
The second table gives the CurrentEndScreen corresponding to the current begin screen.
The values in this table should match the equivalent byte in the RestartPoint tables added by the number of screens in the stripe that Mega Man respawns in, minus 1.

Code: [Select]
;At C51A
TeleportYcoord
; Start of stage
        .byte $94,$B4,$B4,$B4,$C4,$B4
        .byte $B4,$74,$B4,$94,$84,$64
; Restart point A
        .byte $94,$C4,$B4,$94,$94,$54
        .byte $24,$64,$B4,$B4,$B4,$B4
; Restart point B
        .byte $94,$94,$94,$94,$94,$94
        .byte $B4,$94,$B4,$B4,$B4,$B4
These are the Y coordinates where Mega Man lands, when the equivalent screen is chosen from FirstScreenScreenTable and Mega Man teleports there when the stage loads.
« Last Edit: November 18, 2015, 03:07:23 am by Bisqwit »