[Scummvm-git-logs] scummvm master -> 3afb6333b9af8e887f39a0be8dbe534077c7177a
mgerhardy
noreply at scummvm.org
Tue Feb 11 20:46:13 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f00f4e9d7c TWINE: comments to mention the original source names
3afb6333b9 TWINE: added pitchbend values to playSample (they are still unused)
Commit: f00f4e9d7c1976b61467f000fd4591773c4e0a57
https://github.com/scummvm/scummvm/commit/f00f4e9d7c1976b61467f000fd4591773c4e0a57
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2025-02-11T21:09:16+01:00
Commit Message:
TWINE: comments to mention the original source names
Changed paths:
engines/twine/shared.h
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 045b0f73dc9..e2eb4aac7ee 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -287,38 +287,38 @@ enum class ControlMode {
enum class AnimationTypes {
kAnimNone = -1,
- kStanding = 0, // GEN_ANIM_RIEN
- kForward = 1, // GEN_ANIM_MARCHE
- kBackward = 2, // GEN_ANIM_RECULE
- kTurnLeft = 3, // GEN_ANIM_GAUCHE
- kTurnRight = 4, // GEN_ANIM_DROITE
- kHit = 5,
- kBigHit = 6,
- kFall = 7,
- kLanding = 8,
- kLandingHit = 9,
- kLandDeath = 10,
- kAction = 11,
- kClimbLadder = 12,
- kTopLadder = 13,
- kJump = 14,
- kThrowBall = 15,
- kHide = 16,
- kKick = 17,
- kRightPunch = 18,
- kLeftPunch = 19,
- kFoundItem = 20,
- kDrawn = 21,
- kHit2 = 22,
- kSabreAttack = 23,
- kPush = 27, // GEN_ANIM_POUSSE
- kSabreUnknown = 24,
+ kStanding = 0, // GEN_ANIM_RIEN
+ kForward = 1, // GEN_ANIM_MARCHE
+ kBackward = 2, // GEN_ANIM_RECULE
+ kTurnLeft = 3, // GEN_ANIM_GAUCHE
+ kTurnRight = 4, // GEN_ANIM_DROITE
+ kHit = 5, // GEN_ANIM_ENCAISSE
+ kBigHit = 6, // GEN_ANIM_CHOC
+ kFall = 7, // GEN_ANIM_TOMBE
+ kLanding = 8, // GEN_ANIM_RECEPTION
+ kLandingHit = 9, // GEN_ANIM_RECEPTION_2
+ kLandDeath = 10, // GEN_ANIM_MORT
+ kAction = 11, // GEN_ANIM_ACTION
+ kClimbLadder = 12, // GEN_ANIM_MONTE
+ kTopLadder = 13, // GEN_ANIM_ECHELLE
+ kJump = 14, // GEN_ANIM_SAUTE
+ kThrowBall = 15, // GEN_ANIM_LANCE
+ kHide = 16, // GEN_ANIM_CACHE
+ kKick = 17, // GEN_ANIM_COUP_1
+ kRightPunch = 18, // GEN_ANIM_COUP_2
+ kLeftPunch = 19, // GEN_ANIM_COUP_3
+ kFoundItem = 20, // GEN_ANIM_TROUVE
+ kDrawn = 21, // GEN_ANIM_NOYADE
+ kHit2 = 22, // GEN_ANIM_CHOC2
+ kSabreAttack = 23, // GEN_ANIM_SABRE
+ kSabreUnknown = 24, // GEN_ANIM_DEGAINE
+ kPush = 27, // GEN_ANIM_POUSSE
kCarStarting = 303,
kCarDriving = 304,
kCarDrivingBackwards = 305,
kCarStopping = 306,
kCarFrozen = 307,
- kAnimInvalid = 255
+ kAnimInvalid = 255 // NO_ANIM
};
enum class AnimType {
Commit: 3afb6333b9af8e887f39a0be8dbe534077c7177a
https://github.com/scummvm/scummvm/commit/3afb6333b9af8e887f39a0be8dbe534077c7177a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2025-02-11T21:43:53+01:00
Commit Message:
TWINE: added pitchbend values to playSample (they are still unused)
see issue https://bugs.scummvm.org/ticket/15735
Changed paths:
engines/twine/audio/sound.cpp
engines/twine/audio/sound.h
engines/twine/renderer/redraw.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/animations.cpp
engines/twine/scene/extra.cpp
engines/twine/script/script_move.cpp
engines/twine/script/script_move.h
engines/twine/twine.cpp
diff --git a/engines/twine/audio/sound.cpp b/engines/twine/audio/sound.cpp
index b8d758e2cb1..19a72209cfb 100644
--- a/engines/twine/audio/sound.cpp
+++ b/engines/twine/audio/sound.cpp
@@ -112,7 +112,7 @@ void Sound::playFlaSample(int32 index, int32 repeat, uint8 balance, int32 volume
playSample(channelIdx, index, audioStream, repeat, Resources::HQR_FLASAMP_FILE);
}
-void Sound::playSample(int32 index, int32 repeat, int32 x, int32 y, int32 z, int32 actorIdx) {
+void Sound::playSample(int32 index, uint16 pitchbend, int32 repeat, int32 x, int32 y, int32 z, int32 actorIdx) {
if (!_engine->_cfgfile.Sound) {
return;
}
@@ -131,6 +131,9 @@ void Sound::playSample(int32 index, int32 repeat, int32 x, int32 y, int32 z, int
samplesPlayingActors[channelIdx] = -1;
}
+ // TODO: implement pitchbend - see https://bugs.scummvm.org/ticket/15735
+ // frequency would be 11025 + (pitchbend - 0x1000);
+
uint8 *sampPtr = _engine->_resources->_samplesTable[index];
uint32 sampSize = _engine->_resources->_samplesSizeTable[index];
Common::MemoryReadStream *stream = new Common::MemoryReadStream(sampPtr, sampSize, DisposeAfterUse::NO);
diff --git a/engines/twine/audio/sound.h b/engines/twine/audio/sound.h
index 08d73da772b..3db1bd056f2 100644
--- a/engines/twine/audio/sound.h
+++ b/engines/twine/audio/sound.h
@@ -44,7 +44,7 @@ enum _Samples {
TaskCompleted = 41,
Hit = 86,
ItemFound = 97,
- WalkFloorBegin = 126,
+ WalkFloorBegin = 126, // BASE_STEP_SOUND
WalkFloorRightBegin = 141
};
}
@@ -100,11 +100,10 @@ public:
* @param z sound generating entity z position
* @param actorIdx
*/
- void playSample(int32 index, int32 repeat = 1, int32 x = 128, int32 y = 128, int32 z = 128, int32 actorIdx = -1); // HQ_3D_MixSample
- void playSample(int32 index, int32 repeat, const IVec3 &pos, int32 actorIdx = -1) { // HQ_MixSample
- playSample(index, repeat, pos.x, pos.y, pos.z, actorIdx);
+ void playSample(int32 index, uint16 pitchbend = 0x1000, int32 repeat = 1, int32 x = 128, int32 y = 128, int32 z = 128, int32 actorIdx = -1); // HQ_3D_MixSample
+ void playSample(int32 index, uint16 pitchbend, int32 repeat, const IVec3 &pos, int32 actorIdx = -1) { // HQ_MixSample
+ playSample(index, pitchbend, repeat, pos.x, pos.y, pos.z, actorIdx);
}
-
/** Pause samples */
void pauseSamples();
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 8c617f4b4e1..cfff95a7a80 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -332,7 +332,7 @@ int32 Redraw::fillExtraDrawingList(DrawListStruct *drawList, int32 drawListPos)
if (_engine->timerRef - extra->spawnTime > 35) {
extra->spawnTime = _engine->timerRef;
extra->type &= ~ExtraType::TIME_IN;
- _engine->_sound->playSample(Samples::ItemPopup, 1, extra->pos);
+ _engine->_sound->playSample(Samples::ItemPopup, 0x1000, 1, extra->pos);
}
continue;
}
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 2c1598dc3d3..9578a89034d 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -438,13 +438,13 @@ void Actor::giveExtraBonus(int32 actorIdx) {
}
if (actor->_workFlags.bIsDead) {
_engine->_extra->addExtraBonus(actor->posObj(), LBAAngles::ANGLE_90, LBAAngles::ANGLE_0, bonusSprite, actor->_bonusAmount);
- _engine->_sound->playSample(Samples::ItemPopup, 1, actor->posObj(), actorIdx);
+ _engine->_sound->playSample(Samples::ItemPopup, 0x1000, 1, actor->posObj(), actorIdx);
} else {
const ActorStruct *sceneHero = _engine->_scene->_sceneHero;
const int32 angle = _engine->_movements->getAngle(actor->posObj(), sceneHero->posObj());
const IVec3 pos(actor->_posObj.x, actor->_posObj.y + actor->_boundingBox.maxs.y, actor->_posObj.z);
_engine->_extra->addExtraBonus(pos, LBAAngles::ANGLE_70, angle, bonusSprite, actor->_bonusAmount);
- _engine->_sound->playSample(Samples::ItemPopup, 1, pos, actorIdx);
+ _engine->_sound->playSample(Samples::ItemPopup, 0x1000, 1, pos, actorIdx);
}
}
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 962592c8cff..e5ef81e0449 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -294,9 +294,14 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
}
break;
case ActionType::ACTION_SAMPLE:
+ if (action.animFrame == actor->_frame) {
+ _engine->_sound->playSample(action.sampleIndex, 0x1000, 1, actor->posObj(), actorIdx);
+ }
+ break;
case ActionType::ACTION_SAMPLE_FREQ:
if (action.animFrame == actor->_frame) {
- _engine->_sound->playSample(action.sampleIndex, 1, actor->posObj(), actorIdx);
+ const uint16 pitchBend = 0x1000 + _engine->getRandomNumber(action.frequency) - (action.frequency / 2);
+ _engine->_sound->playSample(action.sampleIndex, pitchBend, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_THROW_EXTRA_BONUS:
@@ -311,7 +316,7 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
break;
case ActionType::ACTION_SAMPLE_REPEAT:
if (action.animFrame == actor->_frame) {
- _engine->_sound->playSample(action.sampleIndex, action.repeat, actor->posObj(), actorIdx);
+ _engine->_sound->playSample(action.sampleIndex, 0x1000, action.repeat, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_THROW_SEARCH:
@@ -332,13 +337,15 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
case ActionType::ACTION_LEFT_STEP:
if (action.animFrame == actor->_frame && (actor->_brickSound & 0xF0U) != 0xF0U) {
const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorBegin;
- _engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
+ const uint16 pitchBend = 0x1000 + _engine->getRandomNumber(1000) - 500;
+ _engine->_sound->playSample(sampleIdx, pitchBend, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_RIGHT_STEP:
if (action.animFrame == actor->_frame && (actor->_brickSound & 0xF0U) != 0xF0U) {
const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorRightBegin;
- _engine->_sound->playSample(sampleIdx, 1, actor->posObj(), actorIdx);
+ const uint16 pitchBend = 0x1000 + _engine->getRandomNumber(1000) - 500;
+ _engine->_sound->playSample(sampleIdx, pitchBend, 1, actor->posObj(), actorIdx);
}
break;
case ActionType::ACTION_HERO_HITTING:
@@ -400,7 +407,7 @@ void Animations::processAnimActions(int32 actorIdx) { // GereAnimAction
}
}
-bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes genNextAnim, int32 actorIdx) {
+bool Animations::initAnim(AnimationTypes genNewAnim, AnimType flag, AnimationTypes genNextAnim, int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
if (actor->_body == -1) {
return false;
@@ -410,7 +417,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
return false;
}
- if (newAnim == actor->_genAnim && actor->_anim != -1) {
+ if (genNewAnim == actor->_genAnim && actor->_anim != -1) {
return true;
}
@@ -418,7 +425,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
genNextAnim = actor->_genAnim;
}
- int32 newanim = searchAnim(newAnim, actorIdx);
+ int32 newanim = searchAnim(genNewAnim, actorIdx);
if (newanim == -1) {
newanim = searchAnim(AnimationTypes::kStanding, actorIdx);
@@ -428,7 +435,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
}
if (flag != AnimType::kAnimationSet && actor->_flagAnim == AnimType::kAnimationAllThen) {
- actor->_nextGenAnim = newAnim;
+ actor->_nextGenAnim = genNewAnim;
return false;
}
@@ -455,7 +462,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType flag, AnimationTypes
}
actor->_anim = newanim;
- actor->_genAnim = newAnim;
+ actor->_genAnim = genNewAnim;
actor->_nextGenAnim = genNextAnim;
actor->_ptrAnimAction = _currentActorAnimExtraPtr;
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 258a9365fb7..32631a1cb52 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -610,7 +610,7 @@ void Extra::gereExtras() {
const int32 angle = ClampAngle(tmpAngle - extra->angle);
if (angle > LBAAngles::ANGLE_140 && angle < LBAAngles::ANGLE_210) {
- _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
+ _engine->_sound->playSample(Samples::ItemFound, 0x1000, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
if (extraKey->info1 > 1) {
const IVec3 &projPos = _engine->_renderer->projectPoint(extraKey->pos - _engine->_grid->_worldCube);
@@ -643,7 +643,7 @@ void Extra::gereExtras() {
_engine->_movements->initRealValue(LBAAngles::ANGLE_0, extra->destPos.z, LBAAngles::ANGLE_17, &extra->trackActorMove);
if (extraIdx == _engine->_collision->extraCheckExtraCol(extra, _engine->_gameState->_magicBall)) {
- _engine->_sound->playSample(Samples::ItemFound, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
+ _engine->_sound->playSample(Samples::ItemFound, 0x1000, 1, _engine->_scene->_sceneHero->posObj(), OWN_ACTOR_SCENE_INDEX);
if (extraKey->info1 > 1) {
const IVec3 &projPos = _engine->_renderer->projectPoint(extraKey->pos - _engine->_grid->_worldCube);
@@ -720,7 +720,8 @@ void Extra::gereExtras() {
}
// if extra is magic ball
if (i == _engine->_gameState->_magicBall) {
- _engine->_sound->playSample(Samples::Hit, 1, extra->pos);
+ const uint16 pitchBend = 0x1000 + _engine->getRandomNumber(300) - 150;
+ _engine->_sound->playSample(Samples::Hit, pitchBend, 1, extra->pos);
// can't bounce with not magic points
if (_engine->_gameState->_magicBallType <= 0) {
@@ -791,7 +792,7 @@ void Extra::gereExtras() {
if ((extra->type & ExtraType::TAKABLE) && !(extra->type & ExtraType::FLY)) {
// if hero touch extra
if (_engine->_collision->extraCheckObjCol(extra, -1) == 0) {
- _engine->_sound->playSample(Samples::ItemFound, 1, extra->pos);
+ _engine->_sound->playSample(Samples::ItemFound, 0x1000, 1, extra->pos);
if (extra->info1 > 1) {
const IVec3 &projPos = _engine->_renderer->projectPoint(extra->pos - _engine->_grid->_worldCube);
diff --git a/engines/twine/script/script_move.cpp b/engines/twine/script/script_move.cpp
index 1021b905bfa..8737bbb00d7 100644
--- a/engines/twine/script/script_move.cpp
+++ b/engines/twine/script/script_move.cpp
@@ -280,7 +280,7 @@ int32 ScriptMove::mWAIT_NUM_ANIM(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 ScriptMove::mSAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::SAMPLE(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, 1, ctx.actor->posObj(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, 0x1000, 1, ctx.actor->posObj(), ctx.actorIdx);
return 0;
}
@@ -491,7 +491,8 @@ int32 ScriptMove::mWAIT_DOOR(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 ScriptMove::mSAMPLE_RND(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::SAMPLE_RND(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, 1, ctx.actor->posObj(), ctx.actorIdx);
+ const uint16 pitchbend = 0x800 + engine->getRandomNumber(0x800);
+ engine->_sound->playSample(sampleIdx, pitchbend, 1, ctx.actor->posObj(), ctx.actorIdx);
return 0;
}
@@ -503,7 +504,7 @@ int32 ScriptMove::mSAMPLE_ALWAYS(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::SAMPLE_ALWAYS(%i)", (int)sampleIdx);
if (!engine->_sound->isSamplePlaying(sampleIdx)) { // if its not playing
- engine->_sound->playSample(sampleIdx, -1, ctx.actor->posObj(), ctx.actorIdx);
+ engine->_sound->playSample(sampleIdx, 0x1000, 0, ctx.actor->posObj(), ctx.actorIdx);
}
return 0;
}
@@ -552,8 +553,8 @@ int32 ScriptMove::mPLAY_FLA(TwinEEngine *engine, MoveScriptContext &ctx) {
* @note Opcode @c 0x1F
*/
int32 ScriptMove::mREPEAT_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
- ctx.numRepeatSample = ctx.stream.readSint16LE();
- debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::REPEAT_SAMPLE(%i)", (int)ctx.numRepeatSample);
+ ctx.bigSampleRepeat = ctx.stream.readSint16LE();
+ debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::REPEAT_SAMPLE(%i)", (int)ctx.bigSampleRepeat);
return 0;
}
@@ -564,8 +565,8 @@ int32 ScriptMove::mREPEAT_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 ScriptMove::mSIMPLE_SAMPLE(TwinEEngine *engine, MoveScriptContext &ctx) {
int32 sampleIdx = ctx.stream.readSint16LE();
debugC(3, kDebugLevels::kDebugScriptsMove, "MOVE::SIMPLE_SAMPLE(%i)", (int)sampleIdx);
- engine->_sound->playSample(sampleIdx, ctx.numRepeatSample, ctx.actor->posObj(), ctx.actorIdx);
- ctx.numRepeatSample = 1;
+ engine->_sound->playSample(sampleIdx, 0x1000, ctx.bigSampleRepeat, ctx.actor->posObj(), ctx.actorIdx);
+ ctx.bigSampleRepeat = 1;
return 0;
}
diff --git a/engines/twine/script/script_move.h b/engines/twine/script/script_move.h
index e77da56ab47..d52a35e2c5a 100644
--- a/engines/twine/script/script_move.h
+++ b/engines/twine/script/script_move.h
@@ -30,7 +30,7 @@ namespace TwinE {
struct MoveScriptContext {
int32 actorIdx;
ActorStruct *actor;
- int32 numRepeatSample = 1;
+ int32 bigSampleRepeat = 1;
Common::MemorySeekableReadWriteStream stream;
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index a4333a01a1d..c4aae736d10 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1096,7 +1096,8 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
actor->_workFlags.bIsHitting = 0;
#endif
} else {
- _sound->playSample(Samples::Explode, 1, actor->posObj(), a);
+ const uint16 pitchBend = 0x1000 + getRandomNumber(2000) - (2000 / 2);
+ _sound->playSample(Samples::Explode, pitchBend, 1, actor->posObj(), a);
if (a == _scene->_mecaPenguinIdx) {
_extra->extraExplo(actor->posObj());
@@ -1160,7 +1161,8 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
actor->_flags.bNoShadow = 1;
}
} else {
- _sound->playSample(Samples::Explode, 1, actor->posObj(), a);
+ const uint16 pitchBend = 0x1000 + getRandomNumber(2000) - (2000 / 2);
+ _sound->playSample(Samples::Explode, pitchBend, 1, actor->posObj(), a);
if (actor->_bonusParameter.cloverleaf || actor->_bonusParameter.kashes || actor->_bonusParameter.key || actor->_bonusParameter.lifepoints || actor->_bonusParameter.magicpoints) {
if (!actor->_bonusParameter.givenNothing) {
_actor->giveExtraBonus(a);
More information about the Scummvm-git-logs
mailing list