chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.33k stars 467 forks source link

Bitwise operations don't work in "If Math Expression" event #1403

Open marco-afonso opened 2 months ago

marco-afonso commented 2 months ago

Describe the bug I can use bitwise operations like &, ^ or | but only in the Evaluate expression when setting variables. When I try to use it in the if Math Expression event it doesn't calculate correctly.

To Reproduce Steps to reproduce the behavior (I have a screen grab to illustrate):

  1. Create an If math expression event
  2. Insert a bitwise operation to equal zero from non-zero variables and use an equal operator to compare with 0
  3. Insert a display dialog inside
  4. Play and see the dialog does not appear

Expected behavior The if statement should have returned true

Screenshots

https://github.com/chrismaltby/gb-studio/assets/50088659/2f2bbe77-9986-4e4b-b3e4-448acbac37c9

Platform (please complete the following information):

Additional context Add any other context about the problem here.

marco-afonso commented 2 months ago

Could only make it work with parenthesis, is this expected behavior?

image