Move all engine changes into plugin
This commit is contained in:
parent
040a56c09f
commit
c39ec970f1
10 changed files with 452 additions and 74 deletions
|
@ -73,6 +73,13 @@ var $plugins = [
|
||||||
"parameters":
|
"parameters":
|
||||||
{}
|
{}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "VND_OmoriFixes",
|
||||||
|
"status": true,
|
||||||
|
"description": "Some fixes for android platform",
|
||||||
|
"parameters":
|
||||||
|
{}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "YEP_CoreEngine",
|
"name": "YEP_CoreEngine",
|
||||||
"status": true,
|
"status": true,
|
||||||
|
|
189
www.eng/js/plugins/VND_OmoriFixes.js
Normal file
189
www.eng/js/plugins/VND_OmoriFixes.js
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
// by VienDesu! 2023
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_core
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
Bitmap.prototype._requestImage = function (url) {
|
||||||
|
if (Bitmap._reuseImages.length !== 0) {
|
||||||
|
this._image = Bitmap._reuseImages.pop();
|
||||||
|
} else {
|
||||||
|
this._image = new Image();
|
||||||
|
}
|
||||||
|
|
||||||
|
url = replaceSpecialSymbols(url);
|
||||||
|
url = require("fs").cachedAlternativeName(url);
|
||||||
|
|
||||||
|
if (this._decodeAfterRequest && !this._loader) {
|
||||||
|
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._image = new Image();
|
||||||
|
this._url = url;
|
||||||
|
this._loadingState = 'requesting';
|
||||||
|
|
||||||
|
if (!Decrypter.checkImgIgnore(url) && Decrypter.hasEncryptedImages) {
|
||||||
|
this._loadingState = 'decrypting';
|
||||||
|
Decrypter.decryptImg(url, this);
|
||||||
|
} else {
|
||||||
|
this._image.src = encodeURI(url);
|
||||||
|
|
||||||
|
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
||||||
|
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics.printLoadingError = function (url) {
|
||||||
|
if (this._errorPrinter && !this._errorShowed) {
|
||||||
|
this._errorPrinter.innerHTML = this._makeErrorHtml('Loading Error', 'Failed to load: ' + url);
|
||||||
|
var button = document.createElement('button');
|
||||||
|
button.innerHTML = 'Retry';
|
||||||
|
button.style.fontSize = '24px';
|
||||||
|
button.style.color = '#000000';
|
||||||
|
button.style.backgroundColor = '#000000';
|
||||||
|
button.onmousedown = button.ontouchstart = function (event) {
|
||||||
|
ResourceHandler.retry();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
this._errorPrinter.appendChild(button);
|
||||||
|
this._loadingCount = -Infinity;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._switchFPSMeter = function() {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._switchFullScreen = function () {
|
||||||
|
this._requestFullScreen();
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._isFullScreen = function () {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._requestFullScreen = function () {
|
||||||
|
try {
|
||||||
|
var element = document.body;
|
||||||
|
if (element.requestFullScreen) {
|
||||||
|
element.requestFullScreen();
|
||||||
|
} else if (element.mozRequestFullScreen) {
|
||||||
|
element.mozRequestFullScreen();
|
||||||
|
} else if (element.webkitRequestFullScreen) {
|
||||||
|
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
} else if (element.msRequestFullscreen) {
|
||||||
|
element.msRequestFullscreen();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Fullscreen request denied! %s`, e)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Input._wrapNwjsAlert = function () {
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
var _alert = window.alert;
|
||||||
|
window.alert = function () {
|
||||||
|
var gui = require('nw.gui');
|
||||||
|
var win = gui.window;
|
||||||
|
_alert.apply(this, arguments);
|
||||||
|
win.focus();
|
||||||
|
Input.clear();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Input._setupEventHandlers = function () {
|
||||||
|
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
||||||
|
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
TouchInput.update = function () {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_managers
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
DataManager.loadDataFile = function (name, src) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
var url = _dfs.cachedAlternativeName('data/' + src);
|
||||||
|
xhr.open('GET', url);
|
||||||
|
xhr.overrideMimeType('application/json');
|
||||||
|
xhr.onload = function () {
|
||||||
|
if (xhr.status < 400) {
|
||||||
|
window[name] = JSON.parse(xhr.responseText);
|
||||||
|
DataManager.onLoad(window[name]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.onerror = this._mapLoader || function () {
|
||||||
|
DataManager._errorUrl = DataManager._errorUrl || url;
|
||||||
|
};
|
||||||
|
window[name] = null;
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
|
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
||||||
|
if (filename) {
|
||||||
|
var path = folder + filename + '.png';
|
||||||
|
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
||||||
|
bitmap.smooth = smooth;
|
||||||
|
return bitmap;
|
||||||
|
} else {
|
||||||
|
return this.loadEmptyBitmap();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ImageManager.loadNormalBitmap = function (path, hue) {
|
||||||
|
var key = this._generateCacheKey(path, hue);
|
||||||
|
var bitmap = this._imageCache.get(key);
|
||||||
|
if (!bitmap) {
|
||||||
|
bitmap = Bitmap.load(decodeURIComponent(replaceSpecialSymbols(path)));
|
||||||
|
bitmap.addLoadListener(function () {
|
||||||
|
bitmap.rotateHue(hue);
|
||||||
|
});
|
||||||
|
this._imageCache.add(key, bitmap);
|
||||||
|
} else if (!bitmap.isReady()) {
|
||||||
|
bitmap.decode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
SceneManager.initNwjs = function () {
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
var gui = require('nw.gui');
|
||||||
|
var win = gui.window;
|
||||||
|
if (process.platform === 'darwin' && !win.menu) {
|
||||||
|
var menubar = new gui.Menu({ type: 'menubar' });
|
||||||
|
var option = { hideEdit: true, hideWindow: true };
|
||||||
|
menubar.createMacBuiltin('Game', option);
|
||||||
|
win.menu = menubar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SceneManager.onKeyDown = function (event) {
|
||||||
|
if (!event.ctrlKey && !event.altKey) {
|
||||||
|
switch (event.keyCode) {
|
||||||
|
case 116: // F5
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 119: // F8
|
||||||
|
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
||||||
|
require('nw.gui').window.showDevTools();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_objects
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
Game_Temp.prototype.setDestination = function (x, y) {
|
||||||
|
return;
|
||||||
|
};
|
|
@ -1671,9 +1671,6 @@ Bitmap.prototype._requestImage = function (url) {
|
||||||
this._image = new Image();
|
this._image = new Image();
|
||||||
}
|
}
|
||||||
|
|
||||||
url = replaceSpecialSymbols(url);
|
|
||||||
url = require("fs").cachedAlternativeName(url);
|
|
||||||
|
|
||||||
if (this._decodeAfterRequest && !this._loader) {
|
if (this._decodeAfterRequest && !this._loader) {
|
||||||
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -1686,7 +1683,7 @@ Bitmap.prototype._requestImage = function (url) {
|
||||||
this._loadingState = 'decrypting';
|
this._loadingState = 'decrypting';
|
||||||
Decrypter.decryptImg(url, this);
|
Decrypter.decryptImg(url, this);
|
||||||
} else {
|
} else {
|
||||||
this._image.src = encodeURI(url);
|
this._image.src = url;
|
||||||
|
|
||||||
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
||||||
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
||||||
|
@ -1997,7 +1994,7 @@ Graphics.printLoadingError = function (url) {
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
button.innerHTML = 'Retry';
|
button.innerHTML = 'Retry';
|
||||||
button.style.fontSize = '24px';
|
button.style.fontSize = '24px';
|
||||||
button.style.color = '#000000';
|
button.style.color = '#ffffff';
|
||||||
button.style.backgroundColor = '#000000';
|
button.style.backgroundColor = '#000000';
|
||||||
button.onmousedown = button.ontouchstart = function (event) {
|
button.onmousedown = button.ontouchstart = function (event) {
|
||||||
ResourceHandler.retry();
|
ResourceHandler.retry();
|
||||||
|
@ -2866,23 +2863,23 @@ Graphics._onTouchEnd = function (event) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
///**
|
/**
|
||||||
// * @static
|
* @static
|
||||||
// * @method _switchFPSMeter
|
* @method _switchFPSMeter
|
||||||
// * @private
|
* @private
|
||||||
// */
|
*/
|
||||||
//Graphics._switchFPSMeter = function() {
|
Graphics._switchFPSMeter = function() {
|
||||||
// if (this._fpsMeter.isPaused) {
|
if (this._fpsMeter.isPaused) {
|
||||||
// this.showFps();
|
this.showFps();
|
||||||
// this._fpsMeter.showFps();
|
this._fpsMeter.showFps();
|
||||||
// this._fpsMeterToggled = false;
|
this._fpsMeterToggled = false;
|
||||||
// } else if (!this._fpsMeterToggled) {
|
} else if (!this._fpsMeterToggled) {
|
||||||
// this._fpsMeter.showDuration();
|
this._fpsMeter.showDuration();
|
||||||
// this._fpsMeterToggled = true;
|
this._fpsMeterToggled = true;
|
||||||
// } else {
|
} else {
|
||||||
// this.hideFps();
|
this.hideFps();
|
||||||
// }
|
}
|
||||||
//};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
|
@ -2901,7 +2898,11 @@ Graphics._switchStretchMode = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._switchFullScreen = function () {
|
Graphics._switchFullScreen = function () {
|
||||||
|
if (this._isFullScreen()) {
|
||||||
this._requestFullScreen();
|
this._requestFullScreen();
|
||||||
|
} else {
|
||||||
|
this._cancelFullScreen();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2911,7 +2912,6 @@ Graphics._switchFullScreen = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._isFullScreen = function () {
|
Graphics._isFullScreen = function () {
|
||||||
return true;
|
|
||||||
return ((document.fullScreenElement && document.fullScreenElement !== null) ||
|
return ((document.fullScreenElement && document.fullScreenElement !== null) ||
|
||||||
(!document.mozFullScreen && !document.webkitFullscreenElement &&
|
(!document.mozFullScreen && !document.webkitFullscreenElement &&
|
||||||
!document.msFullscreenElement));
|
!document.msFullscreenElement));
|
||||||
|
@ -2923,7 +2923,6 @@ Graphics._isFullScreen = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._requestFullScreen = function () {
|
Graphics._requestFullScreen = function () {
|
||||||
try {
|
|
||||||
var element = document.body;
|
var element = document.body;
|
||||||
if (element.requestFullScreen) {
|
if (element.requestFullScreen) {
|
||||||
element.requestFullScreen();
|
element.requestFullScreen();
|
||||||
|
@ -2934,9 +2933,6 @@ Graphics._requestFullScreen = function () {
|
||||||
} else if (element.msRequestFullscreen) {
|
} else if (element.msRequestFullscreen) {
|
||||||
element.msRequestFullscreen();
|
element.msRequestFullscreen();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
console.log(`Fullscreen request denied! %s`, e)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3212,7 +3208,7 @@ Input._wrapNwjsAlert = function () {
|
||||||
var _alert = window.alert;
|
var _alert = window.alert;
|
||||||
window.alert = function () {
|
window.alert = function () {
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.window;
|
var win = gui.Window.get();
|
||||||
_alert.apply(this, arguments);
|
_alert.apply(this, arguments);
|
||||||
win.focus();
|
win.focus();
|
||||||
Input.clear();
|
Input.clear();
|
||||||
|
@ -3228,7 +3224,7 @@ Input._wrapNwjsAlert = function () {
|
||||||
Input._setupEventHandlers = function () {
|
Input._setupEventHandlers = function () {
|
||||||
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
||||||
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
||||||
//window.addEventListener('blur', this._onLostFocus.bind(this));
|
window.addEventListener('blur', this._onLostFocus.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3517,7 +3513,6 @@ TouchInput.clear = function () {
|
||||||
* @method update
|
* @method update
|
||||||
*/
|
*/
|
||||||
TouchInput.update = function () {
|
TouchInput.update = function () {
|
||||||
return;
|
|
||||||
this._triggered = this._events.triggered;
|
this._triggered = this._events.triggered;
|
||||||
this._cancelled = this._events.cancelled;
|
this._cancelled = this._events.cancelled;
|
||||||
this._moved = this._events.moved;
|
this._moved = this._events.moved;
|
||||||
|
|
|
@ -76,10 +76,9 @@ DataManager.loadDatabase = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window._dfs = require("fs");
|
|
||||||
DataManager.loadDataFile = function (name, src) {
|
DataManager.loadDataFile = function (name, src) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
var url = _dfs.cachedAlternativeName('data/' + src);
|
var url = 'data/' + src;
|
||||||
xhr.open('GET', url);
|
xhr.open('GET', url);
|
||||||
xhr.overrideMimeType('application/json');
|
xhr.overrideMimeType('application/json');
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
|
@ -863,7 +862,7 @@ ImageManager.loadTitle2 = function (filename, hue) {
|
||||||
|
|
||||||
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
||||||
if (filename) {
|
if (filename) {
|
||||||
var path = folder + filename + '.png';
|
var path = folder + encodeURIComponent(filename) + '.png';
|
||||||
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
||||||
bitmap.smooth = smooth;
|
bitmap.smooth = smooth;
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
@ -887,7 +886,7 @@ ImageManager.loadNormalBitmap = function (path, hue) {
|
||||||
var key = this._generateCacheKey(path, hue);
|
var key = this._generateCacheKey(path, hue);
|
||||||
var bitmap = this._imageCache.get(key);
|
var bitmap = this._imageCache.get(key);
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
bitmap = Bitmap.load(decodeURIComponent(replaceSpecialSymbols(path)));
|
bitmap = Bitmap.load(decodeURIComponent(path));
|
||||||
bitmap.addLoadListener(function () {
|
bitmap.addLoadListener(function () {
|
||||||
bitmap.rotateHue(hue);
|
bitmap.rotateHue(hue);
|
||||||
});
|
});
|
||||||
|
@ -1877,7 +1876,7 @@ SceneManager.initInput = function () {
|
||||||
SceneManager.initNwjs = function () {
|
SceneManager.initNwjs = function () {
|
||||||
if (Utils.isNwjs()) {
|
if (Utils.isNwjs()) {
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.window;
|
var win = gui.Window.get();
|
||||||
if (process.platform === 'darwin' && !win.menu) {
|
if (process.platform === 'darwin' && !win.menu) {
|
||||||
var menubar = new gui.Menu({ type: 'menubar' });
|
var menubar = new gui.Menu({ type: 'menubar' });
|
||||||
var option = { hideEdit: true, hideWindow: true };
|
var option = { hideEdit: true, hideWindow: true };
|
||||||
|
@ -1941,7 +1940,7 @@ SceneManager.onKeyDown = function (event) {
|
||||||
break;
|
break;
|
||||||
case 119: // F8
|
case 119: // F8
|
||||||
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
||||||
require('nw.gui').window.showDevTools();
|
require('nw.gui').Window.get().showDevTools();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ Game_Temp.prototype.reservedCommonEvent = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Game_Temp.prototype.setDestination = function (x, y) {
|
Game_Temp.prototype.setDestination = function (x, y) {
|
||||||
return;
|
|
||||||
this._destinationX = x;
|
this._destinationX = x;
|
||||||
this._destinationY = y;
|
this._destinationY = y;
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,6 +73,13 @@ var $plugins = [
|
||||||
"parameters":
|
"parameters":
|
||||||
{}
|
{}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "VND_OmoriFixes",
|
||||||
|
"status": true,
|
||||||
|
"description": "Some fixes for android platform",
|
||||||
|
"parameters":
|
||||||
|
{}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "YEP_CoreEngine",
|
"name": "YEP_CoreEngine",
|
||||||
"status": true,
|
"status": true,
|
||||||
|
|
189
www.rus/js/plugins/VND_OmoriFixes.js
Normal file
189
www.rus/js/plugins/VND_OmoriFixes.js
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
// by VienDesu! 2023
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_core
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
Bitmap.prototype._requestImage = function (url) {
|
||||||
|
if (Bitmap._reuseImages.length !== 0) {
|
||||||
|
this._image = Bitmap._reuseImages.pop();
|
||||||
|
} else {
|
||||||
|
this._image = new Image();
|
||||||
|
}
|
||||||
|
|
||||||
|
url = replaceSpecialSymbols(url);
|
||||||
|
url = require("fs").cachedAlternativeName(url);
|
||||||
|
|
||||||
|
if (this._decodeAfterRequest && !this._loader) {
|
||||||
|
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._image = new Image();
|
||||||
|
this._url = url;
|
||||||
|
this._loadingState = 'requesting';
|
||||||
|
|
||||||
|
if (!Decrypter.checkImgIgnore(url) && Decrypter.hasEncryptedImages) {
|
||||||
|
this._loadingState = 'decrypting';
|
||||||
|
Decrypter.decryptImg(url, this);
|
||||||
|
} else {
|
||||||
|
this._image.src = encodeURI(url);
|
||||||
|
|
||||||
|
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
||||||
|
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics.printLoadingError = function (url) {
|
||||||
|
if (this._errorPrinter && !this._errorShowed) {
|
||||||
|
this._errorPrinter.innerHTML = this._makeErrorHtml('Loading Error', 'Failed to load: ' + url);
|
||||||
|
var button = document.createElement('button');
|
||||||
|
button.innerHTML = 'Retry';
|
||||||
|
button.style.fontSize = '24px';
|
||||||
|
button.style.color = '#000000';
|
||||||
|
button.style.backgroundColor = '#000000';
|
||||||
|
button.onmousedown = button.ontouchstart = function (event) {
|
||||||
|
ResourceHandler.retry();
|
||||||
|
event.stopPropagation();
|
||||||
|
};
|
||||||
|
this._errorPrinter.appendChild(button);
|
||||||
|
this._loadingCount = -Infinity;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._switchFPSMeter = function() {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._switchFullScreen = function () {
|
||||||
|
this._requestFullScreen();
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._isFullScreen = function () {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Graphics._requestFullScreen = function () {
|
||||||
|
try {
|
||||||
|
var element = document.body;
|
||||||
|
if (element.requestFullScreen) {
|
||||||
|
element.requestFullScreen();
|
||||||
|
} else if (element.mozRequestFullScreen) {
|
||||||
|
element.mozRequestFullScreen();
|
||||||
|
} else if (element.webkitRequestFullScreen) {
|
||||||
|
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
||||||
|
} else if (element.msRequestFullscreen) {
|
||||||
|
element.msRequestFullscreen();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Fullscreen request denied! %s`, e)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Input._wrapNwjsAlert = function () {
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
var _alert = window.alert;
|
||||||
|
window.alert = function () {
|
||||||
|
var gui = require('nw.gui');
|
||||||
|
var win = gui.window;
|
||||||
|
_alert.apply(this, arguments);
|
||||||
|
win.focus();
|
||||||
|
Input.clear();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Input._setupEventHandlers = function () {
|
||||||
|
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
||||||
|
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
TouchInput.update = function () {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_managers
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
DataManager.loadDataFile = function (name, src) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
var url = _dfs.cachedAlternativeName('data/' + src);
|
||||||
|
xhr.open('GET', url);
|
||||||
|
xhr.overrideMimeType('application/json');
|
||||||
|
xhr.onload = function () {
|
||||||
|
if (xhr.status < 400) {
|
||||||
|
window[name] = JSON.parse(xhr.responseText);
|
||||||
|
DataManager.onLoad(window[name]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.onerror = this._mapLoader || function () {
|
||||||
|
DataManager._errorUrl = DataManager._errorUrl || url;
|
||||||
|
};
|
||||||
|
window[name] = null;
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
|
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
||||||
|
if (filename) {
|
||||||
|
var path = folder + filename + '.png';
|
||||||
|
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
||||||
|
bitmap.smooth = smooth;
|
||||||
|
return bitmap;
|
||||||
|
} else {
|
||||||
|
return this.loadEmptyBitmap();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ImageManager.loadNormalBitmap = function (path, hue) {
|
||||||
|
var key = this._generateCacheKey(path, hue);
|
||||||
|
var bitmap = this._imageCache.get(key);
|
||||||
|
if (!bitmap) {
|
||||||
|
bitmap = Bitmap.load(decodeURIComponent(replaceSpecialSymbols(path)));
|
||||||
|
bitmap.addLoadListener(function () {
|
||||||
|
bitmap.rotateHue(hue);
|
||||||
|
});
|
||||||
|
this._imageCache.add(key, bitmap);
|
||||||
|
} else if (!bitmap.isReady()) {
|
||||||
|
bitmap.decode();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
SceneManager.initNwjs = function () {
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
var gui = require('nw.gui');
|
||||||
|
var win = gui.window;
|
||||||
|
if (process.platform === 'darwin' && !win.menu) {
|
||||||
|
var menubar = new gui.Menu({ type: 'menubar' });
|
||||||
|
var option = { hideEdit: true, hideWindow: true };
|
||||||
|
menubar.createMacBuiltin('Game', option);
|
||||||
|
win.menu = menubar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SceneManager.onKeyDown = function (event) {
|
||||||
|
if (!event.ctrlKey && !event.altKey) {
|
||||||
|
switch (event.keyCode) {
|
||||||
|
case 116: // F5
|
||||||
|
if (Utils.isNwjs()) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 119: // F8
|
||||||
|
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
||||||
|
require('nw.gui').window.showDevTools();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// * Patches for rpg_objects
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
Game_Temp.prototype.setDestination = function (x, y) {
|
||||||
|
return;
|
||||||
|
};
|
|
@ -1671,9 +1671,6 @@ Bitmap.prototype._requestImage = function (url) {
|
||||||
this._image = new Image();
|
this._image = new Image();
|
||||||
}
|
}
|
||||||
|
|
||||||
url = replaceSpecialSymbols(url);
|
|
||||||
url = require("fs").cachedAlternativeName(url);
|
|
||||||
|
|
||||||
if (this._decodeAfterRequest && !this._loader) {
|
if (this._decodeAfterRequest && !this._loader) {
|
||||||
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -1686,7 +1683,7 @@ Bitmap.prototype._requestImage = function (url) {
|
||||||
this._loadingState = 'decrypting';
|
this._loadingState = 'decrypting';
|
||||||
Decrypter.decryptImg(url, this);
|
Decrypter.decryptImg(url, this);
|
||||||
} else {
|
} else {
|
||||||
this._image.src = encodeURI(url);
|
this._image.src = url;
|
||||||
|
|
||||||
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this));
|
||||||
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this));
|
||||||
|
@ -1997,7 +1994,7 @@ Graphics.printLoadingError = function (url) {
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
button.innerHTML = 'Retry';
|
button.innerHTML = 'Retry';
|
||||||
button.style.fontSize = '24px';
|
button.style.fontSize = '24px';
|
||||||
button.style.color = '#000000';
|
button.style.color = '#ffffff';
|
||||||
button.style.backgroundColor = '#000000';
|
button.style.backgroundColor = '#000000';
|
||||||
button.onmousedown = button.ontouchstart = function (event) {
|
button.onmousedown = button.ontouchstart = function (event) {
|
||||||
ResourceHandler.retry();
|
ResourceHandler.retry();
|
||||||
|
@ -2866,23 +2863,23 @@ Graphics._onTouchEnd = function (event) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
///**
|
/**
|
||||||
// * @static
|
* @static
|
||||||
// * @method _switchFPSMeter
|
* @method _switchFPSMeter
|
||||||
// * @private
|
* @private
|
||||||
// */
|
*/
|
||||||
//Graphics._switchFPSMeter = function() {
|
Graphics._switchFPSMeter = function() {
|
||||||
// if (this._fpsMeter.isPaused) {
|
if (this._fpsMeter.isPaused) {
|
||||||
// this.showFps();
|
this.showFps();
|
||||||
// this._fpsMeter.showFps();
|
this._fpsMeter.showFps();
|
||||||
// this._fpsMeterToggled = false;
|
this._fpsMeterToggled = false;
|
||||||
// } else if (!this._fpsMeterToggled) {
|
} else if (!this._fpsMeterToggled) {
|
||||||
// this._fpsMeter.showDuration();
|
this._fpsMeter.showDuration();
|
||||||
// this._fpsMeterToggled = true;
|
this._fpsMeterToggled = true;
|
||||||
// } else {
|
} else {
|
||||||
// this.hideFps();
|
this.hideFps();
|
||||||
// }
|
}
|
||||||
//};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
|
@ -2901,7 +2898,11 @@ Graphics._switchStretchMode = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._switchFullScreen = function () {
|
Graphics._switchFullScreen = function () {
|
||||||
|
if (this._isFullScreen()) {
|
||||||
this._requestFullScreen();
|
this._requestFullScreen();
|
||||||
|
} else {
|
||||||
|
this._cancelFullScreen();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2911,7 +2912,6 @@ Graphics._switchFullScreen = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._isFullScreen = function () {
|
Graphics._isFullScreen = function () {
|
||||||
return true;
|
|
||||||
return ((document.fullScreenElement && document.fullScreenElement !== null) ||
|
return ((document.fullScreenElement && document.fullScreenElement !== null) ||
|
||||||
(!document.mozFullScreen && !document.webkitFullscreenElement &&
|
(!document.mozFullScreen && !document.webkitFullscreenElement &&
|
||||||
!document.msFullscreenElement));
|
!document.msFullscreenElement));
|
||||||
|
@ -2923,7 +2923,6 @@ Graphics._isFullScreen = function () {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graphics._requestFullScreen = function () {
|
Graphics._requestFullScreen = function () {
|
||||||
try {
|
|
||||||
var element = document.body;
|
var element = document.body;
|
||||||
if (element.requestFullScreen) {
|
if (element.requestFullScreen) {
|
||||||
element.requestFullScreen();
|
element.requestFullScreen();
|
||||||
|
@ -2934,9 +2933,6 @@ Graphics._requestFullScreen = function () {
|
||||||
} else if (element.msRequestFullscreen) {
|
} else if (element.msRequestFullscreen) {
|
||||||
element.msRequestFullscreen();
|
element.msRequestFullscreen();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
console.log(`Fullscreen request denied! %s`, e)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3212,7 +3208,7 @@ Input._wrapNwjsAlert = function () {
|
||||||
var _alert = window.alert;
|
var _alert = window.alert;
|
||||||
window.alert = function () {
|
window.alert = function () {
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.window;
|
var win = gui.Window.get();
|
||||||
_alert.apply(this, arguments);
|
_alert.apply(this, arguments);
|
||||||
win.focus();
|
win.focus();
|
||||||
Input.clear();
|
Input.clear();
|
||||||
|
@ -3228,7 +3224,7 @@ Input._wrapNwjsAlert = function () {
|
||||||
Input._setupEventHandlers = function () {
|
Input._setupEventHandlers = function () {
|
||||||
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
document.addEventListener('keydown', this._onKeyDown.bind(this));
|
||||||
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
document.addEventListener('keyup', this._onKeyUp.bind(this));
|
||||||
//window.addEventListener('blur', this._onLostFocus.bind(this));
|
window.addEventListener('blur', this._onLostFocus.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3517,7 +3513,6 @@ TouchInput.clear = function () {
|
||||||
* @method update
|
* @method update
|
||||||
*/
|
*/
|
||||||
TouchInput.update = function () {
|
TouchInput.update = function () {
|
||||||
return;
|
|
||||||
this._triggered = this._events.triggered;
|
this._triggered = this._events.triggered;
|
||||||
this._cancelled = this._events.cancelled;
|
this._cancelled = this._events.cancelled;
|
||||||
this._moved = this._events.moved;
|
this._moved = this._events.moved;
|
||||||
|
|
|
@ -76,10 +76,9 @@ DataManager.loadDatabase = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window._dfs = require("fs");
|
|
||||||
DataManager.loadDataFile = function (name, src) {
|
DataManager.loadDataFile = function (name, src) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
var url = _dfs.cachedAlternativeName('data/' + src);
|
var url = 'data/' + src;
|
||||||
xhr.open('GET', url);
|
xhr.open('GET', url);
|
||||||
xhr.overrideMimeType('application/json');
|
xhr.overrideMimeType('application/json');
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
|
@ -863,7 +862,7 @@ ImageManager.loadTitle2 = function (filename, hue) {
|
||||||
|
|
||||||
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
ImageManager.loadBitmap = function (folder, filename, hue, smooth) {
|
||||||
if (filename) {
|
if (filename) {
|
||||||
var path = folder + filename + '.png';
|
var path = folder + encodeURIComponent(filename) + '.png';
|
||||||
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
var bitmap = this.loadNormalBitmap(path, hue || 0);
|
||||||
bitmap.smooth = smooth;
|
bitmap.smooth = smooth;
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
@ -887,7 +886,7 @@ ImageManager.loadNormalBitmap = function (path, hue) {
|
||||||
var key = this._generateCacheKey(path, hue);
|
var key = this._generateCacheKey(path, hue);
|
||||||
var bitmap = this._imageCache.get(key);
|
var bitmap = this._imageCache.get(key);
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
bitmap = Bitmap.load(decodeURIComponent(replaceSpecialSymbols(path)));
|
bitmap = Bitmap.load(decodeURIComponent(path));
|
||||||
bitmap.addLoadListener(function () {
|
bitmap.addLoadListener(function () {
|
||||||
bitmap.rotateHue(hue);
|
bitmap.rotateHue(hue);
|
||||||
});
|
});
|
||||||
|
@ -1877,7 +1876,7 @@ SceneManager.initInput = function () {
|
||||||
SceneManager.initNwjs = function () {
|
SceneManager.initNwjs = function () {
|
||||||
if (Utils.isNwjs()) {
|
if (Utils.isNwjs()) {
|
||||||
var gui = require('nw.gui');
|
var gui = require('nw.gui');
|
||||||
var win = gui.window;
|
var win = gui.Window.get();
|
||||||
if (process.platform === 'darwin' && !win.menu) {
|
if (process.platform === 'darwin' && !win.menu) {
|
||||||
var menubar = new gui.Menu({ type: 'menubar' });
|
var menubar = new gui.Menu({ type: 'menubar' });
|
||||||
var option = { hideEdit: true, hideWindow: true };
|
var option = { hideEdit: true, hideWindow: true };
|
||||||
|
@ -1941,7 +1940,7 @@ SceneManager.onKeyDown = function (event) {
|
||||||
break;
|
break;
|
||||||
case 119: // F8
|
case 119: // F8
|
||||||
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
||||||
require('nw.gui').window.showDevTools();
|
require('nw.gui').Window.get().showDevTools();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ Game_Temp.prototype.reservedCommonEvent = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Game_Temp.prototype.setDestination = function (x, y) {
|
Game_Temp.prototype.setDestination = function (x, y) {
|
||||||
return;
|
|
||||||
this._destinationX = x;
|
this._destinationX = x;
|
||||||
this._destinationY = y;
|
this._destinationY = y;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue