Skip to content

Commit

Permalink
Added New Plugin: Change Keyboard Input
Browse files Browse the repository at this point in the history
  • Loading branch information
Archeia committed Jan 25, 2019
1 parent 2cfdfeb commit f236c48
Show file tree
Hide file tree
Showing 3 changed files with 278 additions and 2 deletions.
123 changes: 123 additions & 0 deletions General Modification/LEDA_ChangeKeys/LEDA_ChangeKeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// ===================================================================
//
// Archeia Engine LEDA -- Change Keys
//
// Version 1.0.0 - 1/25/2019
//
// Change keyboard input for specific Visual Novel Maker games.
// This plugin overwrites a lot of input functions.
//
// ===================================================================
var Imported = Imported || {};
Imported.AEL_KEY = true;

var Archeia = Archeia || {};
Archeia.AEL_KEY = Archeia.AEL_KEY || {};
Archeia.AEL_KEY.version = 1.00;

//=============================================================================
// Parameter Variables
//=============================================================================

// Keys set in this section will proceed the game
Archeia.AEL_KEY.InputOK = Input.KEY_SPACE;
Archeia.AEL_KEY.InputOK_ALT= Input.C;

// This key exists for hiding the messagebox
Archeia.AEL_KEY.inputHIDE= Input.KEY_BACK_SPACE;

//=============================================================================
// Component_GameSceneBehavior
//=============================================================================

// Checks for the shortcut to hide/show the game UI. By default, this is the
// space-key. You can override this method to change the shortcut.
// ----------------------------------------------------------------------- //
Component_GameSceneBehavior.prototype.updateUIVisibilityShortcut = function() {
if (!this.uiVisible && (Input.trigger(Archeia.AEL_KEY.InputOK) || Input.trigger(Archeia.AEL_KEY.InputOK_ALT) || Input.Mouse.buttonDown)) {
this.changeUIVisibility(!this.uiVisible);
}
if (Input.trigger(Archeia.AEL_KEY.inputHIDE)) {
return this.changeUIVisibility(!this.uiVisible);
}
};

// Updates the full screen video played via Play Movie command.
// ----------------------------------------------------------------------- //
Component_GameSceneBehavior.prototype.updateVideo = function() {
if (this.object.video !== null) {
this.object.video.update();
if (this.object.settings.allowVideoSkip && (Input.trigger(Archeia.AEL_KEY.InputOK) || Input.trigger(Archeia.AEL_KEY.InputOK_ALT) || Input.Mouse.buttons[Input.Mouse.LEFT] === 2)) {
this.object.video.stop();
}
return Input.clear();
}
};

//=============================================================================
// Component_MessageTextRenderer
//=============================================================================
// Adds event-handlers for mouse/touch events
// ----------------------------------------------------------------------- //
gs.Component_MessageTextRenderer.prototype.setupEventHandlers = function() {
gs.GlobalEventManager.offByOwner("mouseUp", this.object);
gs.GlobalEventManager.offByOwner("keyUp", this.object);
gs.GlobalEventManager.on("mouseUp", ((function(_this) {
return function(e) {
if (_this.object.findComponentByName("animation") || (GameManager.settings.autoMessage.enabled && !GameManager.settings.autoMessage.stopOnAction)) {
return;
}
if (Input.Mouse.buttons[Input.Mouse.LEFT] !== 2) {
return;
}
if (_this.isWaiting && !(_this.waitCounter > 0 || _this.waitForKey)) {
e.breakChain = true;
_this["continue"]();
} else {
e.breakChain = _this.isRunning;
_this.drawImmediately = !_this.waitForKey;
_this.waitCounter = 0;
_this.waitForKey = false;
_this.isWaiting = false;
}
if (_this.waitForKey) {
if (Input.Mouse.buttons[Input.Mouse.LEFT] === 2) {
e.breakChain = true;
Input.clear();
_this.waitForKey = false;
return _this.isWaiting = false;
}
}
};
})(this)), null, this.object);
return gs.GlobalEventManager.on("keyUp", ((function(_this) {
return function(e) {
if ((Input.keys[Archeia.AEL_KEY.inputOK] || Input.keys[Archeia.AEL_KEY.InputOK_ALT]) && (!_this.isWaiting || (_this.waitCounter > 0 || _this.waitForKey))) {
_this.drawImmediately = !_this.waitForKey;
_this.waitCounter = 0;
_this.waitForKey = false;
_this.isWaiting = false;
}
if (_this.isWaiting && !_this.waitForKey && !_this.waitCounter && Input.keys[Archeia.AEL_KEY.InputOK] || Input.keys[Archeia.AEL_KEY.InputOK_ALT] ) {
_this["continue"]();
}
if (_this.waitForKey) {
if (Input.keys[Archeia.AEL_KEY.InputOK] || Input.keys[Archeia.AEL_KEY.InputOK_ALT]) {
Input.clear();
_this.waitForKey = false;
return _this.isWaiting = false;
}
}
};
})(this)), null, this.object);
};

//=============================================================================
// Component_MessageBehavior
//=============================================================================
// Checks if a mouse-button or key was pressed to continue with the message-rendering.
// ----------------------------------------------------------------------- //

vn.Component_MessageBehavior.prototype.actionTrigger = function() {
return (gs.ObjectManager.current.input && this.object.visible && this.object.dstRect.contains(Input.Mouse.x - this.object.origin.x, Input.Mouse.y - this.object.origin.y) && Input.Mouse.buttons[Input.Mouse.LEFT] === 2) || Input.trigger(Archeia.AEL_KEY.InputOK) || Input.trigger(Archeia.AEL_KEY.InputOK_ALT);
};
136 changes: 136 additions & 0 deletions General Modification/LEDA_ChangeKeys/gsInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// ===================================================================
//
// GS Input References
//
// ===================================================================
/* gs.Input.@KEY
@LEFT = 37
@UP = 38
@RIGHT = 39
@DOWN = 40
@A = 16
@B = 88
@C = 13
@X = 65
@Y = 83
@Z = 68
@L = 81
@R = 87
@START = @C
@SELECT = @Z
@KEY_CANCEL = 3
@KEY_HELP = 6
@KEY_BACK_SPACE = 8
@KEY_TAB = 9
@KEY_CLEAR = 12
@KEY_RETURN = 13
@KEY_ENTER = 14
@KEY_SHIFT = 16
@KEY_CONTROL = 17
@KEY_ALT = 18
@KEY_PAUSE = 19
@KEY_CAPS_LOCK = 20
@KEY_ESCAPE = 27
@KEY_SPACE = 32
@KEY_PAGE_UP = 33
@KEY_PAGE_DOWN = 34
@KEY_END = 35
@KEY_HOME = 36
@KEY_LEFT = 37
@KEY_UP = 38
@KEY_RIGHT = 39
@KEY_DOWN = 40
@KEY_PRINTSCREEN = 44
@KEY_INSERT = 45
@KEY_DELETE = 46
@KEY_0 = 48
@KEY_1 = 49
@KEY_2 = 50
@KEY_3 = 51
@KEY_4 = 52
@KEY_5 = 53
@KEY_6 = 54
@KEY_7 = 55
@KEY_8 = 56
@KEY_9 = 57
@KEY_SEMICOLON = 59
@KEY_EQUALS = 61
@KEY_A = 65
@KEY_B = 66
@KEY_C = 67
@KEY_D = 68
@KEY_E = 69
@KEY_F = 70
@KEY_G = 71
@KEY_H = 72
@KEY_I = 73
@KEY_J = 74
@KEY_K = 75
@KEY_L = 76
@KEY_M = 77
@KEY_N = 78
@KEY_O = 79
@KEY_P = 80
@KEY_Q = 81
@KEY_R = 82
@KEY_S = 83
@KEY_T = 84
@KEY_U = 85
@KEY_V = 86
@KEY_W = 87
@KEY_X = 88
@KEY_Y = 89
@KEY_Z = 90
@KEY_CONTEXT_MENU = 93
@KEY_NUMPAD0 = 96
@KEY_NUMPAD1 = 97
@KEY_NUMPAD2 = 98
@KEY_NUMPAD3 = 99
@KEY_NUMPAD4 = 100
@KEY_NUMPAD5 = 101
@KEY_NUMPAD6 = 102
@KEY_NUMPAD7 = 103
@KEY_NUMPAD8 = 104
@KEY_NUMPAD9 = 105
@KEY_MULTIPLY = 106
@KEY_ADD = 107
@KEY_SEPARATOR = 108
@KEY_SUBTRACT = 109
@KEY_DECIMAL = 110
@KEY_DIVIDE = 111
@KEY_F1 = 112
@KEY_F2 = 113
@KEY_F3 = 114
@KEY_F4 = 115
@KEY_F5 = 116
@KEY_F6 = 117
@KEY_F7 = 118
@KEY_F8 = 119
@KEY_F9 = 120
@KEY_F10 = 121
@KEY_F11 = 122
@KEY_F12 = 123
@KEY_F13 = 124
@KEY_F14 = 125
@KEY_F15 = 126
@KEY_F16 = 127
@KEY_F17 = 128
@KEY_F18 = 129
@KEY_F19 = 130
@KEY_F20 = 131
@KEY_F21 = 132
@KEY_F22 = 133
@KEY_F23 = 134
@KEY_F24 = 135
@KEY_NUM_LOCK = 144
@KEY_SCROLL_LOCK = 145
@KEY_COMMA = 188
@KEY_PERIOD = 190
@KEY_SLASH = 191
@KEY_BACK_QUOTE = 192
@KEY_OPEN_BRACKET = 219
@KEY_BACK_SLASH = 220
@KEY_CLOSE_BRACKET = 221
@KEY_QUOTE = 222
@KEY_META = 224
*/
21 changes: 19 additions & 2 deletions LEDA_CreateExtensionSettings
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ http://archeia.moe

>>> Special Message~ <<<
----------------------------------------------------------------------------------------------------------
- If you'd like to donate, here's my Ko-Fi Page: https://ko-fi.com/A215KAOs
- Please support my Patreon so I can have more time to create new stuff! (https://www.patreon.com/archeia)

>>> Features <<<
Expand All @@ -33,7 +34,7 @@ Changelog:
** December 15, 2017 (GMT+8:00)
Changed Line 58 from:
"$ -> if $gameMessageNVL.visible then o.dstRect.y = $gameMessageNVL_message.textRenderer.currentY + 20"
to
to
"$ -> if $nvlGameMessage.visible then o.dstRect.y = $nvlGameMessage_message.textRenderer.currentY + 20"

** Version 1.0.0.0
Expand Down Expand Up @@ -61,4 +62,20 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.


>>> Features <<<
----------------------------------------------------------------------------------------------------------
Change keyboard input for specific Visual Novel Maker games.
This plugin overwrites a lot of input functions.
This allows you to use Spacebar and Enter Key to proceed messages.
Backspace will hide the window.

>>> Changelog <<<
----------------------------------------------------------------------------------------------------------
1.0.0.0 - Initial Release (1/25/2019)

>>> Special Message~ <<<
----------------------------------------------------------------------------------------------------------
- If you'd like to donate, here's my Ko-Fi Page: https://ko-fi.com/A215KAO

0 comments on commit f236c48

Please sign in to comment.