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

Function MakePlrPath

Source/player.cpp:3596–3654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3594}
3595
3596void MakePlrPath(int pnum, int xx, int yy, BOOL endspace)
3597{
3598 int path;
3599
3600 if ((DWORD)pnum >= MAX_PLRS) {
3601 app_fatal("MakePlrPath: illegal player %d", pnum);
3602 }
3603
3604 plr[pnum]._ptargx = xx;
3605 plr[pnum]._ptargy = yy;
3606 if (plr[pnum]._px == xx && plr[pnum]._py == yy) {
3607 return;
3608 }
3609
3610 path = FindPath(PosOkPlayer, pnum, plr[pnum]._px, plr[pnum]._py, xx, yy, plr[pnum].walkpath);
3611 if (!path) {
3612 return;
3613 }
3614
3615 if (!endspace) {
3616 path--;
3617
3618 switch (plr[pnum].walkpath[path]) {
3619 case WALK_NE:
3620 yy++;
3621 break;
3622 case WALK_NW:
3623 xx++;
3624 break;
3625 case WALK_SE:
3626 xx--;
3627 break;
3628 case WALK_SW:
3629 yy--;
3630 break;
3631 case WALK_N:
3632 xx++;
3633 yy++;
3634 break;
3635 case WALK_E:
3636 xx--;
3637 yy++;
3638 break;
3639 case WALK_S:
3640 xx--;
3641 yy--;
3642 break;
3643 case WALK_W:
3644 xx++;
3645 yy--;
3646 break;
3647 }
3648
3649 plr[pnum]._ptargx = xx;
3650 plr[pnum]._ptargy = yy;
3651 }
3652
3653 plr[pnum].walkpath[path] = WALK_NONE;

Callers 12

PerformSecondaryActionFunction · 0.85
On_WALKXYFunction · 0.85
On_GOTOGETITEMFunction · 0.85
On_GOTOAGETITEMFunction · 0.85
On_ATTACKXYFunction · 0.85
On_OPOBJXYFunction · 0.85
On_DISARMXYFunction · 0.85
On_ATTACKIDFunction · 0.85
On_ATTACKPIDFunction · 0.85
On_TALKXYFunction · 0.85
CheckNewPathFunction · 0.85

Calls 2

app_fatalFunction · 0.85
FindPathFunction · 0.85

Tested by

no test coverage detected