[Scummvm-git-logs] scummvm master -> 165ec9cbaeb3d9de0293dc6f723be4df8d94820f
bluegr
noreply at scummvm.org
Thu Apr 21 17:34:23 UTC 2022
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
67c3bce30e TINSEL: Replace TinselV2 checks with comparisons
7fc6499264 TINSEL: Replace TinselV0 checks with comparisons
6b1dec7879 TINSEL: Replace TinselV1 checks with comparisons
165ec9cbae TINSEL: Replace TinselV3 checks with comparisons
Commit: 67c3bce30ef6f1bce3b8d1567a3cbe503d0a4507
https://github.com/scummvm/scummvm/commit/67c3bce30ef6f1bce3b8d1567a3cbe503d0a4507
Author: Jakob Wagner (wobakj at web.de)
Date: 2022-04-21T20:34:17+03:00
Commit Message:
TINSEL: Replace TinselV2 checks with comparisons
Until now, the TinselV* defines were used for discerning between
engine versions. The define TinselV2 was true for both v2 and v3.
Sticking to the old scheme would lead to confusion when more
special paths for v3 are implemented.
Changed paths:
engines/tinsel/actors.cpp
engines/tinsel/anim.cpp
engines/tinsel/background.cpp
engines/tinsel/bg.cpp
engines/tinsel/cursor.cpp
engines/tinsel/debugger.cpp
engines/tinsel/dialogs.cpp
engines/tinsel/drives.cpp
engines/tinsel/effect.cpp
engines/tinsel/events.cpp
engines/tinsel/faders.cpp
engines/tinsel/font.cpp
engines/tinsel/graphics.cpp
engines/tinsel/handle.cpp
engines/tinsel/heapmem.cpp
engines/tinsel/move.cpp
engines/tinsel/movers.cpp
engines/tinsel/movers.h
engines/tinsel/multiobj.cpp
engines/tinsel/music.cpp
engines/tinsel/palette.cpp
engines/tinsel/pcode.cpp
engines/tinsel/pdisplay.cpp
engines/tinsel/play.cpp
engines/tinsel/polygons.cpp
engines/tinsel/saveload.cpp
engines/tinsel/savescn.cpp
engines/tinsel/scene.cpp
engines/tinsel/scene.h
engines/tinsel/scn.cpp
engines/tinsel/scroll.cpp
engines/tinsel/sound.cpp
engines/tinsel/strres.cpp
engines/tinsel/tinlib.cpp
engines/tinsel/tinsel.cpp
engines/tinsel/tinsel.h
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index 1412aa8101b..9a2b4fb52eb 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -99,7 +99,7 @@ Actor::Actor() : _actorInfo(nullptr), _defaultColor(0), _actorsOn(false), ti(0),
Actor::~Actor() {
free(_actorInfo);
_actorInfo = nullptr;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
free(_zFactors);
_zFactors = nullptr;
}
@@ -124,7 +124,7 @@ void Actor::RegisterActors(int num) {
// as this makes the save/load code simpler
// size of ACTORINFO is 148, so this allocates 512 * 148 = 75776 bytes, about 74KB
_actorInfo = (ACTORINFO *)calloc(MAX_SAVED_ALIVES, sizeof(ACTORINFO));
- if (TinselV2)
+ if (TinselVersion >= 2)
_zFactors = (uint8 *)malloc(MAX_SAVED_ALIVES);
// make sure memory allocated
@@ -136,7 +136,7 @@ void Actor::RegisterActors(int num) {
assert(num == _numActors);
memset(_actorInfo, 0, MAX_SAVED_ALIVES * sizeof(ACTORINFO));
- if (TinselV2)
+ if (TinselVersion >= 2)
memset(_zFactors, 0, MAX_SAVED_ALIVES);
}
@@ -226,7 +226,7 @@ void Actor::StartActor(const ACTORDATA *ad, bool bRunScript) {
* @param bRunScript Flag for whether to run actor scene scripts
*/
void Actor::StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript) {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Tinsel 1 load variation
// Only actors with code blocks got (x, y) re-initialized, so...
@@ -280,7 +280,7 @@ void Actor::StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript) {
void Actor::DropActors() {
for (int i = 0; i < _numActors; i++) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Save text color
COLORREF tColor = _actorInfo[i].textColor;
@@ -525,7 +525,7 @@ int Actor::GetActorSteps(int ano) {
void Actor::StoreActorZpos(int ano, int z, int column) {
assert(ano > 0 && ano <= _numActors); // illegal actor number
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Prior to Tinsel 2, only a single z value was stored
_actorInfo[ano - 1].z = z;
} else {
@@ -623,7 +623,7 @@ void Actor::GetActorMidTop(int ano, int *x, int *y) {
*x = (GetActorLeft(ano) + GetActorRight(ano)) / 2;
*y = GetActorTop(ano);
}
- } else if (TinselV2) {
+ } else if (TinselVersion >= 2) {
*x = (GetActorLeft(ano) + GetActorRight(ano)) / 2;
*y = GetActorTop(ano);
} else if (_actorInfo[ano - 1].presObj) {
@@ -642,7 +642,7 @@ void Actor::GetActorMidTop(int ano, int *x, int *y) {
int Actor::GetActorLeft(int ano) {
assert(ano > 0 && ano <= _numActors); // illegal actor number
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Tinsel 1 version
if (!_actorInfo[ano - 1].presObj)
return 0;
@@ -684,7 +684,7 @@ int Actor::GetActorLeft(int ano) {
int Actor::GetActorRight(int ano) {
assert(ano > 0 && ano <= _numActors); // illegal actor number
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Tinsel 1 version
if (!_actorInfo[ano - 1].presObj)
return 0;
@@ -725,7 +725,7 @@ int Actor::GetActorRight(int ano) {
int Actor::GetActorTop(int ano) {
assert(ano > 0 && ano <= _numActors); // illegal actor number
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Tinsel 1 version
if (!_actorInfo[ano - 1].presObj)
return 0;
@@ -766,7 +766,7 @@ int Actor::GetActorTop(int ano) {
int Actor::GetActorBottom(int ano) {
assert(ano > 0 && ano <= _numActors); // illegal actor number
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Tinsel 1 version
if (!_actorInfo[ano - 1].presObj)
return 0;
@@ -1077,21 +1077,21 @@ int Actor::SaveActors(SAVED_ACTOR *sActorInfo) {
int i, j, k;
for (i = 0, j = 0; i < _numActors; i++) {
- for (k = 0; k < (TinselV2 ? MAX_REELS : 1); ++k) {
- bool presFlag = !TinselV2 ? _actorInfo[i].presObj != NULL :
+ for (k = 0; k < ((TinselVersion >= 2) ? MAX_REELS : 1); ++k) {
+ bool presFlag = (TinselVersion <= 1) ? _actorInfo[i].presObj != NULL :
(_actorInfo[i].presObjs[k] != NULL) && !_vm->_handle->IsCdPlayHandle(_actorInfo[i].presFilm);
if (presFlag) {
assert(j < MAX_SAVED_ACTORS); // Saving too many actors
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
sActorInfo[j].bAlive = _actorInfo[i].bAlive;
sActorInfo[j].zFactor = (short)_actorInfo[i].z;
sActorInfo[j].presRnum = (short)_actorInfo[i].presRnum;
}
sActorInfo[j].actorID = (short)(i+1);
- if (TinselV2)
+ if (TinselVersion >= 2)
sActorInfo[j].bHidden = _actorInfo[i].bHidden;
// sActorInfo[j].x = (short)actorInfo[i].x;
// sActorInfo[j].y = (short)actorInfo[i].y;
@@ -1488,7 +1488,7 @@ static void ActorTinselProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Take control for CONVERSE events
if (atp->event == CONVERSE) {
_ctx->bTookControl = GetControl();
@@ -1658,7 +1658,7 @@ void HideActor(CORO_PARAM, int ano) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_vm->_actor->ToggleActor(ano, false);
// Send event to tagged actors
@@ -1677,7 +1677,7 @@ void HideActor(CORO_PARAM, int ano) {
if (pMover)
HideMover(pMover, 0);
- else if (!TinselV2)
+ else if (TinselVersion <= 1)
_vm->_actor->ToggleActor(ano, false);
CORO_END_CODE;
diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp
index b23cee36f33..c28e1ada2cf 100644
--- a/engines/tinsel/anim.cpp
+++ b/engines/tinsel/anim.cpp
@@ -242,7 +242,7 @@ SCRIPTSTATE StepAnimScript(ANIM *pAnim) {
// re-init animation delta counter
pAnim->aniDelta = pAnim->aniRate;
- if (TinselV2)
+ if (TinselVersion >= 2)
state = DoNextFrame(pAnim);
else {
// move to next frame
@@ -266,7 +266,7 @@ void SkipFrames(ANIM *pAnim, int numFrames) {
// get a pointer to the script
const ANI_SCRIPT *pAni = (const ANI_SCRIPT *)_vm->_handle->LockMem(pAnim->hScript);
- if (!TinselV2 && (numFrames <= 0))
+ if ((TinselVersion <= 1) && (numFrames <= 0))
// do nothing
return;
@@ -275,7 +275,7 @@ void SkipFrames(ANIM *pAnim, int numFrames) {
switch ((int32)FROM_32(pAni[pAnim->scriptIndex].op)) {
case ANI_END: // end of animation script
// going off the end is probably a error, but only in Tinsel 1
- if (!TinselV2)
+ if (TinselVersion <= 1)
error("SkipFrames(): formally 'assert(0)!'");
return;
@@ -287,7 +287,7 @@ void SkipFrames(ANIM *pAnim, int numFrames) {
// jump to new frame position
pAnim->scriptIndex += (int32)FROM_32(pAni[pAnim->scriptIndex].op);
- if (TinselV2)
+ if (TinselVersion >= 2)
// Done if skip to jump
return;
break;
diff --git a/engines/tinsel/background.cpp b/engines/tinsel/background.cpp
index 21da985001a..262e97a8bc6 100644
--- a/engines/tinsel/background.cpp
+++ b/engines/tinsel/background.cpp
@@ -273,7 +273,7 @@ void Background::SetBackPal(SCNHANDLE hPal) {
void Background::DropBackground() {
_pBG[0] = nullptr; // No background
- if (!TinselV2)
+ if (TinselVersion <= 1)
_hBgPal = 0; // No background palette
}
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index 9790b8235b2..e15dfe5ff64 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -60,7 +60,7 @@ void BGmainProcess(CORO_PARAM, const void *param) {
if (_vm->_bg->_pBG[0] == NULL) {
/*** At start of scene ***/
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
pReel = (const FREEL *)param;
// Get the MULTI_INIT structure
@@ -95,7 +95,7 @@ void BGmainProcess(CORO_PARAM, const void *param) {
if (_vm->_bg->GetDoFadeIn()) {
FadeInFast();
_vm->_bg->SetDoFadeIn(false);
- } else if (TinselV2)
+ } else if (TinselVersion >= 2)
PokeInTagColor();
for (;;) {
@@ -108,7 +108,7 @@ void BGmainProcess(CORO_PARAM, const void *param) {
}
} else {
// New background during scene
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
pReel = (const FREEL *)param;
InitStepAnimScript(&_vm->_bg->_thisAnim[0], _vm->_bg->_pBG[0], FROM_32(pReel->script), _vm->_bg->getBgSpeed());
StepAnimScript(&_vm->_bg->_thisAnim[0]);
@@ -193,7 +193,7 @@ void Background::StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
if (_pBG[0] == NULL)
ControlStartOff();
- if (TinselV2 && (coroParam != Common::nullContext))
+ if ((TinselVersion >= 2) && (coroParam != Common::nullContext))
CORO_GIVE_WAY;
CORO_END_CODE;
diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp
index 47d1733588a..7a0ef70b749 100644
--- a/engines/tinsel/cursor.cpp
+++ b/engines/tinsel/cursor.cpp
@@ -432,7 +432,7 @@ void Cursor::InitCurObj() {
PokeInPalette(pmi);
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
_auxCursor = nullptr; // No auxillary cursor
_mainCursor = MultiInitObject(pmi);
@@ -475,7 +475,7 @@ void Cursor::DwInitCursor(SCNHANDLE bfilm) {
* DropCursor is called when a scene is closing down.
*/
void Cursor::DropCursor() {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (_auxCursor)
MultiDeleteObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _auxCursor);
if (_mainCursor)
@@ -588,7 +588,7 @@ void CursorStoppedCheck(CORO_PARAM) {
bool CanInitializeCursor() {
if (!_vm->_cursor->HasReelData()) {
return false;
- } else if (TinselVersion != TINSEL_V3) {
+ } else if (TinselVersion != 3) {
return (_vm->_bg->BgPal() != 0);
}
return true;
diff --git a/engines/tinsel/debugger.cpp b/engines/tinsel/debugger.cpp
index f5c524871ff..de46b7ded06 100644
--- a/engines/tinsel/debugger.cpp
+++ b/engines/tinsel/debugger.cpp
@@ -134,7 +134,7 @@ bool Console::cmd_sound(int argc, const char **argv) {
int id = strToInt(argv[1]);
if (_vm->_sound->sampleExists(id)) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
_vm->_sound->playSample(id, Audio::Mixer::kSpeechSoundType);
else
_vm->_sound->playSample(id, 0, false, 0, 0, PRIORITY_TALK, Audio::Mixer::kSpeechSoundType);
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 40783cbc5a0..15f93b7dbac 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -168,19 +168,19 @@ enum PARTS_INDEX {
};
// The following defines select the correct constant depending on Tinsel version
-#define IX_CROSS1 (TinselV2 ? IX2_CROSS1 : IX1_CROSS1)
-#define IX_CURDD (TinselV2 ? IX2_CURDD : IX1_CURDD)
-#define IX_CURDU (TinselV2 ? IX2_CURDU : IX1_CURDU)
-#define IX_CURLR (TinselV2 ? IX2_CURLR : IX1_CURLR)
-#define IX_CURUD (TinselV2 ? IX2_CURUD : IX1_CURUD)
-#define IX_CURUL (TinselV2 ? IX2_CURUL : IX1_CURUL)
-#define IX_MDGROOVE (TinselV2 ? IX2_MDGROOVE : IX1_MDGROOVE)
-#define IX_MDSLIDER (TinselV2 ? IX2_MDSLIDER : IX1_MDSLIDER)
-#define IX_NTR (TinselV2 ? IX2_NTR : IX1_NTR)
-#define IX_RBR (TinselV2 ? IX2_RBR : IX1_RBR)
-#define IX_RTL (TinselV2 ? IX2_RTL : IX1_RTL)
-#define IX_RTR (TinselV2 ? IX2_RTR : IX1_RTR)
-#define IX_TICK1 (TinselV2 ? IX2_TICK1 : IX1_TICK1)
+#define IX_CROSS1 ((TinselVersion >= 2) ? IX2_CROSS1 : IX1_CROSS1)
+#define IX_CURDD ((TinselVersion >= 2) ? IX2_CURDD : IX1_CURDD)
+#define IX_CURDU ((TinselVersion >= 2) ? IX2_CURDU : IX1_CURDU)
+#define IX_CURLR ((TinselVersion >= 2) ? IX2_CURLR : IX1_CURLR)
+#define IX_CURUD ((TinselVersion >= 2) ? IX2_CURUD : IX1_CURUD)
+#define IX_CURUL ((TinselVersion >= 2) ? IX2_CURUL : IX1_CURUL)
+#define IX_MDGROOVE ((TinselVersion >= 2) ? IX2_MDGROOVE : IX1_MDGROOVE)
+#define IX_MDSLIDER ((TinselVersion >= 2) ? IX2_MDSLIDER : IX1_MDSLIDER)
+#define IX_NTR ((TinselVersion >= 2) ? IX2_NTR : IX1_NTR)
+#define IX_RBR ((TinselVersion >= 2) ? IX2_RBR : IX1_RBR)
+#define IX_RTL ((TinselVersion >= 2) ? IX2_RTL : IX1_RTL)
+#define IX_RTR ((TinselVersion >= 2) ? IX2_RTR : IX1_RTR)
+#define IX_TICK1 ((TinselVersion >= 2) ? IX2_TICK1 : IX1_TICK1)
#define NORMGRAPH 0
#define DOWNGRAPH 1
@@ -195,26 +195,26 @@ enum PARTS_INDEX {
#define HOPEDFORFREELS 6 // Expected flag reels
//-----------------------
-#define MAX_ININV (TinselV2 ? 160 : 150) // Max in an inventory
+#define MAX_ININV ((TinselVersion >= 2) ? 160 : 150) // Max in an inventory
-#define ITEM_WIDTH (TinselV2 ? 50 : 25) // Dimensions of an icon
-#define ITEM_HEIGHT (TinselV2 ? 50 : 25) //
-#define I_SEPARATION (TinselV2 ? 2 : 1) // Item separation
+#define ITEM_WIDTH ((TinselVersion >= 2) ? 50 : 25) // Dimensions of an icon
+#define ITEM_HEIGHT ((TinselVersion >= 2) ? 50 : 25) //
+#define I_SEPARATION ((TinselVersion >= 2) ? 2 : 1) // Item separation
#define NM_TOFF 11 // Title text Y offset from top
-#define NM_TBT (TinselV2 ? 4 : 0) // Y, title box top
+#define NM_TBT ((TinselVersion >= 2) ? 4 : 0) // Y, title box top
#define NM_TBB 33
-#define NM_LSX (TinselV2 ? 4 : 0) // X, left side
-#define NM_BSY (TinselV2 ? -9 : -M_TH + 1)
-#define NM_RSX (TinselV2 ? -9 : -M_SW + 1)
+#define NM_LSX ((TinselVersion >= 2) ? 4 : 0) // X, left side
+#define NM_BSY ((TinselVersion >= 2) ? -9 : -M_TH + 1)
+#define NM_RSX ((TinselVersion >= 2) ? -9 : -M_SW + 1)
#define NM_SBL (-27)
-#define NM_SLH (TinselV2 ? 11 : 5) // Slider height
+#define NM_SLH ((TinselVersion >= 2) ? 11 : 5) // Slider height
#define NM_SLX (-11) // Slider X offset (from right)
-#define NM_BG_POS_X (TinselV2 ? 9 : 1) // }
-#define NM_BG_POS_Y (TinselV2 ? 9 : 1) // } Offset of translucent rectangle
-#define NM_BG_SIZ_X (TinselV2 ? -18 : -3) // }
-#define NM_BG_SIZ_Y (TinselV2 ? -18 : -3) // } How much larger it is than edges
+#define NM_BG_POS_X ((TinselVersion >= 2) ? 9 : 1) // }
+#define NM_BG_POS_Y ((TinselVersion >= 2) ? 9 : 1) // } Offset of translucent rectangle
+#define NM_BG_SIZ_X ((TinselVersion >= 2) ? -18 : -3) // }
+#define NM_BG_SIZ_Y ((TinselVersion >= 2) ? -18 : -3) // } How much larger it is than edges
#define NM_RS_T_INSET 3
#define NM_RS_B_INSET 4
@@ -222,32 +222,32 @@ enum PARTS_INDEX {
#define NM_RS_R_INSET 4
#define NM_RS_THICKNESS 5
#define NM_MOVE_AREA_B_Y 30
-#define NM_SLIDE_INSET (TinselV2 ? 18 : 9) // X offset (from right) of left of scroll region
-#define NM_SLIDE_THICKNESS (TinselV2 ? 13 : 7) // thickness of scroll region
+#define NM_SLIDE_INSET ((TinselVersion >= 2) ? 18 : 9) // X offset (from right) of left of scroll region
+#define NM_SLIDE_THICKNESS ((TinselVersion >= 2) ? 13 : 7) // thickness of scroll region
#define NM_UP_ARROW_TOP 34 // Y offset of top of up arrow
#define NM_UP_ARROW_BOTTOM 49 // Y offset of bottom of up arrow
#define NM_DN_ARROW_TOP 22 // Y offset (from bottom) of top of down arrow
#define NM_DN_ARROW_BOTTOM 5 // Y offset (from bottom) of bottom of down arrow
-#define MD_YBUTTOP (TinselV2 ? 2 : 9)
-#define MD_YBUTBOT (TinselV2 ? 16 : 0)
-#define MD_XLBUTL (TinselV2 ? 4 : 1)
-#define MD_XLBUTR (TinselV2 ? 26 : 10)
-#define MD_XRBUTL (TinselV2 ? 173 : 105)
-#define MD_XRBUTR (TinselV2 ? 195 : 114)
+#define MD_YBUTTOP ((TinselVersion >= 2) ? 2 : 9)
+#define MD_YBUTBOT ((TinselVersion >= 2) ? 16 : 0)
+#define MD_XLBUTL ((TinselVersion >= 2) ? 4 : 1)
+#define MD_XLBUTR ((TinselVersion >= 2) ? 26 : 10)
+#define MD_XRBUTL ((TinselVersion >= 2) ? 173 : 105)
+#define MD_XRBUTR ((TinselVersion >= 2) ? 195 : 114)
#define ROTX1 60 // Rotate button's offsets from the center
-#define MAX_NAME_RIGHT (TinselV2 ? 417 : 213)
+#define MAX_NAME_RIGHT ((TinselVersion >= 2) ? 417 : 213)
-#define SLIDE_RANGE (TinselV2 ? 120 : 81)
-#define SLIDE_MINX (TinselV2 ? 25 : 8)
-#define SLIDE_MAXX (TinselV2 ? 25 + 120 : 8 + 81)
+#define SLIDE_RANGE ((TinselVersion >= 2) ? 120 : 81)
+#define SLIDE_MINX ((TinselVersion >= 2) ? 25 : 8)
+#define SLIDE_MAXX ((TinselVersion >= 2) ? 25 + 120 : 8 + 81)
-#define MDTEXT_YOFF (TinselV2 ? -1 : 6)
+#define MDTEXT_YOFF ((TinselVersion >= 2) ? -1 : 6)
#define MDTEXT_XOFF -4
#define TOG2_YOFF -22
#define ROT_YOFF 48
-#define TYOFF (TinselV2 ? 4 : 0)
+#define TYOFF ((TinselVersion >= 2) ? 4 : 0)
#define FLAGX (-5)
#define FLAGY 4
@@ -392,8 +392,8 @@ static CONFBOX t2OptionBox[] = {
static CONFINIT t2ciOption = {6, 4, 144, 60, false, t2OptionBox, sizeof(t2OptionBox) / sizeof(CONFBOX), NO_HEADING};
-#define ciOption (TinselV2 ? t2ciOption : t1ciOption)
-#define optionBox (TinselV2 ? t2OptionBox : t1OptionBox)
+#define ciOption ((TinselVersion >= 2) ? t2ciOption : t1ciOption)
+#define optionBox ((TinselVersion >= 2) ? t2OptionBox : t1OptionBox)
/*-------------------------------------------------------------*\
| These are the load and save game menus. |
@@ -473,10 +473,10 @@ static CONFBOX t2SaveBox[] = {
static CONFINIT t1ciSave = {10, 6, 20, 16, true, t1SaveBox, ARRAYSIZE(t1SaveBox), SIX_SAVE_HEADING};
static CONFINIT t2ciSave = {10, 6, 40, 16, true, t2SaveBox, sizeof(t2SaveBox) / sizeof(CONFBOX), SS_SAVE_HEADING};
-#define ciLoad (TinselV2 ? t2ciLoad : t1ciLoad)
-#define loadBox (TinselV2 ? t2LoadBox : t1LoadBox)
-#define ciSave (TinselV2 ? t2ciSave : t1ciSave)
-#define saveBox (TinselV2 ? t2SaveBox : t1SaveBox)
+#define ciLoad ((TinselVersion >= 2) ? t2ciLoad : t1ciLoad)
+#define loadBox ((TinselVersion >= 2) ? t2LoadBox : t1LoadBox)
+#define ciSave ((TinselVersion >= 2) ? t2ciSave : t1ciSave)
+#define saveBox ((TinselVersion >= 2) ? t2SaveBox : t1SaveBox)
/*-------------------------------------------------------------*\
| This is the restart confirmation 'menu'. |
@@ -508,7 +508,7 @@ static CONFINIT t1ciRestart = {4, 2, 98, 53, false, t1RestartBox, ARRAYSIZE(t1Re
static CONFINIT t1ciRestartPSX = {8, 2, 46, 53, false, t1RestartBoxPSX, ARRAYSIZE(t1RestartBoxPSX), SIX_RESTART_HEADING};
static CONFINIT t2ciRestart = {4, 2, 196, 53, false, t2RestartBox, sizeof(t2RestartBox) / sizeof(CONFBOX), SS_RESTART_HEADING};
-#define ciRestart (TinselV2 ? t2ciRestart : (TinselV1PSX ? t1ciRestartPSX : t1ciRestart))
+#define ciRestart ((TinselVersion >= 2) ? t2ciRestart : (TinselV1PSX ? t1ciRestartPSX : t1ciRestart))
/*-------------------------------------------------------------*\
| This is the sound control 'menu'. In Discworld 2, it also |
@@ -532,7 +532,7 @@ static CONFBOX t2SoundBox[] = {
static CONFINIT t1ciSound = {10, 5, 20, 16, false, t1SoundBox, ARRAYSIZE(t1SoundBox), NO_HEADING};
static CONFINIT t2ciSound = {10, 5, 40, 16, false, t2SoundBox, sizeof(t2SoundBox) / sizeof(CONFBOX), SS_SOUND_HEADING};
-#define ciSound (TinselV2 ? t2ciSound : t1ciSound)
+#define ciSound ((TinselVersion >= 2) ? t2ciSound : t1ciSound)
/*-------------------------------------------------------------*\
| This is the (mouse) control 'menu'. |
@@ -618,8 +618,8 @@ static CONFBOX t2QuitBox[] = {
static CONFINIT t1ciQuit = {4, 2, 98, 53, false, t1QuitBox, ARRAYSIZE(t1QuitBox), SIX_QUIT_HEADING};
static CONFINIT t2ciQuit = {4, 2, 196, 53, false, t2QuitBox, sizeof(t2QuitBox) / sizeof(CONFBOX), SS_QUIT_HEADING};
-#define quitBox (TinselV2 ? t2QuitBox : t1QuitBox)
-#define ciQuit (TinselV2 ? t2ciQuit : t1ciQuit)
+#define quitBox ((TinselVersion >= 2) ? t2QuitBox : t1QuitBox)
+#define ciQuit ((TinselVersion >= 2) ? t2ciQuit : t1ciQuit)
/***************************************************************************\
|************************ Startup and shutdown ***********************|
@@ -736,8 +736,8 @@ enum {
#define M_IDT 10 // Y offset (from bottom) of top of down arrow
#define M_IDB 3 // Y offset (from bottom) of bottom of down arrow
-#define START_ICONX (TinselV2 ? 12 : (M_SW + 1)) // } Relative offset of first icon
-#define START_ICONY (TinselV2 ? 40 : (M_TBB + M_TH + 1)) // } within the inventory window
+#define START_ICONX ((TinselVersion >= 2) ? 12 : (M_SW + 1)) // } Relative offset of first icon
+#define START_ICONY ((TinselVersion >= 2) ? 40 : (M_TBB + M_TH + 1)) // } within the inventory window
/*-------------------------------------------------------------------------*/
@@ -1158,7 +1158,7 @@ int Dialogs::WhichItemHeld() {
void Dialogs::InventoryIconCursor(bool bNewItem) {
if (_heldItem != INV_NOICON) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (bNewItem) {
int objIndex = GetObjectIndex(_heldItem);
_heldFilm = _invFilms[objIndex];
@@ -1374,7 +1374,7 @@ void Dialogs::Select(int i, bool force) {
switch (cd.box[i].boxType) {
case RGROUP:
_iconArray[HL2] = RectangleObject(_vm->_bg->BgPal(),
- (TinselV2 ? HighlightColor() : COL_HILIGHT), cd.box[i].w, cd.box[i].h);
+ ((TinselVersion >= 2) ? HighlightColor() : COL_HILIGHT), cd.box[i].w, cd.box[i].h);
MultiInsertObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _iconArray[HL2]);
MultiSetAniXY(_iconArray[HL2],
_invD[_activeInv].inventoryX + cd.box[i].xpos,
@@ -1384,7 +1384,7 @@ void Dialogs::Select(int i, bool force) {
if (cd.editableRgroup) {
MultiSetZPosition(_iconArray[HL2], Z_INV_ITEXT + 1);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
assert(cd.box[i].textMethod == TM_POINTER);
} else {
assert(cd.box[i].ixText == USE_POINTER);
@@ -1474,7 +1474,7 @@ void Dialogs::AddToInventory(int invno, int icon, bool hold) {
INV_OBJECT *invObj;
// Validate trying to add to a legal inventory
- assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV || invno == INV_OPEN || (invno == INV_DEFAULT && TinselV2));
+ assert(invno == INV_1 || invno == INV_2 || invno == INV_CONV || invno == INV_OPEN || (invno == INV_DEFAULT && TinselVersion >= 2));
if (invno == INV_OPEN) {
assert(_inventoryState == ACTIVE_INV && (_activeInv == INV_1 || _activeInv == INV_2)); // addopeninv() with inventry not open
@@ -1486,7 +1486,7 @@ void Dialogs::AddToInventory(int invno, int icon, bool hold) {
} else {
bOpen = false;
- if (TinselV2 && invno == INV_DEFAULT) {
+ if ((TinselVersion >= 2) && invno == INV_DEFAULT) {
invObj = GetInvObject(icon);
if (invObj->attribute & DEFINV2)
invno = INV_2;
@@ -1512,7 +1512,7 @@ void Dialogs::AddToInventory(int invno, int icon, bool hold) {
if (i == _invD[invno].NoofItems) {
if (!bOpen) {
if (invno == INV_CONV) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
int nei;
// Count how many current contents have end attribute
@@ -1586,7 +1586,7 @@ bool Dialogs::RemFromInventory(int invno, int icon) {
memmove(&_invD[invno].contents[i], &_invD[invno].contents[i + 1], (_invD[invno].NoofItems - i) * sizeof(int));
_invD[invno].NoofItems--;
- if (TinselV2 && invno == INV_CONV) {
+ if ((TinselVersion >= 2) && invno == INV_CONV) {
_invD[INV_CONV].NoofHicons = _invD[invno].NoofItems;
// Get the window to re-position
@@ -1605,7 +1605,7 @@ void Dialogs::HoldItem(int item, bool bKeepFilm) {
INV_OBJECT *invObj;
if (_heldItem != item) {
- if (TinselV2 && (_heldItem != NOOBJECT)) {
+ if ((TinselVersion >= 2) && (_heldItem != NOOBJECT)) {
// No longer holding previous item
_vm->_cursor->DelAuxCursor(); // no longer aux cursor
@@ -1623,7 +1623,7 @@ void Dialogs::HoldItem(int item, bool bKeepFilm) {
AddToInventory(INV_1, _heldItem);
}
- } else if (!TinselV2) {
+ } else if (TinselVersion <= 1) {
if (item == INV_NOICON && _heldItem != INV_NOICON)
_vm->_cursor->DelAuxCursor(); // no longer aux cursor
@@ -1640,7 +1640,7 @@ void Dialogs::HoldItem(int item, bool bKeepFilm) {
_heldItem = item; // Item held
- if (TinselV2) {
+ if (TinselVersion >= 2) {
InventoryIconCursor(!bKeepFilm);
// Redraw contents - held item not displayed as a content.
@@ -1648,7 +1648,7 @@ void Dialogs::HoldItem(int item, bool bKeepFilm) {
}
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
// Redraw contents - held item not displayed as a content.
_ItemsChanged = true;
}
@@ -1693,7 +1693,7 @@ enum { I_NOTIN,
* to rework all this.
*/
int Dialogs::InvArea(int x, int y) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
int RightX = MultiRightmost(_rectObject) - NM_BG_SIZ_X - NM_BG_POS_X - NM_RS_R_INSET;
int BottomY = MultiLowest(_rectObject) - NM_BG_SIZ_Y - NM_BG_POS_Y - NM_RS_B_INSET;
@@ -1958,13 +1958,13 @@ int Dialogs::WhichMenuBox(int curX, int curY, bool bSlides) {
// Slider on extra window
if (cd.bExtraWin) {
- const Common::Rect r = TinselV2 ? Common::Rect(411, 46, 425, 339) : Common::Rect(20 + 181, 24 + 2, 20 + 181 + 8, 24 + 139 + 5);
+ const Common::Rect r = (TinselVersion >= 2) ? Common::Rect(411, 46, 425, 339) : Common::Rect(20 + 181, 24 + 2, 20 + 181 + 8, 24 + 139 + 5);
if (r.contains(curX, curY)) {
- if (curY < (r.top + (TinselV2 ? 18 : 5)))
+ if (curY < (r.top + ((TinselVersion >= 2) ? 18 : 5)))
return IB_UP;
- else if (curY > (r.bottom - (TinselV2 ? 18 : 5)))
+ else if (curY > (r.bottom - ((TinselVersion >= 2) ? 18 : 5)))
return IB_DOWN;
else if (curY + _invD[_activeInv].inventoryY < _sliderYpos)
return IB_SLIDE_UP;
@@ -2020,7 +2020,7 @@ void Dialogs::InvBoxes(bool InBody, int curX, int curY) {
cd.box[cd.pointBox].boxType == AATBUT ||
cd.box[cd.pointBox].boxType == AABUT) {
_iconArray[HL1] = RectangleObject(_vm->_bg->BgPal(),
- (TinselV2 ? HighlightColor() : COL_HILIGHT),
+ ((TinselVersion >= 2) ? HighlightColor() : COL_HILIGHT),
cd.box[cd.pointBox].w, cd.box[cd.pointBox].h);
MultiInsertObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _iconArray[HL1]);
MultiSetAniXY(_iconArray[HL1],
@@ -2332,7 +2332,7 @@ OBJECT *Dialogs::AddObject(const FREEL *pfreel, int num) {
void Dialogs::AddSlider(OBJECT **slide, const FILM *pfilm) {
_slideObject = *slide = AddObject(&pfilm->reels[IX_SLIDE], -1);
- MultiSetAniXY(*slide, MultiRightmost(_rectObject) + (TinselV2 ? NM_SLX : -M_SXOFF + 2),
+ MultiSetAniXY(*slide, MultiRightmost(_rectObject) + ((TinselVersion >= 2) ? NM_SLX : -M_SXOFF + 2),
_invD[_activeInv].inventoryY + _sliderYpos);
MultiSetZPosition(*slide, Z_INV_MFRAME);
}
@@ -2350,11 +2350,11 @@ void Dialogs::AddBox(int *pi, const int i) {
switch (cd.box[i].boxType) {
default:
// Ignore if it's a blank scene hopper box
- if (TinselV2 && (cd.box[i].textMethod == TM_NONE))
+ if ((TinselVersion >= 2) && (cd.box[i].textMethod == TM_NONE))
break;
// Give us a box
- _iconArray[*pi] = RectangleObject(_vm->_bg->BgPal(), TinselV2 ? BoxColor() : COL_BOX,
+ _iconArray[*pi] = RectangleObject(_vm->_bg->BgPal(), (TinselVersion >= 2) ? BoxColor() : COL_BOX,
cd.box[i].w, cd.box[i].h);
MultiInsertObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _iconArray[*pi]);
MultiSetAniXY(_iconArray[*pi], x, y);
@@ -2363,7 +2363,7 @@ void Dialogs::AddBox(int *pi, const int i) {
// Stick in the text
if ((cd.box[i].textMethod == TM_POINTER) ||
- (!TinselV2 && (cd.box[i].ixText == USE_POINTER))) {
+ ((TinselVersion <= 1) && (cd.box[i].ixText == USE_POINTER))) {
if (cd.box[i].boxText != NULL) {
if (cd.box[i].boxType == RGROUP) {
_iconArray[*pi] = ObjectTextOut(_vm->_bg->GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
@@ -2386,7 +2386,7 @@ void Dialogs::AddBox(int *pi, const int i) {
*pi += 1;
}
} else {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (cd.box[i].textMethod == TM_INDEX)
LoadStringRes(SysString(cd.box[i].ixText), _vm->_font->TextBufferAddr(), TBUFSZ);
else {
@@ -2398,7 +2398,7 @@ void Dialogs::AddBox(int *pi, const int i) {
assert(cd.box[i].boxType != RGROUP); // You'll need to add some code!
}
- if (TinselV2 && (cd.box[i].boxType == RGROUP))
+ if ((TinselVersion >= 2) && (cd.box[i].boxType == RGROUP))
_iconArray[*pi] = ObjectTextOut(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _vm->_font->TextBufferAddr(),
0, x + 2, y + TYOFF, _vm->_font->GetTagFontHandle(), 0, 0);
else
@@ -2452,7 +2452,7 @@ void Dialogs::AddBox(int *pi, const int i) {
*pi += 1;
// Stick in the text
- if (TinselV2) {
+ if (TinselVersion >= 2) {
assert(cd.box[i].textMethod == TM_INDEX);
LoadStringRes(SysString(cd.box[i].ixText), _vm->_font->TextBufferAddr(), TBUFSZ);
} else {
@@ -2477,7 +2477,7 @@ void Dialogs::AddBox(int *pi, const int i) {
*pi += 1;
// Stick in the text
- if (TinselV2) {
+ if (TinselVersion >= 2) {
assert(cd.box[i].textMethod == TM_INDEX);
LoadStringRes(SysString(cd.box[i].ixText), _vm->_font->TextBufferAddr(), TBUFSZ);
} else {
@@ -2518,7 +2518,7 @@ void Dialogs::AddBox(int *pi, const int i) {
*pi += 1;
// Stick in the text
- if (TinselV2) {
+ if (TinselVersion >= 2) {
assert(cd.box[i].textMethod == TM_INDEX);
LoadStringRes(SysString(cd.box[i].ixText), _vm->_font->TextBufferAddr(), TBUFSZ);
} else {
@@ -2591,7 +2591,7 @@ void Dialogs::AddBoxes(bool bPosnSlide) {
}
if (cd.bExtraWin) {
- if (bPosnSlide && !TinselV2)
+ if (bPosnSlide && TinselVersion <= 1)
_sliderYpos = _sliderYmin + (cd.extraBase * (_sliderYmax - _sliderYmin)) / (MAX_SAVED_FILES - NUM_RGROUP_BOXES);
else if (bPosnSlide) {
// Tinsel 2 bPosnSlide code
@@ -2616,7 +2616,7 @@ void Dialogs::AddBoxes(bool bPosnSlide) {
MultiMoveRelXY(_slideObject, 0, _sliderYpos - lastY);
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
MultiSetAniXY(_slideObject, _invD[_activeInv].inventoryX + 24 + 179, _sliderYpos);
}
@@ -2642,8 +2642,8 @@ int Dialogs::AddExtraWindow(int x, int y, OBJECT **retObj) {
// Get the frame's data
pfilm = (const FILM *)_vm->_handle->LockMem(_hWinParts);
- x += TinselV2 ? 30 : 20;
- y += TinselV2 ? 38 : 24;
+ x += (TinselVersion >= 2) ? 30 : 20;
+ y += (TinselVersion >= 2) ? 38 : 24;
// Draw the four corners
retObj[n] = AddObject(&pfilm->reels[IX_RTL], -1); // Top left
@@ -2651,44 +2651,44 @@ int Dialogs::AddExtraWindow(int x, int y, OBJECT **retObj) {
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_NTR], -1); // Top right
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth + 312 : 152), y);
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth + 312 : 152), y);
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_BL], -1); // Bottom left
- MultiSetAniXY(retObj[n], x, y + (TinselV2 ? _TLheight + 208 : 124));
+ MultiSetAniXY(retObj[n], x, y + ((TinselVersion >= 2) ? _TLheight + 208 : 124));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_BR], -1); // Bottom right
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth + 312 : 152),
- y + (TinselV2 ? _TLheight + 208 : 124));
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth + 312 : 152),
+ y + ((TinselVersion >= 2) ? _TLheight + 208 : 124));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
// Draw the edges
retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Top
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth : 6), y + NM_TBT);
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth : 6), y + NM_TBT);
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_H156], -1); // Bottom
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth : 6), y + (TinselV2 ? _TLheight + 208 + _BLheight + NM_BSY : 143));
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth : 6), y + ((TinselVersion >= 2) ? _TLheight + 208 + _BLheight + NM_BSY : 143));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Left
- MultiSetAniXY(retObj[n], x + NM_LSX, y + (TinselV2 ? _TLheight : 20));
+ MultiSetAniXY(retObj[n], x + NM_LSX, y + ((TinselVersion >= 2) ? _TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Right 1
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth + 312 + _TRwidth + NM_RSX : 179),
- y + (TinselV2 ? _TLheight : 20));
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth + 312 + _TRwidth + NM_RSX : 179),
+ y + ((TinselVersion >= 2) ? _TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
retObj[n] = AddObject(&pfilm->reels[IX_V104], -1); // Right 2
- MultiSetAniXY(retObj[n], x + (TinselV2 ? _TLwidth + 312 + _TRwidth + NM_SBL : 188),
- y + (TinselV2 ? _TLheight : 20));
+ MultiSetAniXY(retObj[n], x + ((TinselVersion >= 2) ? _TLwidth + 312 + _TRwidth + NM_SBL : 188),
+ y + ((TinselVersion >= 2) ? _TLheight : 20));
MultiSetZPosition(retObj[n], Z_INV_MFRAME);
n++;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_sliderYpos = _sliderYmin = y + 27;
_sliderYmax = y + 273;
@@ -2754,7 +2754,7 @@ void Dialogs::ConstructInventory(InventoryType filling) {
eV = (_invD[_activeInv].NoofVicons - 1) * (ITEM_HEIGHT + I_SEPARATION) + _SuppV;
// Which window frame corners to use
- if (TinselV2 && (_activeInv == INV_CONV)) {
+ if ((TinselVersion >= 2) && (_activeInv == INV_CONV)) {
_TL = IX_TL;
_TR = IX2_TR4;
_BL = IX_BL;
@@ -2799,7 +2799,7 @@ void Dialogs::ConstructInventory(InventoryType filling) {
// Bottom of header box
if (filling == FULL) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
retObj[n] = AddObject(&pfilm->reels[hFillers[_invD[_activeInv].NoofHicons - 2]], -1);
MultiSetAniXY(retObj[n], invX + _TLwidth, invY + NM_TBB);
MultiSetZPosition(retObj[n], zpos);
@@ -2833,7 +2833,7 @@ void Dialogs::ConstructInventory(InventoryType filling) {
n++;
}
if (_SuppH) {
- int offx = _TLwidth + eH - (TinselV2 ? ITEM_WIDTH + I_SEPARATION : 26);
+ int offx = _TLwidth + eH - ((TinselVersion >= 2) ? ITEM_WIDTH + I_SEPARATION : 26);
if (offx < _TLwidth) // Not too far!
offx = _TLwidth;
@@ -2862,7 +2862,7 @@ void Dialogs::ConstructInventory(InventoryType filling) {
// Left side of scroll bar
if (filling == FULL && _activeInv != INV_CONV) {
retObj[n] = AddObject(&pfilm->reels[vFillers[_invD[_activeInv].NoofVicons - 2]], -1);
- if (TinselV2)
+ if (TinselVersion >= 2)
MultiSetAniXY(retObj[n], invX + _TLwidth + eH + _TRwidth + NM_SBL, invY + _TLheight);
else
MultiSetAniXY(retObj[n], invX + _TLwidth + eH + M_SBL + 1, invY + _TLheight);
@@ -2877,8 +2877,8 @@ void Dialogs::ConstructInventory(InventoryType filling) {
n++;
}
if (_SuppV) {
- int offy = _TLheight + eV - (TinselV2 ? ITEM_HEIGHT + I_SEPARATION : 26);
- int minAmount = TinselV2 ? 20 : 5;
+ int offy = _TLheight + eV - ((TinselVersion >= 2) ? ITEM_HEIGHT + I_SEPARATION : 26);
+ int minAmount = (TinselVersion >= 2) ? 20 : 5;
if (offy < minAmount)
offy = minAmount;
@@ -2898,13 +2898,13 @@ void Dialogs::ConstructInventory(InventoryType filling) {
OBJECT **rect, **title;
// Draw background, slider and icons
- if (TinselV2 && (filling != EMPTY)) {
+ if ((TinselVersion >= 2) && (filling != EMPTY)) {
AddBackground(&retObj[n++], eH, eV);
AddTitle(&retObj[n++], eH);
}
if (filling == FULL) {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
rect = &retObj[n++];
title = &retObj[n++];
@@ -2914,7 +2914,7 @@ void Dialogs::ConstructInventory(InventoryType filling) {
if (_activeInv == INV_CONV) {
_slideObject = nullptr;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// !!!!! MAGIC NUMBER ALERT !!!!!
// Make sure it's big enough for the heading
if (MultiLeftmost(retObj[n - 1]) < _invD[INV_CONV].inventoryX + 10) {
@@ -2923,14 +2923,14 @@ void Dialogs::ConstructInventory(InventoryType filling) {
}
}
} else if (_invD[_activeInv].NoofItems > _invD[_activeInv].NoofHicons * _invD[_activeInv].NoofVicons) {
- _sliderYmin = _TLheight - (TinselV2 ? 1 : 2);
- _sliderYmax = _TLheight + eV + (TinselV2 ? 12 : 10);
+ _sliderYmin = _TLheight - ((TinselVersion >= 2) ? 1 : 2);
+ _sliderYmax = _TLheight + eV + ((TinselVersion >= 2) ? 12 : 10);
AddSlider(&retObj[n++], pfilm);
}
FillInInventory();
} else if (filling == CONF) {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
rect = &retObj[n++];
title = &retObj[n++];
@@ -3124,7 +3124,7 @@ void Dialogs::InvCursor(InvCursorFN fn, int CurX, int CurY) {
void Dialogs::ConvAction(int index) {
assert(_activeInv == INV_CONV); // not conv. window!
- MOVER *pMover = TinselV2 ? GetMover(_vm->_actor->GetLeadId()) : NULL;
+ MOVER *pMover = (TinselVersion >= 2) ? GetMover(_vm->_actor->GetLeadId()) : NULL;
switch (index) {
case INV_NOICON:
@@ -3136,7 +3136,7 @@ void Dialogs::ConvAction(int index) {
case INV_OPENICON:
// Store the direction the lead character is facing in when the conversation starts
- if (TinselV2)
+ if (TinselVersion >= 2)
_initialDirection = GetMoverDirection(pMover);
_thisIcon = -2; // Preamble
break;
@@ -3146,7 +3146,7 @@ void Dialogs::ConvAction(int index) {
break;
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
RunPolyTinselCode(_thisConvPoly, CONVERSE, PLR_NOEVENT, true);
else {
// If the lead's direction has changed for any reason (such as having broken the
@@ -3267,7 +3267,7 @@ void Dialogs::HideConversation(bool bHide) {
// Window is not hidden
_InventoryHidden = false;
- if (TinselV2 && _ItemsChanged)
+ if ((TinselVersion >= 2) && _ItemsChanged)
// Just rebuild the whole thing
ConstructInventory(FULL);
else {
@@ -3277,14 +3277,14 @@ void Dialogs::HideConversation(bool bHide) {
}
// Don't flash if items changed. If they have, will be redrawn anyway.
- if (TinselV2 || !_ItemsChanged) {
+ if ((TinselVersion >= 2) || !_ItemsChanged) {
for (i = 0; i < MAX_ICONS && _iconArray[i]; i++) {
MultiAdjustXY(_iconArray[i], -2 * SCREEN_WIDTH, 0);
}
}
}
- if (TinselV2 && _bMoveOnUnHide) {
+ if ((TinselVersion >= 2) && _bMoveOnUnHide) {
/*
* First time, position it appropriately
*/
@@ -3414,11 +3414,11 @@ void Dialogs::PopUpInventory(int invno) {
_reOpenMenu = false; // Better safe than sorry...
DisableTags(); // Tags disabled during inventory
- if (TinselV2)
+ if (TinselVersion >= 2)
DisablePointing(); // Pointing disabled during inventory
if (invno == INV_CONV) { // Conversation window?
- if (TinselV2)
+ if (TinselVersion >= 2)
// Quiet please..
_vm->_pcmMusic->dim(false);
@@ -3426,7 +3426,7 @@ void Dialogs::PopUpInventory(int invno) {
memset(_invD[INV_CONV].contents, 0, MAX_ININV * sizeof(int));
memcpy(_invD[INV_CONV].contents, _permIcons, _numPermIcons * sizeof(int));
_invD[INV_CONV].NoofItems = _numPermIcons;
- if (TinselV2)
+ if (TinselVersion >= 2)
_invD[INV_CONV].NoofHicons = _numPermIcons;
else
_thisIcon = 0;
@@ -3460,7 +3460,7 @@ void Dialogs::SetMenuGlobals(CONFINIT *ci) {
cd.NumBoxes = ci->NumBoxes;
cd.ixHeading = ci->ixHeading;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if ((ci->ixHeading != NO_HEADING) && SysString(ci->ixHeading))
_invD[INV_MENU].hInvTitle = SysString(ci->ixHeading);
else
@@ -3491,7 +3491,7 @@ void Dialogs::OpenMenu(CONFTYPE menuType) {
case SAVE_MENU:
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); // Show VK when saving a game
- if (!TinselV2)
+ if (TinselVersion <= 1)
_vm->_cursor->SetCursorScreenXY(262, 91);
SetMenuGlobals(&ciSave);
cd.editableRgroup = true;
@@ -3505,7 +3505,7 @@ void Dialogs::OpenMenu(CONFTYPE menuType) {
break;
case RESTART_MENU:
- if (TinselV2)
+ if (TinselVersion >= 2)
_vm->_cursor->SetCursorScreenXY(360, 153);
else if (_vm->getLanguage() == Common::JA_JPN)
_vm->_cursor->SetCursorScreenXY(180, 106);
@@ -3516,11 +3516,11 @@ void Dialogs::OpenMenu(CONFTYPE menuType) {
break;
case SOUND_MENU:
- if (TinselV2)
+ if (TinselVersion >= 2)
_displayedLanguage = TextLanguage();
#if 1
// FIXME: Hack to setup CONFBOX pointer to data in the global Config object
- if (TinselV2) {
+ if (TinselVersion >= 2) {
t2SoundBox[0].ival = &_vm->_config->_musicVolume;
t2SoundBox[1].ival = &_vm->_config->_soundVolume;
t2SoundBox[2].ival = &_vm->_config->_voiceVolume;
@@ -3545,7 +3545,7 @@ void Dialogs::OpenMenu(CONFTYPE menuType) {
break;
case QUIT_MENU:
- if (TinselV2)
+ if (TinselVersion >= 2)
_vm->_cursor->SetCursorScreenXY(360, 153);
else if (_vm->getLanguage() == Common::JA_JPN)
_vm->_cursor->SetCursorScreenXY(180, 106);
@@ -3653,7 +3653,7 @@ void Dialogs::KillInventory() {
if (_inventoryState == ACTIVE_INV) {
EnableTags();
- if (TinselV2)
+ if (TinselVersion >= 2)
EnablePointing();
_invD[_activeInv].bMax = _InventoryMaximised;
@@ -3674,7 +3674,7 @@ void Dialogs::KillInventory() {
} else if (_activeInv == INV_CONF)
InventoryIconCursor(false);
- if (TinselV2)
+ if (TinselVersion >= 2)
// Pump up the volume
if (_activeInv == INV_CONV)
_vm->_pcmMusic->unDim(false);
@@ -3807,7 +3807,7 @@ void Dialogs::SlideCSlider(int y, SSFN fn) {
gotoY = newY; // Hunky-Dory
// Move slider to new position
- if (TinselV2)
+ if (TinselVersion >= 2)
MultiMoveRelXY(_slideObject, 0, gotoY - _sliderYpos);
_sliderYpos = gotoY;
@@ -4607,11 +4607,11 @@ void Dialogs::InvPickup(int index) {
// If not holding anything
if (_heldItem == INV_NOICON && _invD[_activeInv].contents[index] &&
- (!TinselV2 || _invD[_activeInv].contents[index] != _heldItem)) {
+ ((TinselVersion <= 1) || _invD[_activeInv].contents[index] != _heldItem)) {
// Pick-up
invObj = GetInvObject(_invD[_activeInv].contents[index]);
_thisIcon = _invD[_activeInv].contents[index];
- if (TinselV2)
+ if (TinselVersion >= 2)
InvTinselEvent(invObj, PICKUP, INV_PICKUP, index);
else if (invObj->hScript)
InvTinselEvent(invObj, WALKTO, INV_PICKUP, index);
@@ -4625,7 +4625,7 @@ void Dialogs::InvPickup(int index) {
InvTinselEvent(invObj, PUTDOWN, INV_PICKUP, index);
else if (!(invObj->attribute & IO_ONLYINV1 && _activeInv != INV_1) && !(invObj->attribute & IO_ONLYINV2 && _activeInv != INV_2)) {
- if (TinselV2)
+ if (TinselVersion >= 2)
InvPutDown(index);
else
CoroScheduler.createProcess(PID_TCODE, InvPdProcess, &index, sizeof(index));
@@ -4741,9 +4741,9 @@ void Dialogs::InvAction() {
if (index != INV_NOICON) {
if (_invD[_activeInv].contents[index] && _invD[_activeInv].contents[index] != _heldItem) {
invObj = GetInvObject(_invD[_activeInv].contents[index]);
- if (TinselV2)
+ if (TinselVersion >= 2)
_thisIcon = _invD[_activeInv].contents[index];
- if (TinselV2 || (invObj->hScript))
+ if ((TinselVersion >= 2) || (invObj->hScript))
InvTinselEvent(invObj, ACTION, INV_ACTION, index);
}
}
@@ -5020,7 +5020,7 @@ void Dialogs::syncInvInfo(Common::Serializer &s) {
s.syncAsSint32LE(_invD[i].bMax);
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
for (int i = 0; i < _numObjects; ++i)
s.syncAsUint32LE(_invFilms[i]);
s.syncAsUint32LE(_heldFilm);
@@ -5054,7 +5054,7 @@ void Dialogs::RegisterIcons(void *cptr, int num) {
memmove(destP, srcP, 12);
destP->attribute = 0;
}
- } else if (TinselV2) {
+ } else if (TinselVersion >= 2) {
if (_invFilms == NULL) {
// First time - allocate memory
MEM_NODE *node = MemoryAllocFixed(_numObjects * sizeof(SCNHANDLE));
@@ -5091,7 +5091,7 @@ void Dialogs::setInvWinParts(SCNHANDLE hf) {
#ifdef DEBUG
pfilm = (const FILM *)_vm->_handle->LockMem(hf);
- assert(FROM_32(pfilm->numreels) >= (uint32)(TinselV2 ? T2_HOPEDFORREELS : T1_HOPEDFORREELS)); // not as many reels as expected
+ assert(FROM_32(pfilm->numreels) >= (uint32)((TinselVersion >= 2) ? T2_HOPEDFORREELS : T1_HOPEDFORREELS)); // not as many reels as expected
#endif
}
@@ -5598,7 +5598,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- if (!TinselV2)
+ if (TinselVersion <= 1)
CORO_INVOKE_1(AllowDclick, to->bev);
_ctx->pic = InitInterpretContext(GS_INVENTORY, to->pinvo->hScript, to->event, NOPOLY, 0, to->pinvo,
@@ -5632,7 +5632,7 @@ static void ObjectProcess(CORO_PARAM, const void *param) {
static void InvTinselEvent(INV_OBJECT *pinvo, TINSEL_EVENT event, PLR_EVENT be, int index) {
OP_INIT to = {pinvo, event, be, 0};
- if (_vm->_dialogs->InventoryIsHidden() || (TinselV2 && !pinvo->hScript))
+ if (_vm->_dialogs->InventoryIsHidden() || ((TinselVersion >= 2) && !pinvo->hScript))
return;
_vm->_dialogs->_glitterIndex = index;
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp
index bba7e6a26d4..f4923df7324 100644
--- a/engines/tinsel/drives.cpp
+++ b/engines/tinsel/drives.cpp
@@ -110,7 +110,7 @@ void DoCdChange() {
_vm->_sound->closeSampleStream();
// Use the filesize of the sample file to determine, for Discworld 2, which CD it is
- if (TinselV2) {
+ if (TinselVersion >= 2) {
TinselFile f;
if (!f.open(_vm->getSampleFile(g_sampleLanguage)))
// No CD present
@@ -179,7 +179,7 @@ bool TinselFile::open(const Common::String &filename) {
if (openInternal(filename))
return true;
- if (!TinselV2)
+ if (TinselVersion <= 1)
return false;
// Check if the file being requested is the *1.* or *2.* files
diff --git a/engines/tinsel/effect.cpp b/engines/tinsel/effect.cpp
index 33bd847e3db..61224bbfa40 100644
--- a/engines/tinsel/effect.cpp
+++ b/engines/tinsel/effect.cpp
@@ -65,7 +65,7 @@ static void EffectProcess(CORO_PARAM, const void *param) {
int x, y; // Lead actor position
// Run effect poly enter script
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, to->hEpoly, WALKIN,
GetMoverId(to->pMover), false, 0));
else
@@ -77,7 +77,7 @@ static void EffectProcess(CORO_PARAM, const void *param) {
} while (InPolygon(x, y, EFFECT) == to->hEpoly);
// Run effect poly leave script
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, to->hEpoly, WALKOUT,
GetMoverId(to->pMover), false, 0));
else
diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp
index 8f76feefa40..51315f41e99 100644
--- a/engines/tinsel/events.cpp
+++ b/engines/tinsel/events.cpp
@@ -138,7 +138,7 @@ void AllowDclick(CORO_PARAM, PLR_EVENT be) {
* Re-enables user control
*/
void ControlOn() {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
Control(CONTROL_ON);
return;
}
@@ -168,7 +168,7 @@ void ControlOn() {
* Takes control from the user
*/
void ControlOff() {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
Control(CONTROL_ON);
return;
}
@@ -194,7 +194,7 @@ void ControlOff() {
* Prevent tags and cursor re-appearing
*/
void ControlStartOff() {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
Control(CONTROL_STARTOFF);
return;
}
@@ -218,7 +218,7 @@ void ControlStartOff() {
* Return TRUE if control taken, FALSE if not.
*/
bool GetControl(int param) {
- if (TinselV2)
+ if (TinselVersion >= 2)
return GetControl();
else if (TestToken(TOKEN_CONTROL)) {
@@ -237,7 +237,7 @@ bool GetControl() {
}
bool ControlIsOn() {
- if (TinselV2)
+ if (TinselVersion >= 2)
return (g_controlState == CONTROL_ON);
return TestToken(TOKEN_CONTROL);
@@ -266,7 +266,7 @@ static void WalkProcess(CORO_PARAM, const void *param) {
_ctx->pMover = GetMover(LEAD_ACTOR);
- if (TinselV2 && MoverIs(_ctx->pMover) && !MoverIsSWalking(_ctx->pMover)) {
+ if ((TinselVersion >= 2) && MoverIs(_ctx->pMover) && !MoverIsSWalking(_ctx->pMover)) {
assert(_ctx->pMover->hCpath != NOPOLY); // Lead actor is not in a path
_ctx->thisWalk = SetActorDest(_ctx->pMover, to->x, to->y, false, 0);
@@ -275,7 +275,7 @@ static void WalkProcess(CORO_PARAM, const void *param) {
while (MoverMoving(_ctx->pMover) && (_ctx->thisWalk == GetWalkNumber(_ctx->pMover)))
CORO_SLEEP(1);
- } else if (!TinselV2 && _ctx->pMover->bActive) {
+ } else if ((TinselVersion <= 1) && _ctx->pMover->bActive) {
assert(_ctx->pMover->hCpath != NOPOLY); // Lead actor is not in a path
GetToken(TOKEN_LEAD);
@@ -312,13 +312,13 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
if ((actor = GetTaggedActor()) != 0) {
// Event for a tagged actor
- if (TinselV2)
+ if (TinselVersion >= 2)
ActorEvent(Common::nullContext, actor, uEvent, false, 0);
else
ActorEvent(actor, uEvent, be);
} else if ((hPoly = GetTaggedPoly()) != NOPOLY) {
// Event for active tagged polygon
- if (!TinselV2)
+ if (TinselVersion <= 1)
RunPolyTinselCode(hPoly, uEvent, be, false);
else if (uEvent != PROV_WALKTO)
PolygonEvent(Common::nullContext, hPoly, uEvent, 0, false, 0);
@@ -328,13 +328,13 @@ static void ProcessUserEvent(TINSEL_EVENT uEvent, const Common::Point &coOrds, P
// There could be a poly involved which has no tag.
if ((hPoly = InPolygon(aniX, aniY, TAG)) != NOPOLY ||
- (!TinselV2 && ((hPoly = InPolygon(aniX, aniY, EXIT)) != NOPOLY))) {
- if (TinselV2 && (uEvent != PROV_WALKTO))
+ ((TinselVersion <= 1) && ((hPoly = InPolygon(aniX, aniY, EXIT)) != NOPOLY))) {
+ if ((TinselVersion >= 2) && (uEvent != PROV_WALKTO))
PolygonEvent(Common::nullContext, hPoly, uEvent, 0, false, 0);
- else if (!TinselV2)
+ else if (TinselVersion <= 1)
RunPolyTinselCode(hPoly, uEvent, be, false);
} else if ((uEvent == PROV_WALKTO) || (uEvent == WALKTO)) {
- if (TinselV2)
+ if (TinselVersion >= 2)
ProcessedProvisional();
WalkTo(aniX, aniY);
}
@@ -393,7 +393,7 @@ void ProcessKeyEvent(PLR_EVENT ke) {
PlayerEvent(ke, mousePos);
}
-#define REAL_ACTION_CHECK if (TinselV2) { \
+#define REAL_ACTION_CHECK if (TinselVersion >= 2) { \
if (DwGetCurrentTime() - lastRealAction < 4) return; \
lastRealAction = DwGetCurrentTime(); \
}
@@ -432,7 +432,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
if (!ControlIsOn() && (pEvent != PLR_DRAG1_END))
return;
- if (TinselV2 && _vm->_dialogs->InventoryActive()) {
+ if ((TinselVersion >= 2) && _vm->_dialogs->InventoryActive()) {
int x, y;
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &x, &y);
_vm->_dialogs->EventToInventory(pEvent, Common::Point(coOrds.x - x, coOrds.y - y));
@@ -467,7 +467,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
case PLR_WALKTO:
REAL_ACTION_CHECK;
- if (TinselV2 || !_vm->_dialogs->InventoryActive())
+ if ((TinselVersion >= 2) || !_vm->_dialogs->InventoryActive())
ProcessUserEvent(WALKTO, coOrds, PLR_SLEFT);
else
_vm->_dialogs->EventToInventory(PLR_SLEFT, coOrds);
@@ -476,7 +476,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
case PLR_ACTION:
REAL_ACTION_CHECK;
- if (TinselV2 || !_vm->_dialogs->InventoryActive())
+ if ((TinselVersion >= 2) || !_vm->_dialogs->InventoryActive())
ProcessUserEvent(ACTION, coOrds, PLR_DLEFT);
else
_vm->_dialogs->EventToInventory(PLR_DLEFT, coOrds);
@@ -485,7 +485,7 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
case PLR_LOOK:
REAL_ACTION_CHECK;
- if (TinselV2 || !_vm->_dialogs->InventoryActive())
+ if ((TinselVersion >= 2) || !_vm->_dialogs->InventoryActive())
ProcessUserEvent(LOOK, coOrds, PLR_SRIGHT);
else
_vm->_dialogs->EventToInventory(PLR_SRIGHT, coOrds);
@@ -559,7 +559,7 @@ void PolyTinselProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Take control for CONVERSE events
if (to->event == CONVERSE) {
@@ -655,14 +655,14 @@ void PolygonEvent(CORO_PARAM, HPOLYGON hPoly, TINSEL_EVENT tEvent, int actor, bo
void RunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, PLR_EVENT be, bool tc) {
PTP_INIT to = { hPoly, event, be, tc, 0, NULL };
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
}
void effRunPolyTinselCode(HPOLYGON hPoly, TINSEL_EVENT event, int actor) {
PTP_INIT to = { hPoly, event, PLR_NOEVENT, false, actor, NULL };
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
CoroScheduler.createProcess(PID_TCODE, PolyTinselProcess, &to, sizeof(to));
}
diff --git a/engines/tinsel/faders.cpp b/engines/tinsel/faders.cpp
index b3f85ec7ca1..174bdfb983c 100644
--- a/engines/tinsel/faders.cpp
+++ b/engines/tinsel/faders.cpp
@@ -70,7 +70,7 @@ static COLORREF ScaleColor(COLORREF color, uint32 colorMult) {
*/
static void FadePalette(COLORREF *pNew, COLORREF *pOrig, int numColors, uint32 mult) {
for (int i = 0; i < numColors; i++, pNew++, pOrig++) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
// apply multiplier to RGB components
*pNew = ScaleColor(*pOrig, mult);
else if (i == (TalkColor() - 1)) {
@@ -103,7 +103,7 @@ static void FadeProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2)
+ if (TinselVersion >= 2)
// Note that this palette is being faded
FadingPalette(pFade->pPalQ, true);
@@ -114,7 +114,7 @@ static void FadeProcess(CORO_PARAM, const void *param) {
// go through all multipliers in table - until a negative entry
// fade palette using next multiplier
- if (TinselV2)
+ if (TinselVersion >= 2)
FadePalette(_ctx->fadeRGB, pFade->pPalQ->palRGB,
pFade->pPalQ->numColors, (uint32) *_ctx->pColMult);
else
@@ -128,7 +128,7 @@ static void FadeProcess(CORO_PARAM, const void *param) {
CORO_SLEEP(1);
}
- if (TinselV2)
+ if (TinselVersion >= 2)
// Note that this palette is being faded
FadingPalette(pFade->pPalQ, false);
@@ -145,7 +145,7 @@ static void FadeProcess(CORO_PARAM, const void *param) {
static void Fader(const long multTable[]) {
PALQ *pPal; // palette manager iterator
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// The is only ever one cuncurrent fade
// But this could be a fade out and the fade in is still going!
CoroScheduler.killMatchingProcess(PID_FADER);
diff --git a/engines/tinsel/font.cpp b/engines/tinsel/font.cpp
index 1ce57002fb6..3785151f1a3 100644
--- a/engines/tinsel/font.cpp
+++ b/engines/tinsel/font.cpp
@@ -48,10 +48,10 @@ void Font::FettleFontPal(SCNHANDLE fontPal) {
assert(_hTagFont); // Tag font not declared
assert(_hTalkFont); // Talk font not declared
- h->SetImagePalette(h->GetFontImageHandle(_hTagFont), !TinselV2 ? fontPal : 0); // get image for char 0
- h->SetImagePalette(h->GetFontImageHandle(_hTalkFont), !TinselV2 ? fontPal : 0); // get image for char 0
+ h->SetImagePalette(h->GetFontImageHandle(_hTagFont), (TinselVersion <= 1) ? fontPal : 0); // get image for char 0
+ h->SetImagePalette(h->GetFontImageHandle(_hTalkFont), (TinselVersion <= 1) ? fontPal : 0); // get image for char 0
- if (TinselV2 && SysVar(SV_TAGCOLOR)) {
+ if ((TinselVersion >= 2) && SysVar(SV_TAGCOLOR)) {
const COLORREF c = _vm->_actor->GetActorRGB(-1);
SetTagColorRef(c);
UpdateDACqueue(SysVar(SV_TAGCOLOR), c);
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 4fd2b4f7e07..634e6cdb342 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -1050,7 +1050,7 @@ void ClearScreen() {
* Updates the screen surface within the following rectangle
*/
void UpdateScreenRect(const Common::Rect &pClip) {
- int yOffset = TinselV2 ? (g_system->getHeight() - SCREEN_HEIGHT) / 2 : 0;
+ int yOffset = (TinselVersion >= 2) ? (g_system->getHeight() - SCREEN_HEIGHT) / 2 : 0;
byte *pSrc = (byte *)_vm->screen().getBasePtr(pClip.left, pClip.top);
g_system->copyRectToScreen(pSrc, _vm->screen().pitch, pClip.left, pClip.top + yOffset,
pClip.width(), pClip.height());
@@ -1074,7 +1074,7 @@ void DrawObject(DRAWOBJECT *pObj) {
// If writing constant data, don't bother locking the data pointer and reading src details
if (((pObj->flags & DMA_CONST) == 0) || (TinselV3 && ((pObj->flags & 0x05) == 0x05))) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
srcPtr = (byte *)_vm->_handle->LockMem(pObj->hBits);
pObj->charBase = nullptr;
pObj->transOffset = 0;
@@ -1142,10 +1142,10 @@ void DrawObject(DRAWOBJECT *pObj) {
// Handle various draw types
uint8 typeId = pObj->flags & 0xff;
- int packType = pObj->flags >> 14; // TinselV2
+ int packType = pObj->flags >> 14; // TinselVersion >= 2
- if (TinselV2 && packType != 0) {
- // Color packing for TinselV2
+ if ((TinselVersion >= 2) && packType != 0) {
+ // Color packing for TinselVersion >= 2
if (packType == 1)
pObj->baseCol = 0xF0; // 16 from 240
@@ -1159,15 +1159,15 @@ void DrawObject(DRAWOBJECT *pObj) {
switch (typeId) {
case 0x01: // all versions, draw sprite without clipping
case 0x41: // all versions, draw sprite with clipping
- case 0x02: // TinselV2, draw sprite without clipping
- case 0x11: // TinselV2, draw sprite without clipping, flipped horizontally
- case 0x42: // TinselV2, draw sprite with clipping
- case 0x51: // TinselV2, draw sprite with clipping, flipped horizontally
- assert(TinselV2 || (typeId == 0x01 || typeId == 0x41));
+ case 0x02: // TinselV2 and above, draw sprite without clipping
+ case 0x11: // TinselV2 and above, draw sprite without clipping, flipped horizontally
+ case 0x42: // TinselV2 and above, draw sprite with clipping
+ case 0x51: // TinselV2 and above, draw sprite with clipping, flipped horizontally
+ assert((TinselVersion >= 2) || (typeId == 0x01 || typeId == 0x41));
if (TinselV3)
t3WrtNonZero(pObj, srcPtr, destPtr);
- else if (TinselV2)
+ else if (TinselVersion >= 2)
t2WrtNonZero(pObj, srcPtr, destPtr, (typeId & DMA_CLIP) != 0, (typeId & DMA_FLIPH) != 0);
else if (TinselV1PSX || TinselV1Saturn)
psxSaturnDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41, psxFourBitClut, psxSkipBytes, psxMapperTable, true);
@@ -1182,7 +1182,7 @@ void DrawObject(DRAWOBJECT *pObj) {
case 0x48: // draw background with clipping
if (TinselV3)
t3WrtAll(pObj, srcPtr, destPtr);
- else if (TinselV2 || TinselV1Mac || TinselV0)
+ else if ((TinselVersion == 2) || TinselV1Mac || TinselV0)
WrtAll(pObj, srcPtr, destPtr, typeId == 0x48);
else if (TinselV1PSX || TinselV1Saturn)
psxSaturnDrawTiles(pObj, srcPtr, destPtr, typeId == 0x48, psxFourBitClut, psxSkipBytes, psxMapperTable, false);
@@ -1197,7 +1197,7 @@ void DrawObject(DRAWOBJECT *pObj) {
case 0xC1: // TinselV3, draw sprite with transparency & clipping
if (TinselV3)
t3TransWNZ(pObj, srcPtr, destPtr);
- else if (TinselV2)
+ else if (TinselVersion == 2)
t2WrtNonZero(pObj, srcPtr, destPtr, (typeId & DMA_CLIP) != 0, (typeId & DMA_FLIPH) != 0);
break;
case 0x84: // draw transparent surface without clipping
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index 33087bf646b..e9a6a1acae3 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -80,7 +80,7 @@ Handle::~Handle() {
* permanent graphics etc.
*/
void Handle::SetupHandleTable() {
- bool t2Flag = TinselV2;
+ bool t2Flag = TinselVersion >= 2;
int RECORD_SIZE = t2Flag ? 24 : 20;
int len;
@@ -417,14 +417,14 @@ SCNHANDLE Handle::GetFontImageHandle(SCNHANDLE offset) {
const ACTORDATA *Handle::GetActorData(SCNHANDLE offset, int numActors) {
byte *data = LockMem(offset);
const bool isBE = TinselV1Mac || TinselV1Saturn;
- const uint32 size = TinselV2 ? 20 : 12; // ACTORDATA struct size
+ const uint32 size = (TinselVersion >= 2) ? 20 : 12; // ACTORDATA struct size
Common::MemoryReadStreamEndian *stream = new Common::MemoryReadStreamEndian(data, size * numActors, isBE);
ACTORDATA *actorData = new ACTORDATA[numActors];
for (int i = 0; i < numActors; i++) {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
actorData[i].masking = stream->readSint32();
actorData[i].hActorId = stream->readUint32();
actorData[i].hActorCode = stream->readUint32();
@@ -483,7 +483,7 @@ byte *Handle::LockMem(SCNHANDLE offset) {
// Data was discarded, we have to reload
MemoryReAlloc(pH->_node, pH->filesize & FSIZE_MASK);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
SetCD(pH->flags2 & fAllCds);
CdCD(Common::nullContext);
}
@@ -602,7 +602,7 @@ int Handle::CdNumber(SCNHANDLE offset) {
MEMHANDLE *pH = _handleTable + handle;
- if (!TinselV2)
+ if (TinselVersion <= 1)
return 1;
return GetCD(pH->flags2 & fAllCds);
diff --git a/engines/tinsel/heapmem.cpp b/engines/tinsel/heapmem.cpp
index f1b601bd30a..046aa2078d0 100644
--- a/engines/tinsel/heapmem.cpp
+++ b/engines/tinsel/heapmem.cpp
@@ -125,9 +125,9 @@ void MemoryInit() {
// store the current heap size in the sentinel
uint32 size = MemoryPoolSize[0];
- if (TinselVersion == TINSEL_V1) size = MemoryPoolSize[1];
- else if (TinselVersion == TINSEL_V2) size = MemoryPoolSize[2];
- else if (TinselVersion == TINSEL_V3) {
+ if (TinselVersion == 1) size = MemoryPoolSize[1];
+ else if (TinselVersion == 2) size = MemoryPoolSize[2];
+ else if (TinselVersion == 3) {
warning("TODO: Find the correct memory pool size for Noir, using 512 MiB for now");
size = MemoryPoolSize[3];
}
diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp
index f3d8b3af782..53ff08e69d0 100644
--- a/engines/tinsel/move.cpp
+++ b/engines/tinsel/move.cpp
@@ -51,10 +51,10 @@ HPOLYGON InitExtraBlock(MOVER *ca, MOVER *ta);
//----------------- LOCAL DEFINES --------------------
-#define XMDIST (TinselV2 ? 6 : 4)
-#define XHMDIST (TinselV2 ? 3 : 2)
-#define YMDIST (TinselV2 ? 3 : 2)
-#define YHMDIST (TinselV2 ? 3 : 2)
+#define XMDIST ((TinselVersion >= 2) ? 6 : 4)
+#define XHMDIST ((TinselVersion >= 2) ? 3 : 2)
+#define YMDIST ((TinselVersion >= 2) ? 3 : 2)
+#define YHMDIST ((TinselVersion >= 2) ? 3 : 2)
#define XTHERE 1
#define XRESTRICT 2
@@ -69,7 +69,7 @@ HPOLYGON InitExtraBlock(MOVER *ca, MOVER *ta);
#define ALL_SORTED 1
#define NOT_SORTED 0
-#define STEPS_MAX (TinselV2 ? 12 : 6)
+#define STEPS_MAX ((TinselVersion >= 2) ? 12 : 6)
//----------------- LOCAL GLOBAL DATA --------------------
@@ -510,7 +510,7 @@ static void GotThere(MOVER *pMover) {
// Perhaps we have'nt moved.
if (pMover->objX == (int)pMover->walkedFromX && pMover->objY == (int)pMover->walkedFromY) {
// Got there without moving
- if (!TinselV2)
+ if (TinselVersion <= 1)
GotThereWithoutMoving(pMover);
else if (!pMover->bSpecReel) {
// No tag reel, look at cursor
@@ -529,13 +529,13 @@ static void GotThere(MOVER *pMover) {
}
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
_vm->_actor->ReTagActor(pMover->actorID); // Tag allowed while stationary
SetMoverStanding(pMover);
pMover->bMoving = false;
- if (TinselV2 && pMover->bIgPath && pMover->zOverride != -1
+ if ((TinselVersion >= 2) && pMover->bIgPath && pMover->zOverride != -1
&& InPolygon(pMover->objX, pMover->objY, PATH) == NOPOLY)
// New feature for end-of-scene walk-outs
SetMoverZ(pMover, pMover->objY, pMover->zOverride);
@@ -616,7 +616,7 @@ static void SetMoverIntDest(MOVER *pMover, int x, int y) {
pMover->ItargetX = x;
pMover->ItargetY = y;
// make damn sure that Itarget is in hIpath
- pMover->hIpath = !TinselV2 ? hTpath : InPolygon(x, y, PATH);
+ pMover->hIpath = (TinselVersion <= 1) ? hTpath : InPolygon(x, y, PATH);
} else if (IsAdjacentPath(pMover->hCpath, hTpath)) {
// In path adjacent to target
if (PolySubtype(hTpath) != NODE) {
@@ -627,24 +627,24 @@ static void SetMoverIntDest(MOVER *pMover, int x, int y) {
}
pMover->ItargetX = x;
pMover->ItargetY = y;
- if (TinselV2)
+ if (TinselVersion >= 2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(x, y, PATH);
} else {
// Target path is node - head for end node.
node = NearestEndNode(hTpath, pMover->objX, pMover->objY);
getNpathNode(hTpath, node, &pMover->ItargetX, &pMover->ItargetY);
- if (TinselV2)
+ if (TinselVersion >= 2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(pMover->ItargetX, pMover->ItargetY, PATH);
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
pMover->hIpath = hTpath;
} else {
assert(hTpath != NOPOLY); // Error 701
hIpath = GetPathOnTheWay(pMover->hCpath, hTpath);
- if (TinselV2 && (hIpath == NOPOLY)) {
+ if ((TinselVersion >= 2) && (hIpath == NOPOLY)) {
pMover->hIpath = NOPOLY;
} else if (hIpath != NOPOLY) {
/* Head for an en-route path */
@@ -653,13 +653,13 @@ static void SetMoverIntDest(MOVER *pMover, int x, int y) {
if (CanGetThere(pMover, x, y) == GT_OK) {
pMover->ItargetX = x;
pMover->ItargetY = y;
- if (TinselV2)
+ if (TinselVersion >= 2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(x, y, PATH);
} else {
pMover->ItargetX = PolyCenterX(hIpath);
pMover->ItargetY = PolyCenterY(hIpath);
- if (TinselV2)
+ if (TinselVersion >= 2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(pMover->ItargetX, pMover->ItargetY, PATH);
}
@@ -667,11 +667,11 @@ static void SetMoverIntDest(MOVER *pMover, int x, int y) {
/* En-route path is node - head for end node. */
node = NearestEndNode(hIpath, pMover->objX, pMover->objY);
getNpathNode(hIpath, node, &pMover->ItargetX, &pMover->ItargetY);
- if (TinselV2)
+ if (TinselVersion >= 2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(pMover->ItargetX, pMover->ItargetY, PATH);
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
pMover->hIpath = hIpath;
}
}
@@ -990,7 +990,7 @@ static void SetNextDest(MOVER *pMover) {
x = nextx;
y = nexty;
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
/*-------------------------
Change of path polygon? |
-------------------------*/
@@ -1285,7 +1285,7 @@ static void SetOffWithinNodePath(MOVER *pMover, HPOLYGON StartPath, HPOLYGON Des
endnode == NearestEndNode(StartPath, pMover->objX, pMover->objY)) {
// Leave it be
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Yeah, but we need a destination
// It's release night and there's this problem in the bar...
if (hIpath) // must be, but...
@@ -1334,7 +1334,7 @@ int SetActorDest(MOVER *pMover, int clickX, int clickY, bool igPath, SCNHANDLE h
HPOLYGON StartPath, DestPath = 0;
int targetX, targetY;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// No need to synchronise if not moving!
// Hopefully will stop luggage flip in shades.
if (!MoverMoving(pMover))
@@ -1357,7 +1357,7 @@ int SetActorDest(MOVER *pMover, int clickX, int clickY, bool igPath, SCNHANDLE h
pMover->zOverride = -1;
pMover->hRpath = NOPOLY;
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Use the supplied reel or restore the normal actor.
if (hFilm != 0)
AlterMover(pMover, hFilm, AR_WALKREEL);
@@ -1416,7 +1416,7 @@ int SetActorDest(MOVER *pMover, int clickX, int clickY, bool igPath, SCNHANDLE h
SetMoverUltDest(pMover, targetX, targetY);
SetMoverIntDest(pMover, targetX, targetY);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// No movement for unconnected paths
if (pMover->hIpath == NOPOLY && !igPath) {
GotThere(pMover);
@@ -1570,10 +1570,10 @@ static void EnteringNewPath(MOVER *pMover, HPOLYGON hPath, int x, int y) {
return;
// Added 23/10/96
- if (TinselV2 && (pMover->hRpath == hPath))
+ if ((TinselVersion >= 2) && (pMover->hRpath == hPath))
return;
- if (TinselV2)
+ if (TinselVersion >= 2)
pMover->hRpath = hLpath;
SetMoverIntDest(pMover, pMover->UtargetX, pMover->UtargetY);
SetNextDest(pMover);
@@ -1635,7 +1635,7 @@ void MoveActor(MOVER *pMover) {
/**/ g_BogusVar = 0; //
#endif
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// During swalk()s, movement while hidden may be slowed down.
if (pMover->bHidden) {
if (++g_hSlowVar < pMover->SlowFactor)
diff --git a/engines/tinsel/movers.cpp b/engines/tinsel/movers.cpp
index 2a4021abd39..2dcd393d9c8 100644
--- a/engines/tinsel/movers.cpp
+++ b/engines/tinsel/movers.cpp
@@ -224,7 +224,7 @@ void HideMover(MOVER *pMover, int sf) {
pMover->bHidden = true;
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// sf is only passed in Tinsel v1
pMover->SlowFactor = sf;
} else {
@@ -254,7 +254,7 @@ bool MoverHidden(MOVER *pMover) {
* To be or not to be? If it be, then it is.
*/
bool MoverIs(MOVER *pMover) {
- if (TinselV2)
+ if (TinselVersion >= 2)
return pMover->actorObj ? true : false;
else
return getMActorState(pMover);
@@ -271,7 +271,7 @@ bool MoverIsSWalking(MOVER *pMover) {
* MoverMoving()
*/
bool MoverMoving(MOVER *pMover) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
return pMover->bMoving;
if (pMover->UtargetX == -1 && pMover->UtargetY == -1)
@@ -299,7 +299,7 @@ int GetMoverId(MOVER *pMover) {
*/
void SetMoverZ(MOVER *pMover, int y, uint32 zFactor) {
if (!pMover->bHidden) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
_vm->_actor->AsetZPos(pMover->actorObj, y, zFactor);
else if (MoverIsSWalking(pMover) && pMover->zOverride != -1) {
// Special for SWalk()
@@ -321,7 +321,7 @@ void SetMoverZoverride(MOVER *pMover, uint32 zFactor) {
void UnHideMover(MOVER *pMover) {
assert(pMover); // unHiding null moving actor
- if (!TinselV2 || pMover->bHidden) {
+ if ((TinselVersion <= 1) || pMover->bHidden) {
pMover->bHidden = false;
// Make visible on the screen
@@ -570,7 +570,7 @@ void AlterMover(MOVER *pMover, SCNHANDLE film, AR_FUNCTION fn) {
assert(pfilm != NULL);
InitStepAnimScript(&pMover->actorAnim, pMover->actorObj, FROM_32(pfilm->reels[0].script), ONE_SECOND / FROM_32(pfilm->frate));
- if (!TinselV2)
+ if (TinselVersion <= 1)
pMover->stepCount = 0;
// If no path, just use first path in the scene
@@ -910,7 +910,7 @@ void T3MoverProcess(CORO_PARAM, const void *param) {
* Creates a handling process for a moving actor
*/
void MoverProcessCreate(int X, int Y, int id, MOVER *pMover) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
MAINIT iStruct;
iStruct.X = X;
iStruct.Y = Y;
@@ -941,8 +941,8 @@ MOVER *InMoverBlock(MOVER *pMover, int x, int y) {
for (int i = 0; i < MAX_MOVERS; i++) {
if (pMover == &g_Movers[i] ||
- (TinselV2 && (g_Movers[i].actorObj == NULL)) ||
- (!TinselV2 && !g_Movers[i].bActive))
+ ((TinselVersion >= 2) && (g_Movers[i].actorObj == NULL)) ||
+ ((TinselVersion <= 1) && !g_Movers[i].bActive))
continue;
// At around the same height?
@@ -973,13 +973,13 @@ MOVER *InMoverBlock(MOVER *pMover, int x, int y) {
*/
void SaveMovers(SAVED_MOVER *sMoverInfo) {
for (int i = 0; i < MAX_MOVERS; i++) {
- sMoverInfo[i].bActive = !TinselV2 ? g_Movers[i].bActive : g_Movers[i].actorObj != NULL;
+ sMoverInfo[i].bActive = (TinselVersion <= 1) ? g_Movers[i].bActive : g_Movers[i].actorObj != NULL;
sMoverInfo[i].actorID = g_Movers[i].actorID;
sMoverInfo[i].objX = g_Movers[i].objX;
sMoverInfo[i].objY = g_Movers[i].objY;
sMoverInfo[i].hLastfilm = g_Movers[i].hLastFilm;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
sMoverInfo[i].bHidden = g_Movers[i].bHidden;
sMoverInfo[i].brightness = g_Movers[i].brightness;
sMoverInfo[i].startColor = g_Movers[i].startColor;
@@ -994,7 +994,7 @@ void SaveMovers(SAVED_MOVER *sMoverInfo) {
void RestoreAuxScales(SAVED_MOVER *sMoverInfo) {
for (int i = 0; i < MAX_MOVERS; i++) {
- if (TinselV2)
+ if (TinselVersion >= 2)
g_Movers[i].actorID = sMoverInfo[i].actorID;
memcpy(g_Movers[i].walkReels, sMoverInfo[i].walkReels, TOTAL_SCALES * 4 * sizeof(SCNHANDLE));
diff --git a/engines/tinsel/movers.h b/engines/tinsel/movers.h
index e93d85486b0..78c311294c8 100644
--- a/engines/tinsel/movers.h
+++ b/engines/tinsel/movers.h
@@ -37,7 +37,7 @@ enum IND {NO_PROB, TRY_CENTER, TRY_CORNER, TRY_NEXTCORNER};
enum DIRECTION { LEFTREEL, RIGHTREEL, FORWARD, AWAY };
-#define NUM_MAINSCALES (TinselV2 ? 10 : 5)
+#define NUM_MAINSCALES ((TinselVersion >= 2) ? 10 : 5)
#define NUM_AUXSCALES 5
#define TOTAL_SCALES (NUM_MAINSCALES + NUM_AUXSCALES)
#define REQ_MAIN_SCALES 10
diff --git a/engines/tinsel/multiobj.cpp b/engines/tinsel/multiobj.cpp
index 93b0c4eda02..78aacffba5d 100644
--- a/engines/tinsel/multiobj.cpp
+++ b/engines/tinsel/multiobj.cpp
@@ -196,7 +196,7 @@ void MultiAdjustXY(OBJECT *pMultiObj, int deltaX, int deltaY) {
if (deltaX == 0 && deltaY == 0)
return; // ignore no change
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// *** This may be wrong!!!
if (pMultiObj->flags & DMA_FLIPH) {
// image is flipped horizontally - flip the x direction
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index 565f062fccf..ce5290d86cc 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -270,7 +270,7 @@ void Music::OpenMidiFiles() {
if (TinselV0) {
// The early demo version of DW1 doesn't have MIDI
- } else if (TinselV2) {
+ } else if (TinselVersion >= 2) {
// DW2 uses a different music mechanism
} else if (TinselV1Mac) {
// open MIDI sequence file in binary mode
diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index 0693d00ab07..b4ba25c3522 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -339,7 +339,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
p->hPal = hNewPal; // set hardware palette data
p->numColors = pal->numColors; // set number of colors in palette
- if (TinselV2)
+ if (TinselVersion >= 2)
// Copy all the colors
memcpy(p->palRGB, pal->palRGB, p->numColors * sizeof(COLORREF));
@@ -350,7 +350,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
#endif
// Q the change to the video DAC
- if (TinselV2)
+ if (TinselVersion >= 2)
UpdateDACqueue(p->posInDAC, p->numColors, p->palRGB);
else
UpdateDACqueueHandle(p->posInDAC, p->numColors, p->hPal);
@@ -367,7 +367,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
pNxtPal->posInDAC = (pPrev->posInDAC + pPrev->numColors) | PALETTE_MOVED;
// Q the palette change in position to the video DAC
- if (!TinselV2)
+ if (TinselVersion <= 1)
UpdateDACqueueHandle(pNxtPal->posInDAC, pNxtPal->numColors, pNxtPal->hPal);
else if (!pNxtPal->bFading)
UpdateDACqueue(pNxtPal->posInDAC, pNxtPal->numColors, pNxtPal->palRGB);
@@ -451,7 +451,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
// install new palette
pPalQ->hPal = hNewPal;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pPalQ->numColors = pal->numColors;
// Copy all the colors
@@ -466,7 +466,7 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
}
} else {
// # colors are different - will have to update all following palette entries
- assert(!TinselV2); // Fatal error for Tinsel 2
+ assert(TinselVersion <= 1); // Fatal error for Tinsel 2
PALQ *pNxtPalQ; // next palette queue position
@@ -574,7 +574,7 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) {
val /= 63;
byte blackColorIndex = (!TinselV1Mac) ? 0 : 255;
g_transPalette[i + 1] = (uint8)((val == 0) ? blackColorIndex : val +
- (TinselV2 ? TranslucentColor() : COL_HILIGHT) - 1);
+ ((TinselVersion >= 2) ? TranslucentColor() : COL_HILIGHT) - 1);
}
delete pal;
@@ -648,7 +648,7 @@ int HighlightColor() {
}
int TalkColor() {
- return TinselV2 ? g_talkIndex : TALKFONT_COL;
+ return (TinselVersion >= 2) ? g_talkIndex : TALKFONT_COL;
}
void SetTalkColorRef(COLORREF colRef) {
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 904c8f26e17..acf31ced3d9 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -252,7 +252,7 @@ void ResetVarsPCode() {
*/
void LockCode(INT_CONTEXT *ic) {
if (ic->GSort == GS_MASTER) {
- if (TinselV2)
+ if (TinselVersion >= 2)
// Get the srcipt handle from a specific global chunk
ic->code = (byte *)_vm->_handle->LockMem(g_hMasterScript);
else
@@ -318,7 +318,7 @@ static void FreeWaitCheck(INT_CONTEXT * pic, bool bVoluntary) {
*/
static void FreeInterpretContextPi(INT_CONTEXT *pic) {
FreeWaitCheck(pic, true);
- if (TinselV2)
+ if (TinselVersion >= 2)
memset(pic, 0, sizeof(INT_CONTEXT));
pic->GSort = GS_NONE;
}
@@ -335,7 +335,7 @@ void FreeInterpretContextPr(Common::PROCESS *pProc) {
for (i = 0, pic = g_icList; i < NUM_INTERPRET; i++, pic++) {
if (pic->GSort != GS_NONE && pic->pProc == pProc) {
FreeWaitCheck(pic, false);
- if (TinselV2)
+ if (TinselVersion >= 2)
memset(pic, 0, sizeof(INT_CONTEXT));
pic->GSort = GS_NONE;
break;
@@ -435,7 +435,7 @@ void RegisterGlobals(int num) {
if (g_pGlobals == nullptr) {
g_numGlobals = num;
- g_hMasterScript = !TinselV2 ? 0 :
+ g_hMasterScript = (TinselVersion <= 1) ? 0 :
READ_32(FindChunk(MASTER_SCNHANDLE, CHUNK_MASTER_SCRIPT));
// Allocate RAM for pGlobals and make sure it's allocated
@@ -458,7 +458,7 @@ void RegisterGlobals(int num) {
memset(g_icList, 0, NUM_INTERPRET * sizeof(INT_CONTEXT));
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// read initial values
CdCD(Common::nullContext);
@@ -723,7 +723,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
if (!TinselV0)
ic->sp += tmp2;
LockCode(ic);
- if (TinselV2 && (ic->resumeState == RES_1))
+ if ((TinselVersion >= 2) && (ic->resumeState == RES_1))
ic->resumeState = RES_NOT;
break;
diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp
index 8f9c7d54403..5358a8759c0 100644
--- a/engines/tinsel/pdisplay.cpp
+++ b/engines/tinsel/pdisplay.cpp
@@ -398,7 +398,7 @@ static bool ActorTag(int curX_, int curY_, HotSpotTag *pTag, OBJECT **ppText) {
bool newActor;
char tagBuffer[64];
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Tinsel 2 version
// Get the foremost pointed to actor
int actor = _vm->_actor->FrontTaggedActor();
@@ -515,7 +515,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
for (int i = 0; i < MAX_POLY; i++) {
hp = GetPolyHandle(i);
- if (TinselV2 && (hp == NOPOLY))
+ if ((TinselVersion >= 2) && (hp == NOPOLY))
continue;
// Added code for un-tagged tags
@@ -531,11 +531,11 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
SaveTaggedPoly(hp); // This polygon tagged
}
return true;
- } else if ((TinselV2 && PolyTagIsWanted(hp)) ||
- (!TinselV2 && hp != NOPOLY && PolyTagState(hp) == TAG_ON)) {
+ } else if (((TinselVersion >= 2) && PolyTagIsWanted(hp)) ||
+ ((TinselVersion <= 1) && hp != NOPOLY && PolyTagState(hp) == TAG_ON)) {
// Put up or maintain polygon tag
newPoly = false;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (hp != GetTaggedPoly())
newPoly = true; // Different polygon
} else {
@@ -549,7 +549,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
if (*ppText)
MultiDeleteObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), *ppText);
- if (!TinselV2)
+ if (TinselVersion <= 1)
*pTag = POLY_HOTSPOT_TAG;
SaveTaggedActor(0); // No tagged actor
SaveTaggedPoly(hp); // This polygon tagged
@@ -566,14 +566,14 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
if (strLen == 0)
// No valid string returned, so leave ppText as NULL
ppText = nullptr;
- else if (TinselV2 && !PolyTagFollowsCursor(hp)) {
+ else if ((TinselVersion >= 2) && !PolyTagFollowsCursor(hp)) {
// May have buggered cursor
_vm->_cursor->EndCursorFollowed();
*ppText = ObjectTextOut(_vm->_bg->GetPlayfieldList(FIELD_STATUS),
_vm->_font->TextBufferAddr(), 0, tagx - Loffset, tagy - Toffset,
_vm->_font->GetTagFontHandle(), TXT_CENTER, 0);
- } else if (TinselV2) {
+ } else if (TinselVersion >= 2) {
// Bugger cursor
const char *tagPtr = _vm->_font->TextBufferAddr();
if (tagPtr[0] < ' ' && tagPtr[1] == EOS_CHAR)
@@ -607,7 +607,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
if (shift > _vm->_bg->BgHeight()) // Not off bottom
MultiMoveRelXY(*ppText, 0, _vm->_bg->BgHeight() - shift);
}
- } else if (TinselV2 && (*ppText)) {
+ } else if ((TinselVersion >= 2) && (*ppText)) {
if (!PolyTagFollowsCursor(hp)) {
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &nLoff, &nToff);
if (nLoff != Loffset || nToff != Toffset) {
@@ -623,7 +623,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
curY = tagy;
}
}
- } else if (!TinselV2) {
+ } else if (TinselVersion <= 1) {
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &nLoff, &nToff);
if (nLoff != Loffset || nToff != Toffset) {
MultiMoveRelXY(*ppText, Loffset - nLoff, Toffset - nToff);
@@ -636,7 +636,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
}
// No tagged polygon
- if (TinselV2)
+ if (TinselVersion >= 2)
SaveTaggedPoly(NOPOLY);
else if (*pTag == POLY_HOTSPOT_TAG) {
*pTag = NO_HOTSPOT_TAG;
@@ -677,7 +677,7 @@ void TagProcess(CORO_PARAM, const void *) {
MultiDeleteObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _ctx->pText);
_ctx->pText = nullptr;
- if (TinselV2)
+ if (TinselVersion >= 2)
// May have buggered cursor
_vm->_cursor->EndCursorFollowed();
}
@@ -712,7 +712,7 @@ static void enteringpoly(CORO_PARAM, HPOLYGON hp) {
SetPolyPointState(hp, PS_POINTING);
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, hp, POINTED, 0, false, 0));
else
RunPolyTinselCode(hp, POINTED, PLR_NOEVENT, false);
@@ -731,7 +731,7 @@ static void leavingpoly(CORO_PARAM, HPOLYGON hp) {
SetPolyPointState(hp, PS_NOT_POINTING);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, hp, UNPOINT, 0, false, 0));
SetPolyTagWanted(hp, false, false, 0);
@@ -758,7 +758,7 @@ void PointProcess(CORO_PARAM, const void *) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2)
+ if (TinselVersion >= 2)
EnablePointing();
while (1) {
@@ -776,7 +776,7 @@ void PointProcess(CORO_PARAM, const void *) {
if (!PolyIsPointedTo(_ctx->hPoly)) {
if (IsInPolygon(_ctx->curX, _ctx->curY, _ctx->hPoly)) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
SetPolyPointedTo(_ctx->hPoly, true);
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->hPoly, POINTED, 0, false, 0));
} else {
@@ -785,7 +785,7 @@ void PointProcess(CORO_PARAM, const void *) {
}
} else {
if (!IsInPolygon(_ctx->curX, _ctx->curY, _ctx->hPoly)) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
SetPolyPointedTo(_ctx->hPoly, false);
SetPolyTagWanted(_ctx->hPoly, false, false, 0);
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->hPoly, UNPOINT, 0, false, 0));
@@ -796,7 +796,7 @@ void PointProcess(CORO_PARAM, const void *) {
}
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// For each tagged actor
for (_ctx->i = 0; (_ctx->i = _vm->_actor->NextTaggedActor(_ctx->i)) != 0;) {
if (!_vm->_actor->ActorIsPointedTo(_ctx->i)) {
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index 156ccbc9daa..c6ac94c042f 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -941,7 +941,7 @@ static void PlayProcess(CORO_PARAM, const void *param) {
const PPINIT *ppi = (const PPINIT *)param;
CORO_BEGIN_CODE(_ctx);
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(t2PlayReel, (CORO_SUBCTX, ppi->x, ppi->y, ppi->bRestore, ppi->speed,
ppi->hFilm, ppi->column, ppi->myescEvent, ppi->bTop, ppi->playfield));
else
@@ -960,7 +960,7 @@ void NewestFilm(SCNHANDLE film, const FREEL *reel) {
// Get the MULTI_INIT structure
pmi = (const MULTI_INIT *)_vm->_handle->LockMem(FROM_32(reel->mobj));
- if (!TinselV2 || ((int32)FROM_32(pmi->mulID) != -2))
+ if ((TinselVersion <= 1) || ((int32)FROM_32(pmi->mulID) != -2))
_vm->_actor->SetActorLatestFilm((int32)FROM_32(pmi->mulID), film);
}
@@ -1010,7 +1010,7 @@ void PlayFilm(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool splay
CoroScheduler.createProcess(PID_REEL, PlayProcess, &ppi, sizeof(PPINIT));
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Let it all kick in and position this process
// down the process list from the playing process(es)
// This ensures something
@@ -1042,6 +1042,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla
assert(hFilm != 0); // Trying to play NULL film
const FILM *pFilm;
+ int lowestReel;
pFilm = (const FILM *)_vm->_handle->LockMem(hFilm);
@@ -1065,14 +1066,15 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla
// Start display process for each secondary reel in the film in Tinsel 1,
// or all of them in Tinsel 2
- for (int i = FROM_32(pFilm->numreels) - 1; i >= (TinselV2 ? 0 : 1); i--) {
+ lowestReel = (TinselVersion >= 2) ? 0 : 1;
+ for (int i = FROM_32(pFilm->numreels) - 1; i >= lowestReel; i--) {
NewestFilm(hFilm, &pFilm->reels[i]);
_ctx->ppi.column = i;
CoroScheduler.createProcess(PID_REEL, PlayProcess, &_ctx->ppi, sizeof(PPINIT));
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Let it all kick in and position this 'waiting' process
// down the process list from the playing process(es)
// This ensures immediate return when the reel finishes
@@ -1107,7 +1109,7 @@ void PlayFilmc(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int actorid, bool spla
* NOTE: This is specifically for actors during a Tinsel 1 restore scene.
*/
void RestoreActorReels(SCNHANDLE hFilm, short reelnum, short z, int x, int y) {
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
const FILM *pfilm = (const FILM *)_vm->_handle->LockMem(hFilm);
PPINIT ppi;
@@ -1141,7 +1143,7 @@ void RestoreActorReels(SCNHANDLE hFilm, short reelnum, short z, int x, int y) {
* NOTE: This is specifically for actors during a Tinsel 2 restore scene.
*/
void RestoreActorReels(SCNHANDLE hFilm, int actor, int x, int y) {
- assert(TinselV2);
+ assert(TinselVersion >= 2);
FILM *pFilm = (FILM *)_vm->_handle->LockMem(hFilm);
PPINIT ppi;
diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp
index 8ce5ad84a47..6f9cd0c1d04 100644
--- a/engines/tinsel/polygons.cpp
+++ b/engines/tinsel/polygons.cpp
@@ -237,7 +237,7 @@ void Poly::nextPoly() {
int typeVal = nextLong(_pData);
if ((FROM_32(typeVal) == 6) && TinselV3)
typeVal = TO_32(7);
- if ((FROM_32(typeVal) == 5) && TinselV2)
+ if ((FROM_32(typeVal) == 5) && TinselVersion >= 2)
typeVal = TO_32(6);
type = (POLY_TYPE)typeVal;
@@ -246,7 +246,7 @@ void Poly::nextPoly() {
for (int i = 0; i < 4; ++i)
y[i] = nextLong(_pData);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
xoff = nextLong(_pData);
yoff = nextLong(_pData);
id = nextLong(_pData);
@@ -273,7 +273,7 @@ void Poly::nextPoly() {
vz[2] = nextLong(_pData);
vz[3] = nextLong(_pData);
} else {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
reftype = nextLong(_pData);
}
tagx = nextLong(_pData);
@@ -283,7 +283,7 @@ void Poly::nextPoly() {
nodey = nextLong(_pData);
hFilm = nextLong(_pData);
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
reftype = nextLong(_pData);
id = nextLong(_pData);
}
@@ -291,14 +291,14 @@ void Poly::nextPoly() {
scale1 = nextLong(_pData);
scale2 = nextLong(_pData);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
level1 = nextLong(_pData);
level2 = nextLong(_pData);
bright1 = nextLong(_pData);
}
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
bright2 = nextLong(_pData);
}
@@ -411,7 +411,7 @@ bool IsInPolygon(int xt, int yt, HPOLYGON hp) {
assert(pp != NULL); // Testing whether in a NULL polygon
// Shift cursor for relative polygons
- if (TinselV2) {
+ if (TinselVersion >= 2) {
xt -= volatileStuff[hp].xoff;
yt -= volatileStuff[hp].yoff;
}
@@ -818,7 +818,7 @@ static HPOLYGON PathOnTheWay(HPOLYGON from, HPOLYGON to) {
const POLYGON *p = TryPath(Polys[from], Polys[to], Polys[from]);
- if (TinselV2 && !p)
+ if ((TinselVersion >= 2) && !p)
return NOPOLY;
assert(p != NULL); // Trying to find route between unconnected paths
@@ -1123,8 +1123,8 @@ void GetTagTag(HPOLYGON hp, SCNHANDLE *hTagText, int *tagx, int *tagy) {
Poly ptp(_vm->_handle->LockMem(pHandle), Polys[hp]->pIndex);
- *tagx = (int)FROM_32(ptp.tagx) + (TinselV2 ? volatileStuff[hp].xoff : 0);
- *tagy = (int)FROM_32(ptp.tagy) + (TinselV2 ? volatileStuff[hp].yoff : 0);
+ *tagx = (int)FROM_32(ptp.tagx) + ((TinselVersion >= 2) ? volatileStuff[hp].xoff : 0);
+ *tagy = (int)FROM_32(ptp.tagy) + ((TinselVersion >= 2) ? volatileStuff[hp].yoff : 0);
*hTagText = FROM_32(ptp.hTagtext);
}
@@ -1266,22 +1266,22 @@ void syncPolyInfo(Common::Serializer &s) {
*/
void SaveDeadPolys(bool *sdp) {
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
memcpy(sdp, deadPolys, MAX_POLY*sizeof(bool));
}
void RestoreDeadPolys(bool *sdp) {
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
memcpy(deadPolys, sdp, MAX_POLY*sizeof(bool));
}
void SavePolygonStuff(POLY_VOLATILE *sps) {
- assert(TinselV2);
+ assert(TinselVersion >= 2);
memcpy(sps, volatileStuff, MAX_POLY*sizeof(POLY_VOLATILE));
}
void RestorePolygonStuff(POLY_VOLATILE *sps) {
- assert(TinselV2);
+ assert(TinselVersion >= 2);
memcpy(volatileStuff, sps, MAX_POLY*sizeof(POLY_VOLATILE));
}
@@ -1397,7 +1397,7 @@ static void SetPathAdjacencies() {
continue;
// Must be on the same level
- if (TinselV2 && !MatchingLevels(p1, p2))
+ if ((TinselVersion >= 2) && !MatchingLevels(p1, p2))
continue;
int j = DistinctCorners(i1, i2);
@@ -1863,7 +1863,7 @@ void InitPolygons(SCNHANDLE ph, int numPoly, bool bRestart) {
memset(RoutePaths, 0, sizeof(RoutePaths));
if (!bRestart) {
- if (TinselV2)
+ if (TinselVersion >= 2)
memset(volatileStuff, 0, sizeof(volatileStuff));
else
memset(deadPolys, 0, sizeof(deadPolys));
@@ -1912,7 +1912,7 @@ void InitPolygons(SCNHANDLE ph, int numPoly, bool bRestart) {
}
}
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
SetPathAdjacencies(); // Paths need to know the facts
#ifdef DEBUG
CheckNPathIntegrity();
@@ -2049,7 +2049,7 @@ void GetPolyNode(HPOLYGON hp, int *pNodeX, int *pNodeY) {
Poly ptp(_vm->_handle->LockMem(pHandle), Polys[hp]->pIndex);
// WORKAROUND: Invalid node adjustment for DW2 Cartwheel scene refer polygon
- if (TinselV2 && (pHandle == 0x74191900) && (hp == 8)) {
+ if ((TinselVersion >= 2) && (pHandle == 0x74191900) && (hp == 8)) {
*pNodeX = 480;
*pNodeY = 408;
} else {
@@ -2057,7 +2057,7 @@ void GetPolyNode(HPOLYGON hp, int *pNodeX, int *pNodeY) {
*pNodeY = FROM_32(ptp.nodey);
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
*pNodeX += volatileStuff[hp].xoff;
*pNodeY += volatileStuff[hp].yoff;
}
@@ -2075,7 +2075,7 @@ void SetPolyPointedTo(HPOLYGON hp, bool bPointedTo) {
bool PolyIsPointedTo(HPOLYGON hp) {
CHECK_HP(hp, "Out of range polygon handle (31)");
- if (TinselV2)
+ if (TinselVersion >= 2)
return (Polys[hp]->tagFlags & POINTING);
return PolyPointState(hp) == PS_POINTING;
@@ -2262,14 +2262,14 @@ void EnableTag(CORO_PARAM, int tag) {
Polys[_ctx->i]->polyType = TAG;
volatileStuff[_ctx->i].bDead = false;
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->i, SHOWEVENT, 0, true, 0));
} else if ((_ctx->i = FindPolygon(TAG, tag)) != NOPOLY) {
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->i, SHOWEVENT, 0, true, 0));
}
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
TAGSTATE *pts = &TagStates[SceneTags[currentTScene].offset];
for (int j = 0; j < SceneTags[currentTScene].nooftags; j++, pts++) {
if (pts->tid == tag) {
@@ -2385,14 +2385,14 @@ void DisableTag(CORO_PARAM, int tag) {
volatileStuff[_ctx->i].bDead = true;
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->i, HIDEEVENT, 0, true, 0));
} else if ((_ctx->i = FindPolygon(EX_TAG, tag)) != NOPOLY) {
- if (TinselV2)
+ if (TinselVersion >= 2)
CORO_INVOKE_ARGS(PolygonEvent, (CORO_SUBCTX, _ctx->i, HIDEEVENT, 0, true, 0));
}
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
TAGSTATE *pts = &TagStates[SceneTags[currentTScene].offset];
for (int j = 0; j < SceneTags[currentTScene].nooftags; j++, pts++) {
if (pts->tid == tag) {
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index e4d76bcdff0..c1832ec7e71 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -91,7 +91,7 @@ enum {
SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 4 + 1 + 1 + 2
};
-#define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID)
+#define SAVEGAME_ID ((TinselVersion >= 2) ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID)
enum {
// FIXME: Save file names in ScummVM can be longer than 8.3, overflowing the
@@ -208,7 +208,7 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
s.syncAsUint16LE(hdr.numInterpreters);
} else {
if(_vm) // See comment above about bug #5819
- hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20;
+ hdr.numInterpreters = ((TinselVersion >= 2) ? 70 : 64) - 20;
else
hdr.numInterpreters = 50; // This value doesn't matter since the saved game is being deleted.
}
@@ -243,7 +243,7 @@ static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
s.syncAsUint32LE(sm.talkReels[i][j]);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
s.syncAsByte(sm.bHidden);
s.syncAsSint32LE(sm.brightness);
@@ -316,7 +316,7 @@ static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp)
s.syncAsUint32LE(sd.SavedNoScrollData.NumNoH);
// Tinsel 2 fields
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// SavedNoScrollData
s.syncAsUint32LE(sd.SavedNoScrollData.xTrigger);
s.syncAsUint32LE(sd.SavedNoScrollData.xDistance);
@@ -450,14 +450,15 @@ char *ListEntry(int i, letype which) {
static bool DoSync(Common::Serializer &s, int numInterp) {
int sg = 0;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (s.isSaving())
g_restoreCD = GetCurrentCD();
s.syncAsSint16LE(g_restoreCD);
+
+ if (s.isLoading())
+ _vm->_dialogs->HoldItem(INV_NOICON);
}
- if (TinselV2 && s.isLoading())
- _vm->_dialogs->HoldItem(INV_NOICON);
syncSavedData(s, *g_srsd, numInterp);
syncGlobInfo(s); // Glitter globals
@@ -472,14 +473,14 @@ static bool DoSync(Common::Serializer &s, int numInterp) {
// Not a valid inventory object, so return false
return false;
- if (TinselV2)
+ if (TinselVersion >= 2)
g_thingHeld = sg;
else
_vm->_dialogs->HoldItem(sg);
}
syncTimerInfo(s); // Timer data
- if (!TinselV2)
+ if (TinselVersion <= 1)
syncPolyInfo(s); // Dead polygon data
syncSCdata(s); // Hook Scene and delayed scene
@@ -496,7 +497,7 @@ static bool DoSync(Common::Serializer &s, int numInterp) {
g_ASceneIsSaved = true;
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
_vm->_actor->syncAllActorsAlive(s);
return true;
@@ -680,7 +681,7 @@ void RequestSaveGame(char *name, char *desc, SAVED_DATA *sd, int *pSsCount, SAVE
}
void RequestRestoreGame(int num, SAVED_DATA *sd, int *pSsCount, SAVED_DATA *pSsData) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (num == -1)
return;
else if (num == -2) {
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index 10739e58dbf..d49a2662b61 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -124,7 +124,7 @@ void DoSaveScene(SAVED_DATA *sd) {
sd->SavedNoBlocking = GetNoBlocking();
_vm->_scroll->GetNoScrollData(&sd->SavedNoScrollData);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Tinsel 2 specific data save
_vm->_actor->SaveActorZ(sd->savedActorZ);
_vm->_actor->SaveZpositions(sd->zPositions);
@@ -181,7 +181,7 @@ void FreeSaveScenes() {
* Also 'stand' all the moving actors at their saved positions.
*/
void sortActors(SAVED_DATA *sd) {
- assert(!TinselV2);
+ assert(TinselVersion <= 1);
for (int i = 0; i < sd->NumSavedActors; i++) {
_vm->_actor->ActorsLife(sd->SavedActorInfo[i].actorID, sd->SavedActorInfo[i].bAlive);
@@ -252,9 +252,11 @@ static void SortMAProcess(CORO_PARAM, const void *) {
void ResumeInterprets() {
// Master script only affected on restore game, not restore scene
- if (!TinselV2 && (g_rsd == &g_sgData)) {
- CoroScheduler.killMatchingProcess(PID_MASTER_SCR, -1);
- FreeMasterInterpretContext();
+ if (TinselVersion <= 1) {
+ if (g_rsd == &g_sgData) {
+ CoroScheduler.killMatchingProcess(PID_MASTER_SCR, -1);
+ FreeMasterInterpretContext();
+ }
}
for (int i = 0; i < NUM_INTERPRET; i++) {
@@ -286,7 +288,7 @@ void ResumeInterprets() {
break;
case GS_ACTOR:
- if (TinselV2)
+ if (TinselVersion >= 2)
RestoreProcess(&g_rsd->SavedICInfo[i]);
else
RestoreActorProcess(g_rsd->SavedICInfo[i].idActor, &g_rsd->SavedICInfo[i], g_rsd == &g_sgData);
@@ -318,7 +320,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
_vm->_sound->stopAllSamples();
ClearScreen();
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Master script only affected on restore game, not restore scene
if (sd == &g_sgData) {
@@ -350,7 +352,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
g_bNoFade = false;
_vm->_bg->StartupBackground(Common::nullContext, sd->SavedBgroundHandle);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
Offset(EX_USEXY, sd->SavedLoffset, sd->SavedToffset);
} else {
_vm->_scroll->KillScroll();
@@ -360,7 +362,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
_vm->_scroll->RestoreNoScrollData(&sd->SavedNoScrollData);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// create process to sort out the moving actors
CoroScheduler.createProcess(PID_MOVER, SortMAProcess, NULL, 0);
g_bNotDoneYet = true;
@@ -380,7 +382,7 @@ static int DoRestoreSceneFrame(SAVED_DATA *sd, int n) {
break;
case 1:
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (g_bNotDoneYet)
return n;
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index 9bc7bc4fe1f..b07f11dd35e 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -154,9 +154,9 @@ SCENE_STRUC* parseV3Scene(const byte *pStruc) {
}
const SCENE_STRUC *GetSceneStruc(const byte *pStruc) {
- if (TinselVersion == TINSEL_V2)
+ if (TinselVersion == 2)
return (const SCENE_STRUC *)pStruc;
- else if (TinselVersion == TINSEL_V3)
+ else if (TinselVersion == 3)
return parseV3Scene(pStruc);
// Copy appropriate fields into tempStruc, and return a pointer to it
@@ -201,7 +201,7 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
_ctx->pic = InitInterpretContext(GS_SCENE,
FROM_32(_ctx->pInit->hTinselCode),
- TinselV2 ? _ctx->pInit->event : NOEVENT,
+ (TinselVersion >= 2) ? _ctx->pInit->event : NOEVENT,
NOPOLY, // No polygon
0, // No actor
NULL, // No object
@@ -252,7 +252,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
_vm->_handle->LockMem(g_SceneHandle); // Make sure scene is loaded
_vm->_handle->LockScene(g_SceneHandle); // Prevent current scene from being discarded
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// CdPlay() stuff
byte *cptr = FindChunk(scene, CHUNK_CDPLAY_FILENUM);
assert(cptr);
@@ -267,7 +267,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
ss = GetSceneStruc(FindChunk(scene, CHUNK_SCENE));
assert(ss != NULL);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Music stuff
char *cptr = (char *)FindChunk(scene, CHUNK_MUSIC_FILENAME);
assert(cptr);
@@ -283,7 +283,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
// Initialize the actors for this scene
_vm->_actor->StartTaggedActors(FROM_32(ss->hTaggedActor), FROM_32(ss->numTaggedActor), false);
- if (TinselV2)
+ if (TinselVersion >= 2)
// Returning from cutscene
SendSceneTinselProcess(RESTORE);
@@ -310,7 +310,7 @@ static void LoadScene(SCNHANDLE scene, int entry) {
}
// Move to next entrance
- if (TinselV2)
+ if (TinselVersion >= 2)
++es;
else
es = (const ENTRANCE_STRUC *)((const byte *)es + 8);
@@ -356,7 +356,7 @@ void EndScene() {
FreeAllTokens(); // No-one has tokens
FreeMostInterpretContexts(); // Only master script still interpreting
- if (TinselV2) {
+ if (TinselVersion >= 2) {
SetSysVar(ISV_DIVERT_ACTOR, 0);
SetSysVar(ISV_GHOST_ACTOR, 0);
SetSysVar(SV_MinimumXoffset, 0);
@@ -389,7 +389,7 @@ void PrimeScene() {
SetSysVar(SYS_SceneFxDimFactor, SysVar(SYS_DefaultFxDimFactor));
_vm->_cursor->RestartCursor(); // Restart the cursor
- if (!TinselV2)
+ if (TinselVersion <= 1)
EnableTags(); // Next scene with tags enabled
CoroScheduler.createProcess(PID_SCROLL, ScrollProcess, NULL, 0);
@@ -414,7 +414,7 @@ void PrimeScene() {
void StartNewScene(SCNHANDLE scene, int entry) {
EndScene(); // Wrap up the last scene.
- if (TinselV2) {
+ if (TinselVersion >= 2) {
TouchMoverReels();
_vm->_handle->LockMem(scene); // Do CD change before PrimeScene
diff --git a/engines/tinsel/scene.h b/engines/tinsel/scene.h
index f6476671a44..827f76f0a4a 100644
--- a/engines/tinsel/scene.h
+++ b/engines/tinsel/scene.h
@@ -74,9 +74,9 @@ enum REEL {
typedef enum { TRANS_DEF, TRANS_CUT, TRANS_FADE } TRANSITS;
// amount to shift scene handles by
-#define SCNHANDLE_SHIFT ((TinselV2 && !TinselV2Demo) ? 25 : 23)
-#define OFFSETMASK ((TinselV2 && !TinselV2Demo) ? 0x01ffffffL : 0x007fffffL)
-#define HANDLEMASK ((TinselV2 && !TinselV2Demo) ? 0xFE000000L : 0xFF800000L)
+#define SCNHANDLE_SHIFT (((TinselVersion >= 2) && !TinselV2Demo) ? 25 : 23)
+#define OFFSETMASK (((TinselVersion >= 2) && !TinselV2Demo) ? 0x01ffffffL : 0x007fffffL)
+#define HANDLEMASK (((TinselVersion >= 2) && !TinselV2Demo) ? 0xFE000000L : 0xFF800000L)
void DoHailScene(SCNHANDLE scene);
diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp
index c5a2abff93a..6fd323720c4 100644
--- a/engines/tinsel/scn.cpp
+++ b/engines/tinsel/scn.cpp
@@ -48,7 +48,7 @@ byte *FindChunk(SCNHANDLE handle, uint32 chunk) {
// V0 chunk types can be found by substracting 2 from the
// chunk type. Note that CHUNK_STRING and CHUNK_BITMAP are
// the same in V0 and V1
- if (TinselVersion == TINSEL_V0 &&
+ if (TinselVersion == 0 &&
chunk != CHUNK_STRING && chunk != CHUNK_BITMAP)
chunk -= 0x2L;
diff --git a/engines/tinsel/scroll.cpp b/engines/tinsel/scroll.cpp
index 3961004cfc7..2f218543ae6 100644
--- a/engines/tinsel/scroll.cpp
+++ b/engines/tinsel/scroll.cpp
@@ -44,9 +44,9 @@ namespace Tinsel {
#define SCROLLPIXELS 8 // Number of pixels to scroll per iteration
// Distance from edge that triggers a scroll
-#define RLDISTANCE (TinselV2 ? _scrollData.xTrigger : 50)
-#define UDISTANCE (TinselV2 ? _scrollData.yTriggerTop : 20)
-#define DDISTANCE (TinselV2 ? _scrollData.yTriggerBottom : 20)
+#define RLDISTANCE ((TinselVersion >= 2) ? _scrollData.xTrigger : 50)
+#define UDISTANCE ((TinselVersion >= 2) ? _scrollData.yTriggerTop : 20)
+#define DDISTANCE ((TinselVersion >= 2) ? _scrollData.yTriggerBottom : 20)
// Number of iterations to make
#define RLSCROLL 160 // 20*8 = 160 = half a screen
@@ -149,7 +149,7 @@ void Scroll::NeedScroll(int direction) {
}
if (_leftScroll <= 0) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_scrollPixelsX = _scrollData.xSpeed;
_leftScroll += _scrollData.xDistance;
} else {
@@ -172,7 +172,7 @@ void Scroll::NeedScroll(int direction) {
}
if (_leftScroll >= 0) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_scrollPixelsX = _scrollData.xSpeed;
_leftScroll -= _scrollData.xDistance;
} else {
@@ -196,7 +196,7 @@ void Scroll::NeedScroll(int direction) {
}
if (_downScroll <= 0) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_scrollPixelsY = _scrollData.ySpeed;
_downScroll += _scrollData.yDistance;
} else {
@@ -219,7 +219,7 @@ void Scroll::NeedScroll(int direction) {
}
if (_downScroll >= 0) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_scrollPixelsY = _scrollData.ySpeed;
_downScroll -= _scrollData.yDistance;
} else {
@@ -274,7 +274,7 @@ void Scroll::ScrollImage() {
Loffset = _imageW - SCREEN_WIDTH;// Now at extreme right
/*** New feature to prop up rickety scroll boundaries ***/
- if (TinselV2 && SysVar(SV_MaximumXoffset) && (Loffset > SysVar(SV_MaximumXoffset)))
+ if ((TinselVersion >= 2) && SysVar(SV_MaximumXoffset) && (Loffset > SysVar(SV_MaximumXoffset)))
Loffset = SysVar(SV_MaximumXoffset);
} else if (_leftScroll < 0) {
@@ -288,7 +288,7 @@ void Scroll::ScrollImage() {
Loffset = 0; // Now at extreme left
/*** New feature to prop up rickety scroll boundaries ***/
- if (TinselV2 && SysVar(SV_MinimumXoffset) && (Loffset < SysVar(SV_MinimumXoffset)))
+ if ((TinselVersion >= 2) && SysVar(SV_MinimumXoffset) && (Loffset < SysVar(SV_MinimumXoffset)))
Loffset = SysVar(SV_MinimumXoffset);
}
@@ -307,7 +307,7 @@ void Scroll::ScrollImage() {
Toffset = _imageH - SCREEN_HEIGHT;// Now at extreme bottom
/*** New feature to prop up rickety scroll boundaries ***/
- if (TinselV2 && SysVar(SV_MaximumYoffset) && Toffset > SysVar(SV_MaximumYoffset))
+ if ((TinselVersion >= 2) && SysVar(SV_MaximumYoffset) && Toffset > SysVar(SV_MaximumYoffset))
Toffset = SysVar(SV_MaximumYoffset);
} else if (_downScroll < 0) {
@@ -322,7 +322,7 @@ void Scroll::ScrollImage() {
Toffset = 0; // Now at extreme top
/*** New feature to prop up rickety scroll boundaries ***/
- if (TinselV2 && SysVar(SV_MinimumYoffset) && Toffset < SysVar(SV_MinimumYoffset))
+ if ((TinselVersion >= 2) && SysVar(SV_MinimumYoffset) && Toffset < SysVar(SV_MinimumYoffset))
Toffset = SysVar(SV_MinimumYoffset);
}
@@ -398,7 +398,7 @@ void Scroll::RestoreScrollDefaults() {
*/
void Scroll::DropScroll() {
_scrollData.NumNoH = _scrollData.NumNoV = 0;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
_leftScroll = _downScroll = 0; // No iterations outstanding
_oldx = _oldy = 0;
_scrollPixelsX = _scrollData.xSpeed;
@@ -432,8 +432,8 @@ int Scroll::GetScrollFocus() {
void Scroll::ScrollTo(int x, int y, int xIter, int yIter) {
int Loffset, Toffset; // for background offsets
- _scrollPixelsX = xIter != 0 ? xIter : (TinselV2 ? _scrollData.xSpeed : SCROLLPIXELS);
- _scrollPixelsY = yIter != 0 ? yIter : (TinselV2 ? _scrollData.ySpeed : SCROLLPIXELS);
+ _scrollPixelsX = xIter != 0 ? xIter : ((TinselVersion >= 2) ? _scrollData.xSpeed : SCROLLPIXELS);
+ _scrollPixelsY = yIter != 0 ? yIter : ((TinselVersion >= 2) ? _scrollData.ySpeed : SCROLLPIXELS);
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset); // get background offsets
@@ -491,7 +491,7 @@ void Scroll::InitScroll(int width, int height) {
_imageH = height; // Dimensions
_imageW = width; // of this scene.
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
_leftScroll = _downScroll = 0; // No iterations outstanding
_oldx = _oldy = 0;
_scrollPixelsX = _scrollPixelsY = SCROLLPIXELS;
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index 355869e0d9c..a30c9872aac 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -437,7 +437,7 @@ bool SoundManager::sampleExists(int id) {
* Returns true if a sample is currently playing.
*/
bool SoundManager::sampleIsPlaying() {
- if (!TinselV2)
+ if (TinselVersion <= 1)
return _vm->_mixer->isSoundHandleActive(_channels[kChannelTinsel1].handle);
for (int i = 0; i < kNumChannels; i++)
@@ -451,7 +451,7 @@ bool SoundManager::sampleIsPlaying() {
* Stops any currently playing sample.
*/
void SoundManager::stopAllSamples() {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
_vm->_mixer->stopHandle(_channels[kChannelTinsel1].handle);
return;
}
@@ -463,7 +463,7 @@ void SoundManager::stopAllSamples() {
void SoundManager::stopSpecSample(int id, int sub) {
debugC(DEBUG_DETAILED, kTinselDebugSound, "stopSpecSample(%d, %d)", id, sub);
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
if (_channels[kChannelTinsel1].sampleNum == id)
_vm->_mixer->stopHandle(_channels[kChannelTinsel1].handle);
return;
@@ -476,7 +476,7 @@ void SoundManager::stopSpecSample(int id, int sub) {
}
void SoundManager::setSFXVolumes(uint8 volume) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
return;
for (int i = kChannelSFX; i < kNumChannels; i++)
diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp
index cf8b6ce199b..24588ec637e 100644
--- a/engines/tinsel/strres.cpp
+++ b/engines/tinsel/strres.cpp
@@ -192,7 +192,7 @@ static byte *FindStringBase(int id) {
while (strSkip-- != 0) {
// skip to next string
- if (!TinselV2 || ((*pText & 0x80) == 0)) {
+ if ((TinselVersion <= 1) || ((*pText & 0x80) == 0)) {
// Tinsel 1, or string of length < 128
pText += *pText + 1;
} else if (*pText == 0x80) {
@@ -244,7 +244,7 @@ int LoadStringResource(int id, int sub, char *pBuffer, int bufferMax) {
return 0;
}
- if (!TinselV2 || ((*pText & 0x80) == 0)) {
+ if ((TinselVersion <= 1) || ((*pText & 0x80) == 0)) {
// get length of string
len = *pText;
} else if (*pText == 0x80) {
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index f34fd1026bf..7728e270ff3 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -713,7 +713,7 @@ void CdEndActor(int actor, int myEscape) {
static void CDload(SCNHANDLE start, SCNHANDLE next, int myEscape) {
assert(start && next && start != next); // cdload() fault
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (myEscape && myEscape != GetEscEvents()) {
g_bEscapedCdPlay = true;
return;
@@ -742,7 +742,7 @@ static void CloseInventory() {
* OR Restore cursor and return control to the player.
*/
void Control(int param) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (param)
ControlOn();
else {
@@ -836,7 +836,7 @@ static void Conversation(CORO_PARAM, int fn, HPOLYGON hp, int actor, bool escOn,
// TOP of screen, Default (i.e. TOP of screen), or BOTTOM of screen
// If waiting is enabled, wait for ongoing scroll
- if (TinselV2 && SysVar(SV_CONVERSATIONWAITS))
+ if ((TinselVersion >= 2) && SysVar(SV_CONVERSATIONWAITS))
CORO_INVOKE_1(WaitScroll, myEscape);
// Don't do it if it's not wanted
@@ -849,7 +849,7 @@ static void Conversation(CORO_PARAM, int fn, HPOLYGON hp, int actor, bool escOn,
_vm->_dialogs->KillInventory();
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// If this is from a tag polygon, get the associated
// actor (the one the polygon is named after), if any.
if (!actor) {
@@ -999,7 +999,7 @@ static void DeclareLanguage(int languageId, SCNHANDLE hDescription, SCNHANDLE hF
static void DecLead(uint32 id, SCNHANDLE *rp = 0, SCNHANDLE text = 0) {
MOVER *pMover; // Moving actor structure
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Tinsel 2 only specifies the lead actor Id
_vm->_actor->SetLeadId(id);
RegisterMover(id);
@@ -1444,7 +1444,7 @@ void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (_vm->_bmv->MoviePlaying()) {
_vm->_bmv->AbortMovie();
CORO_SLEEP(2);
@@ -1454,7 +1454,7 @@ void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition) {
SetNewScene(scene, entrance, transition);
// Prevent tags and cursor re-appearing
- if (TinselV2)
+ if (TinselVersion >= 2)
ControlStartOff();
else
GetControl(CONTROL_STARTOFF);
@@ -1495,7 +1495,7 @@ static void ObjectHeld(int object) {
void Offset(EXTREME extreme, int x, int y) {
_vm->_scroll->KillScroll();
- if (TinselV2)
+ if (TinselVersion >= 2)
DecodeExtreme(extreme, &x, &y);
_vm->_bg->PlayfieldSetPos(FIELD_WORLD, x, y);
@@ -1652,7 +1652,7 @@ static void PlayMidi(CORO_PARAM, SCNHANDLE hMidi, int loop, bool complete) {
// In DW1, it messes up the script arguments when entering the secret
// door in the bookshelf in the library, leading to a crash, when the
// music volume is set to 0.
- if (!_vm->_music->MidiPlaying() && TinselV2)
+ if (!_vm->_music->MidiPlaying() && TinselVersion >= 2)
CORO_SLEEP(1);
if (complete) {
@@ -1937,7 +1937,7 @@ static void PrepareScene(SCNHANDLE scene) {
* Print the given text at the given place for the given time.
*/
static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSustain, bool escOn, int myEscape) {
- if (TinselV2)
+ if (TinselVersion >= 2)
escOn = myEscape != 0;
CORO_BEGIN_CONTEXT;
@@ -1960,7 +1960,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
if (escOn && myEscape != GetEscEvents())
return;
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
// Kick off the voice sample
if (_vm->_config->_voiceVolume != 0 && _vm->_sound->sampleExists(text)) {
_vm->_sound->playSample(text, Audio::Mixer::kSpeechSoundType, &_ctx->handle);
@@ -1981,13 +1981,13 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
_ctx->myleftEvent = bSustain ? 0 : GetLeftEvents();
} else {
_ctx->time = time * ONE_SECOND;
- _ctx->myleftEvent = (TinselV2 && !bSustain) ? GetLeftEvents() : 0;
+ _ctx->myleftEvent = ((TinselVersion >= 2) && !bSustain) ? GetLeftEvents() : 0;
if (_vm->_config->isJapanMode())
bJapDoPrintText = true;
}
// Print the text
- if (TinselV2) {
+ if (TinselVersion >= 2) {
int Loffset, Toffset;
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
_ctx->pText = ObjectTextOut(_vm->_bg->GetPlayfieldList(FIELD_STATUS),
@@ -2003,9 +2003,11 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
} else if (bJapDoPrintText || (!_vm->_config->isJapanMode() && (_vm->_config->_useSubtitles || !_ctx->bSample))) {
int Loffset, Toffset; // Screen position
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
+
+ SCNHANDLE fontHandle = (TinselVersion >= 2) ? _vm->_font->GetTagFontHandle() : _vm->_font->GetTalkFontHandle();
_ctx->pText = ObjectTextOut(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _vm->_font->TextBufferAddr(),
0, x - Loffset, y - Toffset,
- TinselV2 ? _vm->_font->GetTagFontHandle() : _vm->_font->GetTalkFontHandle(), TXT_CENTER);
+ fontHandle, TXT_CENTER);
assert(_ctx->pText); // string produced NULL text
if (_vm->_dialogs->IsTopWindow())
MultiSetZPosition(_ctx->pText, Z_TOPW_TEXT);
@@ -2030,7 +2032,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
return;
// Leave it up until time runs out or whatever
- if (TinselV2) {
+ if (TinselVersion >= 2) {
do {
CORO_SLEEP(1);
@@ -2120,7 +2122,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
}
// Don't do it if it's not wanted
- if (TinselV2 && (myEscape) && (myEscape != GetEscEvents()))
+ if ((TinselVersion >= 2) && (myEscape) && (myEscape != GetEscEvents()))
return;
/*
@@ -2137,15 +2139,15 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
if (event != POINTED) {
g_bNotPointedRunning = true; // Get POINTED text to die
CORO_SLEEP(1); // Give it chance to
- } else if (!TinselV2)
+ } else if (TinselVersion <= 1)
g_bNotPointedRunning = false; // There may have been an OFF without an ON
// Make multi-ones escape
- if (TinselV2 && (SubStringCount(hText) > 1) && !_ctx->myEscape)
+ if ((TinselVersion >= 2) && (SubStringCount(hText) > 1) && !_ctx->myEscape)
_ctx->myEscape = GetEscEvents();
// Loop once for Tinsel 1 strings, and for Tinsel 2 however many lines are needed
- for (_ctx->sub = 0; _ctx->sub < (TinselV2 ? SubStringCount(hText) : 1); _ctx->sub++) {
+ for (_ctx->sub = 0; _ctx->sub < ((TinselVersion >= 2) ? SubStringCount(hText) : 1); _ctx->sub++) {
if (_ctx->myEscape && _ctx->myEscape != GetEscEvents())
break;
@@ -2163,7 +2165,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
int xshift;
// Get the text string
- if (TinselV2)
+ if (TinselVersion >= 2)
LoadSubString(hText, _ctx->sub, _vm->_font->TextBufferAddr(), TBUFSZ);
else
LoadStringRes(hText, _vm->_font->TextBufferAddr(), TBUFSZ);
@@ -2174,7 +2176,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
MultiSetZPosition(_ctx->pText, Z_INV_ITEXT);
- if (TinselV2)
+ if (TinselVersion >= 2)
KeepOnScreen(_ctx->pText, &_ctx->textx, &_ctx->texty);
else {
// Don't go off the side of the screen
@@ -2192,7 +2194,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
} else
_ctx->pText = nullptr;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (event == POINTED) {
/*
* PrintObj() called from POINT event
@@ -2430,11 +2432,11 @@ static void PrintObjNonPointed(CORO_PARAM, const SCNHANDLE text, const OBJECT *p
static void PrintTag(HPOLYGON hp, SCNHANDLE text, int actor = 0, bool bCursor = false) {
// printtag() may only be called from a polygon code block in Tinsel 1, or
// additionally from a moving actor code block in Tinsel 2
- assert((hp != NOPOLY) || (TinselV2 && (actor != 0)));
+ assert((hp != NOPOLY) || ((TinselVersion >= 2) && (actor != 0)));
if (hp != NOPOLY) {
// Poly handling
- if (TinselV2)
+ if (TinselVersion >= 2)
SetPolyTagWanted(hp, true, bCursor, text);
else if (PolyTagState(hp) == TAG_OFF) {
SetPolyTagState(hp, TAG_ON);
@@ -2502,7 +2504,7 @@ static void RestoreScene(CORO_PARAM, TRANSITS transition) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (_vm->_bmv->MoviePlaying()) {
_vm->_bmv->AbortMovie();
CORO_SLEEP(2);
@@ -2555,7 +2557,7 @@ void SaveScene(CORO_PARAM) {
CORO_BEGIN_CODE(_ctx);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
CuttingScene(true);
SendSceneTinselProcess(LEAVE_T2);
CORO_GIVE_WAY;
@@ -2600,12 +2602,12 @@ static void ScrollScreen(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter,
_ctx->x = xp;
_ctx->y = yp;
- if ((TinselV2 && g_bInstantScroll) || (escOn && myEscape != GetEscEvents())) {
+ if (((TinselVersion >= 2) && g_bInstantScroll) || (escOn && myEscape != GetEscEvents())) {
// Instant completion!
Offset(extreme, _ctx->x, _ctx->y);
} else {
_ctx->thisScroll = g_scrollNumber;
- if (TinselV2)
+ if (TinselVersion >= 2)
DecodeExtreme(extreme, &_ctx->x, &_ctx->y);
_vm->_scroll->ScrollTo(_ctx->x, _ctx->y, xIter, yIter);
@@ -2628,7 +2630,7 @@ static void ScrollScreen(CORO_PARAM, EXTREME extreme, int xp, int yp, int xIter,
_vm->_bg->PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
} while (Loffset != _ctx->x || Toffset != _ctx->y);
- } else if (TinselV2 && myEscape) {
+ } else if ((TinselVersion >= 2) && myEscape) {
SCROLL_MONITOR sm;
// Scroll is escapable even though we're not waiting for it
@@ -2910,10 +2912,10 @@ void Stand(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm) {
CORO_BEGIN_CODE(_ctx);
_ctx->pMover = GetMover(actor);
- assert(!TinselV2 || (_ctx->pMover != NULL));
+ assert((TinselVersion <= 1) || (_ctx->pMover != NULL));
if (_ctx->pMover) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// New special. If no paths, just ignore this
if (PathCount() == 0)
return;
@@ -2938,23 +2940,23 @@ void Stand(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm) {
// Check hFilm against certain constants. Note that a switch statement isn't
// used here because it would interfere with our co-routine implementation
if (hFilm == TF_UP) {
- if (TinselV2) CORO_GIVE_WAY;
+ if (TinselVersion >= 2) CORO_GIVE_WAY;
SetMoverDirection(_ctx->pMover, AWAY);
SetMoverStanding(_ctx->pMover);
} else if (hFilm == TF_DOWN) {
- if (TinselV2) CORO_GIVE_WAY;
+ if (TinselVersion >= 2) CORO_GIVE_WAY;
SetMoverDirection(_ctx->pMover, FORWARD);
SetMoverStanding(_ctx->pMover);
} else if (hFilm == TF_LEFT) {
- if (TinselV2) CORO_GIVE_WAY;
+ if (TinselVersion >= 2) CORO_GIVE_WAY;
SetMoverDirection(_ctx->pMover, LEFTREEL);
SetMoverStanding(_ctx->pMover);
} else if (hFilm == TF_RIGHT) {
- if (TinselV2) CORO_GIVE_WAY;
+ if (TinselVersion >= 2) CORO_GIVE_WAY;
SetMoverDirection(_ctx->pMover, RIGHTREEL);
SetMoverStanding(_ctx->pMover);
} else if (hFilm != TF_NONE) {
- if (TinselV2) CORO_GIVE_WAY;
+ if (TinselVersion >= 2) CORO_GIVE_WAY;
AlterMover(_ctx->pMover, hFilm, AR_NORMAL);
}
}
@@ -3025,7 +3027,7 @@ static void StandTag(int actor, HPOLYGON hp) {
hFilm = GetPolyFilm(hp);
// other actors can use direction
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (actor != LEAD_ACTOR && actor != _vm->_actor->GetLeadId()
&& hFilm != TF_UP && hFilm != TF_DOWN
&& hFilm != TF_LEFT && hFilm != TF_RIGHT)
@@ -3084,7 +3086,7 @@ static void StopWalk(int actor) {
pMover = GetMover(actor);
assert(pMover);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (MoverHidden(pMover))
return;
@@ -3123,7 +3125,7 @@ static void Swalk(CORO_PARAM, int actor, int x1, int y1, int x2, int y2, SCNHAND
// Don't do it if it's not wanted
if (escOn && myEscape != GetEscEvents()) {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (x2 == -1 && y2 == -1)
CORO_INVOKE_ARGS(Stand, (CORO_SUBCTX, actor, x1, y1, 0));
else
@@ -3136,13 +3138,13 @@ static void Swalk(CORO_PARAM, int actor, int x1, int y1, int x2, int y2, SCNHAND
// For lead actor, lock out the user (if not already locked out)
if (actor == _vm->_actor->GetLeadId() || actor == LEAD_ACTOR) {
_ctx->bTookControl = GetControl(CONTROL_OFFV2);
- if (TinselV2 && _ctx->bTookControl)
+ if ((TinselVersion >= 2) && _ctx->bTookControl)
_vm->_cursor->RestoreMainCursor();
} else {
_ctx->bTookControl = false;
}
- if (TinselV2 && (x2 == -1) && (y2 == -1)) {
+ if ((TinselVersion >= 2) && (x2 == -1) && (y2 == -1)) {
// First co-ordinates are the destination
x2 = x1;
y2 = y1;
@@ -3163,7 +3165,7 @@ static void Swalk(CORO_PARAM, int actor, int x1, int y1, int x2, int y2, SCNHAND
CORO_INVOKE_ARGS(Stand, (CORO_SUBCTX, actor, x1, y1, 0));
}
- if (TinselV2 && (zOverride != -1)) {
+ if ((TinselVersion >= 2) && (zOverride != -1)) {
MOVER *pMover = GetMover(actor);
assert(pMover);
@@ -3274,7 +3276,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
_ctx->pText = nullptr;
// If waiting is enabled, wait for ongoing scroll
- if (TinselV2 && SysVar(SV_SPEECHWAITS))
+ if ((TinselVersion >= 2) && SysVar(SV_SPEECHWAITS))
CORO_INVOKE_1(WaitScroll, myEscape);
// Don't do it if it's not wanted
@@ -3284,10 +3286,10 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
_ctx->myLeftEvent = GetLeftEvents();
// If this actor is dead, call a stop to the calling process
- if (!TinselV2 && (actorId && !_vm->_actor->actorAlive(actorId)))
+ if ((TinselVersion <= 1) && (actorId && !_vm->_actor->actorAlive(actorId)))
CORO_KILL_SELF();
- if (!TinselV2 || (speechType == IS_TALK)) {
+ if ((TinselVersion <= 1) || (speechType == IS_TALK)) {
/*
* Find out which actor is talking
* and with which direction if no film supplied
@@ -3309,20 +3311,20 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
break;
}
assert(_ctx->actor);
- } else if (TinselV2)
+ } else if (TinselVersion >= 2)
_ctx->actor = actorId;
/*
* Lock out the user (for lead actor, if not already locked out)
* May need to disable tags for other actors
*/
- if (_ctx->actor == _vm->_actor->GetLeadId() || (TinselV2 && (_ctx->actor == LEAD_ACTOR)))
+ if (_ctx->actor == _vm->_actor->GetLeadId() || ((TinselVersion >= 2) && (_ctx->actor == LEAD_ACTOR)))
_ctx->bTookControl = GetControl(CONTROL_OFF);
else
_ctx->bTookControl = false;
_ctx->bTookTags = DisableTagsIfEnabled();
- if (TinselV2) {
+ if (TinselVersion >= 2) {
/*
* Divert stuff
*/
@@ -3339,7 +3341,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
* Kick off the voice sample
*/
if (_vm->_config->_voiceVolume != 0 && _vm->_sound->sampleExists(hText)) {
- if (!TinselV2) {
+ if (TinselVersion <= 1) {
_vm->_sound->playSample(hText, Audio::Mixer::kSpeechSoundType, &_ctx->handle);
_ctx->bSamples = _vm->_mixer->isSoundHandleActive(_ctx->handle);
} else
@@ -3376,7 +3378,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
TALKING, 0, false, 0));
}
- if (TinselV2)
+ if (TinselVersion >= 2)
// Let it all kick in and position this 'waiting' process
// down the process list from the playing process(es)
// This ensures immediate return when the reel finishes
@@ -3384,11 +3386,11 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
}
// Make multi-ones escape
- if (TinselV2 && (SubStringCount(hText) > 1) && !_ctx->escEvents)
+ if ((TinselVersion >= 2) && (SubStringCount(hText) > 1) && !_ctx->escEvents)
_ctx->escEvents = GetEscEvents();
- for (_ctx->sub = 0; _ctx->sub < (TinselV2 ? SubStringCount(hText) : 1); _ctx->sub++) {
- if (TinselV2 && _ctx->escEvents && _ctx->escEvents != GetEscEvents())
+ for (_ctx->sub = 0; _ctx->sub < ((TinselVersion >= 2) ? SubStringCount(hText) : 1); _ctx->sub++) {
+ if ((TinselVersion >= 2) && _ctx->escEvents && _ctx->escEvents != GetEscEvents())
break;
/*
@@ -3412,7 +3414,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
if (!TinselV0 && !TinselV3) {
SetTextPal(_vm->_actor->GetActorRGB(_ctx->actor));
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
LoadSubString(hText, _ctx->sub, _vm->_font->TextBufferAddr(), TBUFSZ);
} else {
LoadStringRes(hText, _vm->_font->TextBufferAddr(), TBUFSZ);
@@ -3438,7 +3440,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
* Set bottom of text just above the speaker's head
* But don't go off the top of the screen
*/
- if (TinselV2)
+ if (TinselVersion >= 2)
MultiMoveRelXY(_ctx->pText, 0, _ctx->y - _ctx->Toffset - MultiLowest(_ctx->pText) - 2);
else {
yshift = _ctx->y - MultiLowest(_ctx->pText) - 2; // Just above head
@@ -3459,7 +3461,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
}
}
- if (TinselV2)
+ if (TinselVersion >= 2)
// Don't go off the screen
KeepOnScreen(_ctx->pText, &_ctx->x, &_ctx->y);
@@ -3470,7 +3472,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
_ctx->ticks = TextTime(_vm->_font->TextBufferAddr());
}
- if (TinselV2 && _ctx->bSample) {
+ if ((TinselVersion >= 2) && _ctx->bSample) {
// Kick off the sample now (perhaps with a delay)
if (g_bNoPause)
g_bNoPause = false;
@@ -3499,7 +3501,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
CORO_SLEEP(1);
// Handle timeout decrementing and Escape presses
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if ((_ctx->escEvents && _ctx->escEvents != GetEscEvents()) ||
(!bSustain && LeftEventChange(_ctx->myLeftEvent)) ||
(--_ctx->timeout <= 0)) {
@@ -3527,7 +3529,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
break;
} else {
// Talk reel stops at end of speech
- if (!TinselV2 || (_ctx->bTalkReel && (_ctx->sub == SubStringCount(hText) - 1))) {
+ if ((TinselVersion <= 1) || (_ctx->bTalkReel && (_ctx->sub == SubStringCount(hText) - 1))) {
CORO_INVOKE_2(FinishTalkingReel, _ctx->pActor, _ctx->actor);
_ctx->bTalkReel = false;
}
@@ -3549,7 +3551,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
MultiDeleteObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _ctx->pText);
_ctx->pText = nullptr;
}
- if (TinselV2 && _ctx->bSample)
+ if ((TinselVersion >= 2) && _ctx->bSample)
_vm->_sound->stopSpecSample(hText, _ctx->sub);
}
@@ -3563,7 +3565,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
if (_ctx->pText != NULL)
MultiDeleteObject(_vm->_bg->GetPlayfieldList(FIELD_STATUS), _ctx->pText);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if ((_ctx->whatSort == IS_SAY) || (_ctx->whatSort == IS_SAYAT)) {
_vm->_actor->SetActorTalking(_ctx->actor, false);
if (_vm->_actor->IsTaggedActor(_ctx->actor))
@@ -3583,7 +3585,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
* And, finally, release the talk token.
*/
if (_ctx->bTookControl) {
- if (TinselV2) ControlOn(); else Control(CONTROL_ON);
+ if (TinselVersion >= 2) ControlOn(); else Control(CONTROL_ON);
}
if (_ctx->bTookTags)
EnableTags();
@@ -3723,7 +3725,7 @@ static void TopPlay(CORO_PARAM, SCNHANDLE hFilm, int x, int y, bool bComplete, i
* Open or close the 'top window'
*/
static void TopWindow(int bpos) {
- bool isStart = (TinselV2 && (bpos != 0)) || (!TinselV2 && (bpos == TW_START));
+ bool isStart = ((TinselVersion >= 2) && (bpos != 0)) || ((TinselVersion <= 1) && (bpos == TW_START));
_vm->_dialogs->KillInventory();
@@ -3910,13 +3912,13 @@ void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool i
// Straight there if escaped
if (escOn && myescEvent != GetEscEvents()) {
- if (TinselV2)
+ if (TinselVersion >= 2)
StopMover(pMover);
CORO_INVOKE_ARGS(Stand, (CORO_SUBCTX, actor, x, y, 0));
return;
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (MoverHidden(pMover))
return;
@@ -3928,7 +3930,7 @@ void Walk(CORO_PARAM, int actor, int x, int y, SCNHANDLE hFilm, int hold, bool i
assert(pMover->hCpath != NOPOLY); // moving actor not in path
// Croak if he is doing an SWalk()
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Croak if he is doing an SWalk()
if (MoverIsSWalking(pMover))
CORO_KILL_SELF();
@@ -4002,7 +4004,7 @@ static void Walked(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, bool esc
return;
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (MoverHidden(pMover) || !MoverIs(pMover)) {
retVal = false;
return;
@@ -4053,7 +4055,7 @@ static void Walked(CORO_PARAM, int actor, int x, int y, SCNHANDLE film, bool esc
static void WalkingActor(uint32 id, SCNHANDLE *rp = NULL) {
MOVER *pActor; // Moving actor structure
- if (TinselVersion == TINSEL_V2) {
+ if (TinselVersion == 2) {
RegisterMover(id);
return;
}
@@ -4104,7 +4106,7 @@ static void WalkPoly(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool es
return;
}
- if (TinselV2) {
+ if (TinselVersion >= 2) {
if (MoverHidden(pMover))
return;
@@ -4126,17 +4128,17 @@ static void WalkPoly(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool es
if (escOn && myEscape != GetEscEvents()) {
// Straight there if escaped
StandTag(actor, hp);
- if (!TinselV2)
+ if (TinselVersion <= 1)
FreeToken(pMover->actorToken);
return;
}
// Die if superceded
- if (TinselV2 && (_ctx->thisWalk != GetWalkNumber(pMover)))
+ if ((TinselVersion >= 2) && (_ctx->thisWalk != GetWalkNumber(pMover)))
CORO_KILL_SELF();
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
FreeToken(pMover->actorToken);
CORO_END_CODE;
@@ -4166,7 +4168,7 @@ static void WalkTag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool esc
return;
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
GetToken(pMover->actorToken);
else {
if (MoverHidden(pMover))
@@ -4182,7 +4184,7 @@ static void WalkTag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool esc
if (escOn && myEscape != GetEscEvents()) {
// Straight there if escaped
StandTag(actor, hp);
- if (!TinselV2)
+ if (TinselVersion <= 1)
FreeToken(pMover->actorToken);
return;
}
@@ -4190,7 +4192,7 @@ static void WalkTag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool esc
CORO_SLEEP(1);
// Die if superceded
- if (TinselV2 && (_ctx->thisWalk != GetWalkNumber(pMover)))
+ if ((TinselVersion >= 2) && (_ctx->thisWalk != GetWalkNumber(pMover)))
CORO_KILL_SELF();
}
@@ -4226,7 +4228,7 @@ static void WalkTag(CORO_PARAM, int actor, SCNHANDLE film, HPOLYGON hp, bool esc
break;
}
- if (!TinselV2)
+ if (TinselVersion <= 1)
FreeToken(pMover->actorToken);
CORO_END_CODE;
@@ -5282,7 +5284,7 @@ NoirMapping translateNoirLibCode(int libCode, int32 *pp) {
int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pic, RESUME_STATE *pResumeState) {
int libCode;
if (TinselV0) libCode = DW1DEMO_CODES[operand];
- else if (!TinselV2) libCode = DW1_CODES[operand];
+ else if (TinselVersion <= 1) libCode = DW1_CODES[operand];
else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
else if (TinselV3) {
NoirMapping mapping = translateNoirLibCode(operand, pp);
@@ -5395,7 +5397,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case ADDOPENINV:
// Common to both DW1 & DW2
- AddInv(TinselV2 ? DW2_INV_OPEN : INV_OPEN, pp[0]);
+ AddInv((TinselVersion >= 2) ? DW2_INV_OPEN : INV_OPEN, pp[0]);
return -1;
case ADDTOPIC:
@@ -5604,7 +5606,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case DECFLAGS:
// Common to both DW1 & DW2
- if (TinselV2)
+ if (TinselVersion >= 2)
error("DecFlags() is obsolete");
DecFlags(pp[0]);
@@ -5641,7 +5643,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case DECLEAD:
// Common to DW1 / DW2 / Noir
- if (TinselV2) {
+ if (TinselVersion >= 2) {
DecLead(pp[0]);
return -1;
} else {
@@ -5727,7 +5729,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case EVENT:
// Common to DW1 / DW2 / Noir
- if (TinselVersion == TINSEL_V2 || TinselVersion == TINSEL_V3)
+ if (TinselVersion >= 2)
pp[0] = pic->event;
else
pp[0] = TINSEL1_EVENT_MAP[pic->event];
@@ -5809,7 +5811,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case HIDEACTOR:
// Common to DW1 / DW2 / Noir
- if (!TinselV2)
+ if (TinselVersion <= 1)
HideActorFn(coroParam, pp[0]);
else if (*pResumeState == RES_1 && pic->resumeCode == RES_WAITING) {
*pResumeState = RES_NOT;
@@ -5908,7 +5910,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case KILLACTOR:
// DW1 only
- if (TinselV2)
+ if (TinselVersion >= 2)
error("KillActor() was not expected to be required");
KillActor(pp[0]);
@@ -5993,7 +5995,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case OFFSET:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 2; // 2 parameters
Offset((EXTREME)pp[0], pp[1], pp[2]);
return -3;
@@ -6029,7 +6031,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
Play(coroParam, pp[-1], -1, -1, pp[0], pic->myEscape, false, pic->event, pic->hPoly, pic->idActor);
return -2;
- } if (TinselV2) {
+ } if (TinselVersion >= 2) {
pp -= 3; // 4 parameters
if (*pResumeState == RES_1 && _vm->_handle->IsCdPlayHandle(pp[0]))
*pResumeState = RES_NOT;
@@ -6074,7 +6076,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case PLAYSAMPLE:
// Common to DW1 / DW2 / Noir
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 3; // 4 parameters
PlaySample(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape);
return -4;
@@ -6132,7 +6134,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case PRINT:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 4; // 5 parameters
Print(coroParam, pp[0], pp[1], pp[2], pp[3], pp[4] != 0, pic->escOn, pic->myEscape);
return -5;
@@ -6155,7 +6157,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case PRINTTAG:
// Common to DW1 / DW2 / Noir
- PrintTag(pic->hPoly, pp[0], TinselV2 ? pic->idActor : 0, false);
+ PrintTag(pic->hPoly, pp[0], (TinselVersion >= 2) ? pic->idActor : 0, false);
return -1;
case QUITGAME:
@@ -6181,7 +6183,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case RESTORESCENE:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
RestoreScene(coroParam, (TRANSITS)pp[0]);
return -1;
} else {
@@ -6257,7 +6259,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case SCROLL:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 5; // 6 parameters
ScrollScreen(coroParam, (EXTREME)pp[0], pp[1], pp[2], pp[3], pp[4], pp[5], pic->escOn, pic->myEscape);
return -6;
@@ -6334,7 +6336,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case SETPALETTE:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Note: Although DW2 introduces parameters for start and length, it doesn't use them
pp -= 2;
SetPalette(pp[0], pic->escOn, pic->myEscape);
@@ -6498,7 +6500,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case STOPSAMPLE:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
StopSample(pp[0]);
return -1;
} else {
@@ -6550,7 +6552,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
// Common to both DW1 & DW2
pp -= 1; // 2 parameters
- if (TinselV2)
+ if (TinselVersion >= 2)
TalkOrSay(coroParam, IS_TALK, pp[1], 0, 0, pp[0], 0, false, pic->escOn, pic->myEscape);
else if (pic->event == WALKIN || pic->event == WALKOUT)
TalkOrSay(coroParam, IS_TALK, pp[1], 0, 0, pp[0], 0, false, pic->escOn, pic->myEscape);
@@ -6560,7 +6562,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case TALKAT:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 4; // 5 parameters
TalkOrSay(coroParam, IS_TALKAT, pp[3], pp[1], pp[2], 0, pp[0], pp[4], pic->escOn, pic->myEscape);
return -5;
@@ -6629,7 +6631,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case TOPPLAY:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 3; // 4 parameters
TopPlay(coroParam, pp[0], pp[1], pp[2], pp[3], pic->myEscape, pic->event);
return -4;
@@ -6722,7 +6724,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case WALKINGACTOR:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// DW2 doesn't use a second parameter to WalkingActor
WalkingActor(pp[0]);
return -1;
@@ -6734,7 +6736,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case WALKPOLY:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 1; // 2 parameters
WalkPoly(coroParam, pp[0], pp[1], pic->hPoly, pic->escOn, pic->myEscape);
return -2;
@@ -6746,7 +6748,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case WALKTAG:
// Common to both DW1 & DW2
- if (TinselV2) {
+ if (TinselVersion >= 2) {
pp -= 1; // 2 parameters
WalkTag(coroParam, pp[0], pp[1], pic->hPoly, pic->escOn, pic->myEscape);
return -2;
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 53310a1fc61..83be5c6ad1b 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -238,8 +238,10 @@ void KeyboardProcess(CORO_PARAM, const void *) {
continue;
case Common::KEYCODE_m:
// Debug facility - scene hopper
- if (TinselV2 && (evt.kbd.hasFlags(Common::KBD_ALT)))
+ if (TinselVersion >= 2) {
+ if (evt.kbd.hasFlags(Common::KBD_ALT))
ProcessKeyEvent(PLR_JUMP);
+ }
break;
case Common::KEYCODE_q:
if ((evt.kbd.hasFlags(Common::KBD_CTRL)) || (evt.kbd.hasFlags(Common::KBD_ALT)))
@@ -337,7 +339,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
if (DwGetCurrentTime() - _ctx->lastLeftClick < (uint32)_vm->_config->_dclickSpeed) {
// Left button double-click
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Kill off the button process and fire off the action command
CoroScheduler.killMatchingProcess(PID_BTN_CLICK, -1);
PlayerEvent(PLR_ACTION, _ctx->clickPos);
@@ -354,7 +356,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
// Initial mouse down - either for a single click, or potentially
// the start of a double-click action
- if (TinselV2) {
+ if (TinselVersion >= 2) {
PlayerEvent(PLR_DRAG1_START, mousePos);
ProvNotProcessed();
@@ -381,14 +383,16 @@ static void MouseProcess(CORO_PARAM, const void *) {
// If player control is enabled, start a process which, if it times out,
// will activate a single button click
- if (TinselV2 && ControlIsOn()) {
- _ctx->clickPos = mousePos;
- CoroScheduler.createProcess(PID_BTN_CLICK, SingleLeftProcess, &_ctx->clickPos, sizeof(Common::Point));
+ if (TinselVersion >= 2) {
+ if (ControlIsOn()) {
+ _ctx->clickPos = mousePos;
+ CoroScheduler.createProcess(PID_BTN_CLICK, SingleLeftProcess, &_ctx->clickPos, sizeof(Common::Point));
+ }
}
} else
_ctx->lastLeftClick -= _vm->_config->_dclickSpeed;
- if (TinselV2)
+ if (TinselVersion >= 2)
// Signal left drag end
PlayerEvent(PLR_DRAG1_END, mousePos);
else
@@ -401,7 +405,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
if (DwGetCurrentTime() - _ctx->lastRightClick < (uint32)_vm->_config->_dclickSpeed) {
// Right button double-click
- if (TinselV2) {
+ if (TinselVersion >= 2) {
PlayerEvent(PLR_NOEVENT, _ctx->clickPos);
} else {
// signal right drag start
@@ -413,7 +417,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
_ctx->lastRWasDouble = true;
} else {
- if (TinselV2) {
+ if (TinselVersion >= 2) {
PlayerEvent(PLR_DRAG2_START, mousePos);
PlayerEvent(PLR_LOOK, mousePos);
} else {
@@ -437,7 +441,7 @@ static void MouseProcess(CORO_PARAM, const void *) {
else
_ctx->lastRightClick -= _vm->_config->_dclickSpeed;
- if (TinselV2)
+ if (TinselVersion >= 2)
// Signal left drag end
PlayerEvent(PLR_DRAG2_END, mousePos);
else
@@ -480,7 +484,7 @@ static void MasterScriptProcess(CORO_PARAM, const void *) {
* Store the facts pertaining to a scene change.
*/
void SetNewScene(SCNHANDLE scene, int entrance, int transition) {
- if (!g_bCuttingScene && TinselV2)
+ if (!g_bCuttingScene && TinselVersion >= 2)
WrapScene();
// If we're loading from the GMM, load the scene as a delayed one
@@ -625,7 +629,7 @@ static void RestoredProcess(CORO_PARAM, const void *param) {
_ctx->pic = *((INT_CONTEXT * const *)param);
_ctx->pic = RestoreInterpretContext(_ctx->pic);
- _ctx->bConverse = TinselV2 && (_ctx->pic->event == CONVERSE);
+ _ctx->bConverse = (TinselVersion >= 2) && (_ctx->pic->event == CONVERSE);
CORO_INVOKE_1(Interpret, _ctx->pic);
@@ -676,12 +680,12 @@ bool ChangeScene(bool bReset) {
// Trigger pre-load and fade and start countdown
CountOut = COUNTOUT_COUNT;
FadeOutFast();
- if (TinselV2)
+ if (TinselVersion >= 2)
_vm->_pcmMusic->startFadeOut(COUNTOUT_COUNT);
break;
}
} else if (--CountOut == 0) {
- if (!TinselV2)
+ if (TinselVersion <= 1)
ClearScreen();
StartNewScene(g_NextScene.scene, g_NextScene.entry);
@@ -760,7 +764,7 @@ GameChunk createGameChunkV2() {
cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_TOTAL_POLY);
chunk.numPolygons = (cptr != NULL) ? READ_32(cptr) : 0;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_NUM_PROCESSES);
assert(cptr && (*cptr < 100));
chunk.numProcesses = *cptr;
@@ -813,7 +817,7 @@ void LoadBasicChunks() {
if (game.numPolygons != 0)
MaxPolygons(game.numPolygons);
- if (TinselV2) {
+ if (TinselVersion >= 2) {
// Global processes
cptr = FindChunk(MASTER_SCNHANDLE, CHUNK_PROCESSES);
assert(!game.numProcesses || cptr);
@@ -1185,7 +1189,9 @@ bool TinselEngine::pollEvent() {
{
// This fragment takes care of Tinsel 2 when it's been compiled with
// blank areas at the top and bottom of the screen
- int ySkip = TinselV2 ? (g_system->getHeight() - _vm->screen().h) / 2 : 0;
+ int ySkip = 0;
+ if (TinselVersion >= 2)
+ ySkip = (g_system->getHeight() - _vm->screen().h) / 2;
if ((event.mouse.y >= ySkip) && (event.mouse.y < (g_system->getHeight() - ySkip)))
_mousePos = Common::Point(event.mouse.x, event.mouse.y - ySkip);
}
@@ -1339,7 +1345,7 @@ void TinselEngine::ProcessKeyEvent(const Common::Event &event) {
const char *TinselEngine::getSampleIndex(LANGUAGE lang) {
int cd;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
cd = GetCurrentCD();
assert((cd == 1) || (cd == 2));
assert(((unsigned int) lang) < NUM_LANGUAGES);
@@ -1360,7 +1366,7 @@ const char *TinselEngine::getSampleIndex(LANGUAGE lang) {
const char *TinselEngine::getSampleFile(LANGUAGE lang) {
int cd;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
cd = GetCurrentCD();
assert((cd == 1) || (cd == 2));
assert(((unsigned int) lang) < NUM_LANGUAGES);
@@ -1383,7 +1389,7 @@ const char *TinselEngine::getTextFile(LANGUAGE lang) {
int cd;
- if (TinselV2) {
+ if (TinselVersion >= 2) {
cd = GetCurrentCD();
assert((cd == 1) || (cd == 2));
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index d0358bc6297..0cb9d643211 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -99,14 +99,13 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define GAME_FRAME_DELAY (1000 / ONE_SECOND)
#define TinselVersion (_vm->getVersion())
-#define TinselV0 (TinselVersion == TINSEL_V0)
-#define TinselV1 (TinselVersion == TINSEL_V1)
-#define TinselV2 (TinselVersion == TINSEL_V2 || TinselVersion == TINSEL_V3)
-#define TinselV3 (TinselVersion == TINSEL_V3)
-#define TinselV2Demo (TinselVersion == TINSEL_V2 && _vm->getIsADGFDemo())
-#define TinselV1PSX (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformPSX)
-#define TinselV1Mac (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformMacintosh)
-#define TinselV1Saturn (TinselVersion == TINSEL_V1 && _vm->getPlatform() == Common::kPlatformSaturn)
+#define TinselV0 (TinselVersion == 0)
+#define TinselV1 (TinselVersion == 1)
+#define TinselV3 (TinselVersion == 3)
+#define TinselV2Demo (TinselVersion == 2 && _vm->getIsADGFDemo())
+#define TinselV1PSX (TinselVersion == 1 && _vm->getPlatform() == Common::kPlatformPSX)
+#define TinselV1Mac (TinselVersion == 1 && _vm->getPlatform() == Common::kPlatformMacintosh)
+#define TinselV1Saturn (TinselVersion == 1 && _vm->getPlatform() == Common::kPlatformSaturn)
#define READ_16(v) (TinselV1Mac || TinselV1Saturn ? READ_BE_UINT16(v) : READ_LE_UINT16(v))
#define READ_32(v) (TinselV1Mac || TinselV1Saturn ? READ_BE_UINT32(v) : READ_LE_UINT32(v))
@@ -213,7 +212,7 @@ public:
pt.x = CLIP<int16>(pt.x, 0, SCREEN_WIDTH - 1);
pt.y = CLIP<int16>(pt.y, 0, SCREEN_HEIGHT - 1);
- int yOffset = TinselV2 ? (g_system->getHeight() - _screenSurface.h) / 2 : 0;
+ int yOffset = (TinselVersion >= 2) ? (g_system->getHeight() - _screenSurface.h) / 2 : 0;
g_system->warpMouse(pt.x, pt.y + yOffset);
_mousePos = pt;
}
Commit: 7fc64992642b7b9fbb8fdd23eafd6ac4586c9b9c
https://github.com/scummvm/scummvm/commit/7fc64992642b7b9fbb8fdd23eafd6ac4586c9b9c
Author: Jakob Wagner (wobakj at web.de)
Date: 2022-04-21T20:34:17+03:00
Commit Message:
TINSEL: Replace TinselV0 checks with comparisons
Changed paths:
engines/tinsel/bg.cpp
engines/tinsel/dialogs.cpp
engines/tinsel/dw.h
engines/tinsel/font.cpp
engines/tinsel/graphics.cpp
engines/tinsel/music.cpp
engines/tinsel/pcode.cpp
engines/tinsel/play.cpp
engines/tinsel/polygons.cpp
engines/tinsel/scn.cpp
engines/tinsel/sound.cpp
engines/tinsel/strres.cpp
engines/tinsel/tinlib.cpp
engines/tinsel/tinsel.h
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index e15dfe5ff64..d50f63194bb 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -185,7 +185,7 @@ void Background::StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
// Start display process for each reel in the film
CoroScheduler.createProcess(PID_REEL, BGmainProcess, &pfilm->reels[0], sizeof(FREEL));
- if (TinselV0) {
+ if (TinselVersion == 0) {
for (uint i = 1; i < FROM_32(pfilm->numreels); ++i)
CoroScheduler.createProcess(PID_REEL, BGotherProcess, &pfilm->reels[i], sizeof(FREEL));
}
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 15f93b7dbac..59241d82d43 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -3475,7 +3475,7 @@ void Dialogs::OpenMenu(CONFTYPE menuType) {
int curX, curY;
// In the DW 1 demo, don't allow any menu to be opened
- if (TinselV0)
+ if (TinselVersion == 0)
return;
if (_inventoryState != IDLE_INV)
@@ -5040,7 +5040,7 @@ void Dialogs::RegisterIcons(void *cptr, int num) {
_numObjects = num;
_invObjects = (INV_OBJECT *)cptr;
- if (TinselV0) {
+ if (TinselVersion == 0) {
// In Tinsel 0, the INV_OBJECT structure doesn't have an attributes field, so we
// need to 'unpack' the source structures into the standard Tinsel v1/v2 format
MEM_NODE *node = MemoryAllocFixed(_numObjects * sizeof(INV_OBJECT));
diff --git a/engines/tinsel/dw.h b/engines/tinsel/dw.h
index 7d895a44665..aa735e2126c 100644
--- a/engines/tinsel/dw.h
+++ b/engines/tinsel/dw.h
@@ -53,7 +53,7 @@ typedef int HPOLYGON;
#define MAX_INT (~MIN_INT)
// inventory object handle (if there are inventory objects)
-#define INV_OBJ_SCNHANDLE (TinselV0 ? (2 << SCNHANDLE_SHIFT) : (1 << SCNHANDLE_SHIFT))
+#define INV_OBJ_SCNHANDLE ((TinselVersion == 0) ? (2 << SCNHANDLE_SHIFT) : (1 << SCNHANDLE_SHIFT))
#define FIELD_WORLD (TinselV3 ? 2 : 0)
#define FIELD_STATUS (TinselV3 ? 8 : 1)
diff --git a/engines/tinsel/font.cpp b/engines/tinsel/font.cpp
index 3785151f1a3..c675d464b46 100644
--- a/engines/tinsel/font.cpp
+++ b/engines/tinsel/font.cpp
@@ -31,7 +31,7 @@ namespace Tinsel {
void Font::SetTagFontHandle(SCNHANDLE hFont) {
_hTagFont = _hRegularTagFont = hFont;
- if (TinselV0)
+ if (TinselVersion == 0)
SetTalkFontHandle(hFont); // Also re-use for talk text
}
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 634e6cdb342..2ea946b61a4 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -1175,14 +1175,14 @@ void DrawObject(DRAWOBJECT *pObj) {
MacDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41);
else if (TinselV1)
WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x41);
- else if (TinselV0)
+ else if (TinselVersion == 0)
t0WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x41);
break;
case 0x08: // draw background without clipping
case 0x48: // draw background with clipping
if (TinselV3)
t3WrtAll(pObj, srcPtr, destPtr);
- else if ((TinselVersion == 2) || TinselV1Mac || TinselV0)
+ else if ((TinselVersion == 2) || TinselV1Mac || (TinselVersion == 0))
WrtAll(pObj, srcPtr, destPtr, typeId == 0x48);
else if (TinselV1PSX || TinselV1Saturn)
psxSaturnDrawTiles(pObj, srcPtr, destPtr, typeId == 0x48, psxFourBitClut, psxSkipBytes, psxMapperTable, false);
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index ce5290d86cc..081fdee0803 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -268,7 +268,7 @@ void Music::SetMidiVolume(int vol) {
void Music::OpenMidiFiles() {
Common::File midiStream;
- if (TinselV0) {
+ if (TinselVersion == 0) {
// The early demo version of DW1 doesn't have MIDI
} else if (TinselVersion >= 2) {
// DW2 uses a different music mechanism
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index acf31ced3d9..f61acef31a6 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -553,7 +553,7 @@ static int32 GetBytes(const byte *scriptCode, const WorkaroundEntry* &wkEntry, i
switch (numBytes) {
case 0:
// Instruction byte
- tmp = code[ip++ * (TinselV0 ? 4 : 1)];
+ tmp = code[ip++ * ((TinselVersion == 0) ? 4 : 1)];
break;
case 1:
// Fetch and sign extend a 8 bit value to 32 bits.
@@ -565,7 +565,7 @@ static int32 GetBytes(const byte *scriptCode, const WorkaroundEntry* &wkEntry, i
ip += 2;
break;
default:
- if (TinselV0)
+ if (TinselVersion == 0)
tmp = (int32)READ_LE_UINT32(code + ip++ * 4);
else {
tmp = (int32)READ_LE_UINT32(code + ip);
@@ -582,7 +582,7 @@ static int32 GetBytes(const byte *scriptCode, const WorkaroundEntry* &wkEntry, i
* stream and advance the instruction pointer accordingly.
*/
static int32 Fetch(byte opcode, const byte *code, const WorkaroundEntry* &wkEntry, int &ip) {
- if (TinselV0)
+ if (TinselVersion == 0)
// Fetch a 32 bit value.
return GetBytes(code, wkEntry, ip, 4);
else if (opcode & OPSIZE8)
@@ -622,7 +622,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
}
byte opcode = (byte)GetBytes(ic->code, wkEntry, ip, 0);
- if (TinselV0 && ((opcode & OPMASK) > OP_IMM))
+ if ((TinselVersion == 0) && ((opcode & OPMASK) > OP_IMM))
opcode += 3;
if (TinselV3) {
@@ -720,7 +720,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
tmp2 = CallLibraryRoutine(coroParam, tmp, &ic->stack[ic->sp], ic, &ic->resumeState);
if (coroParam)
return;
- if (!TinselV0)
+ if (TinselVersion != 0)
ic->sp += tmp2;
LockCode(ic);
if ((TinselVersion >= 2) && (ic->resumeState == RES_1))
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index c6ac94c042f..0a15df15558 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -457,7 +457,7 @@ static void t1PlayReel(CORO_PARAM, const PPINIT *ppi) {
_ctx->reelActor = (int32)FROM_32(pmi->mulID);
/**** New (experimental? bit 5/1/95 ****/
- if (!TinselV0 && !_vm->_actor->actorAlive(_ctx->reelActor))
+ if ((TinselVersion != 0) && !_vm->_actor->actorAlive(_ctx->reelActor))
return;
/**** Delete a bit down there if this stays ****/
diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp
index 6f9cd0c1d04..5b86d9e4590 100644
--- a/engines/tinsel/polygons.cpp
+++ b/engines/tinsel/polygons.cpp
@@ -312,7 +312,7 @@ void Poly::nextPoly() {
nlistx = (const int32 *)(_pStart + (int)FROM_32(pnodelistx));
nlisty = (const int32 *)(_pStart + (int)FROM_32(pnodelisty));
- if (TinselV0)
+ if (TinselVersion == 0)
// Skip to the last 4 bytes of the record for the hScript value
_pData = pRecord + 0x62C;
diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp
index 6fd323720c4..056b8b15d9d 100644
--- a/engines/tinsel/scn.cpp
+++ b/engines/tinsel/scn.cpp
@@ -41,7 +41,7 @@ byte *FindChunk(SCNHANDLE handle, uint32 chunk) {
uint32 add;
// Initial adjustmnet for Tinsel 1 chunk types
- if ((TinselV0 || TinselV1) && (chunk >= CHUNK_SCENE) &&
+ if (((TinselVersion == 0) || TinselV1) && (chunk >= CHUNK_SCENE) &&
(chunk != CHUNK_MBSTRING))
--chunk;
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index a30c9872aac..a5d2a8d56c6 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -497,7 +497,7 @@ void SoundManager::showSoundError(const char *errorMsg, const char *soundFile) {
*/
void SoundManager::openSampleFiles() {
// V1 Floppy and V0 demo versions have no sample files
- if (TinselV0 || (TinselV1 && !_vm->isV1CD()))
+ if ((TinselVersion == 0) || (TinselV1 && !_vm->isV1CD()))
return;
TinselFile f(TinselV1Saturn);
diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp
index 24588ec637e..3a42327cff7 100644
--- a/engines/tinsel/strres.cpp
+++ b/engines/tinsel/strres.cpp
@@ -156,7 +156,7 @@ static byte *FindStringBase(int id) {
byte *pText = g_textBuffer;
// For Tinsel 0, Ids are decremented by 1
- if (TinselV0)
+ if (TinselVersion == 0)
--id;
// index into text resource file
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index 7728e270ff3..d8ba5769d9c 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -3411,7 +3411,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
if ((_ctx->whatSort == IS_SAY) || (_ctx->whatSort == IS_TALK))
_vm->_actor->GetActorMidTop(_ctx->actor, &_ctx->x, &_ctx->y);
- if (!TinselV0 && !TinselV3) {
+ if ((TinselVersion != 0) && !TinselV3) {
SetTextPal(_vm->_actor->GetActorRGB(_ctx->actor));
}
if (TinselVersion >= 2) {
@@ -5283,7 +5283,7 @@ NoirMapping translateNoirLibCode(int libCode, int32 *pp) {
*/
int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pic, RESUME_STATE *pResumeState) {
int libCode;
- if (TinselV0) libCode = DW1DEMO_CODES[operand];
+ if (TinselVersion == 0) libCode = DW1DEMO_CODES[operand];
else if (TinselVersion <= 1) libCode = DW1_CODES[operand];
else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
else if (TinselV3) {
@@ -5329,7 +5329,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case ACTORREF:
// Common to both DW1 & DW2
- if (!TinselV0)
+ if (TinselVersion != 0)
error("actorref isn't a real function");
return 0;
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 0cb9d643211..796a07e7705 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -99,7 +99,6 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define GAME_FRAME_DELAY (1000 / ONE_SECOND)
#define TinselVersion (_vm->getVersion())
-#define TinselV0 (TinselVersion == 0)
#define TinselV1 (TinselVersion == 1)
#define TinselV3 (TinselVersion == 3)
#define TinselV2Demo (TinselVersion == 2 && _vm->getIsADGFDemo())
Commit: 6b1dec78790963b2bc1cd3e49d436bfef7cab46b
https://github.com/scummvm/scummvm/commit/6b1dec78790963b2bc1cd3e49d436bfef7cab46b
Author: Jakob Wagner (wobakj at web.de)
Date: 2022-04-21T20:34:17+03:00
Commit Message:
TINSEL: Replace TinselV1 checks with comparisons
Changed paths:
engines/tinsel/actors.cpp
engines/tinsel/graphics.cpp
engines/tinsel/pcode.cpp
engines/tinsel/scene.cpp
engines/tinsel/scn.cpp
engines/tinsel/sound.cpp
engines/tinsel/tinlib.cpp
engines/tinsel/tinsel.h
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index 9a2b4fb52eb..d7c00f9c016 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -1542,7 +1542,7 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
// This is needed particularly for the Psychiatrist scene in Discworld 1 - otherwise Rincewind
// can't go upstairs without leaving the building and returning. If this patch causes problems
// in other scenes, an added check for the hCode == 1174490602 could be added.
- if (isSavegame && TinselV1)
+ if (isSavegame && (TinselVersion == 1))
_ctx->pic->resumeState = RES_NOT;
CORO_INVOKE_1(Interpret, _ctx->pic);
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 2ea946b61a4..4f161ccb8a9 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -1173,7 +1173,7 @@ void DrawObject(DRAWOBJECT *pObj) {
psxSaturnDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41, psxFourBitClut, psxSkipBytes, psxMapperTable, true);
else if (TinselV1Mac)
MacDrawTiles(pObj, srcPtr, destPtr, typeId == 0x41);
- else if (TinselV1)
+ else if (TinselVersion == 1)
WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x41);
else if (TinselVersion == 0)
t0WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x41);
@@ -1186,7 +1186,7 @@ void DrawObject(DRAWOBJECT *pObj) {
WrtAll(pObj, srcPtr, destPtr, typeId == 0x48);
else if (TinselV1PSX || TinselV1Saturn)
psxSaturnDrawTiles(pObj, srcPtr, destPtr, typeId == 0x48, psxFourBitClut, psxSkipBytes, psxMapperTable, false);
- else if (TinselV1)
+ else if (TinselVersion == 1)
WrtNonZero(pObj, srcPtr, destPtr, typeId == 0x48);
break;
case 0x04: // fill with constant color without clipping
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index f61acef31a6..54faa223d58 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -611,7 +611,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
(wkEntry->ip == ip) &&
(wkEntry->isDemo == _vm->getIsADGFDemo()) &&
((wkEntry->platform == Common::kPlatformUnknown) || (wkEntry->platform == _vm->getPlatform())) &&
- (!TinselV1 || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) {
+ ((TinselVersion != 1) || (wkEntry->scnFlag == ((_vm->getFeatures() & GF_SCNFILES) != 0)))) {
// Point to start of workaround fragment
ip = 0;
break;
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index b07f11dd35e..7efeaaea08a 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -190,9 +190,9 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) {
CORO_BEGIN_CODE(_ctx);
// The following myEscape value setting is used for enabling title screen skipping in DW1
- if (TinselV1 && (g_sceneCtr == 1)) g_initialMyEscape = GetEscEvents();
+ if ((TinselVersion == 1) && (g_sceneCtr == 1)) g_initialMyEscape = GetEscEvents();
// DW1 PSX, Saturn and Mac has its own scene skipping script code for scenes 2 and 3 (bug #6094).
- _ctx->myEscape = (TinselV1 && (g_sceneCtr < ((TinselV1PSX || TinselV1Saturn || TinselV1Mac) ? 2 : 4))) ? g_initialMyEscape : 0;
+ _ctx->myEscape = ((TinselVersion == 1) && (g_sceneCtr < ((TinselV1PSX || TinselV1Saturn || TinselV1Mac) ? 2 : 4))) ? g_initialMyEscape : 0;
// get the stuff copied to process when it was created
_ctx->pInit = (const TP_INIT *)param;
diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp
index 056b8b15d9d..5b23ca4548f 100644
--- a/engines/tinsel/scn.cpp
+++ b/engines/tinsel/scn.cpp
@@ -41,7 +41,7 @@ byte *FindChunk(SCNHANDLE handle, uint32 chunk) {
uint32 add;
// Initial adjustmnet for Tinsel 1 chunk types
- if (((TinselVersion == 0) || TinselV1) && (chunk >= CHUNK_SCENE) &&
+ if ((TinselVersion <= 1) && (chunk >= CHUNK_SCENE) &&
(chunk != CHUNK_MBSTRING))
--chunk;
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index a5d2a8d56c6..d90ce01a462 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -497,7 +497,7 @@ void SoundManager::showSoundError(const char *errorMsg, const char *soundFile) {
*/
void SoundManager::openSampleFiles() {
// V1 Floppy and V0 demo versions have no sample files
- if ((TinselVersion == 0) || (TinselV1 && !_vm->isV1CD()))
+ if ((TinselVersion == 0) || ((TinselVersion == 1) && !_vm->isV1CD()))
return;
TinselFile f(TinselV1Saturn);
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index d8ba5769d9c..daff22d8671 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -1459,7 +1459,7 @@ void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition) {
else
GetControl(CONTROL_STARTOFF);
- if (TinselV1)
+ if (TinselVersion == 1)
++g_sceneCtr;
// Prevent code subsequent to this call running before scene changes
@@ -3811,7 +3811,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) {
for (;;) {
_ctx->startEvent = getUserEvents();
- if (TinselV1) {
+ if (TinselVersion == 1) {
// Store cursor position
while (!_vm->_cursor->GetCursorXYNoWait(&_ctx->startX, &_ctx->startY, false))
CORO_SLEEP(1);
@@ -3821,7 +3821,7 @@ static void WaitKey(CORO_PARAM, bool escOn, int myEscape) {
CORO_SLEEP(1);
// Not necessary to monitor escape as it's an event anyway
- if (TinselV1) {
+ if (TinselVersion == 1) {
int curX, curY;
_vm->_cursor->GetCursorXY(&curX, &curY, false); // Store cursor position
if (curX != _ctx->startX || curY != _ctx->startY)
@@ -5284,7 +5284,7 @@ NoirMapping translateNoirLibCode(int libCode, int32 *pp) {
int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pic, RESUME_STATE *pResumeState) {
int libCode;
if (TinselVersion == 0) libCode = DW1DEMO_CODES[operand];
- else if (TinselVersion <= 1) libCode = DW1_CODES[operand];
+ else if (TinselVersion == 1) libCode = DW1_CODES[operand];
else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
else if (TinselV3) {
NoirMapping mapping = translateNoirLibCode(operand, pp);
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 796a07e7705..3b50aa4712f 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -99,7 +99,6 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define GAME_FRAME_DELAY (1000 / ONE_SECOND)
#define TinselVersion (_vm->getVersion())
-#define TinselV1 (TinselVersion == 1)
#define TinselV3 (TinselVersion == 3)
#define TinselV2Demo (TinselVersion == 2 && _vm->getIsADGFDemo())
#define TinselV1PSX (TinselVersion == 1 && _vm->getPlatform() == Common::kPlatformPSX)
Commit: 165ec9cbaeb3d9de0293dc6f723be4df8d94820f
https://github.com/scummvm/scummvm/commit/165ec9cbaeb3d9de0293dc6f723be4df8d94820f
Author: Jakob Wagner (wobakj at web.de)
Date: 2022-04-21T20:34:17+03:00
Commit Message:
TINSEL: Replace TinselV3 checks with comparisons
Changed paths:
engines/tinsel/actors.cpp
engines/tinsel/background.cpp
engines/tinsel/bg.cpp
engines/tinsel/bmv.cpp
engines/tinsel/bmv.h
engines/tinsel/cliprect.cpp
engines/tinsel/cursor.cpp
engines/tinsel/dw.h
engines/tinsel/graphics.cpp
engines/tinsel/graphics.h
engines/tinsel/handle.cpp
engines/tinsel/movers.cpp
engines/tinsel/music.cpp
engines/tinsel/object.cpp
engines/tinsel/object.h
engines/tinsel/pcode.cpp
engines/tinsel/play.cpp
engines/tinsel/polygons.cpp
engines/tinsel/sound.cpp
engines/tinsel/text.cpp
engines/tinsel/tinlib.cpp
engines/tinsel/tinsel.cpp
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index d7c00f9c016..04d9728b5a9 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -608,7 +608,7 @@ void Actor::GetActorMidTop(int ano, int *x, int *y) {
if (pActor) {
GetMoverMidTop(pActor, x, y);
- } else if (TinselV3) {
+ } else if (TinselVersion == 3) {
int i;
for (i = 0; i < MAX_REELS; i++) {
if (_actorInfo[ano-1].presObjs[i] && MultiHasShape(_actorInfo[ano-1].presObjs[i])) {
diff --git a/engines/tinsel/background.cpp b/engines/tinsel/background.cpp
index 262e97a8bc6..d647af4b24b 100644
--- a/engines/tinsel/background.cpp
+++ b/engines/tinsel/background.cpp
@@ -54,7 +54,7 @@ void Background::InitBackground() {
_pCurBgnd->bAutoErase = false;
int numPlayFields = 2;
- if (TinselV3) {
+ if (TinselVersion == 3) {
numPlayFields = 9;
}
for (int i = 0; i < numPlayFields; ++i) {
@@ -237,7 +237,7 @@ void Background::DrawBackgnd() {
}
}
- if (!TinselV3) {
+ if (TinselVersion != 3) {
// transfer any new palettes to the video DAC
PalettesToVideoDAC();
}
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index d50f63194bb..d3af752cf70 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -167,7 +167,7 @@ void Background::StartupBackground(CORO_PARAM, SCNHANDLE hFilm) {
const FILM *pfilm = (const FILM *)_vm->_handle->LockMem(hFilm);
const FREEL *pfr = &pfilm->reels[0];
- if (!TinselV3) {
+ if (TinselVersion != 3) {
const MULTI_INIT *pmi = (const MULTI_INIT *)_vm->_handle->LockMem(FROM_32(pfr->mobj));
const FRAME *pFrame = (const FRAME *)_vm->_handle->LockMem(FROM_32(pmi->hMulFrame));
const IMAGE *pim = _vm->_handle->GetImage(READ_32(pFrame));
diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp
index 8bd805a02ec..8cb7f006308 100644
--- a/engines/tinsel/bmv.cpp
+++ b/engines/tinsel/bmv.cpp
@@ -111,7 +111,7 @@ static const uint16 Au_DecTable[16] = {16512, 8256, 4128, 2064, 1032, 516, 258,
//---------------- DECOMPRESSOR FUNCTIONS --------------------
#define SCREEN_WIDE 640
-#define SCREEN_HIGH (TinselV3 ? 432 : 429)
+#define SCREEN_HIGH ((TinselVersion == 3) ? 432 : 429)
#define SAM_P_BLOB (32 * 2)
#define ROR(x,v) x = ((x >> (v%32)) | (x << (32 - (v%32))))
@@ -541,7 +541,7 @@ void BMVPlayer::ReadHeader() {
}
void BMVPlayer::InitBMV(byte *memoryBuffer) {
- if (TinselV3) {
+ if (TinselVersion == 3) {
// Clear the whole buffer
memset(memoryBuffer, 0, SCREEN_WIDE * (SCREEN_HIGH + 2) * bpp);
// Reset the pallete as it might be partially updated
@@ -945,7 +945,7 @@ void BMVPlayer::InitializeBMV() {
if (!stream.open(szMovieFile))
error(CANNOT_FIND_FILE, szMovieFile);
- if (TinselV3) {
+ if (TinselVersion == 3) {
ReadHeader();
} else {
bpp = 1;
@@ -992,7 +992,7 @@ void BMVPlayer::InitializeBMV() {
// Prefetch data
LoadSlots(prefetchSlots);
- if (!TinselV3) {
+ if (TinselVersion != 3) {
while (numAdvancePackets < ADVANCE_SOUND) {
LoadSlots(1);
}
@@ -1185,7 +1185,7 @@ bool BMVPlayer::DoBMVFrame() {
graphOffset = nextUseOffset + 4; // Skip command byte and length
if (*data & CD_AUDIO) {
- if (TinselV3) {
+ if (TinselVersion == 3) {
int audioSize = audioMaxSize;
if (*data & CD_EXTEND) {
audioSize -= audioBlobSize;
@@ -1218,7 +1218,7 @@ bool BMVPlayer::DoBMVFrame() {
}
if (*data & CD_CMAP) {
- if (!TinselV3) { // TinselV3 has palette embeded in the video frame
+ if (TinselVersion != 3) { // TinselV3 has palette embeded in the video frame
MoviePalette(graphOffset);
}
graphOffset += sz_CMAP_pkt; // Skip palette data
@@ -1234,7 +1234,7 @@ bool BMVPlayer::DoBMVFrame() {
else
xscr = 0;
- if (TinselV3) {
+ if (TinselVersion == 3) {
if (length > 0) {
t3PrepBMV(bigBuffer + graphOffset, length, xscr);
currentFrame++;
@@ -1339,7 +1339,7 @@ void BMVPlayer::CopyMovieToScreen() {
return;
}
- if (TinselV3) {
+ if (TinselVersion == 3) {
// Videos in Tinsel V3 are using 432 lines
memcpy(_vm->screen().getPixels(), ScreenBeg, SCREEN_WIDTH * SCREEN_HIGH * bpp);
} else {
@@ -1384,7 +1384,7 @@ void BMVPlayer::FettleBMV() {
InitializeBMV();
- if (TinselV3) {
+ if (TinselVersion == 3) {
startTick = -1;
} else {
for (i = 0; i < ADVANCE_SOUND;) {
@@ -1411,7 +1411,7 @@ void BMVPlayer::FettleBMV() {
FettleMovieText();
- if ((!TinselV3) && (bigProblemCount < PT_A)) {
+ if ((TinselVersion != 3) && (bigProblemCount < PT_A)) {
refFrame = currentSoundFrame;
while (currentSoundFrame < ((tick+1-startTick)/frameTime + ADVANCE_SOUND) && bMovieOn) {
@@ -1423,7 +1423,7 @@ void BMVPlayer::FettleBMV() {
}
// Time to process a frame (or maybe more)
- if ((!TinselV3) && (bigProblemCount < PT_A)) {
+ if ((TinselVersion != 3) && (bigProblemCount < PT_A)) {
refFrame = currentFrame;
while ((currentFrame < (tick-startTick)/frameTime) && bMovieOn) {
@@ -1465,7 +1465,7 @@ bool BMVPlayer::MoviePlaying() {
* Returns the audio lag in ms
*/
int32 BMVPlayer::MovieAudioLag() {
- if (!bMovieOn || !_audioStream || TinselV3)
+ if (!bMovieOn || !_audioStream || (TinselVersion == 3))
return 0;
// Calculate lag
diff --git a/engines/tinsel/bmv.h b/engines/tinsel/bmv.h
index 28e4fcb5fc9..982f80ef577 100644
--- a/engines/tinsel/bmv.h
+++ b/engines/tinsel/bmv.h
@@ -93,7 +93,7 @@ class BMVPlayer {
bool bFileEnd;
/// Palette
- COLORREF moviePal[256 * 8]; // TinselV1 & V2 need 256, TinselV3 needs 2048
+ COLORREF moviePal[256 * 8]; // TinselV1 & V2 need 256, TinselVersion == 3 needs 2048
int blobsInBuffer;
diff --git a/engines/tinsel/cliprect.cpp b/engines/tinsel/cliprect.cpp
index bc6a7983dc5..9d32cb57eaf 100644
--- a/engines/tinsel/cliprect.cpp
+++ b/engines/tinsel/cliprect.cpp
@@ -296,7 +296,7 @@ void UpdateClipRect(OBJECT **pObjList, Common::Point *pWin, Common::Rect *pClip)
currentObj.height = pObj->height;
currentObj.xPos = (short)x;
currentObj.yPos = (short)y;
- if (!TinselV3) {
+ if (TinselVersion != 3) {
currentObj.pPal = pObj->pPal;
} else {
currentObj.isRLE = pObj->isRLE;
diff --git a/engines/tinsel/cursor.cpp b/engines/tinsel/cursor.cpp
index 7a0ef70b749..e7d71759a90 100644
--- a/engines/tinsel/cursor.cpp
+++ b/engines/tinsel/cursor.cpp
@@ -428,7 +428,7 @@ void Cursor::InitCurObj() {
const FREEL *pfr = (const FREEL *)&pFilm->reels[0];
const MULTI_INIT *pmi = (MULTI_INIT *)_vm->_handle->LockMem(FROM_32(pfr->mobj));
- if (!TinselV3) {
+ if (TinselVersion != 3) {
PokeInPalette(pmi);
}
diff --git a/engines/tinsel/dw.h b/engines/tinsel/dw.h
index aa735e2126c..fbe5fdf404b 100644
--- a/engines/tinsel/dw.h
+++ b/engines/tinsel/dw.h
@@ -55,8 +55,8 @@ typedef int HPOLYGON;
// inventory object handle (if there are inventory objects)
#define INV_OBJ_SCNHANDLE ((TinselVersion == 0) ? (2 << SCNHANDLE_SHIFT) : (1 << SCNHANDLE_SHIFT))
-#define FIELD_WORLD (TinselV3 ? 2 : 0)
-#define FIELD_STATUS (TinselV3 ? 8 : 1)
+#define FIELD_WORLD ((TinselVersion == 3) ? 2 : 0)
+#define FIELD_STATUS ((TinselVersion == 3) ? 8 : 1)
#define ZSHIFT 10
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 4f161ccb8a9..220da291f39 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -1073,7 +1073,7 @@ void DrawObject(DRAWOBJECT *pObj) {
return;
// If writing constant data, don't bother locking the data pointer and reading src details
- if (((pObj->flags & DMA_CONST) == 0) || (TinselV3 && ((pObj->flags & 0x05) == 0x05))) {
+ if (((pObj->flags & DMA_CONST) == 0) || ((TinselVersion == 3) && ((pObj->flags & 0x05) == 0x05))) {
if (TinselVersion >= 2) {
srcPtr = (byte *)_vm->_handle->LockMem(pObj->hBits);
pObj->charBase = nullptr;
@@ -1165,7 +1165,7 @@ void DrawObject(DRAWOBJECT *pObj) {
case 0x51: // TinselV2 and above, draw sprite with clipping, flipped horizontally
assert((TinselVersion >= 2) || (typeId == 0x01 || typeId == 0x41));
- if (TinselV3)
+ if (TinselVersion == 3)
t3WrtNonZero(pObj, srcPtr, destPtr);
else if (TinselVersion >= 2)
t2WrtNonZero(pObj, srcPtr, destPtr, (typeId & DMA_CLIP) != 0, (typeId & DMA_FLIPH) != 0);
@@ -1180,7 +1180,7 @@ void DrawObject(DRAWOBJECT *pObj) {
break;
case 0x08: // draw background without clipping
case 0x48: // draw background with clipping
- if (TinselV3)
+ if (TinselVersion == 3)
t3WrtAll(pObj, srcPtr, destPtr);
else if ((TinselVersion == 2) || TinselV1Mac || (TinselVersion == 0))
WrtAll(pObj, srcPtr, destPtr, typeId == 0x48);
@@ -1195,7 +1195,7 @@ void DrawObject(DRAWOBJECT *pObj) {
break;
case 0x81: // TinselV3, draw sprite with transparency
case 0xC1: // TinselV3, draw sprite with transparency & clipping
- if (TinselV3)
+ if (TinselVersion == 3)
t3TransWNZ(pObj, srcPtr, destPtr);
else if (TinselVersion == 2)
t2WrtNonZero(pObj, srcPtr, destPtr, (typeId & DMA_CLIP) != 0, (typeId & DMA_FLIPH) != 0);
@@ -1206,7 +1206,7 @@ void DrawObject(DRAWOBJECT *pObj) {
break;
case 0x05: // TinselV3, draw text with color replacement without clipping
case 0x45: // TinselV3, draw text with color replacement with clipping
- assert(TinselV3);
+ assert(TinselVersion == 3);
t3WrtText(pObj, srcPtr, destPtr);
break;
default:
diff --git a/engines/tinsel/graphics.h b/engines/tinsel/graphics.h
index 1378822442c..0d0ccaa22a1 100644
--- a/engines/tinsel/graphics.h
+++ b/engines/tinsel/graphics.h
@@ -40,7 +40,7 @@ struct DRAWOBJECT {
int transOffset; // transparent character offset
int flags; // object flags - see above for list
PALQ *pPal; // objects palette Q position
- short isRLE; // TinselV3, if image is using run-length encoding
+ short isRLE; // TinselVersion == 3, if image is using run-length encoding
short colorFlags; // TinselV3, type of color blending
int constant; // which color in palette for monochrome objects
int width; // width of object
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index e9a6a1acae3..4815eb499b5 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -60,9 +60,9 @@ enum {
fCompressed = 0x10000000L, ///< compressed data
fLoaded = 0x20000000L ///< set when file data has been loaded
};
-#define FSIZE_MASK (TinselV3 ? 0xFFFFFFFFL : 0x00FFFFFFL) //!< mask to isolate the filesize
-#define MEMFLAGS(x) (TinselV3 ? x->flags2 : x->filesize)
-#define MEMFLAGSET(x, mask) (TinselV3 ? x->flags2 |= mask : x->filesize |= mask)
+#define FSIZE_MASK ((TinselVersion == 3) ? 0xFFFFFFFFL : 0x00FFFFFFL) //!< mask to isolate the filesize
+#define MEMFLAGS(x) ((TinselVersion == 3) ? x->flags2 : x->filesize)
+#define MEMFLAGSET(x, mask) ((TinselVersion == 3) ? x->flags2 |= mask : x->filesize |= mask)
Handle::Handle() : _handleTable(0), _numHandles(0), _cdPlayHandle((uint32)-1), _cdBaseHandle(0), _cdTopHandle(0), _cdGraphStream(nullptr) {
}
@@ -258,7 +258,7 @@ void Handle::LoadFile(MEMHANDLE *pH) {
memcpy(szFilename, pH->szName, sizeof(pH->szName));
szFilename[sizeof(pH->szName)] = 0;
- if (!TinselV3 && MEMFLAGS(pH) & fCompressed) {
+ if ((TinselVersion != 3) && MEMFLAGS(pH) & fCompressed) {
error("Compression handling has been removed - %s", szFilename);
}
@@ -273,7 +273,7 @@ void Handle::LoadFile(MEMHANDLE *pH) {
// make sure address is valid
assert(addr);
- if (TinselV3 && MEMFLAGS(pH) & fCompressed) {
+ if ((TinselVersion == 3) && MEMFLAGS(pH) & fCompressed) {
bytes = decompressLZSS(f, addr);
} else {
bytes = f.read(addr, pH->filesize & FSIZE_MASK);
@@ -309,7 +309,7 @@ void Handle::LoadFile(MEMHANDLE *pH) {
FONT *Handle::GetFont(SCNHANDLE offset) {
byte *data = LockMem(offset);
const bool isBE = TinselV1Mac || TinselV1Saturn;
- const uint32 size = (TinselV3 ? 12 * 4 : 11 * 4) + 300 * 4; // FONT struct size
+ const uint32 size = ((TinselVersion == 3) ? 12 * 4 : 11 * 4) + 300 * 4; // FONT struct size
Common::MemoryReadStreamEndian *stream = new Common::MemoryReadStreamEndian(data, size, isBE);
FONT *font = new FONT();
@@ -318,7 +318,7 @@ FONT *Handle::GetFont(SCNHANDLE offset) {
font->xShadow = stream->readSint32();
font->yShadow = stream->readSint32();
font->spaceSize = stream->readSint32();
- font->baseColor = TinselV3 ? stream->readSint32() : 0;
+ font->baseColor = (TinselVersion == 3) ? stream->readSint32() : 0;
font->fontInit.hObjImg = stream->readUint32();
font->fontInit.objFlags = stream->readSint32();
font->fontInit.objID = stream->readSint32();
@@ -383,7 +383,7 @@ const IMAGE *Handle::GetImage(SCNHANDLE offset) {
img->anioffY = stream->readSint16();
img->hImgBits = stream->readUint32();
- if (!TinselV3) {
+ if (TinselVersion != 3) {
img->hImgPal = stream->readUint32();
} else {
img->isRLE = stream->readSint16();
diff --git a/engines/tinsel/movers.cpp b/engines/tinsel/movers.cpp
index 2dcd393d9c8..07feba4fb01 100644
--- a/engines/tinsel/movers.cpp
+++ b/engines/tinsel/movers.cpp
@@ -624,7 +624,7 @@ void SetMoverDirection(MOVER *pMover, DIRECTION dirn) {
* Get actor to adopt its appropriate standing reel.
*/
void SetMoverStanding(MOVER *pMover) {
- if (TinselV3) {
+ if (TinselVersion == 3) {
warning("TODO: Finish implementation of GetMoverStanding() for Noir");
return;
}
@@ -710,7 +710,7 @@ static void InitialPathChecks(MOVER *pMover, int xpos, int ypos) {
z = GetScale(FirstPathPoly(), pMover->objY);
}
- if (TinselV3) {
+ if (TinselVersion == 3) {
warning("TODO: Finish implementation of InitialPathChecks() for Noir");
} else {
SetMoverWalkReel(pMover, FORWARD, z, false);
@@ -916,7 +916,7 @@ void MoverProcessCreate(int X, int Y, int id, MOVER *pMover) {
iStruct.Y = Y;
iStruct.pMover = pMover;
- CoroScheduler.createProcess(PID_MOVER, TinselV3 ? T3MoverProcess : T2MoverProcess, &iStruct, sizeof(MAINIT));
+ CoroScheduler.createProcess(PID_MOVER, (TinselVersion == 3) ? T3MoverProcess : T2MoverProcess, &iStruct, sizeof(MAINIT));
} else {
MoverProcessHelper(X, Y, id, pMover);
pMover->pProc = CoroScheduler.createProcess(PID_MOVER, T1MoverProcess, &pMover, sizeof(MOVER *));
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index 081fdee0803..23c63fced50 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -765,7 +765,7 @@ int PCMMusicPlayer::readBuffer(int16 *buffer, const int numSamples) {
}
bool PCMMusicPlayer::isStereo() const {
- if (TinselV3) {
+ if (TinselVersion == 3) {
return true;
} else {
return false;
@@ -773,7 +773,7 @@ bool PCMMusicPlayer::isStereo() const {
}
int PCMMusicPlayer::getRate() const {
- if (TinselV3) {
+ if (TinselVersion == 3) {
if (_curChunk) {
return _curChunk->getRate();
} else {
@@ -1023,7 +1023,7 @@ void PCMMusicPlayer::loadMP3MusicFromSegment(int segmentNum) {
}
void PCMMusicPlayer::loadMusicFromSegment(int segmentNum) {
- if (TinselV3) {
+ if (TinselVersion == 3) {
loadMP3MusicFromSegment(segmentNum);
} else {
loadADPCMMusicFromSegment(segmentNum);
diff --git a/engines/tinsel/object.cpp b/engines/tinsel/object.cpp
index d05a8bffe37..6e6bc6ad8b6 100644
--- a/engines/tinsel/object.cpp
+++ b/engines/tinsel/object.cpp
@@ -374,7 +374,7 @@ OBJECT *InitObject(const OBJ_INIT *pInitTbl) {
PALQ *pPalQ= nullptr; // palette queue pointer
const IMAGE *pImg = _vm->_handle->GetImage(pInitTbl->hObjImg); // handle to image
- if (!TinselV3) {
+ if (TinselVersion != 3) {
if (pImg->hImgPal) {
// allocate a palette for this object
pPalQ = AllocPalette(pImg->hImgPal);
diff --git a/engines/tinsel/object.h b/engines/tinsel/object.h
index 7e53f5d11ec..8e731fb7d78 100644
--- a/engines/tinsel/object.h
+++ b/engines/tinsel/object.h
@@ -82,7 +82,7 @@ struct OBJECT {
Common::Rect rcPrev; ///< previous screen coordinates of object bounding rectangle
int flags; ///< object flags - see above for list
PALQ *pPal; ///< objects palette Q position
- short isRLE; ///< TinselV3, if image is using run-length encoding
+ short isRLE; ///< TinselVersion == 3, if image is using run-length encoding
short colorFlags; /// TinselV3, type of color blending
int constant; ///< which color in palette for monochrome objects
int width; ///< width of object
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 54faa223d58..49d7b992642 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -625,7 +625,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
if ((TinselVersion == 0) && ((opcode & OPMASK) > OP_IMM))
opcode += 3;
- if (TinselV3) {
+ if (TinselVersion == 3) {
// Discworld Noir adds a NOOP-operation as opcode 0, leaving everything
// else 1 higher, so we subtract 1, and add NOOP as the highest opcode instead.
opcode -= 1;
@@ -858,7 +858,7 @@ void Interpret(CORO_PARAM, INT_CONTEXT *ic) {
break;
case OP_NOOP:
- if (!TinselV3) {
+ if (TinselVersion != 3) {
error("OP_NOOP seen outside Discworld Noir");
}
break;
diff --git a/engines/tinsel/play.cpp b/engines/tinsel/play.cpp
index 0a15df15558..5a6b549a2dc 100644
--- a/engines/tinsel/play.cpp
+++ b/engines/tinsel/play.cpp
@@ -56,7 +56,7 @@ struct PPINIT {
uint8 escOn;
int32 myescEvent;
- OBJECT** playfield; // TinselV3, the playfield to insert the film
+ OBJECT** playfield; // TinselVersion == 3, the playfield to insert the film
};
//----------------- LOCAL GLOBAL DATA --------------------
@@ -753,7 +753,7 @@ static void t2PlayReel(CORO_PARAM, int x, int y, bool bRestore, int speed, SCNHA
/*
* Insert the object
*/
- if (!TinselV3) {
+ if (TinselVersion != 3) {
// Poke in the background palette
PokeInPalette(_ctx->pmi);
}
@@ -766,7 +766,7 @@ static void t2PlayReel(CORO_PARAM, int x, int y, bool bRestore, int speed, SCNHA
// Set up and insert the multi-object
_ctx->pPlayObj = MultiInitObject(_ctx->pmi);
- if (TinselV3) {
+ if (TinselVersion == 3) {
MultiInsertObject(playfield, _ctx->pPlayObj);
} else {
if (!bTop)
@@ -914,7 +914,7 @@ static void t2PlayReel(CORO_PARAM, int x, int y, bool bRestore, int speed, SCNHA
_vm->_actor->NotPlayingReel(_ctx->reelActor, _ctx->filmNumber, column);
// Ditch the object
- if (TinselV3) {
+ if (TinselVersion == 3) {
MultiDeleteObject(playfield, _ctx->pPlayObj);
} else {
if (!bTop) {
diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp
index 5b86d9e4590..4fb6a37410d 100644
--- a/engines/tinsel/polygons.cpp
+++ b/engines/tinsel/polygons.cpp
@@ -235,7 +235,7 @@ void Poly::nextPoly() {
const byte *pRecord = _pData;
int typeVal = nextLong(_pData);
- if ((FROM_32(typeVal) == 6) && TinselV3)
+ if ((FROM_32(typeVal) == 6) && (TinselVersion == 3))
typeVal = TO_32(7);
if ((FROM_32(typeVal) == 5) && TinselVersion >= 2)
typeVal = TO_32(6);
@@ -250,14 +250,14 @@ void Poly::nextPoly() {
xoff = nextLong(_pData);
yoff = nextLong(_pData);
id = nextLong(_pData);
- if (TinselV3) {
+ if (TinselVersion == 3) {
sceneId = nextLong(_pData);
playfield = nextLong(_pData);
}
}
// Noir is for scale polygons using union with some alignment
- if (TinselV3 && type == POLY_SCALE) {
+ if ((TinselVersion == 3) && type == POLY_SCALE) {
vx[0] = nextLong(_pData);
vx[1] = nextLong(_pData);
vx[2] = nextLong(_pData);
@@ -1930,7 +1930,7 @@ void InitPolygons(SCNHANDLE ph, int numPoly, bool bRestart) {
} else {
for (int i = numPoly - 1; i >= 0; i--) {
if (Polys[i]->polyType == TAG){
- if (TinselV3) {
+ if (TinselVersion == 3) {
Poly ptp(_vm->_handle->LockMem(pHandle), Polys[i]->pIndex);
if (ptp.sceneId != -1) {
continue;
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index d90ce01a462..23ad23191da 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -543,7 +543,7 @@ void SoundManager::openSampleFiles() {
break;
default:
debugC(DEBUG_DETAILED, kTinselDebugSound, "Detected original sound-data");
- if (TinselV3) {
+ if (TinselVersion == 3) {
// And in Noir, the data is MP3
_soundMode = kMP3Mode;
}
diff --git a/engines/tinsel/text.cpp b/engines/tinsel/text.cpp
index 406dac6e470..b69ef749470 100644
--- a/engines/tinsel/text.cpp
+++ b/engines/tinsel/text.cpp
@@ -184,7 +184,7 @@ OBJECT *ObjectTextOut(OBJECT **pList, char *szStr, int color,
pChar->constant = color;
// set the base font color to be replaced with supplied color, only for Tinsel V3
- g_t3fontBaseColor = TinselV3 ? pFont->baseColor : 0;
+ g_t3fontBaseColor = (TinselVersion == 3) ? pFont->baseColor : 0;
// get Y animation offset
GetAniOffset(hImg, pChar->flags, &aniX, &aniY);
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index daff22d8671..8a6227b6412 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -1584,7 +1584,7 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int compit, int myEs
return;
}
- if (TinselV3) {
+ if (TinselVersion == 3) {
CORO_INVOKE_0(_vm->_bg->WaitForBG);
}
@@ -1613,7 +1613,7 @@ static void Play(CORO_PARAM, SCNHANDLE hFilm, int x, int y, int compit, int myEs
bComplete = compit;
- if (TinselV3) {
+ if (TinselVersion == 3) {
bComplete = compit & 0x20;
if (bTop) {
playfield = _vm->_bg->GetPlayfieldList(FIELD_STATUS);
@@ -3411,7 +3411,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
if ((_ctx->whatSort == IS_SAY) || (_ctx->whatSort == IS_TALK))
_vm->_actor->GetActorMidTop(_ctx->actor, &_ctx->x, &_ctx->y);
- if ((TinselVersion != 0) && !TinselV3) {
+ if ((TinselVersion != 0) && (TinselVersion != 3)) {
SetTextPal(_vm->_actor->GetActorRGB(_ctx->actor));
}
if (TinselVersion >= 2) {
@@ -3423,7 +3423,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
}
int color = 0;
- if (TinselV3) {
+ if (TinselVersion == 3) {
color = _vm->_actor->GetActorRGB(_ctx->actor);
}
@@ -5286,7 +5286,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
if (TinselVersion == 0) libCode = DW1DEMO_CODES[operand];
else if (TinselVersion == 1) libCode = DW1_CODES[operand];
else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
- else if (TinselV3) {
+ else if (TinselVersion == 3) {
NoirMapping mapping = translateNoirLibCode(operand, pp);
libCode = mapping.libCode;
if (libCode == ZZZZZZ) {
@@ -6017,7 +6017,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case PLAY:
// Common to DW1 / DW2 / Noir
- if (TinselV3) {
+ if (TinselVersion == 3) {
if (*pResumeState == RES_1 && _vm->_handle->IsCdPlayHandle(pp[0])) {
*pResumeState = RES_NOT;
if ((pp[0] & 0x10) != 0) {
@@ -6057,7 +6057,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
return -3;
case PLAYMOVIE:
- if (TinselV3) {
+ if (TinselVersion == 3) {
t3PlayMovie(coroParam, pp[0], pic->myEscape);
} else {
// DW2 only
@@ -6348,7 +6348,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
case SETSYSTEMREEL:
// Noir only
- if (TinselV3) {
+ if (TinselVersion == 3) {
pp -= 1;
SetSystemReel(pp[0], pp[1]);
return -2;
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 83be5c6ad1b..b44523788b3 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -779,7 +779,7 @@ GameChunk createGameChunkV2() {
}
GameChunk loadGameChunk() {
- if (TinselV3) {
+ if (TinselVersion == 3) {
return loadGameChunkV3();
} else {
return createGameChunkV2();
More information about the Scummvm-git-logs
mailing list