2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2005-04-05 18:08:02 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-04-05 18:08:02 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-09 19:19:54 +00:00
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-04-05 18:08:02 +00:00
|
|
|
*
|
|
|
|
*/
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2005-04-05 18:08:02 +00:00
|
|
|
#ifndef GOB_MULT_H
|
|
|
|
#define GOB_MULT_H
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-02-21 14:22:25 +00:00
|
|
|
#include "gob/video.h"
|
2008-07-12 15:21:38 +00:00
|
|
|
#include "gob/variables.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
class Mult {
|
|
|
|
public:
|
2006-07-09 13:01:15 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
2006-07-09 13:01:15 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_AnimData {
|
2008-04-27 03:19:19 +00:00
|
|
|
int8 animation;
|
2006-11-21 13:28:45 +00:00
|
|
|
uint8 layer;
|
2006-12-14 19:07:43 +00:00
|
|
|
uint8 frame;
|
2006-01-03 23:14:39 +00:00
|
|
|
int8 animType;
|
2008-05-07 02:56:18 +00:00
|
|
|
int8 order;
|
2006-01-03 23:14:39 +00:00
|
|
|
int8 isPaused;
|
|
|
|
int8 isStatic;
|
|
|
|
int8 maxTick;
|
2007-03-20 14:51:57 +00:00
|
|
|
int8 maxFrame;
|
2008-04-30 20:07:33 +00:00
|
|
|
uint8 newLayer;
|
2006-01-03 23:14:39 +00:00
|
|
|
int8 newAnimation;
|
|
|
|
byte intersected;
|
2006-12-14 19:07:43 +00:00
|
|
|
uint8 newCycle;
|
2007-03-20 14:51:57 +00:00
|
|
|
int8 state;
|
|
|
|
int8 nextState;
|
|
|
|
int8 newState;
|
|
|
|
int8 curLookDir;
|
|
|
|
int8 isBusy;
|
|
|
|
int8 pathExistence;
|
|
|
|
int8 destX;
|
|
|
|
int8 destY;
|
|
|
|
int8 framesLeft;
|
|
|
|
int8 stateType;
|
|
|
|
int8 animTypeBak;
|
|
|
|
int8 redrawAnimation;
|
2008-04-30 20:07:33 +00:00
|
|
|
uint8 redrawLayer;
|
2007-03-20 14:51:57 +00:00
|
|
|
uint8 redrawFrame;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-06-07 18:49:20 +00:00
|
|
|
struct Mult_GobState {
|
|
|
|
int16 animation; // .
|
|
|
|
int16 layer; // |- [0]
|
|
|
|
int16 dataCount; // '
|
|
|
|
int8 sndItem; // .
|
|
|
|
uint8 sndFrame; // |
|
|
|
|
int16 freq; // |- [1+]
|
|
|
|
int8 repCount; // |
|
|
|
|
uint8 speaker; // '
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-06-07 18:49:20 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_Object {
|
2008-07-12 15:21:38 +00:00
|
|
|
VariableReference *pPosX;
|
|
|
|
VariableReference *pPosY;
|
2006-01-03 23:14:39 +00:00
|
|
|
Mult_AnimData *pAnimData;
|
|
|
|
int16 tick;
|
|
|
|
int16 lastLeft;
|
|
|
|
int16 lastRight;
|
|
|
|
int16 lastTop;
|
|
|
|
int16 lastBottom;
|
2007-03-20 14:51:57 +00:00
|
|
|
Mult_GobState **goblinStates;
|
2008-04-30 20:07:33 +00:00
|
|
|
uint8 goblinX;
|
|
|
|
uint8 goblinY;
|
|
|
|
uint8 destX;
|
|
|
|
uint8 destY;
|
2007-03-20 14:51:57 +00:00
|
|
|
int8 gobDestX;
|
|
|
|
int8 gobDestY;
|
|
|
|
uint8 nearestWayPoint;
|
|
|
|
uint8 nearestDest;
|
|
|
|
int8 field_22;
|
|
|
|
int8 needRedraw;
|
|
|
|
int8 field_24;
|
|
|
|
int8 field_25;
|
|
|
|
int8 field_26;
|
|
|
|
int8 field_27;
|
|
|
|
int16 newLeft;
|
|
|
|
int16 newTop;
|
|
|
|
int16 newRight;
|
|
|
|
int16 newBottom;
|
2008-04-27 03:19:19 +00:00
|
|
|
uint32 videoSlot;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_StaticKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 layer;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_AnimKey {
|
2007-07-24 06:11:38 +00:00
|
|
|
uint16 frame;
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 layer;
|
|
|
|
int16 posX;
|
|
|
|
int16 posY;
|
|
|
|
int16 order;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_TextKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 cmd;
|
2007-03-20 14:51:57 +00:00
|
|
|
char unknown[18];
|
2007-04-02 11:05:09 +00:00
|
|
|
byte script[6];
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_PalKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 cmd;
|
|
|
|
int16 rates[4];
|
|
|
|
int16 unknown0;
|
|
|
|
int16 unknown1;
|
|
|
|
int8 subst[16][4];
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_PalFadeKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 fade;
|
|
|
|
int16 palIndex;
|
|
|
|
int8 flag;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_SndKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 cmd;
|
|
|
|
int16 freq;
|
2007-01-31 13:17:50 +00:00
|
|
|
int16 fadeLength;
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 repCount;
|
|
|
|
int16 resId;
|
|
|
|
int16 soundIndex;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-06-10 14:37:48 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
struct Mult_ImdKey {
|
2006-06-10 14:37:48 +00:00
|
|
|
int16 frame;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 imdFile;
|
2006-06-10 14:37:48 +00:00
|
|
|
int16 field_4;
|
|
|
|
int16 field_6;
|
2007-03-20 14:51:57 +00:00
|
|
|
uint16 flags;
|
2007-03-30 17:52:31 +00:00
|
|
|
int16 palFrame;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 lastFrame;
|
|
|
|
int8 palStart;
|
|
|
|
int8 palEnd;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-06-10 14:37:48 +00:00
|
|
|
|
2007-02-05 14:08:50 +00:00
|
|
|
struct Mult_Data {
|
|
|
|
int16 palFadeKeysCount;
|
|
|
|
Mult_PalFadeKey *palFadeKeys;
|
|
|
|
|
|
|
|
int16 palKeysCount;
|
|
|
|
Mult_PalKey *palKeys;
|
|
|
|
|
|
|
|
int16 staticKeysCount;
|
|
|
|
Mult_StaticKey *staticKeys;
|
|
|
|
int16 staticIndices[10];
|
2007-03-20 14:51:57 +00:00
|
|
|
bool staticLoaded[10];
|
|
|
|
uint8 staticCount;
|
2007-02-05 14:08:50 +00:00
|
|
|
|
|
|
|
int16 animKeysCount[4];
|
|
|
|
Mult_AnimKey *animKeys[4];
|
|
|
|
int16 animIndices[10];
|
2007-03-20 14:51:57 +00:00
|
|
|
uint8 animCount;
|
2007-02-05 14:08:50 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
bool animLoaded[10];
|
2007-02-05 14:08:50 +00:00
|
|
|
int16 animKeysFrames[4];
|
|
|
|
int16 animKeysStartFrames[4];
|
|
|
|
int16 animKeysStopFrames[4];
|
|
|
|
int16 animKeysIndices[4][4];
|
|
|
|
int8 animDirection;
|
|
|
|
|
|
|
|
int16 textKeysCount;
|
|
|
|
Mult_TextKey *textKeys;
|
|
|
|
|
|
|
|
int16 sndKeysCount;
|
|
|
|
Mult_SndKey *sndKeys;
|
|
|
|
|
|
|
|
int16 sndSlotsCount;
|
|
|
|
int16 sndSlot[60];
|
2008-01-27 19:47:41 +00:00
|
|
|
int16 frameRate;
|
2007-02-05 14:08:50 +00:00
|
|
|
|
|
|
|
Video::Color fadePal[5][16];
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 animObjs[4][4];
|
|
|
|
int16 palAnimIndices[4];
|
2007-02-05 14:08:50 +00:00
|
|
|
int16 frameStart;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 imdKeysIndices[4][4];
|
2007-02-05 14:08:50 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 imdKeysCount[4];
|
|
|
|
Mult_ImdKey *imdKeys[4];
|
|
|
|
int16 imdIndices[4];
|
|
|
|
char *imdFiles;
|
2007-02-05 14:08:50 +00:00
|
|
|
char *somepointer10; // ?
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *execPtr;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2007-02-05 14:08:50 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
// Globals
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-02-05 14:08:50 +00:00
|
|
|
Mult_Data *_multData;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 _frame;
|
|
|
|
|
|
|
|
int16 _objCount;
|
2006-01-09 16:10:22 +00:00
|
|
|
Mult_Object *_objects;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 *_renderData;
|
2007-03-20 14:51:57 +00:00
|
|
|
Mult_Object **_renderObjs;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2008-05-07 02:56:18 +00:00
|
|
|
int8 *_orderArray;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
SurfacePtr _animSurf;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 _animLeft;
|
|
|
|
int16 _animTop;
|
|
|
|
int16 _animWidth;
|
|
|
|
int16 _animHeight;
|
|
|
|
|
|
|
|
void initAll();
|
|
|
|
void freeAll();
|
|
|
|
void checkFreeMult();
|
|
|
|
void freeMult();
|
|
|
|
void zeroMultData();
|
|
|
|
void playMult(int16 startFrame, int16 endFrame, char checkEscape,
|
|
|
|
char handleMouse);
|
|
|
|
|
2008-05-04 02:26:25 +00:00
|
|
|
void clearObjectVideos();
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void loadMult(int16 resId) = 0;
|
|
|
|
virtual void freeMultKeys() = 0;
|
2007-07-24 06:11:38 +00:00
|
|
|
virtual bool hasMultData(uint16 multIndex) = 0;
|
|
|
|
virtual void setMultData(uint16 multIndex) = 0;
|
|
|
|
virtual void zeroMultData(uint16 multIndex) = 0;
|
|
|
|
virtual void multSub(uint16 multIndex) = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void animate() = 0;
|
|
|
|
|
|
|
|
Mult(GobEngine *vm);
|
|
|
|
virtual ~Mult();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int16 _index;
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _counter;
|
2007-03-20 14:51:57 +00:00
|
|
|
bool _animDataAllocated;
|
|
|
|
|
|
|
|
Mult_Data *_multDatas[8];
|
|
|
|
|
|
|
|
bool _doPalSubst;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
Variables *_animArrayX;
|
|
|
|
Variables *_animArrayY;
|
2006-01-09 16:10:22 +00:00
|
|
|
Mult_AnimData *_animArrayData;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _palKeyIndex;
|
|
|
|
Video::Color *_oldPalette;
|
|
|
|
Video::Color _palAnimPalette[256];
|
|
|
|
int16 _palAnimKey;
|
|
|
|
int16 _palAnimRed[4];
|
|
|
|
int16 _palAnimGreen[4];
|
|
|
|
int16 _palAnimBlue[4];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
char _palFadingRed;
|
|
|
|
char _palFadingGreen;
|
|
|
|
char _palFadingBlue;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
GobEngine *_vm;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void drawText(bool &stop, bool &stopNoClear);
|
|
|
|
void prepPalAnim(bool &stop);
|
|
|
|
void doPalAnim();
|
|
|
|
void doFadeAnim(bool &stop);
|
|
|
|
void doSoundAnim(bool &stop, int16 frame);
|
|
|
|
|
|
|
|
virtual void playMultInit() = 0;
|
|
|
|
virtual void drawStatics(bool &stop) = 0;
|
|
|
|
virtual void drawAnims(bool &stop) = 0;
|
|
|
|
virtual void newCycleAnim(Mult_Object &animObj) = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-02-21 14:22:25 +00:00
|
|
|
class Mult_v1 : public Mult {
|
|
|
|
public:
|
|
|
|
Mult_v1(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Mult_v1() {}
|
2006-02-21 14:22:25 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void loadMult(int16 resId);
|
|
|
|
virtual void freeMultKeys();
|
2007-07-24 06:11:38 +00:00
|
|
|
virtual bool hasMultData(uint16 multIndex);
|
|
|
|
virtual void setMultData(uint16 multIndex);
|
|
|
|
virtual void zeroMultData(uint16 multIndex);
|
|
|
|
virtual void multSub(uint16 multIndex);
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void animate();
|
2006-04-12 09:49:08 +00:00
|
|
|
|
|
|
|
protected:
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void playMultInit();
|
|
|
|
virtual void drawStatics(bool &stop);
|
|
|
|
virtual void drawAnims(bool &stop);
|
|
|
|
virtual void newCycleAnim(Mult_Object &animObj);
|
2006-02-21 14:22:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Mult_v2 : public Mult_v1 {
|
|
|
|
public:
|
|
|
|
Mult_v2(GobEngine *vm);
|
2006-05-31 08:44:14 +00:00
|
|
|
virtual ~Mult_v2();
|
2006-02-21 14:22:25 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void loadMult(int16 resId);
|
|
|
|
virtual void freeMultKeys();
|
2007-07-24 06:11:38 +00:00
|
|
|
virtual bool hasMultData(uint16 multIndex);
|
|
|
|
virtual void setMultData(uint16 multIndex);
|
|
|
|
virtual void zeroMultData(uint16 multIndex);
|
|
|
|
virtual void multSub(uint16 multIndex);
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void animate();
|
2006-04-12 09:49:08 +00:00
|
|
|
|
|
|
|
protected:
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void playMultInit();
|
|
|
|
virtual void drawStatics(bool &stop);
|
|
|
|
virtual void drawAnims(bool &stop);
|
|
|
|
virtual void newCycleAnim(Mult_Object &animObj);
|
|
|
|
|
|
|
|
void loadImds(Common::SeekableReadStream &data);
|
2007-04-02 11:05:09 +00:00
|
|
|
void playImd(const char *imdFile, Mult_ImdKey &key, int16 dir, int16 startFrame);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
void advanceObjects(int16 index);
|
|
|
|
void advanceAllObjects();
|
2006-02-21 14:22:25 +00:00
|
|
|
};
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
} // End of namespace Gob
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
#endif // GOB_MULT_H
|