mateoconlechuga / oiram

Oiram is a Mario platformer clone
BSD 3-Clause "New" or "Revised" License
63 stars 14 forks source link

Fix timers #18

Closed runer112 closed 2 years ago

runer112 commented 2 years ago

Fixes #17.

The introduction of the always-running clock in https://github.com/CE-Programming/toolchain/pull/325 conflicted with Oiram's use of timers. Not because they used the same timer, but because Oiram simply clobbered (disabled) the other timers when configuring its own. After doing so, the next usage of delay() would cause a freeze because the clock was stopped.

Initially I simply fixed Oiram's timer usage not to clobber the other timers, which fixed the issue. But while I was at it, I switched Oiram to use clock() checking instead of using a timer. The resulting code is more portable (lol) and happens to save 42 bytes in the compressed program.

mateoconlechuga commented 2 years ago

Nice thank you :)