-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathKODERA_optimization.js
More file actions
152 lines (147 loc) · 5.22 KB
/
KODERA_optimization.js
File metadata and controls
152 lines (147 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//=============================================================================
// KODERA_optimization.js
//=============================================================================
/*:
* @plugindesc 1.0.3 Speed up core RPG Maker engine
* @author Mariusz 'koder' Chwalba
*
* @help This plugin exchanges various elements of core RPG Maker engine with
* quicker counterparts. No functionality is lost or gained.
*
* It improves FPS (most visible on mobile platforms and netbooks) and reduces
* battery life.
*
* Plugin is FREE to use in both FREE and COMMERCIAL products. No guarantee,
* implied or otherwise, is given. Attribution required in reasonable place
* (credits).
*/
(function () {
Sprite.prototype.update = function () {
var l = this.children.length;
for (var i = 0; i < l; i++) {
var child = this.children[i];
if (child && child.update) {
child.update();
}
};
};
Tilemap.prototype.update = function () {
this.animationCount++;
this.animationFrame = Math.floor(this.animationCount / 30);
var l = this.children.length;
for (var i = 0; i < l; i++) {
var child = this.children[i];
if (child && child.update) {
child.update();
}
}
for (var i = 0; i < this.bitmaps.length; i++) {
if (this.bitmaps[i]) {
this.bitmaps[i].touch();
}
}
};
TilingSprite.prototype.update = function () {
var l = this.children.length;
for (var i = 0; i < l; i++) {
var child = this.children[i];
if (child && child.update) {
child.update();
}
}
};
Window.prototype.update = function () {
if (this.active) {
this._animationCount++;
}
var l = this.children.length;
for (var i = 0; i < l; i++) {
var child = this.children[i];
if (child && child.update) {
child.update();
}
}
};
WindowLayer.prototype.update = function () {
var l = this.children.length;
for (var i = 0; i < l; i++) {
var child = this.children[i];
if (child && child.update) {
child.update();
}
}
};
Weather.prototype._updateAllSprites = function () {
var maxSprites = Math.floor(this.power * 10);
while (this._sprites.length < maxSprites) {
this._addSprite();
}
while (this._sprites.length > maxSprites) {
this._removeSprite();
}
var l = this._sprites.length;
for (var i = 0; i < l; i++) {
var sprite = this._sprites[i];
this._updateSprite(sprite);
sprite.x = sprite.ax - this.origin.x;
sprite.y = sprite.ay - this.origin.y;
}
};
Scene_Base.prototype.updateChildren = function () {
var i;
var l = this.children.length;
for (i = 0; i < l; i++) {
var child = this.children[i];
if (child.update) {
child.update();
}
}
};
Scene_ItemBase.prototype.applyItem = function () {
var action = new Game_Action(this.user());
action.setItemObject(this.item());
var repeats = action.numRepeats();
var ita = this.itemTargetActors();
for (var i = 0; i < ita.length; i++) {
var target = ita[i];
for (var ix = 0; ix < repeats; ix++) {
action.apply(target);
}
};
action.applyGlobal();
};
Sprite_Animation.prototype.updateFrame = function () {
if (this._duration > 0) {
var frameIndex = this.currentFrameIndex();
this.updateAllCellSprites(this._animation.frames[frameIndex]);
for (var i = 0; i < this._animation.timings.length; i++) {
var timing = this._animation.timings[i];
if (timing.frame === frameIndex) {
this.processTimingData(timing);
}
};
}
};
Spriteset_Map.prototype.createCharacters = function () {
this._characterSprites = [];
var events = $gameMap.events()
for (var i = 0; i < events.length; i++) {
var event = events[i];
this._characterSprites.push(new Sprite_Character(event));
}
var vehicles = $gameMap.vehicles();
for (var i = 0; i < vehicles.length; i++) {
var vehicle = vehicles[i];
this._characterSprites.push(new Sprite_Character(vehicle));
};
var followers = $gamePlayer.followers()._data;
for (var i = followers.length - 1; i >= 0; i--) {
var follower = followers[i];
this._characterSprites.push(new Sprite_Character(follower));
}
this._characterSprites.push(new Sprite_Character($gamePlayer));
for (var i = 0; i < this._characterSprites.length; i++) {
this._tilemap.addChild(this._characterSprites[i]);
}
};
})();