Neptune
Member
I'm struggling to wrap my head around converting this code. I'm very new to bit-wise operations, and no where near ready to understand how to convert this mathematically.
Any help appreciated. I would like to have this same code, but with no bit operations / bit shifting. I tried a few suggestions and the values ended up being undefined for some reason
All variables are just local within a function/script
sx, cx, xx, sy, cy, yy are all integers
There are the two shifts, and a clamp of sorts with the & $FFFF... I think?
Any help appreciated. I would like to have this same code, but with no bit operations / bit shifting. I tried a few suggestions and the values ended up being undefined for some reason
All variables are just local within a function/script
sx, cx, xx, sy, cy, yy are all integers
GML:
for(var a = -1; a < 2; a++)
{
for(var i = -1; i < 2; i++)
{
sx = cx+i;
sy = cy+a;
if condition
{
ds_list_add(rnd_list, sy << 16 | sx);
}
}
}
var rand_cell = irandom_range(0,ds_list_size(rnd_list)-1);
var rnd = rnd_list[| rand_cell];
cx = rnd & $FFFF;
cy = rnd >> 16;
Last edited: