2001-10-09 14:30:12 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2002-03-20 17:51:07 +00:00
|
|
|
* Copyright (C) 2001/2002 The ScummVM project
|
2001-10-09 14:30:12 +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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
2001-11-06 20:00:47 +00:00
|
|
|
* $Header$
|
2001-10-09 14:30:12 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "scumm.h"
|
2002-05-14 23:35:28 +00:00
|
|
|
#include "actor.h"
|
2002-05-23 21:22:08 +00:00
|
|
|
#include "akos.h"
|
2002-07-16 17:59:28 +00:00
|
|
|
#include "costume.h"
|
2002-07-16 21:03:14 +00:00
|
|
|
#include "resource.h"
|
2002-08-29 23:45:15 +00:00
|
|
|
#include "scumm/sound.h"
|
2002-05-14 23:35:28 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::initActor(int mode)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
|
|
|
if (mode == 1) {
|
2002-05-14 19:11:20 +00:00
|
|
|
costume = 0;
|
|
|
|
room = 0;
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
|
|
|
facing = 180;
|
|
|
|
newDirection = 180;
|
2002-04-11 17:19:16 +00:00
|
|
|
} else if (mode == 2) {
|
2002-05-14 19:11:20 +00:00
|
|
|
facing = 180;
|
|
|
|
newDirection = 180;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
elevation = 0;
|
|
|
|
width = 24;
|
|
|
|
talkColor = 15;
|
|
|
|
new_2 = 0;
|
|
|
|
new_1 = -80;
|
|
|
|
scaley = scalex = 0xFF;
|
|
|
|
charset = 0;
|
|
|
|
sound[0] = 0;
|
|
|
|
sound[1] = 0;
|
|
|
|
sound[2] = 0;
|
|
|
|
sound[3] = 0;
|
|
|
|
sound[4] = 0;
|
|
|
|
sound[5] = 0;
|
|
|
|
sound[6] = 0;
|
|
|
|
sound[7] = 0;
|
|
|
|
newDirection = 0;
|
|
|
|
|
|
|
|
stopActorMoving();
|
|
|
|
|
|
|
|
shadow_mode = 0;
|
|
|
|
layer = 0;
|
|
|
|
|
|
|
|
setActorWalkSpeed(8, 2);
|
|
|
|
|
|
|
|
ignoreBoxes = 0;
|
|
|
|
forceClip = 0;
|
|
|
|
new_3 = 0;
|
|
|
|
initFrame = 1;
|
|
|
|
walkFrame = 2;
|
|
|
|
standFrame = 3;
|
|
|
|
talkFrame1 = 4;
|
|
|
|
talkFrame2 = 5;
|
|
|
|
|
|
|
|
walk_script = 0;
|
|
|
|
talk_script = 0;
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_features & GF_AFTER_V7) {
|
|
|
|
_vm->_classData[number] = _vm->_classData[0];
|
2001-12-27 17:51:58 +00:00
|
|
|
} else {
|
2002-05-23 21:22:08 +00:00
|
|
|
_vm->_classData[number] = 0;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::stopActorMoving()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-23 21:22:08 +00:00
|
|
|
_vm->stopScriptNr(walk_script);
|
2002-05-14 19:11:20 +00:00
|
|
|
moving = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-14 19:11:20 +00:00
|
|
|
if (newSpeedX == speedx && newSpeedY == speedy)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
speedx = newSpeedX;
|
|
|
|
speedy = newSpeedY;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving) {
|
|
|
|
calcMovementFactor(walkdata.newx, walkdata.newy);
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
int Scumm::getAngleFromPos(int x, int y)
|
|
|
|
{
|
|
|
|
if (_gameId == GID_DIG) {
|
2002-07-08 01:04:29 +00:00
|
|
|
double temp = atan2((double)x, (double)-y);
|
2002-07-22 18:11:48 +00:00
|
|
|
return normalizeAngle((int)(temp * 180 / 3.1415926535));
|
2001-11-26 19:57:57 +00:00
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
if (abs(y) * 2 < abs(x)) {
|
|
|
|
if (x > 0)
|
2002-04-11 14:13:53 +00:00
|
|
|
return 90;
|
|
|
|
return 270;
|
|
|
|
} else {
|
2002-04-11 17:19:16 +00:00
|
|
|
if (y > 0)
|
2002-04-11 14:13:53 +00:00
|
|
|
return 180;
|
|
|
|
return 0;
|
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
int Actor::calcMovementFactor(int newX, int newY)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int actorX, actorY;
|
|
|
|
int diffX, diffY;
|
|
|
|
int32 XYFactor, YXFactor;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
actorX = x;
|
|
|
|
actorY = y;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
if (actorX == newX && actorY == newY)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
diffX = newX - actorX;
|
|
|
|
diffY = newY - actorY;
|
2002-05-14 19:11:20 +00:00
|
|
|
YXFactor = speedy << 16;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
if (diffY < 0)
|
|
|
|
YXFactor = -YXFactor;
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
XYFactor = YXFactor * diffX;
|
2001-10-09 14:30:12 +00:00
|
|
|
if (diffY != 0) {
|
2001-11-26 19:57:57 +00:00
|
|
|
XYFactor /= diffY;
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
|
|
|
YXFactor = 0;
|
|
|
|
}
|
|
|
|
|
2002-07-08 13:44:00 +00:00
|
|
|
if ((uint) abs((int)(XYFactor >> 16)) > speedx) {
|
2002-05-14 19:11:20 +00:00
|
|
|
XYFactor = speedx << 16;
|
2001-10-09 14:30:12 +00:00
|
|
|
if (diffX < 0)
|
|
|
|
XYFactor = -XYFactor;
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
YXFactor = XYFactor * diffY;
|
2001-10-09 14:30:12 +00:00
|
|
|
if (diffX != 0) {
|
2001-11-26 19:57:57 +00:00
|
|
|
YXFactor /= diffX;
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
|
|
|
XYFactor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.x = actorX;
|
|
|
|
walkdata.y = actorY;
|
|
|
|
walkdata.newx = newX;
|
|
|
|
walkdata.newy = newY;
|
|
|
|
walkdata.XYFactor = XYFactor;
|
|
|
|
walkdata.YXFactor = YXFactor;
|
|
|
|
walkdata.xfrac = 0;
|
|
|
|
walkdata.yfrac = 0;
|
2002-03-06 09:40:21 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
newDirection = _vm->getAngleFromPos(XYFactor, YXFactor);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
return actorWalkStep();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-08-18 13:55:30 +00:00
|
|
|
int Actor::remapDirection(int dir, bool is_walking)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
int specdir;
|
|
|
|
byte flags;
|
2002-05-11 14:55:03 +00:00
|
|
|
bool flipX;
|
|
|
|
bool flipY;
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-08-23 22:46:09 +00:00
|
|
|
// FIXME - why was this here? It breaks some animations in LoomCD, and logical,
|
|
|
|
// why should we not honor box flags when ignoreBoxes is on? If this change
|
|
|
|
// breaks anything, or if you know why the if() was in originally, please
|
|
|
|
// tell this to Fingolfin.
|
|
|
|
//if (!ignoreBoxes) {
|
|
|
|
if (1) {
|
2002-05-23 21:22:08 +00:00
|
|
|
specdir = _vm->_extraBoxFlags[walkbox];
|
2001-11-26 19:57:57 +00:00
|
|
|
if (specdir) {
|
|
|
|
if (specdir & 0x8000) {
|
|
|
|
dir = specdir & 0x3FFF;
|
|
|
|
} else {
|
2002-10-16 02:42:43 +00:00
|
|
|
// FIXME make actors at top of lab walk
|
|
|
|
// facing the correct way in the dig
|
|
|
|
if (_vm->_gameId != GID_DIG)
|
|
|
|
error("remapDirection: special dir not implemented");
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
flags = _vm->getBoxFlags(walkbox);
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
flipX = (walkdata.XYFactor > 0);
|
|
|
|
flipY = (walkdata.YXFactor > 0);
|
2001-12-29 12:45:54 +00:00
|
|
|
|
2002-08-15 22:54:32 +00:00
|
|
|
// FIXME - this special cases for the class might be necesary for other
|
|
|
|
// games besides Loom CD!
|
|
|
|
|
2002-05-11 14:55:03 +00:00
|
|
|
// Check for X-Flip
|
2002-08-15 22:54:32 +00:00
|
|
|
if ((flags & kBoxXFlip) || isInClass(_vm->_gameId == GID_LOOM256 ? 19 : 30)) {
|
2001-11-26 19:57:57 +00:00
|
|
|
dir = 360 - dir;
|
2002-05-11 14:55:03 +00:00
|
|
|
flipX = !flipX;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2002-05-11 14:55:03 +00:00
|
|
|
// Check for Y-Flip
|
2002-08-15 22:54:32 +00:00
|
|
|
if ((flags & kBoxYFlip) || isInClass(_vm->_gameId == GID_LOOM256 ? 18 : 29)) {
|
2001-11-26 19:57:57 +00:00
|
|
|
dir = 180 - dir;
|
2002-05-11 14:55:03 +00:00
|
|
|
flipY = !flipY;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
switch (flags & 7) {
|
2001-11-26 19:57:57 +00:00
|
|
|
case 1:
|
2002-08-18 13:55:30 +00:00
|
|
|
if (is_walking) // Actor is walking
|
2002-05-11 14:55:03 +00:00
|
|
|
return flipX ? 90 : 270;
|
2002-07-07 19:31:51 +00:00
|
|
|
else // Actor is standing/turning
|
2002-05-11 14:55:03 +00:00
|
|
|
return (dir == 90) ? 90 : 270;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 2:
|
2002-08-18 13:55:30 +00:00
|
|
|
if (is_walking) // Actor is walking
|
2002-05-11 14:55:03 +00:00
|
|
|
return flipY ? 180 : 0;
|
2002-07-07 19:31:51 +00:00
|
|
|
else // Actor is standing/turning
|
2002-05-11 14:55:03 +00:00
|
|
|
return (dir == 0) ? 0 : 180;
|
2002-04-11 17:19:16 +00:00
|
|
|
case 3:
|
|
|
|
return 270;
|
|
|
|
case 4:
|
|
|
|
return 90;
|
|
|
|
case 5:
|
|
|
|
return 0;
|
|
|
|
case 6:
|
|
|
|
return 180;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-10 21:35:53 +00:00
|
|
|
/* Or 1024 in to signal direction interpolation should be done */
|
2002-07-22 18:11:48 +00:00
|
|
|
return normalizeAngle(dir) | 1024;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-08-18 13:55:30 +00:00
|
|
|
int Actor::updateActorDirection(bool is_walking)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
|
|
|
int from, to;
|
2001-11-26 19:57:57 +00:00
|
|
|
int diff;
|
2001-12-27 17:51:58 +00:00
|
|
|
int dirType;
|
2002-05-10 21:35:53 +00:00
|
|
|
int dir;
|
2001-12-27 17:51:58 +00:00
|
|
|
int num;
|
2002-05-10 21:35:53 +00:00
|
|
|
bool shouldInterpolate;
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
dirType = _vm->akos_hasManyDirections(this);
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-07-22 18:11:48 +00:00
|
|
|
from = toSimpleDir(dirType, facing);
|
2002-08-18 13:55:30 +00:00
|
|
|
dir = remapDirection(newDirection, is_walking);
|
2002-09-21 Matt Hargett <matt@use.net>
* scumm.dsp, scummvm.dsp, simon.dsp: Turn on warning as errors. Generate
PDBs on all builds.
* gameDetector.cpp, newgui.cpp, widget.cpp, actor.cpp,
dialogs.cpp, resource.cpp, saveload.cpp, scumm_renderer.cpp:
Fix warnings where possible. One pragma added to eliminate
warning of unknown pragmas.
* string.cpp: If unknown escape sequence, print warning.
svn-id: r4998
2002-09-22 03:53:53 +00:00
|
|
|
shouldInterpolate = (dir & 1024) ? true : false;
|
2002-07-22 18:11:48 +00:00
|
|
|
to = toSimpleDir(dirType, dir & 1023);
|
2002-09-16 10:42:12 +00:00
|
|
|
num = dirType ? 8 : 4;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-05-10 21:35:53 +00:00
|
|
|
if (shouldInterpolate) {
|
|
|
|
// Turn left or right, depending on which is shorter.
|
2002-08-18 13:55:30 +00:00
|
|
|
diff = to - from;
|
2002-05-10 21:35:53 +00:00
|
|
|
if (abs(diff) > (num >> 1))
|
|
|
|
diff = -diff;
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-08-18 13:55:30 +00:00
|
|
|
if (diff > 0) {
|
|
|
|
to = from + 1;
|
|
|
|
} else if (diff < 0){
|
|
|
|
to = from - 1;
|
2002-05-10 21:35:53 +00:00
|
|
|
}
|
2002-08-18 13:55:30 +00:00
|
|
|
}
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-08-18 13:55:30 +00:00
|
|
|
dir = fromSimpleDir(dirType, (to + num) % num);
|
2002-05-11 14:55:03 +00:00
|
|
|
|
|
|
|
return dir;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
void Actor::setBox(int box)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-14 19:11:20 +00:00
|
|
|
walkbox = box;
|
2002-04-18 00:56:30 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
setupActorScale();
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
int Actor::actorWalkStep()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
int tmpX, tmpY;
|
|
|
|
int actorX, actorY;
|
|
|
|
int distX, distY;
|
|
|
|
int direction;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-08-18 13:55:30 +00:00
|
|
|
direction = updateActorDirection(true);
|
2002-05-14 19:11:20 +00:00
|
|
|
if (!(moving & MF_IN_LEG) || facing != direction) {
|
2002-10-23 00:22:55 +00:00
|
|
|
// FIXME - frame is never set and thus always 0! See actor.h comment
|
2002-05-14 19:11:20 +00:00
|
|
|
if (walkFrame != frame || facing != direction) {
|
|
|
|
startWalkAnim(walkFrame == frame ? 2 : 1, direction);
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2002-05-14 19:11:20 +00:00
|
|
|
moving |= MF_IN_LEG;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
actorX = x;
|
|
|
|
actorY = y;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
if (walkbox != walkdata.curbox && _vm->checkXYInBoxBounds(walkdata.curbox, actorX, actorY)) {
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(walkdata.curbox);
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
distX = abs(walkdata.newx - walkdata.x);
|
|
|
|
distY = abs(walkdata.newy - walkdata.y);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
if (abs(actorX - walkdata.x) >= distX && abs(actorY - walkdata.y) >= distY) {
|
2002-05-14 19:11:20 +00:00
|
|
|
moving &= ~MF_IN_LEG;
|
2001-10-09 14:30:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
tmpX = ((actorX + 8000) << 16) + walkdata.xfrac + (walkdata.XYFactor >> 8) * scalex;
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.xfrac = (uint16)tmpX;
|
2002-04-11 17:19:16 +00:00
|
|
|
actorX = (tmpX >> 16) - 8000;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
tmpY = (actorY << 16) + walkdata.yfrac + (walkdata.YXFactor >> 8) * scalex;
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.yfrac = (uint16)tmpY;
|
2002-04-11 17:19:16 +00:00
|
|
|
actorY = (tmpY >> 16);
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (abs(actorX - walkdata.x) > distX) {
|
|
|
|
actorX = walkdata.newx;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (abs(actorY - walkdata.y) > distY) {
|
|
|
|
actorY = walkdata.newy;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
x = actorX;
|
|
|
|
y = actorY;
|
2001-10-09 14:30:12 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::setupActorScale()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
uint16 scale;
|
|
|
|
byte *resptr;
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_features & GF_NO_SCALLING) {
|
2002-05-14 19:11:20 +00:00
|
|
|
scalex = 0xFF;
|
|
|
|
scaley = 0xFF;
|
2002-02-15 13:11:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (ignoreBoxes != 0)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-08-15 16:46:29 +00:00
|
|
|
if (_vm->getBoxFlags(walkbox) & kBoxPlayerOnly)
|
2002-05-10 16:08:22 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
scale = _vm->getBoxScale(walkbox);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
|
|
|
if (scale & 0x8000) {
|
2002-04-11 17:19:16 +00:00
|
|
|
scale = (scale & 0x7FFF) + 1;
|
2002-05-23 21:22:08 +00:00
|
|
|
resptr = _vm->getResourceAddress(rtScaleTable, scale);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (resptr == NULL)
|
|
|
|
error("Scale table %d not defined", scale);
|
2002-05-14 19:11:20 +00:00
|
|
|
int theY = y;
|
2002-09-13 12:28:53 +00:00
|
|
|
if (theY >= _vm->_realHeight)
|
|
|
|
theY = _vm->_realHeight - 1;
|
2002-05-14 19:11:20 +00:00
|
|
|
else if (theY < 0)
|
|
|
|
theY = 0;
|
|
|
|
scale = resptr[theY];
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-10-14 05:57:01 +00:00
|
|
|
// FIXME - Hack for The Dig 'Tomb' (room 88)
|
|
|
|
// Otherwise walking to the far-left door causes the actor
|
|
|
|
// to shrink to a one-pixel dot. (!?!?)
|
|
|
|
if (_vm->_gameId == GID_DIG && _vm->_currentRoom == 88) {
|
|
|
|
scale = 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-13 15:51:06 +00:00
|
|
|
// FIXME - Quick fix to ft's fuel tower bug (by yazoo)
|
|
|
|
//
|
|
|
|
// Ben's Y position can be anything between 272 and 398 inclusive
|
|
|
|
// (which by the way means that we're always looking at the same
|
|
|
|
// element in the scale table... hmmm...)
|
|
|
|
//
|
|
|
|
// When standing at the bottom of the ladder, Ben's Y position is
|
|
|
|
// 356, and by the looks of it he ought to be unscaled there.
|
|
|
|
|
|
|
|
if (scale == 1 && _vm->_currentRoom == 76) {
|
|
|
|
scale = 0xff;
|
|
|
|
if (y < 356)
|
|
|
|
scale -= 2 * (356 - y);
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (scale > 255)
|
2002-05-14 19:11:20 +00:00
|
|
|
warning("Actor %d at %d, scale %d out of range", number, y, scale);
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
scalex = (byte)scale;
|
|
|
|
scaley = (byte)scale;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-10-23 00:22:55 +00:00
|
|
|
void Actor::startAnimActor(int f)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-07 19:31:51 +00:00
|
|
|
if (_vm->_features & GF_NEW_COSTUMES) {
|
2002-10-23 00:22:55 +00:00
|
|
|
switch (f) {
|
2002-04-11 17:19:16 +00:00
|
|
|
case 1001:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = initFrame;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
|
|
|
case 1002:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = walkFrame;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
|
|
|
case 1003:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = standFrame;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
|
|
|
case 1004:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = talkFrame1;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
|
|
|
case 1005:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = talkFrame2;
|
2002-04-11 17:19:16 +00:00
|
|
|
break;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (costume != 0) {
|
|
|
|
animProgress = 0;
|
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2002-10-23 00:22:55 +00:00
|
|
|
if (f == initFrame)
|
2002-05-23 00:37:00 +00:00
|
|
|
cost.reset();
|
2002-10-23 00:22:55 +00:00
|
|
|
_vm->akos_decodeData(this, f, (uint) - 1);
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2001-12-27 17:51:58 +00:00
|
|
|
} else {
|
2002-10-23 00:22:55 +00:00
|
|
|
switch (f) {
|
2002-05-14 19:11:20 +00:00
|
|
|
case 0x38:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = initFrame;
|
2002-05-14 19:11:20 +00:00
|
|
|
break;
|
|
|
|
case 0x39:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = walkFrame;
|
2002-05-14 19:11:20 +00:00
|
|
|
break;
|
|
|
|
case 0x3A:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = standFrame;
|
2002-05-14 19:11:20 +00:00
|
|
|
break;
|
|
|
|
case 0x3B:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = talkFrame1;
|
2002-05-14 19:11:20 +00:00
|
|
|
break;
|
|
|
|
case 0x3C:
|
2002-10-23 00:22:55 +00:00
|
|
|
f = talkFrame2;
|
2002-05-14 19:11:20 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-05-20 14:41:47 +00:00
|
|
|
if (isInCurrentRoom() && costume) {
|
2002-05-14 19:11:20 +00:00
|
|
|
animProgress = 0;
|
|
|
|
cost.animCounter1 = 0;
|
|
|
|
needRedraw = true;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-10-23 00:22:55 +00:00
|
|
|
if (initFrame == f)
|
2002-05-23 00:37:00 +00:00
|
|
|
cost.reset();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-10-23 00:22:55 +00:00
|
|
|
if (f != 0x3E) {
|
|
|
|
_vm->cost_decodeData(this, f, (uint) - 1);
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
needBgReset = true;
|
2001-12-27 17:51:58 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
void Actor::animateActor(int anim)
|
|
|
|
{
|
|
|
|
int cmd, dir;
|
|
|
|
|
|
|
|
if (_vm->_features & GF_AFTER_V7) {
|
|
|
|
|
|
|
|
if (anim == 0xFF)
|
|
|
|
anim = 2000;
|
|
|
|
|
|
|
|
cmd = anim / 1000;
|
|
|
|
dir = anim % 1000;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cmd = anim >> 2;
|
2002-07-22 18:11:48 +00:00
|
|
|
dir = oldDirToNewDir(anim & 3);
|
2002-06-04 23:32:53 +00:00
|
|
|
|
|
|
|
// Convert into old cmd code
|
|
|
|
cmd = 0x3F - cmd + 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case 2:
|
|
|
|
stopActorMoving();
|
|
|
|
startAnimActor(standFrame);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
moving &= ~MF_TURN;
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(dir);
|
2002-06-04 23:32:53 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
turnToDirection(dir);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
startAnimActor(anim);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
void Actor::setDirection(int direction)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-14 19:11:20 +00:00
|
|
|
uint aMask;
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
uint16 vald;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (facing == direction)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-07-22 18:11:48 +00:00
|
|
|
facing = normalizeAngle(direction);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (costume == 0)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
aMask = 0x8000;
|
|
|
|
for (i = 0; i < 16; i++, aMask >>= 1) {
|
|
|
|
vald = cost.frame[i];
|
2002-04-11 17:19:16 +00:00
|
|
|
if (vald == 0xFFFF)
|
2001-11-26 19:57:57 +00:00
|
|
|
continue;
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_features & GF_AFTER_V7)
|
|
|
|
_vm->akos_decodeData(this, vald, aMask);
|
2002-04-11 17:19:16 +00:00
|
|
|
else
|
2002-05-23 21:22:08 +00:00
|
|
|
_vm->cost_decodeData(this, vald, aMask);
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
void Actor::putActor(int dstX, int dstY, byte newRoom)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-18 15:45:10 +00:00
|
|
|
if (visible && _vm->_currentRoom != newRoom && _vm->_vars[_vm->VAR_TALK_ACTOR] == number) {
|
|
|
|
_vm->clearMsgQueue();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
x = dstX;
|
|
|
|
y = dstY;
|
|
|
|
room = newRoom;
|
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
if (_vm->_vars[_vm->VAR_EGO] == number) {
|
|
|
|
_vm->_egoPositioned = true;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
if (visible) {
|
|
|
|
if (isInCurrentRoom()) {
|
|
|
|
if (moving) {
|
|
|
|
startAnimActor(standFrame);
|
|
|
|
moving = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-07-18 15:45:10 +00:00
|
|
|
adjustActorPos();
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
2002-07-18 15:45:10 +00:00
|
|
|
hideActor();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-07-18 15:45:10 +00:00
|
|
|
if (isInCurrentRoom())
|
|
|
|
showActor();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-16 18:51:27 +00:00
|
|
|
int Actor::getActorXYPos(int &xPos, int &yPos)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-16 18:51:27 +00:00
|
|
|
if (!isInCurrentRoom())
|
2002-04-11 20:10:47 +00:00
|
|
|
return -1;
|
|
|
|
|
2002-07-16 18:51:27 +00:00
|
|
|
xPos = x;
|
|
|
|
yPos = y;
|
2001-10-09 14:30:12 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
AdjustBoxResult Actor::adjustXYToBeInBox(int dstX, int dstY, int pathfrom)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
|
|
|
AdjustBoxResult abr, tmp;
|
2001-10-09 18:35:02 +00:00
|
|
|
uint threshold;
|
2001-10-09 14:30:12 +00:00
|
|
|
uint best;
|
2002-04-11 17:19:16 +00:00
|
|
|
int box, iterations = 0; /* Use iterations for those odd times we get stuck in the loop */
|
2002-08-12 17:01:02 +00:00
|
|
|
int firstValidBox, i, j;
|
2001-10-09 14:30:12 +00:00
|
|
|
byte flags, b;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
if (_vm->_features & GF_SMALL_HEADER)
|
2002-04-11 17:19:16 +00:00
|
|
|
firstValidBox = 0;
|
2002-03-11 08:34:12 +00:00
|
|
|
else
|
2002-04-11 17:19:16 +00:00
|
|
|
firstValidBox = 1;
|
2002-03-11 08:34:12 +00:00
|
|
|
|
2002-05-14 23:35:28 +00:00
|
|
|
abr.x = dstX;
|
|
|
|
abr.y = dstY;
|
2001-10-10 11:24:21 +00:00
|
|
|
abr.dist = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
if (ignoreBoxes == 0) {
|
2001-10-09 14:30:12 +00:00
|
|
|
threshold = 30;
|
2002-02-12 18:20:37 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
while (1) {
|
2002-03-06 10:03:00 +00:00
|
|
|
iterations++;
|
2002-04-11 17:19:16 +00:00
|
|
|
if (iterations > 1000)
|
|
|
|
return abr; /* Safety net */
|
2002-06-04 23:32:53 +00:00
|
|
|
box = _vm->getNumBoxes() - 1;
|
2002-07-27 20:11:02 +00:00
|
|
|
if (box < firstValidBox)
|
2002-03-26 05:23:06 +00:00
|
|
|
return abr;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
best = (uint) 0xFFFF;
|
2001-10-09 14:30:12 +00:00
|
|
|
b = 0;
|
|
|
|
|
2002-07-28 11:15:47 +00:00
|
|
|
if (!(_vm->_features & GF_OLD256) || box)
|
2002-07-27 20:11:02 +00:00
|
|
|
for (j = box; j >= firstValidBox; j--) {
|
2002-08-15 16:46:29 +00:00
|
|
|
flags = _vm->getBoxFlags(j);
|
|
|
|
|
|
|
|
if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
|
|
|
|
continue;
|
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (pathfrom >= firstValidBox) {
|
2002-08-15 16:46:29 +00:00
|
|
|
|
2002-08-15 22:08:29 +00:00
|
|
|
if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
|
|
|
|
continue;
|
|
|
|
|
2002-08-12 17:01:02 +00:00
|
|
|
i = _vm->getPathToDestBox(pathfrom, j);
|
2002-07-27 20:11:02 +00:00
|
|
|
if (i == -1)
|
|
|
|
continue;
|
2002-08-15 16:46:29 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (_vm->_features & GF_OLD256) {
|
|
|
|
// FIXME - we check here if the box suggested by getPathToDestBox
|
|
|
|
// is locked or not. This prevents us from walking thru
|
|
|
|
// closed doors in some cases in Zak256. However a better fix
|
|
|
|
// would be to recompute the box matrix whenever flags change.
|
|
|
|
flags = _vm->getBoxFlags(i);
|
2002-08-15 16:46:29 +00:00
|
|
|
if (flags & kBoxLocked && (!(flags & kBoxPlayerOnly)))
|
|
|
|
continue;
|
|
|
|
if (flags & kBoxInvisible && (!(flags & kBoxPlayerOnly) || isInClass(31)))
|
2002-07-16 14:54:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
2002-07-27 20:11:02 +00:00
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (!_vm->inBoxQuickReject(j, dstX, dstY, threshold))
|
|
|
|
continue;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (_vm->checkXYInBoxBounds(j, dstX, dstY)) {
|
|
|
|
abr.x = dstX;
|
|
|
|
abr.y = dstY;
|
|
|
|
abr.dist = j;
|
|
|
|
return abr;
|
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
tmp = _vm->getClosestPtOnBox(j, dstX, dstY);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (tmp.dist >= best)
|
|
|
|
continue;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
abr.x = tmp.x;
|
|
|
|
abr.y = tmp.y;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-27 20:11:02 +00:00
|
|
|
if (tmp.dist == 0) {
|
|
|
|
abr.dist = j;
|
|
|
|
return abr;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-07-27 20:11:02 +00:00
|
|
|
best = tmp.dist;
|
|
|
|
b = j;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
if (threshold == 0 || threshold * threshold >= best) {
|
2001-10-09 14:30:12 +00:00
|
|
|
abr.dist = b;
|
|
|
|
return abr;
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
threshold = (threshold == 30) ? 80 : 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
2002-07-15 18:11:30 +00:00
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
return abr;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::adjustActorPos()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
AdjustBoxResult abr;
|
|
|
|
byte flags;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-15 18:11:30 +00:00
|
|
|
abr = adjustXYToBeInBox(x, y, -1);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
x = abr.x;
|
|
|
|
y = abr.y;
|
|
|
|
walkdata.destbox = (byte)abr.dist;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(abr.dist);
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.destx = -1;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
moving = 0;
|
|
|
|
cost.animCounter2 = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_features & GF_AFTER_V7) {
|
2002-05-20 16:02:29 +00:00
|
|
|
stopActorMoving();
|
|
|
|
}
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
flags = _vm->getBoxFlags(walkbox);
|
2002-04-11 17:19:16 +00:00
|
|
|
if (flags & 7) {
|
2002-05-14 19:11:20 +00:00
|
|
|
turnToDirection(facing);
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::turnToDirection(int newdir)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-14 19:11:20 +00:00
|
|
|
if (newdir == -1)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
moving &= ~MF_TURN;
|
|
|
|
|
|
|
|
if (newdir != facing) {
|
|
|
|
moving = MF_TURN;
|
|
|
|
newDirection = newdir;
|
2002-08-04 02:53:50 +00:00
|
|
|
|
|
|
|
// FIXME - workaround for bug #558236
|
|
|
|
if (_vm->_gameId == GID_INDY4 && room == 39 && x == 617 && y == 125 && newdir == 180)
|
|
|
|
startAnimActor(standFrame);
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::hideActor()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-14 19:11:20 +00:00
|
|
|
if (!visible)
|
2001-11-26 19:57:57 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving) {
|
|
|
|
startAnimActor(standFrame);
|
|
|
|
moving = 0;
|
2001-11-26 19:57:57 +00:00
|
|
|
}
|
2002-05-14 19:11:20 +00:00
|
|
|
visible = false;
|
|
|
|
cost.animCounter2 = 0;
|
|
|
|
needRedraw = false;
|
|
|
|
needBgReset = true;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::showActor()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_currentRoom == 0 || visible)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
adjustActorPos();
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
_vm->ensureResourceLoaded(rtCostume, costume);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (costumeNeedsInit) {
|
|
|
|
startAnimActor(initFrame);
|
|
|
|
costumeNeedsInit = false;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-05-14 19:11:20 +00:00
|
|
|
moving = 0;
|
|
|
|
visible = true;
|
|
|
|
needRedraw = true;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::showActors()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
Actor *a;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2001-10-09 14:30:12 +00:00
|
|
|
a = derefActor(i);
|
2002-05-20 14:41:47 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2002-05-14 19:11:20 +00:00
|
|
|
a->showActor();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::stopTalk()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int act;
|
|
|
|
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->stopTalkSound();
|
2001-11-14 18:40:39 +00:00
|
|
|
|
2001-10-09 14:30:12 +00:00
|
|
|
_haveMsg = 0;
|
|
|
|
_talkDelay = 0;
|
|
|
|
|
2001-10-16 10:01:48 +00:00
|
|
|
act = _vars[VAR_TALK_ACTOR];
|
2002-04-11 17:19:16 +00:00
|
|
|
if (act && act < 0x80) {
|
2001-10-09 14:30:12 +00:00
|
|
|
Actor *a = derefActorSafe(act, "stopTalk");
|
2002-10-20 16:49:30 +00:00
|
|
|
if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_AFTER_V7)) {
|
2002-05-14 19:11:20 +00:00
|
|
|
a->startAnimActor(a->talkFrame2);
|
2001-11-05 19:21:49 +00:00
|
|
|
_useTalkAnims = false;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
_vars[VAR_TALK_ACTOR] = 0xFF;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
_keepText = false;
|
|
|
|
restoreCharsetBg();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::clearMsgQueue()
|
|
|
|
{
|
|
|
|
_messagePtr = (byte *)" ";
|
2001-10-09 14:30:12 +00:00
|
|
|
stopTalk();
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::walkActors()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
Actor *a;
|
2002-02-22 16:06:09 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2002-02-22 16:06:09 +00:00
|
|
|
a = derefActor(i);
|
2002-05-20 14:41:47 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2002-04-11 17:19:16 +00:00
|
|
|
if (_features & GF_OLD256)
|
2002-05-14 19:11:20 +00:00
|
|
|
a->walkActorOld();
|
2002-04-11 17:19:16 +00:00
|
|
|
else
|
2002-05-14 19:11:20 +00:00
|
|
|
a->walkActor();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-23 19:51:50 +00:00
|
|
|
/* Used in Scumm v5 only. Play sounds associated with actors */
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::playActorSounds()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
Actor *a;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2001-10-09 14:30:12 +00:00
|
|
|
a = derefActor(i);
|
2002-05-20 14:41:47 +00:00
|
|
|
if (a->cost.animCounter2 && a->isInCurrentRoom() && a->sound) {
|
2001-10-09 14:30:12 +00:00
|
|
|
_currentScript = 0xFF;
|
2002-08-14 20:43:56 +00:00
|
|
|
_sound->addSoundToQueue(a->sound[0]);
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2001-10-09 14:30:12 +00:00
|
|
|
a = derefActor(i);
|
|
|
|
a->cost.animCounter2 = 0;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-06-07 16:54:11 +00:00
|
|
|
#define DRAW_ORDER(x) ((x)->y - ((x)->layer << 11))
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::processActors()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
2002-06-07 16:54:11 +00:00
|
|
|
Actor *actors[MAX_ACTORS], *a, **ac, **ac2, *tmp, **end;
|
|
|
|
int numactors = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-06-01 21:45:15 +00:00
|
|
|
// Make a list of all actors in this room
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2001-10-09 14:30:12 +00:00
|
|
|
a = derefActor(i);
|
2002-05-20 14:41:47 +00:00
|
|
|
if (a->isInCurrentRoom())
|
2001-10-09 14:30:12 +00:00
|
|
|
actors[numactors++] = a;
|
|
|
|
}
|
|
|
|
if (!numactors)
|
|
|
|
return;
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-06-07 16:54:11 +00:00
|
|
|
end = actors + numactors;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-06-01 21:45:15 +00:00
|
|
|
// Sort actors by position before we draw them (to ensure that actors in
|
2002-06-04 23:32:53 +00:00
|
|
|
// front are drawn after those "behind" them).
|
2002-07-07 19:31:51 +00:00
|
|
|
for (ac = end - 1; ac >= actors; --ac) {
|
|
|
|
for (ac2 = actors; ac2 != ac; ++ac2) {
|
|
|
|
if (DRAW_ORDER(*ac2) > DRAW_ORDER(*(ac2 + 1))) {
|
|
|
|
tmp = *(ac2 + 1);
|
|
|
|
*(ac2 + 1) = *ac2;
|
2001-10-09 14:30:12 +00:00
|
|
|
*ac2 = tmp;
|
|
|
|
}
|
2002-06-07 16:54:11 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-06-07 16:54:11 +00:00
|
|
|
// Finally draw the now sorted actors
|
|
|
|
for (ac = actors; ac != end; ++ac) {
|
2001-10-09 14:30:12 +00:00
|
|
|
a = *ac;
|
|
|
|
if (a->costume) {
|
2002-04-11 17:19:16 +00:00
|
|
|
CHECK_HEAP getMaskFromBox(a->walkbox);
|
2002-05-23 00:37:00 +00:00
|
|
|
a->drawActorCostume();
|
2002-08-04 02:53:50 +00:00
|
|
|
CHECK_HEAP a->animateCostume();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-06-07 16:54:11 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
void Actor::drawActorCostume()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-15 22:56:24 +00:00
|
|
|
if (!needRedraw)
|
|
|
|
return;
|
2002-07-07 19:31:51 +00:00
|
|
|
|
2002-07-15 22:56:24 +00:00
|
|
|
needRedraw = false;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-07-15 22:56:24 +00:00
|
|
|
setupActorScale();
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-07-15 22:56:24 +00:00
|
|
|
if (!(_vm->_features & GF_AFTER_V7)) {
|
|
|
|
CostumeRenderer cr(_vm);
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
cr._actorX = x - _vm->virtscr->xstart;
|
2002-05-23 00:37:00 +00:00
|
|
|
cr._actorY = y - elevation;
|
|
|
|
cr._scaleX = scalex;
|
|
|
|
cr._scaleY = scaley;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
cr._outheight = _vm->virtscr->height;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-10-23 08:40:57 +00:00
|
|
|
// FIXME - Hack to fix two glitches in the scene where Bobbin
|
|
|
|
// heals Rusty: Bobbin's feet get masked when Rusty shows him
|
|
|
|
// what happens to The Forge, and Rusty gets masked after
|
|
|
|
// Bobbin heals him.
|
2002-10-17 09:21:55 +00:00
|
|
|
//
|
2002-10-23 08:40:57 +00:00
|
|
|
// When an actor is moved around without regards to walkboxes,
|
|
|
|
// its walkbox is set to 0. Unfortunately that's a valid
|
|
|
|
// walkbox in older games, and its mask may be completely
|
|
|
|
// wrong for this purpose.
|
2002-10-17 09:21:55 +00:00
|
|
|
//
|
2002-10-23 08:40:57 +00:00
|
|
|
// So instead use the mask of the box where the actor happens
|
|
|
|
// to be at the moment or, if it's not in any box, don't mask
|
|
|
|
// at all.
|
2002-10-17 09:21:55 +00:00
|
|
|
//
|
2002-10-23 08:40:57 +00:00
|
|
|
// Checking if ignoreBoxes != 0 isn't enough to fix all the
|
|
|
|
// glitches, so I have to check for walkbox 0. However, that
|
|
|
|
// gives too many false positives -- it breaks masking in a
|
|
|
|
// few other rooms, e.g. when Stoke leaves the room where he
|
|
|
|
// locks up "Rusty".
|
|
|
|
//
|
|
|
|
// Until someone can find the proper fix, only apply it to the
|
|
|
|
// one room where it's actually needed.
|
2002-10-17 09:21:55 +00:00
|
|
|
|
2002-10-23 08:40:57 +00:00
|
|
|
if (_vm->_gameId == GID_LOOM256 && _vm->_currentRoom == 34 && walkbox == 0) {
|
|
|
|
int num_boxes, i;
|
2002-10-17 09:21:55 +00:00
|
|
|
|
|
|
|
cr._zbuf = 0;
|
2002-10-23 08:40:57 +00:00
|
|
|
num_boxes = _vm->getNumBoxes();
|
|
|
|
|
|
|
|
// For this particular room it won't matter in which
|
|
|
|
// direction we loop. In other rooms, looping in the
|
|
|
|
// other direction may pick the wrong box.
|
2002-10-17 09:21:55 +00:00
|
|
|
|
2002-10-23 08:40:57 +00:00
|
|
|
for (i = 0; i < num_boxes; i++) {
|
2002-10-17 09:21:55 +00:00
|
|
|
if (_vm->checkXYInBoxBounds(i, x, y)) {
|
|
|
|
cr._zbuf = _vm->getMaskFromBox(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
cr._zbuf = _vm->getMaskFromBox(walkbox);
|
2002-07-26 15:55:21 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
if (forceClip)
|
2002-07-26 18:07:40 +00:00
|
|
|
cr._zbuf = forceClip;
|
2002-07-26 16:50:41 +00:00
|
|
|
else if (isInClass(20))
|
|
|
|
cr._zbuf = 0;
|
|
|
|
else if (cr._zbuf > _vm->gdi._numZBuffer)
|
|
|
|
cr._zbuf = (byte)_vm->gdi._numZBuffer;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
cr._shadow_table = _vm->_shadowPalette;
|
2001-12-27 17:51:58 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
cr.setCostume(costume);
|
|
|
|
cr.setPalette(palette);
|
|
|
|
cr.setFacing(facing);
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
top = 0xFF;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
bottom = 0;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-03-05 23:05:55 +00:00
|
|
|
/* if the actor is partially hidden, redraw it next frame */
|
2002-05-23 00:37:00 +00:00
|
|
|
if (cr.drawCostume(this) & 1) {
|
|
|
|
needBgReset = true;
|
|
|
|
needRedraw = true;
|
2002-03-05 23:05:55 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-05-23 21:22:08 +00:00
|
|
|
AkosRenderer ar(_vm);
|
2002-10-03 07:38:03 +00:00
|
|
|
ar.charsetmask = true;
|
2002-10-22 11:47:45 +00:00
|
|
|
ar._x = x - _vm->virtscr->xstart;
|
|
|
|
ar._y = y - elevation;
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.scale_x = scalex;
|
|
|
|
ar.scale_y = scaley;
|
|
|
|
ar.clipping = forceClip;
|
2002-03-05 23:05:55 +00:00
|
|
|
if (ar.clipping == 100) {
|
2002-07-26 16:50:41 +00:00
|
|
|
ar.clipping = _vm->getMaskFromBox(walkbox);
|
2002-05-23 21:22:08 +00:00
|
|
|
if (ar.clipping > (byte)_vm->gdi._numZBuffer)
|
|
|
|
ar.clipping = _vm->gdi._numZBuffer;
|
2002-03-05 23:05:55 +00:00
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
ar.outptr = _vm->virtscr->screenPtr + _vm->virtscr->xstart;
|
|
|
|
ar.outwidth = _vm->virtscr->width;
|
|
|
|
ar.outheight = _vm->virtscr->height;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.shadow_mode = shadow_mode;
|
2002-05-23 21:22:08 +00:00
|
|
|
ar.shadow_table = _vm->_shadowPalette;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.setCostume(costume);
|
|
|
|
ar.setPalette(palette);
|
|
|
|
ar.setFacing(this);
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.dirty_id = number;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.cd = &cost;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
ar.draw_top = top = 0x7fffffff;
|
|
|
|
ar.draw_bottom = bottom = 0;
|
|
|
|
ar.drawCostume();
|
|
|
|
top = ar.draw_top;
|
|
|
|
bottom = ar.draw_bottom;
|
2002-03-05 23:05:55 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-08-04 02:53:50 +00:00
|
|
|
void Actor::animateCostume()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-05-23 00:37:00 +00:00
|
|
|
if (costume == 0)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-23 00:37:00 +00:00
|
|
|
animProgress++;
|
|
|
|
if (animProgress >= animSpeed) {
|
|
|
|
animProgress = 0;
|
2001-11-26 19:57:57 +00:00
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->_features & GF_AFTER_V7) {
|
|
|
|
byte *akos = _vm->getResourceAddress(rtCostume, costume);
|
2002-03-05 23:05:55 +00:00
|
|
|
assert(akos);
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->akos_increaseAnims(akos, this)) {
|
2002-05-23 00:37:00 +00:00
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2002-03-05 23:05:55 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-07-15 22:56:24 +00:00
|
|
|
LoadedCostume lc(_vm);
|
|
|
|
lc.loadCostume(costume);
|
|
|
|
if (lc.increaseAnims(this)) {
|
2002-05-23 00:37:00 +00:00
|
|
|
needRedraw = true;
|
|
|
|
needBgReset = true;
|
2002-03-05 23:05:55 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-17 12:52:53 +00:00
|
|
|
void Scumm::setActorRedrawFlags(bool fg, bool bg)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
2001-11-26 19:57:57 +00:00
|
|
|
uint32 bits;
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-06-07 16:54:11 +00:00
|
|
|
if (_fullRedraw) {
|
|
|
|
for (j = 0; j < NUM_ACTORS; j++) {
|
|
|
|
Actor *a = derefActor(j);
|
2002-09-17 12:52:53 +00:00
|
|
|
if (fg)
|
|
|
|
a->needRedraw = true;
|
|
|
|
if (bg)
|
|
|
|
a->needBgReset = true;
|
2002-06-07 16:54:11 +00:00
|
|
|
}
|
|
|
|
} else {
|
2002-10-24 06:28:54 +00:00
|
|
|
for (i = 0; i < gdi._numStrips; i++) {
|
2002-06-07 16:54:11 +00:00
|
|
|
bits = gfxUsageBits[_screenStartStrip + i];
|
|
|
|
if (bits & 0x3FFFFFFF) {
|
|
|
|
for (j = 0; j < NUM_ACTORS; j++) {
|
|
|
|
if ((bits & (1 << j)) && bits != (uint32)(1 << j)) {
|
|
|
|
Actor *a = derefActor(j);
|
2002-09-17 12:52:53 +00:00
|
|
|
if (fg)
|
|
|
|
a->needRedraw = true;
|
|
|
|
if (bg)
|
|
|
|
a->needBgReset = true;
|
2002-06-07 16:54:11 +00:00
|
|
|
}
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
int Scumm::getActorFromPos(int x, int y)
|
|
|
|
{
|
2001-11-26 19:57:57 +00:00
|
|
|
uint32 drawbits;
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
drawbits = gfxUsageBits[x >> 3];
|
2001-11-26 19:57:57 +00:00
|
|
|
if (!(drawbits & 0x3FFFFFFF))
|
2001-10-09 14:30:12 +00:00
|
|
|
return 0;
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 1; i < NUM_ACTORS; i++) {
|
2001-10-09 14:30:12 +00:00
|
|
|
Actor *a = derefActor(i);
|
2002-07-07 19:31:51 +00:00
|
|
|
if (drawbits & (1 << i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) {
|
2001-10-09 14:30:12 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
void Scumm::actorTalk()
|
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int oldact;
|
|
|
|
Actor *a;
|
|
|
|
|
|
|
|
_msgPtrToAdd = charset._buffer;
|
|
|
|
_messagePtr = addMessageToStack(_messagePtr);
|
2002-07-07 19:31:51 +00:00
|
|
|
assert((int)(_msgPtrToAdd - charset._buffer) < (int)(sizeof(charset._buffer)));
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
if (_actorToPrintStrFor == 0xFF) {
|
2001-10-09 14:30:12 +00:00
|
|
|
if (!_keepText)
|
|
|
|
stopTalk();
|
2001-10-16 10:01:48 +00:00
|
|
|
_vars[VAR_TALK_ACTOR] = 0xFF;
|
2001-10-09 14:30:12 +00:00
|
|
|
oldact = 0;
|
|
|
|
} else {
|
|
|
|
a = derefActorSafe(_actorToPrintStrFor, "actorTalk");
|
2002-05-20 14:41:47 +00:00
|
|
|
if (!a->isInCurrentRoom() && !(_features & GF_AFTER_V7)) {
|
2001-10-09 14:30:12 +00:00
|
|
|
oldact = 0xFF;
|
|
|
|
} else {
|
|
|
|
if (!_keepText)
|
|
|
|
stopTalk();
|
2001-10-16 10:01:48 +00:00
|
|
|
_vars[VAR_TALK_ACTOR] = a->number;
|
2002-09-22 01:17:53 +00:00
|
|
|
if (!_string[0].no_talk_anim) {
|
2002-05-14 19:11:20 +00:00
|
|
|
a->startAnimActor(a->talkFrame1);
|
2001-11-05 19:21:49 +00:00
|
|
|
_useTalkAnims = true;
|
|
|
|
}
|
2001-10-16 10:01:48 +00:00
|
|
|
oldact = _vars[VAR_TALK_ACTOR];
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
2002-04-11 17:19:16 +00:00
|
|
|
if (oldact >= 0x80)
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
|
|
|
if (_vars[VAR_TALK_ACTOR] > 0x7F) {
|
2002-09-22 01:17:53 +00:00
|
|
|
_charsetColor = (byte)_string[0].color;
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
2001-10-16 10:01:48 +00:00
|
|
|
a = derefActorSafe(_vars[VAR_TALK_ACTOR], "actorTalk(2)");
|
2001-10-09 14:30:12 +00:00
|
|
|
_charsetColor = a->talkColor;
|
|
|
|
}
|
|
|
|
charset._bufPos = 0;
|
|
|
|
_talkDelay = 0;
|
|
|
|
_haveMsg = 0xFF;
|
2001-10-16 10:01:48 +00:00
|
|
|
_vars[VAR_HAVE_MSG] = 0xFF;
|
2001-10-09 14:30:12 +00:00
|
|
|
CHARSET_1();
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::setActorCostume(int c)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
int i;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
costumeNeedsInit = true;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (visible) {
|
|
|
|
hideActor();
|
2002-05-23 00:37:00 +00:00
|
|
|
cost.reset();
|
2002-05-14 19:11:20 +00:00
|
|
|
costume = c;
|
|
|
|
showActor();
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
2002-05-14 19:11:20 +00:00
|
|
|
costume = c;
|
2002-05-23 00:37:00 +00:00
|
|
|
cost.reset();
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
for (i = 0; i < 32; i++)
|
2002-05-14 19:11:20 +00:00
|
|
|
palette[i] = 0xFF;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::startWalkActor(int destX, int destY, int dir)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2001-10-09 14:30:12 +00:00
|
|
|
AdjustBoxResult abr;
|
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
abr = adjustXYToBeInBox(destX, destY, walkbox);
|
2001-10-09 14:30:12 +00:00
|
|
|
|
2002-05-20 14:41:47 +00:00
|
|
|
if (!isInCurrentRoom()) {
|
2002-05-14 19:11:20 +00:00
|
|
|
x = abr.x;
|
2002-07-15 15:29:47 +00:00
|
|
|
y = abr.y;
|
2001-11-26 19:57:57 +00:00
|
|
|
if (dir != -1)
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(dir);
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (ignoreBoxes != 0) {
|
2001-10-09 14:30:12 +00:00
|
|
|
abr.dist = 0;
|
2002-05-14 19:11:20 +00:00
|
|
|
walkbox = 0;
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
2002-10-23 08:40:57 +00:00
|
|
|
// FIXME: this prevents part of bug #605970 (Loom) from
|
|
|
|
// occuring, and also fixes a walk bug with Rusty's ghost.
|
|
|
|
// Not sure if there is a better way to achieve this.
|
2002-09-21 00:23:45 +00:00
|
|
|
if (walkbox == 0)
|
|
|
|
adjustActorPos();
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
if (_vm->checkXYInBoxBounds(walkdata.destbox, abr.x, abr.y)) {
|
2002-05-14 19:11:20 +00:00
|
|
|
abr.dist = walkdata.destbox;
|
2001-10-09 14:30:12 +00:00
|
|
|
} else {
|
2002-06-04 23:32:53 +00:00
|
|
|
abr = adjustXYToBeInBox(abr.x, abr.y, walkbox);
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
2002-07-07 19:31:51 +00:00
|
|
|
if (moving && walkdata.destdir == dir && walkdata.destx == abr.x && walkdata.desty == abr.y)
|
2002-04-11 17:19:16 +00:00
|
|
|
return;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (x == abr.x && y == abr.y) {
|
|
|
|
turnToDirection(dir);
|
2001-10-09 14:30:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.destx = abr.x;
|
|
|
|
walkdata.desty = abr.y;
|
|
|
|
walkdata.destbox = (byte)abr.dist; /* a box */
|
|
|
|
walkdata.destdir = dir;
|
|
|
|
moving = (moving & MF_IN_LEG) | MF_NEW_LEG;
|
|
|
|
walkdata.point3x = 32000;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.curbox = walkbox;
|
2001-10-09 14:30:12 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
void Actor::startWalkAnim(int cmd, int angle)
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-15 21:50:51 +00:00
|
|
|
if (angle == -1)
|
|
|
|
angle = facing;
|
2001-11-05 19:21:49 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
/*FIXME: (yazoo): the walk script are buggy in dig causing
|
|
|
|
* troubles while walking. It's disabled until I can
|
|
|
|
* find a proper fix
|
|
|
|
* note: walk scripts aren't required to make the game
|
|
|
|
* work as usual */
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
/* int16 args[16];
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (walk_script != 0) {
|
|
|
|
args[2] = angle;
|
|
|
|
args[0] = number;
|
|
|
|
args[1] = cmd;
|
|
|
|
_vm->runScript(walk_script, 1, 0, args);
|
|
|
|
} else*/ {
|
|
|
|
switch (cmd) {
|
|
|
|
case 1: /* start walk */
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(angle);
|
2002-07-15 21:50:51 +00:00
|
|
|
startAnimActor(walkFrame);
|
|
|
|
break;
|
|
|
|
case 2: /* change dir only */
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(angle);
|
2002-07-15 21:50:51 +00:00
|
|
|
break;
|
|
|
|
case 3: /* stop walk */
|
|
|
|
turnToDirection(angle);
|
|
|
|
startAnimActor(standFrame);
|
|
|
|
break;
|
|
|
|
}
|
2001-12-11 13:34:15 +00:00
|
|
|
}
|
2002-07-15 21:50:51 +00:00
|
|
|
}
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
void Actor::walkActor()
|
|
|
|
{
|
|
|
|
int j;
|
2002-08-12 16:05:14 +00:00
|
|
|
int16 foundPathX, foundPathY;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (!moving)
|
|
|
|
return;
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (!(moving & MF_NEW_LEG)) {
|
|
|
|
if (moving & MF_IN_LEG && actorWalkStep())
|
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (moving & MF_LAST_LEG) {
|
|
|
|
moving = 0;
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(walkdata.destbox);
|
2002-07-15 21:50:51 +00:00
|
|
|
startWalkAnim(3, walkdata.destdir);
|
|
|
|
return;
|
|
|
|
}
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (moving & MF_TURN) {
|
2002-08-18 13:55:30 +00:00
|
|
|
j = updateActorDirection(false);
|
2002-07-15 21:50:51 +00:00
|
|
|
if (facing != j)
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(j);
|
2002-07-15 21:50:51 +00:00
|
|
|
else
|
|
|
|
moving = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(walkdata.curbox);
|
2002-07-15 21:50:51 +00:00
|
|
|
moving &= MF_IN_LEG;
|
2001-12-11 13:34:15 +00:00
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
do {
|
|
|
|
moving &= ~MF_NEW_LEG;
|
|
|
|
if ((!walkbox && (!(_vm->_features & GF_SMALL_HEADER)))) {
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(walkdata.destbox);
|
2002-07-15 21:50:51 +00:00
|
|
|
walkdata.curbox = walkdata.destbox;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (walkbox == walkdata.destbox)
|
|
|
|
break;
|
|
|
|
j = _vm->getPathToDestBox(walkbox, walkdata.destbox);
|
|
|
|
if (j == -1 || j > 0xF0) {
|
|
|
|
walkdata.destbox = walkbox;
|
|
|
|
moving |= MF_LAST_LEG;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
walkdata.curbox = j;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-08-12 16:05:14 +00:00
|
|
|
if (_vm->findPathTowards(this, walkbox, j, walkdata.destbox, foundPathX, foundPathY))
|
2002-07-15 21:50:51 +00:00
|
|
|
break;
|
2002-08-12 16:05:14 +00:00
|
|
|
if (calcMovementFactor(foundPathX, foundPathY))
|
2002-07-15 21:50:51 +00:00
|
|
|
return;
|
2001-12-11 13:34:15 +00:00
|
|
|
|
2002-07-18 15:45:10 +00:00
|
|
|
setBox(walkdata.curbox);
|
2002-07-15 21:50:51 +00:00
|
|
|
} while (1);
|
|
|
|
|
|
|
|
moving |= MF_LAST_LEG;
|
|
|
|
calcMovementFactor(walkdata.destx, walkdata.desty);
|
2001-12-11 13:34:15 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
void Actor::walkActorOld()
|
2002-04-11 17:19:16 +00:00
|
|
|
{
|
2002-07-15 21:50:51 +00:00
|
|
|
ScummPoint gateLoc[5]; // Gate locations
|
2002-04-11 17:19:16 +00:00
|
|
|
int new_dir, next_box;
|
2002-03-18 22:48:57 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (!moving)
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving & MF_NEW_LEG) {
|
2002-04-11 17:19:16 +00:00
|
|
|
restart:
|
2002-05-14 19:11:20 +00:00
|
|
|
moving &= ~MF_NEW_LEG;
|
2002-03-18 22:48:57 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (walkbox == 0xFF) {
|
|
|
|
walkbox = walkdata.destbox;
|
|
|
|
walkdata.curbox = walkdata.destbox;
|
|
|
|
moving |= MF_LAST_LEG;
|
|
|
|
calcMovementFactor(walkdata.destx, walkdata.desty);
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (walkbox == walkdata.destbox) {
|
|
|
|
moving |= MF_LAST_LEG;
|
|
|
|
calcMovementFactor(walkdata.destx, walkdata.desty);
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-23 21:22:08 +00:00
|
|
|
next_box = _vm->getPathToDestBox(walkbox, walkdata.destbox);
|
2002-03-18 22:48:57 +00:00
|
|
|
|
2002-04-11 17:19:16 +00:00
|
|
|
if (next_box == -1) {
|
2002-05-14 19:11:20 +00:00
|
|
|
moving |= MF_LAST_LEG;
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.curbox = next_box;
|
2002-03-18 22:48:57 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
_vm->findPathTowardsOld(this, walkbox, next_box, walkdata.destbox, gateLoc);
|
|
|
|
if (gateLoc[2].x == 32000 && gateLoc[3].x == 32000) {
|
2002-05-14 19:11:20 +00:00
|
|
|
moving |= MF_LAST_LEG;
|
|
|
|
calcMovementFactor(walkdata.destx, walkdata.desty);
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (gateLoc[2].x != 32000) {
|
|
|
|
if (calcMovementFactor(gateLoc[2].x, gateLoc[2].y)) {
|
|
|
|
walkdata.point3x = gateLoc[3].x;
|
|
|
|
walkdata.point3y = gateLoc[3].y;
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
if (calcMovementFactor(gateLoc[3].x, gateLoc[3].y))
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
2002-04-11 17:19:16 +00:00
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkbox = walkdata.destbox;
|
2002-03-18 22:48:57 +00:00
|
|
|
goto restart;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving & MF_IN_LEG) {
|
|
|
|
if (actorWalkStep())
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving & MF_LAST_LEG) {
|
|
|
|
moving = 0;
|
|
|
|
startWalkAnim(3, walkdata.destdir);
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (moving & MF_TURN) {
|
2002-08-18 13:55:30 +00:00
|
|
|
new_dir = updateActorDirection(false);
|
2002-05-14 19:11:20 +00:00
|
|
|
if (facing != new_dir) {
|
2002-07-18 15:45:10 +00:00
|
|
|
setDirection(new_dir);
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-05-14 19:11:20 +00:00
|
|
|
moving = 0;
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
if (walkdata.point3x != 32000) {
|
|
|
|
if (calcMovementFactor(walkdata.point3x, walkdata.point3y)) {
|
|
|
|
walkdata.point3x = 32000;
|
2002-03-18 22:48:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-05-14 19:11:20 +00:00
|
|
|
walkdata.point3x = 32000;
|
2002-03-18 22:48:57 +00:00
|
|
|
}
|
|
|
|
|
2002-05-14 19:11:20 +00:00
|
|
|
walkbox = walkdata.curbox;
|
|
|
|
moving &= MF_IN_LEG;
|
|
|
|
moving |= MF_NEW_LEG;
|
2002-04-11 17:19:16 +00:00
|
|
|
goto restart;
|
2002-03-18 22:48:57 +00:00
|
|
|
}
|
2002-06-04 23:32:53 +00:00
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
byte *Actor::getActorName()
|
|
|
|
{
|
|
|
|
byte *ptr = _vm->getResourceAddress(rtActorName, number);
|
|
|
|
if (ptr == NULL)
|
|
|
|
return (byte *)" ";
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2002-08-19 17:23:48 +00:00
|
|
|
void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
|
2002-07-15 21:50:51 +00:00
|
|
|
{
|
|
|
|
byte *akos, *rgbs, *akpl;
|
|
|
|
int akpl_size, i;
|
|
|
|
int r, g, b;
|
|
|
|
byte akpl_color;
|
|
|
|
|
|
|
|
if (!isInCurrentRoom()) {
|
|
|
|
warning("Remap actor %d not in current room", number);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (costume < 1 || costume >= _vm->_numCostumes - 1) {
|
|
|
|
warning("Remap actor %d invalid costume", number, costume);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
akos = _vm->getResourceAddress(rtCostume, costume);
|
2002-10-02 09:14:59 +00:00
|
|
|
if (!akos) {
|
|
|
|
warning("Can't remap actor %d, costume %d not found", number, costume);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
akpl = findResource(MKID('AKPL'), akos);
|
2002-10-02 09:14:59 +00:00
|
|
|
if (!akpl) {
|
|
|
|
warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume);
|
|
|
|
return;
|
|
|
|
}
|
2002-07-15 21:50:51 +00:00
|
|
|
|
|
|
|
//get num palette entries
|
|
|
|
akpl_size = RES_SIZE(akpl) - 8;
|
|
|
|
|
|
|
|
//skip resource header
|
|
|
|
akpl = RES_DATA(akpl);
|
|
|
|
|
|
|
|
rgbs = findResource(MKID('RGBS'), akos);
|
|
|
|
|
|
|
|
if (!rgbs) {
|
|
|
|
warning("Can't remap actor %d costume %d doesn't contain an RGB block", number, costume);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// skip resource header
|
|
|
|
rgbs = RES_DATA(rgbs);
|
|
|
|
|
2002-10-02 09:14:59 +00:00
|
|
|
// FIXME!!! - Ender's hack to workaround a crash in Full Throttle.
|
|
|
|
// After touching the ladder at the Fuel Tower, memory
|
|
|
|
// gets trashed when the police fly down to the tower.
|
|
|
|
// This seems to happen with an akpl 256 supposidly 256
|
|
|
|
// bytes long, but which in reality is less than 65 bytes?!?
|
|
|
|
// Someone -please- fix this properly.
|
|
|
|
if (akpl_size > 255) {
|
|
|
|
warning("Actor palette for actor %d/costume %d is %d bytes - too big!", number, costume, akpl_size);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-15 21:50:51 +00:00
|
|
|
for (i = 0; i < akpl_size; i++) {
|
|
|
|
r = *rgbs++;
|
|
|
|
g = *rgbs++;
|
|
|
|
b = *rgbs++;
|
|
|
|
|
|
|
|
akpl_color = *akpl++;
|
|
|
|
|
|
|
|
// allow remap of generic palette entry?
|
|
|
|
if (!shadow_mode || akpl_color >= 16) {
|
|
|
|
if (r_fact != 256)
|
|
|
|
r = (r * r_fact) >> 8;
|
|
|
|
if (g_fact != 256)
|
|
|
|
g = (g * g_fact) >> 8;
|
|
|
|
if (b_fact != 256)
|
|
|
|
b = (b * b_fact) >> 8;
|
|
|
|
palette[i] = _vm->remapPaletteColor(r, g, b, threshold);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-04 23:32:53 +00:00
|
|
|
void Scumm::resetActorBgs()
|
|
|
|
{
|
|
|
|
Actor *a;
|
|
|
|
int i;
|
|
|
|
uint32 onlyActorFlags, bitpos;
|
|
|
|
|
2002-10-24 06:28:54 +00:00
|
|
|
for (i = 0; i < gdi._numStrips; i++) {
|
2002-06-04 23:32:53 +00:00
|
|
|
onlyActorFlags = (gfxUsageBits[_screenStartStrip + i] &= 0x3FFFFFFF);
|
|
|
|
a = getFirstActor();
|
|
|
|
bitpos = 1;
|
|
|
|
|
|
|
|
while (onlyActorFlags) {
|
|
|
|
if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) {
|
|
|
|
gfxUsageBits[_screenStartStrip + i] ^= bitpos;
|
|
|
|
|
2002-07-07 19:31:51 +00:00
|
|
|
if ((a->bottom - a->top) >= 0)
|
2002-06-04 23:32:53 +00:00
|
|
|
gdi.resetBackground(a->top, a->bottom, i);
|
|
|
|
}
|
|
|
|
bitpos <<= 1;
|
|
|
|
onlyActorFlags >>= 1;
|
|
|
|
a++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) {
|
|
|
|
a->needBgReset = false;
|
|
|
|
}
|
|
|
|
}
|
2002-07-15 22:56:24 +00:00
|
|
|
|
2002-07-26 16:13:04 +00:00
|
|
|
void Actor::classChanged(int cls, bool value)
|
|
|
|
{
|
|
|
|
switch(cls) {
|
|
|
|
case 20: // Never clip
|
|
|
|
break;
|
|
|
|
case 21: // Always clip
|
2002-07-26 16:50:41 +00:00
|
|
|
forceClip = value;
|
2002-07-26 16:13:04 +00:00
|
|
|
break;
|
|
|
|
case 22: // Ignore boxes
|
|
|
|
ignoreBoxes = value;
|
|
|
|
break;
|
|
|
|
case 29: // Y flip
|
|
|
|
break;
|
|
|
|
case 30: // X flip
|
|
|
|
break;
|
|
|
|
case 31: // ??
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-15 22:56:24 +00:00
|
|
|
bool Actor::isInClass(int cls)
|
|
|
|
{
|
|
|
|
return _vm->getClass(number, cls);
|
|
|
|
}
|