From DoomWiki.org Warning: You are not logged in. Your IP address will be recorded in this page's edit history. Anti-spam check. Do not fill this in! ==Code== The corrected code, copied from ZDoom, is below: for (count = 0 ; count < 100 ; count++) { if (flags & PT_ADDLINES) { AddLineIntercepts(mapx, mapy); } if (flags & PT_ADDTHINGS) { AddThingIntercepts(mapx, mapy, btit); } if (mapx == xt2 && mapy == yt2) { break; } // [RH] Handle corner cases properly instead of pretending they don't exist. switch ((((yintercept >> FRACBITS) == mapy) << 1) | ((xintercept >> FRACBITS) == mapx)) { case 0: // neither xintercept nor yintercept match! count = 100; // Stop traversing, because somebody screwed up. break; case 1: // xintercept matches xintercept += xstep; mapy += mapystep; break; case 2: // yintercept matches yintercept += ystep; mapx += mapxstep; break; case 3: // xintercept and yintercept both match // The trace is exiting a block through its corner. Not only does the block // being entered need to be checked (which will happen when this loop // continues), but the other two blocks adjacent to the corner also need to // be checked. if (flags & PT_ADDLINES) { AddLineIntercepts(mapx + mapxstep, mapy); AddLineIntercepts(mapx, mapy + mapystep); } if (flags & PT_ADDTHINGS) { AddThingIntercepts(mapx + mapxstep, mapy, btit); AddThingIntercepts(mapx, mapy + mapystep, btit); } xintercept += xstep; yintercept += ystep; mapx += mapxstep; mapy += mapystep; break; } } In the original code, "Case 3" was missing. Quoting [[Christoph Oelckers (Graf Zahl)]]: "When case 3 is not there the trace will get lost with no chance of ever getting back on track which would cause an endless loop. That's where the 'for' loop came in. Apparently id had problems with the code hanging but never found the real cause so they just put a safety net around their broken algorithm so that it can terminate."{{cite web|author=|title=Is it possible to... (Heretic source) - Doomworld Forums|url=https://www.doomworld.com/vb/source-ports/48276-is-it-possible-to-heretic-source/|publication=|publishdate=October 11, 2009|accessdate=November 29, 2016}} Summary: All contributions to DoomWiki.org are considered to be released under the CC BY-SA 4.0 International (see Doom Wiki:Copyrights for details). By contributing, you agree to be bound by the Terms of Use. Your changes will be visible immediately. Please enter a summary of your changes above. Do not submit copyrighted images or text without permission! This includes text taken from in-game codices or logbooks, or from official instruction manuals, strategy guides, and other such books. This project is not affiliated with id Software, Raven Software, ZeniMax Media, Bethesda SoftWorks, or any other commercial software developer or publisher. Use of trademarked logos and other protected intellectual property is solely for the purpose of analysis and critical commentary on the identified products and associated fan community activity, and does not imply any endorsement by any of these organizations or their employees, past or present. Upload images to the wiki. Don't forget to categorize pages! For testing, please use a sandbox. View this template Cancel | Editing help (opens in new window)