From 829efed097abdc6fdd35e1e42e79cd468ad78de9 Mon Sep 17 00:00:00 2001 From: RetroFriends Date: Mon, 3 May 2021 17:13:02 -0400 Subject: [PATCH] Fix to load/save issue and bootstrap object requirement --- .../o_InputCandy_startup_example/Create_0.gml | 8 +++++--- .../o_InputCandy_startup_example.yy | 2 +- scripts/InputCandy/InputCandy.gml | 17 +++++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/objects/o_InputCandy_startup_example/Create_0.gml b/objects/o_InputCandy_startup_example/Create_0.gml index 76f385f..f95e958 100644 --- a/objects/o_InputCandy_startup_example/Create_0.gml +++ b/objects/o_InputCandy_startup_example/Create_0.gml @@ -1,6 +1,5 @@ -Init_InputCandy_Advanced(); - - +Init_InputCandy_Advanced({ + init: function () { // Setup actions for our test game __IC.Action( "Jump", IC_B, IC_space, IC_mouse_right ); @@ -19,3 +18,6 @@ __IC.Action( "Dodge Low", IC_hat0_D, IC_key_S, IC_none ); __IC.Action( "Special", IC_Ltrigger, IC_key_E, IC_none ); __IC.Action( "Inventory", IC_Rshoulder, IC_key_I, IC_none ); __IC.Action( "Help/Menu", IC_back_select, IC_f1, IC_none ); + } +} +); \ No newline at end of file diff --git a/objects/o_InputCandy_startup_example/o_InputCandy_startup_example.yy b/objects/o_InputCandy_startup_example/o_InputCandy_startup_example.yy index 44a73fd..ce3427a 100644 --- a/objects/o_InputCandy_startup_example/o_InputCandy_startup_example.yy +++ b/objects/o_InputCandy_startup_example/o_InputCandy_startup_example.yy @@ -18,7 +18,7 @@ "physicsKinematic": false, "physicsShapePoints": [], "eventList": [ - {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"o_InputCandy_startup_example","path":"objects/o_InputCandy_startup_example/o_InputCandy_startup_example.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, + {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, ], "properties": [], "overriddenProperties": [], diff --git a/scripts/InputCandy/InputCandy.gml b/scripts/InputCandy/InputCandy.gml index ebf5df3..9ff6119 100644 --- a/scripts/InputCandy/InputCandy.gml +++ b/scripts/InputCandy/InputCandy.gml @@ -14,7 +14,7 @@ See Notes > Note1 for more information #macro __ICI __INPUTCANDY.internal // 1. Initialize the "Advanced mode" with the following function call in a Room Creation or during initial game startup. -function Init_InputCandy_Advanced() { __Private_Init_InputCandy(); } +function Init_InputCandy_Advanced( bootstrap ) { __Private_Init_InputCandy(bootstrap); } /* InputCandy's advanced mode is relatively easy to use. @@ -503,7 +503,7 @@ function ICDeviceTypeString(i) { // Called "once" to initialize everything. -function __Private_Init_InputCandy() { +function __Private_Init_InputCandy( bootstrap ) { global.SDLDB_Entries=0; global.SDLDB=[]; @@ -829,6 +829,7 @@ __INPUTCANDY.directionals=[ __INPUTCANDY.SDL_GameControllerDB = []; +bootstrap.init(); __ICI.LoadSettings(); __ICI.Init(); @@ -2682,9 +2683,10 @@ function New_InputCandy_Private() { PostLoadBinding: function( binding ) { var new_json=json_parse(json_stringify(binding)); - var action_for_index = __IC.GetAction( binding.action, binding.group ); - new_json.action = action_for_index.index; - new_json.bound_action.index = action_for_index.index; + var action_index = __IC.GetAction( binding.action, binding.group ); + if ( action_index < 0 ) return false; + new_json.action = action_index; + new_json.bound_action.index = action_index; return new_json; }, @@ -2693,7 +2695,6 @@ function New_InputCandy_Private() { var new_jsonifiable={ action: action.name, group: action.group, - rotate: binding.rotate, calibrations: binding.calibrations, bound_action: json_parse(json_stringify(binding.bound_action)) }; @@ -2741,6 +2742,10 @@ function New_InputCandy_Private() { var k=0; for ( var j=0; j