News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Repointing graphics, use of Message Box v4

Started by Draconis Kenjishiya, August 26, 2015, 09:08:37 AM

Previous topic - Next topic

Draconis Kenjishiya

Having learned how to properly allocate free space, I've applied a ton of patches to my fragile skeletal romhack.

Some of these include Walljump Boots, Accel Charge, Long Beam and Plasma-Spazer, all beautifully coded by JAM. Though at first I thought there was an issue of free space, they all seem to work okay...

There is a step in this process that I don't fully understand - or, rather, begin to understand - that is kinda crucial and I don't know where to look to find out how. I need to repoint graphics so the items will appear in-game once a Chozo Ball is opened. Not sure how to do this, really...

Also, all the messages for the items now say "Beam Fusion" instead of "Long Beam", "Walljump Boots", etc. I suppose I would have to edit the message box ASM file to include all of them, or is there another step in there?

Thanks for your help.

Jordan5

The locations to draw the graphics for the new PLMs is given in the readme i believe (I did stuff with WJ boots before) so you draw them into the rom there using TLP or something similar. The fact they all say the same message is likely due to them all using the same message box index and so the last patch you applied will be the message at that location (ie all new items will say that items name when picking up). You will need to change them to separate indexes before applying the asm (if it's a patch then you're likely in trouble). I'm not too sure about message boxes, and was hoping to get someone to help me out with them at some point, so maybe someone else here can clear that up. Hope this helps :^_^:

Draconis Kenjishiya

Okay. I successfully changed the graphics of the PLMs in question (very easy once I knew what I was doing) but I don't understand Message Box v4 at all. I found the spot where Long Beam was using free space ($859643) and applied it, changed Walljump Boots' address to $8596D0 so it wouldn't overwrite Long Beam, changed Walljump's message pointer to 1E...but when I collect Walljump, it causes horrific graphics crashes.

JAM

Looks one, I am the one who must reply here. =)

First of all, I'm very glad that you used a lot of my patches. Waiting for a good hack from you. =)

For the MessageBox patch, see file SetBeamFusionMessage.asm, as it's based on Message Box v4. Accel Charge is based on v2. Every item I made have asm file that adds 1 new message. Since you're using few of them, you'll have to write new messages in a single patch.

Open SetBeamFusionMessage.asm

It already adds 1 message.


BeamFusion:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !F, !red
DB !U, !red
DB !S, !red
DB !I, !red
DB !O, !red
DB !N, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E


Since you add more of them, copy and paste BeamFusion part, like this:


BeamFusion:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !F, !red
DB !U, !red
DB !S, !red
DB !I, !red
DB !O, !red
DB !N, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

AccelCharge:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !F, !red
DB !U, !red
DB !S, !red
DB !I, !red
DB !O, !red
DB !N, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E


Now edit the letters in AccelCharge part.


BeamFusion:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !F, !red
DB !U, !red
DB !S, !red
DB !I, !red
DB !O, !red
DB !N, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

AccelCharge:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !A, !red
DB !C, !red
DB !C, !red
DB !E, !red
DB !L, !red
DB !_, !red
DB !C, !red
DB !H, !red
DB !A, !red
DB !R, !red
DB !G, !red
DB !E, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

So, Beam Fusion text will be shown when displaying message $1D and Accel Charge -- message $1E. To change message number to display, use SMILE JX. Single byte change in PLM editor.

Also, to make it work, add ", $0000" to "ButtonArray:" for every new message you'll add. Do this for other 2 items and you can apply this ASM to your hack.

Draconis Kenjishiya

#4
Oh, damn. Use one patch...that makes sense. I'm dumb.

Hm, SMILE JX won't let me save changes to the item definition array. The "Save" option is greyed out and does nothing when clicked upon.

EDIT: Also, upon adding the other messages to Message Box v4 (the letter entries for Accel Charge, Wall Jump, and Long Beam), collecting the Beam Fusion upgrade (Item Message 1D) makes it display all four entries at once. So it looks like "Beam Fusion" on top of "Accel Charge" and so on.

JAM

Quote from: Draconis Kenjishiya on August 26, 2015, 10:55:23 PM
Hm, SMILE JX won't let me save changes to the item definition array. The "Save" option is greyed out and does nothing when clicked upon.
Well, I would fix that in 2.84. Then just use hex to change the single byte for every patch.

Quote from: Draconis Kenjishiya on August 26, 2015, 10:55:23 PM
EDIT: Also, upon adding the other messages to Message Box v4 (the letter entries for Accel Charge, Wall Jump, and Long Beam), collecting the Beam Fusion upgrade (Item Message 1D) makes it display all four entries at once. So it looks like "Beam Fusion" on top of "Accel Charge" and so on.
Now I should say "I'm dumb".

(Hachi facepalms)

I forgot that you should expand instruction array too.


;J: For the small messages, use !EmptySmall for the first DW and !Small for the second one.

DW !EmptySmall, !Small, BeamFusion

;J: Don't touch this line. Meaning of it is that game can't display the last message in the array correctly, even if is a pointer is leading to unexisting message. FixSize subroutine in the Kej's code allows to use only small message box as last one (see below).
DW !EmptySmall, !Small, ButtonArray


Add lines after BeamFusion, like this:


;J: For the small messages, use !EmptySmall for the first DW and !Small for the second one.

DW !EmptySmall, !Small, BeamFusion
DW !EmptySmall, !Small, AccelCharge
...


;J: Don't touch this line. Meaning of it is that game can't display the last message in the array correctly, even if is a pointer is leading to unexisting message. FixSize subroutine in the Kej's code allows to use only small message box as last one (see below).
DW !EmptySmall, !Small, ButtonArray


What you put after "!Small," in each line should match your marks before the message itself. AccelCharge matches the mark in my previous message.

If you name the mark before LongBeam as "Long:" then, you should put "Long" after "!Small,"

That's the meaning of making marks between messages.

Draconis Kenjishiya

#6
Okay. I have followed instructions as I thought they were said, and I've got some pretty serious graphical errors. Included here is the code for the Message Box v4 file.

;K: A hack to add new message boxes. Based on an item in Insanity, stripped of spoily stuff and commented for public use.
;K: This hasn't been extensively bugtested yet, but at the moment I don't know of any bugs from it.
;J: I've tested it. Looks like, you can use big and small messages with or without highlighted buttons.
;J: Lines below are used to set letter and color numbers for using in this patch.

lorom

;Letters
!A = $E0
!B = $E1
!C = $E2
!D = $E3
!E = $E4
!F = $E5
!G = $E6
!H = $E7
!I = $E8
!J = $E9
!K = $EA
!L = $EB
!M = $EC
!N = $ED
!O = $EE
!P = $EF
!Q = $F0
!R = $F1
!S = $F2
!T = $F3
!U = $F4
!V = $F5
!W = $F6
!X = $F7
!Y = $F8
!Z = $F9

;Numbers
!n1 = $00 ;1
!n2 = $01 ;2
!n3 = $02 ;3
!n4 = $03 ;4
!n5 = $04 ;5
!n6 = $05 ;6
!n7 = $06 ;7
!n8 = $07 ;8
!n9 = $08 ;9
!n0 = $09 ;0

;Symbols
!dot = $FA ; .
!comma = $FB ; ,
!quotestart = $FC ; `
!quoteend = $FC ; '
!question = $FE ; ?
!exclamation = $FF ; !
!- = $CF ; -
!percent = $0A ; %
!_ = $4E ; empty

;Colors
!red = $28
!yellow = $3C
!green = $38
!blue = $2C

;MessageConstants
!Big = #$825A
!Small = #$8289
!EmptySmall = #$8436
!Shot = #$83C5
!Dash = #$83CC
!Jump = #$8756
!ItemCancel = #$875D
!ItemSelect = #$8764
!AimDown = #$876B
!AimUp = #$8773
!EmptyBig = #$877A




;header
;K: Uncomment this if you're using a headered ROM
;J: Hint: commented lines are starting from ";" and they aren't executed.

;lorom


;K: Somewhere in your bank 84 you should have a PLM using a message box, change the index to 1D or higher.
;K: See PLM_Details.txt for how to do that.
;J: You can create new item or use Messenger patch (see patch section) for this purpose.

; DW $88F3 : DW $0040 : DB $1D ;For example, this is the instruction used by a new item in Insanity.


org $859643

;K: Here is where you can put in new message box entries and tiles. All entries must be consecutive; do not put tiles in between entries.

;K: Example message box entries. They start at the first new slot, 1D.
;K: The first two DW's are for the message box setup and size. This is a simple, 3-high message box with 1 line of text. Other options are possible (see the table at 85869B if you want) but I haven't documented any and the code at the bottom only supports this option.
;J: Alright, I did it. The only thing I don't know is how to get 3 line text messages, such as "Energy recharge completed."

;K: Each new entry simply needs a new message box name for the last DW.
;J: For the big messages, use any of these constants, depending on button you need for the first DW: !Shot, !Dash, !Jump, !ItemCancel, !ItemSelect, !AimDown, !AimUp.
;J: To get a big message without rewriting certain tile use !EmptyBig constant.
;J: Second DW should be !Big for a big messages.

;J: For the small messages, use !EmptySmall for the first DW and !Small for the second one.

DW !EmptySmall, !Small, BeamFusion
DW !EmptySmall, !Small, AccelCharge
DW !EmptySmall, !Small, WallJump
DW !EmptySmall, !Small, LongBeam

;J: Don't touch this line. Meaning of it is that game can't display the last message in the array correctly, even if is a pointer is leading to unexisting message. FixSize subroutine in the Kej's code allows to use only small message box as last one (see below).
DW !EmptySmall, !Small, ButtonArray



;K: Small message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each small message box requires 32 words, so don't add or delete any lines, just change them.

BeamFusion:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !F, !red
DB !U, !red
DB !S, !red
DB !I, !red
DB !O, !red
DB !N, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

AccelCharge:
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !A, !red
DB !C, !red
DB !C, !red
DB !E, !red
DB !L, !red
DB !_, !red
DB !C, !red
DB !H, !red
DB !A, !red
DB !R, !red
DB !G, !red
DB !E, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

WallJump
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !W, !red
DB !A, !red
DB !L, !red
DB !L, !red
DB !_, !red
DB !J, !red
DB !U, !red
DB !M, !red
DB !P, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

LongBeam
DW $000E, $000E, $000E, $000E, $000E, $000E
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !L, !red
DB !O, !red
DB !N, !red
DB !G, !red
DB !_, !red
DB !B, !red
DB !E, !red
DB !A, !red
DB !M, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DB !_, !red
DW $000E, $000E, $000E, $000E, $000E, $000E, $000E










;J: Big message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines in each group are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each big message box requires 128 words (4 groups of 32 words), so don't add or delete any lines, just change them.





;J: Strict order like "small messages first" isn't nesessary.

;==========================================================================

;J: There is a relocated button array for big messages with text "press certain button".
;J: Meaning of this array is if you change default control settings and shot will use Y button instead of X, then in the default text (press the X button) letter X will be rewritten with Y.
;J: Actually, there are a different button written by default in each message, but this doesn't matter.

;J: Each word is a position of correct letter.
;J: When adding a new message, don't forget to add a word to this array.

;J: In short messages such as "Energy Tank" the value must be $0000.

;J: In big messages the value is the position of tile that will be rewriten.
;J: Add 2 to move the button right, substract 2 to move the button left.
;J: Add 40 to move the button down, substract 40 to move the button up.
;J: To create big message without rewriting a tile, use value $0020 and !EmptyBig constant as a first DW when defining certain message box.
;J: Note that you can overwrite empty tiles in top and border lines of each message.


ButtonArray:
DW $0000, $012A, $012A, $012C, $012C, $012C, $0000, $0000, $0000, $0000, $0000, $0000, $0120, $0000, $0000
;Messages 01-0F

DW $0000, $0000, $0000, $012A, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
;Messages 10-1D [+Beam Fusion]





;K: The rest is code to make the game use the free space above for new message boxes. No touching.
;K: If you do intend to try something tricky, please note that this code is placed at the end of the above message boxes and doesn't have its own org.
;J: FixSize subroutine is replaced. It has a limitation for using only small messages. I've tweaked it a bit, but got another limitation: last message must be small. So, I got rid of it and added a bunch of pointers to unexisting message (see above).

;J: Fix1C1F subroutine is relocated to use space previously used by button array.

org $858749
Fix1C1F:
LDA $1C1F
CMP #$001D
BPL +
RTS
+
ADC #$027F
RTS

;J: Extra code, allowing to use all buttons, not only used Run and Fire used by game for creating messages like "press A to jump" (and get correct button, of course) or short instructions of how to use Wall Jump or Space Jump techniques. You can also make a short player-freindly guide for each button and display these messages in the first few rooms, like it was done in Metroid Prime series.


;Jump
REP #30
LDA $09B4
BRA $1A
;ItemCancel
REP #30
LDA $09B8
BRA $13
;ItemSelect
REP #30
LDA $09BA
BRA $0C
;AimDown
REP #30
LDA $09BC
BRA $05
;AimUp
REP #30
LDA $09BE
JMP $83D1
;EmptyBig
REP #30
JMP $8409

org $858243
JSR Fix1C1F

org $8582E5
JSR Fix1C1F

org $858413
DW ButtonArray

;K: Kejardon
;J: JAM
;Version 4

Mettyk25jigsaw

#7
I don't know a real lot about ASM, but I have got this ASM working myself for my 2nd hack...
On the Button array near the bottom, I think you may have to place the Last 2 sets of 'DW $0000's' that you've placed down to the next line...

Also with the 1st 2 procedures of the code that you have done, I believe it was meant to work as you have it. But for me it never worked that way...Read next paragraph to find out what I did to make it work...

Up the top of the ASM are the values the words Small, Empty small,  red, _, A TO Z, all stand for...You really have to replace these with the values (all the examples I have given to you just now---[small, Empty small etc]) given, so in other words small is 8289. So where it sais small in the code, put 8289 there instead (don't change anything up the top of the ASM, just the main part of code). Do this with all examples I have given you, nothing more and nothing less...Hope this does it...Good luck...

EDIT...PS, Remember that the values you put in have to Have a '$' sign B4 the value, otherwise it won't read it properly...

JAM

#8
Mettyk25jigsaw
LOL, no. Just no. To everything you said.


Quote from: Draconis Kenjishiya on August 27, 2015, 09:18:27 PM
Okay. I have followed instructions as I thought they were said, and I've got some pretty serious graphical errors. Included here is the code for the Message Box v4 file.
Don't you forgot something? Beam Fusion and Accel Charge works just right while other 2 items -- not. I'll show you what is missing.

;K: A hack to add new message boxes. Based on an item in Insanity, stripped of spoily stuff and commented for public use.
;K: This hasn't been extensively bugtested yet, but at the moment I don't know of any bugs from it.
;J: I've tested it. Looks like, you can use big and small messages with or without highlighted buttons.
;J: Lines below are used to set letter and color numbers for using in this patch.

lorom

;Letters
!A = $E0
!B = $E1
!C = $E2
!D = $E3
!E = $E4
!F = $E5
!G = $E6
!H = $E7
!I = $E8
!J = $E9
!K = $EA
!L = $EB
!M = $EC
!N = $ED
!O = $EE
!P = $EF
!Q = $F0
!R = $F1
!S = $F2
!T = $F3
!U = $F4
!V = $F5
!W = $F6
!X = $F7
!Y = $F8
!Z = $F9

;Numbers
!n1 = $00   ;1
!n2 = $01   ;2
!n3 = $02   ;3
!n4 = $03   ;4
!n5 = $04   ;5
!n6 = $05   ;6
!n7 = $06   ;7
!n8 = $07   ;8
!n9 = $08   ;9
!n0 = $09   ;0

;Symbols
!dot = $FA   ; .
!comma = $FB   ; ,
!quotestart = $FC   ; `
!quoteend = $FC   ; '
!question = $FE   ; ?
!exclamation = $FF   ; !
!- = $CF      ; -
!percent = $0A   ; %
!_ = $4E      ; empty

;Colors
!red = $28
!yellow = $3C
!green = $38
!blue = $2C

;MessageConstants
!Big = #$825A
!Small = #$8289
!EmptySmall = #$8436
!Shot = #$83C5
!Dash = #$83CC
!Jump = #$8756
!ItemCancel = #$875D
!ItemSelect = #$8764
!AimDown = #$876B
!AimUp = #$8773
!EmptyBig = #$877A




;header   
;K: Uncomment this if you're using a headered ROM
;J: Hint: commented lines are starting from ";" and they aren't executed.

;lorom


;K: Somewhere in your bank 84 you should have a PLM using a message box, change the index to 1D or higher.
;K: See PLM_Details.txt for how to do that.
;J: You can create new item or use Messenger patch (see patch section) for this purpose.

;   DW $88F3 : DW $0040 : DB $1D   ;For example, this is the instruction used by a new item in Insanity.


org $859643

;K: Here is where you can put in new message box entries and tiles. All entries must be consecutive; do not put tiles in between entries.

;K: Example message box entries. They start at the first new slot, 1D.
;K: The first two DW's are for the message box setup and size. This is a simple, 3-high message box with 1 line of text. Other options are possible (see the table at 85869B if you want) but I haven't documented any and the code at the bottom only supports this option.
;J: Alright, I did it. The only thing I don't know is how to get 3 line text messages, such as "Energy recharge completed."

;K: Each new entry simply needs a new message box name for the last DW.
;J: For the big messages, use any of these constants, depending on button you need for the first DW: !Shot, !Dash, !Jump, !ItemCancel, !ItemSelect, !AimDown, !AimUp.
;J: To get a big message without rewriting certain tile use !EmptyBig constant.
;J: Second DW should be !Big for a big messages.

;J: For the small messages, use !EmptySmall for the first DW and !Small for the second one.

   DW !EmptySmall, !Small, BeamFusion
   DW !EmptySmall, !Small, AccelCharge
   DW !EmptySmall, !Small, WallJump
   DW !EmptySmall, !Small, LongBeam

;J: Don't touch this line. Meaning of it is that game can't display the last message in the array correctly, even if is a pointer is leading to unexisting message. FixSize subroutine in the Kej's code allows to use only small message box as last one (see below).
   DW !EmptySmall, !Small, ButtonArray



;K: Small message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each small message box requires 32 words, so don't add or delete any lines, just change them.

BeamFusion:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !B, !red
   DB !E, !red
   DB !A, !red
   DB !M, !red
   DB !_, !red
   DB !F, !red
   DB !U, !red
   DB !S, !red
   DB !I, !red
   DB !O, !red
   DB !N, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

AccelCharge:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !A, !red
   DB !C, !red
   DB !C, !red
   DB !E, !red
   DB !L, !red
   DB !_, !red
   DB !C, !red
   DB !H, !red
   DB !A, !red
   DB !R, !red
   DB !G, !red
   DB !E, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

WallJump
:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !W, !red
   DB !A, !red
   DB !L, !red
   DB !L, !red
   DB !_, !red
   DB !J, !red
   DB !U, !red
   DB !M, !red
   DB !P, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

LongBeam
:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !L, !red
   DB !O, !red
   DB !N, !red
   DB !G, !red
   DB !_, !red
   DB !B, !red
   DB !E, !red
   DB !A, !red
   DB !M, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E










;J: Big message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines in each group are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each big message box requires 128 words (4 groups of 32 words), so don't add or delete any lines, just change them.





;J: Strict order like "small messages first" isn't nesessary.

;==========================================================================

;J: There is a relocated button array for big messages with text "press certain button".
;J: Meaning of this array is if you change default control settings and shot will use Y button instead of X, then in the default text (press the X button) letter X will be rewritten with Y.
;J: Actually, there are a different button written by default in each message, but this doesn't matter.

;J: Each word is a position of correct letter.
;J: When adding a new message, don't forget to add a word to this array.

;J: In short messages such as "Energy Tank" the value must be $0000.

;J: In big messages the value is the position of tile that will be rewriten.
;J: Add 2 to move the button right, substract 2 to move the button left.
;J: Add 40 to move the button down, substract 40 to move the button up.
;J: To create big message without rewriting a tile, use value $0020 and !EmptyBig constant as a first DW when defining certain message box.
;J: Note that you can overwrite empty tiles in top and border lines of each message.


ButtonArray:
   DW $0000, $012A, $012A, $012C, $012C, $012C, $0000, $0000, $0000, $0000, $0000, $0000, $0120, $0000, $0000
;Messages 01-0F

   DW $0000, $0000, $0000, $012A, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
;Messages 10-1D [+Beam Fusion]





;K: The rest is code to make the game use the free space above for new message boxes. No touching.
;K: If you do intend to try something tricky, please note that this code is placed at the end of the above message boxes and doesn't have its own org.
;J: FixSize subroutine is replaced. It has a limitation for using only small messages. I've tweaked it a bit, but got another limitation: last message must be small. So, I got rid of it and added a bunch of pointers to unexisting message (see above).

;J: Fix1C1F subroutine is relocated to use space previously used by button array.

org $858749
Fix1C1F:
   LDA $1C1F
   CMP #$001D
   BPL +
   RTS
+
   ADC #$027F
   RTS

;J: Extra code, allowing to use all buttons, not only used Run and Fire used by game for creating messages like "press A to jump" (and get correct button, of course) or short instructions of how to use Wall Jump or Space Jump techniques. You can also make a short player-freindly guide for each button and display these messages in the first few rooms, like it was done in Metroid Prime series.


;Jump
   REP #30
   LDA $09B4
   BRA $1A
;ItemCancel
   REP #30
   LDA $09B8
   BRA $13
;ItemSelect
   REP #30
   LDA $09BA
   BRA $0C
;AimDown
   REP #30
   LDA $09BC
   BRA $05
;AimUp
   REP #30
   LDA $09BE
   JMP $83D1
;EmptyBig
   REP #30
   JMP $8409

org $858243
   JSR Fix1C1F

org $8582E5
   JSR Fix1C1F

org $858413
   DW ButtonArray

;K: Kejardon
;J: JAM
;Version 4

Mettyk25jigsaw

#9
So that's where the error is in Message box V4, you must put 'lorom' up the very top and comment the lorom further down. That's the difference I've seen as I've used it exactly the way you have it JAM but without the lorom edits and I'm fairly certain there's nowhere to tell you to do that. You should really put a fix to that JAM as some people like myself and Draconis will not know to do that, especially if there are no instructions to do so, otherwise you have to go to all the effort as I did to make it work and yes it does work doing it the way I did, but always wished I could have it work the way I knew it was suppose to work...Having said all this it's a great piece of ASM and a great idea, so don't get me wrong, I just think some people won't know to do the Lorom edits that's all.
   So Draconis, just do it the way via the lorom edits, not the hard way like I did it...Good luck...

EDIT: OK I apologise for 1 thing, I've reread Draconis last thread and the code is showing up fine now and have realised the lorom has been edited and why it wasn't working...B4 the code at least on my computer was only showing up one line at a time and was tedious to follow, however in my ASM on my computer (V4) the lorom issue does need addressing...

Draconis Kenjishiya

...oh my god, I forgot to put colons there. *headdesk*

Thanks so much. It works perfectly. This taught me a lot about how the code is structured and how it works. I am going to try to make a patch that makes it so the Shinespark doesn't work until a custom item has been collected, and then add a message to it using this system.

Again, thanks for your patience and time, JAM.

@Mettyk: It's all good. I am learning as well. Thanks anyway.

JAM

Draconis Kenjishiya
You're welcome! I glad that it finally works! Now you understand how the pointers work in the asm format. =)

Mettyk25jigsaw
This bug depends on compilator you use. For xkas v0.6 it works fine. But sometimes -- don't. That's why I put TWO lorom lines in the Message Box v4. One is commented, another one is not. If it isn't working as it should, uncomment commented lorom line and comment uncommented.

Mettyk25jigsaw

Jam, As far as I can see, there is no 'lo rom' up the top, only above the first org...And I was using Version 0.6 of Xkas, so if there is something up the top, it should have worked the easy way, Right? Just wanting to make sure, that it is me that's doing something wrong, so if it's not, you may be able to put a fix to it...Thanks JAM...

PS, I downloaded Message box V4, yesterday too, to see if I accidentally deleted the lorom originally but to no avail...(I think), unless I made a blunder of a mistake of eyesight, lol...

JAM

Mettyk25jigsaw
If we're talking about this patch, there are 2 lorom entries. I'll show you.

Quote from: JAM on August 28, 2015, 09:10:55 PM
;K: A hack to add new message boxes. Based on an item in Insanity, stripped of spoily stuff and commented for public use.
;K: This hasn't been extensively bugtested yet, but at the moment I don't know of any bugs from it.
;J: I've tested it. Looks like, you can use big and small messages with or without highlighted buttons.
;J: Lines below are used to set letter and color numbers for using in this patch.

lorom

;Letters
!A = $E0
!B = $E1
!C = $E2
!D = $E3
!E = $E4
!F = $E5
!G = $E6
!H = $E7
!I = $E8
!J = $E9
!K = $EA
!L = $EB
!M = $EC
!N = $ED
!O = $EE
!P = $EF
!Q = $F0
!R = $F1
!S = $F2
!T = $F3
!U = $F4
!V = $F5
!W = $F6
!X = $F7
!Y = $F8
!Z = $F9

;Numbers
!n1 = $00   ;1
!n2 = $01   ;2
!n3 = $02   ;3
!n4 = $03   ;4
!n5 = $04   ;5
!n6 = $05   ;6
!n7 = $06   ;7
!n8 = $07   ;8
!n9 = $08   ;9
!n0 = $09   ;0

;Symbols
!dot = $FA   ; .
!comma = $FB   ; ,
!quotestart = $FC   ; `
!quoteend = $FC   ; '
!question = $FE   ; ?
!exclamation = $FF   ; !
!- = $CF      ; -
!percent = $0A   ; %
!_ = $4E      ; empty

;Colors
!red = $28
!yellow = $3C
!green = $38
!blue = $2C

;MessageConstants
!Big = #$825A
!Small = #$8289
!EmptySmall = #$8436
!Shot = #$83C5
!Dash = #$83CC
!Jump = #$8756
!ItemCancel = #$875D
!ItemSelect = #$8764
!AimDown = #$876B
!AimUp = #$8773
!EmptyBig = #$877A




;header   
;K: Uncomment this if you're using a headered ROM
;J: Hint: commented lines are starting from ";" and they aren't executed.

;lorom


;K: Somewhere in your bank 84 you should have a PLM using a message box, change the index to 1D or higher.
;K: See PLM_Details.txt for how to do that.
;J: You can create new item or use Messenger patch (see patch section) for this purpose.

;   DW $88F3 : DW $0040 : DB $1D   ;For example, this is the instruction used by a new item in Insanity.


org $859643

;K: Here is where you can put in new message box entries and tiles. All entries must be consecutive; do not put tiles in between entries.

;K: Example message box entries. They start at the first new slot, 1D.
;K: The first two DW's are for the message box setup and size. This is a simple, 3-high message box with 1 line of text. Other options are possible (see the table at 85869B if you want) but I haven't documented any and the code at the bottom only supports this option.
;J: Alright, I did it. The only thing I don't know is how to get 3 line text messages, such as "Energy recharge completed."

;K: Each new entry simply needs a new message box name for the last DW.
;J: For the big messages, use any of these constants, depending on button you need for the first DW: !Shot, !Dash, !Jump, !ItemCancel, !ItemSelect, !AimDown, !AimUp.
;J: To get a big message without rewriting certain tile use !EmptyBig constant.
;J: Second DW should be !Big for a big messages.

;J: For the small messages, use !EmptySmall for the first DW and !Small for the second one.

   DW !EmptySmall, !Small, BeamFusion
   DW !EmptySmall, !Small, AccelCharge
   DW !EmptySmall, !Small, WallJump
   DW !EmptySmall, !Small, LongBeam

;J: Don't touch this line. Meaning of it is that game can't display the last message in the array correctly, even if is a pointer is leading to unexisting message. FixSize subroutine in the Kej's code allows to use only small message box as last one (see below).
   DW !EmptySmall, !Small, ButtonArray



;K: Small message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each small message box requires 32 words, so don't add or delete any lines, just change them.

BeamFusion:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !B, !red
   DB !E, !red
   DB !A, !red
   DB !M, !red
   DB !_, !red
   DB !F, !red
   DB !U, !red
   DB !S, !red
   DB !I, !red
   DB !O, !red
   DB !N, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

AccelCharge:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !A, !red
   DB !C, !red
   DB !C, !red
   DB !E, !red
   DB !L, !red
   DB !_, !red
   DB !C, !red
   DB !H, !red
   DB !A, !red
   DB !R, !red
   DB !G, !red
   DB !E, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

WallJump:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !W, !red
   DB !A, !red
   DB !L, !red
   DB !L, !red
   DB !_, !red
   DB !J, !red
   DB !U, !red
   DB !M, !red
   DB !P, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E

LongBeam:
   DW $000E, $000E, $000E, $000E, $000E, $000E
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !L, !red
   DB !O, !red
   DB !N, !red
   DB !G, !red
   DB !_, !red
   DB !B, !red
   DB !E, !red
   DB !A, !red
   DB !M, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DB !_, !red
   DW $000E, $000E, $000E, $000E, $000E, $000E, $000E










;J: Big message box tiles. Start with the message box name from its entry.
;K&J: The first and last lines in each group are blank tiles for past the left and right edge of the message box. These must be in every message box, and you probably don't want to change them.
;K&J: The lines starting with DB you'll prorably want to edit.
;J: In each line starting with DB there should be a letter and a color after that. Don't place 2 letters or 2 colors in one line!
;J: Change "_" symbol after sign "!" to get the letter you want.
;J: Change color after sign "!" to change color. Available colors are: red, yellow, green and blue.
;K&J: Each big message box requires 128 words (4 groups of 32 words), so don't add or delete any lines, just change them.





;J: Strict order like "small messages first" isn't nesessary.

;==========================================================================

;J: There is a relocated button array for big messages with text "press certain button".
;J: Meaning of this array is if you change default control settings and shot will use Y button instead of X, then in the default text (press the X button) letter X will be rewritten with Y.
;J: Actually, there are a different button written by default in each message, but this doesn't matter.

;J: Each word is a position of correct letter.
;J: When adding a new message, don't forget to add a word to this array.

;J: In short messages such as "Energy Tank" the value must be $0000.

;J: In big messages the value is the position of tile that will be rewriten.
;J: Add 2 to move the button right, substract 2 to move the button left.
;J: Add 40 to move the button down, substract 40 to move the button up.
;J: To create big message without rewriting a tile, use value $0020 and !EmptyBig constant as a first DW when defining certain message box.
;J: Note that you can overwrite empty tiles in top and border lines of each message.


ButtonArray:
   DW $0000, $012A, $012A, $012C, $012C, $012C, $0000, $0000, $0000, $0000, $0000, $0000, $0120, $0000, $0000
;Messages 01-0F

   DW $0000, $0000, $0000, $012A, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
;Messages 10-1D [+Beam Fusion]





;K: The rest is code to make the game use the free space above for new message boxes. No touching.
;K: If you do intend to try something tricky, please note that this code is placed at the end of the above message boxes and doesn't have its own org.
;J: FixSize subroutine is replaced. It has a limitation for using only small messages. I've tweaked it a bit, but got another limitation: last message must be small. So, I got rid of it and added a bunch of pointers to unexisting message (see above).

;J: Fix1C1F subroutine is relocated to use space previously used by button array.

org $858749
Fix1C1F:
   LDA $1C1F
   CMP #$001D
   BPL +
   RTS
+
   ADC #$027F
   RTS

;J: Extra code, allowing to use all buttons, not only used Run and Fire used by game for creating messages like "press A to jump" (and get correct button, of course) or short instructions of how to use Wall Jump or Space Jump techniques. You can also make a short player-freindly guide for each button and display these messages in the first few rooms, like it was done in Metroid Prime series.


;Jump
   REP #30
   LDA $09B4
   BRA $1A
;ItemCancel
   REP #30
   LDA $09B8
   BRA $13
;ItemSelect
   REP #30
   LDA $09BA
   BRA $0C
;AimDown
   REP #30
   LDA $09BC
   BRA $05
;AimUp
   REP #30
   LDA $09BE
   JMP $83D1
;EmptyBig
   REP #30
   JMP $8409

org $858243
   JSR Fix1C1F

org $8582E5
   JSR Fix1C1F

org $858413
   DW ButtonArray

;K: Kejardon
;J: JAM
;Version 4


If we're talking about default Message Box v4, lorom line there is located as it should. After constants.

Draconis Kenjishiya

I actually have a further question.

How would I change what free space these patches use? They are in .ips format and I am not sure how I'd do about editing anything within them.

Mettyk25jigsaw

First of all to JAM, I understand there are 'suppose' to be 2 Lorom entries as you have them in your post...What I am saying is when you download it, only one 'exists', you have to put the top one in manually and I just thought those who don't know much about ASM, like myself (I know a little on how to edit them) may not know to put the 'lorom' there manually, that's all...

To Draconis, what you have to do, is open IPS file in a hex editor and there are 2 main instructions to follow, to someone new to hacking though this could go over your head, but I'll give it a go...

First of all you must understand how an IPS file works...Inside the hex editor with IPS file open, always leave the first 5 bytes alone and also the last 3...Now the first 3 bytes 'after' the first 5 bytes is the PC address as to where the first amount of data is going to be patched/pasted...The next 2 are the size (in hex) of the data that is going to be pasted...The next bunch of data can vary in size and is the actual data that 'is' going to be pasted and the amount of data that you have to calculate is the size command I previously gave you...Now I won't tell you what happens if the size of data command is '00 00' because you won't need to worry about it for the patches you are using...Now the only other thing you need to know is, after the bunch of data that is actually going to be pasted is exactly the same process all over again starting from the first 3 bytes 'after' the first 5 bytes process and keeps repeating till end of file is reached...

Main Instruction 1...Change the PC address (the one that is pointing to where there is already data for PLM's in Bank $84) to somewhere in same bank where there 'is' free space...

Main instruction 2...Where the Patch was suppose to be pasted originally, will probably be some pointers pointing to data in that same paste range, now for example if the patch was originally suppose to patch at 27800 (pc address) ($84F800 in SNES address), and now you are wanting patch to be pasted at 27A00 ($84FA00 in SNES Address) you've added $200 to where it was originally suppose to be pasted...Now with 'all' the pointers that are pointing to data in the original paste range, well you add $200 to these pointers keeping in mind that pointers are always read backwards, so anything that might say '04 F8' is actually pointing to 'F8 04' (that is in SNES address). You must also add $200 bytes to your GIF PLM Image ID...
So firstly you must look for anything (in my example) that sais anything between '00 F8' to end of original paste range (inside IPS FILE under the data that is to be pasted) and add $200 to them...

Now I am hoping you only have data to be repointed inside Bank $84, chances are quite high that's the case, if so this method should work. But if you have other data that needs repointing in other banks, PM me and I will talk you through that, That is if you can understand what I've already said to you and hasn't gone over your head...

If you think you have understood me above and believe you have done it right and don't need any other data repointed, you can patch it...BUT, REMEMBER TO BACK-UP B4 HAND, Because that's very important!!!!!!!!!!!!!!!!!!!!!!!!!!!Good Luck...

JAM

Quote from: Mettyk25jigsaw on September 01, 2015, 10:06:41 PM
First of all to JAM, I understand there are 'suppose' to be 2 Lorom entries as you have them in your post...What I am saying is when you download it, only one 'exists', you have to put the top one in manually and I just thought those who don't know much about ASM, like myself (I know a little on how to edit them) may not know to put the 'lorom' there manually, that's all...


Must quote myself.
Quote from: JAM on August 31, 2015, 05:07:06 PM
If we're talking about default Message Box v4, lorom line there is located as it should. After constants.