Moved maskwallcnt to the engine_state struct