25 #include "engines/grim/pool.h" 26 #include "engines/grim/object.h" 27 #include "engines/grim/color.h" 29 #include "math/vector3d.h" 30 #include "math/angle.h" 31 #include "math/quat.h" 60 SectorListType planeList;
103 static int32 getStaticTag() {
return MKTAG(
'A',
'C',
'T',
'R'); }
110 void saveState(
SaveGame *savedState)
const;
116 bool restoreState(
SaveGame *savedState);
150 void setPos(
const Math::Vector3d &position);
156 Math::Vector3d
getPos()
const {
return _pos; }
157 inline Math::Vector3d getDestPos()
const {
return _destPos; }
168 void walkTo(
const Math::Vector3d &position);
182 bool isWalking()
const;
200 void turnTo(
const Math::Angle &pitch,
const Math::Angle &yaw,
const Math::Angle &roll,
bool snap =
false);
211 void turnTo(
const Math::Vector3d &pos,
bool snap =
false);
222 bool singleTurnTo(
const Math::Vector3d &pos);
228 bool isTurning()
const;
247 void setRot(
const Math::Angle &pitch,
const Math::Angle &yaw,
const Math::Angle &roll);
256 void setRot(
const Math::Vector3d &pos);
291 Math::Angle
getYaw()
const {
return _yaw; }
310 Math::Angle getYawTo(
const Actor *actor)
const;
317 Math::Angle getYawTo(
const Math::Vector3d &p)
const;
340 float getScale()
const {
return _scale; }
406 void setLooking(
bool lookingMode) { _lookingMode = lookingMode; }
416 void moveTo(
const Math::Vector3d &pos);
423 void setReflection(
float angle) { _reflectionAngle = angle; }
428 Math::Vector3d getPuckVector()
const;
430 void setPuckOrient(
bool orient);
442 void sayLine(
const char *msgId,
bool background,
float x,
float y);
461 void setRestChore(
int choreNumber,
Costume *cost);
462 int getRestChore()
const;
463 void setWalkChore(
int choreNumber,
Costume *cost);
464 void setTurnChores(
int left_chore,
int right_chore,
Costume *cost);
465 void setTalkChore(
int index,
int choreNumber,
Costume *cost);
466 int getTalkChore(
int index)
const;
467 Costume *getTalkCostume(
int index)
const;
468 void setMumbleChore(
int choreNumber,
Costume *cost);
469 void stopAllChores(
bool ignoreLoopingChores =
false);
470 void setColormap(
const char *map);
471 void pushCostume(
const char *name);
472 void setCostume(
const char *name);
474 void clearCostumes();
475 Costume *getCurrentCostume()
const;
476 void setLocalAlphaMode(
unsigned int vertex, AlphaMode alphamode);
477 void setLocalAlpha(
unsigned int vertex,
float alpha);
478 bool hasLocalAlpha()
const;
479 float getLocalAlpha(
unsigned int vertex)
const;
481 int getCostumeStackDepth()
const {
482 return _costumeStack.size();
486 void setActiveShadow(
int shadowId);
487 void setShadowPoint(
const Math::Vector3d &pos);
488 void setShadowColor(
const Color &color);
489 void setShadowPlane(
const char *name);
490 void addShadowPlane(
const char *name);
491 void clearShadowPlanes();
492 void clearShadowPlane(
int i);
493 void setShadowValid(
int);
494 void setActivateShadow(
int,
bool);
496 void setFollowBoxes(
bool follow);
497 bool hasFollowBoxes()
const {
return _followBoxes; }
498 bool hasFollowedBoxes()
const {
return _hasFollowedBoxes; }
499 void update(uint frameTime);
503 bool updateTalk(uint frameTime);
506 bool isLookAtVectorZero() {
507 return _lookAtVector.isZero();
509 void setLookAtVectorZero() {
510 _lookAtVector.set(0.f, 0.f, 0.f);
513 void setLookAtVector(
const Math::Vector3d &vector) {
514 _lookAtVector = vector;
517 Math::Vector3d getLookAtVector() {
518 return _lookAtVector;
520 void setLookAtActor(
Actor *other) { _lookAtActor = other->getId(); }
521 void setLookAtRate(
float rate);
522 float getLookAtRate()
const;
523 void setHead(
int joint1,
int joint2,
int joint3,
float maxRoll,
float maxPitch,
float maxYaw);
524 void setHead(
const char *joint,
const Math::Vector3d &offset);
525 void setHeadLimits(
float yawRange,
float maxPitch,
float minPitch);
527 void setCollisionMode(CollisionMode mode);
528 void setCollisionScale(
float scale);
530 bool handleCollisionWith(
Actor *actor, CollisionMode mode, Math::Vector3d *vec)
const;
532 static void saveStaticState(
SaveGame *state);
533 static void restoreStaticState(
SaveGame *state);
535 bool isAttached()
const {
return _attachedActor != 0; }
536 Math::Vector3d getWorldPos()
const;
537 void attachToActor(
Actor *other,
const char *joint);
539 Math::Quaternion getRotationQuat()
const;
540 const Math::Matrix4 getFinalMatrix()
const;
541 Math::Vector3d getHeadPos()
const;
543 void setInOverworld(
bool inOverworld) { _inOverworld = inOverworld; }
544 bool isInOverworld()
const {
return _inOverworld; }
546 float getGlobalAlpha()
const {
return _globalAlpha; }
547 AlphaMode getAlphaMode()
const {
return _alphaMode; }
548 float getEffectiveAlpha()
const {
return _alphaMode != AlphaOff ? _globalAlpha : 1.f; }
552 int getSortOrder()
const;
553 void setSortOrder(
const int order);
554 int getEffectiveSortOrder()
const;
556 void activateShadow(
bool active,
const char *shadowName);
557 void activateShadow(
bool active,
SetShadow *shadow);
559 void drawToCleanBuffer();
561 bool isTalkingForeground()
const;
563 LightMode getLightMode()
const {
return _lightMode; }
564 void setLightMode(LightMode lightMode) { _lightMode = lightMode; }
569 void getBBoxInfo(Math::Vector3d &bboxPos, Math::Vector3d &bboxSize)
const;
572 void costumeMarkerCallback(
int marker);
573 void collisionHandlerCallback(
Actor *other)
const;
575 void addShadowPlane(
const char *n,
Set *scene,
int shadowId);
576 bool shouldDrawShadow(
int shadowId);
578 bool stopMumbleChore();
579 void drawCostume(
Costume *costume);
584 Math::Vector3d handleCollisionTo(
const Math::Vector3d &from,
const Math::Vector3d &pos)
const;
590 Math::Vector3d getTangentPos(
const Math::Vector3d &pos,
const Math::Vector3d &dest)
const;
592 Math::Vector3d getSimplePuckVector()
const;
593 void calculateOrientation(
const Math::Vector3d &pos, Math::Angle *pitch, Math::Angle *yaw, Math::Angle *roll);
595 bool getSphereInfo(
bool adjustZ,
float &size, Math::Vector3d &pos)
const;
603 Math::Angle _pitch, _yaw, _roll;
604 float _walkRate, _turnRate;
607 bool _hasFollowedBoxes;
608 float _reflectionAngle;
615 bool _backgroundTalk;
627 Math::Angle _moveYaw;
628 Math::Angle _movePitch;
629 Math::Angle _moveRoll;
631 float _turnRateMultiplier;
635 Math::Vector3d _destPos;
641 ActionChore(
Costume *cost,
int chore);
643 void play(
bool fade =
false,
unsigned int time = fadeTime);
644 void playLooping(
bool fade =
false,
unsigned int time = fadeTime);
645 void stop(
bool fade =
false,
unsigned int time = fadeTime);
648 inline bool isValid()
const {
return _chore > -1 && _costume !=
nullptr; }
649 bool isPlaying()
const;
650 inline bool equals(
const Costume *cost,
int chore)
const {
651 return (_costume == cost && _chore == chore);
654 void saveState(
SaveGame *state)
const;
660 static const unsigned int fadeTime;
661 static const unsigned int talkFadeTime;
663 ActionChore _restChore;
665 ActionChore _walkChore;
666 bool _walkedLast, _walkedCur;
669 ActionChore _leftTurnChore, _rightTurnChore;
670 int _lastTurnDir, _currTurnDir;
672 ActionChore _talkChore[10];
675 ActionChore _mumbleChore;
678 int _activeShadowSlot;
684 ActionChore *getTurnChore(
int dir) {
685 return (dir > 0 ? &_leftTurnChore : &_rightTurnChore);
688 void freeCostume(
Costume *costume);
689 void freeCostumeChore(
const Costume *toFree, ActionChore *chore);
692 Math::Vector3d _lookAtVector;
704 CollisionMode _collisionMode;
705 float _collisionScale;
709 static bool _isTalkingBackground;
714 AlphaMode _alphaMode;
720 int _sectorSortOrder;
721 bool _useParentSortOrder;
726 LightMode _lightMode;
731 const static unsigned int MAX_LOCAL_ALPHA_VERTICES = 48;
float getTimeScale() const
Definition: actor.h:356
void setVisibility(bool val)
Definition: actor.h:325
void setWalkRate(float rate)
Definition: actor.h:398
Definition: modelemi.h:82
Math::Angle getPitch() const
Definition: actor.h:280
void setTalkColor(const Color &color)
Definition: actor.h:136
float getWalkRate() const
Definition: actor.h:404
Math::Angle getRoll() const
Definition: actor.h:302
Definition: savegame.h:33
void setScale(float scale)
Definition: actor.h:339
void stopWalking()
Definition: actor.h:175
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
bool isVisible() const
Definition: actor.h:331
void setRunning(bool running)
Definition: actor.h:422
float getTurnRate() const
Definition: actor.h:391
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Actor represents a 3D character on screen.
Definition: actor.h:72
void setTurnRate(float rate)
Definition: actor.h:385
void setTimeScale(float scale)
Definition: actor.h:350
Math::Angle getYaw() const
Definition: actor.h:291
void setName(const Common::String &name)
Definition: actor.h:128
Math::Vector3d getPos() const
Definition: actor.h:156
Color getTalkColor() const
Definition: actor.h:142
const Common::String & getName() const
Definition: actor.h:121