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

Function PlrDirOK

Source/player.cpp:1025–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025BOOL PlrDirOK(int pnum, int dir)
1026{
1027 int px, py;
1028 BOOL isOk;
1029
1030 if ((DWORD)pnum >= MAX_PLRS) {
1031 app_fatal("PlrDirOK: illegal player %d", pnum);
1032 }
1033
1034 px = plr[pnum].WorldX + offset_x[dir];
1035 py = plr[pnum].WorldY + offset_y[dir];
1036
1037 if (px < 0 || !dPiece[px][py] || !PosOkPlayer(pnum, px, py)) {
1038 return FALSE;
1039 }
1040
1041 isOk = TRUE;
1042 if (dir == DIR_E) {
1043 isOk = !SolidLoc(px, py + 1) && !(dFlags[px][py + 1] & BFLAG_PLAYERLR);
1044 }
1045
1046 if (isOk && dir == DIR_W) {
1047 isOk = !SolidLoc(px + 1, py) && !(dFlags[px + 1][py] & BFLAG_PLAYERLR);
1048 }
1049
1050 return isOk;
1051}
1052
1053void PlrClrTrans(int x, int y)
1054{

Callers 3

StartWalkFunction · 0.85
StartWalk2Function · 0.85
StartWalk3Function · 0.85

Calls 3

app_fatalFunction · 0.85
PosOkPlayerFunction · 0.85
SolidLocFunction · 0.85

Tested by

no test coverage detected