Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int RotateDirNum(int d, int n){
- for (int i = 0; i < n; ++i) {
- if ( d == DIR_UP )
- d = DIR_RIGHT;
- else if ( d == DIR_RIGHT )
- d = DIR_DOWN;
- else if ( d == DIR_DOWN )
- d = DIR_LEFT;
- else
- d = DIR_UP;
- }
- return d;
- }
- int i; int j; int x = Link->X; int y = Link->Y;
- if ( Screen->isSolid(Link->X+8, Link->Y+8) ) {
- for (i = 1; i < 6; ++i) {
- for (j = 0; j < 4; ++j) {
- x = Link->X+8+VectorX(8*i, DirAngle(RotateDirNum(Link->Dir, j)));
- y = Link->Y+8+VectorY(8*i, DirAngle(RotateDirNum(Link->Dir, j)));
- if ( !Screen->isSolid(x, y) ) {
- i = 9999;
- j = 4;
- }
- }
- }
- if ( i >= 9999 ) {
- Link->X = x-8;
- Link->Y = y-8;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement