]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_phys.c
Fixed crash in Host_Shutdown when MR_Shutdown was 0.
[xonotic/darkplaces.git] / sv_phys.c
index f592b08e40f53010a205140b5f0df78b95aaded5..37b1ae5ffaafbb877b2fe352b07855f3aed1cfc3 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1131,21 +1131,17 @@ void SV_CheckWaterTransition (edict_t *ent)
                return;
        }
 
+       // check if the entity crossed into or out of water
+       if ((ent->v->watertype == CONTENTS_WATER || ent->v->watertype == CONTENTS_SLIME) != (cont == CONTENTS_WATER || cont == CONTENTS_SLIME))
+               SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
+
        if (cont <= CONTENTS_WATER)
        {
-               if (ent->v->watertype == CONTENTS_EMPTY && cont != CONTENTS_LAVA)
-                       // just crossed into water
-                       SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
-
                ent->v->watertype = cont;
                ent->v->waterlevel = 1;
        }
        else
        {
-               if (ent->v->watertype != CONTENTS_EMPTY && ent->v->watertype != CONTENTS_LAVA)
-                       // just crossed into water
-                       SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
-
                ent->v->watertype = CONTENTS_EMPTY;
                ent->v->waterlevel = 0;
        }