[Scummvm-git-logs] scummvm master -> 79d8fe9d2647ad608b5a076eedee32bd230899fd
mgerhardy
martin.gerhardy at gmail.com
Thu Aug 12 19:53:00 UTC 2021
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
fdad24a901 TWINE: fixed typo
d0f95b0dca TWINE: const
21b288407d TWINE: simplified grid code
3d47d74933 TWINE: changed getBrickSoundType return value from int32 to uint8
79d8fe9d26 TWINE: fixed SpriteData cleanup
Commit: fdad24a90170084c04d7d708be462a8996d1c9c8
https://github.com/scummvm/scummvm/commit/fdad24a90170084c04d7d708be462a8996d1c9c8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-12T21:50:04+02:00
Commit Message:
TWINE: fixed typo
Changed paths:
engines/twine/parser/blocklibrary.h
diff --git a/engines/twine/parser/blocklibrary.h b/engines/twine/parser/blocklibrary.h
index ebbf933424..0e135ee6af 100644
--- a/engines/twine/parser/blocklibrary.h
+++ b/engines/twine/parser/blocklibrary.h
@@ -34,7 +34,7 @@ struct BlockDataEntry {
uint8 brickShape;
uint8 brickType;
/**
- * Index is not starting a 0 - but at 1.
+ * Index is not starting at 0 - but at 1. A 0 indicates an empty brick
*/
uint16 brickIdx;
uint8 sound;
Commit: d0f95b0dca46baf711e906dfa090efb6217aea1e
https://github.com/scummvm/scummvm/commit/d0f95b0dca46baf711e906dfa090efb6217aea1e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-12T21:50:04+02:00
Commit Message:
TWINE: const
Changed paths:
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 86751e2ae4..e2465556bc 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -704,12 +704,12 @@ ShapeType Grid::getBrickShape(int32 x, int32 y, int32 z) {
return ShapeType::kNone;
}
- uint8 *blockBufferPtr = _blockBuffer;
+ const uint8 *blockBufferPtr = _blockBuffer;
blockBufferPtr += collision.x * GRID_SIZE_Y * 2;
blockBufferPtr += collision.y * 2;
blockBufferPtr += (collision.z * GRID_SIZE_X * 2) * GRID_SIZE_Y;
- uint8 blockIdx = *blockBufferPtr;
+ const uint8 blockIdx = *blockBufferPtr;
if (blockIdx) {
const uint8 tmpBrickIdx = *(blockBufferPtr + 1);
Commit: 21b288407d72113eb500c8ad70c3e7185f8864cc
https://github.com/scummvm/scummvm/commit/21b288407d72113eb500c8ad70c3e7185f8864cc
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-12T21:50:04+02:00
Commit Message:
TWINE: simplified grid code
Changed paths:
engines/twine/scene/grid.cpp
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index e2465556bc..97fef2a2eb 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -391,10 +391,9 @@ void Grid::createCellingGridColumn(const uint8 *gridEntry, uint32 gridEntrySize,
}
void Grid::createGridMap() {
- int32 currOffset = 0;
+ int32 blockOffset = 0;
for (int32 z = 0; z < GRID_SIZE_Z; z++) {
- int32 blockOffset = currOffset;
const int32 gridIdx = z * GRID_SIZE_X;
for (int32 x = 0; x < GRID_SIZE_X; x++) {
@@ -402,16 +401,14 @@ void Grid::createGridMap() {
createGridColumn(_currentGrid + gridOffset, _currentGridSize - gridOffset, _blockBuffer + blockOffset, _blockBufferSize - blockOffset);
blockOffset += 2 * GRID_SIZE_Y;
}
- currOffset += GRID_SIZE_X * (2 * GRID_SIZE_Y);
}
}
void Grid::createCellingGridMap(const uint8 *gridPtr, int32 gridPtrSize) {
int32 currGridOffset = 0;
- int32 currOffset = 0;
+ int32 blockOffset = 0;
for (int32 z = 0; z < GRID_SIZE_Z; z++) {
- int32 blockOffset = currOffset;
const uint8 *tempGridPtr = gridPtr + currGridOffset;
for (int32 x = 0; x < GRID_SIZE_X; x++) {
@@ -420,8 +417,7 @@ void Grid::createCellingGridMap(const uint8 *gridPtr, int32 gridPtrSize) {
createCellingGridColumn(gridPtr + gridOffset, gridPtrSize - gridOffset, _blockBuffer + blockOffset, _blockBufferSize - blockOffset);
blockOffset += 2 * GRID_SIZE_Y;
}
- currGridOffset += GRID_SIZE_X+ GRID_SIZE_Z;
- currOffset += GRID_SIZE_X * (2 * GRID_SIZE_Y);
+ currGridOffset += GRID_SIZE_X + GRID_SIZE_Z;
}
}
Commit: 3d47d7493310d1cd813c58e4eeb7b6a008d7a032
https://github.com/scummvm/scummvm/commit/3d47d7493310d1cd813c58e4eeb7b6a008d7a032
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-12T21:50:04+02:00
Commit Message:
TWINE: changed getBrickSoundType return value from int32 to uint8
this is parsed from the bll - no need to increase the size
Changed paths:
engines/twine/scene/actor.h
engines/twine/scene/animations.cpp
engines/twine/scene/grid.cpp
engines/twine/scene/grid.h
engines/twine/twine.cpp
diff --git a/engines/twine/scene/actor.h b/engines/twine/scene/actor.h
index af24f7694c..6bc3167c15 100644
--- a/engines/twine/scene/actor.h
+++ b/engines/twine/scene/actor.h
@@ -241,7 +241,7 @@ public:
int32 _animPosition = 0;
AnimType _animType = AnimType::kAnimationTypeLoop;
int32 _spriteActorRotation = 0;
- int32 _brickSound = 0;
+ uint8 _brickSound = 0U;
BoundingBox _boudingBox;
ActorMoveStruct _move;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 26c230c752..b5e5e35f4c 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -321,8 +321,8 @@ void Animations::processAnimActions(int32 actorIdx) {
break;
case ActionType::ACTION_LEFT_STEP:
case ActionType::ACTION_RIGHT_STEP:
- if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0x0F0) != 0x0F0) {
- const int16 sampleIdx = (actor->_brickSound & 0x0F) + Samples::WalkFloorBegin;
+ if (action.animFrame == actor->_animPosition && (actor->_brickSound & 0xF0U) != 0xF0U) {
+ const int16 sampleIdx = (actor->_brickSound & 0x0FU) + Samples::WalkFloorBegin;
_engine->_sound->playSample(sampleIdx, 1, actor->pos(), actorIdx);
}
break;
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 97fef2a2eb..77684bf332 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -788,7 +788,7 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
return ShapeType::kNone;
}
-int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
+uint8 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
const IVec3 &collision = updateCollisionCoordinates(x, y, z);
if (collision.x < 0 || collision.x >= GRID_SIZE_X) {
@@ -816,7 +816,7 @@ int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
return blockPtr->brickType;
}
- return 0xF0;
+ return 0xF0U;
}
void Grid::centerOnActor(const ActorStruct* actor) {
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index 3b8fb009b3..1250c767b8 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -289,7 +289,7 @@ public:
ShapeType getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2);
- int32 getBrickSoundType(int32 x, int32 y, int32 z);
+ uint8 getBrickSoundType(int32 x, int32 y, int32 z);
inline ShapeType getBrickShape(const IVec3 &pos) {
return getBrickShape(pos.x, pos.y, pos.z);
@@ -299,7 +299,7 @@ public:
return getBrickShapeFull(pos.x, pos.y, pos.z, y2);
}
- inline int32 getBrickSoundType(const IVec3 &pos) {
+ inline uint8 getBrickSoundType(const IVec3 &pos) {
return getBrickSoundType(pos.x, pos.y, pos.z);
}
};
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 138e3e443e..ed5bba3033 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -903,11 +903,11 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
}
if (actor->_staticFlags.bCanDrown) {
- int32 brickSound = _grid->getBrickSoundType(actor->_pos.x, actor->_pos.y - 1, actor->_pos.z);
+ const uint8 brickSound = _grid->getBrickSoundType(actor->_pos.x, actor->_pos.y - 1, actor->_pos.z);
actor->_brickSound = brickSound;
- if ((brickSound & 0xF0) == 0xF0) {
- if ((brickSound & 0x0F) == 1) {
+ if ((brickSound & 0xF0U) == 0xF0U) {
+ if ((brickSound & 0x0FU) == 1) {
if (IS_HERO(a)) {
if (_actor->_heroBehaviour != HeroBehaviourType::kProtoPack || actor->_anim != AnimationTypes::kForward) {
if (!_actor->_cropBottomScreen) {
Commit: 79d8fe9d2647ad608b5a076eedee32bd230899fd
https://github.com/scummvm/scummvm/commit/79d8fe9d2647ad608b5a076eedee32bd230899fd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-12T21:50:04+02:00
Commit Message:
TWINE: fixed SpriteData cleanup
Changed paths:
engines/twine/parser/parser.h
engines/twine/parser/sprite.cpp
engines/twine/parser/sprite.h
diff --git a/engines/twine/parser/parser.h b/engines/twine/parser/parser.h
index 2f8b5cc23c..a679a1b29f 100644
--- a/engines/twine/parser/parser.h
+++ b/engines/twine/parser/parser.h
@@ -1,4 +1,4 @@
- /* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
diff --git a/engines/twine/parser/sprite.cpp b/engines/twine/parser/sprite.cpp
index 29a1986b0c..64e78c0eff 100644
--- a/engines/twine/parser/sprite.cpp
+++ b/engines/twine/parser/sprite.cpp
@@ -46,7 +46,19 @@ bool SpriteBoundingBoxData::loadFromStream(Common::SeekableReadStream &stream, b
return !stream.err();
}
+SpriteData::~SpriteData() {
+ clear();
+}
+
+void SpriteData::clear() {
+ for (int i = 0; i < _sprites; ++i) {
+ _surfaces[i].free();
+ }
+ _sprites = 0;
+}
+
bool SpriteData::loadFromStream(Common::SeekableReadStream &stream, bool lba1) {
+ clear();
if (_bricks) {
// brick sprites don't have the offsets
return loadSprite(stream, 0);
diff --git a/engines/twine/parser/sprite.h b/engines/twine/parser/sprite.h
index e367337da6..853cd75025 100644
--- a/engines/twine/parser/sprite.h
+++ b/engines/twine/parser/sprite.h
@@ -74,8 +74,10 @@ protected:
bool _bricks = false;
bool loadSprite(Common::SeekableReadStream &stream, uint32 offset);
-
+ void clear();
public:
+ ~SpriteData();
+
bool loadFromStream(Common::SeekableReadStream &stream, bool lba1) override;
inline const Graphics::ManagedSurface &surface(int index = 0) const {
More information about the Scummvm-git-logs
mailing list