Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //All problems related to exiting water are probably here. -Z
- if(action==swimming)
- {
- if(!wf)
- {
- if(landswim>= (get_bit(quest_rules,qr_DROWN) && isSwimming() ? 1
- : (!diagonalMovement) ? 1 : 22))
- {
- //Check for out of bounds for swimming
- bool changehop = true;
- if(diagonalMovement)
- {
- if(wx<0||wy<0)
- changehop = false;
- else if(wx>248)
- changehop = false;
- else if(wx>240&&cnt==2)
- changehop = false;
- else if(wy>168)
- changehop = false;
- }
- //This may be where the hang-up for exiting water exists. -Z
- // hop out of the water
- if(changehop)
- ret.setHopClk(1);
- }
- else
- {
- if(dir==d2 || shiftdir==d2)
- {
- //int vx=((int)x+4)&0xFFF8;
- //int vy=((int)y+4)&0xFFF8;
- if(d2==left)
- {
- if(!iswater(MAPCOMBO(x-1,y+(bigHitbox?6:11))) &&
- !iswater(MAPCOMBO(x-1,y+(bigHitbox?9:12))) &&
- !_walkflag(x-1,y+(bigHitbox?6:11),1) &&
- !_walkflag(x-1,y+(bigHitbox?9:12),1))
- {
- ret.setHopDir(d2);
- ret.setIlswim(true);
- }
- else ret.setIlswim(false);
- }
- else if(d2==right)
- {
- if(!iswater(MAPCOMBO(x+16,y+(bigHitbox?6:11))) &&
- !iswater(MAPCOMBO(x+16,y+(bigHitbox?9:12))) &&
- !_walkflag(x+16,y+(bigHitbox?6:11),1) &&
- !_walkflag(x+16,y+(bigHitbox?9:12),1))
- {
- ret.setHopDir(d2);
- ret.setIlswim(true);
- }
- else ret.setIlswim(false);
- }
- else if(d2==up)
- {
- if(!iswater(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1)) &&
- !iswater(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1)) &&
- !_walkflag(x+7,y+(bigHitbox?0:8)-1,1) &&
- !_walkflag(x+8,y+(bigHitbox?0:8)-1,1))
- {
- ret.setHopDir(d2);
- ret.setIlswim(true);
- }
- else ret.setIlswim(false);
- }
- else if(d2==down)
- {
- if(!iswater(MAPCOMBO(x+7,y+16)) &&
- !iswater(MAPCOMBO(x+8,y+16)) &&
- !_walkflag(x+7,y+16,1) &&
- !_walkflag(x+8,y+16,1))
- {
- ret.setHopDir(d2);
- ret.setIlswim(true);
- }
- else ret.setIlswim(false);
- }
- }
- if(wx<0||wy<0);
- else if(wx>248);
- else if(wx>240&&cnt==2);
- else if(wy>168);
- else if(get_bit(quest_rules, qr_DROWN) && !ilswim);
- else if(iswater(MAPCOMBO(wx,wy)) && iswater(MAPCOMBO(wx,wy)))
- {
- ret.setUnwalkable(false);
- return ret;
- }
- else
- {
- ret.setUnwalkable(true);
- return ret;
- }
- }
- }
- else
- {
- bool wtrx = iswater(MAPCOMBO(wx,wy));
- bool wtrx8 = iswater(MAPCOMBO(x+8,wy));
- if((d2>=left && wtrx) || (d2<=down && wtrx && wtrx8))
- {
- ret.setUnwalkable(false);
- return ret;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement