2005-04-05 18:08:02 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2004 Ivan Dubrov
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2004-2006 The ScummVM project
|
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
|
|
|
|
* 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
|
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
|
|
|
*
|
2006-02-11 10:11:37 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
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-05-29 18:24:52 +00:00
|
|
|
#include "gob/gob.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/sound.h"
|
2006-02-21 14:22:25 +00:00
|
|
|
#include "gob/video.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
class Mult {
|
|
|
|
public:
|
2005-04-05 15:07:40 +00:00
|
|
|
#pragma START_PACK_STRUCTS
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_AnimData {
|
2006-01-03 23:14:39 +00:00
|
|
|
int8 animation;
|
|
|
|
int8 layer;
|
|
|
|
int8 frame;
|
|
|
|
int8 animType;
|
|
|
|
int8 order;
|
|
|
|
int8 isPaused;
|
|
|
|
int8 isStatic;
|
|
|
|
int8 maxTick;
|
|
|
|
int8 unknown;
|
|
|
|
int8 newLayer;
|
|
|
|
int8 newAnimation;
|
|
|
|
byte intersected;
|
|
|
|
int8 newCycle;
|
2006-05-11 19:43:30 +00:00
|
|
|
int8 state; // New in GOB2
|
2006-06-07 18:49:20 +00:00
|
|
|
int8 nextState; // New in GOB2
|
2006-04-12 09:49:08 +00:00
|
|
|
int8 field_F; // New in GOB2
|
2006-06-07 18:49:20 +00:00
|
|
|
int8 curLookDir; // New in GOB2
|
2006-06-10 14:37:48 +00:00
|
|
|
int8 isBusy; // New in GOB2
|
2006-06-07 18:49:20 +00:00
|
|
|
int8 pathExistence; // New in GOB2
|
2006-05-11 19:43:30 +00:00
|
|
|
int8 field_13; // New in GOB2
|
|
|
|
int8 field_14; // New in GOB2
|
|
|
|
int8 field_15; // New in GOB2
|
2006-06-07 18:49:20 +00:00
|
|
|
int8 field_16; // New in GOB2
|
2006-05-11 19:43:30 +00:00
|
|
|
int8 field_17; // New in GOB2
|
2006-06-10 14:37:48 +00:00
|
|
|
int8 somethingAnimation; // New in GOB2
|
|
|
|
int8 somethingLayer; // New in GOB2
|
|
|
|
int8 somethingFrame; // New in GOB2
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
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; // '
|
|
|
|
};
|
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_Object {
|
2006-01-03 23:14:39 +00:00
|
|
|
int32 *pPosX;
|
|
|
|
int32 *pPosY;
|
|
|
|
Mult_AnimData *pAnimData;
|
|
|
|
int16 tick;
|
|
|
|
int16 lastLeft;
|
|
|
|
int16 lastRight;
|
|
|
|
int16 lastTop;
|
|
|
|
int16 lastBottom;
|
2006-06-07 18:49:20 +00:00
|
|
|
int8 someFlag; // New in GOB2
|
|
|
|
int16 somethingLeft; // New in GOB2
|
|
|
|
int16 somethingTop; // New in GOB2
|
|
|
|
int16 somethingRight; // New in GOB2
|
|
|
|
int16 somethingBottom; // New in GOB2
|
|
|
|
int8 goblinX; // New in GOB2
|
|
|
|
int8 goblinY; // New in GOB2
|
|
|
|
int8 destX; // New in GOB2
|
|
|
|
int8 destY; // New in GOB2
|
|
|
|
int8 gobDestX; // New in GOB2
|
|
|
|
int8 gobDestY; // New in GOB2
|
|
|
|
int8 nearestWayPoint; // New in GOB2
|
|
|
|
int8 nearestDest; // New in GOB2
|
|
|
|
Mult::Mult_GobState **goblinStates; // New in GOB2
|
2006-01-29 02:27:10 +00:00
|
|
|
};
|
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;
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Mult_AnimKey {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 frame;
|
|
|
|
int16 layer;
|
|
|
|
int16 posX;
|
|
|
|
int16 posY;
|
|
|
|
int16 order;
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
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;
|
|
|
|
int16 unknown0[9];
|
|
|
|
int16 index;
|
|
|
|
int16 unknown1[2];
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
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];
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
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;
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
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;
|
|
|
|
int16 channel;
|
|
|
|
int16 repCount;
|
|
|
|
int16 resId;
|
|
|
|
int16 soundIndex;
|
2006-01-29 02:27:10 +00:00
|
|
|
} GCC_PACK;
|
2006-06-10 14:37:48 +00:00
|
|
|
|
|
|
|
struct Mult_SomeKey {
|
|
|
|
int16 frame;
|
|
|
|
int16 field_2;
|
|
|
|
int16 field_4;
|
|
|
|
int16 field_6;
|
|
|
|
int16 field_8;
|
|
|
|
int16 field_A;
|
|
|
|
int16 field_C;
|
|
|
|
int16 field_E;
|
|
|
|
} GCC_PACK;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
#pragma END_PACK_STRUCTS
|
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
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
Mult_Object *_objects;
|
|
|
|
int16 *_renderData;
|
2006-04-12 09:49:08 +00:00
|
|
|
Mult_Object **_renderData2;
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _objCount;
|
|
|
|
Video::SurfaceDesc *_underAnimSurf;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
char *_multData;
|
|
|
|
int16 _frame;
|
|
|
|
char _doPalSubst;
|
|
|
|
int16 _counter;
|
|
|
|
int16 _frameRate;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
int32 *_animArrayX;
|
|
|
|
int32 *_animArrayY;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
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 _index;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
// Static keys
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _staticKeysCount;
|
|
|
|
Mult_StaticKey *_staticKeys;
|
|
|
|
int16 _staticIndices[10];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Anim keys
|
2006-01-09 16:10:22 +00:00
|
|
|
Mult_AnimKey *_animKeys[4];
|
|
|
|
int16 _animKeysCount[4];
|
|
|
|
int16 _animLayer;
|
|
|
|
int16 _animIndices[10];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Text keys
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _textKeysCount;
|
|
|
|
Mult_TextKey *_textKeys;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _frameStart;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Palette keys
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _palKeyIndex;
|
|
|
|
int16 _palKeysCount;
|
|
|
|
Mult_PalKey *_palKeys;
|
|
|
|
Video::Color *_oldPalette;
|
|
|
|
Video::Color _palAnimPalette[256];
|
|
|
|
int16 _palAnimKey;
|
|
|
|
int16 _palAnimIndices[4];
|
|
|
|
int16 _palAnimRed[4];
|
|
|
|
int16 _palAnimGreen[4];
|
|
|
|
int16 _palAnimBlue[4];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Palette fading
|
2006-01-09 16:10:22 +00:00
|
|
|
Mult_PalFadeKey *_palFadeKeys;
|
|
|
|
int16 _palFadeKeysCount;
|
|
|
|
char _palFadingRed;
|
|
|
|
char _palFadingGreen;
|
|
|
|
char _palFadingBlue;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
char _animDataAllocated;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-09 16:10:22 +00:00
|
|
|
char *_dataPtr;
|
|
|
|
int16 _staticLoaded[10];
|
|
|
|
int16 _animLoaded[10];
|
|
|
|
int16 _sndSlotsCount;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Sound keys
|
2006-01-09 16:10:22 +00:00
|
|
|
int16 _sndKeysCount;
|
|
|
|
Mult_SndKey *_sndKeys;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-04-12 09:49:08 +00:00
|
|
|
int8 *_orderArray;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void zeroMultData(void);
|
|
|
|
void checkFreeMult(void);
|
|
|
|
void interGetObjAnimSize(void);
|
|
|
|
void freeAll(void);
|
|
|
|
void initAll(void);
|
|
|
|
|
2006-02-24 21:58:03 +00:00
|
|
|
virtual void setMultData(uint16 multindex) = 0;
|
2006-05-01 16:04:53 +00:00
|
|
|
virtual void multSub(uint16 multindex) = 0;
|
2006-02-21 14:22:25 +00:00
|
|
|
virtual void loadMult(int16 resId) = 0;
|
2006-04-12 09:49:08 +00:00
|
|
|
virtual void playMult(int16 startFrame, int16 endFrame, char checkEscape,
|
|
|
|
char handleMouse) = 0;
|
|
|
|
virtual void animate(void) = 0;
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount,
|
|
|
|
int16 freq, int16 channel) = 0;
|
2006-06-10 14:37:48 +00:00
|
|
|
virtual void freeMult(void) = 0;
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void freeMultKeys(void) = 0;
|
2006-02-21 14:22:25 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
Mult(GobEngine *vm);
|
2006-02-21 14:22:25 +00:00
|
|
|
virtual ~Mult() {};
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
protected:
|
2006-01-09 16:10:22 +00:00
|
|
|
Video::Color _fadePal[5][16];
|
2006-01-03 23:14:39 +00:00
|
|
|
GobEngine *_vm;
|
|
|
|
|
2006-04-12 09:49:08 +00:00
|
|
|
virtual char drawStatics(char stop) = 0;
|
|
|
|
virtual char drawAnims(char stop) = 0;
|
|
|
|
virtual void drawText(char *pStop, char *pStopNoClear) = 0;
|
|
|
|
virtual char prepPalAnim(char stop) = 0;
|
|
|
|
virtual void doPalAnim(void) = 0;
|
|
|
|
virtual char doFadeAnim(char stop) = 0;
|
2006-05-11 19:43:30 +00:00
|
|
|
virtual char doSoundAnim(char stop, int16 frame) = 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);
|
|
|
|
virtual ~Mult_v1() {};
|
|
|
|
|
2006-02-24 21:58:03 +00:00
|
|
|
virtual void setMultData(uint16 multindex);
|
2006-05-01 16:04:53 +00:00
|
|
|
virtual void multSub(uint16 multindex);
|
2006-02-21 14:22:25 +00:00
|
|
|
virtual void loadMult(int16 resId);
|
2006-04-12 09:49:08 +00:00
|
|
|
virtual void playMult(int16 startFrame, int16 endFrame, char checkEscape,
|
|
|
|
char handleMouse);
|
|
|
|
virtual void animate(void);
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount,
|
|
|
|
int16 freq, int16 channel);
|
2006-06-10 14:37:48 +00:00
|
|
|
virtual void freeMult(void);
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void freeMultKeys(void);
|
2006-04-12 09:49:08 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual char drawStatics(char stop);
|
|
|
|
virtual char drawAnims(char stop);
|
|
|
|
virtual void drawText(char *pStop, char *pStopNoClear);
|
|
|
|
virtual char prepPalAnim(char stop);
|
|
|
|
virtual void doPalAnim(void);
|
|
|
|
virtual char doFadeAnim(char stop);
|
2006-05-11 19:43:30 +00:00
|
|
|
virtual char doSoundAnim(char stop, int16 frame);
|
2006-02-21 14:22:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Mult_v2 : public Mult_v1 {
|
|
|
|
public:
|
|
|
|
#pragma START_PACK_STRUCTS
|
|
|
|
struct Mult_Data {
|
|
|
|
int16 palFadeKeysCount;
|
|
|
|
Mult_PalFadeKey *palFadeKeys;
|
|
|
|
|
|
|
|
int16 palKeysCount;
|
|
|
|
Mult_PalKey *palKeys;
|
|
|
|
|
|
|
|
int16 staticKeysCount;
|
|
|
|
Mult_StaticKey *staticKeys;
|
|
|
|
int8 staticCount;
|
|
|
|
int16 staticIndices[10];
|
|
|
|
int16 staticLoaded[10];
|
|
|
|
|
|
|
|
int16 animKeysCount[4];
|
|
|
|
Mult_AnimKey *animKeys[4];
|
|
|
|
int8 animCount;
|
|
|
|
int16 animIndices[10];
|
|
|
|
int16 animLoaded[10];
|
2006-06-12 10:55:53 +00:00
|
|
|
int16 animKeysFrames[4];
|
|
|
|
int16 someKeysFrames[4];
|
2006-02-21 14:22:25 +00:00
|
|
|
|
|
|
|
int16 textKeysCount;
|
|
|
|
Mult_TextKey *textKeys;
|
|
|
|
|
|
|
|
int16 sndKeysCount;
|
|
|
|
Mult_SndKey *sndKeys;
|
|
|
|
|
|
|
|
int16 sndSlotsCount;
|
2006-02-24 21:58:03 +00:00
|
|
|
int16 sndSlot[60];
|
2006-02-21 14:22:25 +00:00
|
|
|
int16 frameRate;
|
|
|
|
|
|
|
|
Video::Color fadePal[5][16];
|
2006-04-12 09:49:08 +00:00
|
|
|
int16 field_124[4][4]; // Not sure here either
|
2006-02-21 14:22:25 +00:00
|
|
|
int16 palAnimIndices[4]; // Not sure here either
|
|
|
|
int16 frameStart;
|
|
|
|
|
|
|
|
int8 field_156;
|
|
|
|
int16 field_157[4];
|
|
|
|
int16 field_15F[4][4];
|
|
|
|
int16 field_17F[4][4];
|
|
|
|
|
2006-06-10 14:37:48 +00:00
|
|
|
int16 someKeysCount[4];
|
|
|
|
Mult_SomeKey *someKeys[4];
|
|
|
|
int16 someKeysIndices[4];
|
2006-02-21 14:22:25 +00:00
|
|
|
char *somepointer09; // ?
|
|
|
|
char *somepointer10; // ?
|
|
|
|
char *execPtr;
|
|
|
|
} GCC_PACK;
|
|
|
|
#pragma END_PACK_STRUCTS
|
|
|
|
|
|
|
|
Mult_Data *_multData2; // TODO: This'll be _multData once every function using it
|
|
|
|
// in GOB2 is done
|
|
|
|
// TODO: Maybe changing Mult_v1::_multData to struct Mult_Data as well?
|
|
|
|
// Could help minimizing code dup...
|
|
|
|
Mult_Data *_multDatas[8];
|
|
|
|
|
|
|
|
Mult_v2(GobEngine *vm);
|
2006-05-31 08:44:14 +00:00
|
|
|
virtual ~Mult_v2();
|
2006-02-21 14:22:25 +00:00
|
|
|
|
2006-02-24 21:58:03 +00:00
|
|
|
virtual void setMultData(uint16 multindex);
|
2006-05-01 16:04:53 +00:00
|
|
|
virtual void multSub(uint16 multindex);
|
2006-02-21 14:22:25 +00:00
|
|
|
virtual void loadMult(int16 resId);
|
2006-04-12 09:49:08 +00:00
|
|
|
virtual void playMult(int16 startFrame, int16 endFrame, char checkEscape,
|
|
|
|
char handleMouse);
|
|
|
|
virtual void animate(void);
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount,
|
|
|
|
int16 freq, int16 channel);
|
2006-06-10 14:37:48 +00:00
|
|
|
virtual void freeMult(void);
|
2006-04-13 16:25:07 +00:00
|
|
|
virtual void freeMultKeys(void);
|
2006-04-12 09:49:08 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual char drawStatics(char stop);
|
|
|
|
virtual char drawAnims(char stop);
|
|
|
|
virtual void drawText(char *pStop, char *pStopNoClear);
|
|
|
|
virtual char prepPalAnim(char stop);
|
|
|
|
virtual void doPalAnim(void);
|
|
|
|
virtual char doFadeAnim(char stop);
|
2006-05-11 19:43:30 +00:00
|
|
|
virtual char doSoundAnim(char stop, int16 frame);
|
2006-04-12 09:49:08 +00:00
|
|
|
|
|
|
|
void sub_62DD(int16 index);
|
|
|
|
void sub_6A35(void);
|
2006-06-07 18:49:20 +00:00
|
|
|
void sub_10C87(Mult_Object *obj);
|
2006-02-21 14:22:25 +00:00
|
|
|
};
|
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
} // End of namespace Gob
|
|
|
|
|
|
|
|
#endif /* __MULT_H */
|