I am working on making a mod of a mod for "Pizza Tower Online", and I've been getting this weird issue causing YYC to fail, but not VM. Here is the code snippet causing this:
function instance_in_camera(inst = id, cam = view_camera[0])
{
var camx = camera_get_view_x(cam);
var camy = camera_get_view_y(cam);
var camw = camera_get_view_width(cam);
var camh = camera_get_view_height(cam);
var result = false;
var xx = inst.x - sprite_get_xoffset(inst.sprite_index);
var yy = inst.y - sprite_get_yoffset(inst.sprite_index);
// left bottom
result = result || point_in_rectangle(xx + sprite_get_bbox_left(inst.sprite_index), yy + sprite_get_bbox_bottom(inst.sprite_index), camx, camy, camx + camw, camy + camh);
if (result)
return result;
// left top
if (!result)
{
result = result || point_in_rectangle(xx + sprite_get_bbox_left(inst.sprite_index), yy + sprite_get_bbox_top(inst.sprite_index), camx, camy, camx + camw, camy + camh);
if (result)
return result;
}
// right bottom
if (!result)
{
result = result || point_in_rectangle(xx + sprite_get_bbox_right(inst.sprite_index), yy + sprite_get_bbox_bottom(inst.sprite_index), camx, camy, camx + camw, camy + camh);
if (result)
return result;
}
// right top
if (!result)
{
result = result || point_in_rectangle(xx + sprite_get_bbox_right(inst.sprite_index), yy + sprite_get_bbox_top(inst.sprite_index), camx, camy, camx + camw, camy + camh);
if (result)
return result;
}
return false;
}
I am using GameMaker 2022.0.0.12 Runtime, 2022.0.0.19 IDE.
I tried changing the |= statements to "result ||", did not work, added a failsafe "return false;" which doesn't work either. I've also tried to make a "result = false;" in case nothing works, it didn't work.
Fixed - Just don't make "inst" and "cam" optional