2012-04-29 13:19:30 +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.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2012-05-14 05:43:50 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on original Tony Tough source code
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997-2003 Nayma Software
|
|
|
|
*/
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
#ifndef TONY_LOC_H
|
|
|
|
#define TONY_LOC_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2012-04-29 23:27:12 +00:00
|
|
|
#include "common/system.h"
|
2012-05-02 14:49:59 +00:00
|
|
|
#include "common/file.h"
|
2012-04-29 23:27:12 +00:00
|
|
|
#include "tony/sound.h"
|
|
|
|
#include "tony/utils.h"
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
namespace Tony {
|
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
/****************************************************************************\
|
|
|
|
* Various defines
|
|
|
|
\****************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Valid colour modes
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
CM_256,
|
|
|
|
CM_65K
|
|
|
|
} RMColorMode;
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************\
|
|
|
|
* Class declarations
|
|
|
|
\****************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic palette
|
|
|
|
*/
|
|
|
|
class RMPalette {
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
byte _data[1024];
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMPalette &pal);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sound effect of an object
|
|
|
|
*/
|
|
|
|
class RMSfx {
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMString _name;
|
|
|
|
FPSFX *_fx;
|
|
|
|
bool _bPlayingLoop;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMSfx();
|
|
|
|
virtual ~RMSfx();
|
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMSfx &sfx);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void play(bool bLoop = false);
|
|
|
|
void setVolume(int vol);
|
|
|
|
void pause(bool bPause);
|
|
|
|
void stop(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds, bool bLOX = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Object pattern
|
|
|
|
*/
|
|
|
|
class RMPattern {
|
|
|
|
public:
|
|
|
|
// Type of slot
|
|
|
|
enum RMSlotType {
|
|
|
|
DUMMY1 = 0,
|
|
|
|
DUMMY2,
|
|
|
|
SPRITE,
|
|
|
|
SOUND,
|
|
|
|
COMMAND,
|
|
|
|
SPECIAL
|
|
|
|
};
|
|
|
|
|
|
|
|
// Class slot
|
|
|
|
class RMSlot {
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint _pos; // Child co-ordinates
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMSlotType _type;
|
|
|
|
int _data;
|
|
|
|
byte _flag;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMSlot &slot);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint pos() {
|
|
|
|
return _pos;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds, bool bLOX = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMString _name;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
int _speed;
|
|
|
|
RMPoint _pos; // Parent coordinates
|
|
|
|
RMPoint _curPos; // Parent + child coordinates
|
|
|
|
int _bLoop;
|
|
|
|
int _nSlots;
|
|
|
|
int _nCurSlot;
|
|
|
|
int _nCurSprite;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
RMSlot *_slots;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
uint32 _nStartTime;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMPattern();
|
|
|
|
virtual ~RMPattern();
|
2012-05-21 21:53:13 +00:00
|
|
|
|
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMPattern &pat);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// A warning that the pattern now and the current
|
2012-06-07 05:58:01 +00:00
|
|
|
int init(RMSfx *sfx, bool bPlayP0 = false, byte *bFlag = NULL);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
// Update the pattern, checking to see if it's time to change slot and executing
|
2012-04-29 23:27:12 +00:00
|
|
|
// any associated commands
|
2012-06-07 05:58:01 +00:00
|
|
|
int update(uint32 hEndPattern, byte &bFlag, RMSfx *sfx);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Stop a sound effect
|
2012-06-07 05:58:01 +00:00
|
|
|
void stopSfx(RMSfx *sfx);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Reads the position of the pattern
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint pos() {
|
|
|
|
return _curPos;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds, bool bLOX = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
void updateCoord(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sprite (frame) animation of an item
|
|
|
|
*/
|
|
|
|
class RMSprite : public RMGfxTask {
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMString _name;
|
|
|
|
RMRect _rcBox;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
protected:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMGfxSourceBuffer *_buf;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMSprite();
|
|
|
|
virtual ~RMSprite();
|
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void init(RMGfxSourceBuffer *buf);
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMSprite &sprite);
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-06-07 05:58:01 +00:00
|
|
|
void setPalette(byte *lpBuf);
|
|
|
|
void getSizeFromStream(RMDataStream &ds, int *dimx, int *dimy);
|
2012-05-21 21:53:13 +00:00
|
|
|
void LOXGetSizeFromStream(RMDataStream &ds, int *dimx, int *dimy);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds, bool bLOX = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Data on an item
|
|
|
|
*/
|
|
|
|
class RMItem : public RMGfxTask {
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMString _name;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
protected:
|
2012-06-07 05:58:01 +00:00
|
|
|
int _z;
|
|
|
|
RMPoint _pos; // Coordinate nonno
|
|
|
|
RMColorMode _cm;
|
|
|
|
RMPoint _curScroll;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
byte _FX;
|
|
|
|
byte _FXparm;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
virtual int getCurPattern() {
|
|
|
|
return _nCurPattern;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
int _nCurPattern;
|
|
|
|
int _mpalCode;
|
|
|
|
RMPoint _hot;
|
|
|
|
RMRect _rcBox;
|
|
|
|
int _nSprites, _nSfx, _nPatterns;
|
|
|
|
byte _bPal;
|
|
|
|
RMPalette _pal;
|
|
|
|
|
|
|
|
RMSprite *_sprites;
|
|
|
|
RMSfx *_sfx;
|
|
|
|
RMPattern *_patterns;
|
|
|
|
|
|
|
|
byte _bCurFlag;
|
|
|
|
int _nCurSprite;
|
|
|
|
bool _bIsActive;
|
|
|
|
uint32 _hEndPattern;
|
|
|
|
bool _bInitCurPattern;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint calculatePos(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMItem();
|
|
|
|
virtual ~RMItem();
|
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMItem &item);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Process to make the object move on any animations.
|
|
|
|
// Returns TRUE if it should be redrawn on the next frame
|
2012-06-05 23:37:06 +00:00
|
|
|
bool doFrame(RMGfxTargetBuffer *bigBuf, bool bAddToList = true);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Sets the current scrolling position
|
2012-06-07 05:58:01 +00:00
|
|
|
void setScrollPosition(const RMPoint &scroll);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Overloading of check whether to remove from active list
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual void removeThis(CORO_PARAM, bool &result);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Overloaded Draw
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Overloaded priority: it's based on Z ordering
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual int priority() {
|
2012-06-07 05:58:01 +00:00
|
|
|
return _z;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Pattern number
|
2012-06-07 05:58:01 +00:00
|
|
|
int numPattern() {
|
|
|
|
return _nPatterns;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Set anew animation pattern, changing abruptly from the current
|
2012-06-07 05:58:01 +00:00
|
|
|
virtual void setPattern(int nPattern, bool bPlayP0 = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Set a new status
|
2012-06-07 05:58:01 +00:00
|
|
|
void setStatus(int nStatus);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
bool isIn(const RMPoint &pt, int *size = NULL);
|
|
|
|
RMPoint hotspot() {
|
|
|
|
return _hot;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-06-07 05:58:01 +00:00
|
|
|
bool getName(RMString &name);
|
|
|
|
int mpalCode() {
|
|
|
|
return _mpalCode;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Unload
|
2012-06-07 05:58:01 +00:00
|
|
|
void unload(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Wait for the end of the current pattern
|
2012-06-07 05:58:01 +00:00
|
|
|
void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Sets a new hotspot fro the object
|
2012-06-07 05:58:01 +00:00
|
|
|
void changeHotspot(const RMPoint &pt);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void setInitCurPattern(bool status) {
|
|
|
|
_bInitCurPattern = status;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void playSfx(int nSfx);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds, bool bLOX = false);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void pauseSound(bool bPause);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
protected:
|
2012-05-20 03:54:59 +00:00
|
|
|
// Create a primitive that has as it's task this item
|
2012-06-07 05:58:01 +00:00
|
|
|
virtual RMGfxPrimitive *newItemPrimitive();
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Allocate memory for the sprites
|
2012-06-07 05:58:01 +00:00
|
|
|
virtual RMGfxSourceBuffer *newItemSpriteBuffer(int dimx, int dimy, bool bPreRLE);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
#define MAXBOXES 50 // Maximum number of allowed boxes
|
|
|
|
#define MAXHOTSPOT 20 // Maximum nimber of allowed hotspots
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
class RMBox {
|
|
|
|
public:
|
|
|
|
struct T_HOTSPOT {
|
2012-06-10 21:56:37 +00:00
|
|
|
int _hotx, _hoty; // Hotspot coordinates
|
|
|
|
int _destination; // Hotspot destination
|
2012-04-29 13:19:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2012-06-10 21:56:37 +00:00
|
|
|
int _left, _top, _right, _bottom; // Vertici bounding boxes
|
|
|
|
int _adj[MAXBOXES]; // List of adjacent bounding boxes
|
|
|
|
int _numHotspot; // Hotspot number
|
|
|
|
uint8 _destZ; // Z value for the bounding box
|
|
|
|
T_HOTSPOT _hotspot[MAXHOTSPOT]; // List of hotspots
|
2012-04-29 13:19:30 +00:00
|
|
|
|
2012-06-10 21:56:37 +00:00
|
|
|
bool _attivo;
|
|
|
|
bool _bReversed;
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds);
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
friend RMDataStream &operator>>(RMDataStream &ds, RMBox &box);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RMBoxLoc {
|
|
|
|
public:
|
2012-06-11 20:22:46 +00:00
|
|
|
int _numbBox;
|
2012-06-10 21:56:37 +00:00
|
|
|
RMBox *_boxes;
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
void readFromStream(RMDataStream &ds);
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-05 00:32:43 +00:00
|
|
|
RMBoxLoc();
|
|
|
|
virtual ~RMBoxLoc();
|
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
friend RMDataStream &operator >>(RMDataStream &ds, RMBoxLoc &bl);
|
2012-06-07 05:58:01 +00:00
|
|
|
void recalcAllAdj(void);
|
2012-04-29 13:19:30 +00:00
|
|
|
};
|
|
|
|
|
2012-05-05 00:56:56 +00:00
|
|
|
#define GAME_BOXES_SIZE 200
|
2012-04-29 13:19:30 +00:00
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
class RMGameBoxes {
|
2012-04-29 13:19:30 +00:00
|
|
|
protected:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMBoxLoc *_allBoxes[GAME_BOXES_SIZE];
|
|
|
|
int _nLocBoxes;
|
2012-04-29 13:19:30 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-05 00:56:56 +00:00
|
|
|
RMGameBoxes();
|
|
|
|
~RMGameBoxes();
|
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void init(void);
|
|
|
|
void close(void);
|
2012-04-29 13:19:30 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Get binding boxes for a given location
|
2012-06-07 05:58:01 +00:00
|
|
|
RMBoxLoc *getBoxes(int nLoc);
|
|
|
|
int getLocBoxesCount() const { return _nLocBoxes; }
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Return the box which contains a given point
|
2012-06-07 05:58:01 +00:00
|
|
|
int whichBox(int nLoc, const RMPoint &pt);
|
2012-04-29 13:19:30 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Check whether a point is inside a given box
|
2012-06-07 05:58:01 +00:00
|
|
|
bool isInBox(int nLoc, int nBox, const RMPoint &pt);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Change the status of a box
|
2012-06-07 05:58:01 +00:00
|
|
|
void changeBoxStatus(int nLoc, int nBox, int status);
|
2012-04-29 13:19:30 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Save state handling
|
2012-06-07 05:58:01 +00:00
|
|
|
int getSaveStateSize(void);
|
|
|
|
void saveState(byte *buf);
|
|
|
|
void loadState(byte *buf);
|
2012-04-29 13:19:30 +00:00
|
|
|
};
|
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
class RMCharacter : protected RMItem {
|
|
|
|
public:
|
|
|
|
enum PATTERNS {
|
|
|
|
PAT_STANDUP = 1,
|
|
|
|
PAT_STANDDOWN,
|
|
|
|
PAT_STANDLEFT,
|
|
|
|
PAT_STANDRIGHT,
|
|
|
|
PAT_WALKUP,
|
|
|
|
PAT_WALKDOWN,
|
|
|
|
PAT_WALKLEFT,
|
2012-05-21 21:53:13 +00:00
|
|
|
PAT_WALKRIGHT
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum STATUS {
|
|
|
|
STAND,
|
|
|
|
WALK
|
|
|
|
};
|
|
|
|
|
2012-06-10 21:56:37 +00:00
|
|
|
signed short _walkCount;
|
|
|
|
int _dx, _dy, _olddx, _olddy;
|
|
|
|
float _fx, _fy, _slope;
|
|
|
|
RMPoint _lineStart, _lineEnd, _pathEnd;
|
|
|
|
signed char _walkSpeed, _walkStatus;
|
|
|
|
char _minPath;
|
|
|
|
short _nextBox;
|
|
|
|
short _path[MAXBOXES];
|
|
|
|
short _pathLength, _pathCount;
|
|
|
|
int _curBox;
|
|
|
|
|
|
|
|
STATUS _status;
|
|
|
|
int _curSpeed;
|
|
|
|
bool _bEndOfPath;
|
|
|
|
uint32 _hEndOfPath;
|
|
|
|
OSystem::MutexRef _csMove;
|
|
|
|
int _curLocation;
|
|
|
|
bool _bRemoveFromOT;
|
|
|
|
bool _bMovingWithoutMinpath;
|
|
|
|
RMGameBoxes *_theBoxes;
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint _fixedScroll;
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
int inWhichBox(const RMPoint &pt);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
short findPath(short source, short destination);
|
|
|
|
RMPoint searching(char UP, char DOWN, char RIGHT, char LEFT, RMPoint punto);
|
|
|
|
RMPoint nearestPoint(const RMPoint &punto);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void goTo(CORO_PARAM, RMPoint destcoord, bool bReversed = false);
|
|
|
|
short scanLine(const RMPoint &punto);
|
|
|
|
RMPoint invScanLine(const RMPoint &punto);
|
|
|
|
RMPoint nearestHotSpot(int sourcebox, int destbox);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void newBoxEntered(int nBox);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
protected:
|
2012-06-10 21:56:37 +00:00
|
|
|
bool _bMoving;
|
|
|
|
bool _bDrawNow;
|
|
|
|
bool _bNeedToStop;
|
2012-05-20 03:54:59 +00:00
|
|
|
// virtual RMGfxPrimitive *NewItemPrimitive();
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMCharacter();
|
|
|
|
virtual ~RMCharacter();
|
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void linkToBoxes(RMGameBoxes *theBoxes);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual void removeThis(CORO_PARAM, bool &result);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Update the position of a character
|
2012-06-07 05:58:01 +00:00
|
|
|
void doFrame(CORO_PARAM, RMGfxTargetBuffer *bigBuf, int loc);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Overloaded draw
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// TRUE if you just stopped
|
2012-06-07 05:58:01 +00:00
|
|
|
bool endOfPath() {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _bEndOfPath;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Change the pattern of a character to STOP
|
2012-06-07 05:58:01 +00:00
|
|
|
virtual void stop(CORO_PARAM);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Check if the character is moving
|
2012-06-07 05:58:01 +00:00
|
|
|
bool isMoving() {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _bMoving;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Move the character to a certain position
|
2012-06-07 05:58:01 +00:00
|
|
|
void move(CORO_PARAM, RMPoint pt, bool *result = NULL);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Place the character in a certain position WITHOUT moving
|
2012-06-07 05:58:01 +00:00
|
|
|
void setPosition(const RMPoint &pt, int newloc = -1);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Wait for the end of movement
|
2012-06-07 05:58:01 +00:00
|
|
|
void waitForEndMovement(CORO_PARAM);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void setFixedScroll(const RMPoint &fix) {
|
|
|
|
_fixedScroll = fix;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-06-07 05:58:01 +00:00
|
|
|
void setSpeed(int speed) {
|
2012-06-10 21:56:37 +00:00
|
|
|
_curSpeed = speed;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RMWipe : public RMGfxTask {
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
bool _bFading;
|
|
|
|
bool _bEndFade;
|
|
|
|
bool _bUnregister;
|
|
|
|
uint32 _hUnregistered;
|
|
|
|
int _nFadeStep;
|
|
|
|
uint32 _hEndOfFade;
|
|
|
|
bool _bMustRegister;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
RMItem _wip0r;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMWipe();
|
|
|
|
virtual ~RMWipe();
|
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void doFrame(RMGfxTargetBuffer &bigBuf);
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-05-21 21:53:13 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void initFade(int type);
|
|
|
|
void closeFade(void);
|
|
|
|
void waitForFadeEnd(CORO_PARAM);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
virtual void Unregister(void);
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual void removeThis(CORO_PARAM, bool &result);
|
|
|
|
virtual int priority(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Location
|
|
|
|
*/
|
|
|
|
class RMLocation : public RMGfxTaskSetPrior {
|
|
|
|
public:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMString _name; // Name
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-21 21:53:13 +00:00
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
RMColorMode _cmode; // Color mode
|
|
|
|
RMGfxSourceBuffer *_buf; // Location picture
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
int _nItems; // Number of objects
|
|
|
|
RMItem *_items; // Objects
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint _curScroll; // Current scroll position
|
|
|
|
RMPoint _fixedScroll;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// @@@@@@@@@@@@@@@@@@@@@@@
|
|
|
|
RMPoint TEMPTonyStart;
|
2012-05-21 21:53:13 +00:00
|
|
|
RMPoint TEMPGetTonyStart() {
|
|
|
|
return TEMPTonyStart;
|
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
int TEMPNumLoc;
|
2012-05-21 21:53:13 +00:00
|
|
|
int TEMPGetNumLoc() {
|
|
|
|
return TEMPNumLoc;
|
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMLocation();
|
|
|
|
virtual ~RMLocation();
|
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Load variations
|
2012-06-07 05:58:01 +00:00
|
|
|
bool load(const char *lpszFileName);
|
|
|
|
bool load(Common::File &file);
|
|
|
|
bool load(const byte *buf);
|
|
|
|
bool load(RMDataStream &ds);
|
|
|
|
bool loadLOX(RMDataStream &ds);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Unload
|
2012-06-07 05:58:01 +00:00
|
|
|
void unload(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Overloaded draw
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Prepare a frame by drawing the location and all it's items
|
2012-06-05 23:37:06 +00:00
|
|
|
void doFrame(RMGfxTargetBuffer *bigBuf);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Return the item at a given point
|
2012-06-07 05:58:01 +00:00
|
|
|
RMItem *whichItemIsIn(const RMPoint &pt);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Return the item based on it's MPAL code
|
2012-06-07 05:58:01 +00:00
|
|
|
RMItem *getItemFromCode(uint32 dwCode);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Set the current scroll position
|
2012-06-07 05:58:01 +00:00
|
|
|
void setScrollPosition(const RMPoint &scroll);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Sets an additinal offset for scrolling
|
2012-06-07 05:58:01 +00:00
|
|
|
void setFixedScroll(const RMPoint &scroll);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Update the scrolling coordinates to display the specified point
|
2012-06-07 05:58:01 +00:00
|
|
|
void updateScrolling(const RMPoint &ptShowThis);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Read the current scroll position
|
2012-06-07 05:58:01 +00:00
|
|
|
RMPoint scrollPosition() {
|
|
|
|
return _curScroll;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 03:54:59 +00:00
|
|
|
// Pause sound
|
2012-06-07 05:58:01 +00:00
|
|
|
void pauseSound(bool bPause);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MPAL message, composed of more ASCIIZ
|
|
|
|
*/
|
|
|
|
class RMMessage {
|
|
|
|
private:
|
2012-06-10 21:56:37 +00:00
|
|
|
char *_lpMessage;
|
|
|
|
char *_lpPeriods[256];
|
|
|
|
int _nPeriods;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
private:
|
2012-06-07 05:58:01 +00:00
|
|
|
void parseMessage(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-13 09:06:08 +00:00
|
|
|
RMMessage();
|
2012-04-29 23:27:12 +00:00
|
|
|
RMMessage(uint32 dwId);
|
|
|
|
virtual ~RMMessage();
|
|
|
|
|
2012-06-07 05:58:01 +00:00
|
|
|
void load(uint32 dwId);
|
|
|
|
bool isValid() {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _lpMessage != NULL;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-06-07 05:58:01 +00:00
|
|
|
int numPeriods() {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _nPeriods;
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-06-07 05:58:01 +00:00
|
|
|
char *period(int num) {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _lpPeriods[num];
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
|
|
|
char *operator[](int num) {
|
2012-06-10 21:56:37 +00:00
|
|
|
return _lpPeriods[num];
|
2012-05-21 21:53:13 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
2012-04-29 13:19:30 +00:00
|
|
|
} // End of namespace Tony
|
|
|
|
|
|
|
|
#endif /* TONY_H */
|