@@ -360,10 +360,27 @@ function love.drawControllerOverlay()
360
360
361
361
local controller = watcher .controller [PORT + 1 ]
362
362
363
+ if PANEL_SETTINGS :IsSlippiReplay () then
364
+ local player = watcher .player [PORT + 1 ]
365
+
366
+ if not player then return end
367
+
368
+ local entity
369
+
370
+ if player .transformed == 256 then
371
+ -- If the player has the "transformed" flag set, assume they are now controlling the "partner" entity
372
+ entity = player .partner
373
+ else
374
+ entity = player .entity
375
+ end
376
+
377
+ controller = entity .controller
378
+ end
379
+
363
380
if controller then
364
381
-- Draw Joystick
365
382
366
- if controller .plugged ~= 0x00 then
383
+ if controller .plugged and controller . plugged ~= 0x00 then
367
384
local sin = 128 + math.sin (love .timer .getTime ()* 2 ) * 128
368
385
graphics .setColor (255 , 0 , 0 , sin )
369
386
graphics .easyDraw (DC_CON , 512 - 42 - 16 , 256 - 42 - 16 , 0 , 42 , 42 )
@@ -449,50 +466,90 @@ function love.drawControllerOverlay()
449
466
450
467
-- Draw L
451
468
452
- local al , ar = watcher .game .translateTriggers (controller .analog .l , controller .analog .r )
469
+ if PANEL_SETTINGS :IsSlippiReplay () then
470
+ graphics .setLineStyle (" smooth" )
471
+ love .graphics .setLineWidth (3 )
453
472
454
- graphics .setLineStyle (" smooth" )
455
- love .graphics .setLineWidth (3 )
473
+ graphics .stencil (function ()
474
+ -- Create a rounded rectangle mask
475
+ graphics .rectangle (" fill" , 108 + 14 , 16 , 100 , 12 , 6 , 6 )
476
+ end , " replace" , 1 )
477
+ graphics .setStencilTest (" greater" , 0 ) -- Only draw within our rounded rectangle mask
478
+ -- Analog
456
479
457
- graphics .stencil (function ()
458
- -- Create a rounded rectangle mask
459
- graphics .rectangle (" fill" , 24 + 14 , 16 , 100 , 12 , 6 , 6 )
460
- end , " replace" , 1 )
461
- graphics .setStencilTest (" greater" , 0 ) -- Only draw within our rounded rectangle mask
462
- -- L Analog
463
- graphics .rectangle (" fill" , 24 + 14 , 16 , 88 * al , 12 )
480
+ local analog = controller .analog .float
464
481
465
- -- L Button
466
- if bit .band (controller .buttons .pressed , BUTTONS .L ) == BUTTONS .L then
467
- graphics .rectangle (" fill" , 24 + 14 + 88 , 16 , 12 , 12 )
468
- end
469
- graphics . setStencilTest ()
482
+ -- L Button
483
+ if bit .band (controller .buttons .pressed , BUTTONS .L ) == BUTTONS .L then
484
+ graphics .rectangle (" fill" , 108 + 14 , 16 , 12 , 12 )
485
+ analog = 1
486
+ end
470
487
471
- -- Draw outline
472
- graphics .rectangle (" line" , 24 + 14 , 16 , 100 , 12 , 6 , 6 )
473
- -- Draw segment for button press
474
- graphics .line (24 + 14 + 88 , 16 , 24 + 14 + 88 , 16 + 12 )
488
+ -- R Button
489
+ if bit .band (controller .buttons .pressed , BUTTONS .R ) == BUTTONS .R then
490
+ graphics .rectangle (" fill" , 108 + 14 + 12 + 76 , 16 , 12 , 12 )
491
+ analog = 1
492
+ end
475
493
476
- -- Draw R
494
+ local w = 76 * analog
495
+ graphics .rectangle (" fill" , 108 + 14 + 12 + 76 / 2 - (w / 2 ), 16 , w , 12 )
496
+ graphics .setStencilTest ()
497
+
498
+ -- Draw outline
499
+ graphics .rectangle (" line" , 108 + 14 , 16 , 100 , 12 , 6 , 6 )
500
+ -- Draw segment for button press
501
+ graphics .line (108 + 14 + 88 , 16 , 108 + 14 + 88 , 16 + 12 )
502
+
503
+ -- Draw segment for button press
504
+ graphics .line (108 + 14 + 12 , 16 , 108 + 14 + 12 , 16 + 12 )
505
+ else
506
+ local al , ar = watcher .game .translateTriggers (controller .analog .l , controller .analog .r )
507
+
508
+ graphics .setLineStyle (" smooth" )
509
+ love .graphics .setLineWidth (3 )
510
+
511
+ graphics .stencil (function ()
512
+ -- Create a rounded rectangle mask
513
+ graphics .rectangle (" fill" , 24 + 14 , 16 , 100 , 12 , 6 , 6 )
514
+ end , " replace" , 1 )
515
+ graphics .setStencilTest (" greater" , 0 ) -- Only draw within our rounded rectangle mask
516
+ -- L Button
517
+ if bit .band (controller .buttons .pressed , BUTTONS .L ) == BUTTONS .L then
518
+ graphics .rectangle (" fill" , 24 + 14 + 88 , 16 , 12 , 12 )
519
+ al = 1
520
+ end
477
521
478
- graphics .stencil (function ()
479
- -- Create a rounded rectangle mask
480
- graphics .rectangle (" fill" , 48 + 128 + 14 , 16 , 100 , 12 , 6 , 6 )
481
- end , " replace" , 1 )
482
- graphics .setStencilTest (" greater" , 0 ) -- Only draw within our rounded rectangle mask
483
- -- R Analog
484
- graphics .rectangle (" fill" , 48 + 128 + 14 + 12 + (88 * (1 - ar )), 16 , 88 * ar , 12 )
522
+ -- L Analog
523
+ graphics .rectangle (" fill" , 24 + 14 , 16 , 88 * al , 12 )
524
+ graphics .setStencilTest ()
525
+
526
+ -- Draw outline
527
+ graphics .rectangle (" line" , 24 + 14 , 16 , 100 , 12 , 6 , 6 )
528
+ -- Draw segment for button press
529
+ graphics .line (24 + 14 + 88 , 16 , 24 + 14 + 88 , 16 + 12 )
530
+
531
+ -- Draw R
532
+
533
+ graphics .stencil (function ()
534
+ -- Create a rounded rectangle mask
535
+ graphics .rectangle (" fill" , 48 + 128 + 14 , 16 , 100 , 12 , 6 , 6 )
536
+ end , " replace" , 1 )
537
+ graphics .setStencilTest (" greater" , 0 ) -- Only draw within our rounded rectangle mask
538
+ -- R Button
539
+ if bit .band (controller .buttons .pressed , BUTTONS .R ) == BUTTONS .R then
540
+ graphics .rectangle (" fill" , 48 + 128 + 14 , 16 , 12 , 12 )
541
+ ar = 1
542
+ end
485
543
486
- -- R Button
487
- if bit .band (controller .buttons .pressed , BUTTONS .R ) == BUTTONS .R then
488
- graphics .rectangle (" fill" , 48 + 128 + 14 , 16 , 12 , 12 )
489
- end
490
- graphics .setStencilTest ()
544
+ -- R Analog
545
+ graphics .rectangle (" fill" , 48 + 128 + 14 + 12 + (88 * (1 - ar )), 16 , 88 * ar , 12 )
546
+ graphics .setStencilTest ()
491
547
492
- -- Draw outline
493
- graphics .rectangle (" line" , 48 + 128 + 14 , 16 , 100 , 12 , 6 , 6 )
494
- -- Draw segment for button press
495
- graphics .line (48 + 128 + 14 + 12 , 16 , 48 + 128 + 14 + 12 , 16 + 12 )
548
+ -- Draw outline
549
+ graphics .rectangle (" line" , 48 + 128 + 14 , 16 , 100 , 12 , 6 , 6 )
550
+ -- Draw segment for button press
551
+ graphics .line (48 + 128 + 14 + 12 , 16 , 48 + 128 + 14 + 12 , 16 + 12 )
552
+ end
496
553
497
554
-- Draw buttons
498
555
0 commit comments