How does loading the graphics work in the engine?

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
168
Reaction score
49
First Language
English
Primarily Uses
RMMV
So for the plugin i am creating it would be helpful to know how the engine goes about loading the following;

Icons
Enemy graphics
Tileset graphics
Face graphics
Event graphics*

basically i am trying to figure out what is responsible for loading them so i can just copy the function and make a version that looks in a specified path rather than the default "img" folder...yet i have no idea how this would work as looking into the code somewhat related to it i got very lost. I would appreciate any help that can be offered!
 
Last edited:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,339
Reaction score
3,020
First Language
Portuguese
Primarily Uses
RMMV
Loading is done by the ImageManager class for all of them, but each of those is drawn in a different way.
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
168
Reaction score
49
First Language
English
Primarily Uses
RMMV
Loading is done by the ImageManager class for all of them, but each of those is drawn in a different way.
Oh, well, that was easy, i can literally just...copy that and change where it looks based on stuff...Thanks!

I just have to figure out the smart way of messing with that, would their be a way to get information about what called the function? Or any clean-ish way of being able to determine what to load instead?

Edit: I suppose i could do something a bit sneaky with how it loads things, i noticed that it passes a string for the filename when loading the graphic to make a full path, instead of giving it just a filename we could give it a full path instead with some editing
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,323
Reaction score
11,927
First Language
English
Primarily Uses
RMMV
The ImageManager has code that fills in the first half of the path. If you just want SOME images to load from a different location, but ALL of those particular types of images to do so, you would just have to override that particular function in ImageManager so it didn't call the default 'load' function.
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
168
Reaction score
49
First Language
English
Primarily Uses
RMMV
The ImageManager has code that fills in the first half of the path. If you just want SOME images to load from a different location, but ALL of those particular types of images to do so, you would just have to override that particular function in ImageManager so it didn't call the default 'load' function.
I noticed that icons werent included in there, do you know where they are handled? annnd admiditly it sounds like it would be a decent bit of going through and changing things but it seems doable
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,323
Reaction score
11,927
First Language
English
Primarily Uses
RMMV
Everything in the System folder is loaded on game launch. They'll be done in rpg_scenes somewhere. Just search for iconset
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
168
Reaction score
49
First Language
English
Primarily Uses
RMMV
Everything in the System folder is loaded on game launch. They'll be done in rpg_scenes somewhere. Just search for iconset
Do you know how the actual icons are drawn?

What i am looking to do is more along those lines to be honest; specify the icon sheet that it will draw from when it told to draw one?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,323
Reaction score
11,927
First Language
English
Primarily Uses
RMMV
This is something you could look up yourself fairly easily.

rpg_windows.js

Code:
Window_Base.prototype.drawIcon = function(iconIndex, x, y) {
    var bitmap = ImageManager.loadSystem('IconSet');
    var pw = Window_Base._iconWidth;
    var ph = Window_Base._iconHeight;
    var sx = iconIndex % 16 * pw;
    var sy = Math.floor(iconIndex / 16) * ph;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
};
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
168
Reaction score
49
First Language
English
Primarily Uses
RMMV
This is something you could look up yourself fairly easily.

rpg_windows.js

Code:
Window_Base.prototype.drawIcon = function(iconIndex, x, y) {
    var bitmap = ImageManager.loadSystem('IconSet');
    var pw = Window_Base._iconWidth;
    var ph = Window_Base._iconHeight;
    var sx = iconIndex % 16 * pw;
    var sy = Math.floor(iconIndex / 16) * ph;
    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);
};
Thanks for the help, I thiiiink i can handle it on my own from here, have a good night!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Oh, stop with the Melodrama...

...Listen to it instead!

anybody else like getting baked whilst coding?

When you go to the beach watch out for coconuts. Coconuts are more dangerous than sharks. Fact.
Try to get into pixelart again, so far its a sucess.
Also finally found a useful pixeltutorial which helps a lot.
♫ Anyone knows an ant can't move a rubber tree plant, but he's got high hopes, he's got high hopes, he's got high apple pie in the sky hopes ♫

Forum statistics

Threads
93,615
Messages
913,980
Members
123,180
Latest member
tdominach
Top