function grabCollisionArrayPixel(xz,yz:integer;xx,yy:intege r) : byte;
begin
if ((yz mod 512) = 0) then inc(yz);
if ((xz mod 512) = 0) then inc(xz);
if(yy < 1) then yy := 1;
if(xx < 1) then xx := 1;
try
result := arrayCollisionPixels[yy,xx]^[ (512 * (yz mod 512)) + (xz mod 512) ];
except
raise exception.create('Bad memory access');
writeln('SIGSEGV noted');
result := 255;
end;
end;
If anybody could help me with stopping this from crashing I would majorly appreciate it. It's certainly not xx and yy being out of bound, and the second value can range from 0 to 262144. By my calculations, (512 * (yz mod 512)) + (xz mod 512) should never be larget than 262143, even if yz and xz are both 511. So any ideas?
Bookmarks