Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // Quickdraws Plugin - State Overlay Control
- // StateOverlayControl.js
- // Version: 1.00
- //=============================================================================
- var Imported = Imported || {};
- Imported.StateOverlayControl = true;
- var Quickdraws = Quickdraws || {};
- Quickdraws.control = Quickdraws.control || {};
- //=============================================================================
- /*:
- * @plugindesc Breaks the limit of state overlays by using note tags to reference index. Options to change some properties.
- * @author Quickdraws
- *
- * @param State Overlay Width
- * @desc This is the width of a single cell in the overlay.
- * Default: 96
- * @default 96
- *
- * @param State Overlay Height
- * @desc This is the height of a single cell in the overlay.
- * Default: 96
- * @default 96
- *
- * @param Animation Frames
- * @desc Adjust how many frames of animation there are.
- * Default: 8
- * @default 8
- *
- * @param Anchor X
- * @desc Adjust where the animations are anchored X axis.
- * Default: 0.5
- * @default 0.5
- *
- * @param Anchor Y
- * @desc Adjust where the animations are anchored Y axis.
- * Default: 1
- * @default 1
- *
- * @param Wait Frames
- * @desc Adjust the wait time between animation frames.
- * Default: 8
- * @default 8
- *
- * @help
- * ============================================================================
- * Overview
- * ============================================================================
- * This plugin breaks the default state overlay limit and provides some property
- * modifications.
- *
- * ============================================================================
- * Notetags
- * ============================================================================
- * <OVERLAY INDEX: x>
- *
- * Then use <OVERLAY INDEX: x> in the note of a state and replace the 'x'
- * by the line number of your new overlay.
- *
- * Example:
- * <STATE OVERLAY: 27>
- *
- * this will choose the 27nth line based on your width and height settings of your
- * States.png
- *
- * ============================================================================
- * Misc
- * ============================================================================
- * The default animation for state overlays is made of 8 frames of 96x96.
- *
- * Always be mindful of the line format in order based on your desire frame width
- * and height to make thing line up and show properly.
- *
- * ============================================================================
- * Terms
- * ============================================================================
- * Free to use commercial or non commercial just credit the author as
- * Quickdraws.
- * ============================================================================
- * Changelog
- * ============================================================================
- * Version 1.00
- * - Initial release.
- */
- //=============================================================================
- //=============================================================================
- // Parameter Variables
- //=============================================================================
- Quickdraws.Parameters = PluginManager.parameters('StateOverlayControl');
- Quickdraws.Param = Quickdraws.Param || {};
- Quickdraws.Param.SOWidth = Number(Quickdraws.Parameters['State Overlay Width']);
- Quickdraws.Param.SOHeight = Number(Quickdraws.Parameters['State Overlay Height']);
- Quickdraws.Param.SOFrames = Number(Quickdraws.Parameters['Animation Frames']);
- Quickdraws.Param.AnchorX = Number(Quickdraws.Parameters['Anchor X']);
- Quickdraws.Param.AnchorY = Number(Quickdraws.Parameters['Anchor Y']);
- Quickdraws.Param.WaitFrames = Number(Quickdraws.Parameters['Wait Frames']);
- //=============================================================================
- // DataManager
- //=============================================================================
- Quickdraws.control.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
- DataManager.isDatabaseLoaded = function() {
- if (!Quickdraws.control.DataManager_isDatabaseLoaded.call(this)) return false;
- DataManager.processControlTags1($dataStates);
- return true;
- };
- DataManager.processControlTags1 = function(group) {
- var note1 = /<(?:OVERLAY INDEX):[ ]*(\d+)>/i;
- var note2 = /<(?:OVERLAY ANCHOR X):[ ]*(\d+)>/i;
- var note3 = /<(?:OVERLAY ANCHOR Y):[ ]*(\d+)>/i;
- for (var n = 1; n < group.length; n++) {
- var obj = group[n];
- var notedata = obj.note.split(/[\r\n]+/);
- // obj.anchorx = [];
- // obj.anchory = [];
- for (var i = 0; i < notedata.length; i++) {
- var line = notedata[i];
- if (line.match(note1)) {
- obj.overlay = parseInt(RegExp.$1);
- } else if (line.match(note2)) {
- obj.anchorx = parseInt(RegExp.$1);
- } else if (line.match(note3)) {
- obj.anchory = parseInt(RegExp.$1);
- }
- }
- }
- };
- Sprite_StateOverlay.prototype.initMembers = function() {
- this._battler = null;
- this._overlayIndex = 0;
- this._animationCount = 0;
- this._pattern = 0;
- this.anchor.x = Quickdraws.Param.AnchorX;
- this.anchor.y = Quickdraws.Param.AnchorY;
- };
- Sprite_StateOverlay.prototype.animationWait = function() {
- return Quickdraws.Param.WaitFrames;
- };
- Sprite_StateOverlay.prototype.updatePattern = function() {
- this._pattern++;
- this._pattern %= Quickdraws.Param.SOFrames;
- if (this._battler) {
- this._overlayIndex = this._battler.stateOverlayIndex();
- }
- };
- Sprite_StateOverlay.prototype.updateFrame = function() {
- if (this._overlayIndex > 0) {
- var w = Quickdraws.Param.SOWidth;
- var h = Quickdraws.Param.SOHeight;
- var sx = this._pattern * w;
- var sy = (this._overlayIndex - 1) * h;
- this.setFrame(sx, sy, w, h);
- } else {
- this.setFrame(0,0,0,0);
- }
- };
- // var monkey = this._battler.bump();
- // Game_BattlerBase.prototype.bump = function(stateId) {
- // var testing = $dataStates[this._stateId].anchorx;
- // return testing;
- // };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement