[Scummvm-cvs-logs] SF.net SVN: scummvm: [25392] residual/trunk
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Mon Feb 5 14:49:33 CET 2007
Revision: 25392
http://scummvm.svn.sourceforge.net/scummvm/?rev=25392&view=rev
Author: aquadran
Date: 2007-02-05 05:49:32 -0800 (Mon, 05 Feb 2007)
Log Message:
-----------
add initial support for shadows, missing gfx stuff
Modified Paths:
--------------
residual/trunk/actor.cpp
residual/trunk/actor.h
residual/trunk/engine.cpp
residual/trunk/engine.h
residual/trunk/lua.cpp
residual/trunk/resource.cpp
Modified: residual/trunk/actor.cpp
===================================================================
--- residual/trunk/actor.cpp 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/actor.cpp 2007-02-05 13:49:32 UTC (rev 25392)
@@ -28,6 +28,7 @@
#include "localize.h"
#include "driver.h"
#include "smush.h"
+#include "walkplane.h"
#include "mixer/mixer.h"
@@ -53,6 +54,7 @@
_lookingMode = false;
_constrain = false;
_talkSoundName = "";
+ _activeShadowSlot = -1;
for (int i = 0; i < 10; i++) {
_talkCostume[i] = NULL;
@@ -600,3 +602,46 @@
if (!talking() || !g_imuse->isVoicePlaying())
shutUp();
}
+
+#define strmatch(src, dst) (strlen(src) == strlen(dst) && strcmp(src, dst) == 0)
+
+void Actor::setShadowPlane(const char *name) {
+ assert(_activeShadowSlot != -1);
+
+ _shadowArray[_activeShadowSlot].name = name;
+}
+
+void Actor::addShadowPlane(const char *name) {
+ assert(_activeShadowSlot != -1);
+
+ int numSectors = g_engine->currScene()->getSectorCount();
+
+ for (int i = 0; i < numSectors; i++) {
+ Sector *sector = g_engine->currScene()->getSectorBase(i);
+ if (strmatch(sector->name(), name)) {
+ _shadowArray[_activeShadowSlot].planeList.push_back(sector);
+ return;
+ }
+ }
+}
+
+void Actor::setActiveShadow(int shadowId) {
+ assert(shadowId >= 0 && shadowId <= 4);
+
+ _activeShadowSlot = shadowId;
+}
+
+void Actor::setShadowPoint(Vector3d pos) {
+ assert(_activeShadowSlot != -1);
+
+ _shadowArray[_activeShadowSlot].pos = pos;
+}
+
+void Actor::clearShadowPlanes() {
+ for (int i = 0; i < 5; i++) {
+ Shadow *shadow = &_shadowArray[i];
+ while (!shadow->planeList.empty()) {
+ shadow->planeList.pop_back();
+ }
+ }
+}
Modified: residual/trunk/actor.h
===================================================================
--- residual/trunk/actor.h 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/actor.h 2007-02-05 13:49:32 UTC (rev 25392)
@@ -34,7 +34,15 @@
class Costume;
class LipSynch;
class TextObject;
+class Sector;
+struct Shadow {
+ std::string name;
+ Vector3d pos;
+ std::list<Sector *>planeList;
+ bool active;
+};
+
class Actor {
public:
Actor(const char *name);
@@ -112,6 +120,13 @@
int costumeStackDepth() const {
return _costumeStack.size();
}
+
+ void setActiveShadow(int shadowId);
+ void setShadowPoint(Vector3d pos);
+ void setShadowPlane(const char *name);
+ void addShadowPlane(const char *name);
+ void clearShadowPlanes();
+
void setConstrain(bool constrain) {
_constrain = constrain;
}
@@ -179,12 +194,15 @@
Costume *_mumbleCostume;
int _mumbleChore;
+ Shadow _shadowArray[5];
+ int _activeShadowSlot;
+
static Font *_sayLineFont;
TextObject *_sayLineText;
// Validate a yaw angle then set it appropriately
void setYaw(float yaw);
-
+
int getTurnChore(int dir) {
return (dir > 0 ? _rightTurnChore : _leftTurnChore);
}
Modified: residual/trunk/engine.cpp
===================================================================
--- residual/trunk/engine.cpp 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/engine.cpp 2007-02-05 13:49:32 UTC (rev 25392)
@@ -667,3 +667,7 @@
_textSpeed = 10;
_textSpeed = speed;
}
+
+void Engine::setShadowColor(Color c) {
+ _shadowColor = c;
+}
Modified: residual/trunk/engine.h
===================================================================
--- residual/trunk/engine.h 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/engine.h 2007-02-05 13:49:32 UTC (rev 25392)
@@ -65,6 +65,7 @@
bool getFlipEnable() { return _flipEnable; }
void refreshDrawMode() { _refreshDrawNeeded = true; }
void drawPrimitives();
+ void setShadowColor(Color c);
void mainLoop();
unsigned frameStart() const { return _frameStart; }
@@ -182,6 +183,7 @@
bool _refreshDrawNeeded;
char _fps[8];
bool _doFlip;
+ Color _shadowColor;
unsigned _frameStart, _frameTime, _movieTime;
unsigned int _frameTimeCollection;
Modified: residual/trunk/lua.cpp
===================================================================
--- residual/trunk/lua.cpp 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/lua.cpp 2007-02-05 13:49:32 UTC (rev 25392)
@@ -1393,6 +1393,81 @@
lua_pushobject(result);
}
+static void SetShadowColor() {
+ DEBUG_FUNCTION();
+
+ int r = check_int(1);
+ int g = check_int(2);
+ int b = check_int(3);
+
+ g_engine->setShadowColor(Color(r, g, b));
+}
+
+static void KillActorShadows() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+
+ act->clearShadowPlanes();
+}
+
+static void SetActiveShadow() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ int shadowId = check_int(2);
+
+ act->setActiveShadow(shadowId);
+}
+
+static void SetActorShadowPoint() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ float x = luaL_check_number(2);
+ float y = luaL_check_number(3);
+ float z = luaL_check_number(4);
+
+ act->setShadowPoint(Vector3d(x, y, z));
+}
+
+static void SetActorShadowPlane() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ char *name = lua_getstring(lua_getparam(2));
+
+ act->setShadowPlane(name);
+}
+
+static void AddShadowPlane() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ char *name = lua_getstring(lua_getparam(2));
+
+ act->addShadowPlane(name);
+}
+
+static void ActivateActorShadow() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ int shadowId = check_int(2);
+ bool state = getbool(3);
+
+ //act->setActivateShadow(shadowId, state);
+}
+
+static void SetActorShadowValid() {
+ DEBUG_FUNCTION();
+
+ Actor *act = check_actor(1);
+ int valid = check_int(2);
+
+ //act->setShadowValid(valid);
+}
+
// 0 - translate from '/msgId/'
// 1 - don't translate - message after '/msgId'
// 2 - return '/msgId/'
@@ -3181,8 +3256,7 @@
// Stub function for builtin functions not yet implemented
static void stubWarning(char *funcName) {
// If the user doesn't want these debug messages then don't print them
- if(debugLevel != DEBUG_WARN && debugLevel != DEBUG_STUB && debugLevel != DEBUG_FUNC
- && debugLevel != DEBUG_ALL)
+ if (debugLevel != DEBUG_WARN && debugLevel != DEBUG_STUB && debugLevel != DEBUG_FUNC && debugLevel != DEBUG_ALL)
return;
debugFunction("WARNING: Stub function", funcName);
@@ -3206,14 +3280,6 @@
STUB_FUNC(SetActorCollisionMode)
STUB_FUNC(FlushControls)
STUB_FUNC(ActorToClean)
-STUB_FUNC(SetActorShadowValid)
-STUB_FUNC(AddShadowPlane)
-STUB_FUNC(KillActorShadows)
-STUB_FUNC(SetActiveShadow)
-STUB_FUNC(SetActorShadowPoint)
-STUB_FUNC(SetActorShadowPlane)
-STUB_FUNC(ActivateActorShadow)
-STUB_FUNC(SetShadowColor)
STUB_FUNC(LightMgrStartup)
STUB_FUNC(SetLightIntensity)
STUB_FUNC(SetLightPosition)
@@ -3248,7 +3314,6 @@
STUB_FUNC(GetCameraFOV)
STUB_FUNC(SetCameraFOV)
STUB_FUNC(GetCameraRoll)
-STUB_FUNC(ActorShadow)
STUB_FUNC(ActorPuckOrient)
STUB_FUNC(GetMemoryUsage)
STUB_FUNC(GetFontDimensions)
@@ -3520,7 +3585,6 @@
{ "GetSpeechMode", GetSpeechMode },
{ "SetShadowColor", SetShadowColor },
{ "ActivateActorShadow", ActivateActorShadow },
- { "ActorShadow", ActorShadow },
{ "SetActorShadowPlane", SetActorShadowPlane },
{ "SetActorShadowPoint", SetActorShadowPoint },
{ "SetActiveShadow", SetActiveShadow },
Modified: residual/trunk/resource.cpp
===================================================================
--- residual/trunk/resource.cpp 2007-02-05 12:53:40 UTC (rev 25391)
+++ residual/trunk/resource.cpp 2007-02-05 13:49:32 UTC (rev 25392)
@@ -114,10 +114,8 @@
error("Cannot find any resource files in %s - check configuration file", dir_str.c_str());
}
-ResourceLoader::~ResourceLoader()
-{
- for(LabList::const_iterator i = _labs.begin();
- i != _labs.end(); i++)
+ResourceLoader::~ResourceLoader() {
+ for (LabList::const_iterator i = _labs.begin(); i != _labs.end(); i++)
delete (*i);
}
@@ -125,6 +123,7 @@
for (LabList::const_iterator i = _labs.begin(); i != _labs.end(); i++)
if ((*i)->fileExists(filename))
return *i;
+
return NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list