2012-09-17 08:03:25 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HOPKINS_OBJECTS_H
|
|
|
|
#define HOPKINS_OBJECTS_H
|
|
|
|
|
2013-02-15 21:20:24 +00:00
|
|
|
#include "hopkins/globals.h"
|
|
|
|
|
2012-09-17 08:03:25 +00:00
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/endian.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
|
2012-12-16 23:16:49 +00:00
|
|
|
#define MAX_SPRITE 5
|
2012-09-17 08:03:25 +00:00
|
|
|
namespace Hopkins {
|
|
|
|
|
2012-09-23 00:59:52 +00:00
|
|
|
struct SpriteItem {
|
2012-12-18 20:50:50 +00:00
|
|
|
int _animationType;
|
2012-12-16 01:11:36 +00:00
|
|
|
const byte *_spriteData;
|
|
|
|
Common::Point _spritePos;
|
2013-01-21 18:15:37 +00:00
|
|
|
int _zoomFactor;
|
2013-01-21 21:25:12 +00:00
|
|
|
bool _flipFl;
|
2012-12-16 01:11:36 +00:00
|
|
|
int _spriteIndex;
|
2013-03-17 14:17:42 +00:00
|
|
|
int _deltaX;
|
|
|
|
int _deltaY;
|
2012-12-29 22:57:50 +00:00
|
|
|
bool _rleFl;
|
2013-02-22 09:36:54 +00:00
|
|
|
bool _activeFl;
|
2013-01-20 23:06:50 +00:00
|
|
|
int _destX;
|
|
|
|
int _destY;
|
2012-12-29 22:57:50 +00:00
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
int _zoomPct;
|
|
|
|
int _reducePct;
|
2012-09-23 00:59:52 +00:00
|
|
|
};
|
|
|
|
|
2013-02-10 23:15:00 +00:00
|
|
|
struct BobItem {
|
2013-03-17 21:41:10 +00:00
|
|
|
int _bobMode;
|
2013-02-10 23:15:00 +00:00
|
|
|
byte *_spriteData;
|
|
|
|
int _xp;
|
|
|
|
int _yp;
|
|
|
|
int _frameIndex;
|
|
|
|
int _animDataIdx;
|
2013-03-17 21:06:03 +00:00
|
|
|
int _moveChange1;
|
|
|
|
int _moveChange2;
|
2013-02-10 23:15:00 +00:00
|
|
|
bool _disabledAnimationFl;
|
|
|
|
byte *_animData;
|
2013-03-17 21:41:10 +00:00
|
|
|
bool _bobMode10;
|
|
|
|
int _bobModeChange;
|
2013-02-10 23:15:00 +00:00
|
|
|
int field20;
|
|
|
|
int field22;
|
|
|
|
bool field34; // Set to true in B_CACHE_OFF()
|
|
|
|
int _zoomFactor;
|
|
|
|
bool _flipFl;
|
|
|
|
bool _isSpriteFl;
|
|
|
|
bool _activeFl;
|
|
|
|
int _oldX;
|
|
|
|
int _oldY;
|
|
|
|
int _oldWidth;
|
|
|
|
int _oldHeight;
|
|
|
|
int _oldX2;
|
|
|
|
int _zooInmFactor;
|
|
|
|
int _zoomOutFactor;
|
|
|
|
};
|
|
|
|
|
2012-09-17 08:53:29 +00:00
|
|
|
class HopkinsEngine;
|
|
|
|
|
2012-09-17 08:03:25 +00:00
|
|
|
class ObjectsManager {
|
2012-09-17 08:53:29 +00:00
|
|
|
private:
|
|
|
|
HopkinsEngine *_vm;
|
2012-09-20 12:02:55 +00:00
|
|
|
|
2012-12-16 08:56:50 +00:00
|
|
|
int _oldBorderSpriteIndex;
|
|
|
|
int _borderSpriteIndex;
|
|
|
|
byte *_spritePtr;
|
2013-01-22 06:53:59 +00:00
|
|
|
const byte *_oldSpriteData;
|
2012-12-16 08:56:50 +00:00
|
|
|
int _verb;
|
2013-01-18 07:32:07 +00:00
|
|
|
int _oldSpriteIndex;
|
2013-03-24 18:38:48 +00:00
|
|
|
int _oldFrameIndex;
|
2013-03-24 19:36:29 +00:00
|
|
|
int _oldDirectionSpriteIdx;
|
|
|
|
Directions _oldDirection;
|
|
|
|
Directions _lastDirection;
|
2013-01-21 21:25:12 +00:00
|
|
|
bool _oldFlipFl;
|
2013-02-15 07:03:59 +00:00
|
|
|
int _curGestureFile;
|
|
|
|
byte *_gestureBuf;
|
2013-03-24 16:27:56 +00:00
|
|
|
int _homeRateCounter;
|
2013-02-15 07:03:59 +00:00
|
|
|
|
2013-01-16 01:00:29 +00:00
|
|
|
void sprite_alone(const byte *objectData, byte *sprite, int objIndex);
|
2013-02-22 09:36:54 +00:00
|
|
|
void removeObjectDataBuf();
|
2012-09-17 08:03:25 +00:00
|
|
|
|
2012-12-29 22:57:50 +00:00
|
|
|
int getOffsetX(const byte *spriteData, int spriteIndex, bool isSize);
|
|
|
|
int getOffsetY(const byte *spriteData, int spriteIndex, bool isSize);
|
2012-09-19 11:34:23 +00:00
|
|
|
|
2013-01-16 01:00:29 +00:00
|
|
|
void capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex);
|
2013-02-04 23:12:42 +00:00
|
|
|
void initBob();
|
|
|
|
void setBobInfo(int idx);
|
2012-09-23 12:52:12 +00:00
|
|
|
void SCBOB(int idx);
|
2012-09-24 12:21:04 +00:00
|
|
|
void CALCUL_BOB(int idx);
|
2012-09-23 00:59:52 +00:00
|
|
|
|
2013-02-22 09:36:54 +00:00
|
|
|
void checkHidingItem();
|
|
|
|
void displayHiding(int idx);
|
2012-12-29 22:57:50 +00:00
|
|
|
void computeSprite(int idx);
|
2013-01-29 07:12:43 +00:00
|
|
|
void beforeSort(SortMode sortMode, int index, int priority);
|
2013-01-01 20:03:24 +00:00
|
|
|
void displayBobAnim();
|
|
|
|
void displayVBob();
|
2013-02-22 11:18:20 +00:00
|
|
|
void DEF_SPRITE(int idx);
|
2012-09-28 12:15:59 +00:00
|
|
|
|
2012-12-18 20:50:50 +00:00
|
|
|
void clearSprite();
|
2013-01-21 17:59:17 +00:00
|
|
|
void setSpriteZoom(int idx, int zoomFactor);
|
2013-02-08 05:44:28 +00:00
|
|
|
|
2012-12-19 01:15:32 +00:00
|
|
|
void loadZone(const Common::String &file);
|
2012-12-16 23:16:49 +00:00
|
|
|
void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter);
|
2013-02-22 11:18:20 +00:00
|
|
|
void GOHOME2();
|
2012-11-24 20:08:13 +00:00
|
|
|
|
2013-01-09 00:15:15 +00:00
|
|
|
void nextVerbIcon();
|
2013-02-08 05:44:28 +00:00
|
|
|
int getBobFrameIndex(int idx);
|
2013-02-19 13:34:43 +00:00
|
|
|
void handleForest(int screenId, int minX, int maxX, int minY, int maxY, int idx);
|
2013-02-08 05:44:28 +00:00
|
|
|
|
2013-03-04 06:46:15 +00:00
|
|
|
void sceneSpecialIni();
|
2013-02-27 07:00:40 +00:00
|
|
|
void ACTION(const byte *spriteData, const Common::String &actionStr, int speed, bool flipFl);
|
2013-02-08 05:44:28 +00:00
|
|
|
public:
|
|
|
|
bool _disableFl;
|
|
|
|
bool _forestFl;
|
|
|
|
bool _visibleFl;
|
|
|
|
bool _saveLoadFl;
|
|
|
|
bool _forceZoneFl;
|
|
|
|
bool _changeVerbFl;
|
|
|
|
bool _helicopterFl;
|
|
|
|
bool _twoCharactersFl;
|
|
|
|
bool _changeHeadFl;
|
|
|
|
bool _priorityFl;
|
|
|
|
int _jumpVerb;
|
|
|
|
int _jumpZone;
|
|
|
|
int _zoneNum;
|
|
|
|
int _eraseVisibleCounter;
|
|
|
|
int _curObjectIndex;
|
|
|
|
int _startSpriteIndex;
|
|
|
|
int _oldInventoryPosX, _oldInventoryPosY;
|
|
|
|
int _saveLoadX, _saveLoadY;
|
|
|
|
int _mapCarPosX, _mapCarPosY;
|
|
|
|
int _oldCharacterPosX, _oldCharacterPosY;
|
|
|
|
Common::Point _borderPos;
|
|
|
|
Common::Point _oldBorderPos;
|
|
|
|
Common::Point _characterPos;
|
|
|
|
byte *_forestSprite;
|
|
|
|
byte *_saveLoadSprite;
|
|
|
|
byte *_saveLoadSprite2;
|
2013-02-15 07:24:10 +00:00
|
|
|
byte *_headSprites;
|
2013-02-08 05:44:28 +00:00
|
|
|
SpriteItem _sprite[6];
|
2013-02-10 23:15:00 +00:00
|
|
|
BobItem _bob[36];
|
2013-02-08 05:44:28 +00:00
|
|
|
|
|
|
|
bool PERSO_ON;
|
|
|
|
bool BOBTOUS;
|
|
|
|
bool OBSSEUL;
|
|
|
|
|
2013-03-20 06:56:16 +00:00
|
|
|
ObjectsManager(HopkinsEngine *vm);
|
2013-02-08 05:44:28 +00:00
|
|
|
~ObjectsManager();
|
|
|
|
|
|
|
|
void clearAll();
|
|
|
|
|
|
|
|
int getWidth(const byte *objectData, int idx);
|
|
|
|
int getHeight(const byte *objectData, int idx);
|
|
|
|
byte *loadSprite(const Common::String &file);
|
2013-02-19 13:34:43 +00:00
|
|
|
void loadLinkFile(const Common::String &file);
|
2013-03-17 14:17:42 +00:00
|
|
|
void addStaticSprite(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int zoomFactor, bool flipFl, int deltaX, int deltaY);
|
2013-02-08 05:44:28 +00:00
|
|
|
void animateSprite(int idx);
|
|
|
|
void removeSprite(int idx);
|
|
|
|
void setSpriteX(int idx, int xp);
|
|
|
|
void setSpriteY(int idx, int yp);
|
|
|
|
int getSpriteX(int idx);
|
|
|
|
int getSpriteY(int idx);
|
|
|
|
void setSpriteIndex(int idx, int spriteIndex);
|
|
|
|
void displaySprite();
|
|
|
|
void computeAndSetSpriteSize();
|
|
|
|
void setFlipSprite(int idx, bool flip);
|
|
|
|
|
|
|
|
int getBobAnimDataIdx(int idx);
|
2013-01-29 07:12:43 +00:00
|
|
|
void initBorder(int zoneIdx);
|
2013-01-08 07:37:42 +00:00
|
|
|
void nextObjectIcon(int idx);
|
|
|
|
void takeInventoryObject(int idx);
|
2013-01-01 12:53:07 +00:00
|
|
|
void handleSpecialGames();
|
2012-09-30 11:02:39 +00:00
|
|
|
|
2013-02-08 05:44:28 +00:00
|
|
|
void addObject(int objIndex);
|
|
|
|
void changeObject(int objIndex);
|
|
|
|
void removeObject(int objIndex);
|
|
|
|
|
|
|
|
void resetBob(int idx);
|
2013-03-05 06:45:15 +00:00
|
|
|
void hideBob(int idx);
|
|
|
|
void displayBob(int idx);
|
|
|
|
void setBobOffset(int idx, int offset);
|
2013-02-08 05:44:28 +00:00
|
|
|
void setBobAnimDataIdx(int idx, int animIdx);
|
2012-12-20 07:35:11 +00:00
|
|
|
void setBobAnimation(int idx);
|
|
|
|
void stopBobAnimation(int idx);
|
|
|
|
int getBobPosX(int idx);
|
2013-01-16 01:00:29 +00:00
|
|
|
int getBobPosY(int idx);
|
2012-10-03 12:15:39 +00:00
|
|
|
|
2013-02-08 05:44:28 +00:00
|
|
|
void handleCityMap();
|
|
|
|
void clearScreen();
|
2012-12-29 18:58:37 +00:00
|
|
|
void disableVerb(int idx, int a2);
|
|
|
|
void enableVerb(int idx, int a2);
|
2013-01-29 07:12:43 +00:00
|
|
|
void lockAnimX(int idx, int x);
|
2013-02-08 05:44:28 +00:00
|
|
|
void handleLeftButton();
|
|
|
|
void handleRightButton();
|
|
|
|
void setOffsetXY(byte *data, int idx, int xp, int yp, bool isSize);
|
2013-02-12 22:48:03 +00:00
|
|
|
void setVerb(int id);
|
2012-11-17 11:00:54 +00:00
|
|
|
|
2013-02-15 06:54:54 +00:00
|
|
|
void doActionBack(int idx);
|
|
|
|
void doActionRight(int idx);
|
|
|
|
void doActionFront(int idx);
|
|
|
|
void doActionLeft(int idx);
|
2013-02-19 13:34:43 +00:00
|
|
|
void doActionDiagRight(int idx);
|
|
|
|
void doActionDiagLeft(int idx);
|
2013-03-24 16:27:56 +00:00
|
|
|
byte *loadObjectFromFile(int objIndex, bool mode);
|
|
|
|
|
|
|
|
void resetHomeRateCounter() { _homeRateCounter = 0; }
|
2013-02-15 06:54:54 +00:00
|
|
|
|
2012-12-14 00:49:22 +00:00
|
|
|
void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
|
2013-02-19 13:34:43 +00:00
|
|
|
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
|
2012-12-14 00:49:22 +00:00
|
|
|
void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile,
|
2013-02-19 13:34:43 +00:00
|
|
|
const Common::String &animFile, const Common::String &s4, int soundNum, bool initializeScreen);
|
2013-02-08 05:44:28 +00:00
|
|
|
void OPTI_OBJET();
|
2013-02-27 07:00:40 +00:00
|
|
|
void SPACTION(byte *spriteData, const Common::String &animationSeq, int speed, bool flipFl);
|
2013-02-08 05:44:28 +00:00
|
|
|
void BOB_VIVANT(int idx);
|
|
|
|
void VBOB(byte *src, int idx, int xp, int yp, int frameIndex);
|
|
|
|
void VBOB_OFF(int idx);
|
|
|
|
void OPTI_ONE(int idx, int animIdx, int destPosi, int animAction);
|
2013-02-27 07:00:40 +00:00
|
|
|
void SCI_OPTI_ONE(int idx, int animIdx, int animDataIdx, int a4);
|
2013-02-08 05:44:28 +00:00
|
|
|
void GOHOME();
|
|
|
|
void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx);
|
2013-02-27 07:00:40 +00:00
|
|
|
void SPACTION1(byte *spriteData, const Common::String &animString, int speed);
|
2013-02-08 05:44:28 +00:00
|
|
|
void PARADISE();
|
2013-03-24 18:38:48 +00:00
|
|
|
|
|
|
|
void resetOldFrameIndex() { _oldFrameIndex = -1; }
|
2013-03-24 19:36:29 +00:00
|
|
|
void resetOldDirection() { _oldDirection = DIR_NONE; }
|
2012-09-17 08:03:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Hopkins
|
|
|
|
|
|
|
|
#endif /* HOPKINS_OBJECTS_H */
|