26 #include "common/scummsys.h" 27 #include "common/serializer.h" 28 #include "scumm/scumm.h" 32 #define CHORE_REDIRECT_INIT 56 33 #define CHORE_REDIRECT_WALK 57 34 #define CHORE_REDIRECT_STAND 58 35 #define CHORE_REDIRECT_START_TALK 59 36 #define CHORE_REDIRECT_STOP_TALK 60 37 #define CHORE_TURN_DIR 61 38 #define CHORE_FACE_DIR 62 73 uint16 heJumpOffsetTable[16] = {};
74 uint16 heJumpCountTable[16] = {};
75 uint32 heCondMaskTable[16] = {};
82 memset(animType, 0,
sizeof(animType));
83 memset(curpos, 0xFF,
sizeof(curpos));
84 memset(start, 0xFF,
sizeof(start));
85 memset(end, 0xFF,
sizeof(end));
86 memset(frame, 0xFF,
sizeof(frame));
102 static byte kInvalidBox;
111 int _top = 0, _bottom = 0;
119 int _talkFrequency = 0;
121 byte _talkVolume = 0;
122 uint16 _boxscale = 0;
123 byte _scalex = 0, _scaley = 0;
126 bool _ignoreBoxes =
false;
128 uint16 _lastValidX = 0, _lastValidY = 0;
132 byte _standFrame = 0;
133 byte _talkStartFrame = 0;
134 byte _talkStopFrame = 0;
136 bool _needRedraw =
false, _needBgReset =
false, _visible =
false;
137 byte _shadowMode = 0;
141 int16 _talkPosX = 0, _talkPosY = 0;
142 uint16 _talkScript = 0, _walkScript = 0;
143 bool _ignoreTurns =
false;
144 bool _drawToBackBuf =
false;
146 uint16 _sound[32] = {};
150 int _heOffsX = 0, _heOffsY = 0;
151 bool _heSkipLimbs =
false;
152 uint32 _heCondMask = 0;
153 uint32 _hePaletteNum = 0;
154 uint32 _heShadow = 0;
168 int32 deltaXFactor = 0, deltaYFactor = 0;
169 uint16 xfrac = 0, yfrac = 0;
170 uint16 xAdd = 0, yAdd = 0;
180 point3.
x = point3.
y = 0;
192 uint16 _palette[256] = {};
195 uint16 _targetFacing = 0;
196 uint _speedx = 0, _speedy = 0;
197 byte _animProgress = 0, _animSpeed = 0;
198 bool _costumeNeedsInit =
false;
200 int16 _animVariable[27] = {};
208 virtual void hideActor();
211 virtual void initActor(
int mode);
214 putActor(_pos.
x, _pos.
y, _room);
217 void putActor(
int room) {
218 putActor(_pos.
x, _pos.
y, room);
221 void putActor(
int x,
int y) {
222 putActor(x, y, _room);
225 void putActor(
int x,
int y,
int room);
226 void setActorWalkSpeed(uint newSpeedX, uint newSpeedY);
229 virtual int actorWalkStep();
230 virtual int remapDirection(
int dir,
bool is_walking);
231 virtual void setupActorScale();
233 void setBox(
int box);
234 int updateActorDirection(
bool is_walking);
237 void adjustActorPos();
240 virtual void setDirection(
int direction);
241 void faceToObject(
int obj);
242 virtual void turnToDirection(
int newdir);
243 virtual void walkActor();
244 void drawActorCostume(
bool hitTestMode =
false);
246 virtual void animateCostume();
247 virtual void setActorCostume(
int c);
249 void animateLimb(
int limb,
int f);
251 bool actorHitTest(
int x,
int y);
253 const byte *getActorName();
254 void startWalkActor(
int x,
int y,
int dir);
255 void stopActorMoving();
257 void startWalkAnim(
int cmd,
int angle);
259 void runActorTalkScript(
int f);
260 virtual void startAnimActor(
int frame);
262 void remapActorPalette(
int r_fact,
int g_fact,
int b_fact,
int threshold);
263 void remapActorPaletteColor(
int slot,
int color);
265 void animateActor(
int anim);
267 bool isInCurrentRoom()
const {
268 return _room == _vm->_currentRoom;
274 p.
x *= V12_X_MULTIPLIER;
275 p.
y *= V12_Y_MULTIPLIER;
284 int getRoom()
const {
288 int getFacing()
const {
292 void setFacing(
int newFacing) {
296 int getAnimVar(byte var)
const;
297 void setAnimVar(byte var,
int value);
299 void setAnimSpeed(byte newAnimSpeed) {
300 _animSpeed = newAnimSpeed;
304 int getAnimSpeed()
const {
308 int getAnimProgress()
const {
309 return _animProgress;
312 int getElevation()
const {
316 void setElevation(
int newElevation) {
317 if (_elevation != newElevation) {
318 _elevation = newElevation;
328 void setPalette(
int idx,
int val) {
333 void setScale(
int sx,
int sy) {
345 void classChanged(
int cls,
bool value);
350 bool isInClass(
int cls);
352 virtual bool isPlayer();
354 bool findPathTowards(byte box, byte box2, byte box3,
Common::Point &foundPath);
361 void initActor(
int mode)
override;
362 void walkActor()
override;
368 void setupActorScale()
override;
372 virtual int actorWalkStep()
override;
374 const int _facingXYratio;
381 void initActor(
int mode)
override;
382 void walkActor()
override;
386 bool isPlayer()
override;
389 int actorWalkStep()
override;
390 int remapDirection(
int dir,
bool is_walking)
override;
397 void initActor(
int mode)
override;
398 void walkActor()
override;
399 void turnToDirection(
int newdir)
override;
400 void startAnimActor(
int frame)
override;
403 int updateActorDirection();
406 enum ActorV0MiscFlags {
407 kActorMiscFlagStrong = 0x01,
408 kActorMiscFlagGTFriend = 0x02,
409 kActorMiscFlagWatchedTV = 0x04,
410 kActorMiscFlagEdsEnemy = 0x08,
411 kActorMiscFlag_10 = 0x10,
412 kActorMiscFlag_20 = 0x20,
413 kActorMiscFlagFreeze = 0x40,
414 kActorMiscFlagHide = 0x80
423 byte _walkboxQueue[0x10] = {};
424 byte _walkboxQueueIndex = 0;
426 byte _costCommandNew = 0;
427 byte _costCommand = 0;
431 byte _walkCountModulo = 0;
432 bool _newWalkBoxEntered =
false;
437 byte _walkYCountGreaterThanXCount = 0;
438 byte _walkXCount = 0;
439 byte _walkXCountInc = 0;
440 byte _walkYCount = 0;
441 byte _walkYCountInc = 0;
443 byte _walkMaxXYCountInc = 0;
447 byte _tmp_WalkBox = 0;
448 bool _tmp_NewWalkBoxEntered =
false;
450 int8 _animFrameRepeat = 0;
451 int8 _limbFrameRepeatNew[8] = {};
452 int8 _limbFrameRepeat[8] = {};
454 bool _limb_flipped[8] = {};
458 bool walkBoxQueueAdd(
int box);
459 bool walkBoxQueueFind(
int box);
460 void walkboxQueueReverse();
465 void initActor(
int mode)
override;
466 void animateActor(
int anim);
467 void animateCostume()
override;
469 void limbFrameCheck(
int limb);
471 void directionUpdate();
473 void setDirection(
int direction)
override;
474 void startAnimActor(
int f)
override;
476 bool calcWalkDistances();
477 void walkActor()
override;
478 void actorSetWalkTo();
479 byte actorWalkXCalculate();
480 byte actorWalkYCalculate();
481 byte updateWalkbox();
483 void walkBoxQueueReset();
484 bool walkBoxQueuePrepare();
489 void setActorToTempPosition();
490 void setActorToOriginalPosition();
Common::Point _pos
Definition: actor.h:108
byte heversion
Definition: detection.h:83
Definition: serializer.h:79
byte version
Definition: detection.h:80
Definition: serializer.h:308
Definition: base-costume.h:68