mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
GRIM: Implemented SetActorScale()
This commit is contained in:
parent
4882f42a1f
commit
fd8035ac24
@ -66,6 +66,7 @@ Actor::Actor(const char *actorName) :
|
||||
_lastWasLeft = false;
|
||||
_lastStepTime = 0;
|
||||
_running = false;
|
||||
_scale = 1.f;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
_shadowArray[i].active = false;
|
||||
@ -95,6 +96,7 @@ Actor::Actor() :
|
||||
_lastWasLeft = false;
|
||||
_lastStepTime = 0;
|
||||
_running = false;
|
||||
_scale = 1.f;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
_shadowArray[i].active = false;
|
||||
@ -130,6 +132,7 @@ void Actor::saveState(SaveGame *savedState) const {
|
||||
savedState->writeFloat(_reflectionAngle);
|
||||
savedState->writeLESint32(_visible);
|
||||
savedState->writeLESint32(_lookingMode),
|
||||
//TODO: save _scale
|
||||
|
||||
savedState->writeString(_talkSoundName);
|
||||
|
||||
@ -1003,6 +1006,10 @@ void Actor::setHead(int joint1, int joint2, int joint3, float maxRoll, float max
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::setScale(float scale) {
|
||||
_scale = scale;
|
||||
}
|
||||
|
||||
Costume *Actor::findCostume(const char *n) {
|
||||
for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
|
||||
if (strcasecmp((*i)->getFilename(), n) == 0)
|
||||
@ -1201,19 +1208,19 @@ void Actor::draw() {
|
||||
continue;
|
||||
g_driver->setShadow(&_shadowArray[l]);
|
||||
g_driver->setShadowMode();
|
||||
g_driver->startActorDraw(_pos, _yaw, _pitch, _roll);
|
||||
g_driver->startActorDraw(_pos, _scale, _yaw, _pitch, _roll);
|
||||
costume->draw();
|
||||
g_driver->finishActorDraw();
|
||||
g_driver->clearShadowMode();
|
||||
g_driver->setShadow(NULL);
|
||||
}
|
||||
// normal draw actor
|
||||
g_driver->startActorDraw(_pos, _yaw, _pitch, _roll);
|
||||
g_driver->startActorDraw(_pos, _scale, _yaw, _pitch, _roll);
|
||||
costume->draw();
|
||||
g_driver->finishActorDraw();
|
||||
} else {
|
||||
// normal draw actor
|
||||
g_driver->startActorDraw(_pos, _yaw, _pitch, _roll);
|
||||
g_driver->startActorDraw(_pos, _scale, _yaw, _pitch, _roll);
|
||||
costume->draw();
|
||||
g_driver->finishActorDraw();
|
||||
|
||||
@ -1223,7 +1230,7 @@ void Actor::draw() {
|
||||
g_driver->setShadow(&_shadowArray[l]);
|
||||
g_driver->setShadowMode();
|
||||
g_driver->drawShadowPlanes();
|
||||
g_driver->startActorDraw(_pos, _yaw, _pitch, _roll);
|
||||
g_driver->startActorDraw(_pos, _scale, _yaw, _pitch, _roll);
|
||||
costume->draw();
|
||||
g_driver->finishActorDraw();
|
||||
g_driver->clearShadowMode();
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
float roll() const { return _roll; }
|
||||
void setVisibility(bool val) { _visible = val; }
|
||||
bool visible() const { return _visible; }
|
||||
void setScale(float scale);
|
||||
// The set should change immediately, otherwise a very rapid set change
|
||||
// for an actor will be recognized incorrectly and the actor will be lost.
|
||||
void putInSet(const char *setName);
|
||||
@ -188,6 +189,7 @@ private:
|
||||
bool _constrain; // Constrain to walkboxes
|
||||
float _reflectionAngle; // Maximum angle to turn by at walls
|
||||
bool _visible;
|
||||
float _scale;
|
||||
bool _lookingMode;
|
||||
Common::String _talkSoundName;
|
||||
LipSyncPtr _lipSync;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
virtual void flipBuffer() = 0;
|
||||
|
||||
virtual void getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, int *x2, int *y2) = 0;
|
||||
virtual void startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll) = 0;
|
||||
virtual void startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll) = 0;
|
||||
virtual void finishActorDraw() = 0;
|
||||
virtual void setShadow(Shadow *shadow) = 0;
|
||||
virtual void drawShadowPlanes() = 0;
|
||||
|
@ -242,7 +242,7 @@ void GfxOpenGL::getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, in
|
||||
*y2 = (int)bottom;
|
||||
}
|
||||
|
||||
void GfxOpenGL::startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll) {
|
||||
void GfxOpenGL::startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
@ -262,6 +262,7 @@ void GfxOpenGL::startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, f
|
||||
glShadowProjection(_currentShadowArray->pos, shadowSector->getVertices()[0], shadowSector->getNormal(), _currentShadowArray->dontNegate);
|
||||
}
|
||||
glTranslatef(pos.x(), pos.y(), pos.z());
|
||||
glScalef(scale, scale, scale);
|
||||
glRotatef(yaw, 0, 0, 1);
|
||||
glRotatef(pitch, 1, 0, 0);
|
||||
glRotatef(roll, 0, 1, 0);
|
||||
|
@ -58,7 +58,7 @@ byte *setupScreen(int screenW, int screenH, bool fullscreen);
|
||||
|
||||
void getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, int *x2, int *y2);
|
||||
|
||||
void startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll);
|
||||
void startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll);
|
||||
void finishActorDraw();
|
||||
void setShadow(Shadow *shadow);
|
||||
void drawShadowPlanes();
|
||||
|
@ -348,7 +348,7 @@ void GfxTinyGL::getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, in
|
||||
}*/
|
||||
}
|
||||
|
||||
void GfxTinyGL::startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll) {
|
||||
void GfxTinyGL::startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll) {
|
||||
tglEnable(TGL_TEXTURE_2D);
|
||||
tglMatrixMode(TGL_MODELVIEW);
|
||||
tglPushMatrix();
|
||||
@ -368,6 +368,7 @@ void GfxTinyGL::startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, f
|
||||
}
|
||||
|
||||
tglTranslatef(pos.x(), pos.y(), pos.z());
|
||||
tglScalef(scale, scale, scale);
|
||||
tglRotatef(yaw, 0, 0, 1);
|
||||
tglRotatef(pitch, 1, 0, 0);
|
||||
tglRotatef(roll, 0, 1, 0);
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
|
||||
void getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, int *x2, int *y2);
|
||||
|
||||
void startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll);
|
||||
void startActorDraw(Graphics::Vector3d pos, float scale, float yaw, float pitch, float roll);
|
||||
void finishActorDraw();
|
||||
void setShadow(Shadow *shadow);
|
||||
void drawShadowPlanes();
|
||||
|
@ -606,6 +606,22 @@ static void SetActorVisibility() {
|
||||
actor->setVisibility(val);
|
||||
}
|
||||
|
||||
static void SetActorScale() {
|
||||
lua_Object actorObj = lua_getparam(1);
|
||||
lua_Object scaleObj = lua_getparam(2);
|
||||
|
||||
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
|
||||
return;
|
||||
|
||||
Actor *actor = static_cast<Actor *>(lua_getuserdata(actorObj));
|
||||
float scale = 1.f;
|
||||
|
||||
if (lua_isnumber(scaleObj))
|
||||
scale = lua_getnumber(scaleObj);
|
||||
|
||||
actor->setScale(scale);
|
||||
}
|
||||
|
||||
static void PutActorAt() {
|
||||
lua_Object actorObj = lua_getparam(1);
|
||||
lua_Object xObj = lua_getparam(2);
|
||||
@ -4104,7 +4120,6 @@ STUB_FUNC(SetActorFrustrumCull)
|
||||
STUB_FUNC(DriveActorTo)
|
||||
STUB_FUNC(GetActorRect)
|
||||
STUB_FUNC(SetActorTimeScale)
|
||||
STUB_FUNC(SetActorScale)
|
||||
STUB_FUNC(GetTranslationMode)
|
||||
STUB_FUNC(SetTranslationMode)
|
||||
STUB_FUNC(WalkActorToAvoiding)
|
||||
|
Loading…
x
Reference in New Issue
Block a user