Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
Untitled diff
Erstellt
vor 9 Jahren
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
27 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
242 Zeilen
Kopieren
107 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
322 Zeilen
Kopieren
Kopieren
Kopiert
Kopieren
Kopiert
object_event_
clear(PlayerControl
, ev_
step, ev_step_begin);
//PrOF 2017
global.joystickExists = false;
global.secondaryDelay = 15;
//If this gets added it'll be a lot cleaner, clearing and adding is just a lot of code
controllerObserver = object_add();
object_set_persistent(controllerObserver, true);
object_event_
add(controllerObserver
, ev_
create, 0, '
mouseLocked = false;
JoystickMouseLockTimer = 0;
mouseStarterY = window_get_width() / 2;
mouseStarterX = window_get_height() / 2;
');
Kopieren
Kopiert
Kopieren
Kopiert
object_event_add(controllerObserver, ev_step, 0, '
if(joystick_exists(1)){
global.joystickExists = true;
JoystickMouseLockTimer += global.delta_factor;
//Cursor movement, inspiration taken form ArrowAim.gml
//TODO Configurable sensitivity
//TODO change deadzone calculation to be a percentage
if (joystick_check_button(1, 7) && JoystickMouseLockTimer >= 10) {
mouseLocked = !mouseLocked;
JoystickMouseLockTimer = 0;
}
if (!mouseLocked) {
if(instance_exists(MenuController)) {
//Menu mode
/* Woo debug stuff, coming hopefully next update
lStickY = joystick_ypos(1)*30;
lStickX = joystick_xpos(1)*30;
if (lStickY < 6 && lStickY > -6 && lStickX < 6 && lStickX > -6){
//Do nothing
}
else {
mouseStarterY = mouseStarterY + lStickY;
mouseStarterX = mouseStarterX + lStickX;
window_mouse_set(mouseStarterX, mouseStarterY);
}
show_message("X " + string(mouseStarterX) + " Y " + string(mouseStarterY));
*/
}
else {
//Gameplay mode
Sensitivity = 150;
//Sniper and quote are handled differently
if (instance_exists(Player)) {
global.secondaryDelay = 15;
/*
if (global.myself.class = CLASS_SNIPER) {
//TODO use old aim method when aimed
Sensitivity = 500;
}
*/
if (global.myself.class = CLASS_QUOTE) {
//Disable the delay between Secondary actions
global.secondaryDelay = 0;
}
}
Text moved with changes from lines 139-144 (99.5% similarity)
mousex = window_get_width() / 2;
mousey = window_get_height() / 2;
rStickY = joystick_rpos(1)*100;
rStickX = joystick_upos(1)*100;
//window_mouse_set(mousex + rStickX, mousey + rStickY);
gradi = arctan2(rStickY, rStickX);
if (rStickY < 20 && rStickY > -20 && rStickX < 20 && rStickX > -20){
//Do nothing
}
else {
window_mouse_set(Sensitivity * cos(gradi) + mousex, Sensitivity * sin(gradi) + mousey);
}
}
}
}
');
instance_create(0,0,controllerObserver);
object_event_add(PlayerControl, ev_create, 0, '
object_event_add(PlayerControl, ev_create, 0, '
//Used by the stupid Special action workaround
//Used by the stupid Special action workaround
Kopieren
Kopiert
Kopieren
Kopiert
JoystickWorkaroundFramesCount
= 0;
JoystickSecondaryTimer
= 0;
');
');
Kopieren
Kopiert
Kopieren
Kopiert
object_event_clear(PlayerControl, ev_step, ev_step_begin);
object_event_add(PlayerControl, ev_step, ev_step_begin, '
object_event_add(PlayerControl, ev_step, ev_step_begin, '
if(instance_exists(MenuController))
if(instance_exists(MenuController))
exit;
exit;
var kickOpen;
var kickOpen;
kickOpen = false
kickOpen = false
if (instance_exists(ScoreTableController))
if (instance_exists(ScoreTableController))
if (ScoreTableController.showadmin)
if (ScoreTableController.showadmin)
kickOpen = true;
kickOpen = true;
if(instance_exists(TeamSelectController) || instance_exists(ClassSelectController) || kickOpen)
if(instance_exists(TeamSelectController) || instance_exists(ClassSelectController) || kickOpen)
menuOpen = true;
menuOpen = true;
else
else
menuOpen = false;
menuOpen = false;
//Checking for input - Mapped Keys
//Checking for input - Mapped Keys
if(keyboard_check_pressed(global.changeTeam))
if(keyboard_check_pressed(global.changeTeam))
inputChangeTeam();
inputChangeTeam();
if(keyboard_check_pressed(global.changeClass))
if(keyboard_check_pressed(global.changeClass))
inputChangeClass();
inputChangeClass();
event_user(8);
event_user(8);
var keybyte;
var keybyte;
keybyte = 0;
keybyte = 0;
/* KeyByte flags:
/* KeyByte flags:
02 - down
02 - down
08 - primary
08 - primary
10 - secondary
10 - secondary
20 - right
20 - right
40 - left
40 - left
80 - up
80 - up
*/
*/
//character object exists
//character object exists
if(global.myself.object != -1)
if(global.myself.object != -1)
{
{
if(!menuOpen)
if(!menuOpen)
{
{
Kopieren
Kopiert
Kopieren
Kopiert
JoystickWorkaroundFramesCount
+=
1
;
JoystickSecondaryTimer
+=
global.delta_factor
;
if(keyboard_check(global.left)) keybyte |= $40;
if(keyboard_check(global.left)) keybyte |= $40;
if(keyboard_check(global.right)) keybyte |= $20;
if(keyboard_check(global.right)) keybyte |= $20;
if(keyboard_check(global.jump)) keybyte |= $80;
if(keyboard_check(global.jump)) keybyte |= $80;
if(keyboard_check(global.down)) keybyte |= $02;
if(keyboard_check(global.down)) keybyte |= $02;
if(keyboard_check(global.taunt)) keybyte |= $01;
if(keyboard_check(global.taunt)) keybyte |= $01;
if(keyboard_check_pressed(global.chat1)) inputChat1();
if(keyboard_check_pressed(global.chat1)) inputChat1();
if(keyboard_check_pressed(global.chat2)) inputChat2();
if(keyboard_check_pressed(global.chat2)) inputChat2();
if(keyboard_check_pressed(global.chat3)) inputChat3();
if(keyboard_check_pressed(global.chat3)) inputChat3();
if(keyboard_check_pressed(global.drop)) inputDrop();
if(keyboard_check_pressed(global.drop)) inputDrop();
if(keyboard_check_pressed(global.medic))
if(keyboard_check_pressed(global.medic))
{
{
inputCallMedic();
inputCallMedic();
}
}
if(!global.myself.humiliated)
if(!global.myself.humiliated)
{
{
if(keyboard_check(global.attack)) keybyte |= $10;
if(keyboard_check(global.attack)) keybyte |= $10;
if(keyboard_check(global.special)) keybyte |= $08;
if(keyboard_check(global.special)) keybyte |= $08;
if(keyboard_check_pressed(global.special)) inputSpecial();
if(keyboard_check_pressed(global.special)) inputSpecial();
if(keyboard_check_pressed(global.taunt)) inputTaunt();
if(keyboard_check_pressed(global.taunt)) inputTaunt();
if(mouse_check_button(mb_left))
if(mouse_check_button(mb_left))
{
{
if(global.attack == MOUSE_LEFT) keybyte |= $10;
if(global.attack == MOUSE_LEFT) keybyte |= $10;
if(global.special == MOUSE_LEFT) keybyte |= $08;
if(global.special == MOUSE_LEFT) keybyte |= $08;
}
}
if(mouse_check_button_pressed(mb_left) and global.special == MOUSE_LEFT)
if(mouse_check_button_pressed(mb_left) and global.special == MOUSE_LEFT)
inputSpecial();
inputSpecial();
if(mouse_check_button(mb_right))
if(mouse_check_button(mb_right))
{
{
if(global.attack == MOUSE_RIGHT) keybyte |= $10;
if(global.attack == MOUSE_RIGHT) keybyte |= $10;
if(global.special == MOUSE_RIGHT) keybyte |= $08;
if(global.special == MOUSE_RIGHT) keybyte |= $08;
}
}
if(mouse_check_button_pressed(mb_right) and global.special == MOUSE_RIGHT)
if(mouse_check_button_pressed(mb_right) and global.special == MOUSE_RIGHT)
inputSpecial();
inputSpecial();
}
}
Kopieren
Kopiert
Kopieren
Kopiert
//
S
ame as
K
eyboard, but with a Joystick check
, maybe some button could be a context action?
//
Actual plugin, s
ame as
k
eyboard, but with a Joystick check
//For now it only works with the first controller connected
//Left analog stick could also work using some axis, but it is simpler this way.
T
his
will
be
change
d once the controllerObserver gets used
//Left analog stick could also work using some axis, but it is simpler this way.
If t
his
many checks lag the game I
will
change
it
if (
global.
joystick
E
xists
) {
if (
joystick
_e
xists
(1)
) {
//Left
//Left
if(joystick_direction(1) == vk_numpad4 || joystick_direction(1) == vk_numpad7 || joystick_direction(1) == vk_numpad1) keybyte |= $40;
if(joystick_direction(1) == vk_numpad4 || joystick_direction(1) == vk_numpad7 || joystick_direction(1) == vk_numpad1) keybyte |= $40;
//Right
//Right
if(joystick_direction(1) == vk_numpad6 || joystick_direction(1) == vk_numpad9 || joystick_direction(1) == vk_numpad3) keybyte |= $20;
if(joystick_direction(1) == vk_numpad6 || joystick_direction(1) == vk_numpad9 || joystick_direction(1) == vk_numpad3) keybyte |= $20;
//Jump
//Jump
if(joystick_check_button(1, 5)) keybyte |= $80;
if(joystick_check_button(1, 5)) keybyte |= $80;
//Down
//Down
if(joystick_direction(1) == vk_numpad2 || joystick_direction(1) == vk_numpad1 || joystick_direction(1) == vk_numpad3) keybyte |= $02;
if(joystick_direction(1) == vk_numpad2 || joystick_direction(1) == vk_numpad1 || joystick_direction(1) == vk_numpad3) keybyte |= $02;
//Taunt L2
//Taunt L2
if(joystick_zpos(1) > 0) keybyte |= $01;
if(joystick_zpos(1) > 0) keybyte |= $01;
//Context action, O
//Context action, O
if (joystick_check_button(1, 2)) {
if (joystick_check_button(1, 2)) {
if (instance_exists(CTFHUD) || instance_exists(GeneratorHUD)){
if (instance_exists(CTFHUD) || instance_exists(GeneratorHUD)){
//Intelligence bubble, because a generator bubble does not exists
//Intelligence bubble, because a generator bubble does not exists
instance_create(0, 0, BubbleMenuX);
instance_create(0, 0, BubbleMenuX);
with BubbleMenuX
with BubbleMenuX
{
{
bubbleImage=29;
bubbleImage=29;
event_user(0);
event_user(0);
}
}
//Drop intel. Yes even if we are in a generator map
//Drop intel. Yes even if we are in a generator map
inputDrop();
inputDrop();
}
}
else if (instance_exists(ControlPointHUD) || instance_exists(ArenaHUD) || instance_exists(KothHUD) || instance_exists(DKothHUD)){
else if (instance_exists(ControlPointHUD) || instance_exists(ArenaHUD) || instance_exists(KothHUD) || instance_exists(DKothHUD)){
//Control point bubble
//Control point bubble
instance_create(0, 0, BubbleMenuX);
instance_create(0, 0, BubbleMenuX);
with BubbleMenuX
with BubbleMenuX
{
{
bubbleImage=33;
bubbleImage=33;
event_user(0);
event_user(0);
}
}
}
}
//Support for payload? Maybe. Maybe
//Support for payload? Maybe. Maybe
}
}
//Medic! X Button
//Medic! X Button
if(joystick_check_button(1, 1))
if(joystick_check_button(1, 1))
{
{
inputCallMedic();
inputCallMedic();
}
}
Kopieren
Kopiert
Kopieren
Kopiert
//Cursor movement
//Inspiration taken form ArrowAim.gml as I had problems moving the cursor the way I wanted it to move
Text moved with changes to lines 62-67 (99.5% similarity)
mousex = window_get_width() / 2;
mousey = window_get_height() / 2;
rStickY = joystick_rpos(1)*100;
rStickX = joystick_upos(1)*100;
window_mouse_set(mousex + rStickX, mousey + rStickY);
//POV or arrows on gamepad, bound to most common bubbles
//POV or arrows on gamepad, bound to most common bubbles
switch joystick_pov(1) {
switch joystick_pov(1) {
//Thumbs up
//Thumbs up
case 0:
case 0:
instance_create(0, 0, BubbleMenuC);
instance_create(0, 0, BubbleMenuC);
with BubbleMenuC
with BubbleMenuC
{
{
bubbleImage=36;
bubbleImage=36;
event_user(0);
event_user(0);
}
}
break;
break;
//Attack!
//Attack!
case 90:
case 90:
instance_create(0, 0, BubbleMenuZ);
instance_create(0, 0, BubbleMenuZ);
with BubbleMenuZ
with BubbleMenuZ
{
{
bubbleImage=41;
bubbleImage=41;
event_user(0);
event_user(0);
}
}
break;
break;
//Angry face, might replace with NO Sign
//Angry face, might replace with NO Sign
case 180:
case 180:
instance_create(0, 0, BubbleMenuZ);
instance_create(0, 0, BubbleMenuZ);
with BubbleMenuZ
with BubbleMenuZ
{
{
bubbleImage=22;
bubbleImage=22;
event_user(0);
event_user(0);
}
}
break;
break;
//Defend!
//Defend!
case 270:
case 270:
instance_create(0, 0, BubbleMenuZ);
instance_create(0, 0, BubbleMenuZ);
with BubbleMenuZ
with BubbleMenuZ
{
{
bubbleImage=42;
bubbleImage=42;
event_user(0);
event_user(0);
}
}
break;
break;
//When 2 arrows are pressed simultaneously. Might modify is someone actually plays with a flight joystick
//When 2 arrows are pressed simultaneously. Might modify is someone actually plays with a flight joystick
default:
default:
}
}
//L3 to call for SPY!
//L3 to call for SPY!
if (joystick_check_button(1, 9)) {
if (joystick_check_button(1, 9)) {
instance_create(0, 0, BubbleMenuX);
instance_create(0, 0, BubbleMenuX);
with BubbleMenuX
with BubbleMenuX
{
{
bubbleImage=30;
bubbleImage=30;
event_user(0);
event_user(0);
}
}
}
}
if(!global.myself.humiliated)
if(!global.myself.humiliated)
{
{
//Shoot
//Shoot
if(joystick_check_button(1, 6)) keybyte |= $10;
if(joystick_check_button(1, 6)) keybyte |= $10;
//Secondary action
//Secondary action
if(joystick_zpos(1) < 0) keybyte |= $08;
if(joystick_zpos(1) < 0) keybyte |= $08;
//Special action with stupid timer as workaround
//Special action with stupid timer as workaround
Kopieren
Kopiert
Kopieren
Kopiert
//TODO if the number
goes
up indefinetly
I may
have to put a cap to the timer
//TODO if the number
going
up indefinetly
causes issues I might
have to put a cap to the timer
if(joystick_zpos(1) < 0 &&
JoystickWorkaroundFramesCount
>=
60
) {
if(joystick_zpos(1) < 0 &&
JoystickSecondaryTimer
>=
global.secondaryDelay
) {
inputSpecial();
inputSpecial();
Kopieren
Kopiert
Kopieren
Kopiert
JoystickWorkaroundFramesCount
= 0;
JoystickSecondaryTimer
= 0;
}
}
//Taunt L2
//Taunt L2
if(joystick_zpos(1) > 0) inputTaunt();
if(joystick_zpos(1) > 0) inputTaunt();
}
}
}
}
}
}
if(global.run_virtual_ticks)
if(global.run_virtual_ticks)
ClientInputstate(global.serverSocket, keybyte);
ClientInputstate(global.serverSocket, keybyte);
socket_send(global.serverSocket);
socket_send(global.serverSocket);
}
}
// spectator controls
// spectator controls
else if (instance_exists(Spectator))
else if (instance_exists(Spectator))
{
{
if(!menuOpen)
if(!menuOpen)
{
{
if(mouse_check_button_pressed(mb_left))
if(mouse_check_button_pressed(mb_left))
with (Spectator) event_user(7);
with (Spectator) event_user(7);
if(mouse_check_button_pressed(mb_right))
if(mouse_check_button_pressed(mb_right))
with (Spectator) event_user(8);
with (Spectator) event_user(8);
Kopieren
Kopiert
Kopieren
Kopiert
//Joystick controls
if (global.joystickExists && JoystickSecondaryTimer > 10) {
JoystickSecondaryTimer = 0;
if(joystick_check_button(1, 1) )
with (Spectator) event_user(7);
if(joystick_check_button(1, 2))
with (Spectator) event_user(8);
}
}
}
}
}
if(keybyte != 0
if(keybyte != 0
or keyboard_check(global.left)
or keyboard_check(global.left)
or keyboard_check(global.right)
or keyboard_check(global.right)
or keyboard_check(global.jump)
or keyboard_check(global.jump)
or keyboard_check(global.down)) {
or keyboard_check(global.down)) {
afktimer = afktimeout;
afktimer = afktimeout;
}
}
');
');
Gespeicherte Diffs
Originaltext
Datei öffnen
object_event_clear(PlayerControl, ev_step, ev_step_begin); object_event_add(PlayerControl, ev_create, 0, ' //Used by the stupid Special action workaround JoystickWorkaroundFramesCount = 0; '); object_event_add(PlayerControl, ev_step, ev_step_begin, ' if(instance_exists(MenuController)) exit; var kickOpen; kickOpen = false if (instance_exists(ScoreTableController)) if (ScoreTableController.showadmin) kickOpen = true; if(instance_exists(TeamSelectController) || instance_exists(ClassSelectController) || kickOpen) menuOpen = true; else menuOpen = false; //Checking for input - Mapped Keys if(keyboard_check_pressed(global.changeTeam)) inputChangeTeam(); if(keyboard_check_pressed(global.changeClass)) inputChangeClass(); event_user(8); var keybyte; keybyte = 0; /* KeyByte flags: 02 - down 08 - primary 10 - secondary 20 - right 40 - left 80 - up */ //character object exists if(global.myself.object != -1) { if(!menuOpen) { JoystickWorkaroundFramesCount += 1; if(keyboard_check(global.left)) keybyte |= $40; if(keyboard_check(global.right)) keybyte |= $20; if(keyboard_check(global.jump)) keybyte |= $80; if(keyboard_check(global.down)) keybyte |= $02; if(keyboard_check(global.taunt)) keybyte |= $01; if(keyboard_check_pressed(global.chat1)) inputChat1(); if(keyboard_check_pressed(global.chat2)) inputChat2(); if(keyboard_check_pressed(global.chat3)) inputChat3(); if(keyboard_check_pressed(global.drop)) inputDrop(); if(keyboard_check_pressed(global.medic)) { inputCallMedic(); } if(!global.myself.humiliated) { if(keyboard_check(global.attack)) keybyte |= $10; if(keyboard_check(global.special)) keybyte |= $08; if(keyboard_check_pressed(global.special)) inputSpecial(); if(keyboard_check_pressed(global.taunt)) inputTaunt(); if(mouse_check_button(mb_left)) { if(global.attack == MOUSE_LEFT) keybyte |= $10; if(global.special == MOUSE_LEFT) keybyte |= $08; } if(mouse_check_button_pressed(mb_left) and global.special == MOUSE_LEFT) inputSpecial(); if(mouse_check_button(mb_right)) { if(global.attack == MOUSE_RIGHT) keybyte |= $10; if(global.special == MOUSE_RIGHT) keybyte |= $08; } if(mouse_check_button_pressed(mb_right) and global.special == MOUSE_RIGHT) inputSpecial(); } //Same as Keyboard, but with a Joystick check, maybe some button could be a context action? //For now it only works with the first controller connected //Left analog stick could also work using some axis, but it is simpler this way. If this many checks lag the game I will change it if (joystick_exists(1)) { //Left if(joystick_direction(1) == vk_numpad4 || joystick_direction(1) == vk_numpad7 || joystick_direction(1) == vk_numpad1) keybyte |= $40; //Right if(joystick_direction(1) == vk_numpad6 || joystick_direction(1) == vk_numpad9 || joystick_direction(1) == vk_numpad3) keybyte |= $20; //Jump if(joystick_check_button(1, 5)) keybyte |= $80; //Down if(joystick_direction(1) == vk_numpad2 || joystick_direction(1) == vk_numpad1 || joystick_direction(1) == vk_numpad3) keybyte |= $02; //Taunt L2 if(joystick_zpos(1) > 0) keybyte |= $01; //Context action, O if (joystick_check_button(1, 2)) { if (instance_exists(CTFHUD) || instance_exists(GeneratorHUD)){ //Intelligence bubble, because a generator bubble does not exists instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=29; event_user(0); } //Drop intel. Yes even if we are in a generator map inputDrop(); } else if (instance_exists(ControlPointHUD) || instance_exists(ArenaHUD) || instance_exists(KothHUD) || instance_exists(DKothHUD)){ //Control point bubble instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=33; event_user(0); } } //Support for payload? Maybe. Maybe } //Medic! X Button if(joystick_check_button(1, 1)) { inputCallMedic(); } //Cursor movement //Inspiration taken form ArrowAim.gml as I had problems moving the cursor the way I wanted it to move mousex = window_get_width() / 2; mousey = window_get_height() / 2; rStickY = joystick_rpos(1)*100; rStickX = joystick_upos(1)*100; window_mouse_set(mousex + rStickX, mousey + rStickY); //POV or arrows on gamepad, bound to most common bubbles switch joystick_pov(1) { //Thumbs up case 0: instance_create(0, 0, BubbleMenuC); with BubbleMenuC { bubbleImage=36; event_user(0); } break; //Attack! case 90: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=41; event_user(0); } break; //Angry face, might replace with NO Sign case 180: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=22; event_user(0); } break; //Defend! case 270: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=42; event_user(0); } break; //When 2 arrows are pressed simultaneously. Might modify is someone actually plays with a flight joystick default: } //L3 to call for SPY! if (joystick_check_button(1, 9)) { instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=30; event_user(0); } } if(!global.myself.humiliated) { //Shoot if(joystick_check_button(1, 6)) keybyte |= $10; //Secondary action if(joystick_zpos(1) < 0) keybyte |= $08; //Special action with stupid timer as workaround //TODO if the number goes up indefinetly I may have to put a cap to the timer if(joystick_zpos(1) < 0 && JoystickWorkaroundFramesCount >= 60) { inputSpecial(); JoystickWorkaroundFramesCount = 0; } //Taunt L2 if(joystick_zpos(1) > 0) inputTaunt(); } } } if(global.run_virtual_ticks) ClientInputstate(global.serverSocket, keybyte); socket_send(global.serverSocket); } // spectator controls else if (instance_exists(Spectator)) { if(!menuOpen) { if(mouse_check_button_pressed(mb_left)) with (Spectator) event_user(7); if(mouse_check_button_pressed(mb_right)) with (Spectator) event_user(8); } } if(keybyte != 0 or keyboard_check(global.left) or keyboard_check(global.right) or keyboard_check(global.jump) or keyboard_check(global.down)) { afktimer = afktimeout; } ');
Bearbeitung
Datei öffnen
//PrOF 2017 global.joystickExists = false; global.secondaryDelay = 15; //If this gets added it'll be a lot cleaner, clearing and adding is just a lot of code controllerObserver = object_add(); object_set_persistent(controllerObserver, true); object_event_add(controllerObserver, ev_create, 0, ' mouseLocked = false; JoystickMouseLockTimer = 0; mouseStarterY = window_get_width() / 2; mouseStarterX = window_get_height() / 2; '); object_event_add(controllerObserver, ev_step, 0, ' if(joystick_exists(1)){ global.joystickExists = true; JoystickMouseLockTimer += global.delta_factor; //Cursor movement, inspiration taken form ArrowAim.gml //TODO Configurable sensitivity //TODO change deadzone calculation to be a percentage if (joystick_check_button(1, 7) && JoystickMouseLockTimer >= 10) { mouseLocked = !mouseLocked; JoystickMouseLockTimer = 0; } if (!mouseLocked) { if(instance_exists(MenuController)) { //Menu mode /* Woo debug stuff, coming hopefully next update lStickY = joystick_ypos(1)*30; lStickX = joystick_xpos(1)*30; if (lStickY < 6 && lStickY > -6 && lStickX < 6 && lStickX > -6){ //Do nothing } else { mouseStarterY = mouseStarterY + lStickY; mouseStarterX = mouseStarterX + lStickX; window_mouse_set(mouseStarterX, mouseStarterY); } show_message("X " + string(mouseStarterX) + " Y " + string(mouseStarterY)); */ } else { //Gameplay mode Sensitivity = 150; //Sniper and quote are handled differently if (instance_exists(Player)) { global.secondaryDelay = 15; /* if (global.myself.class = CLASS_SNIPER) { //TODO use old aim method when aimed Sensitivity = 500; } */ if (global.myself.class = CLASS_QUOTE) { //Disable the delay between Secondary actions global.secondaryDelay = 0; } } mousex = window_get_width() / 2; mousey = window_get_height() / 2; rStickY = joystick_rpos(1)*100; rStickX = joystick_upos(1)*100; //window_mouse_set(mousex + rStickX, mousey + rStickY); gradi = arctan2(rStickY, rStickX); if (rStickY < 20 && rStickY > -20 && rStickX < 20 && rStickX > -20){ //Do nothing } else { window_mouse_set(Sensitivity * cos(gradi) + mousex, Sensitivity * sin(gradi) + mousey); } } } } '); instance_create(0,0,controllerObserver); object_event_add(PlayerControl, ev_create, 0, ' //Used by the stupid Special action workaround JoystickSecondaryTimer = 0; '); object_event_clear(PlayerControl, ev_step, ev_step_begin); object_event_add(PlayerControl, ev_step, ev_step_begin, ' if(instance_exists(MenuController)) exit; var kickOpen; kickOpen = false if (instance_exists(ScoreTableController)) if (ScoreTableController.showadmin) kickOpen = true; if(instance_exists(TeamSelectController) || instance_exists(ClassSelectController) || kickOpen) menuOpen = true; else menuOpen = false; //Checking for input - Mapped Keys if(keyboard_check_pressed(global.changeTeam)) inputChangeTeam(); if(keyboard_check_pressed(global.changeClass)) inputChangeClass(); event_user(8); var keybyte; keybyte = 0; /* KeyByte flags: 02 - down 08 - primary 10 - secondary 20 - right 40 - left 80 - up */ //character object exists if(global.myself.object != -1) { if(!menuOpen) { JoystickSecondaryTimer += global.delta_factor; if(keyboard_check(global.left)) keybyte |= $40; if(keyboard_check(global.right)) keybyte |= $20; if(keyboard_check(global.jump)) keybyte |= $80; if(keyboard_check(global.down)) keybyte |= $02; if(keyboard_check(global.taunt)) keybyte |= $01; if(keyboard_check_pressed(global.chat1)) inputChat1(); if(keyboard_check_pressed(global.chat2)) inputChat2(); if(keyboard_check_pressed(global.chat3)) inputChat3(); if(keyboard_check_pressed(global.drop)) inputDrop(); if(keyboard_check_pressed(global.medic)) { inputCallMedic(); } if(!global.myself.humiliated) { if(keyboard_check(global.attack)) keybyte |= $10; if(keyboard_check(global.special)) keybyte |= $08; if(keyboard_check_pressed(global.special)) inputSpecial(); if(keyboard_check_pressed(global.taunt)) inputTaunt(); if(mouse_check_button(mb_left)) { if(global.attack == MOUSE_LEFT) keybyte |= $10; if(global.special == MOUSE_LEFT) keybyte |= $08; } if(mouse_check_button_pressed(mb_left) and global.special == MOUSE_LEFT) inputSpecial(); if(mouse_check_button(mb_right)) { if(global.attack == MOUSE_RIGHT) keybyte |= $10; if(global.special == MOUSE_RIGHT) keybyte |= $08; } if(mouse_check_button_pressed(mb_right) and global.special == MOUSE_RIGHT) inputSpecial(); } //Actual plugin, same as keyboard, but with a Joystick check //Left analog stick could also work using some axis, but it is simpler this way. This will be changed once the controllerObserver gets used if (global.joystickExists) { //Left if(joystick_direction(1) == vk_numpad4 || joystick_direction(1) == vk_numpad7 || joystick_direction(1) == vk_numpad1) keybyte |= $40; //Right if(joystick_direction(1) == vk_numpad6 || joystick_direction(1) == vk_numpad9 || joystick_direction(1) == vk_numpad3) keybyte |= $20; //Jump if(joystick_check_button(1, 5)) keybyte |= $80; //Down if(joystick_direction(1) == vk_numpad2 || joystick_direction(1) == vk_numpad1 || joystick_direction(1) == vk_numpad3) keybyte |= $02; //Taunt L2 if(joystick_zpos(1) > 0) keybyte |= $01; //Context action, O if (joystick_check_button(1, 2)) { if (instance_exists(CTFHUD) || instance_exists(GeneratorHUD)){ //Intelligence bubble, because a generator bubble does not exists instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=29; event_user(0); } //Drop intel. Yes even if we are in a generator map inputDrop(); } else if (instance_exists(ControlPointHUD) || instance_exists(ArenaHUD) || instance_exists(KothHUD) || instance_exists(DKothHUD)){ //Control point bubble instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=33; event_user(0); } } //Support for payload? Maybe. Maybe } //Medic! X Button if(joystick_check_button(1, 1)) { inputCallMedic(); } //POV or arrows on gamepad, bound to most common bubbles switch joystick_pov(1) { //Thumbs up case 0: instance_create(0, 0, BubbleMenuC); with BubbleMenuC { bubbleImage=36; event_user(0); } break; //Attack! case 90: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=41; event_user(0); } break; //Angry face, might replace with NO Sign case 180: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=22; event_user(0); } break; //Defend! case 270: instance_create(0, 0, BubbleMenuZ); with BubbleMenuZ { bubbleImage=42; event_user(0); } break; //When 2 arrows are pressed simultaneously. Might modify is someone actually plays with a flight joystick default: } //L3 to call for SPY! if (joystick_check_button(1, 9)) { instance_create(0, 0, BubbleMenuX); with BubbleMenuX { bubbleImage=30; event_user(0); } } if(!global.myself.humiliated) { //Shoot if(joystick_check_button(1, 6)) keybyte |= $10; //Secondary action if(joystick_zpos(1) < 0) keybyte |= $08; //Special action with stupid timer as workaround //TODO if the number going up indefinetly causes issues I might have to put a cap to the timer if(joystick_zpos(1) < 0 && JoystickSecondaryTimer >= global.secondaryDelay) { inputSpecial(); JoystickSecondaryTimer = 0; } //Taunt L2 if(joystick_zpos(1) > 0) inputTaunt(); } } } if(global.run_virtual_ticks) ClientInputstate(global.serverSocket, keybyte); socket_send(global.serverSocket); } // spectator controls else if (instance_exists(Spectator)) { if(!menuOpen) { if(mouse_check_button_pressed(mb_left)) with (Spectator) event_user(7); if(mouse_check_button_pressed(mb_right)) with (Spectator) event_user(8); //Joystick controls if (global.joystickExists && JoystickSecondaryTimer > 10) { JoystickSecondaryTimer = 0; if(joystick_check_button(1, 1) ) with (Spectator) event_user(7); if(joystick_check_button(1, 2)) with (Spectator) event_user(8); } } } if(keybyte != 0 or keyboard_check(global.left) or keyboard_check(global.right) or keyboard_check(global.jump) or keyboard_check(global.down)) { afktimer = afktimeout; } ');
Unterschied finden