Earlier quoted context omitted.
What's wrong with this?
Over 150 lines of code in a simple method? C-style declaration of all the variables in the beginning? (Yes, I know what Carmack said about how he written the project; this explains it, but doesn't make it good C++ code.) Unclear flow with just one comment, which doesn't really explain anything?
Well, some familiarity with the game helps, too. This is the code that runs when a certain pick-up item's effect activates.