mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
Controller Support (#1835)
* small fixes for complete tape fixes that the complete ductape was a bit to high * ToeTape Priority change it just looks better this way, when used with full feet tape * Revert "ToeTape Priority change" This reverts commit210037b612
. * Revert "Revert "ToeTape Priority change"" This reverts commita7dd1cfa82
. * Revert "Revert "Revert "ToeTape Priority change""" This reverts commit62864765c6
. * Adds Controller Support (Unfinished) This adds controller support to the game. i=up;k=down;j=up*5;l=down*5 still unsinished and with bugs * ControllerSupport * ControllerSupport * s * Update Drawing.js * Update Common.js * last minute changes ant stick support * last minute fix * preference text to csv * added adjustable sensitivity and fixed the drift issue i have a third party controller with the same drift issue, so this should fix it * resolve preference conflict (hopefully) * jsdoc for controllersupport.js i think, it's better, if the commented console.log() statements stay, because you can't work on that part of the code wihout it. If i should still remove it then i will * removed icon from preference-controller screen it's not needed for that part * adds icon i think, that i am done * added prefixes to variables * fixes + deadzone * Delete .~lock.Text_Preference.csv# * Delete debug.log * Update ControllerSupport.js * add player.controllersettings * Update Text_Preference.csv * Update Common.js * revert drawing.js * fixes and changes * Update ControllerSupport.js * Update Dialog.js * Update Common.js * 4 space -> tab
This commit is contained in:
parent
4e059bc9d1
commit
dd26f62a88
12 changed files with 1021 additions and 32 deletions
BondageClub
BIN
BondageClub/Icons/Controller.png
Normal file
BIN
BondageClub/Icons/Controller.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 1.6 KiB |
|
@ -421,6 +421,7 @@ function LoginResponse(C) {
|
|||
Player.ArousalSettings = C.ArousalSettings;
|
||||
Player.OnlineSettings = C.OnlineSettings;
|
||||
Player.OnlineSharedSettings = C.OnlineSharedSettings;
|
||||
Player.ControllerSettings = C.ControllerSettings;
|
||||
Player.GraphicsSettings = C.GraphicsSettings;
|
||||
Player.NotificationSettings = C.NotificationSettings;
|
||||
Player.WhiteList = ((C.WhiteList == null) || !Array.isArray(C.WhiteList)) ? [] : C.WhiteList;
|
||||
|
|
|
@ -136,7 +136,7 @@ ZoneBlocked,,,This zone is out of reach from another item,,
|
|||
LockZoneBlocked,,,Another item is blocking access to this lock,,
|
||||
AccessBlocked,,,You cannot access your items,,
|
||||
ProgressClick,,,Click here to speed up the progress,,
|
||||
ProgressKeys,,,Alternate keys A and S to speed up,,
|
||||
ProgressKeys,,,Alternate keys A and S or X and Y on a Controller to speed up,,
|
||||
SelectInflateLevel,,,Select inflation level,,
|
||||
GwenHoodSelectStyle,,,Select hood style,,
|
||||
GwenHoodStyleHairOutAccOut,,,Hair out & Accessories out,,
|
||||
|
|
|
|
@ -5,7 +5,7 @@ var PreferenceSafewordConfirm = false;
|
|||
var PreferenceMaidsButton = true;
|
||||
var PreferenceColorPick = "";
|
||||
var PreferenceSubscreen = "";
|
||||
var PreferenceSubscreenList = ["General", "Difficulty", "Restriction", "Chat", "Audio", "Arousal", "Security", "Online", "Visibility", "Immersion", "Graphics", "Notifications"];
|
||||
var PreferenceSubscreenList = ["General", "Difficulty", "Restriction", "Chat", "Audio", "Arousal", "Security", "Online", "Visibility", "Immersion", "Graphics", "Controller", "Notifications"];
|
||||
var PreferenceChatColorThemeSelected = "";
|
||||
var PreferenceChatColorThemeList = ["Light", "Dark", "Light2", "Dark2"];
|
||||
var PreferenceChatColorThemeIndex = 0;
|
||||
|
@ -20,7 +20,11 @@ var PreferenceSettingsSensDepIndex = 0;
|
|||
var PreferenceSettingsVFXList = ["VFXInactive", "VFXSolid", "VFXAnimatedTemp", "VFXAnimated"];
|
||||
var PreferenceSettingsVFXIndex = 0;
|
||||
var PreferenceSettingsVolumeList = [1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
|
||||
var PreferenceSettingsSensitivityList = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
var PreferenceSettingsDeadZoneList = [0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
|
||||
var PreferenceSettingsVolumeIndex = 0;
|
||||
var PreferenceSettingsSensitivityIndex = 13;
|
||||
var PreferenceSettingsDeadZoneIndex = 1;
|
||||
var PreferenceEmailStatusReceived = false;
|
||||
var PreferenceArousalActiveList = ["Inactive", "NoMeter", "Manual", "Hybrid", "Automatic"];
|
||||
var PreferenceArousalActiveIndex = 0;
|
||||
|
@ -50,6 +54,7 @@ var PreferenceDifficultyLevel = null;
|
|||
var PreferenceDifficultyAccept = false;
|
||||
var PreferenceGraphicsFontList = ["Arial", "TimesNewRoman", "Papyrus", "ComicSans", "Impact", "HelveticaNeue", "Verdana", "CenturyGothic", "Georgia", "CourierNew", "Copperplate"];
|
||||
var PreferenceGraphicsFontIndex = 0;
|
||||
var PreferenceCalibrationStage = 0;
|
||||
|
||||
/**
|
||||
* Gets the effect of a sexual activity on the player
|
||||
|
@ -216,6 +221,7 @@ function PreferenceInit(C) {
|
|||
OnlineSettings: C.OnlineSettings,
|
||||
OnlineSharedSettings: C.OnlineSharedSettings,
|
||||
GraphicsSettings: Player.GraphicsSettings,
|
||||
ControllerSettings: C.ControllerSettings,
|
||||
NotificationSettings: Player.NotificationSettings,
|
||||
};
|
||||
|
||||
|
@ -240,6 +246,60 @@ function PreferenceInit(C) {
|
|||
if (typeof C.AudioSettings.PlayItem !== "boolean") C.AudioSettings.PlayItem = false;
|
||||
if (typeof C.AudioSettings.PlayItemPlayerOnly !== "boolean") C.AudioSettings.PlayItemPlayerOnly = false;
|
||||
|
||||
|
||||
// Sets the default controller settings
|
||||
if (!C.ControllerSettings) C.ControllerSettings = {
|
||||
ControllerSensitivity: 5,
|
||||
ControllerDeadZone: 0.01,
|
||||
ControllerA: 1,
|
||||
ControllerB: 0,
|
||||
ControllerX: 3,
|
||||
ControllerY: 2,
|
||||
ControllerStickUpDown: 1,
|
||||
ControllerStickLeftRight: 0,
|
||||
ControllerStickRight: 1,
|
||||
ControllerStickDown: 1,
|
||||
ControllerDPadUp: 4,
|
||||
ControllerDPadDown: 5,
|
||||
ControllerDPadLeft: 6,
|
||||
ControllerDPadRight: 7,
|
||||
};
|
||||
if (typeof C.ControllerSettings.ControllerSensitivity !== "number") C.ControllerSettings.ControllerSensitivity = 5;
|
||||
if (typeof C.ControllerSettings.ControllerDeadZone !== "number") C.ControllerSettings.ControllerDeadZone = 0.01;
|
||||
if (typeof C.ControllerSettings.ControllerA !== "number") C.ControllerSettings.ControllerA = 1;
|
||||
if (typeof C.ControllerSettings.ControllerB !== "number") C.ControllerSettings.ControllerB = 0;
|
||||
if (typeof C.ControllerSettings.ControllerX !== "number") C.ControllerSettings.ControllerX = 3;
|
||||
if (typeof C.ControllerSettings.ControllerY !== "number") C.ControllerSettings.ControllerY = 2;
|
||||
if (typeof C.ControllerSettings.ControllerStickUpDown !== "number") C.ControllerSettings.ControllerStickUpDown = 1;
|
||||
if (typeof C.ControllerSettings.ControllerStickLeftRight !== "number") C.ControllerSettings.ControllerStickLeftRight = 0;
|
||||
if (typeof C.ControllerSettings.ControllerStickRight !== "number") C.ControllerSettings.ControllerStickRight = 1;
|
||||
if (typeof C.ControllerSettings.ControllerStickDown !== "number") C.ControllerSettings.ControllerStickDown = 1;
|
||||
if (typeof C.ControllerSettings.ControllerDPadUp !== "number") C.ControllerSettings.ControllerDPadUp = 4;
|
||||
if (typeof C.ControllerSettings.ControllerDPadDown !== "number") C.ControllerSettings.ControllerDPadDown = 5;
|
||||
if (typeof C.ControllerSettings.ControllerDPadLeft !== "number") C.ControllerSettings.ControllerDPadLeft = 6;
|
||||
if (typeof C.ControllerSettings.ControllerDPadRight !== "number") C.ControllerSettings.ControllerDPadRight = 7;
|
||||
if (typeof C.ControllerSettings.ControllerActive !== "boolean") C.ControllerSettings.ControllerActive = false;
|
||||
|
||||
ControllerSensitivity = C.ControllerSettings.ControllerSensitivity;
|
||||
ControllerDeadZone = C.ControllerSettings.ControllerDeadZone;
|
||||
PreferenceSettingsSensitivityIndex = PreferenceSettingsSensitivityList.indexOf(Player.ControllerSettings.ControllerSensitivity);
|
||||
PreferenceSettingsDeadZoneIndex = PreferenceSettingsDeadZoneList.indexOf(Player.ControllerSettings.ControllerDeadZone);
|
||||
ControllerA = C.ControllerSettings.ControllerA;
|
||||
ControllerB = C.ControllerSettings.ControllerB;
|
||||
ControllerX = C.ControllerSettings.ControllerX;
|
||||
ControllerY = C.ControllerSettings.ControllerY;
|
||||
ControllerStickUpDown = C.ControllerSettings.ControllerStickUpDown;
|
||||
ControllerStickLeftRight = C.ControllerSettings.ControllerStickLeftRight;
|
||||
ControllerStickRight = C.ControllerSettings.ControllerStickRight;
|
||||
ControllerStickDown = C.ControllerSettings.ControllerStickDown;
|
||||
ControllerDPadUp = C.ControllerSettings.ControllerDPadUp;
|
||||
ControllerDPadDown = C.ControllerSettings.ControllerDPadDown;
|
||||
ControllerDPadLeft = C.ControllerSettings.ControllerDPadLeft;
|
||||
ControllerDPadRight = C.ControllerSettings.ControllerDPadRight;
|
||||
ControllerActive = C.ControllerSettings.ControllerActive;
|
||||
|
||||
|
||||
|
||||
// Sets the default arousal settings
|
||||
if (!C.ArousalSettings) C.ArousalSettings = { Active: "Hybrid", Visible: "Access", ShowOtherMeter: true, AffectExpression: true, AffectStutter: "All", Progress: 0, ProgressTimer: 0, VibratorLevel: 0, VFX: "VFXAnimatedTemp", ChangeTime: CommonTime(), Activity: [], Zone: [] };
|
||||
if (typeof C.ArousalSettings.Active !== "string") C.ArousalSettings.Active = "Hybrid";
|
||||
|
@ -393,6 +453,7 @@ function PreferenceInit(C) {
|
|||
ArousalSettings: Player.ArousalSettings,
|
||||
OnlineSettings: Player.OnlineSettings,
|
||||
OnlineSharedSettings: Player.OnlineSharedSettings,
|
||||
ControllerSettings: Player.ControllerSettings,
|
||||
GraphicsSettings: Player.GraphicsSettings,
|
||||
NotificationSettings: Player.NotificationSettings,
|
||||
};
|
||||
|
@ -440,7 +501,7 @@ function PreferenceLoad() {
|
|||
PreferenceChatEnterLeaveIndex = (PreferenceChatEnterLeaveList.indexOf(Player.ChatSettings.EnterLeave) < 0) ? 0 : PreferenceChatEnterLeaveList.indexOf(Player.ChatSettings.EnterLeave);
|
||||
PreferenceChatMemberNumbersIndex = (PreferenceChatMemberNumbersList.indexOf(Player.ChatSettings.MemberNumbers) < 0) ? 0 : PreferenceChatMemberNumbersList.indexOf(Player.ChatSettings.MemberNumbers);
|
||||
PreferenceSettingsSensDepIndex = (PreferenceSettingsSensDepList.indexOf(Player.GameplaySettings.SensDepChatLog) < 0) ? 0 : PreferenceSettingsSensDepList.indexOf(Player.GameplaySettings.SensDepChatLog);
|
||||
PreferenceSettingsVolumeIndex = (PreferenceSettingsVolumeList.indexOf(Player.AudioSettings.Volume) < 0) ? 0 : PreferenceSettingsVolumeList.indexOf(Player.AudioSettings.Volume);
|
||||
PreferenceSettingsVolumeIndex = (PreferenceSettingsVolumeList.indexOf(Player.AudioSettings.Volume) < 0) ? 0 : PreferenceSettingsVolumeList.indexOf(Player.AudioSettings.Volume);
|
||||
PreferenceArousalActiveIndex = (PreferenceArousalActiveList.indexOf(Player.ArousalSettings.Active) < 0) ? 0 : PreferenceArousalActiveList.indexOf(Player.ArousalSettings.Active);
|
||||
PreferenceSettingsVFXIndex = (PreferenceSettingsVFXList.indexOf(Player.ArousalSettings.VFX) < 0) ? 0 : PreferenceSettingsVFXList.indexOf(Player.ArousalSettings.VFX);
|
||||
PreferenceArousalVisibleIndex = (PreferenceArousalVisibleList.indexOf(Player.ArousalSettings.Visible) < 0) ? 0 : PreferenceArousalVisibleList.indexOf(Player.ArousalSettings.Visible);
|
||||
|
@ -488,10 +549,15 @@ function PreferenceRun() {
|
|||
MainCanvas.textAlign = "center";
|
||||
|
||||
// Draw all the buttons to access the submenus
|
||||
for (let A = 0; A < PreferenceSubscreenList.length; A++) {
|
||||
DrawButton(500 + 420 * Math.floor(A / 7), 160 + 110 * (A % 7), 400, 90, "", "White", "Icons/" + PreferenceSubscreenList[A] + ".png");
|
||||
DrawTextFit(TextGet("Homepage" + PreferenceSubscreenList[A]), 745 + 420 * Math.floor(A / 7), 205 + 110 * (A % 7), 310, "Black");
|
||||
}
|
||||
for (let A = 0; A < PreferenceSubscreenList.length; A++) {
|
||||
ControllerIgnoreButton = true;
|
||||
DrawButton(500 + 420 * Math.floor(A / 7), 160 + 110 * (A % 7), 400, 90, "", "White", "Icons/" + PreferenceSubscreenList[A] + ".png");
|
||||
ControllerIgnoreButton = false;
|
||||
DrawTextFit(TextGet("Homepage" + PreferenceSubscreenList[A]), 745 + 420 * Math.floor(A / 7), 205 + 110 * (A % 7), 310, "Black");
|
||||
if (ControllerActive == true) {
|
||||
setButton(745 + 420 * Math.floor(A / 7), 205 + 110 * (A % 7));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -613,8 +679,10 @@ function PreferenceSubscreenRestrictionRun() {
|
|||
* @returns {void} - Nothing
|
||||
*/
|
||||
function PreferenceClick() {
|
||||
|
||||
// Pass the click into the opened subscreen
|
||||
if (ControllerActive == true) {
|
||||
ClearButtons();
|
||||
}
|
||||
// Pass the click into the opened subscreen
|
||||
if (PreferenceSubscreen != "") return CommonDynamicFunction("PreferenceSubscreen" + PreferenceSubscreen + "Click()");
|
||||
|
||||
// Exit button
|
||||
|
@ -816,6 +884,7 @@ function PreferenceExit() {
|
|||
ArousalSettings: Player.ArousalSettings,
|
||||
OnlineSettings: Player.OnlineSettings,
|
||||
OnlineSharedSettings: Player.OnlineSharedSettings,
|
||||
ControllerSettings: Player.ControllerSettings,
|
||||
GraphicsSettings: Player.GraphicsSettings,
|
||||
NotificationSettings: Player.NotificationSettings,
|
||||
LimitedItems: Player.LimitedItems,
|
||||
|
@ -844,6 +913,77 @@ function PreferenceSubscreenAudioRun() {
|
|||
DrawButton(1815, 75, 90, 90, "", "White", "Icons/Exit.png");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the audio preferences for the player. Redirected to from the main Run function if the player is in the audio settings subscreen
|
||||
* @returns {void} - Nothing
|
||||
*/
|
||||
function PreferenceSubscreenControllerRun() {
|
||||
if (PreferenceCalibrationStage == 0) {
|
||||
DrawCharacter(Player, 50, 50, 0.9);
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawText(TextGet("ControllerPreferences"), 500, 125, "Black", "Gray");
|
||||
DrawText(TextGet("Sensitivity"), 800, 225, "Black", "Gray");
|
||||
DrawText(TextGet("DeadZone"), 800, 625, "Black", "Gray");
|
||||
DrawCheckbox(500, 272, 64, 64, TextGet("ControllerActive"), ControllerActive);
|
||||
|
||||
DrawButton(500, 380, 400, 90, "", "White");
|
||||
DrawTextFit(TextGet("MapButtons"), 590, 425, 310, "Black");
|
||||
|
||||
DrawButton(500, 480, 400, 90, "", "White");
|
||||
DrawTextFit(TextGet("MapSticks"), 590, 525, 310, "Black");
|
||||
|
||||
MainCanvas.textAlign = "center";
|
||||
DrawBackNextButton(500, 193, 250, 64, Player.ControllerSettings.ControllerSensitivity, "White", "",
|
||||
() => PreferenceSettingsSensitivityList[(PreferenceSettingsSensitivityIndex + PreferenceSettingsSensitivityList.length - 1) % PreferenceSettingsSensitivityList.length],
|
||||
() => PreferenceSettingsSensitivityList[(PreferenceSettingsSensitivityIndex + 1) % PreferenceSettingsSensitivityList.length]);
|
||||
MainCanvas.textAlign = "center";
|
||||
DrawBackNextButton(500, 593, 250, 64, Player.ControllerSettings.ControllerDeadZone, "White", "",
|
||||
() => PreferenceSettingsDeadZoneList[(PreferenceSettingsDeadZoneIndex + PreferenceSettingsDeadZoneList.length - 1) % PreferenceSettingsDeadZoneList.length],
|
||||
() => PreferenceSettingsDeadZoneList[(PreferenceSettingsDeadZoneIndex + 1) % PreferenceSettingsDeadZoneList.length] );
|
||||
}
|
||||
if (PreferenceCalibrationStage == 101) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("MoveLeftStickUp"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 102) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("MoveLeftStickRight"), 590, 425, 310, "Black");
|
||||
}
|
||||
DrawButton(1815, 75, 90, 90, "", "White", "Icons/Exit.png");
|
||||
if (PreferenceCalibrationStage == 1) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressA"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 2) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressB"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 3) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressX"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 4) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressY"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 5) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressUpOnDpad"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 6) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressDownOnDpad"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 7) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressLeftOnDpad"), 590, 425, 310, "Black");
|
||||
}
|
||||
if (PreferenceCalibrationStage == 8) {
|
||||
MainCanvas.textAlign = "left";
|
||||
DrawTextFit(TextGet("PressRightOnDpad"), 590, 425, 310, "Black");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the chat preferences for the player. Redirected to from the main Run function if the player is in the chat settings subscreen.
|
||||
* @returns {void} - Nothing
|
||||
|
@ -1096,6 +1236,52 @@ function PreferenceSubscreenAudioClick() {
|
|||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Handles click events for the audio preference settings. Redirected from the main Click function.
|
||||
* @returns {void} - Nothing
|
||||
*/
|
||||
function PreferenceSubscreenControllerClick() {
|
||||
if ((MouseX >= 1815) && (MouseX < 1905) && (MouseY >= 75) && (MouseY < 165)) {
|
||||
PreferenceSubscreen = "";
|
||||
PreferenceCalibrationStage = 0;
|
||||
Calibrating = false;
|
||||
}
|
||||
if (PreferenceCalibrationStage == 0) {
|
||||
|
||||
|
||||
if ((MouseX >= 500) && (MouseX < 750) && (MouseY >= 193) && (MouseY < 257)) {
|
||||
if (MouseX <= 625) PreferenceSettingsSensitivityIndex = (PreferenceSettingsSensitivityList.length + PreferenceSettingsSensitivityIndex - 1) % PreferenceSettingsSensitivityList.length;
|
||||
else PreferenceSettingsSensitivityIndex = (PreferenceSettingsSensitivityIndex + 1) % PreferenceSettingsSensitivityList.length;
|
||||
Player.ControllerSettings.ControllerSensitivity = PreferenceSettingsSensitivityList[PreferenceSettingsSensitivityIndex];
|
||||
ControllerSensitivity = Player.ControllerSettings.ControllerSensitivity;
|
||||
}
|
||||
if ((MouseX >= 500) && (MouseX < 750) && (MouseY >= 593) && (MouseY < 657)) {
|
||||
if (MouseX <= 625) PreferenceSettingsDeadZoneIndex = (PreferenceSettingsDeadZoneList.length + PreferenceSettingsDeadZoneIndex - 1) % PreferenceSettingsDeadZoneList.length;
|
||||
else PreferenceSettingsDeadZoneIndex = (PreferenceSettingsDeadZoneIndex + 1) % PreferenceSettingsDeadZoneList.length;
|
||||
Player.ControllerSettings.ControllerDeadZone = PreferenceSettingsDeadZoneList[PreferenceSettingsDeadZoneIndex];
|
||||
ControllerDeadZone = Player.ControllerSettings.ControllerDeadZone;
|
||||
}
|
||||
|
||||
if (MouseIn(590, 400, 310, 90)) {
|
||||
//console.log("CalibrateClick")
|
||||
PreferenceCalibrationStage = 1;
|
||||
Calibrating = true;
|
||||
}
|
||||
if (MouseIn(590, 500, 310, 90)) {
|
||||
//console.log("CalibrateClick")
|
||||
PreferenceCalibrationStage = 101;
|
||||
Calibrating = true;
|
||||
}
|
||||
|
||||
if ((MouseX >= 500) && (MouseX < 564)) {
|
||||
if ((MouseY >= 272) && (MouseY < 336)) {
|
||||
ControllerActive = !ControllerActive;
|
||||
Player.ControllerSettings.ControllerActive = ControllerActive;
|
||||
ClearButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the click events for the chat settings of a player. Redirected from the main Click function.
|
||||
|
|
|
@ -10,6 +10,7 @@ VisibilityPreferences,- Item Preferences -
|
|||
VFXPreferences,- Graphical Preferences -
|
||||
OnlinePreferences,- Online Preferences -
|
||||
ImmersionPreferences,- Immersion Preferences -
|
||||
ControllerPreferences,- Controller Preferences -
|
||||
NotificationsPreferences,- Notification Preferences -
|
||||
HomepageGeneral,General
|
||||
HomepageDifficulty,Difficulty
|
||||
|
@ -22,6 +23,7 @@ HomepageVisibility,Item Visibility
|
|||
HomepageOnline,Online
|
||||
HomepageImmersion,Immersion
|
||||
HomepageGraphics,Graphics
|
||||
HomepageController,Controller
|
||||
HomepageNotifications,Notifications
|
||||
DifficultyTitle,The difficulty mode enforces BDSM restrictions in multi-player only. Click for details.
|
||||
DifficultyLevel0,Roleplay
|
||||
|
@ -239,6 +241,21 @@ Georgia,Georgia
|
|||
CourierNew,Courier New
|
||||
Copperplate,Copperplate
|
||||
GraphicsInvertRoom,Flip the room vertically when upside-down
|
||||
Sensitivity,Sensitivity
|
||||
ControllerActive,Controller Active
|
||||
MapButtons,Map Buttons
|
||||
MapSticks,Map Sticks
|
||||
MoveLeftStickUp,move left stick up
|
||||
MoveLeftStickRight,move left stick right
|
||||
PressA,Press A
|
||||
PressB,Press B
|
||||
PressX,Press X
|
||||
PressY,Press Y
|
||||
PressUpOnDpad,Press Up on Dpad
|
||||
PressDownOnDpad,Press Down on Dpad
|
||||
PressLeftOnDpad,Press Left on Dpad
|
||||
PressRightOnDpad,Press Right on Dpad
|
||||
DeadZone,Dead Zone
|
||||
NotificationsChatRooms,Raise notifications for:
|
||||
NotificationsBeeps,Missed beeps
|
||||
NotificationsChat,Unread messages in chat rooms
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 81.
|
|
@ -12,8 +12,8 @@ var CutsceneStage = 0;
|
|||
var Notifications = {};
|
||||
|
||||
/**
|
||||
* A map of keys to common font stack definitions. Each stack definition is a
|
||||
* two-item array whose first item is an ordered list of fonts, and whose
|
||||
* A map of keys to common font stack definitions. Each stack definition is a
|
||||
* two-item array whose first item is an ordered list of fonts, and whose
|
||||
* second item is the generic fallback font family (e.g. sans-serif, serif,
|
||||
* etc.)
|
||||
* @constant
|
||||
|
@ -230,9 +230,16 @@ function CommonKeyDown() {
|
|||
if (CurrentCharacter == null) {
|
||||
if (typeof window[CurrentScreen + "KeyDown"] === "function")
|
||||
CommonDynamicFunction(CurrentScreen + "KeyDown()");
|
||||
if (ControllerActive == true) {
|
||||
ControllerSupportKeyDown();
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
DialogKeyDown();
|
||||
if (ControllerActive == true) {
|
||||
ControllerSupportKeyDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,6 +349,9 @@ function CommonSetScreen(NewModule, NewScreen) {
|
|||
TextLoad();
|
||||
if (typeof window[CurrentScreen + "Load"] === "function")
|
||||
CommonDynamicFunction(CurrentScreen + "Load()");
|
||||
if (ControllerActive == true) {
|
||||
ClearButtons();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
705
BondageClub/Scripts/ControllerSupport.js
Normal file
705
BondageClub/Scripts/ControllerSupport.js
Normal file
|
@ -0,0 +1,705 @@
|
|||
var ControllerButtonsX = [];//there probably is a way to use just one list, but i don't want to bother and this works anyway
|
||||
var ControllerButtonsY = [];
|
||||
var ControllerActive = true;
|
||||
var ControllerCurrentButton = 0;
|
||||
var ControllerButtonsRepeat = true;
|
||||
var ControllerAxesRepeat = false;
|
||||
var ControllerIgnoreButton = false;
|
||||
var ControllerAxesRepeatTime = 0;
|
||||
var ControllerA = 1;
|
||||
var ControllerB = 0;
|
||||
var ControllerX = 3;
|
||||
var ControllerY = 2;
|
||||
var ControllerStickUpDown = 1;
|
||||
var ControllerStickLeftRight = 0;
|
||||
var ControllerStickRight = 1;
|
||||
var ControllerStickDown = 1;
|
||||
var ControllerDPadUp = 4;
|
||||
var ControllerDPadDown = 5;
|
||||
var ControllerDPadLeft = 6;
|
||||
var ControllerDPadRight = 7;
|
||||
var Calibrating = false;
|
||||
var ControllerStick = false;
|
||||
var waitasec = false;
|
||||
var ControllerSensitivity = 5;
|
||||
var ControllerIgnoreStick = [];
|
||||
var ControllerDeadZone = 0.01;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*removes all buttons from the lists
|
||||
*/
|
||||
function ClearButtons() {
|
||||
ControllerButtonsX = [];
|
||||
ControllerButtonsY = [];
|
||||
}
|
||||
/**
|
||||
* adds a button to the lists
|
||||
* @param {any} X X value of the button
|
||||
* @param {any} Y Y value of the button
|
||||
*/
|
||||
function setButton(X, Y) {
|
||||
if (ControllerIgnoreButton == false) {
|
||||
X += 10;
|
||||
Y += 10;
|
||||
if (!ButtonExists(X, Y)) {
|
||||
ControllerButtonsX.push(X);
|
||||
ControllerButtonsY.push(Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* checks, wether a button is already in the lists (i realise now, that i could have used .includes but it works)
|
||||
* @param {any} X X value of the button
|
||||
* @param {any} Y Y value of the button
|
||||
*/
|
||||
function ButtonExists(X, Y) {
|
||||
var g = 0;
|
||||
var ButtonExists = false;
|
||||
while (g < ControllerButtonsX.length) {
|
||||
if (ControllerButtonsX[g] == X && ControllerButtonsY[g] == Y) {
|
||||
ButtonExists = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
return ButtonExists;
|
||||
}
|
||||
|
||||
/**
|
||||
* handles the sitck input
|
||||
* @param {any} axes the raw data of all axes of the controller
|
||||
*/
|
||||
function ControllerAxis(axes) {
|
||||
|
||||
//if a value is over 1, it is from a d-pad (some d-pads register as buttons, some d-pads register like this)
|
||||
var g = 0;
|
||||
while (g < axes.length) {
|
||||
if (Math.abs(axes[g]) > 1 && ControllerIgnoreStick.includes(g) == false) {
|
||||
ControllerIgnoreStick.push(g);
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
if (Calibrating == false) {
|
||||
var g = 0;
|
||||
while (g < axes.length && ControllerStick == false) {
|
||||
if (Math.abs(axes[g]) > 0.1 && ControllerIgnoreStick.includes(g) == false) {
|
||||
ControllerStick = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
if (ControllerStick == true && ControllerActive == true) {
|
||||
if (Math.abs(axes[ControllerStickUpDown]) > ControllerDeadZone) {
|
||||
MouseY += axes[ControllerStickUpDown] * ControllerStickDown * ControllerSensitivity;
|
||||
}
|
||||
if (Math.abs(axes[ControllerStickLeftRight]) > ControllerDeadZone) {
|
||||
MouseX += axes[ControllerStickLeftRight] * ControllerStickRight * ControllerSensitivity;
|
||||
}
|
||||
if (MouseX < 0) {
|
||||
MouseX = 0;
|
||||
}
|
||||
if (MouseX > 2000) {
|
||||
MouseX = 2000;
|
||||
}
|
||||
if (MouseY < 0) {
|
||||
MouseY = 0;
|
||||
}
|
||||
if (MouseY > 1000) {
|
||||
MouseY = 1000;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (Calibrating == true) {
|
||||
if (PreferenceCalibrationStage == 101) {
|
||||
var g = 0;
|
||||
var f = false;
|
||||
while (g < axes.length && f == false) {
|
||||
if (Math.abs(axes[g]) > 0.8 && ControllerIgnoreStick.includes(g) == false) {
|
||||
ControllerStickUpDown = g;
|
||||
Player.ControllerSettings.ControllerStickUpDown = g;
|
||||
if (axes[g] > 0) {
|
||||
ControllerStickDown = -1;
|
||||
Player.ControllerSettings.ControllerStickDown = -1;
|
||||
}
|
||||
if (axes[g] < 0) {
|
||||
ControllerStickDown = 1;
|
||||
Player.ControllerSettings.ControllerStickDown = 1;
|
||||
}
|
||||
waitasec = true;
|
||||
PreferenceCalibrationStage = 102;
|
||||
f = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
if (PreferenceCalibrationStage == 102) {
|
||||
if (waitasec == true) {
|
||||
var g = 0;
|
||||
var f = false;
|
||||
while (g < axes.length) {
|
||||
if (Math.abs(axes[g]) > 0.1 && ControllerIgnoreStick.includes(g) == false) {
|
||||
f = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
if (f == false) {
|
||||
waitasec = false;
|
||||
}
|
||||
}
|
||||
if (waitasec == false) {
|
||||
var g = 0;
|
||||
var f = false;
|
||||
while (g < axes.length && f == false) {
|
||||
if (Math.abs(axes[g]) > 0.8 && ControllerIgnoreStick.includes(g) == false) {
|
||||
ControllerStickLeftRight = g;
|
||||
Player.ControllerSettings.ControllerStickLeftRight = g;
|
||||
if (axes[g] > 0) {
|
||||
ControllerStickRight = 1;
|
||||
Player.ControllerSettings.ControllerStickRight = 1;
|
||||
}
|
||||
if (axes[g] < 0) {
|
||||
ControllerStickRight = -1;
|
||||
Player.ControllerSettings.ControllerStickRight = -1;
|
||||
}
|
||||
PreferenceCalibrationStage = 0;
|
||||
Calibrating = false;
|
||||
f = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* handles button input
|
||||
* @param {any} buttons raw buttons data
|
||||
*/
|
||||
function ControllerButton(buttons) {
|
||||
if (ControllerActive == true) {
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (Calibrating == false) {
|
||||
if (buttons[ControllerA].pressed == true) {
|
||||
ControllerClick();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
|
||||
if (buttons[ControllerB].pressed == true) {
|
||||
if (typeof window[CurrentScreen + "Exit"] === "function") {
|
||||
window[CurrentScreen + "Exit"]();
|
||||
} else if ((CurrentCharacter != null) && Array.isArray(DialogMenuButton) && (DialogMenuButton.indexOf("Exit") >= 0)) {
|
||||
if (!DialogLeaveFocusItem())
|
||||
DialogLeaveItemMenu();
|
||||
} else if ((CurrentCharacter != null) && (CurrentScreen == "ChatRoom")) {
|
||||
DialogLeave();
|
||||
} else if ((CurrentCharacter == null) && (CurrentScreen == "ChatRoom") && (document.getElementById("TextAreaChatLog") != null)) {
|
||||
ElementScrollToEnd("TextAreaChatLog");
|
||||
}
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
|
||||
if (buttons[ControllerX].pressed == true) {
|
||||
KeyPress = 65;
|
||||
DialogKeyDown();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
|
||||
if (buttons[ControllerY].pressed == true) {
|
||||
KeyPress = 97;
|
||||
DialogKeyDown();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
|
||||
if (buttons[ControllerDPadUp].pressed == true) {
|
||||
ControllerStick = true;
|
||||
ControllerUp();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
if (buttons[ControllerDPadDown].pressed == true) {
|
||||
ControllerStick = true;
|
||||
ControllerDown();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
if (buttons[ControllerDPadLeft].pressed == true) {
|
||||
ControllerStick = true;
|
||||
ControllerLeft();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
if (buttons[ControllerDPadRight].pressed == true) {
|
||||
ControllerStick = true;
|
||||
ControllerRight();
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (Calibrating == true) {
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 1) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerA = g;
|
||||
Player.ControllerSettings.ControllerA = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 2;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 2) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerB = g;
|
||||
Player.ControllerSettings.ControllerB = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 3;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 3) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerX = g;
|
||||
Player.ControllerSettings.ControllerX = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 4;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 4) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerY = g;
|
||||
Player.ControllerSettings.ControllerY = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 5;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 5) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerDPadUp = g;
|
||||
Player.ControllerSettings.ControllerDPadUp = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 6;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 6) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerDPadDown = g;
|
||||
Player.ControllerSettings.ControllerDPadDown = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 7;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 7) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerDPadLeft = g;
|
||||
Player.ControllerSettings.ControllerDPadLeft = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 8;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ControllerButtonsRepeat == false) {
|
||||
if (PreferenceCalibrationStage == 8) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
ControllerDPadRight = g;
|
||||
Player.ControllerSettings.ControllerDPadRight = g;
|
||||
h = true;
|
||||
PreferenceCalibrationStage = 0;
|
||||
Calibrating = 0;
|
||||
ControllerButtonsRepeat = true;
|
||||
}
|
||||
g += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ControllerButtonsRepeat == true) {
|
||||
var g = 0;
|
||||
var h = false;
|
||||
while (g < buttons.length && h == false) {
|
||||
if (buttons[g].pressed == true) {
|
||||
h = true;
|
||||
}
|
||||
g += 1
|
||||
}
|
||||
if (h == false) {
|
||||
ControllerButtonsRepeat = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//uncomment to test it with keyboard
|
||||
/**
|
||||
* handles keyboard inputs in controller mode
|
||||
* @returns {void} Nothing
|
||||
*/
|
||||
function ControllerSupportKeyDown() {
|
||||
/*i*/// if (KeyPress == 105) ControllerUp();
|
||||
/*k*/// if (KeyPress == 107) ControllerDown();
|
||||
/*j*/// if (KeyPress == 106) ControllerLeft();
|
||||
/*l*/// if (KeyPress == 108) ControllerRight();
|
||||
/*space*///if (KeyPress == 32) ControllerClick();
|
||||
}
|
||||
/**
|
||||
* A -> Click
|
||||
*/
|
||||
function ControllerClick() {
|
||||
if (ControllerActive == true) {
|
||||
if (ControllerStick == false) {
|
||||
MouseX = ControllerButtonsX[ControllerCurrentButton];
|
||||
MouseY = ControllerButtonsY[ControllerCurrentButton];
|
||||
}
|
||||
CommonClick();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* moves the pointer to either a button in a straight line above it or the closest one above
|
||||
* (all the commented stuff in the function is for debugging)
|
||||
*/
|
||||
function ControllerUp() {
|
||||
MouseX = ControllerButtonsX[ControllerCurrentButton];
|
||||
MouseY = ControllerButtonsY[ControllerCurrentButton];
|
||||
// console.log("starting search");
|
||||
if (ControllerCurrentButton > ControllerButtonsX.length) ControllerCurrentButton = 0;
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var found = false;
|
||||
while (CurrentY > 0 && found == false) {
|
||||
CurrentY -= 1;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("round 2");
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var CurrentXX = ControllerButtonsX[ControllerCurrentButton];
|
||||
while (CurrentY > 0 && found == false) {
|
||||
CurrentY -= 1;
|
||||
var OffsetX = 0;
|
||||
while (OffsetX < 2000 && found == false) {
|
||||
OffsetX += 1;
|
||||
CurrentX = CurrentXX + OffsetX;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
CurrentX = CurrentXX - OffsetX;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
//console.log(OffsetX);
|
||||
}
|
||||
//console.log("searching round 2 Y=" + CurrentY);
|
||||
//console.log("searching round 2 MouseX, MouseY=" + MouseX + ", " + MouseY);
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("not found");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* same as ControllerUp()
|
||||
*/
|
||||
function ControllerDown() {
|
||||
MouseX = ControllerButtonsX[ControllerCurrentButton];
|
||||
MouseY = ControllerButtonsY[ControllerCurrentButton];
|
||||
// console.log("starting search");
|
||||
if (ControllerCurrentButton > ControllerButtonsX.length) ControllerCurrentButton = 0;
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var found = false;
|
||||
while (CurrentY < 1000 && found == false) {
|
||||
CurrentY += 1;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
}
|
||||
if (CurrentY >= 1000 && found == false) {
|
||||
// console.log("round 2");
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var CurrentXX = ControllerButtonsX[ControllerCurrentButton];
|
||||
while (CurrentY < 1000 && found == false) {
|
||||
CurrentY += 1;
|
||||
var OffsetX = 0;
|
||||
while (OffsetX < 2000 && found == false) {
|
||||
OffsetX += 1;
|
||||
CurrentX = CurrentXX + OffsetX;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
CurrentX = CurrentXX - OffsetX;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
//console.log(OffsetX);
|
||||
}
|
||||
//console.log("searching round 2 Y=" + CurrentY);
|
||||
//console.log("searching round 2 MouseX, MouseY=" + MouseX + ", " + MouseY);
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("not found");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* same as ControllerUp()
|
||||
*/
|
||||
function ControllerLeft() {
|
||||
MouseX = ControllerButtonsX[ControllerCurrentButton];
|
||||
MouseY = ControllerButtonsY[ControllerCurrentButton];
|
||||
// console.log("starting search");
|
||||
if (ControllerCurrentButton > ControllerButtonsX.length) ControllerCurrentButton = 0;
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var found = false;
|
||||
while (CurrentX > 0 && found == false) {
|
||||
CurrentX -= 1;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("round 2");
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var CurrentYY = ControllerButtonsY[ControllerCurrentButton];
|
||||
while (CurrentX > 0 && found == false) {
|
||||
CurrentX -= 1;
|
||||
var OffsetY = 0;
|
||||
while (OffsetY < 1000 && found == false) {
|
||||
OffsetY += 1;
|
||||
CurrentY = CurrentYY + OffsetY;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
CurrentY = CurrentYY - OffsetY;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
//console.log(OffsetX);
|
||||
}
|
||||
//console.log("searching round 2 Y=" + CurrentY);
|
||||
//console.log("searching round 2 MouseX, MouseY=" + MouseX + ", " + MouseY);
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("not found");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* same as ControllerUp()
|
||||
*/
|
||||
function ControllerRight() {
|
||||
MouseX = ControllerButtonsX[ControllerCurrentButton];
|
||||
MouseY = ControllerButtonsY[ControllerCurrentButton];
|
||||
// console.log("starting search");
|
||||
if (ControllerCurrentButton > ControllerButtonsX.length) ControllerCurrentButton = 0;
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var found = false;
|
||||
while (CurrentX <= 2000 && found == false) {
|
||||
CurrentX += 1;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("round 2");
|
||||
var CurrentY = ControllerButtonsY[ControllerCurrentButton];
|
||||
var CurrentX = ControllerButtonsX[ControllerCurrentButton];
|
||||
var CurrentYY = ControllerButtonsY[ControllerCurrentButton];
|
||||
while (CurrentX < 2000 && found == false) {
|
||||
CurrentX += 1;
|
||||
var OffsetY = 0;
|
||||
while (OffsetY < 1000 && found == false) {
|
||||
OffsetY += 1;
|
||||
CurrentY = CurrentYY + OffsetY;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
CurrentY = CurrentYY - OffsetY;
|
||||
var f = 0;
|
||||
while (f < ControllerButtonsX.length && found == false) {
|
||||
if (CurrentY == ControllerButtonsY[f] && CurrentX == ControllerButtonsX[f]) {
|
||||
found = true;
|
||||
MouseX = CurrentX;
|
||||
MouseY = CurrentY;
|
||||
ControllerCurrentButton = f;
|
||||
//console.log("found at X=" + CurrentX + ", Y=" + CurrentY);
|
||||
}
|
||||
f += 1;
|
||||
//console.log("searching: " + CurrentY + " " + CurrentX); //debug
|
||||
}
|
||||
//console.log(OffsetX);
|
||||
}
|
||||
//console.log("searching round 2 Y=" + CurrentY);
|
||||
//console.log("searching round 2 MouseX, MouseY=" + MouseX + ", " + MouseY);
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
// console.log("not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2082,9 +2082,11 @@ function DialogDrawItemMenu(C) {
|
|||
DrawRect(X, Y, 225, 275, (DialogItemPermissionMode && C.ID == 0) ?
|
||||
(Item.Worn ? "gray" : Block ? Hover ? "red" : "pink" : Limit ? Hover ? "orange" : "#fed8b1" : Hover ? "green" : "lime") :
|
||||
((Hover && !Blocked) ? "cyan" : Item.Worn ? "pink" : Blocked ? "red" : Unusable ? "gray" : "white"));
|
||||
if (!CharacterAppearanceItemIsHidden(Item.Asset.Name, Item.Asset.Group.Name))
|
||||
if (!CharacterAppearanceItemIsHidden(Item.Asset.Name, Item.Asset.Group.Name)) {
|
||||
if (ControllerActive == true) setButton(X + 2, Y + 2);
|
||||
if (Item.Worn && InventoryItemHasEffect(InventoryGet(C, Item.Asset.Group.Name), "Vibrating", true)) DrawImageResize("Assets/" + Item.Asset.Group.Family + "/" + Item.Asset.DynamicGroupName + "/Preview/" + Item.Asset.Name + ".png", X + Math.floor(Math.random() * 3) + 1, Y + Math.floor(Math.random() * 3) + 1, 221, 221);
|
||||
else DrawImageResize("Assets/" + Item.Asset.Group.Family + "/" + Item.Asset.DynamicGroupName + "/Preview/" + Item.Asset.Name + Item.Asset.DynamicPreviewIcon(CharacterGetCurrent()) + ".png", X + 2, Y + 2, 221, 221);
|
||||
}
|
||||
else DrawImageResize("Icons/HiddenItem.png", X + 2, Y + 2, 221, 221);
|
||||
DrawTextFit(Item.Asset.DynamicDescription(Player), X + 112, Y + 250, 221, "black");
|
||||
if (Item.Icon != "") DrawImage("Icons/" + Item.Icon + ".png", X + 2, Y + 110);
|
||||
|
@ -2177,7 +2179,9 @@ function DialogFindAutoReplace(C, KeyWord1, KeyWord2, ReturnPrevious) {
|
|||
* @returns {void} - Nothing
|
||||
*/
|
||||
function DialogDraw() {
|
||||
|
||||
if (ControllerActive == true) {
|
||||
ClearButtons();
|
||||
}
|
||||
// Draw both the player and the interaction character
|
||||
if (CurrentCharacter.ID != 0) DrawCharacter(Player, 0, 0, 1);
|
||||
DrawCharacter(CurrentCharacter, 500, 0, 1);
|
||||
|
|
|
@ -220,6 +220,10 @@ function DrawArousalMeter(C, X, Y, Zoom) {
|
|||
function DrawCharacter(C, X, Y, Zoom, IsHeightResizeAllowed) {
|
||||
if ((C != null) && ((C.ID == 0) || (Player.GetBlindLevel() < 3) || (CurrentScreen == "InformationSheet"))) {
|
||||
|
||||
if (ControllerActive == true) {
|
||||
setButton(X + 100, Y + 200)
|
||||
}
|
||||
|
||||
// If there's a fixed image to draw instead of the character
|
||||
if (C.FixedImage != null) {
|
||||
DrawImageZoomCanvas(C.FixedImage, MainCanvas, 0, 0, 500, 1000, X, Y, 500 * Zoom, 1000 * Zoom);
|
||||
|
@ -355,6 +359,10 @@ function DrawAssetGroupZone(C, Zone, Zoom, X, Y, HeightRatio, Color, Thickness =
|
|||
|
||||
if (FillColor != null) DrawRect(CZ[0], CZ[1], CZ[2], CZ[3], FillColor);
|
||||
DrawEmptyRect(CZ[0], CZ[1], CZ[2], CZ[3], Color, Thickness);
|
||||
|
||||
if (ControllerActive == true) {
|
||||
setButton(Math.round(CZ[0]), Math.round(CZ[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,7 +659,9 @@ function GetWrapTextSize(Text, Width, MaxLine) {
|
|||
* @returns {void} - Nothing
|
||||
*/
|
||||
function DrawTextWrap(Text, X, Y, Width, Height, ForeColor, BackColor, MaxLine) {
|
||||
|
||||
if (ControllerActive == true) {
|
||||
setButton(X, Y);
|
||||
}
|
||||
// Draw the rectangle if we need too
|
||||
if (BackColor != null) {
|
||||
MainCanvas.beginPath();
|
||||
|
@ -781,6 +791,10 @@ function DrawText(Text, X, Y, Color, BackColor) {
|
|||
*/
|
||||
function DrawButton(Left, Top, Width, Height, Label, Color, Image, HoveringText, Disabled) {
|
||||
|
||||
if (ControllerActive == true) {
|
||||
setButton(Left, Top);
|
||||
}
|
||||
|
||||
// Draw the button rectangle (makes the background color cyan if the mouse is over it)
|
||||
MainCanvas.beginPath();
|
||||
MainCanvas.rect(Left, Top, Width, Height);
|
||||
|
@ -1067,4 +1081,4 @@ function DrawItemPreview(X, Y, Item) {
|
|||
DrawRect(X, Y, 225, 275, "white");
|
||||
DrawImageResize("Assets/" + Item.Asset.Group.Family + "/" + Item.Asset.DynamicGroupName + "/Preview/" + Item.Asset.Name + Item.Asset.DynamicPreviewIcon(CharacterGetCurrent()) + ".png", X + 2, Y + 2, 221, 221);
|
||||
DrawTextFit(Item.Asset.Description, X + 110, Y + 250, 221, "black");
|
||||
}
|
||||
}
|
|
@ -148,24 +148,27 @@ function ExtendedItemDraw(Options, DialogPrefix, OptionsPerPage, ShowImages = tr
|
|||
DrawText(DialogExtendedMessage, 1500, 375, "white", "gray");
|
||||
|
||||
// Draw the possible variants and their requirements, arranged based on the number per page
|
||||
for (let I = ItemOptionsOffset; I < Options.length && I < ItemOptionsOffset + OptionsPerPage; I++) {
|
||||
var PageOffset = I - ItemOptionsOffset;
|
||||
var X = XYPositions[OptionsPerPage][PageOffset][0];
|
||||
var Y = XYPositions[OptionsPerPage][PageOffset][1];
|
||||
|
||||
var Option = Options[I];
|
||||
var Hover = MouseIn(X, Y, 225, 55 + ImageHeight) && !CommonIsMobile;
|
||||
var FailSkillCheck = !!ExtendedItemRequirementCheckMessageMemo(Option, IsSelfBondage);
|
||||
var IsSelected = DialogFocusItem.Property.Type == Option.Property.Type;
|
||||
var Blocked = InventoryIsPermissionBlocked(C, DialogFocusItem.Asset.DynamicName(Player), DialogFocusItem.Asset.DynamicGroupName, Option.Property.Type);
|
||||
var Limited = !InventoryCheckLimitedPermission(C, DialogFocusItem, Option.Property.Type);
|
||||
var PlayerBlocked = InventoryIsPermissionBlocked(Player, DialogFocusItem.Asset.DynamicName(Player), DialogFocusItem.Asset.DynamicGroupName, Option.Property.Type);
|
||||
var PlayerLimited = InventoryIsPermissionLimited(Player, DialogFocusItem.Asset.Name, DialogFocusItem.Asset.Group.Name, Option.Property.Type);
|
||||
var Color = ExtendedItemPermissionMode ? ((C.ID == 0 && IsSelected) || Option.Property.Type == null ? "#888888" : PlayerBlocked ? Hover ? "red" : "pink" : PlayerLimited ? Hover ? "orange" : "#fed8b1" : Hover ? "green" : "lime") : (IsSelected ? "#888888" : (Blocked || Limited) ? "Red" : FailSkillCheck ? "Pink" : Hover ? "Cyan" : "White");
|
||||
for (let I = ItemOptionsOffset; I < Options.length && I < ItemOptionsOffset + OptionsPerPage; I++) {
|
||||
var PageOffset = I - ItemOptionsOffset;
|
||||
var X = XYPositions[OptionsPerPage][PageOffset][0];
|
||||
var Y = XYPositions[OptionsPerPage][PageOffset][1];
|
||||
|
||||
var Option = Options[I];
|
||||
var Hover = MouseIn(X, Y, 225, 55 + ImageHeight) && !CommonIsMobile;
|
||||
var FailSkillCheck = !!ExtendedItemRequirementCheckMessageMemo(Option, IsSelfBondage);
|
||||
var IsSelected = DialogFocusItem.Property.Type == Option.Property.Type;
|
||||
var Blocked = InventoryIsPermissionBlocked(C, DialogFocusItem.Asset.DynamicName(Player), DialogFocusItem.Asset.DynamicGroupName, Option.Property.Type);
|
||||
var Limited = !InventoryCheckLimitedPermission(C, DialogFocusItem, Option.Property.Type);
|
||||
var PlayerBlocked = InventoryIsPermissionBlocked(Player, DialogFocusItem.Asset.DynamicName(Player), DialogFocusItem.Asset.DynamicGroupName, Option.Property.Type);
|
||||
var PlayerLimited = InventoryIsPermissionLimited(Player, DialogFocusItem.Asset.Name, DialogFocusItem.Asset.Group.Name, Option.Property.Type);
|
||||
var Color = ExtendedItemPermissionMode ? ((C.ID == 0 && IsSelected) || Option.Property.Type == null ? "#888888" : PlayerBlocked ? Hover ? "red" : "pink" : PlayerLimited ? Hover ? "orange" : "#fed8b1" : Hover ? "green" : "lime") : (IsSelected ? "#888888" : (Blocked || Limited) ? "Red" : FailSkillCheck ? "Pink" : Hover ? "Cyan" : "White");
|
||||
|
||||
DrawButton(X, Y, 225, 55 + ImageHeight, "", Color, null, null, IsSelected);
|
||||
if (ShowImages) DrawImage("Screens/Inventory/" + Asset.Group.Name + "/" + Asset.Name + "/" + Option.Name + ".png", X + 2, Y);
|
||||
DrawTextFit(DialogFind(Player, DialogPrefix + Option.Name), X + 112, Y + 30 + ImageHeight, 225, "black");
|
||||
if (ControllerActive == true) {
|
||||
setButton(X + 112, Y + 30 + ImageHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Permission mode toggle is always available
|
||||
|
|
|
@ -249,9 +249,13 @@ function TimerProcess(Timestamp) {
|
|||
|
||||
}
|
||||
|
||||
// Launches the main again for the next frame
|
||||
requestAnimationFrame(MainRun);
|
||||
if (ControllerActive == true) {
|
||||
DrawRect(MouseX - 5, MouseY - 5, 10, 10, "Cyan");
|
||||
}
|
||||
|
||||
// Launches the main again for the next frame
|
||||
requestAnimationFrame(MainRun);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<script src="Scripts/Character.js"></script>
|
||||
<script src="Scripts/CharacterName.js"></script>
|
||||
<script src="Scripts/ColorPicker.js"></script>
|
||||
<script src="Scripts/ControllerSupport.js"></script>
|
||||
<script src="Scripts/Dialog.js"></script>
|
||||
<script src="Scripts/Speech.js"></script>
|
||||
<script src="Scripts/Text.js"></script>
|
||||
|
@ -360,6 +361,7 @@ window.onload = function() {
|
|||
DrawLoad();
|
||||
AssetLoadAll();
|
||||
CommonSetScreen("Character", "Login");
|
||||
ControllerActive = false;
|
||||
ServerInit();
|
||||
MainRun(0);
|
||||
};
|
||||
|
@ -438,6 +440,49 @@ function LoseFocus(event) {
|
|||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div id="axes" style="display: flex; flex-direction: column;"></div>
|
||||
<script>
|
||||
if (ControllerActive == true) {
|
||||
window.addEventListener('gamepadconnected', (event) => {
|
||||
const update = () => {
|
||||
const output = document.getElementById('axes');
|
||||
output.innerHTML = '';
|
||||
|
||||
for (const gamepad of navigator.getGamepads()) {
|
||||
if (!gamepad) continue;
|
||||
for (const [index, axis] of gamepad.axes.entries()) {
|
||||
ControllerAxis(gamepad.axes);
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(update);
|
||||
};
|
||||
update();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<div id="buttons" style="display: flex; flex-direction: column;"></div>
|
||||
<script>
|
||||
if (ControllerActive == true) {
|
||||
window.addEventListener('gamepadconnected', (event) => {
|
||||
const update = () => {
|
||||
const output = document.getElementById('buttons');
|
||||
output.innerHTML = '';
|
||||
|
||||
for (const gamepad of navigator.getGamepads()) {
|
||||
if (!gamepad) continue;
|
||||
for (const [index, button] of gamepad.buttons.entries()) {
|
||||
ControllerButton(gamepad.buttons);
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(update);
|
||||
};
|
||||
update();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<body style="width:100%; height:100%; background-color:black; margin:0px; padding:0px; overflow:hidden;">
|
||||
<canvas id="MainCanvas" Width="2000" Height="1000" onClick="Click(event);" onTouchStart="Touch(event);" onMouseMove="MouseMove(event);" onMouseLeave="LoseFocus(event);"></canvas>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Reference in a new issue