[Scummvm-git-logs] scummvm master -> 3e8247a6b75a6b3ddca4fd3cd5da771b571b8c86

mgerhardy martin.gerhardy at gmail.com
Thu Nov 19 22:12:31 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7977f649b3 TWINE: renamed variables + const
6411e5d07e TWINE: fixed warning
3e8247a6b7 TWINE: use IS_HERO macro


Commit: 7977f649b33d41c90af96a1efb5c1ac0a59b1cb3
    https://github.com/scummvm/scummvm/commit/7977f649b33d41c90af96a1efb5c1ac0a59b1cb3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-19T22:54:50+01:00

Commit Message:
TWINE: renamed variables + const

Changed paths:
    engines/twine/animations.cpp


diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index c585a9b367..3a72674ae6 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -448,7 +448,7 @@ int32 Animations::verifyAnimAtKeyframe(int32 animIdx, uint8 *animPtr, uint8 *bod
 
 void Animations::processAnimActions(int32 actorIdx) {
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
-	if (!actor->animExtraPtr) {
+	if (actor->animExtraPtr == nullptr) {
 		return; // avoid null pointers
 	}
 
@@ -464,7 +464,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 
 		switch (actionType) {
 		case ACTION_HITTING: {
-			int32 animPos = stream.readByte() - 1;
+			const int32 animPos = stream.readByte() - 1;
 			const int8 strength = stream.readByte();
 
 			if (animPos == actor->animPosition) {
@@ -474,7 +474,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_SAMPLE: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int16 sampleIdx = stream.readSint16LE();
 
 			if (animPos == actor->animPosition) {
@@ -483,7 +483,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_SAMPLE_FREQ: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int16 sampleIdx = stream.readSint16LE();
 			int16 frequency = stream.readSint16LE();
 
@@ -494,7 +494,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_THROW_EXTRA_BONUS: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 yHeight = stream.readSint16LE();
 			const int32 sprite = stream.readByte();
 			const int32 cx = stream.readSint16LE();
@@ -509,7 +509,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_THROW_MAGIC_BALL: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 var_8 = stream.readSint16LE();
 			const int32 dx = stream.readSint16LE();
 			const int32 var_24 = stream.readSint16LE();
@@ -521,7 +521,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_SAMPLE_REPEAT: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int16 sampleIdx = stream.readSint16LE();
 			const int16 repeat = stream.readSint16LE();
 
@@ -531,39 +531,39 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_UNKNOWN_6: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			if (animPos == actor->animPosition) {
-				//The folowing fetches 7 bytes, but the else block skips only 6 bytes.
+				// TODO: The folowing fetches 7 bytes, but the else block skips only 6 bytes.
 				// Please check if that's correct.
 				const int32 var_8 = stream.readSint16LE();
-				const int32 var_C = stream.readByte();
-				const int32 dx = stream.readByte();
-				const int32 var_24 = stream.readSint16LE();
-				const int32 temp = stream.readByte();
+				const int32 spriteIdx = stream.readByte();
+				const int32 targetActorIdx = stream.readByte();
+				const int32 maxSpeed = stream.readSint16LE();
+				const int32 strengthOfHit = stream.readByte();
 
-				_engine->_extra->addExtraAiming(actorIdx, actor->x, actor->y + var_8, actor->z, var_C, dx, var_24, temp);
+				_engine->_extra->addExtraAiming(actorIdx, actor->x, actor->y + var_8, actor->z, spriteIdx, targetActorIdx, maxSpeed, strengthOfHit);
 			} else {
 				stream.skip(6);
 			}
 			break;
 		}
 		case ACTION_UNKNOWN_7: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 yHeight = stream.readSint16LE();
-			const int32 var_C = stream.readByte();
+			const int32 spriteIdx = stream.readByte();
 			const int32 dx = stream.readSint16LE();
-			const int32 cx = actor->angle + stream.readSint16LE();
+			const int32 angle = actor->angle + stream.readSint16LE();
 			const int32 var_24 = stream.readSint16LE();
 			const int32 var_14 = stream.readByte();
-			const int32 var = stream.readByte();
+			const int32 strengthOfHit = stream.readByte();
 
 			if (animPos == actor->animPosition) {
-				_engine->_extra->addExtraThrow(actorIdx, actor->x, actor->y + yHeight, actor->z, var_C, dx, cx, var_24, var_14, var);
+				_engine->_extra->addExtraThrow(actorIdx, actor->x, actor->y + yHeight, actor->z, spriteIdx, dx, angle, var_24, var_14, strengthOfHit);
 			}
 			break;
 		}
 		case ACTION_SAMPLE_STOP: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 sampleIdx = stream.readByte(); //why is it reading a byte but saving it in a 32bit variable?
 			stream.skip(1);               //what is the meaning of this extra byte?
 
@@ -573,7 +573,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_SAMPLE_BRICK_1: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			if (animPos == actor->animPosition && (actor->brickSound & 0x0F0) != 0x0F0) {
 				const int16 sampleIdx = (actor->brickSound & 0x0F) + Samples::WalkFloorBegin;
 				_engine->_sound->playSample(sampleIdx, _engine->getRandomNumber(1000) + 3596, 1, actor->x, actor->y, actor->z, actorIdx);
@@ -581,7 +581,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_SAMPLE_BRICK_2: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			if (animPos == actor->animPosition && (actor->brickSound & 0x0F0) != 0x0F0) {
 				const int16 sampleIdx = (actor->brickSound & 0x0F) + Samples::WalkFloorBegin;
 				_engine->_sound->playSample(sampleIdx, _engine->getRandomNumber(1000) + 3596, 1, actor->x, actor->y, actor->z, actorIdx);
@@ -589,7 +589,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_HERO_HITTING: {
-			int32 animPos = stream.readByte() - 1;
+			const int32 animPos = stream.readByte() - 1;
 			if (animPos == actor->animPosition) {
 				actor->strengthOfHit = magicLevelStrengthOfHit[_engine->_gameState->magicLevelIdx];
 				actor->dynamicFlags.bIsHitting = 1;
@@ -597,13 +597,13 @@ void Animations::processAnimActions(int32 actorIdx) {
 			break;
 		}
 		case ACTION_UNKNOWN_13: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 distanceX = stream.readSint16LE();
 			const int32 distanceY = stream.readSint16LE();
 			const int32 distanceZ = stream.readSint16LE();
 			const int32 spriteIdx = stream.readByte();
 			const int32 param1 = stream.readSint16LE();
-			const int32 param2 = stream.readSint16LE();
+			const int32 angle = stream.readSint16LE();
 			const int32 param3 = stream.readSint16LE();
 			const int32 param4 = stream.readByte();
 			const int32 strength = stream.readByte();
@@ -616,18 +616,18 @@ void Animations::processAnimActions(int32 actorIdx) {
 				const int32 throwZ = _engine->_renderer->destZ + actor->z;
 
 				_engine->_extra->addExtraThrow(actorIdx, throwX, throwY, throwZ, spriteIdx,
-				                               param1, param2 + actor->angle, param3, param4, strength);
+				                               param1, angle + actor->angle, param3, param4, strength);
 			}
 			break;
 		}
 		case ACTION_UNKNOWN_14: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 distanceX = stream.readSint16LE();
 			const int32 distanceY = stream.readSint16LE();
 			const int32 distanceZ = stream.readSint16LE();
 			const int32 spriteIdx = stream.readByte();
 			const int32 param1 = stream.readSint16LE();
-			const int32 param2 = stream.readSint16LE();
+			const int32 angle = stream.readSint16LE();
 			const int32 param3 = stream.readSint16LE();
 			const int32 param4 = stream.readByte();
 			const int32 strength = stream.readByte();
@@ -642,24 +642,24 @@ void Animations::processAnimActions(int32 actorIdx) {
 				const int32 throwZ = _engine->_renderer->destZ + actor->z;
 
 				_engine->_extra->addExtraThrow(actorIdx, throwX, throwY, throwZ, spriteIdx,
-				                               param1 + newAngle, param2 + actor->angle, param3, param4, strength);
+				                               param1 + newAngle, angle + actor->angle, param3, param4, strength);
 			}
 			break;
 		}
 		case ACTION_UNKNOWN_15: {
-			int32 animPos = stream.readByte();
+			const int32 animPos = stream.readByte();
 			const int32 distanceX = stream.readSint16LE();
 			const int32 distanceY = stream.readSint16LE();
 			const int32 distanceZ = stream.readSint16LE();
 			const int32 spriteIdx = stream.readByte();
 			const int32 targetActor = stream.readByte();
-			const int32 param3 = stream.readSint16LE();
-			const int32 param4 = stream.readByte();
+			const int32 maxSpeed = stream.readSint16LE();
+			const int32 strengthOfHit = stream.readByte();
 
 			if (animPos == actor->animPosition) {
 				_engine->_movements->rotateActor(distanceX, distanceZ, actor->angle);
 				_engine->_extra->addExtraAiming(actorIdx, actor->x + _engine->_renderer->destX, actor->y + distanceY, actor->z + distanceZ, spriteIdx,
-				                                targetActor, param3, param4);
+				                                targetActor, maxSpeed, strengthOfHit);
 			}
 			break;
 		}


Commit: 6411e5d07eeacb66d585e884587460036b0068ba
    https://github.com/scummvm/scummvm/commit/6411e5d07eeacb66d585e884587460036b0068ba
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-19T22:58:24+01:00

Commit Message:
TWINE: fixed warning

Changed paths:
    engines/twine/animations.cpp


diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index 3a72674ae6..07807f9d17 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -465,7 +465,7 @@ void Animations::processAnimActions(int32 actorIdx) {
 		switch (actionType) {
 		case ACTION_HITTING: {
 			const int32 animPos = stream.readByte() - 1;
-			const int8 strength = stream.readByte();
+			const int32 strength = stream.readByte();
 
 			if (animPos == actor->animPosition) {
 				actor->strengthOfHit = strength;


Commit: 3e8247a6b75a6b3ddca4fd3cd5da771b571b8c86
    https://github.com/scummvm/scummvm/commit/3e8247a6b75a6b3ddca4fd3cd5da771b571b8c86
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-19T23:12:06+01:00

Commit Message:
TWINE: use IS_HERO macro

Changed paths:
    engines/twine/script_life_v1.cpp


diff --git a/engines/twine/script_life_v1.cpp b/engines/twine/script_life_v1.cpp
index e4d922bf7f..c315673fc4 100644
--- a/engines/twine/script_life_v1.cpp
+++ b/engines/twine/script_life_v1.cpp
@@ -228,7 +228,7 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
 				engine->_movements->targetActorDistance = MAX_TARGET_ACTOR_DISTANCE;
 			}
 
-			if (!targetActorIdx) {
+			if (IS_HERO(targetActorIdx)) {
 				int32 heroAngle = ctx.actor->angle + 0x480 - newAngle + 0x400;
 				heroAngle &= 0x3FF;
 




More information about the Scummvm-git-logs mailing list