aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohndoe1232012-10-01 11:04:36 +0000
committerWillem Jan Palenstijn2013-05-08 20:43:45 +0200
commit0c5a5b3c62826904166847b2626fe37b62023547 (patch)
treeb6cc4b9c9bfd0af715d7ec90e8335e8678921771
parent3651d982c4229fb77d371836cdc3ddbca156d980 (diff)
downloadscummvm-rg350-0c5a5b3c62826904166847b2626fe37b62023547.tar.gz
scummvm-rg350-0c5a5b3c62826904166847b2626fe37b62023547.tar.bz2
scummvm-rg350-0c5a5b3c62826904166847b2626fe37b62023547.zip
NEVERHOOD: Change sound stuff in Module2400
-rw-r--r--engines/neverhood/module2400.cpp48
-rw-r--r--engines/neverhood/module2400.h10
2 files changed, 23 insertions, 35 deletions
diff --git a/engines/neverhood/module2400.cpp b/engines/neverhood/module2400.cpp
index f1f9f04777..6c120069b7 100644
--- a/engines/neverhood/module2400.cpp
+++ b/engines/neverhood/module2400.cpp
@@ -201,7 +201,7 @@ static const uint32 kAsScene2401WaterSpitFileHashes1[] = {
};
AsScene2401WaterSpit::AsScene2401WaterSpit(NeverhoodEngine *vm)
- : AnimatedSprite(vm, 1200), _soundResource(vm) {
+ : AnimatedSprite(vm, 1200) {
SetUpdateHandler(&AnimatedSprite::update);
SetMessageHandler(&AsScene2401WaterSpit::handleMessage);
@@ -217,13 +217,13 @@ uint32 AsScene2401WaterSpit::handleMessage(int messageNum, const MessageParam &p
switch (messageNum) {
case 0x100D:
if (param.asInteger() == 0x120A0013)
- _soundResource.play(kAsScene2401WaterSpitFileHashes1[_soundIndex]);
+ playSound(0, kAsScene2401WaterSpitFileHashes1[_soundIndex]);
break;
case 0x2000:
_x = 240;
_y = 447;
_soundIndex = getSubVar(0x0800547C, param.asInteger());
- _soundResource.play(0x48640244);
+ playSound(0, 0x48640244);
startAnimation(kAsScene2401WaterSpitFileHashes2[param.asInteger()], 0, -1);
setVisible(true);
break;
@@ -323,7 +323,7 @@ uint32 AsScene2401WaterFlushing::handleMessage(int messageNum, const MessagePara
}
AsScene2401Door::AsScene2401Door(NeverhoodEngine *vm, bool isOpen)
- : AnimatedSprite(vm, 1100), _countdown(0), _isOpen(isOpen), _soundResource(vm) {
+ : AnimatedSprite(vm, 1100), _countdown(0), _isOpen(isOpen) {
createSurface1(0x44687810, 100);
_x = 320;
@@ -348,7 +348,7 @@ void AsScene2401Door::update() {
startAnimation(0x44687810, -1, -1);
_newStickFrameIndex = 0;
_playBackwards = true;
- _soundResource.play(calcHash("fxDoorClose38"));
+ playSound(0, calcHash("fxDoorClose38"));
}
AnimatedSprite::update();
}
@@ -370,7 +370,7 @@ uint32 AsScene2401Door::handleMessage(int messageNum, const MessageParam &param,
_isOpen = true;
setVisible(true);
startAnimation(0x44687810, 0, -1);
- _soundResource.play(calcHash("fxDoorOpen38"));
+ playSound(0, calcHash("fxDoorOpen38"));
NextState(&AsScene2401Door::stDoorOpenFinished);
}
break;
@@ -385,7 +385,7 @@ void AsScene2401Door::stDoorOpenFinished() {
Scene2401::Scene2401(NeverhoodEngine *vm, Module *parentModule, int which)
: Scene(vm, parentModule, true), _countdown1(0), _countdown2(0), _flag(false),
- _soundToggle(false), _asWaterSpitIndex(0), _soundResource1(vm), _soundResource2(vm) {
+ _soundToggle(false), _asWaterSpitIndex(0) {
_vm->gameModule()->initScene2401Vars();
@@ -545,7 +545,7 @@ uint32 Scene2401::handleMessage(int messageNum, const MessageParam &param, Entit
} else if (sender == _ssFloorButton && getGlobalVar(0x4E0BE910)) {
_countdown2 = 144;
sendMessage(_asFlowingWater, 0x2002, 0);
- _soundResource1.play(0xE1130324);
+ playSound(0, 0xE1130324);
}
break;
case 0x482A:
@@ -562,9 +562,9 @@ uint32 Scene2401::handleMessage(int messageNum, const MessageParam &param, Entit
void Scene2401::playPipeSound(uint32 fileHash) {
if (_soundToggle)
- _soundResource1.play(fileHash);
+ playSound(0, fileHash);
else
- _soundResource2.play(fileHash);
+ playSound(1, fileHash);
_soundToggle = !_soundToggle;
}
@@ -577,7 +577,7 @@ static const uint32 kScene2402FileHashes[] = {
};
AsScene2402Door::AsScene2402Door(NeverhoodEngine *vm, Scene *parentScene, bool isOpen)
- : AnimatedSprite(vm, 1100), _parentScene(parentScene), _isOpen(isOpen), _soundResource(vm) {
+ : AnimatedSprite(vm, 1100), _parentScene(parentScene), _isOpen(isOpen) {
SetUpdateHandler(&AsScene2402Door::update);
SetMessageHandler(&AsScene2402Door::handleMessage);
@@ -600,7 +600,7 @@ void AsScene2402Door::update() {
setVisible(true);
startAnimation(0x80495831, -1, -1);
_playBackwards = true;
- _soundResource.play(calcHash("fxDoorClose38"));
+ playSound(0, calcHash("fxDoorClose38"));
NextState(&AsScene2402Door::stDoorClosingFinished);
}
AnimatedSprite::update();
@@ -623,7 +623,7 @@ uint32 AsScene2402Door::handleMessage(int messageNum, const MessageParam &param,
setVisible(true);
startAnimation(0x80495831, 0, -1);
_newStickFrameIndex = -2;
- _soundResource.play(calcHash("fxDoorOpen38"));
+ playSound(0, calcHash("fxDoorOpen38"));
break;
}
return messageResult;
@@ -635,8 +635,7 @@ void AsScene2402Door::stDoorClosingFinished() {
}
AsScene2402TV::AsScene2402TV(NeverhoodEngine *vm, Klayman *klayman)
- : AnimatedSprite(vm, 1100), _klayman(klayman), _countdown1(0), _countdown2(0),
- _soundResource(vm) {
+ : AnimatedSprite(vm, 1100), _klayman(klayman), _countdown1(0), _countdown2(0) {
createSurface(100, 640, 480); // TODO Use correct size from the two hashes
SetMessageHandler(&Sprite::handleMessage);
@@ -645,7 +644,7 @@ AsScene2402TV::AsScene2402TV(NeverhoodEngine *vm, Klayman *klayman)
setDoDeltaX(1);
if (!getGlobalVar(0x92603A79)) {
- _soundResource.load(0x58208810);
+ loadSound(0, 0x58208810);
_countdown1 = 48;
startAnimation(0x4919397A, 0, -1);
_newStickFrameIndex = 0;
@@ -709,7 +708,7 @@ uint32 AsScene2402TV::hmJoke(int messageNum, const MessageParam &param, Entity *
switch (messageNum) {
case 0x100D:
if (param.asInteger() == 0x431EA0B0) {
- _soundResource.play();
+ playSound(0);
}
break;
case 0x3002:
@@ -720,8 +719,7 @@ uint32 AsScene2402TV::hmJoke(int messageNum, const MessageParam &param, Entity *
}
Scene2402::Scene2402(NeverhoodEngine *vm, Module *parentModule, int which)
- : Scene(vm, parentModule, true), _countdown(0), _soundToggle(false),
- _soundResource1(vm), _soundResource2(vm) {
+ : Scene(vm, parentModule, true), _countdown(0), _soundToggle(false) {
_surfaceFlag = true;
SetMessageHandler(&Scene2402::handleMessage);
@@ -816,14 +814,14 @@ uint32 Scene2402::handleMessage(int messageNum, const MessageParam &param, Entit
void Scene2402::playPipeSound(uint32 fileHash) {
if (_soundToggle)
- _soundResource1.play(fileHash);
+ playSound(0, fileHash);
else
- _soundResource2.play(fileHash);
+ playSound(1, fileHash);
_soundToggle = !_soundToggle;
}
Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which)
- : Scene(vm, parentModule, true), _soundResource1(vm), _soundResource2(vm) {
+ : Scene(vm, parentModule, true) {
Sprite *tempSprite;
@@ -868,7 +866,7 @@ Scene2403::Scene2403(NeverhoodEngine *vm, Module *parentModule, int which)
tempSprite->setClipRect(_sprite1->getDrawRect().x, 0, 640, _sprite2->getDrawRect().y2());
_klayman->setClipRect(_sprite1->getDrawRect().x, 0, 640, _sprite2->getDrawRect().y2());
- _soundResource2.load(calcHash("fxFogHornSoft"));
+ loadSound(1, calcHash("fxFogHornSoft"));
}
@@ -894,10 +892,10 @@ uint32 Scene2403::handleMessage(int messageNum, const MessageParam &param, Entit
if (sender == _ssButton) {
if (getSubVar(0x14800353, 0x304008D2)) {
setSubVar(0x14800353, 0x304008D2, 0);
- _soundResource1.play(calcHash("fx3LocksDisable"));
+ playSound(0, calcHash("fx3LocksDisable"));
} else {
setSubVar(0x14800353, 0x304008D2, 1);
- _soundResource2.play();
+ playSound(1);
}
}
break;
diff --git a/engines/neverhood/module2400.h b/engines/neverhood/module2400.h
index e29f03da9a..bbfa47d07a 100644
--- a/engines/neverhood/module2400.h
+++ b/engines/neverhood/module2400.h
@@ -54,7 +54,6 @@ public:
AsScene2401WaterSpit(NeverhoodEngine *vm);
protected:
int _soundIndex;
- SoundResource _soundResource;
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
};
@@ -83,7 +82,6 @@ public:
protected:
int _countdown;
bool _isOpen;
- SoundResource _soundResource;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void stDoorOpenFinished();
@@ -107,8 +105,6 @@ protected:
int _countdown2;
int _pipeStatus;
int _asWaterSpitIndex;
- SoundResource _soundResource1;
- SoundResource _soundResource2;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void playPipeSound(uint32 fileHash);
@@ -121,7 +117,6 @@ protected:
Scene *_parentScene;
int _countdown;
bool _isOpen;
- SoundResource _soundResource;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void stDoorClosingFinished();
@@ -135,7 +130,6 @@ protected:
Klayman *_klayman;
int _countdown1;
int _countdown2;
- SoundResource _soundResource;
void upWait();
void upFocusKlayman();
void stJokeFinished();
@@ -155,8 +149,6 @@ protected:
int _pipeStatus;
int _countdown;
bool _soundToggle;
- SoundResource _soundResource1;
- SoundResource _soundResource2;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void playPipeSound(uint32 fileHash);
@@ -173,8 +165,6 @@ protected:
Sprite *_class545;
Sprite *_asLightCord;
bool _flag1;
- SoundResource _soundResource1;
- SoundResource _soundResource2;
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
};