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;
538 void attachToActor(
Actor *other,
const char *joint);
540 Math::Quaternion getRotationQuat()
const;
541 const Math::Matrix4 getFinalMatrix()
const;
542 Math::Vector3d getHeadPos()
const;
544 void setInOverworld(
bool inOverworld) { _inOverworld = inOverworld; }
545 bool isInOverworld()
const {
return _inOverworld; }
547 float getGlobalAlpha()
const {
return _globalAlpha; }
548 AlphaMode getAlphaMode()
const {
return _alphaMode; }
549 float getEffectiveAlpha()
const {
return _alphaMode != AlphaOff ? _globalAlpha : 1.f; }
553 int getSortOrder()
const;
554 void setSortOrder(
const int order);
555 int getEffectiveSortOrder()
const;
557 void activateShadow(
bool active,
const char *shadowName);
558 void activateShadow(
bool active,
SetShadow *shadow);
560 void drawToCleanBuffer();
562 bool isTalkingForeground()
const;
564 LightMode getLightMode()
const {
return _lightMode; }
565 void setLightMode(LightMode lightMode) { _lightMode = lightMode; }
570 void getBBoxInfo(Math::Vector3d &bboxPos, Math::Vector3d &bboxSize)
const;
573 void costumeMarkerCallback(
int marker);
574 void collisionHandlerCallback(
Actor *other)
const;
576 void addShadowPlane(
const char *n,
Set *scene,
int shadowId);
577 bool shouldDrawShadow(
int shadowId);
579 bool stopMumbleChore();
580 void drawCostume(
Costume *costume);
585 Math::Vector3d handleCollisionTo(
const Math::Vector3d &from,
const Math::Vector3d &pos)
const;
591 Math::Vector3d getTangentPos(
const Math::Vector3d &pos,
const Math::Vector3d &dest)
const;
593 Math::Vector3d getSimplePuckVector()
const;
594 void calculateOrientation(
const Math::Vector3d &pos, Math::Angle *pitch, Math::Angle *yaw, Math::Angle *roll);
596 bool getSphereInfo(
bool adjustZ,
float &size, Math::Vector3d &pos)
const;
604 Math::Angle _pitch, _yaw, _roll;
605 float _walkRate, _turnRate;
608 bool _hasFollowedBoxes;
609 float _reflectionAngle;
616 bool _backgroundTalk;
628 Math::Angle _moveYaw;
629 Math::Angle _movePitch;
630 Math::Angle _moveRoll;
632 float _turnRateMultiplier;
636 Math::Vector3d _destPos;
642 ActionChore(
Costume *cost,
int chore);
644 void play(
bool fade =
false,
unsigned int time = fadeTime);
645 void playLooping(
bool fade =
false,
unsigned int time = fadeTime);
646 void stop(
bool fade =
false,
unsigned int time = fadeTime);
649 inline bool isValid()
const {
return _chore > -1 && _costume !=
nullptr; }
650 bool isPlaying()
const;
651 inline bool equals(
const Costume *cost,
int chore)
const {
652 return (_costume == cost && _chore == chore);
655 void saveState(
SaveGame *state)
const;
661 static const unsigned int fadeTime;
662 static const unsigned int talkFadeTime;
664 ActionChore _restChore;
666 ActionChore _walkChore;
667 bool _walkedLast, _walkedCur;
670 ActionChore _leftTurnChore, _rightTurnChore;
671 int _lastTurnDir, _currTurnDir;
673 ActionChore _talkChore[10];
676 ActionChore _mumbleChore;
679 int _activeShadowSlot;
685 ActionChore *getTurnChore(
int dir) {
686 return (dir > 0 ? &_leftTurnChore : &_rightTurnChore);
689 void freeCostume(
Costume *costume);
690 void freeCostumeChore(
const Costume *toFree, ActionChore *chore);
693 Math::Vector3d _lookAtVector;
705 CollisionMode _collisionMode;
706 float _collisionScale;
710 static bool _isTalkingBackground;
715 AlphaMode _alphaMode;
721 int _sectorSortOrder;
722 bool _useParentSortOrder;
727 LightMode _lightMode;
732 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
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
Definition: skeleton.h:43