What happens between $gameMessage.add() and Window_Base.processNormalCharacter()?

aporokizzu

anti-kumbaya
Veteran
Joined
Jan 14, 2020
Messages
59
Reaction score
84
First Language
english
Primarily Uses
RMMV
I'm trying to better understand the process for displaying text messages- so, I'm wondering if somebody more knowledgeable would be kind enough to explain what happens from the time text gets added to the $gameMessage._text array to when it is broken down to a single letter as part of the textState object that gets passed to the Window_Message.contents Bitmap drawText() function.

My questions specifically are:
  1. Where / how are the values textState.height, textState.x, textState.y, textState.index defined?
  2. Would it be possible to intercept the $gameMessage._text array (after it goes through the convertEscapeCharacter(), processEscapeCharacter(), processCharacter() functions) and pass the whole string (not just individual letters) to an external function that outputs a Bitmap that can be placed in the Window_Message.contents instead of going through the Bitmap drawText() / blt() method? Where / at what point would be the best place to do this?
Thanks in advance!
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
1. Most of the answers to this are found on lines 259-~353 of rpg_windows.
textState.height is defined by the calcTextHeight function found on lines 398 and below of rpg_windows
textState.x is generally just the position as defined by the starting position + textWidth of the current character being drawn.
textState.index is incremented as each character is drawn.
textState.y is generally only incremented and changed when a new line needs to be drawn (see line 333) or when a page needs changing.

2. I don't understand your reasoning for this, as it would still need to draw the full message onto a bitmap. I guess you could hijack (alias) the processNormalCharacter, and processsDrawIcon to draw on a second bitmap that you have somewhere. Regardless though you'd need to draw the characters in some way, unless you have another way of drawing text onto a bitmap. In which case, I think just getting the result of convertEscapeCharacters would be fine? The other ones are used to handle how the text is drawn so they really don't mean much in terms of an actual string. Only to the engines way of drawing text.
 

aporokizzu

anti-kumbaya
Veteran
Joined
Jan 14, 2020
Messages
59
Reaction score
84
First Language
english
Primarily Uses
RMMV
1. Most of the answers to this are found on lines 259-~353 of rpg_windows.
textState.height is defined by the calcTextHeight function found on lines 398 and below of rpg_windows
textState.x is generally just the position as defined by the starting position + textWidth of the current character being drawn.
textState.index is incremented as each character is drawn.
textState.y is generally only incremented and changed when a new line needs to be drawn (see line 333) or when a page needs changing.
@Kaliya Thanks! I'll take a gander.
Would you know where $gameMessage._text is detected and a command to draw the Window_Message is fired?

2. I don't understand your reasoning for this, as it would still need to draw the full message onto a bitmap. I guess you could hijack (alias) the processNormalCharacter, and processsDrawIcon to draw on a second bitmap that you have somewhere. Regardless though you'd need to draw the characters in some way, unless you have another way of drawing text onto a bitmap. In which case, I think just getting the result of convertEscapeCharacters would be fine? The other ones are used to handle how the text is drawn so they really don't mean much in terms of an actual string. Only to the engines way of drawing text.
Sorry I should have been more specific- the reasoning is, I have a custom BitmapFont.drawSmallText() that handles the layout of the passed string and renders it to a Bitmap (which I have more control over).

Window_Message:
showtext.PNG

Cutom BitmapFont function:
custombitmap_console.PNG
custombitmap.PNG

But anyway I will pour over your tips and see if I can make it work for me. Thanks again!
 

aporokizzu

anti-kumbaya
Veteran
Joined
Jan 14, 2020
Messages
59
Reaction score
84
First Language
english
Primarily Uses
RMMV
OK- sort of got it working based on @Kaliya 's advice. I just can't figure out yet why my first line has a large gap between it and the second line and / or how to adjust the height so that the window cursor / border is closer to the bottom text line:

showtext_fix_00.PNG
 

aporokizzu

anti-kumbaya
Veteran
Joined
Jan 14, 2020
Messages
59
Reaction score
84
First Language
english
Primarily Uses
RMMV
Bump...

Can anybody speculate why the line space between my first and second line is taller than the rest of the lines in the dialog box?
showtext_fix_01.PNG
showtext_fix_01_00.png

Thank you :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Small rant: While using SRD Hud maker for a battle hud, I typed in the wrong script call and got an error, but then forgot to delete the piece that caused the error before closed the Hud maker and hit F5 to restart the game. Now everytime I engage in a battle my game crashes...
:kaolivid:
Would Jump into Javascript be best off continuing to break down the MV core files, or would people prefer a quick detour to cover everything that's changed in the core from MV to MZ?
Not going to lie... PIXI Particles make fantastic graphics... But predicting the hitbox of something with a "fixed size" but whose graphics can stick out past that, is quite challenging. :kaoswt:
Would you like a glass of spiders?

Forum statistics

Threads
100,530
Messages
976,897
Members
132,081
Latest member
Kaezyelnatz
Top