diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4c19865e9..ad60418f0 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,7 +1,7 @@ October 17, 2009 (Changes by Graf Zahl) -- Fixed: The rail sound used the shooter's position for calculating the sound origin - but should use the camera position instead to get the correct position for - the closest point along the trail. +- Fixed: 3DMidtex checks were treating the Null texture as a valid texture. +- Fixed: The rail sound's position was not clamped to the actual range between + the trail's start and end point. - Fixed: Explosions no longer caused splashes. - Fixed: Copying translations to lower decals had the shade color check wrong. - Fixed: Waggling floors did not moved attached geometry. diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 94df21d8c..39186ae9f 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -219,6 +219,7 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f side_t *side = line->sidedef[sideno]; FTextureID texnum = side->GetTexture(side_t::mid); + if (!texnum.isValid()) return false; FTexture * tex= TexMan(texnum); if (!tex) return false; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 79de562c1..8a4d5bb1f 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -476,7 +476,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end // Only consider sound in 2D (for now, anyway) // [BB] You have to devide by lengthsquared here, not multiply with it. - r = ((start.Y - FIXED2FLOAT(viewy)) * (-dir.Y) - (start.X - FIXED2FLOAT(viewx)) * (dir.X)) / lengthsquared; + r = ((start.Y - FIXED2FLOAT(mo->y)) * (-dir.Y) - (start.X - FIXED2FLOAT(mo->x)) * (dir.X)) / lengthsquared; r = clamp(r, 0., 1.); dirz = dir.Z; @@ -484,20 +484,6 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end point = start + r * dir; dir.Z = dirz; -#if 0 - Printf("Start = (%1.4f,%1.4f), End = (%1.4f,%1.4f), Dir =(%1.4f,%1.4f), View = (%1.4f,%1.4f), Point = (%1.4f,%1.4f), r=%1.4f\n", - start.X, start.Y, end.X, end.Y, dir.X, dir.Y, FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), - point.X, point.Y, r); - - FVector3 _start = start; - FVector3 _end = end; - FVector3 view(FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), 0); - point.Z = _start.Z = _end.Z = 0; - - Printf("S: %1.4f, E: %1.4f, H: %1.4f P: %1.4f\n", - (_start-view).Length(), (_end-view).Length(), (((_start+_end)/2)-view).Length(), (point-view).Length()); -#endif - S_Sound (FLOAT2FIXED(point.X), FLOAT2FIXED(point.Y), viewz, CHAN_WEAPON, sound, 1, ATTN_NORM); }