[Scummvm-cvs-logs] CVS: scummvm/scumm/smush insane.cpp,NONE,1.1 insane.h,NONE,1.1 smush_player.cpp,1.65,1.66 smush_player.h,1.12,1.13

Eugene Sandulenko sev at users.sourceforge.net
Fri Dec 5 21:48:01 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1:/tmp/cvs-serv12604/scumm/smush

Modified Files:
	smush_player.cpp smush_player.h 
Added Files:
	insane.cpp insane.h 
Log Message:
Preliminary support for FT INSANE is added. To enable the code define
INSANE in config.h. But only non-interactive parts work and there is no
insane scene skip. Only one choice during those scenes is Ctrl+X.


--- NEW FILE: insane.cpp ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2001  Ludvig Strigeus
 * Copyright (C) 2001-2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/scumm/smush/insane.cpp,v 1.1 2003/12/06 05:47:24 sev Exp $
[...4904 lines suppressed...]
	_smush_setupsan1 = setupsan1;
	_smush_setupsan2 = setupsan2;
	smush_setupSanFile(filename, 8);
	_smush_isSanFileSetup = 1;
	smush_setFrameSteps(step1, step2);
}

void Insane::smush_setFrameSteps(int32 step1, int32 step2) {
	_smush_frameNum2 = _smush_curFrame;
	_smush_frameNum1 = step2;
	_smush_frameStep = step1;
}

void Insane::smush_setupSanFile(const char *filename, int32 offset) {
	// FIXME: implement
	warning("stub Insane::smush_setupSanFile(%s, %d)", filename, offset);
}

}
#endif // INSANE

--- NEW FILE: insane.h ---
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2002-2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummvm/scumm/smush/insane.h,v 1.1 2003/12/06 05:47:24 sev Exp $
 *
 */

#ifndef INSANE_H
#define INSANE_H

#include "base/engine.h"
#include "scumm/scumm.h"

#include "scumm/smush/smush_player.h"

#ifdef INSANE

namespace Scumm {

#define INV_CHAIN    0
#define INV_CHAINSAW 1
#define INV_MACE     2
#define INV_2X4      3
#define INV_WRENCH   4
#define INV_BOOT     5
#define INV_HAND     6
#define INV_DUST     7

#define EN_ROTT1     0 // rottwheeler
#define EN_ROTT2     1 // rottwheeler
#define EN_ROTT3     2 // rottwheeler
#define EN_VULTF1    3 // vulture (redhead female1)
#define EN_VULTM1    4 // vulture (male with glasses)
#define EN_VULTF2    5 // vulture (redhead female2)
#define EN_VULTM2    6 // vulture (initialized as rottwheeler) (male)
#define EN_CAVEFISH  7 // Cavefish Maximum Fish
#define EN_TORQUE    8 // Father Torque
#define EN_ENEMY9    9 // default, used only with handler

class Insane {
 public:
	Insane(ScummEngine *scumm);
	~Insane();

	void setSmushParams(int speed, bool subtitles);
	void runScene(int arraynum);

	void procPreRendering(void);
	void procPostRendering(byte *renderBitmap, int32 codecparam, int32 setupsan12,
						   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void escapeKeyHandler(void);

 private:
	
	ScummEngine *_scumm;
	SmushPlayer *_player;
	
	int32 _speed;
	bool _subtitles;
	bool _insaneIsRunning;
	
	int32 _numberArray;
   	int32 _emulTimerId;
	int32 _emulateInterrupt;
	byte _errbuf[0x7d0];
	int32 _flag1d;
	int32 _mainTimerId;
	int32 _objArray1Idx;
	int32 _objArray1Idx2;
	int32 _objArray1[101];
	int32 _objArray2Idx;
	int32 _objArray2Idx2;
	int32 _objArray2[101];
	byte _currSceneId;
	int32 _timer1Flag;
	int32 _timer3Id;
	int32 _timer4Id;
	int32 _timer6Id;
	int32 _timer7Id;
	int32 _timerSpriteId;
	byte _temp2SceneId;
	byte _tempSceneId;
	int32 _currEnemy;
	int32 _currScenePropIdx;
	int32 _currScenePropSubIdx;
	char *_currTrsMsg;
	int16 _sceneData2Loaded;
	int16 _sceneData1Loaded;
	int16 _keyboardDisable;
	bool _needSceneSwitch;
	int32 _idx2Exceeded;
	bool _memoryAllocatedNotOK;
	int32 _lastKey;
	int32 _val4_;
	int32 _val8d;
	byte _val10b;
	int32 _val11d;
	int32 _val20d;
	int32 _val32d;
	int32 _val39d;
	int32 _val50d;
	int32 _val51d;
	int32 _val52d;
	int32 _val53d;
	int32 _val54d;
	int32 _val55d;
	int32 _val56d;
	int32 _val57d;
	int16 _val109w;
	int16 _val110w;
	int16 _val111w;
	int16 _val112w;
	int32 _val113d;
	int32 _val114d16[16];
	int16 _val115w;
	int16 _val116w;
	bool _val118_;
	bool _val119_;
	bool _val120_;
	bool _val121_;
	bool _val122_;
	bool _val123_;
	bool _val124_;
	bool _val127_;
	int32 _val128d;
	bool _val129_;
	byte _val130b;
	int16 _val131w;
	int16 _val132w;
	int16 _val133w;
	int16 _val134w;
	int16 _val135w;
	int16 _val136w;
	byte _val140b;
	int16 _val141w;
	int16 _val142w;
	int16 _val143w;
	int16 _val144w;
	int16 _val145w;
	int16 _val146w;
	byte _val150b;
	int16 _val151w;
	int16 _val152w;
	int16 _val153w;
	int16 _val154w;
	int16 _val155w;
	int16 _val156w;
	byte _val160b;
	int16 _val161w;
	int16 _val162w;
	int16 _val163w;
	int16 _val164w;
	int16 _val165w;
	int16 _val166w;
	int16 _val167w;
	int16 _val168w;
	byte _val170b;
	int16 _val171w;
	int16 _val172w;
	int16 _val173w;
	int16 _val174w;
	int16 _val175w;
	int16 _val176w;
	int32 _val180d;
	byte _val181b;
	byte _val182b;
	int32 _val183d;
	int32 _val190d;
	int16 _val191w;
	int32 _val200d;
	int32 _val201d;
	byte _val202b;
	int32 _val210d;
	int32 _val211d;
	int32 _val212_;
	int32 _trsFilePtr; // FIXME: we don't need it
	int32 _smlayer_room;
	int32 _smlayer_room2;
	byte *_smush_roadrashRip; // FIXME: combine them in array
	byte *_smush_roadrsh2Rip;
	byte *_smush_roadrsh3Rip;
	byte *_smush_goglpaltRip;
	byte *_smush_tovista1Flu;
	byte *_smush_tovista2Flu;
	byte *_smush_toranchFlu;
	byte *_smush_minedrivFlu;
	byte *_smush_minefiteFlu;
	byte *_smush_bencutNut;
	byte *_smush_bensgoggNut;
	byte *_smush_iconsNut;
	byte *_smush_icons2Nut;
	bool _smush_isSanFileSetup;
	bool _isBenCut;
	int _smush_smushState;
	bool _smush_isPauseImuse;
	int _continueFrame;
	int _continueFrame1;
	int _counter1;
	int _iactSceneId;
	int _iactSceneId2;
	int _smush_setupsan17;
	int32 _smush_setupsan1;
	int16 _smush_setupsan2;
	int32 _smush_setupsan4;
	int16 _smush_numFrames;
	int16 _smush_frameStep;
	int16 _smush_curFrame;
	int16 _smush_frameNum1;
	int16 _smush_frameNum2;
	byte _smush_earlyFluContents[0x31a];
	int16 _enemyState[9][10];


	struct enemy {
		int32 handler;
		int32 initializer;
		int32 field_8;
		int32 maxdamage;
		int32 field_10;
		int32 weapon;
		int32 sound;
		char  filename[20];
		int32 costume4;
		int32 costume6;
		int32 costume5;
		int16 field_2C;
		int32 field_30;
		int32 field_34;
	};
  
	struct enemy _enemy[9];
  
	struct act {
		int32 actor;
		byte  state;
		int32 room;
		int32 facing;
		int32 speedX;
		int32 frame;
	};
  
	struct fluConf {
		int sceneId;
		byte *fluPtr;
		const char *filenamePtr;
		int startFrame;
		int numFrames;
	};

	struct fluConf _fluConf[21];

	struct sceneProp {
		int32 actor; // main actor number, -1 if not applicable
		int32 sound;
		int32 trsId;
		byte r;
		byte g;
		byte b;
		int32 counter;
		int32 maxCounter;
		int32 index;
	};

	struct sceneProp _sceneProp[139];

	struct actor {
		int32 damage;
		int32 maxdamage;
		int32 field_8;
		int32 field_C;
		int32 speed;
		int32 field_14;
		int32 field_18;
		int32 x;
		int32 y;
		int32 y1;
		int32 x1;
		int32 field_2C;
		int32 field_30;
		int32 field_34;
		int32 field_38;
		bool  dead;
		bool  field_40;
		bool  field_44;
		int32 field_48;
		int32 field_4C;
		int32 scenePropSubIdx;
		int32 field_54;
		int32 runningSound;
		int32 weapon;
		bool inventory[8];
		int32 field_80;
		int32 enemyHandler;
		struct act act[4];
	};

	struct actor _actor[2];

	void initvars(void);
	void readFileToMem(const char *name, byte **buf);
	void startVideo(const char *filename, int num, int argC, int frameRate, int doMainLoop);
	void startVideo1(const char *filename, int num, int argC, int frameRate, 
					 int doMainLoop, byte *fluPtr, int32 numFrames);
	void smush_proc39(void);
	void smush_proc40(void);
	void smush_proc41(void);
	void imuseCode04(void);
	void smush_setupSomething(int x, int y, int flag);
	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);
	int loadSceneData(int scene, int flag, int phase);
	void setSceneCostumes(int sceneId);
	void setupValues(void);
	void setOtherCostumes (void);
	void smlayer_stopSound (int idx);
	int smlayer_loadSound(int id, int flag, int phase);
	int smlayer_loadCostume(int id, int phase);
	void smlayer_setActorCostume(int actornum, int act, int costume);
	void smlayer_putActor(int actornum, int act, int x, int y, byte room);
	void smlayer_setActorLayer(int actornum, int act, int layer);
	void smlayer_setFluPalette(byte *pal, int shut_flag);
	int readArray (int field, int number);
	void setWordInString(int field, int number, int value);
	int smlayer_mainLoop(void);
	void mainLoop(void);
	bool idx1Compare(void);
	bool idx2Compare(void);
	int32 idx1Tweak(void);
	int32 idx2Tweak(void);
	void smush_setToFinish(void);
	void postCase11(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase0(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase17(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase16(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase1(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase2(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase20(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase3(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase5(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase6(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase8(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase9(byte *renderBitmap, int32 codecparam, int32 setupsan12,
				   int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase10(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase12(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase23(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCase14(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCaseAll(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					 int32 setupsan13, int32 curFrame, int32 maxFrame);
	void postCaseMore(byte *renderBitmap, int32 codecparam, int32 setupsan12,
					  int32 setupsan13, int32 curFrame, int32 maxFrame);
	void switchSceneIfNeeded(void);
	int smush_changeState(int state);
	void init_actStruct(int actornum, int actnum, int32 actorval, byte state, 
						  int32 room, int32 facing, int32 speedX, int32 frame);
	void init_enemyStruct(int n, int32 handler, int32 initializer,
							   int32 field_8, int32 maxdamage, int32 field_10,
							   int32 field_14, int32 sound, const char *filename,
							   int32 costume4, int32 costume6, int32 costume5,
							   int16 field_2C, int32 field_30, int32 field_34);
	int32 enemyHandler(int n, int32, int32, int32);
	int32 enemyInitializer(int n, int32, int32, int32);
	int32 enemy0handler(int32, int32, int32);
	int32 enemy0initializer(int32, int32, int32);
	int32 enemy1handler(int32, int32, int32);
	int32 enemy1initializer(int32, int32, int32);
	int32 enemy2handler(int32, int32, int32);
	int32 enemy2initializer(int32, int32, int32);
	int32 enemy3handler(int32, int32, int32);
	int32 enemy3initializer(int32, int32, int32);
	int32 enemy4handler(int32, int32, int32);
	int32 enemy4initializer(int32, int32, int32);
	int32 enemy5handler(int32, int32, int32);
	int32 enemy5initializer(int32, int32, int32);
	int32 enemy6handler(int32, int32, int32);
	int32 enemy6initializer(int32, int32, int32);
	int32 enemy7handler(int32, int32, int32);
	int32 enemy7initializer(int32, int32, int32);
	int32 enemy8handler(int32, int32, int32);
	int32 enemy8initializer(int32, int32, int32);
	int32 enemyDefHandler(int32, int32, int32);
	void IMUSE_shutVolume(void);
	void IMUSE_restoreVolume(void);
	bool smlayer_isSoundRunning(int32 sound);
	bool smlayer_startSound1(int32 sound);
	bool smlayer_startSound2(int32 sound);
	void smlayer_soundSetPan(int32 sound, int32 pan);
	void smlayer_soundSetPriority(int32 sound, int32 priority);
	void smlayer_drawSomething(byte *renderBitmap, int32 codecparam, 
							   int32 arg_8, int32 arg_C, int32 arg_10, byte *nutfileptr, 
							   int32 arg_18, int32 arg_1C, int32 arg_20);
	void smlayer_overrideDrawActorAt(byte *, byte, byte);
	void queueSceneSwitch(int32 sceneId, byte *fluPtr, const char *filename, 
						  int32 arg_C, int32 arg_10, int32 startFrame, int32 numFrames);
	void actorsReaction(bool flag);
	void smush_rewindCurrentSan(int arg_0, int arg_4, int arg_8);
	void 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);
	void init_fluConfStruct(int n, int sceneId, byte *fluPtr, 
							const char *filenamePtr, int startFrame, int numFrames);
	int32 func10(bool flag);
	void func11(int32 arg_0);
	void actor1Reaction(int32 arg_4);
	void actor2Reaction(int32 arg_4);
	void actor3Reaction(int32 arg_4);
	void actor8Reaction(int32 arg_4);
	void checkEnemyDeath(int);
	int32 func5(void);
	void proc12(int arg_0);
	void proc23(int actornum, int arg_4);
	int speedTranslator(int value);
	bool smush_eitherNotStartNewFrame(void);
	void smlayer_setActorFacing(int actornum, int actnum, int frame, int direction);
	int32 weaponMaxRange(int32 actornum);
	int32 weaponMinRange(int32 actornum);
	void switchWeapon(void);
	void prepareScenePropScene(int32 scenePropNum, bool arg_4, bool arg_8);
	int32 calcDamage(bool arg_0, bool arg_4);
	int32 weaponDamage(int32 actornum);
	void proc47(int32 actornum, int32 val);
	int32 func48(void);
	bool actor1StateFlags(int state);
	bool actor0StateFlags1(int state);
	bool actor0StateFlags2(int state);
	bool loadScenePropSounds(int32 scenePropNum);
	void init_scenePropStruct(int32 n, int32 n1, int32 actornum, int32 sound, int32 trsId,
							  byte r, byte g, byte b, int32 counter, int32 maxCounter,
							  int32 index);
	int32 setProperActorState(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);
	void enemyOuchSound(void);
	void smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 step1, 
							   int32 step2, int32 setupsan1, byte *fluPtr, int32 numFrames);
	void smush_setupSanFromStart(const char *filename, int32 setupsan2, int32 step1, 
								 int32 step2, int32 setupsan1);
	void smush_setFrameSteps(int32 step1, int32 step2);
	void smush_setupSanFile(const char *filename, int32 offset);
	int32 smush_func23(bool arg_0);
	void drawSpeedyActor(int32 arg_0);
	void proc59(int32 actornum, int32 actnum, int32 arg_8);
	void proc51(int32 actornum, int32 actnum, int32 arg_8);
	void proc54(int32 actornum, int32 actnum, int32 arg_8);
	void proc55(int32 actornum, int32 actnum, int32 arg_8);
	int32 func60(void);

	void blah(void);

};
} // End of namespace Insane

#endif // INSANE

#endif

Index: smush_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- smush_player.cpp	18 Nov 2003 01:57:00 -0000	1.65
+++ smush_player.cpp	6 Dec 2003 05:47:24 -0000	1.66
@@ -38,6 +38,7 @@
 #include "scumm/smush/smush_font.h"
 #include "scumm/smush/smush_mixer.h"
 #include "scumm/smush/smush_player.h"
+#include "scumm/smush/insane.h"
 
 #include "sound/mixer.h"
 
@@ -243,6 +244,7 @@
 	_soundFrequency = 22050;
 	_speed = speed;
 	_smushProcessFrame = false;
+	_insanity = false;
 }
 
 SmushPlayer::~SmushPlayer() {
@@ -754,6 +756,13 @@
 	uint32 start_time, end_time;
 	start_time = _scumm->_system->get_msecs();
 
+#ifdef INSANE
+	// FIXME: Check either it is proper place for the call
+	if (_insanity) {
+		_scumm->_insane->procPreRendering();
+	}
+#endif
+
 	while (!b.eof()) {
 		Chunk *sub = b.subBlock();
 		if (sub->getSize() & 1) b.seek(1);
@@ -794,6 +803,14 @@
 		delete sub;
 	}
 
+#ifdef INSANE
+	// FIXME: Check either it is proper place for the call
+	//        Check either parameters are valid
+	if (_insanity) {
+		_scumm->_insane->procPostRendering(_dst, 0, 0, 0, _frame, _nbframes-1);
+	}
+#endif
+
 	end_time = _scumm->_system->get_msecs();
 
 	updateScreen();
@@ -825,7 +842,10 @@
 	checkBlock(*sub, TYPE_AHDR);
 	handleAnimHeader(*sub);
 
-	readString(file, directory);
+	if (_insanity)
+		readString("mineroad.trs", directory);
+	else
+		readString(file, directory);
 
 	if (_scumm->_gameId == GID_FT) {
 		if (!(_scumm->_features & GF_DEMO)) {
@@ -945,6 +965,10 @@
 	_updateNeeded = true;
 	end_time = _scumm->_system->get_msecs();
 	debug(4, "Smush stats: updateScreen( %03d )", end_time - start_time);
+}
+
+void SmushPlayer::insanity(bool flag) {
+	_insanity = flag;
 }
 
 void SmushPlayer::play(const char *filename, const char *directory) {

Index: smush_player.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/smush_player.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- smush_player.h	3 Oct 2003 18:33:57 -0000	1.12
+++ smush_player.h	6 Dec 2003 05:47:24 -0000	1.13
@@ -35,6 +35,7 @@
 class StringResource;
 
 class SmushPlayer {
+	friend class Insane;
 private:
 	ScummEngine *_scumm;
 	int _version;
@@ -66,6 +67,7 @@
 	int _width, _height;
 	byte *_dst;
 	bool _updateNeeded;
+	bool _insanity;
 
 	volatile bool _smushProcessFrame;
 
@@ -75,6 +77,10 @@
 
 	void play(const char *filename, const char *directory);
 
+protected:
+	void insanity(bool);
+	void setPalette(const byte *palette);
+
 private:
 	void updatePalette(void);
 	void parseNextFrame();
@@ -82,7 +88,6 @@
 	void deinit();
 	void setupAnim(const char *file, const char *directory);
 	void updateScreen();
-	void setPalette(const byte *palette);
 
 	bool readString(const char *file, const char *directory);
 	void checkBlock(const Chunk &, Chunk::type, uint32 = 0);





More information about the Scummvm-git-logs mailing list