2002-05-14 19:11:20 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001/2002 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ACTOR_H
|
|
|
|
#define ACTOR_H
|
|
|
|
|
2002-05-19 12:39:52 +00:00
|
|
|
#include <string.h>
|
2002-05-14 23:35:28 +00:00
|
|
|
#include "scummsys.h"
|
|
|
|
|
|
|
|
class Scumm;
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
enum MoveFlags {
|
|
|
|
MF_NEW_LEG = 1,
|
|
|
|
MF_IN_LEG = 2,
|
|
|
|
MF_TURN = 4,
|
|
|
|
MF_LAST_LEG = 8
|
|
|
|
};
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
struct ActorWalkData {
|
2002-07-07 19:31:51 +00:00
|
|
|
int16 destx, desty; // Final destination
|
2002-05-14 19:11:20 +00:00
|
|
|
byte destbox;
|
|
|
|
int16 destdir;
|
|
|
|
byte curbox;
|
2002-07-07 19:31:51 +00:00
|
|
|
int16 x, y; // Current position
|
|
|
|
int16 newx, newy; // Next position on our way to the destination
|
2002-05-14 19:11:20 +00:00
|
|
|
int32 XYFactor, YXFactor;
|
2002-07-07 19:31:51 +00:00
|
|
|
uint16 xfrac, yfrac;
|
2002-05-14 19:11:20 +00:00
|
|
|
int point3x, point3y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CostumeData {
|
|
|
|
byte active[16];
|
|
|
|
uint16 animCounter1;
|
|
|
|
byte animCounter2;
|
|
|
|
uint16 stopped;
|
|
|
|
uint16 curpos[16];
|
|
|
|
uint16 start[16];
|
|
|
|
uint16 end[16];
|
|
|
|
uint16 frame[16];
|
2002-07-07 19:31:51 +00:00
|
|
|
|
|
|
|
void reset() {
|
2002-05-23 00:37:00 +00:00
|
|
|
stopped = 0;
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
active[i] = 0;
|
|
|
|
curpos[i] = start[i] = end[i] = frame[i] = 0xFFFF;
|
2002-07-15 01:38:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2002-05-14 19:11:20 +00:00
|
|
|
|
2002-05-14 23:35:28 +00:00
|
|
|
class Actor {
|
|
|
|
|
|
|
|
public:
|
2002-05-14 19:11:20 +00:00
|
|
|
int x, y, top, bottom;
|
|
|
|
int elevation;
|
|
|
|
uint width;
|
|
|
|
byte number;
|
|
|
|
uint16 facing;
|
|
|
|
uint16 costume;
|
|
|
|
byte room;
|
|
|
|
byte talkColor;
|
2002-07-07 19:31:51 +00:00
|
|
|
byte scalex, scaley;
|
2002-05-14 19:11:20 +00:00
|
|
|
byte charset;
|
|
|
|
int16 newDirection;
|
|
|
|
byte moving;
|
|
|
|
byte ignoreBoxes;
|
|
|
|
byte forceClip;
|
|
|
|
byte initFrame, walkFrame, standFrame, talkFrame1, talkFrame2;
|
|
|
|
bool needRedraw, needBgReset, costumeNeedsInit, visible;
|
|
|
|
byte shadow_mode;
|
|
|
|
bool flip;
|
2002-07-07 19:31:51 +00:00
|
|
|
uint speedx, speedy;
|
2002-05-14 19:11:20 +00:00
|
|
|
byte frame;
|
|
|
|
byte walkbox;
|
|
|
|
byte mask;
|
|
|
|
byte animProgress, animSpeed;
|
2002-07-07 19:31:51 +00:00
|
|
|
int16 new_1, new_2;
|
2002-05-14 19:11:20 +00:00
|
|
|
uint16 talk_script, walk_script;
|
|
|
|
byte new_3;
|
|
|
|
int8 layer;
|
|
|
|
ActorWalkData walkdata;
|
|
|
|
int16 animVariable[16];
|
|
|
|
uint16 sound[8];
|
|
|
|
CostumeData cost;
|
|
|
|
byte palette[64];
|
|
|
|
|
2002-05-14 23:35:28 +00:00
|
|
|
protected:
|
2002-07-07 19:31:51 +00:00
|
|
|
Scumm *_vm;
|
2002-05-14 23:35:28 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2002-05-19 12:39:52 +00:00
|
|
|
// Constructor, sets all data to 0
|
2002-07-07 19:31:51 +00:00
|
|
|
Actor() {
|
|
|
|
memset(this, 0, sizeof(Actor));
|
|
|
|
} void initActorClass(Scumm *scumm) {
|
|
|
|
_vm = scumm;
|
|
|
|
}
|
2002-05-14 23:35:28 +00:00
|
|
|
//protected:
|
2002-05-14 19:11:20 +00:00
|
|
|
void hideActor();
|
|
|
|
void showActor();
|
|
|
|
|
|
|
|
void initActor(int mode);
|
|
|
|
void setActorWalkSpeed(uint newSpeedX, uint newSpeedY);
|
|
|
|
int calcMovementFactor(int newx, int newy);
|
|
|
|
int actorWalkStep();
|
|
|
|
int remapDirection(int dir);
|
|
|
|
void setupActorScale();
|
|
|
|
void stopActorMoving();
|
|
|
|
void startWalkAnim(int cmd, int angle);
|
|
|
|
void startAnimActor(int frame);
|
|
|
|
void setActorBox(int box);
|
|
|
|
|
|
|
|
int updateActorDirection();
|
|
|
|
void setActorDirection(int direction);
|
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
AdjustBoxResult adjustXYToBeInBox(int dstX, int dstY, int pathfrom);
|
2002-07-07 19:31:51 +00:00
|
|
|
void adjustActorPos();
|
2002-05-14 19:11:20 +00:00
|
|
|
void turnToDirection(int newdir);
|
|
|
|
void walkActor();
|
2002-05-23 00:37:00 +00:00
|
|
|
void drawActorCostume();
|
|
|
|
void actorAnimate();
|
2002-05-14 19:11:20 +00:00
|
|
|
void setActorCostume(int c);
|
|
|
|
byte *getActorName();
|
|
|
|
void startWalkActor(int x, int y, int dir);
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void remapActor(int b, int c, int d, int e);
|
|
|
|
void walkActorOld();
|
2002-06-04 23:32:53 +00:00
|
|
|
|
|
|
|
void animateActor(int anim);
|
2002-05-23 00:37:00 +00:00
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
bool isInCurrentRoom() {
|
|
|
|
return room == _vm->_currentRoom;
|
|
|
|
}
|
|
|
|
int getRoom() {
|
|
|
|
return room;
|
|
|
|
}
|
|
|
|
|
|
|
|
int getAnimVar(byte var) {
|
|
|
|
return animVariable[var];
|
|
|
|
}
|
|
|
|
void setAnimVar(byte var, int value) {
|
|
|
|
animVariable[var] = value;
|
|
|
|
}
|
2002-05-23 00:37:00 +00:00
|
|
|
|
2002-07-15 22:56:24 +00:00
|
|
|
protected:
|
|
|
|
bool isInClass(int cls);
|
2002-05-14 19:11:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|