From 68bbf3c16cb7569b0c19e132ca480d99c2b83ef5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 2 Jun 2021 18:25:54 +0200 Subject: [PATCH] SAGA2: Reduce header dependency --- engines/saga2/magic.cpp | 3 --- engines/saga2/main.cpp | 8 -------- engines/saga2/mainmap.cpp | 2 -- engines/saga2/mapfeatr.cpp | 5 ----- engines/saga2/modal.cpp | 5 ----- engines/saga2/motion.cpp | 6 ------ engines/saga2/mouseimg.cpp | 2 -- engines/saga2/msgbox.cpp | 2 -- engines/saga2/noise.cpp | 8 -------- engines/saga2/objects.cpp | 6 ------ engines/saga2/objproto.cpp | 21 +++++++-------------- engines/saga2/speech.cpp | 4 ++-- engines/saga2/speech.h | 2 +- engines/saga2/uidialog.cpp | 11 ----------- engines/saga2/vbacksav.cpp | 2 -- engines/saga2/videobox.cpp | 4 ---- engines/saga2/vpal.cpp | 4 ---- engines/saga2/vwdraw.cpp | 3 --- engines/saga2/vwpage.cpp | 5 ----- engines/saga2/weapons.cpp | 3 --- 20 files changed, 10 insertions(+), 96 deletions(-) diff --git a/engines/saga2/magic.cpp b/engines/saga2/magic.cpp index 5bd43c892ba..d572a0ba03a 100644 --- a/engines/saga2/magic.cpp +++ b/engines/saga2/magic.cpp @@ -24,8 +24,6 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/magic.h" #include "saga2/idtypes.h" @@ -33,7 +31,6 @@ #include "saga2/spellbuk.h" #include "saga2/spelshow.h" #include "saga2/motion.h" -#include "saga2/actor.h" #include "saga2/player.h" namespace Saga2 { diff --git a/engines/saga2/main.cpp b/engines/saga2/main.cpp index 975e4fb1264..62d4efa1afb 100644 --- a/engines/saga2/main.cpp +++ b/engines/saga2/main.cpp @@ -29,13 +29,9 @@ #include "common/debug.h" #include "saga2/std.h" - -#include "saga2/fta.h" - #include "saga2/setup.h" #include "saga2/transit.h" #include "saga2/player.h" -#include "saga2/calender.h" #include "saga2/tile.h" #include "saga2/messager.h" #include "saga2/intrface.h" @@ -45,14 +41,10 @@ #include "saga2/display.h" #include "saga2/tower.h" #include "saga2/tromode.h" -#include "saga2/loadmsg.h" -#include "saga2/ioerrors.h" #include "saga2/loadsave.h" #include "saga2/gamerate.h" #include "saga2/msgbox.h" -#include "saga2/script.h" #include "saga2/config.h" -#include "saga2/hresmgr.h" #include "saga2/savefile.h" namespace Saga2 { diff --git a/engines/saga2/mainmap.cpp b/engines/saga2/mainmap.cpp index 252cf878fd1..c47073b22e8 100644 --- a/engines/saga2/mainmap.cpp +++ b/engines/saga2/mainmap.cpp @@ -25,8 +25,6 @@ */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/fta.h" #include "saga2/mainmap.h" diff --git a/engines/saga2/mapfeatr.cpp b/engines/saga2/mapfeatr.cpp index e505e249a0b..98466ce68b6 100644 --- a/engines/saga2/mapfeatr.cpp +++ b/engines/saga2/mapfeatr.cpp @@ -24,15 +24,10 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/mapfeatr.h" #include "saga2/automap.h" #include "saga2/tile.h" -#include "saga2/objects.h" -#include "saga2/player.h" -#include "saga2/grequest.h" namespace Saga2 { diff --git a/engines/saga2/modal.cpp b/engines/saga2/modal.cpp index bfc7de2e89b..9b6e9ad271f 100644 --- a/engines/saga2/modal.cpp +++ b/engines/saga2/modal.cpp @@ -24,13 +24,8 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" -#include "saga2/fta.h" -#include "saga2/floating.h" #include "saga2/modal.h" -#include "saga2/setup.h" #include "saga2/speech.h" #include "saga2/grabinfo.h" diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp index cf8f81cd6cb..dc35f454a75 100644 --- a/engines/saga2/motion.cpp +++ b/engines/saga2/motion.cpp @@ -27,18 +27,12 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove #include "saga2/std.h" -#include "saga2/cmisc.h" #include "saga2/dispnode.h" #include "saga2/tile.h" #include "saga2/motion.h" -#include "saga2/actor.h" -#include "saga2/panel.h" #include "saga2/tilemode.h" -#include "saga2/transit.h" -#include "saga2/assign.h" #include "saga2/magic.h" #include "saga2/spellbuk.h" -#include "saga2/player.h" #include "saga2/contain.h" #include "saga2/intrface.h" #include "saga2/savefile.h" diff --git a/engines/saga2/mouseimg.cpp b/engines/saga2/mouseimg.cpp index 64f4b8cba37..bb3d1c4c187 100644 --- a/engines/saga2/mouseimg.cpp +++ b/engines/saga2/mouseimg.cpp @@ -24,8 +24,6 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/blitters.h" #include "saga2/fta.h" diff --git a/engines/saga2/msgbox.cpp b/engines/saga2/msgbox.cpp index fb6f73c62b1..b3d2a11b5e4 100644 --- a/engines/saga2/msgbox.cpp +++ b/engines/saga2/msgbox.cpp @@ -24,8 +24,6 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/fta.h" #include "saga2/button.h" diff --git a/engines/saga2/noise.cpp b/engines/saga2/noise.cpp index e0b949fc62d..12b2cdd6449 100644 --- a/engines/saga2/noise.cpp +++ b/engines/saga2/noise.cpp @@ -24,27 +24,19 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/fta.h" #include "saga2/audio.h" #include "saga2/audiores.h" #include "saga2/audiodec.h" #include "saga2/audiofnc.h" -#include "saga2/tcoords.h" -#include "saga2/button.h" #include "saga2/annoy.h" -#include "saga2/objproto.h" #include "saga2/player.h" - #include "saga2/queues.h" #include "saga2/audiosmp.h" #include "saga2/audqueue.h" #include "saga2/audiosys.h" - #include "saga2/config.h" -#include "saga2/hresmgr.h" namespace Saga2 { diff --git a/engines/saga2/objects.cpp b/engines/saga2/objects.cpp index a7344e3f468..7de69b416a3 100644 --- a/engines/saga2/objects.cpp +++ b/engines/saga2/objects.cpp @@ -28,28 +28,22 @@ #include "saga2/std.h" #include "saga2/objects.h" -#include "saga2/actor.h" #include "saga2/tile.h" -#include "saga2/terrain.h" -#include "saga2/cmisc.h" #include "saga2/motion.h" #include "saga2/contain.h" #include "saga2/setup.h" #include "saga2/script.h" -#include "saga2/player.h" #include "saga2/target.h" #include "saga2/uimetrcs.h" #include "saga2/magic.h" #include "saga2/intrface.h" #include "saga2/sensor.h" #include "saga2/timers.h" -#include "saga2/magic.h" #include "saga2/grabinfo.h" #include "saga2/localize.h" #include "saga2/spellbuk.h" #include "saga2/tilevect.h" #include "saga2/dispnode.h" -#include "saga2/hresmgr.h" #include "saga2/savefile.h" #include "saga2/methods.r" // generated by SAGA diff --git a/engines/saga2/objproto.cpp b/engines/saga2/objproto.cpp index 584995d45d0..3e956b43ee6 100644 --- a/engines/saga2/objproto.cpp +++ b/engines/saga2/objproto.cpp @@ -24,22 +24,15 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/gdraw.h" -#include "saga2/sprite.h" #include "saga2/objects.h" -#include "saga2/actor.h" #include "saga2/grabinfo.h" #include "saga2/contain.h" #include "saga2/motion.h" -#include "saga2/setup.h" #include "saga2/player.h" #include "saga2/script.h" -#include "saga2/intrface.h" #include "saga2/document.h" -#include "saga2/stimtype.h" #include "saga2/magic.h" #include "saga2/weapons.h" #include "saga2/spellbuk.h" @@ -634,7 +627,7 @@ bool ProtoObj::acceptHealing( damage = absDamage; if (dice) for (int d = 0; d < abs(dice); d++) - damage += ((rand() % sides) + pdm + 1) * (dice > 0 ? 1 : -1); + damage += (g_vm->_rnd->getRandomNumber(sides - 1) + pdm + 1) * (dice > 0 ? 1 : -1); #if 0 if ((scriptResult = stdActionScript( Method_GameObject_onAcceptDamage, @@ -811,7 +804,7 @@ uint16 ProtoObj::containmentSet(void) { // return the sprite data ObjectSpriteInfo ProtoObj::getSprite(GameObject *obj, enum spriteTypes spr, int16 count) { - ObjectSpriteInfo sprInfo = { NULL, static_cast(flags & objPropFlipped != 0) }; + ObjectSpriteInfo sprInfo = { NULL, static_cast((flags & objPropFlipped) != 0) }; int16 openOffset = ((flags & objPropVisOpen) && obj->isOpen()) ? 1 : 0; switch (spr) { @@ -1817,7 +1810,7 @@ void BludgeoningWeaponProto::applySkillGrowth(ObjectID enactor, uint8 points) { player->skillAdvance(skillIDBludgeon, points); - if (rand() & 1) + if (g_vm->_rnd->getRandomNumber(65534) & 1) player->skillAdvance(skillIDBrawn, points); } } @@ -1854,7 +1847,7 @@ void SlashingWeaponProto::applySkillGrowth(ObjectID enactor, uint8 points) { player->skillAdvance(skillIDSwordcraft, points); - if (rand() & 1) + if (g_vm->_rnd->getRandomNumber(65534) & 1) player->skillAdvance(skillIDBrawn, points); } } @@ -2181,7 +2174,7 @@ void ArrowProto::applySkillGrowth(ObjectID enactor, uint8 points) { player->skillAdvance(skillIDArchery, points); - if (rand() & 1) + if (g_vm->_rnd->getRandomNumber(65534) & 1) player->skillAdvance(skillIDBrawn, points); } } @@ -2406,7 +2399,7 @@ void ShieldProto::applySkillGrowth(ObjectID enactor, uint8 points) { player->skillAdvance(skillIDShieldcraft, points); - if (rand() & 1) + if (g_vm->_rnd->getRandomNumber(65534) & 1) player->skillAdvance(skillIDBrawn, points); } } @@ -2945,7 +2938,7 @@ void EncounterGeneratorProto::doBackgroundUpdate(GameObject *obj) { // Now, roll to see if we got an encounter! - if (rand() & 0x0000ffff < prob) { + if ((g_vm->_rnd->getRandomNumber(65534) & 0x0000ffff) < prob) { scriptCallFrame scf; #if DEBUG diff --git a/engines/saga2/speech.cpp b/engines/saga2/speech.cpp index 26f3e1fa365..77442d71a25 100644 --- a/engines/saga2/speech.cpp +++ b/engines/saga2/speech.cpp @@ -610,7 +610,7 @@ bool Speech::longEnough(void) { // Gets rid of the current speech -void Speech::abort(void) { +void Speech::abortSpeech(void) { // Start by displaying first frame straight off, no delay speechFinished.set(0); if (speechFlags & spHasVoice) { @@ -619,7 +619,7 @@ void Speech::abort(void) { } void abortSpeech(void) { - if (speechList.currentActive()) speechList.currentActive()->abort(); + if (speechList.currentActive()) speechList.currentActive()->abortSpeech(); } diff --git a/engines/saga2/speech.h b/engines/saga2/speech.h index 9b4d8c5c5db..4fd4a30f44e 100644 --- a/engines/saga2/speech.h +++ b/engines/saga2/speech.h @@ -154,7 +154,7 @@ public: bool longEnough(void); // Abort the current speech. - void abort(void); + void abortSpeech(void); }; class SpeechTaskList { diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp index e5a37377c6b..39624d18f44 100644 --- a/engines/saga2/uidialog.cpp +++ b/engines/saga2/uidialog.cpp @@ -27,13 +27,7 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove #include "saga2/std.h" -#include "saga2/objects.h" -#include "saga2/button.h" -#include "saga2/contain.h" -#include "saga2/modal.h" #include "saga2/intrface.h" -#include "saga2/player.h" -#include "saga2/hresmgr.h" #include "saga2/grequest.h" #include "saga2/gtextbox.h" #include "saga2/loadsave.h" @@ -45,7 +39,6 @@ #include "saga2/audqueue.h" #include "saga2/audiosys.h" -#include "saga2/annoy.h" #include "saga2/uidialog.h" #include "saga2/document.h" #include "saga2/tilemode.h" @@ -53,12 +46,8 @@ #include "saga2/uitext.h" #include "saga2/vpal.h" #include "saga2/palette.h" -#include "saga2/display.h" -#include "saga2/program.h" -#include "saga2/version.h" #include "saga2/config.h" -#include "saga2/hresmgr.h" #include "saga2/fontlib.h" #include "saga2/savefile.h" diff --git a/engines/saga2/vbacksav.cpp b/engines/saga2/vbacksav.cpp index 8a37166a19f..d73d11081b2 100644 --- a/engines/saga2/vbacksav.cpp +++ b/engines/saga2/vbacksav.cpp @@ -24,8 +24,6 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" #include "saga2/vbacksav.h" diff --git a/engines/saga2/videobox.cpp b/engines/saga2/videobox.cpp index 874ae512fb0..fd4889029e6 100644 --- a/engines/saga2/videobox.cpp +++ b/engines/saga2/videobox.cpp @@ -24,12 +24,8 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" -#include "saga2/floating.h" #include "saga2/videobox.h" -#include "saga2/hresmgr.h" namespace Saga2 { diff --git a/engines/saga2/vpal.cpp b/engines/saga2/vpal.cpp index 018485b2ed3..84fffed28f6 100644 --- a/engines/saga2/vpal.cpp +++ b/engines/saga2/vpal.cpp @@ -30,10 +30,6 @@ #include "saga2/fta.h" #include "saga2/vpal.h" #include "saga2/palette.h" -#include "saga2/transit.h" -#include "saga2/cmisc.h" -#include "saga2/calender.h" -#include "saga2/player.h" #include "saga2/display.h" #include "saga2/hresmgr.h" #include "saga2/savefile.h" diff --git a/engines/saga2/vwdraw.cpp b/engines/saga2/vwdraw.cpp index 20a69099acd..2792e53deed 100644 --- a/engines/saga2/vwdraw.cpp +++ b/engines/saga2/vwdraw.cpp @@ -24,10 +24,7 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" -#include "saga2/vwpage.h" #include "saga2/vdraw.h" namespace Saga2 { diff --git a/engines/saga2/vwpage.cpp b/engines/saga2/vwpage.cpp index f798a890329..07fab694db9 100644 --- a/engines/saga2/vwpage.cpp +++ b/engines/saga2/vwpage.cpp @@ -24,14 +24,9 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" -#include "saga2/rect.h" #include "saga2/vdraw.h" #include "saga2/vwpage.h" -#include "saga2/display.h" -#include "saga2/vpage.h" namespace Saga2 { diff --git a/engines/saga2/weapons.cpp b/engines/saga2/weapons.cpp index 37b5ddf15c3..ea3c7629a5a 100644 --- a/engines/saga2/weapons.cpp +++ b/engines/saga2/weapons.cpp @@ -24,10 +24,7 @@ * (c) 1993-1996 The Wyrmkeep Entertainment Co. */ -#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove - #include "saga2/std.h" -#include "saga2/idtypes.h" #include "saga2/weapons.h" #include "saga2/spellbuk.h" #include "saga2/actor.h"