EMI: implement SetActorGlobalAlpha

This commit is contained in:
Dries Harnie
2012-04-13 20:02:03 +02:00
parent dedb4f16b4
commit c27894e85e
3 changed files with 29 additions and 14 deletions
+7 -1
View File
@@ -74,7 +74,10 @@ Actor::Actor(const Common::String &actorName) :
_visible(true), _lipSync(NULL), _turning(false), _walking(false),
_walkedLast(false), _walkedCur(false),
_lastTurnDir(0), _currTurnDir(0),
_sayLineText(0), _talkDelay(0), _attachedActor(NULL), _attachedJoint("") {
_sayLineText(0), _talkDelay(0),
_attachedActor(NULL), _attachedJoint(""),
_global_alpha(1.f), _alphaMode(AlphaOff) {
_inOverworld = false;
_lookingMode = false;
_constrain = false;
_talkSoundName = "";
@@ -112,6 +115,9 @@ Actor::Actor() {
_attachedActor = NULL;
_attachedJoint = "";
_alphaMode = AlphaOff;
_global_alpha = 1.f;
for (int i = 0; i < MAX_SHADOWS; i++) {
_shadowArray[i].active = false;
_shadowArray[i].dontNegate = false;
+11
View File
@@ -71,6 +71,12 @@ public:
CollisionSphere = 2
};
enum AlphaMode {
AlphaOff = -1,
AlphaReplace = 2,
AlphaModulate = 3 // Seems to be unused
};
/**
* Initializes an actor with the given name.
*
@@ -467,6 +473,9 @@ public:
void setInOverworld(bool inOverworld) { _inOverworld = inOverworld; }
bool isInOverworld() { return _inOverworld; }
void setGlobalAlpha(float alpha) { _global_alpha = alpha; }
void setAlphaMode(AlphaMode mode) { _alphaMode = mode; }
private:
void costumeMarkerCallback(int marker);
void collisionHandlerCallback(Actor *other) const;
@@ -600,6 +609,8 @@ private:
int _talkDelay;
Actor *_attachedActor;
Common::String _attachedJoint;
AlphaMode _alphaMode;
float _global_alpha;
bool _inOverworld;
+11 -13
View File
@@ -56,8 +56,8 @@ void Lua_V2::SetActorLocalAlpha() {
void Lua_V2::SetActorGlobalAlpha() {
lua_Object actorObj = lua_getparam(1);
// lua_Object alphaModeObj = lua_getparam(2);
// lua_Object valueObj = lua_getparam(3);
lua_Object alphaObj = lua_getparam(2);
// lua_Object meshObj = lua_getparam(3);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
@@ -66,19 +66,17 @@ void Lua_V2::SetActorGlobalAlpha() {
if (!actor)
return;
warning("Lua_V2::SetActorGlobalAlpha: actor: %s", actor->getName().c_str());
/* Only when actor has primitives
if (!actor->primities)
if (!lua_isnumber(alphaObj))
return;
if (lua_isnumber(alphaModeObj) {
int alphaMode = (int)lua_getnumber(alphaModeObj);
if (!lua_isnil(valueObj) && lua_isstring(valueObj)) {
// TODO: missing part
}
// TODO
float alpha = lua_getnumber(alphaObj);
if (alpha == Actor::AlphaOff ||
alpha == Actor::AlphaReplace ||
alpha == Actor::AlphaModulate) {
actor->setAlphaMode((Actor::AlphaMode) (int) alpha);
} else {
actor->setGlobalAlpha(alpha);
}
*/
}
void Lua_V2::PutActorInOverworld() {