libretro / nxengine-libretro

Port of NxEngine to the libretro API. NXEngine is a Cave Story game engine clone
85 stars 89 forks source link

Prevents inputs from leaking out of options mode, map system, and inventory. #86

Closed crocket closed 2 years ago

crocket commented 2 years ago

I don't understand how nxengine-evo manages to prevent inputs from leaking out of options mode, map system, and inventory with memset(inputs, 0, sizeof(inputs)).

By replacing memset(inputs, 0, sizeof(inputs)) with memcpy(lastpinputs, inputs, sizeof(lastpinputs)) in various places and enabling weapons only when pinputs[FIREKEY] is true and lastpinputs[FIREKEY] is false, I could prevent inputs from leaking out of options mode, map system, and inventory.

With these commits, pressing fire key to exit options mode, map system, or inventory doesn't trigger machine gun. Even nxengine-evo and cave story engine 2 activate machine gun when I press fire key to exit options mode, map system, or inventory.

Figuring this out took two days.

This fixes https://github.com/libretro/nxengine-libretro/issues/85

crocket commented 2 years ago

@twinaphex Do you know how nxengine-evo manages to prevent options mode, inventory, and map system from leaking inputs to other modes?