Skip to content

Instantly share code, notes, and snippets.

@katai5plate
Created October 30, 2020 09:24
Show Gist options
  • Save katai5plate/c8bfa38c4f980a9b6576b8d7f6c7adb1 to your computer and use it in GitHub Desktop.
Save katai5plate/c8bfa38c4f980a9b6576b8d7f6c7adb1 to your computer and use it in GitHub Desktop.
RPGツクールMZ 1.0.2 -> 1.1.0 コアスクリプト差分
From 21dd3f9a791fc7c9b33bba8df8057690bcff8fc0 Mon Sep 17 00:00:00 2001
From: katai5plate <katai5plate.sub@gmail.com>
Date: Fri, 30 Oct 2020 18:35:53 +0900
Subject: [PATCH] 1.1.0
---
js/main.js | 2 +-
js/rmmz_core.js | 4 ++--
js/rmmz_managers.js | 11 ++++++-----
js/rmmz_objects.js | 16 ++++++++++------
js/rmmz_scenes.js | 2 +-
js/rmmz_sprites.js | 16 ++++++++++++++--
js/rmmz_windows.js | 2 +-
package.json | 2 +-
src/core/Utils.js | 2 +-
src/managers/BattleManager.js | 1 +
src/managers/EffectManager.js | 2 +-
src/managers/StorageManager.js | 6 +++---
src/objects/Game_Actor.js | 2 +-
src/objects/Game_Battler.js | 4 ++++
src/objects/Game_Map.js | 4 ++--
src/objects/Game_Player.js | 4 ++--
src/sprites/Sprite_Animation.js | 3 +++
src/sprites/Sprite_Gauge.js | 11 ++++++++++-
18 files changed, 64 insertions(+), 30 deletions(-)
diff --git a/js/main.js b/js/main.js
index 5d17d56..f3ba4e5 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,5 +1,5 @@
//=============================================================================
-// main.js v1.0.2
+// main.js v1.1.0
//=============================================================================
const scriptUrls = [
diff --git a/js/rmmz_core.js b/js/rmmz_core.js
index bdc1199..79b9b8d 100644
--- a/js/rmmz_core.js
+++ b/js/rmmz_core.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_core.js v1.0.2
+// rmmz_core.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
@@ -192,7 +192,7 @@ Utils.RPGMAKER_NAME = "MZ";
* @type string
* @constant
*/
-Utils.RPGMAKER_VERSION = "1.0.2";
+Utils.RPGMAKER_VERSION = "1.1.0";
/**
* Checks whether the current RPG Maker version is greater than or equal to
diff --git a/js/rmmz_managers.js b/js/rmmz_managers.js
index 0e08307..7eb2f5f 100644
--- a/js/rmmz_managers.js
+++ b/js/rmmz_managers.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_managers.js v1.0.2
+// rmmz_managers.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
@@ -688,8 +688,8 @@ StorageManager.saveToForage = function(saveName, zip) {
setTimeout(() => localforage.removeItem(testKey));
return localforage
.setItem(testKey, zip)
- .then(localforage.setItem(key, zip))
- .then(this.updateForageKeys());
+ .then(() => localforage.setItem(key, zip))
+ .then(() => this.updateForageKeys());
};
StorageManager.loadFromForage = function(saveName) {
@@ -704,7 +704,7 @@ StorageManager.forageExists = function(saveName) {
StorageManager.removeForage = function(saveName) {
const key = this.forageKey(saveName);
- return localforage.removeItem(key).then(this.updateForageKeys());
+ return localforage.removeItem(key).then(() => this.updateForageKeys());
};
StorageManager.updateForageKeys = function() {
@@ -998,7 +998,7 @@ EffectManager.load = function(filename) {
EffectManager.startLoading = function(url) {
const onLoad = () => this.onLoad(url);
- const onError = () => this.onError(url);
+ const onError = (message, url) => this.onError(url);
const effect = Graphics.effekseer.loadEffect(url, 1, onLoad, onError);
this._cache[url] = effect;
return effect;
@@ -2742,6 +2742,7 @@ BattleManager.startAction = function() {
this._phase = "action";
this._action = action;
this._targets = targets;
+ subject.cancelMotionRefresh();
subject.useItem(action.item());
this._action.applyGlobal();
this._logWindow.startAction(subject, action, targets);
diff --git a/js/rmmz_objects.js b/js/rmmz_objects.js
index 2c3c4a7..aa3b1ed 100644
--- a/js/rmmz_objects.js
+++ b/js/rmmz_objects.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_objects.js v1.0.2
+// rmmz_objects.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
@@ -3342,6 +3342,10 @@ Game_Battler.prototype.requestMotionRefresh = function() {
this._motionRefresh = true;
};
+Game_Battler.prototype.cancelMotionRefresh = function() {
+ this._motionRefresh = false;
+};
+
Game_Battler.prototype.select = function() {
this._selected = true;
};
@@ -4706,7 +4710,7 @@ Game_Actor.prototype.makeActionList = function() {
Game_Actor.prototype.makeAutoBattleActions = function() {
for (let i = 0; i < this.numActions(); i++) {
const list = this.makeActionList();
- let maxValue = Number.MIN_VALUE;
+ let maxValue = -Number.MAX_VALUE;
for (const action of list) {
const value = action.evaluate();
if (value > maxValue) {
@@ -6333,11 +6337,11 @@ Game_Map.prototype.isOverworld = function() {
};
Game_Map.prototype.screenTileX = function() {
- return Graphics.width / this.tileWidth();
+ return Math.round((Graphics.width / this.tileWidth()) * 16) / 16;
};
Game_Map.prototype.screenTileY = function() {
- return Graphics.height / this.tileHeight();
+ return Math.round((Graphics.height / this.tileHeight()) * 16) / 16;
};
Game_Map.prototype.adjustX = function(x) {
@@ -8188,11 +8192,11 @@ Game_Player.prototype.isCollided = function(x, y) {
};
Game_Player.prototype.centerX = function() {
- return (Graphics.width / $gameMap.tileWidth() - 1) / 2.0;
+ return ($gameMap.screenTileX() - 1) / 2;
};
Game_Player.prototype.centerY = function() {
- return (Graphics.height / $gameMap.tileHeight() - 1) / 2.0;
+ return ($gameMap.screenTileY() - 1) / 2;
};
Game_Player.prototype.center = function(x, y) {
diff --git a/js/rmmz_scenes.js b/js/rmmz_scenes.js
index 9dac5a1..09d2e06 100644
--- a/js/rmmz_scenes.js
+++ b/js/rmmz_scenes.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_scenes.js v1.0.2
+// rmmz_scenes.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
diff --git a/js/rmmz_sprites.js b/js/rmmz_sprites.js
index cdbcf41..d502bd0 100644
--- a/js/rmmz_sprites.js
+++ b/js/rmmz_sprites.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_sprites.js v1.0.2
+// rmmz_sprites.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
@@ -1424,6 +1424,9 @@ Sprite_Animation.prototype.targetPosition = function(renderer) {
Sprite_Animation.prototype.targetSpritePosition = function(sprite) {
const point = new Point(0, -sprite.height / 2);
+ if (this._animation.alignBottom) {
+ point.y = 0;
+ }
sprite.updateTransform();
return sprite.worldTransform.apply(point);
};
@@ -2151,7 +2154,11 @@ Sprite_Gauge.prototype.gaugeHeight = function() {
};
Sprite_Gauge.prototype.gaugeX = function() {
- return this._statusType === "time" ? 0 : 30;
+ if (this._statusType === "time") {
+ return 0;
+ } else {
+ return this.measureLabelWidth() + 6;
+ }
};
Sprite_Gauge.prototype.labelY = function() {
@@ -2432,6 +2439,11 @@ Sprite_Gauge.prototype.setupLabelFont = function() {
this.bitmap.outlineWidth = this.labelOutlineWidth();
};
+Sprite_Gauge.prototype.measureLabelWidth = function() {
+ this.setupLabelFont();
+ return this.bitmap.measureTextWidth(this.label());
+};
+
Sprite_Gauge.prototype.labelOpacity = function() {
return this.isValid() ? 255 : 160;
};
diff --git a/js/rmmz_windows.js b/js/rmmz_windows.js
index 547e922..8e8702a 100644
--- a/js/rmmz_windows.js
+++ b/js/rmmz_windows.js
@@ -1,5 +1,5 @@
//=============================================================================
-// rmmz_windows.js v1.0.2
+// rmmz_windows.js v1.1.0
//=============================================================================
//-----------------------------------------------------------------------------
diff --git a/package.json b/package.json
index 454fb0d..d1cb583 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rpgmz-corescript-diffs",
- "version": "1.0.2",
+ "version": "1.1.0",
"description": "ツクールMZのコアスクリプトを非公式に保管する",
"main": "index.js",
"scripts": {
diff --git a/src/core/Utils.js b/src/core/Utils.js
index 51f3bcb..cbac8b0 100644
--- a/src/core/Utils.js
+++ b/src/core/Utils.js
@@ -22,7 +22,7 @@ Utils.RPGMAKER_NAME = "MZ";
* @type string
* @constant
*/
-Utils.RPGMAKER_VERSION = "1.0.2";
+Utils.RPGMAKER_VERSION = "1.1.0";
/**
* Checks whether the current RPG Maker version is greater than or equal to
diff --git a/src/managers/BattleManager.js b/src/managers/BattleManager.js
index a186a39..251967a 100644
--- a/src/managers/BattleManager.js
+++ b/src/managers/BattleManager.js
@@ -526,6 +526,7 @@ BattleManager.startAction = function() {
this._phase = "action";
this._action = action;
this._targets = targets;
+ subject.cancelMotionRefresh();
subject.useItem(action.item());
this._action.applyGlobal();
this._logWindow.startAction(subject, action, targets);
diff --git a/src/managers/EffectManager.js b/src/managers/EffectManager.js
index 99ca628..0e90db7 100644
--- a/src/managers/EffectManager.js
+++ b/src/managers/EffectManager.js
@@ -25,7 +25,7 @@ EffectManager.load = function(filename) {
EffectManager.startLoading = function(url) {
const onLoad = () => this.onLoad(url);
- const onError = () => this.onError(url);
+ const onError = (message, url) => this.onError(url);
const effect = Graphics.effekseer.loadEffect(url, 1, onLoad, onError);
this._cache[url] = effect;
return effect;
diff --git a/src/managers/StorageManager.js b/src/managers/StorageManager.js
index a142df5..59d4653 100644
--- a/src/managers/StorageManager.js
+++ b/src/managers/StorageManager.js
@@ -160,8 +160,8 @@ StorageManager.saveToForage = function(saveName, zip) {
setTimeout(() => localforage.removeItem(testKey));
return localforage
.setItem(testKey, zip)
- .then(localforage.setItem(key, zip))
- .then(this.updateForageKeys());
+ .then(() => localforage.setItem(key, zip))
+ .then(() => this.updateForageKeys());
};
StorageManager.loadFromForage = function(saveName) {
@@ -176,7 +176,7 @@ StorageManager.forageExists = function(saveName) {
StorageManager.removeForage = function(saveName) {
const key = this.forageKey(saveName);
- return localforage.removeItem(key).then(this.updateForageKeys());
+ return localforage.removeItem(key).then(() => this.updateForageKeys());
};
StorageManager.updateForageKeys = function() {
diff --git a/src/objects/Game_Actor.js b/src/objects/Game_Actor.js
index 22800b2..e7efca8 100644
--- a/src/objects/Game_Actor.js
+++ b/src/objects/Game_Actor.js
@@ -707,7 +707,7 @@ Game_Actor.prototype.makeActionList = function() {
Game_Actor.prototype.makeAutoBattleActions = function() {
for (let i = 0; i < this.numActions(); i++) {
const list = this.makeActionList();
- let maxValue = Number.MIN_VALUE;
+ let maxValue = -Number.MAX_VALUE;
for (const action of list) {
const value = action.evaluate();
if (value > maxValue) {
diff --git a/src/objects/Game_Battler.js b/src/objects/Game_Battler.js
index d8eabb9..9c7d035 100644
--- a/src/objects/Game_Battler.js
+++ b/src/objects/Game_Battler.js
@@ -65,6 +65,10 @@ Game_Battler.prototype.requestMotionRefresh = function() {
this._motionRefresh = true;
};
+Game_Battler.prototype.cancelMotionRefresh = function() {
+ this._motionRefresh = false;
+};
+
Game_Battler.prototype.select = function() {
this._selected = true;
};
diff --git a/src/objects/Game_Map.js b/src/objects/Game_Map.js
index 6a1e39e..b2f9680 100644
--- a/src/objects/Game_Map.js
+++ b/src/objects/Game_Map.js
@@ -303,11 +303,11 @@ Game_Map.prototype.isOverworld = function() {
};
Game_Map.prototype.screenTileX = function() {
- return Graphics.width / this.tileWidth();
+ return Math.round((Graphics.width / this.tileWidth()) * 16) / 16;
};
Game_Map.prototype.screenTileY = function() {
- return Graphics.height / this.tileHeight();
+ return Math.round((Graphics.height / this.tileHeight()) * 16) / 16;
};
Game_Map.prototype.adjustX = function(x) {
diff --git a/src/objects/Game_Player.js b/src/objects/Game_Player.js
index dd18599..4e86075 100644
--- a/src/objects/Game_Player.js
+++ b/src/objects/Game_Player.js
@@ -155,11 +155,11 @@ Game_Player.prototype.isCollided = function(x, y) {
};
Game_Player.prototype.centerX = function() {
- return (Graphics.width / $gameMap.tileWidth() - 1) / 2.0;
+ return ($gameMap.screenTileX() - 1) / 2;
};
Game_Player.prototype.centerY = function() {
- return (Graphics.height / $gameMap.tileHeight() - 1) / 2.0;
+ return ($gameMap.screenTileY() - 1) / 2;
};
Game_Player.prototype.center = function(x, y) {
diff --git a/src/sprites/Sprite_Animation.js b/src/sprites/Sprite_Animation.js
index a2d4a8e..d9607fb 100644
--- a/src/sprites/Sprite_Animation.js
+++ b/src/sprites/Sprite_Animation.js
@@ -237,6 +237,9 @@ Sprite_Animation.prototype.targetPosition = function(renderer) {
Sprite_Animation.prototype.targetSpritePosition = function(sprite) {
const point = new Point(0, -sprite.height / 2);
+ if (this._animation.alignBottom) {
+ point.y = 0;
+ }
sprite.updateTransform();
return sprite.worldTransform.apply(point);
};
diff --git a/src/sprites/Sprite_Gauge.js b/src/sprites/Sprite_Gauge.js
index 762f7be..baa2fdf 100644
--- a/src/sprites/Sprite_Gauge.js
+++ b/src/sprites/Sprite_Gauge.js
@@ -51,7 +51,11 @@ Sprite_Gauge.prototype.gaugeHeight = function() {
};
Sprite_Gauge.prototype.gaugeX = function() {
- return this._statusType === "time" ? 0 : 30;
+ if (this._statusType === "time") {
+ return 0;
+ } else {
+ return this.measureLabelWidth() + 6;
+ }
};
Sprite_Gauge.prototype.labelY = function() {
@@ -332,6 +336,11 @@ Sprite_Gauge.prototype.setupLabelFont = function() {
this.bitmap.outlineWidth = this.labelOutlineWidth();
};
+Sprite_Gauge.prototype.measureLabelWidth = function() {
+ this.setupLabelFont();
+ return this.bitmap.measureTextWidth(this.label());
+};
+
Sprite_Gauge.prototype.labelOpacity = function() {
return this.isValid() ? 255 : 160;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment