aboutsummaryrefslogtreecommitdiff
path: root/scumm/insane
diff options
context:
space:
mode:
authorEugene Sandulenko2004-02-06 21:05:58 +0000
committerEugene Sandulenko2004-02-06 21:05:58 +0000
commit8411a8ade175a9d35af22d108a67ff542d4441ad (patch)
treef55184f40c0fa1130a190a4e06fa273d46d3493a /scumm/insane
parent7b26a609f7c9e410c7a5930fa333901a09055bde (diff)
downloadscummvm-rg350-8411a8ade175a9d35af22d108a67ff542d4441ad.tar.gz
scummvm-rg350-8411a8ade175a9d35af22d108a67ff542d4441ad.tar.bz2
scummvm-rg350-8411a8ade175a9d35af22d108a67ff542d4441ad.zip
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
Diffstat (limited to 'scumm/insane')
-rw-r--r--scumm/insane/insane.cpp73
-rw-r--r--scumm/insane/insane.h6
-rw-r--r--scumm/insane/insane_iact.cpp34
-rw-r--r--scumm/insane/insane_scenes.cpp5
4 files changed, 53 insertions, 65 deletions
diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp
index d05d6b8a6d..ea88496694 100644
--- a/scumm/insane/insane.cpp
+++ b/scumm/insane/insane.cpp
@@ -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) {
diff --git a/scumm/insane/insane.h b/scumm/insane/insane.h
index ef2134dcd7..24b39b6ecb 100644
--- a/scumm/insane/insane.h
+++ b/scumm/insane/insane.h
@@ -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];
diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp
index 155bb9b3eb..0279feb8eb 100644
--- a/scumm/insane/insane_iact.cpp
+++ b/scumm/insane/insane_iact.cpp
@@ -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:
@@ -138,29 +139,12 @@ void Insane::iactScene1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
_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:
diff --git a/scumm/insane/insane_scenes.cpp b/scumm/insane/insane_scenes.cpp
index 546e123169..9fb4e56513 100644
--- a/scumm/insane/insane_scenes.cpp
+++ b/scumm/insane/insane_scenes.cpp
@@ -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);