Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision Functions/Bool Cast Fix #1218

merged 3 commits into from May 8, 2018


None yet
2 participants
Copy link

RobertBColton commented May 7, 2018

This is me attempting to fix #1208 to behave similar to GM and GMS.

Basically, a few collision and instance functions return noone or the id of the instance. Because noone is -4 it is treated as true if you put those functions directly in an if statement. So, we want them to return var so that when the return value is cast to boolean it is false when negative (as it should be in GML). We typedef instance_t as an alias of variant (lighter weight than var according to Josh) instead of int now so that it's easy to change and clear which functions support this.

This will now make the following work as expected:

if (instance_find(...)) {
  // instance was found
if (collision_line(...)) {
  // there was a collision

Without having to add != noone to the condition. Therefore, the FPS example functions correctly and the monsters will in fact chase you now. Testing a variety of other games which use collisions from emake also does not show any signs of regression.
FPS Example Monsters Chasing


This comment has been minimized.

Copy link

codecov bot commented May 7, 2018

Codecov Report

Merging #1218 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1218   +/-   ##
  Coverage    9.22%   9.22%           
  Files         152     152           
  Lines       16631   16631           
  Hits         1534    1534           
  Misses      15097   15097
Impacted Files Coverage Δ
...stem/SHELL/Universal_System/instance_system_base.h 0% <ø> (ø) ⬆️
...Asystem/SHELL/Universal_System/instance_planar.cpp 0% <0%> (ø) ⬆️
...stem/SHELL/Collision_Systems/Precise/PRECfuncs.cpp 0% <0%> (ø) ⬆️
ENIGMAsystem/SHELL/Universal_System/instance.cpp 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86d34c2...4e767ae. Read the comment docs.

@RobertBColton RobertBColton requested a review from JoshDreamland May 8, 2018

@JoshDreamland JoshDreamland merged commit 6196449 into master May 8, 2018

3 of 4 checks passed

codecov/patch 0% of diff hit (target 9.22%)
codecov/project 9.22% remains the same compared to 86d34c2
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

@RobertBColton RobertBColton deleted the collisions-return-bool-fix branch May 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.