Question about bitmap on load callback

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
Hi, guys
 
Today I tried to mess with Window Status. I tried to add a standing picture for each actor. I put it directly on refresh method (which was worked on RM VXAce). My problem is, it doesn't show any picture until I move to the next actor's status, and back.
 
When I tried to inspect it using ImageManager.isReady, it display false as if the picture hasn't been fully loaded. I feel that this is weird because actor's face, actor's character graphics, and other images are fully loaded. My workaround is just to add a callback function when the images has been fully loaded.

My question is:

Is there any "more direct" way to show picture (like RMVX Ace) rather than using callback (like this)? Or did I miss something like character images preload step?

I'm looking for any advice on this.

Code:
(function() {'use strict'// ==================================================================================// Game_Actor	var _Game_Actor_initMembers = Game_Actor.prototype.initMembers;	Game_Actor.prototype.initMembers = function() {		_Game_Actor_initMembers.call(this);		this._standingPicture = '';	};		var _Game_Actor_initImages = Game_Actor.prototype.initImages;	Game_Actor.prototype.initImages = function() {		_Game_Actor_initImages.call(this);		var actor = this.actor();		this._standingPicture = actor.meta.standing_pic || '';	};		Game_Actor.prototype.pictureName = function(){		return this._standingPicture;	};// ==================================================================================// Window_Status	var _Window_Status_refresh = Window_Status.prototype.refresh;	Window_Status.prototype.refresh = function() {		_Window_Status_refresh.call(this);		if (this._actor) {			this.loadActorPicture(this._actor); 		}	};		Window_Status.prototype.loadActorPicture = function(actor) {		var filename = actor.pictureName();		if (filename == '') {return;}		var bitmap = ImageManager.loadPicture(filename);		bitmap.addLoadListener(function() {			SceneManager._scene._statusWindow.drawActorPicture(bitmap);		});	};			Window_Status.prototype.drawActorPicture = function(bitmap, x, y) {		var pw = bitmap.width;		var ph = bitmap.height;		var ww = Graphics.boxWidth;		var wh = Graphics.boxHeight;		var x = x || ww - pw;		var y = y || wh - ph;		this.contents.blt(bitmap, 0, 0, pw, ph, x, y);	};})(); // Don't touch this!
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
This is no workaround, but the intended way to deal with Ajax loading. Your other option would be to use the Sprite class, instead, which internally handles the callback.
 

Heartbreak61

Wandering Noob
Veteran
Joined
Sep 5, 2012
Messages
187
Reaction score
90
First Language
Indonesian
Primarily Uses
RMMV
This is no workaround, but the intended way to deal with Ajax loading. Your other option would be to use the Sprite class, instead, which internally handles the callback.
I see then.

But what about actor's picture and character graphic? I think it just use bitmap.blt and it showed up instantly without using callback.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Please post the code that you're refering to or at least the filename and line number in the base scripts.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top