Controller support

This commit is contained in:
Eddoursul 2024-04-28 00:57:23 +02:00
parent 89e9c89be9
commit 6cba50dbf4
5 changed files with 258 additions and 5 deletions

Binary file not shown.

View File

@ -23,6 +23,11 @@
<_PNxCyberboyLeftImplant1State> 0 </_PNxCyberboyLeftImplant1State> <_PNxCyberboyLeftImplant1State> 0 </_PNxCyberboyLeftImplant1State>
<_PNxCyberboyLeftImplant2State> 0 </_PNxCyberboyLeftImplant2State> <_PNxCyberboyLeftImplant2State> 0 </_PNxCyberboyLeftImplant2State>
<_PNxCyberboyRightImplant1Active> 0 </_PNxCyberboyRightImplant1Active>
<_PNxCyberboyRightImplant2Active> 0 </_PNxCyberboyRightImplant2Active>
<_PNxCyberboyLeftImplant1Active> 0 </_PNxCyberboyLeftImplant1Active>
<_PNxCyberboyLeftImplant2Active> 0 </_PNxCyberboyLeftImplant2Active>
<_PNxCyberboyRightImplant1Path> </_PNxCyberboyRightImplant1Path> <_PNxCyberboyRightImplant1Path> </_PNxCyberboyRightImplant1Path>
<_PNxCyberboyRightImplant2Path> </_PNxCyberboyRightImplant2Path> <_PNxCyberboyRightImplant2Path> </_PNxCyberboyRightImplant2Path>
<_PNxCyberboyLeftImplant1Path> </_PNxCyberboyLeftImplant1Path> <_PNxCyberboyLeftImplant1Path> </_PNxCyberboyLeftImplant1Path>
@ -443,6 +448,7 @@
<string> &-sAccept; </string> <string> &-sAccept; </string>
<clicksound> UIMenuPrevNext</clicksound> <clicksound> UIMenuPrevNext</clicksound>
<_PCButtonText> &-sPCMenuHintA; </_PCButtonText> <_PCButtonText> &-sPCMenuHintA; </_PCButtonText>
<_xbox_button> &xbuttony; </_xbox_button>
<text name="button_text"> <text name="button_text">
<font> 2 </font> <font> 2 </font>
@ -477,6 +483,47 @@
<_line_alpha> <copy src="parent()" trait="_line_alpha"/> </_line_alpha> <_line_alpha> <copy src="parent()" trait="_line_alpha"/> </_line_alpha>
</rect> </rect>
<image name="xbox_button">
<visible>
<copy src="globals()" trait="_Has360Controller"/>
<and>
<copy src="parent()" trait="_xbox_button"/>
<gt> 0 </gt>
</and>
</visible>
<filename>
<copy src="parent()" trait="_xbox_button"/>
<sub> &default_accept; </sub>
<add> 1 </add>
<copy src="me()" trait="_filename_"/>
</filename>
<texatlas> Interface\InterfaceShared.tai </texatlas>
<alpha> <copy src="parent()" trait="_line_alpha"/> </alpha>
<width> 75 </width>
<height> 75 </height>
<x>
<copy src="sibling(box)" trait="x"/>
<sub>
<copy src="me()" trait="width"/>
<sub> 10 </sub>
</sub>
</x>
<y>
<copy src="sibling(box)" trait="y"/>
<add>
<copy src="sibling(box)" trait="height"/>
<sub src="me()" trait="height"/>
<div> 2 </div>
</add>
</y>
<_filename_4> general_button_y.dds </_filename_4>
<_filename_17> glow_general_button_y.dds </_filename_17>
</image>
<text name="PCShortcutLabel"> <text name="PCShortcutLabel">
<visible> <visible>
<not src="globals()" trait="_Has360Controller"/> <not src="globals()" trait="_Has360Controller"/>
@ -654,6 +701,10 @@
<systemcolor> <systemcolor>
<copy> &hudmain; </copy> <copy> &hudmain; </copy>
<onlyif src="parent()" trait="mouseover" /> <onlyif src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyRightImplant1Active"/>
</or>
<add> <add>
<copy> &nosystemcolor; </copy> <copy> &nosystemcolor; </copy>
<onlyifnot src="parent()" trait="mouseover" /> <onlyifnot src="parent()" trait="mouseover" />
@ -691,6 +742,10 @@
<visible> <visible>
<copy src="parent()" trait="visible" /> <copy src="parent()" trait="visible" />
<and src="parent()" trait="mouseover" /> <and src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyRightImplant1Active"/>
</or>
<and> <and>
<copy src="io()" trait="_PNxCyberboyRightImplant1State" /> <copy src="io()" trait="_PNxCyberboyRightImplant1State" />
<eq> 0 </eq> <eq> 0 </eq>
@ -806,6 +861,10 @@
<copy> &nosystemcolor; </copy> <copy> &nosystemcolor; </copy>
<onlyifnot src="parent()" trait="mouseover" /> <onlyifnot src="parent()" trait="mouseover" />
</add> </add>
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyRightImplant2Active"/>
</or>
</systemcolor> </systemcolor>
<visible> <visible>
@ -839,6 +898,10 @@
<visible> <visible>
<copy src="parent()" trait="visible" /> <copy src="parent()" trait="visible" />
<and src="parent()" trait="mouseover" /> <and src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyRightImplant2Active"/>
</or>
<and> <and>
<copy src="io()" trait="_PNxCyberboyRightImplant2State" /> <copy src="io()" trait="_PNxCyberboyRightImplant2State" />
<eq> 0 </eq> <eq> 0 </eq>
@ -949,6 +1012,10 @@
<systemcolor> <systemcolor>
<copy> &hudmain; </copy> <copy> &hudmain; </copy>
<onlyif src="parent()" trait="mouseover" /> <onlyif src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyLeftImplant1Active"/>
</or>
<add> <add>
<copy> &nosystemcolor; </copy> <copy> &nosystemcolor; </copy>
<onlyifnot src="parent()" trait="mouseover" /> <onlyifnot src="parent()" trait="mouseover" />
@ -986,6 +1053,10 @@
<visible> <visible>
<copy src="parent()" trait="visible" /> <copy src="parent()" trait="visible" />
<and src="parent()" trait="mouseover" /> <and src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyLeftImplant1Active"/>
</or>
<and> <and>
<copy src="io()" trait="_PNxCyberboyLeftImplant1State" /> <copy src="io()" trait="_PNxCyberboyLeftImplant1State" />
<eq> 0 </eq> <eq> 0 </eq>
@ -1093,6 +1164,10 @@
<systemcolor> <systemcolor>
<copy> &hudmain; </copy> <copy> &hudmain; </copy>
<onlyif src="parent()" trait="mouseover" /> <onlyif src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyLeftImplant2Active"/>
</or>
<add> <add>
<copy> &nosystemcolor; </copy> <copy> &nosystemcolor; </copy>
<onlyifnot src="parent()" trait="mouseover" /> <onlyifnot src="parent()" trait="mouseover" />
@ -1130,6 +1205,10 @@
<visible> <visible>
<copy src="parent()" trait="visible" /> <copy src="parent()" trait="visible" />
<and src="parent()" trait="mouseover" /> <and src="parent()" trait="mouseover" />
<or>
<copy src="globals()" trait="_Has360Controller"/>
<and src="io()" trait="_PNxCyberboyLeftImplant2Active"/>
</or>
<and> <and>
<copy src="io()" trait="_PNxCyberboyLeftImplant2State" /> <copy src="io()" trait="_PNxCyberboyLeftImplant2State" />
<eq> 0 </eq> <eq> 0 </eq>

View File

@ -0,0 +1,132 @@
scn CWxPanelOnButtonDown
int keyCode
int selectedRegion
int bHasPerks
int iCurrentSlot
int n
array_var slots
array_var toggles
begin function { keyCode }
if MenuMode == 0 || MenuMode 4
RemoveEventHandler "OnButtonDown:4111" (GetCurrentScript)
return
endif
if GetActiveMenuMode != 1059 || MenuMode 1001
return
endif
selectedRegion := CWxImplantsPanel.selectedRegion
if keyCode == 1 ; UP
if selectedRegion == 0
call CWxPanelSelectFirstSlot 6 "TutorialMenu\_PNxCyberboyLeftLegSelected"
elseif selectedRegion == 6
call CWxPanelSelectFirstSlot 5 "TutorialMenu\_PNxCyberboyRightLegSelected"
elseif selectedRegion == 5
call CWxPanelSelectFirstSlot 4 "TutorialMenu\_PNxCyberboyLeftArmSelected"
elseif selectedRegion == 4
call CWxPanelSelectFirstSlot 2 "TutorialMenu\_PNxCyberboyTorsoSelected"
elseif selectedRegion == 2
call CWxPanelSelectFirstSlot 3 "TutorialMenu\_PNxCyberboyRightArmSelected"
elseif selectedRegion == 3
call CWxPanelSelectFirstSlot 1 "TutorialMenu\_PNxCyberboyHeadSelected"
elseif selectedRegion == 1
SetUIFloat "TutorialMenu\_PNxCyberboyHeadSelected" 0
endif
elseif keyCode == 2 ; DOWN
if selectedRegion == 0
call CWxPanelSelectFirstSlot 1 "TutorialMenu\_PNxCyberboyHeadSelected"
elseif selectedRegion == 1
call CWxPanelSelectFirstSlot 3 "TutorialMenu\_PNxCyberboyRightArmSelected"
elseif selectedRegion == 3
call CWxPanelSelectFirstSlot 2 "TutorialMenu\_PNxCyberboyTorsoSelected"
elseif selectedRegion == 2
call CWxPanelSelectFirstSlot 4 "TutorialMenu\_PNxCyberboyLeftArmSelected"
elseif selectedRegion == 4
call CWxPanelSelectFirstSlot 5 "TutorialMenu\_PNxCyberboyRightLegSelected"
elseif selectedRegion == 5
call CWxPanelSelectFirstSlot 6 "TutorialMenu\_PNxCyberboyLeftLegSelected"
elseif selectedRegion == 6
SetUIFloat "TutorialMenu\_PNxCyberboyLeftLegSelected" 0
endif
elseif eval keyCode == 8 || keyCode == 4 ; RIGHT/LEFT
if selectedRegion <= 0
return
endif
slots := ar_list "PNxCyberboyRightSlot2", "PNxCyberboyRightSlot1", "PNxCyberboyLeftSlot1", "PNxCyberboyLeftSlot2"
toggles := ar_list "TutorialMenu\_PNxCyberboyRightImplant2Active", "TutorialMenu\_PNxCyberboyRightImplant1Active", "TutorialMenu\_PNxCyberboyLeftImplant1Active", "TutorialMenu\_PNxCyberboyLeftImplant2Active"
let iCurrentSlot := -1
let n := 0
while n < 4
if GetUIFloat (toggles[n])
let iCurrentSlot := n
let n := 4
endif
n += 1
loop
if iCurrentSlot == -1
return
endif
SetUIFloat (toggles[iCurrentSlot]) 0
let n := 0
while n < 4
if IsButtonPressed 8 ; RIGHT
let iCurrentSlot += 1
if iCurrentSlot == 4
let iCurrentSlot := 0
endif
else ; LEFT
let iCurrentSlot -= 1
if iCurrentSlot == -1
let iCurrentSlot := 3
endif
endif
if GetUIFloat ("TutorialMenu\PNxImplantsPanel\" + slots[iCurrentSlot] + "\visible")
SetUIFloat (toggles[iCurrentSlot]) 1
let n := 4
endif
n += 1
loop
elseif keyCode == 4096 ; BUTTON_A
if GetUIFloat "TutorialMenu\_PNxCyberboyRightImplant1Active"
set CWxImplantsPanel.selectedSlot to 1
elseif GetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant1Active"
set CWxImplantsPanel.selectedSlot to 2
elseif GetUIFloat "TutorialMenu\_PNxCyberboyRightImplant2Active"
set CWxImplantsPanel.selectedSlot to 3
elseif GetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant2Active"
set CWxImplantsPanel.selectedSlot to 4
else
set CWxImplantsPanel.selectedSlot to 0
endif
if CWxImplantsPanel.selectedSlot > 0
set CWxImplantsPanel.currentSlot to CWxImplantsPanel.selectedSlot
endif
endif
end

View File

@ -118,6 +118,8 @@ begin GameMode
rimod CWxControlPanelISFX rimod CWxControlPanelISFX
RemoveEventHandler "OnButtonDown:4111" CWxPanelOnButtonDown
if bPerformSurgery if bPerformSurgery
set bPerformSurgery to 0 set bPerformSurgery to 0
@ -239,6 +241,13 @@ Begin MenuMode 1059
set selectedRegion to 0 set selectedRegion to 0
SetEventHandler "OnButtonDown:4111" CWxPanelOnButtonDown
if CWxPanelGamepadHintShown == 0 && GetController
MessageBoxEx "Use D-pad to navigate:%rUP/DOWN - select a body part%rLEFT/RIGHT - select an implant slot%rA - show an implant menu"
set CWxPanelGamepadHintShown to 1
endif
if ListGetCount CWxImplantsAllList != ListGetCount CWxImplantsDescList if ListGetCount CWxImplantsAllList != ListGetCount CWxImplantsDescList
print "Cyberware: Number of elements in CWxImplantsAllList and CWxImplantsDescList is not equal!" print "Cyberware: Number of elements in CWxImplantsAllList and CWxImplantsDescList is not equal!"
endif endif
@ -302,7 +311,7 @@ Begin MenuMode 1059
return return
elseif (GetUIFloat "TutorialMenu\_PNxImplantsPanelAcceptSelected") || (isKeyPressed 30 && GetUIFloat "TutorialMenu\_PNxImplantsPanelAcceptEnabled" && menuMode 1059) elseif (GetUIFloat "TutorialMenu\_PNxImplantsPanelAcceptSelected") || (GetUIFloat "TutorialMenu\_PNxImplantsPanelAcceptEnabled" && MenuMode 1059 && (isKeyPressed 30 || IsButtonPressed 32768))
printd "Accept confirmation" printd "Accept confirmation"
@ -562,7 +571,7 @@ Begin MenuMode 1059
printd "Cyberware: Current message was not empty, but not processed." printd "Cyberware: Current message was not empty, but not processed."
set rCurrentMessage to 0 let rCurrentMessage := 0
else else

View File

@ -0,0 +1,33 @@
scn CWxPanelSelectFirstSlot
begin function { int selectedRegion, string_var sNode }
SetUIFloat "TutorialMenu\_PNxCyberboyHeadSelected" 0
SetUIFloat "TutorialMenu\_PNxCyberboyLeftArmSelected" 0
SetUIFloat "TutorialMenu\_PNxCyberboyRightArmSelected" 0
SetUIFloat "TutorialMenu\_PNxCyberboyTorsoSelected" 0
SetUIFloat "TutorialMenu\_PNxCyberboyLeftLegSelected" 0
SetUIFloat "TutorialMenu\_PNxCyberboyRightLegSelected" 0
SetUIFloat (sNode) 1
if eval sNode == "TutorialMenu\_PNxCyberboyLeftArmSelected" || sNode == "TutorialMenu\_PNxCyberboyLeftLegSelected"
SetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant1Active" 1
SetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant2Active" 0
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant1Active" 0
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant2Active" 0
return
endif
SetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant1Active" 0
SetUIFloat "TutorialMenu\_PNxCyberboyLeftImplant2Active" 0
if eval (selectedRegion == 1 && playerRef.hasPerk CWxExtraHeadSlotsPerk) || (selectedRegion == 2 && playerRef.hasPerk CWxExtraTorsoSlotsPerk) || (selectedRegion == 3 && playerRef.hasPerk CWxExtraArmSlotsPerk) || (selectedRegion == 4 && playerRef.hasPerk CWxExtraArmSlotsPerk) || (selectedRegion == 5 && playerRef.hasPerk CWxExtraLegSlotsPerk) || (selectedRegion == 6 && playerRef.hasPerk CWxExtraLegSlotsPerk)
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant2Active" 1
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant1Active" 0
else
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant1Active" 1
SetUIFloat "TutorialMenu\_PNxCyberboyRightImplant2Active" 0
endif
end