o Now Long TRS messages get wrapped

o Approaching enemy animation fixed
o Renames some vars and struct members
o Fixed dosdemo. It didn't run
o Correct Mac demo INSANE skipping behaviour

svn-id: r12751
This commit is contained in:
Eugene Sandulenko 2004-02-06 21:05:58 +00:00
parent 7b26a609f7
commit 8411a8ade1
7 changed files with 67 additions and 78 deletions

View File

@ -39,8 +39,6 @@
#include "scumm/insane/insane.h"
// TODO (in no particular order):
// o Long TRS messages get rendered just in one line, so text overlaps
// o Approaching enemy animation is wrong sometimes
// o Code review/cleanup
// o DOS demo INSANE
@ -53,30 +51,33 @@ static const int actorAnimationData[21] = {20, 21, 22, 23, 24, 25, 26, 13, 14, 1
Insane::Insane(ScummEngine_v6 *scumm) {
_vm = scumm;
// Demo has different insane, so disable it now
if (_vm->_features & GF_DEMO)
#ifndef FTDOSDEMO
if ((_vm->_features & GF_DEMO) && (_vm->_features & GF_PC))
return;
#endif
initvars();
readFileToMem("roadrash.rip", &_smush_roadrashRip);
readFileToMem("roadrsh2.rip", &_smush_roadrsh2Rip);
readFileToMem("roadrsh3.rip", &_smush_roadrsh3Rip);
readFileToMem("goglpalt.rip", &_smush_goglpaltRip);
readFileToMem("tovista1.flu", &_smush_tovista1Flu);
readFileToMem("tovista2.flu", &_smush_tovista2Flu);
readFileToMem("toranch.flu", &_smush_toranchFlu);
readFileToMem("minedriv.flu", &_smush_minedrivFlu);
readFileToMem("minefite.flu", &_smush_minefiteFlu);
if (!((_vm->_features & GF_DEMO) && (_vm->_features & GF_PC))) {
readFileToMem("roadrash.rip", &_smush_roadrashRip);
readFileToMem("roadrsh2.rip", &_smush_roadrsh2Rip);
readFileToMem("roadrsh3.rip", &_smush_roadrsh3Rip);
readFileToMem("goglpalt.rip", &_smush_goglpaltRip);
readFileToMem("tovista1.flu", &_smush_tovista1Flu);
readFileToMem("tovista2.flu", &_smush_tovista2Flu);
readFileToMem("toranch.flu", &_smush_toranchFlu);
readFileToMem("minedriv.flu", &_smush_minedrivFlu);
readFileToMem("minefite.flu", &_smush_minefiteFlu);
_smush_bensgoggNut = new NutRenderer(_vm);
_smush_bensgoggNut->loadFont("bensgogg.nut", _vm->getGameDataPath());
_smush_bencutNut = new NutRenderer(_vm);
_smush_bencutNut->loadFont("bencut.nut", _vm->getGameDataPath());
}
_smush_iconsNut = new NutRenderer(_vm);
_smush_iconsNut->loadFont("icons.nut", _vm->getGameDataPath());
_smush_icons2Nut = new NutRenderer(_vm);
_smush_icons2Nut->loadFont("icons2.nut", _vm->getGameDataPath());
_smush_bensgoggNut = new NutRenderer(_vm);
_smush_bensgoggNut->loadFont("bensgogg.nut", _vm->getGameDataPath());
_smush_bencutNut = new NutRenderer(_vm);
_smush_bencutNut->loadFont("bencut.nut", _vm->getGameDataPath());
}
Insane::~Insane(void) {
@ -154,7 +155,7 @@ void Insane::initvars(void) {
_benHasGoggles = false;
_mineCaveIsNear = false;
_objectDetected = false;
_val32d = -1;
_approachAnim = -1;
_val54d = 0;
_val57d = 0;
_val115_ = false;
@ -453,7 +454,7 @@ void Insane::init_enemyStruct(int n, int32 handler, int32 initializer,
int16 occurences, int32 maxdamage, int32 field_10,
int32 weapon, int32 sound, const char *filename,
int32 costume4, int32 costume6, int32 costume5,
int16 costumevar, int32 maxframe, int32 field_34) {
int16 costumevar, int32 maxframe, int32 apprAnim) {
assert(strlen(filename) < 20);
_enemy[n].handler = handler;
@ -469,7 +470,7 @@ void Insane::init_enemyStruct(int n, int32 handler, int32 initializer,
_enemy[n].costume5 = costume5;
_enemy[n].costumevar = costumevar;
_enemy[n].maxframe = maxframe;
_enemy[n].field_34 = field_34;
_enemy[n].apprAnim = apprAnim;
}
void Insane::init_fluConfStruct(int n, int sceneId, byte **fluPtr,
@ -597,11 +598,6 @@ void Insane::readFileToMem(const char *name, byte **buf) {
void Insane::startVideo(const char *filename, int num, int argC, int frameRate,
int doMainLoop, byte *fluPtr, int32 numFrames) {
// Demo has different insane, so disable it now
if (_vm->_features & GF_DEMO)
return;
_smush_curFrame = 0;
_smush_isSanFileSetup = 0;
_smush_setupsan4 = 0;
@ -680,7 +676,7 @@ void Insane::setupValues(void) {
_actor[0].cursorX = 0;
_actor[0].lost = false;
_currEnemy = -1;
_val32d = -1;
_approachAnim = -1;
smush_warpMouse(160, 100, -1);
}
@ -947,8 +943,7 @@ bool Insane::actor1StateFlags(int state) {
void Insane::escapeKeyHandler(void) {
struct fluConf *flu;
//if (!_ptrMainLoop) { } // We don't need it
// Demo has different insane, so disable it now
// Demos have just one scene
if (!_insaneIsRunning || _vm->_features & GF_DEMO) {
smush_setToFinish();
return;
@ -1275,13 +1270,16 @@ void Insane::smlayer_showStatusMsg(int32 arg_0, byte *renderBitmap, int32 codecp
// bit 1 - not used 2
// bit 2 - ??? 4
// bit 3 - wrap around 8
switch (flags & 9) {
switch (flags) {
case 0:
sf->drawStringAbsolute(str, renderBitmap, _player->_width, pos_x, pos_y);
break;
case 1:
sf->drawStringCentered(str, renderBitmap, _player->_width, _player->_height, pos_x, MAX(pos_y, top));
break;
case 5:
sf->drawStringWrapCentered(str, renderBitmap, _player->_width, _player->_height, pos_x, pos_y, 10, 300);
break;
default:
warning("Insane::smlayer_showStatusMsg. Not handled flags: %d", flags);
}
@ -1295,6 +1293,8 @@ void Insane::procSKIP(Chunk &b) {
par1 = b.getWord();
par2 = b.getWord();
_player->_skipNext = false;
if (!par2) {
if (isBitSet(par1))
_player->_skipNext = true;
@ -1308,24 +1308,21 @@ void Insane::procSKIP(Chunk &b) {
}
bool Insane::isBitSet(int n) {
if (n >= 0x80 * 8)
return false;
assert (n < 0x80);
return ((_iactBits[n / 8] & (0x80 >> (n % 8))) != 0);
return (_iactBits[n] != 0);
}
void Insane::setBit(int n) {
if (n >= 0x80 * 8)
return;
assert (n < 0x80);
_iactBits[n / 8] |= 0x80 >> (n % 8);
_iactBits[n] = 1;
}
void Insane::clearBit(int n) {
if (n >= 0x80 * 8)
return;
assert (n < 0x80);
_iactBits[n / 8] &= ~(0x80 >> (n % 8));
_iactBits[n] = 0;
}
void Insane::smlayer_setActorFacing(int actornum, int actnum, int frame, int direction) {

View File

@ -53,6 +53,8 @@ namespace Scumm {
#define INSANE_DBG 5
#undef FTDOSDEMO
class Insane {
public:
Insane(ScummEngine_v6 *scumm);
@ -172,7 +174,7 @@ class Insane {
bool _mineCaveIsNear;
bool _objectDetected;
bool _roadBumps;
int32 _val32d;
int32 _approachAnim;
int32 _val54d;
int32 _val57d;
bool _val115_;
@ -195,7 +197,7 @@ class Insane {
int32 costume5;
int16 costumevar;
int32 maxframe;
int32 field_34;
int32 apprAnim;
};
struct enemy _enemy[9];

View File

@ -85,12 +85,13 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
break;
}
if (_val32d == -1) {
if (_approachAnim == -1) {
proc62(); //PATCH
_val32d = _enemy[_currEnemy].field_34;
_currEnemy = EN_VULTM2;
_approachAnim = _enemy[_currEnemy].apprAnim;
}
if (_val32d == par4)
if (_approachAnim == par4)
clearBit(par5);
else
setBit(par5);
@ -98,11 +99,11 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
case 3:
if (par3 == 1) {
setBit(b.getWord());
_val32d = -1;
_approachAnim = -1;
}
break;
case 4:
if (par3 == 1 && (_val32d < 0 || _val32d > 4))
if (par3 == 1 && (_approachAnim < 0 || _approachAnim > 4))
setBit(b.getWord());
break;
case 5:
@ -137,30 +138,13 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
_smush_iconsNut, 7, 0, 0);
_roadBranch = true;
_iactSceneId = par4;
break;
case 7:
if (readArray(4) != 0)
return;
smlayer_drawSomething(renderBitmap, codecparam, 160-13, 20-10, 3, // QW
_smush_icons2Nut, 8, 0, 0);
_roadStop = true;
break;
case 8:
if (readArray(4) == 0 || readArray(6) == 0)
return;
writeArray(1, _posBrokenTruck);
writeArray(3, _val57d);
smush_setToFinish();
break;
case 25:
_roadBumps = true;
_actor[0].y1 = -_actor[0].y1;
break;
case 11:
if (_val32d >= 1 && _val32d <= 4 && !_needSceneSwitch)
if (_approachAnim >= 1 && _approachAnim <= 4 && !_needSceneSwitch)
queueSceneSwitch(13, _smush_minefiteFlu, "minefite.san", 64, 0,
_continueFrame1, 1300);
break;
@ -192,7 +176,7 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
break;
}
if (_val32d < 0 || _val32d > 4)
if (_approachAnim < 0 || _approachAnim > 4)
if (readArray(8)) {
smlayer_drawSomething(renderBitmap, codecparam, 270-19, 20-18, 3,
_smush_iconsNut, 20, 0, 0);
@ -581,7 +565,7 @@ void Insane::iactScene17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
case 4:
if (par3 == 1) {
setBit(b.getWord());
_val32d = -1;
_approachAnim = -1;
}
break;
case 6:

View File

@ -34,6 +34,11 @@
namespace Scumm {
void Insane::runScene(int arraynum) {
#ifndef FTDOSDEMO
if ((_vm->_features & GF_DEMO) && (_vm->_features & GF_PC))
return;
#endif
_insaneIsRunning = true;
_player = new SmushPlayer(_vm, _speed);
_player->insanity(true);

View File

@ -2040,7 +2040,8 @@ void ScummEngine::readMAXS() {
_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);
if ((_gameId == GID_FT) && (_features & GF_DEMO))
if ((_gameId == GID_FT) && (_features & GF_DEMO) &&
(_features & GF_PC))
_numGlobalScripts = 300;
else
_numGlobalScripts = 2000;

View File

@ -2557,21 +2557,19 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
debug(1, "INSANE Arg: %d %d", args[1], args[2]);
SmushPlayer *sp = new SmushPlayer(this, speed);
// INSANE mode 0: SMUSH movie playback
if (args[1] == 0) {
sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
} else if (_gameId == GID_FT) {
const int insaneVarNum = (_features & GF_DEMO) ? 232 : 233;
SmushPlayer *sp = new SmushPlayer(this, speed);
// PC demo uses different INSANE
if (!(_features & GF_DEMO)) {
_insane->setSmushParams(speed);
_insane->runScene(insaneVarNum);
}
sp->play((char *)getStringAddressVar(VAR_VIDEONAME), getGameDataPath());
delete sp;
} else if (_gameId == GID_FT) {
const int insaneVarNum = ((_features & GF_DEMO) && (_features & GF_PC))
? 232 : 233;
_insane->setSmushParams(speed);
_insane->runScene(insaneVarNum);
}
delete sp;
}
break;
case 12:

View File

@ -190,7 +190,7 @@ static const ScummGameSettings scumm_settings[] = {
{"ft", "Full Throttle", GID_FT, 7, MDT_NONE,
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE, 0},
{"ftdemo", "Full Throttle (Mac. Demo)", GID_FT, 7, MDT_NONE,
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE, 0},
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO, 0},
{"ftpcdemo", "Full Throttle (PC Demo)", GID_FT, 7, MDT_NONE,
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO, "ft"},
@ -644,6 +644,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
if (_features & GF_AFTER_HEV7) {
sprintf(buf, "%s.he0", _gameName.c_str());
} else if ((_gameId == GID_FT) && (_features & GF_PC) && (_features & GF_DEMO)) {
sprintf(buf, "%s.000", _gameName.c_str());
} else if (_version >= 7) {
sprintf(buf, "%s.la0", _gameName.c_str());
} else if (_features & GF_HUMONGOUS)