aboutsummaryrefslogtreecommitdiff
path: root/scumm/insane
diff options
context:
space:
mode:
authorEugene Sandulenko2004-01-26 22:44:47 +0000
committerEugene Sandulenko2004-01-26 22:44:47 +0000
commit498e0f4d6f088a77ad450ed782befc4a799cdf24 (patch)
tree0e37cbe6e8e3a446d55a63f9e134a19e8c88d84d /scumm/insane
parent74901527146fef1de6f26f5e28152cf0f2c59917 (diff)
downloadscummvm-rg350-498e0f4d6f088a77ad450ed782befc4a799cdf24.tar.gz
scummvm-rg350-498e0f4d6f088a77ad450ed782befc4a799cdf24.tar.bz2
scummvm-rg350-498e0f4d6f088a77ad450ed782befc4a799cdf24.zip
o Implemented TRS handling
o Now you can succesfully reach the cave so FT is completable, but it crashes now in some particularly situations, so you should avoid them. svn-id: r12630
Diffstat (limited to 'scumm/insane')
-rw-r--r--scumm/insane/insane.cpp94
-rw-r--r--scumm/insane/insane.h6
-rw-r--r--scumm/insane/insane_iact.cpp4
-rw-r--r--scumm/insane/insane_scenes.cpp19
4 files changed, 76 insertions, 47 deletions
diff --git a/scumm/insane/insane.cpp b/scumm/insane/insane.cpp
index fe10f9cb51..28c114c510 100644
--- a/scumm/insane/insane.cpp
+++ b/scumm/insane/insane.cpp
@@ -32,6 +32,7 @@
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/smush/smush_player.h"
+#include "scumm/smush/smush_font.h"
#include "scumm/smush/chunk_type.h"
#include "scumm/smush/chunk.h"
@@ -39,7 +40,13 @@
// TODO (in no particular order):
// o Ben's velocity don't get zeroed after crash
-// o TRS file support. Everything is in place, I just need to figure out function parameters
+// o Mine road used to have correct behaviour with ESC but now is not.
+// Instead of skipping portions of road it just restarts
+// o Road signs are not aligned properly
+// o With goggles on there is a seek error
+// o SAUD complaining again
+// o Insane::postCase16() has workaround. Cockpit is not transparent so it is
+// disabled now
// o Code review/cleanup
// o DOS demo INSANE
@@ -76,9 +83,6 @@ Insane::Insane(ScummEngine_v6 *scumm) {
_smush_bensgoggNut->loadFont("bensgogg.nut", _vm->getGameDataPath());
_smush_bencutNut = new NutRenderer(_vm);
_smush_bencutNut->loadFont("bencut.nut", _vm->getGameDataPath());
-
- // FIXME: implement
- // openManyResource(0, 4, "specfnt.nut", "titlfnt.nut", "techfnt.nut", "scummfnt.nut");
}
Insane::~Insane(void) {
@@ -691,14 +695,6 @@ void Insane::readState(void) {
_enemy[EN_VULTF2].field_10 = readArray(339);
}
-void Insane::setTrsFile(int file) {
- // FIXME: we don't need it
-}
-
-void Insane::resetTrsFilePtr(void) {
- // FIXME: we don't need it
-}
-
void Insane::setupValues(void) {
_actor[0].x = 160;
_actor[0].y = 200;
@@ -844,7 +840,7 @@ void Insane::prepareScenePropScene(int32 scenePropNum, bool arg_4, bool arg_8) {
_sceneProp[idx + 1].counter = 0;
_currScenePropSubIdx = 1;
if (_sceneProp[idx + 1].trsId)
- _currTrsMsg = handleTrsTag(_trsFilePtr, _sceneProp[idx + 1].trsId);
+ _currTrsMsg = handleTrsTag(_sceneProp[idx + 1].trsId);
else
_currTrsMsg = 0;
@@ -1265,11 +1261,61 @@ void Insane::smlayer_overrideDrawActorAt(byte *arg_0, byte arg_4, byte arg_8) {
}
void Insane::smlayer_showStatusMsg(int32 arg_0, byte *renderBitmap, int32 codecparam,
- int32 x, int32 y, int32 arg_14, int32 arg_18,
- int32 arg_1C, const char *formatString, char *str) {
- // FIXME: implement
- // SmushPlayer::handleTextResource does the thing
- warning("stub Insane::smlayer_showStatusMsg(...)");
+ int32 pos_x, int32 pos_y, int32 arg_14, int32 arg_18,
+ int32 flags, const char *formatString, char *strng) {
+ SmushFont *sf = _player->_sf[0];
+ int color = 1, top = 0;
+ char *str = NULL, *string;
+ int len = strlen(formatString) + strlen(strng) + 16;
+
+ string = (char *)malloc(len);
+ str = string;
+
+ while (*strng == '/') {
+ strng++; // For text resources
+ }
+
+ snprintf(str, len, formatString, strng);
+
+ while (str[0] == '^') {
+ switch (str[1]) {
+ case 'f':
+ {
+ int id = str[3] - '0';
+ str += 4;
+ sf = _player->_sf[id];
+ }
+ break;
+ case 'c':
+ {
+ color = str[4] - '0' + 10 *(str[3] - '0');
+ str += 5;
+ }
+ break;
+ default:
+ error("invalid escape code in text string");
+ }
+ }
+
+ assert(sf != NULL);
+ sf->setColor(color);
+
+ // flags:
+ // bit 0 - center 1
+ // bit 1 - not used 2
+ // bit 2 - ??? 4
+ // bit 3 - wrap around 8
+ switch (flags & 9) {
+ 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;
+ default:
+ warning("Insane::smlayer_showStatusMsg. Not handled flags: %d", flags);
+ }
+ free (string);
}
void Insane::procSKIP(Chunk &b) {
@@ -1320,11 +1366,8 @@ void Insane::smlayer_setActorFacing(int actornum, int actnum, int frame, int dir
}
}
-char *Insane::handleTrsTag(int32 trsFilePtr, int32 trsId) {
- // FIXME: implement
- warning("stub Insane::handleTrsTag(0, %d)", trsId);
-
- return 0;
+char *Insane::handleTrsTag(int32 trsId) {
+ return _player->getString(trsId);;
}
bool Insane::smush_eitherNotStartNewFrame(void) {
@@ -1361,11 +1404,6 @@ bool Insane::smlayer_actorNeedRedraw(int actornum, int actnum) {
return a->needRedraw;
}
-void Insane::smush_setPaletteValue(int where, int r, int g, int b) {
- // FIXME: implement
- warning("stub Insane::smlayer_setPaletteValue(%d, %d, %d, %d)", where, r, g, b);
-}
-
int32 Insane::readArray (int item) {
return _vm->readArray(_numberArray, 0, item);
}
diff --git a/scumm/insane/insane.h b/scumm/insane/insane.h
index c5f075d1b1..e96c2883a0 100644
--- a/scumm/insane/insane.h
+++ b/scumm/insane/insane.h
@@ -122,7 +122,6 @@ class Insane {
bool _kickEnemyProgress;
bool _weaponEnemyJustSwitched;
int32 _enHdlVar[9][9];
- int32 _trsFilePtr; // FIXME: we don't need it
int32 _smlayer_room;
int32 _smlayer_room2;
byte *_smush_roadrashRip; // FIXME: combine them in array
@@ -278,8 +277,6 @@ class Insane {
void smush_warpMouse(int x, int y, int buttons);
void putActors(void);
void readState(void);
- void setTrsFile(int file); // FIXME: we don't need it
- void resetTrsFilePtr(void); // FIXME: we don't need it
int initScene(int sceneId);
void stopSceneSounds(int sceneId);
void shutCurrentScene(void);
@@ -422,8 +419,7 @@ class Insane {
int32 setBenState(void);
bool smlayer_actorNeedRedraw(int actornum, int actnum);
void reinitActors(void);
- void smush_setPaletteValue(int where, int r, int g, int b);
- char *handleTrsTag(int32 trsFilePtr, int32 trsId);
+ char *handleTrsTag(int32 trsId);
void ouchSoundBen(void);
void smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 step1,
int32 step2, int32 setupsan1, byte *fluPtr, int32 numFrames);
diff --git a/scumm/insane/insane_iact.cpp b/scumm/insane/insane_iact.cpp
index 99d5c4679b..34469ea836 100644
--- a/scumm/insane/insane_iact.cpp
+++ b/scumm/insane/insane_iact.cpp
@@ -578,7 +578,7 @@ void Insane::iactScene17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smlayer_startSfx(94);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 24, 167, 1,
- 2, 0, "%s", handleTrsTag(_trsFilePtr, 5000));
+ 2, 0, "%s", handleTrsTag(5000));
}
_val124_ = true;
break;
@@ -590,7 +590,7 @@ void Insane::iactScene17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
smlayer_startSfx(94);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 24, 167, 1,
- 2, 0, "%s", handleTrsTag(_trsFilePtr, 5001));
+ 2, 0, "%s", handleTrsTag(5001));
}
_val124_ = true;
_val123_ = true;
diff --git a/scumm/insane/insane_scenes.cpp b/scumm/insane/insane_scenes.cpp
index 7a6c101b39..fce17465ad 100644
--- a/scumm/insane/insane_scenes.cpp
+++ b/scumm/insane/insane_scenes.cpp
@@ -34,11 +34,6 @@
namespace Scumm {
void Insane::runScene(int arraynum) {
- // procPtr5 = &procPtr5Body;
- // procPtr6 = &procPtr6Body;
- // procIact = &handleIact;
- // ptrMainLoop = &ptrMainLoopBody;
-
_insaneIsRunning = true;
_player = new SmushPlayer(_vm, _speed);
_player->insanity(true);
@@ -60,7 +55,6 @@ void Insane::runScene(int arraynum) {
smush_warpMouse(160, 100, -1);
putActors();
readState();
- setTrsFile(_trsFilePtr); // FIXME: we don't need it
debug(0, "INSANE Arg: %d", readArray(0));
@@ -137,7 +131,6 @@ void Insane::runScene(int arraynum) {
break;
}
- resetTrsFilePtr(); // FIXME: we don't need it
smush_proc39();
putActors();
smush_proc40();
@@ -1058,8 +1051,9 @@ void Insane::postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
sprintf(buf, "^f01%02o", curFrame & 0xff);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 140, 168, 1, 2, 0, "%s", buf);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 170, 43, 1, 2, 0, "%s", buf);
-
- smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
+
+ // FIXME: it should be transparent
+ //smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
if (!_val124_)
smlayer_drawSomething(renderBitmap, codecparam, 24, 170, 1,
@@ -1440,8 +1434,9 @@ void Insane::postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
if (!_actor[tsceneProp->actor].runningSound || ConfMan.getBool("subtitles")) {
if (_actor[tsceneProp->actor].act[3].state == 72 &&
_currTrsMsg) {
- smush_setPaletteValue(1, tsceneProp->r, tsceneProp->g, tsceneProp->b);
- smush_setPaletteValue(2, 0, 0, 0);
+ _player->setPaletteValue(0, tsceneProp->r, tsceneProp->g, tsceneProp->b);
+ _player->setPaletteValue(1, tsceneProp->r, tsceneProp->g, tsceneProp->b);
+ _player->setPaletteValue(0, 0, 0, 0);
smlayer_showStatusMsg(-1, renderBitmap, codecparam, 160, 20, 1, 2, 5,
"^f00%s", _currTrsMsg);
}
@@ -1452,7 +1447,7 @@ void Insane::postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
tsceneProp = &_sceneProp[_currScenePropIdx + _currScenePropSubIdx];
tsceneProp->counter = 0;
if (tsceneProp->trsId)
- _currTrsMsg = handleTrsTag(_trsFilePtr, tsceneProp->trsId);
+ _currTrsMsg = handleTrsTag(tsceneProp->trsId);
else
_currTrsMsg = 0;