forked from Trivel/RMMV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMrTS_ProgressTitleScreen.js
117 lines (103 loc) · 4.09 KB
/
MrTS_ProgressTitleScreen.js
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
//=============================================================================
// MrTS_ProgressTitleScreen.js
//=============================================================================
/*:
* @plugindesc Changes title screen picture according to game progress.
* @author Mr. Trivel
*
* @param Image List
* @desc Title screen image list.
* (no space after ,)
* @default Book,Castle,Crystal,Sword,Volcano
*
* @help
* --------------------------------------------------------------------------------
* Terms of Use
* --------------------------------------------------------------------------------
* Don't remove the header or claim that you wrote this plugin.
* Credit Mr. Trivel if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Infor
* --------------------------------------------------------------------------------
* Save file with highest TitleScreen value will be used to display title screen.
*
* --------------------------------------------------------------------------------
* Plugin Commands
* --------------------------------------------------------------------------------
* TitleScreen [PROGRESS]
* E.g.: TitleScreen 3
* That would set TitleScreen to 3rd item on the Image List. Using defaults it'd be
* Crystal.
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
//-----------------------------------------------------------------------------
// Parameters
//
var parameters = PluginManager.parameters('MrTS_ProgressTitleScreen');
var paramTitleList = String(parameters['Image List'] || "Book,Castle,Crystal,Sword,Volcano");
var paramImageList = paramTitleList.split(",");
//--------------------------------------------------------------------------
// Game_Interpreter
//
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'TitleScreen') {
$gameSystem.setTitleScreenProgressTo(Number(args[0]));
}
};
//--------------------------------------------------------------------------
// Game_System
//
Game_System.prototype.setTitleScreenProgressTo = function(progress) {
this._titleProgress = progress;
};
Game_System.prototype.getTitleScreenProgress = function() {
return this._titleProgress;
};
//--------------------------------------------------------------------------
// DataManager
//
var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
DataManager.makeSavefileInfo = function() {
var info = _DataManager_makeSavefileInfo.call(this);
info.titleProgress = $gameSystem.getTitleScreenProgress();
return info;
};
DataManager.highestTitleProgress = function() {
var progress = 0;
var globalInfo = this.loadGlobalInfo();
if (globalInfo) {
for (var i = 1; i < globalInfo.length; i++) {
if (this.isThisGameFile(i)) {
if (globalInfo[i].titleProgress && globalInfo[i].titleProgress > progress)
progress = globalInfo[i].titleProgress;
}
}
}
return progress;
};
//--------------------------------------------------------------------------
// Scene_Title
//
Scene_Title.prototype.createBackground = function() {
var progress = DataManager.highestTitleProgress();
if (progress > 0)
this._backSprite1 = new Sprite(ImageManager.loadTitle1(paramImageList[progress-1]));
else
this._backSprite1 = new Sprite(ImageManager.loadTitle1($dataSystem.title1Name));
this._backSprite2 = new Sprite(ImageManager.loadTitle2($dataSystem.title2Name));
this.addChild(this._backSprite1);
this.addChild(this._backSprite2);
};
})();