Skip to content

Commit

Permalink
SCUMM: Move ActorHE into its own header, move some HE specific stuff …
Browse files Browse the repository at this point in the history
…out of scumm.h
  • Loading branch information
fingolfin committed Apr 5, 2011
1 parent 55e65ce commit d7a6bf5
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 65 deletions.
3 changes: 2 additions & 1 deletion engines/scumm/actor.cpp
Expand Up @@ -26,6 +26,7 @@
#include "common/system.h" // for setFocusRectangle/clearFocusRectangle
#include "scumm/scumm.h"
#include "scumm/actor.h"
#include "scumm/actor_he.h"
#include "scumm/akos.h"
#include "scumm/boxes.h"
#include "scumm/charset.h"
Expand Down Expand Up @@ -75,7 +76,7 @@ void ActorHE::initActor(int mode) {
if (_vm->_game.heversion >= 61)
_flip = 0;

_clipOverride = _vm->_actorClipOverride;
_clipOverride = ((ScummEngine_v60he *)_vm)->_actorClipOverride;

_auxBlock.reset();
}
Expand Down
41 changes: 0 additions & 41 deletions engines/scumm/actor.h
Expand Up @@ -34,7 +34,6 @@

namespace Scumm {


enum {
V12_X_MULTIPLIER = 8,
V12_Y_MULTIPLIER = 2,
Expand Down Expand Up @@ -315,46 +314,6 @@ class Actor : public Serializable {
bool findPathTowards(byte box, byte box2, byte box3, Common::Point &foundPath);
};

class ActorHE : public Actor {
public:
ActorHE(ScummEngine *scumm, int id) : Actor(scumm, id) {}

virtual void initActor(int mode);

virtual void hideActor();

void drawActorToBackBuf(int x, int y);

void setHEFlag(int bit, int set);

void setUserCondition(int slot, int set);
bool isUserConditionSet(int slot) const;

void setTalkCondition(int slot);
bool isTalkConditionSet(int slot) const;

public:
/** This rect is used to clip actor drawing. */
Common::Rect _clipOverride;

bool _heNoTalkAnimation;
bool _heTalking;
byte _heFlags;

AuxBlock _auxBlock;

struct {
int16 posX;
int16 posY;
int16 color;
byte sentence[128];
} _heTalkQueue[16];


virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
virtual void setActorCostume(int c);
};

class Actor_v3 : public Actor {
public:
Actor_v3(ScummEngine *scumm, int id) : Actor(scumm, id) {}
Expand Down
92 changes: 92 additions & 0 deletions engines/scumm/actor_he.h
@@ -0,0 +1,92 @@
/* 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.
*
* $URL$
* $Id$
*
*/


#ifndef SCUMM_ACTOR_HE_H
#define SCUMM_ACTOR_HE_H

#include "scumm/actor.h"

namespace Scumm {

struct AuxBlock {
bool visible;
Common::Rect r;

void reset() {
visible = false;
r.left = r.top = 0;
r.right = r.bottom = -1;
}
};

struct AuxEntry {
int actorNum;
int subIndex;
};

class ActorHE : public Actor {
public:
ActorHE(ScummEngine *scumm, int id) : Actor(scumm, id) {}

virtual void initActor(int mode);

virtual void hideActor();

void drawActorToBackBuf(int x, int y);

void setHEFlag(int bit, int set);

void setUserCondition(int slot, int set);
bool isUserConditionSet(int slot) const;

void setTalkCondition(int slot);
bool isTalkConditionSet(int slot) const;

public:
/** This rect is used to clip actor drawing. */
Common::Rect _clipOverride;

bool _heNoTalkAnimation;
bool _heTalking;
byte _heFlags;

AuxBlock _auxBlock;

struct {
int16 posX;
int16 posY;
int16 color;
byte sentence[128];
} _heTalkQueue[16];


virtual void prepareDrawActorCostume(BaseCostumeRenderer *bcr);
virtual void setActorCostume(int c);
};

} // End of namespace Scumm

#endif
4 changes: 4 additions & 0 deletions engines/scumm/he/intern_he.h
Expand Up @@ -31,6 +31,7 @@
#include "scumm/he/floodfill_he.h"
#include "scumm/he/wiz_he.h"
#endif
#include "scumm/actor_he.h" // For AuxBlock & AuxEntry

namespace Common {
class SeekableReadStream;
Expand All @@ -55,7 +56,10 @@ class ScummEngine_v60he : public ScummEngine_v6 {
Common::SeekableReadStream *_hInFileTable[17];
Common::WriteStream *_hOutFileTable[17];

Common::Rect _actorClipOverride; // HE specific

int _heTimers[16];

int getHETimer(int timer);
void setHETimer(int timer);

Expand Down
11 changes: 6 additions & 5 deletions engines/scumm/scumm.cpp
Expand Up @@ -320,11 +320,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_V1TalkingActor = 0;
_NESStartStrip = 0;

_actorClipOverride.top = 0;
_actorClipOverride.bottom = 480;
_actorClipOverride.left = 0;
_actorClipOverride.right = 640;

_skipDrawObject = 0;

#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
Expand Down Expand Up @@ -767,6 +762,12 @@ ScummEngine_v60he::ScummEngine_v60he(OSystem *syst, const DetectorResult &dr)
: ScummEngine_v6(syst, dr) {
memset(_hInFileTable, 0, sizeof(_hInFileTable));
memset(_hOutFileTable, 0, sizeof(_hOutFileTable));

_actorClipOverride.top = 0;
_actorClipOverride.bottom = 480;
_actorClipOverride.left = 0;
_actorClipOverride.right = 640;

memset(_heTimers, 0, sizeof(_heTimers));

if (_game.heversion >= 61)
Expand Down
18 changes: 0 additions & 18 deletions engines/scumm/scumm.h
Expand Up @@ -308,22 +308,6 @@ enum WhereIsObject {
WIO_FLOBJECT = 4
};

struct AuxBlock {
bool visible;
Common::Rect r;

void reset() {
visible = false;
r.left = r.top = 0;
r.right = r.bottom = -1;
}
};

struct AuxEntry {
int actorNum;
int subIndex;
};

// TODO: Rename InfoStuff to something more descriptive
struct InfoStuff {
uint32 date;
Expand Down Expand Up @@ -972,8 +956,6 @@ class ScummEngine : public Engine {
// Generic costume code
bool isCostumeInUse(int i) const;

Common::Rect _actorClipOverride; // HE specific

protected:
/* Should be in Graphics class? */
uint16 _screenB, _screenH;
Expand Down

0 comments on commit d7a6bf5

Please sign in to comment.