It
did in fact, actually fix it,
Nope (I already explained the math in my previous post). Think carefully about what the code is doing and which bits of y affect the final result.
If the bug is gone it is due to an unrelated change you made (or insufficient testing).
Don't believe me? Try to find a single value of y for which the old and new versions of the functions behave differently (or look again at the code and think about the math.)
I still do not know
what bugs you originally intended to fix with the clamp change:
It's a short function and the only relevant line is:
Code:
int combo = (cy&0xF0)+(cx>>4);
return TheMaps[currmap*MAPSCRS+s].data[combo]; // entire combo code
Think about what this code is doing and then answer these questions:
1. What happens if the value of cx is greater than 255?
2. What happens if the value of cy is greater than 175?
3. How should cx and cy be clamped to fix these issues (there are multiple possible correct solutions; 160 and 168 behave exactly the same for cy, for instance, as explained above.)
Don't make changes to the code based on guesses or "values in a number of other functions." Think about the code and be sure.