diff options
author | johndoe123 | 2012-10-18 17:36:40 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:47:32 +0200 |
commit | 126a306c899924cf774dfc0db1111728f9ac366b (patch) | |
tree | 93767933eec016dbcb6aab981e9e9ab26cbf5570 /engines/neverhood | |
parent | 533eb5d61d6d3f0b7f229648cf186ba1b54e5388 (diff) | |
download | scummvm-rg350-126a306c899924cf774dfc0db1111728f9ac366b.tar.gz scummvm-rg350-126a306c899924cf774dfc0db1111728f9ac366b.tar.bz2 scummvm-rg350-126a306c899924cf774dfc0db1111728f9ac366b.zip |
NEVERHOOD: Some cleanup:
- Remove _name field from Entity (wasn't really maintained by me and
became useless)
- Remove obsolete TODOs
- Add STICK_LAST_FRAME constant for better readability
- Remove commented out callbackList TODOs (these were so far never
used with over 90% of the game implemented)
Diffstat (limited to 'engines/neverhood')
-rw-r--r-- | engines/neverhood/entity.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/entity.h | 4 | ||||
-rw-r--r-- | engines/neverhood/klayman.cpp | 26 | ||||
-rw-r--r-- | engines/neverhood/module1000.cpp | 10 | ||||
-rw-r--r-- | engines/neverhood/module1200.cpp | 16 | ||||
-rw-r--r-- | engines/neverhood/module1300.cpp | 12 | ||||
-rw-r--r-- | engines/neverhood/module1400.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module1600.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module1900.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/module2100.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module2400.cpp | 6 | ||||
-rw-r--r-- | engines/neverhood/module2700.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2800.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/sprite.cpp | 21 | ||||
-rw-r--r-- | engines/neverhood/sprite.h | 7 |
17 files changed, 56 insertions, 80 deletions
diff --git a/engines/neverhood/entity.cpp b/engines/neverhood/entity.cpp index 36137a6fb5..29524f8639 100644 --- a/engines/neverhood/entity.cpp +++ b/engines/neverhood/entity.cpp @@ -52,8 +52,7 @@ Entity *MessageParam::asEntity() const { #define SetMessageHandler(handler) _messageHandlerCb = static_cast <uint32 (Entity::*)(int messageNum, const MessageParam ¶m, Entity *sender)> (handler); debug(2, "SetMessageHandler(" #handler ")"); _messageHandlerCbName = #handler Entity::Entity(NeverhoodEngine *vm, int priority) - : _vm(vm), _updateHandlerCb(NULL), _messageHandlerCb(NULL), _priority(priority), _soundResources(NULL), - _name("Entity") { + : _vm(vm), _updateHandlerCb(NULL), _messageHandlerCb(NULL), _priority(priority), _soundResources(NULL) { } Entity::~Entity() { @@ -64,7 +63,6 @@ void Entity::draw() { } void Entity::handleUpdate() { - //debug("Entity(%s).handleUpdate", _name.c_str()); debug(2, "handleUpdate() -> [%s]", _updateHandlerCbName.c_str()); if (_updateHandlerCb) (this->*_updateHandlerCb)(); diff --git a/engines/neverhood/entity.h b/engines/neverhood/entity.h index 0b3e32c5e8..89a1a42eb4 100644 --- a/engines/neverhood/entity.h +++ b/engines/neverhood/entity.h @@ -53,10 +53,8 @@ protected: uint32 _integer; NPoint _point; Entity *_entity; - // TODO: Other types... }; MessageParamType _type; - // TODO: Constructors for the param types... }; // TODO: Disable heavy debug stuff in release mode @@ -75,7 +73,6 @@ const uint kMaxSoundResources = 16; class Entity { public: - Common::String _name; // Entity name for debugging purposes Common::String _updateHandlerCbName; Common::String _messageHandlerCbName; Entity(NeverhoodEngine *vm, int priority); @@ -105,7 +102,6 @@ protected: int _priority; SoundResource **_soundResources; SoundResource *getSoundResource(uint index); - // TODO Add other sound stuff void loadSound(uint index, uint32 fileHash); void playSound(uint index, uint32 fileHash = 0); void stopSound(uint index); diff --git a/engines/neverhood/klayman.cpp b/engines/neverhood/klayman.cpp index 8f0a94e52d..f06ce40c68 100644 --- a/engines/neverhood/klayman.cpp +++ b/engines/neverhood/klayman.cpp @@ -62,7 +62,6 @@ Klayman::Klayman(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, int _flagF6(false), _isLeverDown(false), _isSittingInTeleporter(false), _flagFA(false), _ladderStatus(0), _pathPoints(NULL), _soundFlag(false), _idleTableNum(0), _otherSprite(NULL), _moveObjectCountdown(0), _readyToSpit(false), _walkResumeFrameIncr(0) { - // TODO DirtySurface createSurface(surfacePriority, 320, 200); _x = x; _y = y; @@ -475,10 +474,6 @@ void Klayman::gotoNextStateExt() { AnimationCb cb = _nextStateCb; _nextStateCb = NULL; (this->*cb)(); -#if 0 // TODO (So far, with almost all Klayman subclasses implemented, _callbackList and related code seems unused) - } else if (_callbackList) { - removeCallbackList(); -#endif } else { // Inform the scene that the current Klayman animation sequence has finished sendMessage(_parentScene, 0x1006, 0); @@ -2927,7 +2922,6 @@ void Klayman::stFalling() { SetMessageHandler(&Klayman::hmLowLevelAnimation); NextState(&Klayman::stFallTouchdown); sendMessage(_parentScene, 0x2002, 0); - // TODO _callbackList = NULL; (See comment above) _attachedSprite = NULL; sendMessage(_parentScene, 0x8001, 0); } @@ -3338,7 +3332,6 @@ uint32 KmScene1001::xHandleMessage(int messageNum, const MessageParam ¶m) { gotoNextStateExt(); break; case 0x481B: - // TODO: It's not really a point but an x1/x2 pair if (param.asPoint().y != 0) { sub41CC40(param.asPoint().y, param.asPoint().x); } else { @@ -3575,9 +3568,11 @@ KmScene1109::KmScene1109(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { + uint32 messageResult = 0; switch (messageNum) { case 0x2000: _isSittingInTeleporter = param.asInteger() != 0; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -3629,7 +3624,7 @@ uint32 KmScene1109::xHandleMessage(int messageNum, const MessageParam ¶m) { teleporterDisappear(0x3C2E4245); break; } - return 0; + return messageResult; } // KmScene1201 @@ -3816,6 +3811,7 @@ uint32 KmScene1306::xHandleMessage(int messageNum, const MessageParam ¶m) { switch (messageNum) { case 0x2000: _isSittingInTeleporter = param.asInteger() != 0; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -4270,9 +4266,11 @@ KmScene1608::KmScene1608(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { + uint32 messageResult = 0; switch (messageNum) { case 0x2032: _isSittingInTeleporter = param.asInteger() != 0; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -4349,7 +4347,7 @@ uint32 KmScene1608::xHandleMessage(int messageNum, const MessageParam ¶m) { startSpecialWalkLeft(param.asInteger()); break; } - return 0; + return messageResult; } // KmScene1705 @@ -4493,9 +4491,11 @@ KmScene2001::KmScene2001(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { + uint32 messageResult = 0; switch (messageNum) { case 0x2000: _isSittingInTeleporter = param.asInteger() != 0; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -4547,7 +4547,7 @@ uint32 KmScene2001::xHandleMessage(int messageNum, const MessageParam ¶m) { teleporterDisappear(0x18AB4ED4); break; } - return 0; + return messageResult; } KmScene2101::KmScene2101(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y) @@ -5758,9 +5758,11 @@ KmScene2805::KmScene2805(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 } uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { + uint32 messageResult = 0; switch (messageNum) { case 0x2000: _isSittingInTeleporter = param.asInteger() != 0; + messageResult = 1; break; case 0x4001: case 0x4800: @@ -5804,7 +5806,7 @@ uint32 KmScene2805::xHandleMessage(int messageNum, const MessageParam ¶m) { teleporterDisappear(0xD82A4094); break; } - return 0; + return messageResult; } KmScene2806::KmScene2806(NeverhoodEngine *vm, Entity *parentScene, int16 x, int16 y, @@ -5815,7 +5817,6 @@ KmScene2806::KmScene2806(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 _surface->setClipRects(clipRects, clipRectsCount); if (flag) { - // TODO Maybe? Don't know. Set Klayman clip rects loadSound(3, 0x58E0C341); loadSound(4, 0x40A00342); loadSound(5, 0xD0A1C348); @@ -5875,7 +5876,6 @@ KmScene2809::KmScene2809(NeverhoodEngine *vm, Entity *parentScene, int16 x, int1 _surface->setClipRects(clipRects, clipRectsCount); if (flag) { - // TODO Maybe? Don't know. Set Klayman clip rects loadSound(3, 0x58E0C341); loadSound(4, 0x40A00342); loadSound(5, 0xD0A1C348); diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 8e6b56b9f0..4f8f584313 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -200,7 +200,7 @@ AsScene1001Hammer::AsScene1001Hammer(NeverhoodEngine *vm, Sprite *asDoor) _y = 206; createSurface(900, 177, 192); startAnimation(0x022C90D4, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1001Hammer::handleMessage); } @@ -218,7 +218,7 @@ uint32 AsScene1001Hammer::handleMessage(int messageNum, const MessageParam ¶ case 0x2000: startAnimation(0x022C90D4, 1, -1); playSound(0, 0xE741020A); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; break; } return 0; @@ -332,8 +332,6 @@ uint32 SsCommonButtonSprite::handleMessage(int messageNum, const MessageParam &p Scene1001::Scene1001(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true) { - _name = "Scene1001"; - Sprite *tempSprite; SetMessageHandler(&Scene1001::handleMessage); @@ -1130,7 +1128,7 @@ AsScene1002OutsideDoorBackground::AsScene1002OutsideDoorBackground(NeverhoodEngi _y = 240; if (getGlobalVar(V_FLYTRAP_RING_DOOR)) { startAnimation(0x004A4495, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { setVisible(false); } @@ -1177,7 +1175,7 @@ uint32 AsScene1002OutsideDoorBackground::hmAnimation(int messageNum, const Messa void AsScene1002OutsideDoorBackground::stOpenDoor() { startAnimation(0x004A4495, 0, -1); SetMessageHandler(&AsScene1002OutsideDoorBackground::handleMessage); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; setVisible(true); } diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index c0bab71f52..768e7819b0 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -229,7 +229,7 @@ AsScene1201TntManRope::AsScene1201TntManRope(NeverhoodEngine *vm, bool flag) _y = -32; if (flag) { startAnimation(0x928F0C10, 15, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { startAnimation(0x928F0C10, 0, -1); _newStickFrameIndex = 0; @@ -246,7 +246,7 @@ uint32 AsScene1201TntManRope::handleMessage(int messageNum, const MessageParam & break; case 0x2006: startAnimation(0x928F0C10, 1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; break; } return messageResult; @@ -260,10 +260,10 @@ AsScene1201RightDoor::AsScene1201RightDoor(NeverhoodEngine *vm, Sprite *klayman, _y = 240; SetUpdateHandler(&AsScene1201RightDoor::update); SetMessageHandler(&AsScene1201RightDoor::handleMessage); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; if (flag) { startAnimation(0xD088AC30, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; _countdown = 25; } else { stopAnimation(); @@ -293,7 +293,7 @@ uint32 AsScene1201RightDoor::handleMessage(int messageNum, const MessageParam &p void AsScene1201RightDoor::stOpenDoor() { startAnimation(0xD088AC30, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; setVisible(true); playSound(0, calcHash("fxDoorOpen20")); } @@ -419,7 +419,7 @@ void AsScene1201TntMan::stMoving() { startAnimation(0x85084190, 0, -1); SetMessageHandler(&AsScene1201TntMan::handleMessage); SetSpriteUpdate(&AsScene1201TntMan::suMoving); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } AsScene1201TntManFlame::AsScene1201TntManFlame(NeverhoodEngine *vm, Sprite *asTntMan) @@ -687,11 +687,11 @@ AsScene1201LeftDoor::AsScene1201LeftDoor(NeverhoodEngine *vm, Sprite *klayman) createSurface(800, 55, 199); if (_klayman->getX() < 100) { startAnimation(0x508A111B, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; playSound(0, calcHash("fxDoorOpen03")); } else { startAnimation(0x508A111B, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } SetUpdateHandler(&AnimatedSprite::update); SetMessageHandler(&AsScene1201LeftDoor::handleMessage); diff --git a/engines/neverhood/module1300.cpp b/engines/neverhood/module1300.cpp index d92cd66bc6..945d7a9218 100644 --- a/engines/neverhood/module1300.cpp +++ b/engines/neverhood/module1300.cpp @@ -310,7 +310,7 @@ AsScene1302Bridge::AsScene1302Bridge(NeverhoodEngine *vm, Scene *parentScene) _newStickFrameIndex = 0; } else { startAnimation(0x88148150, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } loadSound(0, 0x68895082); loadSound(1, 0x689BD0C1); @@ -348,7 +348,7 @@ void AsScene1302Bridge::stRaiseBridge() { void AsScene1302Bridge::cbLowerBridgeEvent() { sendMessage(_parentScene, 0x2032, 0); startAnimation(0x88148150, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } SsScene1302Fence::SsScene1302Fence(NeverhoodEngine *vm) @@ -1210,7 +1210,7 @@ void AsScene1307Key::stInsertKey() { sendMessage(_parentScene, 0x1022, kAsScene1307KeySurfacePriorities[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _index) % 4]); setClipRect(_clipRects[getSubVar(VA_CURR_KEY_SLOT_NUMBERS, _index) % 4]); SetSpriteUpdate(&AsScene1307Key::suInsertKey); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } void AsScene1307Key::stMoveKey() { @@ -1237,13 +1237,13 @@ void AsScene1307Key::stMoveKey() { void AsScene1307Key::stUnlock() { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; startAnimation(fileHashes[1], 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } void AsScene1307Key::stInsert() { const uint32 *fileHashes = kAsScene1307KeyResourceLists[_index]; startAnimation(fileHashes[2], 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } Scene1307::Scene1307(NeverhoodEngine *vm, Module *parentModule, int which) @@ -1515,7 +1515,7 @@ uint32 AsScene1308LightWallSymbols::handleMessage(int messageNum, const MessageP void AsScene1308LightWallSymbols::stFadeIn() { startAnimation(0x80180A10, 0, -1); setVisible(true); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } void AsScene1308LightWallSymbols::stFadeOut() { diff --git a/engines/neverhood/module1400.cpp b/engines/neverhood/module1400.cpp index f25efe2027..cfa1614602 100644 --- a/engines/neverhood/module1400.cpp +++ b/engines/neverhood/module1400.cpp @@ -311,7 +311,7 @@ AsScene1401BackDoor::AsScene1401BackDoor(NeverhoodEngine *vm, Sprite *klayman, b createSurface1(0x04551900, 100); SetUpdateHandler(&AsScene1401BackDoor::update); SetMessageHandler(&AsScene1401BackDoor::handleMessage); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; if (isOpen) { _isOpen = true; startAnimation(0x04551900, -1,- 1); @@ -355,7 +355,7 @@ void AsScene1401BackDoor::stOpenDoor() { _isOpen = true; setVisible(true); startAnimation(0x04551900, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; playSound(0, calcHash("fxDoorOpen24")); } @@ -820,7 +820,7 @@ AsScene1402PuzzleBox::AsScene1402PuzzleBox(NeverhoodEngine *vm, Scene *parentSce // Puzzle box is here startAnimation(0x20060259, 0, -1); loadSound(1, 0x61901C29); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } } diff --git a/engines/neverhood/module1600.cpp b/engines/neverhood/module1600.cpp index 382aedde38..09bb375a4e 100644 --- a/engines/neverhood/module1600.cpp +++ b/engines/neverhood/module1600.cpp @@ -1062,7 +1062,7 @@ AsCommonCarConnector::AsCommonCarConnector(NeverhoodEngine *vm, AsCommonCar *asC SetUpdateHandler(&AsCommonCarConnector::update); createSurface1(0x60281C10, 150); startAnimation(0x60281C10, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } void AsCommonCarConnector::update() { diff --git a/engines/neverhood/module1900.cpp b/engines/neverhood/module1900.cpp index c4a0904232..0a02d85876 100644 --- a/engines/neverhood/module1900.cpp +++ b/engines/neverhood/module1900.cpp @@ -205,7 +205,7 @@ AsScene1907Symbol::AsScene1907Symbol(NeverhoodEngine *vm, Scene1907 *parentScene } createSurface1(kAsScene1907SymbolFileHashes[_elementIndex], 1000 + _currPositionIndex); startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { _isPluggedIn = false; _currPositionIndex = positionIndex; @@ -377,7 +377,7 @@ void AsScene1907Symbol::fallOff(int newPositionIndex, int fallOffDelay) { _someY = _y; startAnimation(kAsScene1907SymbolFileHashes[_elementIndex], -1, 0); _playBackwards = true; - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; _currStep = 0; _yAccel = 1; SetUpdateHandler(&AsScene1907Symbol::update); diff --git a/engines/neverhood/module2100.cpp b/engines/neverhood/module2100.cpp index 58f87d9afb..879250a624 100644 --- a/engines/neverhood/module2100.cpp +++ b/engines/neverhood/module2100.cpp @@ -87,7 +87,7 @@ AsScene2101Door::AsScene2101Door(NeverhoodEngine *vm, bool flag) SetMessageHandler(&AsScene2101Door::handleMessage); if (flag) { startAnimation(0x0C202B9C, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { setVisible(false); } @@ -111,14 +111,14 @@ uint32 AsScene2101Door::handleMessage(int messageNum, const MessageParam ¶m, void AsScene2101Door::stOpenDoor() { startAnimation(0x0C202B9C, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; setVisible(true); playSound(0, calcHash("fxDoorOpen32")); } void AsScene2101Door::stCloseDoor() { startAnimation(0xC222A8D4, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; setVisible(true); NextState(&AsScene2101Door::stCloseDoorDone); playSound(0, calcHash("fxDoorClose32")); diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index 028c88359c..d82bf8c1d9 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -426,7 +426,7 @@ AsScene2201Door::AsScene2201Door(NeverhoodEngine *vm, Klayman *klayman, Sprite * if (_doorOpen) { startAnimation(0xE2CB0412, -1, -1); _countdown = 48; - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { startAnimation(0xE2CB0412, 0, -1); _newStickFrameIndex = 0; @@ -473,7 +473,7 @@ uint32 AsScene2201Door::handleMessage(int messageNum, const MessageParam ¶m, void AsScene2201Door::stOpenDoor() { _doorOpen = true; startAnimation(0xE2CB0412, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; playSound(0, calcHash("fxDoorOpen33")); } @@ -1056,7 +1056,7 @@ AsScene2203Door::AsScene2203Door(NeverhoodEngine *vm, Scene *parentScene, uint d createSurface1(kAsScene2203DoorFileHashes[_doorIndex], 900); if (getGlobalVar(V_LARGE_DOOR_NUMBER) == _doorIndex) { startAnimation(kAsScene2203DoorFileHashes[_doorIndex], -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { startAnimation(kAsScene2203DoorFileHashes[_doorIndex], 0, -1); _newStickFrameIndex = 0; diff --git a/engines/neverhood/module2400.cpp b/engines/neverhood/module2400.cpp index 770a5c3301..7cc97f7d48 100644 --- a/engines/neverhood/module2400.cpp +++ b/engines/neverhood/module2400.cpp @@ -328,7 +328,7 @@ AsScene2401Door::AsScene2401Door(NeverhoodEngine *vm, bool isOpen) createSurface1(0x44687810, 100); _x = 320; _y = 240; - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; SetUpdateHandler(&AsScene2401Door::update); SetMessageHandler(&AsScene2401Door::handleMessage); if (_isOpen) { @@ -581,7 +581,7 @@ AsScene2402Door::AsScene2402Door(NeverhoodEngine *vm, Scene *parentScene, bool i createSurface1(0x80495831, 100); _x = 320; _y = 240; - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; if (_isOpen) { startAnimation(0x80495831, -1, -1); _countdown = 48; @@ -619,7 +619,7 @@ uint32 AsScene2402Door::handleMessage(int messageNum, const MessageParam ¶m, _isOpen = true; setVisible(true); startAnimation(0x80495831, 0, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; playSound(0, calcHash("fxDoorOpen38")); break; } diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp index 60cc581066..b0983dee98 100644 --- a/engines/neverhood/module2700.cpp +++ b/engines/neverhood/module2700.cpp @@ -559,7 +559,7 @@ AsCommonCarConnectorShadow::AsCommonCarConnectorShadow(NeverhoodEngine *vm, Spri SetUpdateHandler(&AsCommonCarConnectorShadow::update); createShadowSurface1(shadowSurface, 0x60281C10, 150); startAnimation(0x60281C10, -1, -1); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } void AsCommonCarConnectorShadow::update() { diff --git a/engines/neverhood/module2800.cpp b/engines/neverhood/module2800.cpp index 174e5e041d..268b2c67a9 100644 --- a/engines/neverhood/module2800.cpp +++ b/engines/neverhood/module2800.cpp @@ -3101,7 +3101,7 @@ uint32 AsScene2812TrapDoor::handleMessage(int messageNum, const MessageParam &pa case 0x2000: startAnimation(0x805D0029, 0, -1); playSound(0, 0xEA005F40); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; break; } return messageResult; diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index a6bc6eb6fe..7695248c4b 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -1227,7 +1227,7 @@ void AsScene3010DeadBolt::unlock(bool skipAnim) { setVisible(true); if (skipAnim) { startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], -1, 0); - _newStickFrameIndex = -2; + _newStickFrameIndex = STICK_LAST_FRAME; } else { startAnimation(kAsScene3010DeadBoltFileHashes1[_boltIndex], 0, -1); SetMessageHandler(&AsScene3010DeadBolt::hmAnimation); diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 66f1178a52..f81be07dff 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -30,7 +30,6 @@ Sprite::Sprite(NeverhoodEngine *vm, int objectPriority) : Entity(vm, objectPriority), _x(0), _y(0), _spriteUpdateCb(NULL), _filterXCb(NULL), _filterYCb(NULL), _dataResource(vm), _doDeltaX(false), _doDeltaY(false), _needRefresh(false), _flags(0), _surface(NULL) { - _name = "Sprite"; SetMessageHandler(&Sprite::handleMessage); } @@ -119,21 +118,17 @@ void Sprite::setClipRect(NDrawRect& drawRect) { StaticSprite::StaticSprite(NeverhoodEngine *vm, int objectPriority) : Sprite(vm, objectPriority), _spriteResource(vm) { - _name = "StaticSprite"; - } StaticSprite::StaticSprite(NeverhoodEngine *vm, const char *filename, int surfacePriority, int16 x, int16 y, int16 width, int16 height) : Sprite(vm, 0), _spriteResource(vm) { - _name = "StaticSprite"; init(calcHash(filename), surfacePriority, x, y, width, height); - } StaticSprite::StaticSprite(NeverhoodEngine *vm, uint32 fileHash, int surfacePriority, int16 x, int16 y, int16 width, int16 height) : Sprite(vm, 0), _spriteResource(vm) { - _name = "StaticSprite"; + init(fileHash, surfacePriority, x, y, width, height); } @@ -227,13 +222,11 @@ AnimatedSprite::AnimatedSprite(NeverhoodEngine *vm, uint32 fileHash, int surface } void AnimatedSprite::init() { - _name = "AnimatedSprite"; _currFrameTicks = 0; _newAnimFileHash = 0; _deltaX = 0; _deltaY = 0; _nextAnimFileHash = 0; - // TODO _callbackList = 0; _plFirstFrameIndex = 0; _currFrameIndex = 0; _currStickFrameIndex = -1; @@ -289,7 +282,7 @@ void AnimatedSprite::updateAnim() { if (_newAnimFileHash == 0) { if (_newStickFrameIndex != -1) { - _currStickFrameIndex = _newStickFrameIndex == -2 ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; + _currStickFrameIndex = _newStickFrameIndex == STICK_LAST_FRAME ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; _newStickFrameIndex = -1; } else if (_newStickFrameHash != 0) { _currStickFrameIndex = MAX<int16>(0, _animResource.getFrameIndex(_newStickFrameHash)); @@ -360,7 +353,7 @@ void AnimatedSprite::updateAnim() { } if (_newStickFrameIndex != -1) { - _currStickFrameIndex = _newStickFrameIndex == -2 ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; + _currStickFrameIndex = _newStickFrameIndex == STICK_LAST_FRAME ? _animResource.getFrameCount() - 1 : _newStickFrameIndex; _newStickFrameIndex = -1; } else if (_newStickFrameHash != 0) { _currStickFrameIndex = MAX<int16>(0, _animResource.getFrameIndex(_newStickFrameHash)); @@ -428,9 +421,8 @@ void AnimatedSprite::updateFrameInfo() { _currFrameTicks = frameInfo.counter; processDelta(); _needRefresh = true; - if (frameInfo.frameHash != 0) { + if (frameInfo.frameHash != 0) sendMessage(this, 0x100D, frameInfo.frameHash); - } } void AnimatedSprite::createSurface1(uint32 fileHash, int surfacePriority) { @@ -499,7 +491,6 @@ void AnimatedSprite::gotoState(AnimationCb currStateCb) { _finalizeStateCb = NULL; (this->*cb)(); } - // TODO _callbackList = NULL; _nextStateCb = NULL; _currStateCb = currStateCb; if (_currStateCb) @@ -517,10 +508,6 @@ void AnimatedSprite::gotoNextState() { _nextStateCb = NULL; //debug("Fire _nextStateCb '%s'", _nextStateCbName.c_str()); (this->*_currStateCb)(); -#if 0 // TODO - } else if (_callbackList) { - removeCallbackList(); -#endif } else { _currStateCb = NULL; } diff --git a/engines/neverhood/sprite.h b/engines/neverhood/sprite.h index d34704d7bf..358a37bc57 100644 --- a/engines/neverhood/sprite.h +++ b/engines/neverhood/sprite.h @@ -113,6 +113,8 @@ protected: #define NextState(callback) _nextStateCb = static_cast <void (AnimatedSprite::*)(void)> (callback); debug(2, "NextState(" #callback ")"); _nextStateCbName = #callback #define FinalizeState(callback) setFinalizeState(static_cast <void (AnimatedSprite::*)()> (callback)); +const int STICK_LAST_FRAME = -2; + class AnimatedSprite : public Sprite { public: AnimatedSprite(NeverhoodEngine *vm, int objectPriority); @@ -140,11 +142,6 @@ protected: int16 _deltaX, _deltaY; byte _replOldColor, _replNewColor; bool _playBackwards, _frameChanged; - /* TODO - callbackListIndex dw ? - callbackListCount dw ? - callbackList dd ? - */ AnimationCb _finalizeStateCb; AnimationCb _currStateCb; AnimationCb _nextStateCb; |