diff options
-rw-r--r-- | src/blupi.cxx | 47 | ||||
-rw-r--r-- | src/blupi.h | 1 | ||||
-rw-r--r-- | src/decblupi.cxx | 47 | ||||
-rw-r--r-- | src/obstacle.cxx | 2 |
4 files changed, 54 insertions, 43 deletions
diff --git a/src/blupi.cxx b/src/blupi.cxx index 8578d73..fac2b84 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -61,6 +61,7 @@ bool g_bFullScreen = false; // false si mode de test Sint32 g_speedRate = 1; Sint32 g_timerInterval = 50; // inverval = 50ms int g_rendererType = 0; +bool g_restoreBugs = false; // restore original < v1.9 bugs enum Settings { SETTING_FULLSCREEN = 1 << 0, @@ -501,26 +502,29 @@ CheckForUpdates () static int parseArgs (int argc, char * argv[], bool & exit) { - argagg::parser argparser{{ - {"help", {"-h", "--help"}, "print this help message and exit", 0}, - {"version", {"-V", "--version"}, "print version and exit", 0}, - {"speedrate", - {"-s", "--speed-rate"}, - "change the speed rate [1;2] (default: 1)", - 1}, - {"timerinterval", - {"-t", "--timer-interval"}, - "set the timer interval (refresh)", - 1}, - {"fullscreen", - {"-f", "--fullscreen"}, - "load in fullscreen [on;off] (default: on)", - 1}, - {"renderer", - {"-r", "--renderer"}, - "set a renderer [auto;software;accelerated] (default: auto)", - 1}, - }}; + argagg::parser argparser{ + {{"help", {"-h", "--help"}, "print this help message and exit", 0}, + {"version", {"-V", "--version"}, "print version and exit", 0}, + {"speedrate", + {"-s", "--speed-rate"}, + "change the speed rate [1;2] (default: 1)", + 1}, + {"timerinterval", + {"-t", "--timer-interval"}, + "set the timer interval (refresh)", + 1}, + {"fullscreen", + {"-f", "--fullscreen"}, + "load in fullscreen [on;off] (default: on)", + 1}, + {"renderer", + {"-r", "--renderer"}, + "set a renderer [auto;software;accelerated] (default: auto)", + 1}, + {"restorebugs", + {"-b", "--restore-bugs"}, + "restore funny original bugs of older versions < v1.9", + 0}}}; argagg::parser_results args; try @@ -577,6 +581,9 @@ parseArgs (int argc, char * argv[], bool & exit) g_settingsOverload |= SETTING_RENDERER; } + if (args["restorebugs"]) + g_restoreBugs = true; + return EXIT_SUCCESS; } diff --git a/src/blupi.h b/src/blupi.h index 7f2d361..0691a1a 100644 --- a/src/blupi.h +++ b/src/blupi.h @@ -28,6 +28,7 @@ extern SDL_Window * g_window; extern SDL_Renderer * g_renderer; extern bool g_bFullScreen; +extern bool g_restoreBugs; struct POINT { Sint32 x; diff --git a/src/decblupi.cxx b/src/decblupi.cxx index b0e1a9d..74458de 100644 --- a/src/decblupi.cxx +++ b/src/decblupi.cxx @@ -2460,29 +2460,32 @@ CDecor::BlupiNextAction (Sint32 rank) if (!m_blupi[rank].bExist) return false; - /* Check if a Blupi is already doing a conflicting action at the same place. - * It happens for example when a blupi wants to carry an object from a - * direction and a second from the other direction. Without this check, the - * object is duplicated. - */ - for (int i = 0; i < MAXBLUPI; ++i) - { - if (rank == i || !m_blupi[i].bExist) - continue; + if (!g_restoreBugs) + { + /* Check if a Blupi is already doing a conflicting action at the same place. + * It happens for example when a blupi wants to carry an object from a + * direction and a second from the other direction. Without this check, the + * object is duplicated. + */ + for (int i = 0; i < MAXBLUPI; ++i) + { + if (rank == i || !m_blupi[i].bExist) + continue; - if ( - (m_blupi[rank].goalAction == EV_ACTION_CARRY || - m_blupi[rank].goalAction == EV_ACTION_EAT || - m_blupi[rank].goalAction == EV_ACTION_DRINK) && - (m_blupi[i].goalAction == EV_ACTION_CARRY2 || - m_blupi[i].goalAction == EV_ACTION_EAT2 || - m_blupi[i].goalAction == EV_ACTION_DRINK2) && - m_blupi[rank].goalHili.x == m_blupi[i].goalHili.x && - m_blupi[rank].goalHili.y == m_blupi[i].goalHili.y) - { - BlupiInitAction (i, ACTION_STOP); - GoalStop (i, true); - return false; + if ( + (m_blupi[rank].goalAction == EV_ACTION_CARRY || + m_blupi[rank].goalAction == EV_ACTION_EAT || + m_blupi[rank].goalAction == EV_ACTION_DRINK) && + (m_blupi[i].goalAction == EV_ACTION_CARRY2 || + m_blupi[i].goalAction == EV_ACTION_EAT2 || + m_blupi[i].goalAction == EV_ACTION_DRINK2) && + m_blupi[rank].goalHili.x == m_blupi[i].goalHili.x && + m_blupi[rank].goalHili.y == m_blupi[i].goalHili.y) + { + BlupiInitAction (i, ACTION_STOP); + GoalStop (i, true); + return false; + } } } diff --git a/src/obstacle.cxx b/src/obstacle.cxx index 998fc66..0e18baa 100644 --- a/src/obstacle.cxx +++ b/src/obstacle.cxx @@ -1761,7 +1761,7 @@ CDecor::IsFreeCelGo (POINT cel, Sint32 rank) // Refuse to go in an enemy factory when the door is open. if ( - channel == CHOBJECT && + !g_restoreBugs && channel == CHOBJECT && (icon == 18 || icon == 101 || icon == 103 || icon == 105 || icon == 116)) return false; |