Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled diff
作成日
9 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
27 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
242 行
すべてコピー
107 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
322 行
すべてコピー
コピー
コピー済み
コピー
コピー済み
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;
');
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
JoystickWorkaroundFramesCount
= 0;
JoystickSecondaryTimer
= 0;
');
');
コピー
コピー済み
コピー
コピー済み
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)
{
{
コピー
コピー済み
コピー
コピー済み
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();
}
}
コピー
コピー済み
コピー
コピー済み
//
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();
}
}
コピー
コピー済み
コピー
コピー済み
//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
コピー
コピー済み
コピー
コピー済み
//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();
コピー
コピー済み
コピー
コピー済み
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);
コピー
コピー済み
コピー
コピー済み
//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;
}
}
');
');
保存された差分
原文
ファイルを開く
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; } ');
変更されたテキスト
ファイルを開く
//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; } ');
違いを見つける