Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
triacontane committed Jan 20, 2016
1 parent 502c815 commit 5d427f3
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 5 deletions.
132 changes: 132 additions & 0 deletions CommonInterceptor.js
@@ -0,0 +1,132 @@
//=============================================================================
// CommonInterceptor.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.0.0 2016/01/20 初版
// ----------------------------------------------------------------------------
// [Blog] : http://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
* @plugindesc 割り込みコモンイベントプラグイン
* @author トリアコンタン
*
* @param ニューゲームコモン
* @desc ニューゲーム時に呼ばれるコモンイベントID
* @default
*
* @param ロードコモン
* @desc ロード完了時に呼ばれるコモンイベントID
* @default
*
* @param メニューコモン
* @desc メニュー画面を閉じた時に呼ばれるコモンイベントID
* @default
*
* @help 指定したタイミングでコモンイベントを呼び出します。
*
* ・ニューゲーム時
* ・ロード完了時
* ・メニュー終了時
*
* プラグインコマンド詳細
* イベントコマンド「プラグインコマンド」から実行。
* (パラメータの間は半角スペースで区切る)
*
* このプラグインにはプラグインコマンドはありません。
*
* 利用規約:
* 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
* についても制限はありません。
* このプラグインはもうあなたのものです。
*/
(function () {
'use strict';
var pluginName = 'CommonInterceptor';
var paramNames = ['', 'ニューゲームコモン', 'ロードコモン', 'メニューコモン'];

//=============================================================================
// ローカル関数
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
//=============================================================================
var getParamNumber = function (paramNames, min, max) {
var value = getParamOther(paramNames);
if (arguments.length < 2) min = -Infinity;
if (arguments.length < 3) max = Infinity;
return (parseInt(value, 10) || 0).clamp(min, max);
};

var getParamOther = function (paramNames) {
if (!Array.isArray(paramNames)) paramNames = [paramNames];
for (var i = 0; i < paramNames.length; i++) {
var name = PluginManager.parameters(pluginName)[paramNames[i]];
if (name) return name;
}
return null;
};

var _Game_Temp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function() {
_Game_Temp_initialize.apply(this, arguments);
this._interceptorType = 0;
};

Object.defineProperty(Game_Temp.prototype, 'interceptorType', {
get: function() {
return this._interceptorType;
},
set: function(value) {
this._interceptorType = value.clamp(0, 3);
},
configurable: false
});

var _DataManager_setupNewGame = DataManager.setupNewGame;
DataManager.setupNewGame = function() {
_DataManager_setupNewGame.apply(this, arguments);
$gameTemp.interceptorType = 1;
};

var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue;
DataManager.loadGameWithoutRescue = function(savefileId) {
if (_DataManager_loadGameWithoutRescue.apply(this, arguments)) {
$gameTemp.interceptorType = 2;
return true;
}
return false;
};

var _Scene_Menu_terminate = Scene_Menu.prototype.terminate;
Scene_Menu.prototype.terminate = function() {
_Scene_Menu_terminate.apply(this, arguments);
$gameTemp.interceptorType = 3;
};
//=============================================================================
// Game_Map
// 条件を満たした場合のコモンイベント呼び出し処理を追加定義します。
//=============================================================================
var _Game_Map_setupStartingEvent = Game_Map.prototype.setupStartingEvent;
Game_Map.prototype.setupStartingEvent = function() {
var result = _Game_Map_setupStartingEvent.apply(this, arguments);
return result || this.setupInterceptorCommonEvent();
};

Game_Map.prototype.setupInterceptorCommonEvent = function() {
var commonId = getParamNumber(paramNames[$gameTemp.interceptorType]);
var event = $dataCommonEvents[commonId];
var result = false;
if (commonId > 0 && !this.isEventRunning() && event) {
this._interpreter.setup(event.list);
$gameTemp.interceptorType = 0;
result = true;
}
return result;
};
})();

1 change: 0 additions & 1 deletion CustomizeConfigItem.js
Expand Up @@ -265,7 +265,6 @@

var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
alert('aaa');
_ConfigManager_applyData.apply(this, arguments);
this.getCustomParams().iterate(function(symbol, item) {
if (symbol.contains('Boolean')) {
Expand Down
22 changes: 18 additions & 4 deletions PictureCallCommon.js
Expand Up @@ -176,6 +176,16 @@
pictureId = getArgNumber(args[0], 1, 100);
$gameScreen.setPictureRemoveCommon(pictureId);
break;
case 'P_STROKE' :
pictureId = getArgNumber(args[0], 1, 100);
commonId = getArgNumber(args[1], 1, 100);
trigger = getArgNumber(args[2], 1, 8);
$gameScreen.setPictureCallCommon(pictureId, commonId, trigger);
break;
case 'P_STROKE_REMOVE' :
pictureId = getArgNumber(args[0], 1, 100);
$gameScreen.setPictureRemoveCommon(pictureId);
break;
}
};

Expand Down Expand Up @@ -222,7 +232,8 @@
var event = $dataCommonEvents[commonId];
var result = false;
if (commonId > 0 && !this.isEventRunning() && event) {
var gameValueNum = getParamNumber(['GameVariablePictureNum', 'ピクチャ番号の変数番号'], 0, 5000);
var gameValueNum = getParamNumber(['GameVariablePictureNum', 'ピクチャ番号の変数番号'],
0, $dataSystem.variables.length);
if (gameValueNum !== 0) $gameVariables.setValue(gameValueNum, $gameTemp.pictureNum());
this._interpreter.setup(event.list);
result = true;
Expand All @@ -239,7 +250,8 @@
var commonId = $gameTemp.pictureCommonId();
var event = $dataCommonEvents[commonId];
if (commonId > 0 && !this.isEventRunning() && event) {
var gameValueNum = getParamNumber(['GameVariablePictureNum', 'ピクチャ番号の変数番号'], 0, 5000);
var gameValueNum = getParamNumber(['GameVariablePictureNum', 'ピクチャ番号の変数番号'],
0, $dataSystem.variables.length);
if (gameValueNum !== 0) $gameVariables.setValue(gameValueNum, $gameTemp.pictureNum());
this._interpreter.setup(event.list);
}
Expand Down Expand Up @@ -359,8 +371,6 @@
_Sprite_update.call(this);
this._onMouse = false;
this._outMouse = false;
var commandIds = $gameScreen.getPictureCid(this._pictureId);
if (commandIds == null || (commandIds[4] == null && commandIds[5] == null)) return;
if (TouchInput.isMoved()) {
if (this.isTouchable() && this.isTouchPosInRect() && !this.isTransparent()) {
if (!this._wasOnMouse) {
Expand All @@ -387,6 +397,10 @@
}
};

Sprite_Picture.prototype.stroke = function() {

};

Sprite_Picture.prototype.isTransparent = function () {
if (!this._transparentConsideration) return false;
var bx = (TouchInput.x - this.x) / this.scale.x + this.anchor.x * this.width;
Expand Down

0 comments on commit 5d427f3

Please sign in to comment.