There's a piece of software called DualMonitorTools (free as in speech) that I've used in the past to do this. You can bind a hotkey to lock the cursor to the current monitor, and then there won't be any chance of it moving to the other.
Once upon a time when I used nVidia cards, there were options in the advanced settings of the nVidia control panels that allowed you to do something similar. You might have a look at your graphics card's settings to see if there's some way to bind a hotkey to lock the cursor to a particular monitor. However, I think these types of things have fallen out of popularity among the card vendors.
I've also seen some AutoHotKey scripts (a useful tool for any PC gaming enthusiast!) that purport to do something similar. I haven't checked them out, but they might be worth a look. AutoHotKey scripts can activate/deactivate based on the active window, so that might remove the need to use a macro to start/stop the monitor lock.