MCPcopy Create free account
hub / github.com/diasurgical/devilution / HotSpellMove

Function HotSpellMove

SourceX/controls/plrctrls.cpp:652–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652void HotSpellMove(MoveDirection dir)
653{
654 int x = 0;
655 int y = 0;
656
657 DWORD ticks = SDL_GetTicks();
658 if (ticks - invmove < repeatRate) {
659 return;
660 }
661 invmove = ticks;
662
663 for (int r = 0; r < speedspellcount; r++) { // speedbook cells are 56x56
664 // our 3 rows by y axis
665 if (speedspellscoords[r].y == 307)
666 hsr[0]++;
667 if (speedspellscoords[r].y == 251)
668 hsr[1]++;
669 if (speedspellscoords[r].y == 195)
670 hsr[2]++;
671 if (MouseX >= speedspellscoords[r].x - 28 && MouseX < speedspellscoords[r].x + (28) && MouseY >= speedspellscoords[r].y - (28) && MouseY < speedspellscoords[r].y + 28) {
672 spbslot = r;
673 //sprintf(tempstr, "IN HOT SPELL CELL NUM:%i", r);
674 //NetSendCmdString(1 << myplr, tempstr);
675 }
676 }
677
678 if (dir.y == MoveDirectionY::UP) {
679 if (speedspellscoords[spbslot].y == 307 && hsr[1] > 0) { // we're in row 1, check if row 2 has spells
680 if (HSExists(MouseX, 251)) {
681 x = MouseX;
682 y = 251;
683 }
684 } else if (speedspellscoords[spbslot].y == 251 && hsr[2] > 0) { // we're in row 2, check if row 3 has spells
685 if (HSExists(MouseX, 195)) {
686 x = MouseX;
687 y = 195;
688 }
689 }
690 } else if (dir.y == MoveDirectionY::DOWN) {
691 if (speedspellscoords[spbslot].y == 251) { // we're in row 2
692 if (HSExists(MouseX, 307)) {
693 x = MouseX;
694 y = 307;
695 }
696 } else if (speedspellscoords[spbslot].y == 195) { // we're in row 3
697 if (HSExists(MouseX, 251)) {
698 x = MouseX;
699 y = 251;
700 }
701 }
702 }
703 if (dir.x == MoveDirectionX::LEFT) {
704 if (spbslot >= speedspellcount - 1)
705 return;
706 spbslot++;
707 x = speedspellscoords[spbslot].x;
708 y = speedspellscoords[spbslot].y;
709 } else if (dir.x == MoveDirectionX::RIGHT) {

Callers 1

MovementFunction · 0.85

Calls 2

HSExistsFunction · 0.85
SetCursorPosFunction · 0.85

Tested by

no test coverage detected