underwater


(klines) #1

i’m been trying to create a feature that would make the game act as if the entity/player was underwater (walking/swimming for example), even when they are in the air. i’ve been looking around both the game and cgame sections of source but can’t find anything. does anyone know how to do this or have a suggestion as to where to look?

thanks in advance,
sam kline


(Cheez It) #2

I would look in bg_pmove.c in PM_WalkMove() and maybe force it to call PM_WaterMove() where it would normaly call PM_AirMove(). Thats just a guess though, I havent worked with player movement much.


(klines) #3

yes i accually just found that. now i move like i am underwater, but i can still shoot and walk (not swim). any other ideas? im still looking…


(jet Pilot) #4

for shooting and such, keep looking around bg_pmove.c, in the function PM_Weapon(), specifically at the section starting with:


if(pm->waterlevel == 3)

Also, do a search for waterlevel in the code to see all the things related to it.
In case you don’t know, there are 4 waterlevel settings :
0 - not in or touching water
1 - wading in water (feet are on the ground underneath)
2 - at the surface of the water (feet not touching the ground, but yourhead is out)
3 - completely submerged