The screen distortion when submerged, known as "water warp" (from the r_waterwarp cvar name) is one of the main visual effects introduced in the first Quake game.
The four "wait" commands makes the engine run 4 frames before pausing, which is needed to allow all data to be properly initialized and updated by the savegame.
The above screenshot was upscaled 4 times, to serve as a base for comparison against the highest 4:3 resolution supported by the vanilla WinQuake engine, which is 1280x960.
The 4:3 aspect was chosen because it is the only one that WinQuake can render at.
The window borders were kept to make sure that the output image resolution was accurately set.
By following this test, here's how the waterwarp looks at 1280x960 in WinQuake and several other engines.
The borders of the following screenshots were padded to align the contents of their windows to the contents of the original 320x240 screenshot above, which allows for easier per-pixel comparisons.
On all these engines I've tested, only Retroquad was fully accurate to the original 320x240 rendering. FTEQW was pretty close, with the size of the waves being the most faithful among all the other engines, despite not being truly accurate.
"WinQuake Mark V" at 1280x960 is consistent with vanilla WinQuake at the same resolution, but this is actually a false positive, since WinQuake is not consistent with itself.
Retroquad is not only accurate at 1280x960, but it is also consistently accurate across multiple resolutions and aspects, in both windowed and fullscreen video modes.
The algorithm it uses was developed for the Makaqu engine, and here is an animated collection of screenshots for comparing exactly the same scene across many different configurations.
Each screenshot in the animation linked above was scaled and offset to align their contents for per-pixel comparisons.
FTEQW is also consistent across multiple resolutions, but since there's no way to pause its waterwarp effect, there's no way to make an animated screenshot comparison like the above.
The properly-scaled submerged screen warping algorithm from the Makaqu engine was posted in this topic 3 years and a half ago.
For comparison purposes, the original WinQuake algorithm, with all its inconsistencies, can be found here.
And the FTEQW source code can be found in its official website.
I've always noticed the WARP_WIDTH and WARP_HEIGHT defines aren't particularly consistent nor friendly to larger resolutions.
There's probably a formula that I could come up with, but I admittedly hacked it up very quickly to suit my needs.