-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInput.CB
64 lines (49 loc) · 1.53 KB
/
Input.CB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//Näitä käytetään myös pelajille.
//Varo muutoksia!
//Tässä määritellään vakiot, joilla viitataan eri näppäimiin
Const API_UP = 0
Const API_DOWN = 1
Const API_LEFT = 2
Const API_RIGHT = 3
Const API_ACTION1 = 4
Const API_ACTION2 = 5
Const API_CONTROL_SOURCE = 6
//Otetaan ylös toimintojen määrä jottei tartte käyttää taikavakioita
Const API_ACTIONS = 6
Const API_KEYBOARD = 1
//Korvaa KeyHit()
Function API_KeyHit(number, Key)
If (number >= 0 And number < MAIN_MAX_PLAYERS And Key >=0 And Key < API_ACTIONS) Then
player = MAIN_PlayerData(number)
ctrl = PeekInt(player,MAIN_PLAYER_CONTROLS)
source = PeekByte(ctrl,API_CONTROL_SOURCE)
If (source = API_KEYBOARD) Then
Return KeyHit(PeekByte(ctrl,Key))
EndIf
EndIf
Return False
End Function
//Korvaa KeyDown()
Function API_KeyDown(number, Key)
If (number >= 0 And number < MAIN_MAX_PLAYERS And Key >=0 And Key < API_ACTIONS) Then
player = MAIN_PlayerData(number)
ctrl = PeekInt(player,MAIN_PLAYER_CONTROLS)
source = PeekByte(ctrl,API_CONTROL_SOURCE)
If (source = API_KEYBOARD) Then
Return KeyDown(PeekByte(ctrl,Key))
EndIf
EndIf
Return False
End Function
//Korvaa KeyUp()
Function API_KeyUp(number, Key)
If (number >= 0 And number < MAIN_MAX_PLAYERS And Key >=0 And Key < API_ACTIONS) Then
player = MAIN_PlayerData(number)
ctrl = PeekInt(player,MAIN_PLAYER_CONTROLS)
source = PeekByte(ctrl,API_CONTROL_SOURCE)
If (source = API_KEYBOARD) Then
Return KeyUp(PeekByte(ctrl,Key))
EndIf
EndIf
Return False
End Function