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.
This commit is contained in:
Jakob Wagner 2022-04-16 16:51:32 +02:00 committed by Filippos Karapetis
parent 978ea134cc
commit 67c3bce30e
36 changed files with 517 additions and 505 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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));
}

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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];
}

View File

@ -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)

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -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;

View File

@ -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)) {

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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++)

View File

@ -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) {

View File

@ -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;

View File

@ -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));

View File

@ -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;
}