aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gnap/gamesys.cpp24
-rw-r--r--engines/gnap/gamesys.h2
-rw-r--r--engines/gnap/gnap.cpp4
-rw-r--r--engines/gnap/resource.cpp26
-rw-r--r--engines/gnap/resource.h22
5 files changed, 39 insertions, 39 deletions
diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp
index d18d102060..cced8f3a21 100644
--- a/engines/gnap/gamesys.cpp
+++ b/engines/gnap/gamesys.cpp
@@ -70,15 +70,15 @@ GameSys::GameSys(GnapEngine *vm)
GameSys::~GameSys() {
}
-void GameSys::insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y) {
- debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, a2, sequenceId2, a4, x, y);
+void GameSys::insertSequence(int sequenceId, int id, int sequenceId2, int id2, int flags, int totalDuration, int16 x, int16 y) {
+ debug(0, "GameSys::insertSequence() [%08X, %d] -> [%08X, %d] (%d, %d)", sequenceId, id, sequenceId2, id2, x, y);
Sequence sequence;
SequenceResource *sequenceResource = _vm->_sequenceCache->get(sequenceId);
sequenceResource->_sequenceId = sequenceId;
sequence._sequenceId = sequenceId;
- sequence._id = a2 != -1 ? a2 : sequenceResource->_field_8;
+ sequence._id = id != -1 ? id : sequenceResource->_defaultId;
sequence._sequenceId2 = sequenceId2 != (int32)0x80000000 ? sequenceId2 : sequenceResource->_sequenceId2;
- sequence._id2 = a4 != -1 ? a4 : sequenceResource->_field_10;
+ sequence._id2 = id2 != -1 ? id2 : sequenceResource->_defaultId2;
sequence._flags = flags != -1 ? flags : sequenceResource->_flags;
sequence._totalDuration = totalDuration != -1 ? totalDuration : sequenceResource->_totalDuration;
sequence._x = (x < 10000 && x > -10000) ? x : sequenceResource->_xOffs;
@@ -454,7 +454,7 @@ void GameSys::seqInsertGfx(int index, int duration) {
gfxItem->_animation = animation;
gfxItem->_currFrameNum = 0;
gfxItem->_flags = 0;
- gfxItem->_delayTicks = seqItem->_totalDuration + animation->field_4;
+ gfxItem->_delayTicks = seqItem->_totalDuration + animation->_additionalDelay;
gfxItem->_updFlag = false;
gfxItem->_updRectsCount = 0;
gfxItem->_prevFrame._duration = 0;
@@ -473,12 +473,12 @@ void GameSys::seqInsertGfx(int index, int duration) {
int j;
totalDuration -= gfxItem->_delayTicks;
gfxItem->_delayTicks = 0;
- for (j = gfxItem->_currFrameNum; j < animation->framesCount && animation->frames[j]._duration <= totalDuration; ++j) {
+ for (j = gfxItem->_currFrameNum; j < animation->_framesCount && animation->frames[j]._duration <= totalDuration; ++j) {
if (animation->frames[j]._soundId != -1)
_soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[j]._soundId);
totalDuration -= animation->frames[j]._duration;
}
- if (animation->framesCount > j)
+ if (animation->_framesCount > j)
gfxItem->_currFrame = animation->frames[j++];
else
gfxItem->_currFrame = animation->frames[j - 1];
@@ -546,7 +546,7 @@ bool GameSys::updateSequenceDuration(int sequenceId, int id, int *outDuration) {
found = true;
SequenceAnimation *animation = gfxItem->_animation;
if (animation) {
- if (gfxItem->_currFrameNum < animation->framesCount)
+ if (gfxItem->_currFrameNum < animation->_framesCount)
return false;
if (gfxItem->_updFlag) {
if (gfxItem->_currFrame._duration > 0)
@@ -587,7 +587,7 @@ void GameSys::updateAnimationsStatus(int sequenceId, int id) {
SequenceAnimation *animation = gfxItem->_animation;
if (gfxItem->_sequenceId == sequenceId && gfxItem->_id == id && animation) {
foundSequence = true;
- if (animation->framesCount > gfxItem->_currFrameNum ||
+ if (animation->_framesCount > gfxItem->_currFrameNum ||
(gfxItem->_updFlag && gfxItem->_currFrame._duration > 1) ||
gfxItem->_prevFrame._duration > 1)
foundSequence = false;
@@ -1077,16 +1077,16 @@ void GameSys::fatUpdateFrame() {
v20 = true;
}
currFrameNum = gfxItem->_currFrameNum;
- if (animation->framesCount > currFrameNum) {
+ if (animation->_framesCount > currFrameNum) {
updFlag = false;
- while (animation->framesCount > currFrameNum &&
+ while (animation->_framesCount > currFrameNum &&
animation->frames[currFrameNum]._duration <= duration) {
if (animation->frames[currFrameNum]._soundId != -1)
_soundIds.push_back((gfxItem->_sequenceId & 0xFFFF0000) | animation->frames[currFrameNum]._soundId);
duration -= animation->frames[currFrameNum]._duration;
++currFrameNum;
}
- if (animation->framesCount > currFrameNum)
+ if (animation->_framesCount > currFrameNum)
gfxItem->_currFrame = animation->frames[currFrameNum++];
else
gfxItem->_currFrame = animation->frames[currFrameNum - 1];
diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h
index 043dec3c32..fc137eb65c 100644
--- a/engines/gnap/gamesys.h
+++ b/engines/gnap/gamesys.h
@@ -101,7 +101,7 @@ class GameSys {
public:
GameSys(GnapEngine *vm);
~GameSys();
- void insertSequence(int sequenceId, int a2, int sequenceId2, int a4, int flags, int totalDuration, int16 x, int16 y);
+ void insertSequence(int sequenceId, int id, int sequenceId2, int id2, int flags, int totalDuration, int16 x, int16 y);
void insertDirtyRect(const Common::Rect &rect);
void removeSequence(int sequenceId, int id, bool resetFl);
void invalidateGrabCursorSprite(int id, Common::Rect &rect, Graphics::Surface *surface1, Graphics::Surface *surface2);
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index ce81f368b8..2edfcacabc 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -642,8 +642,8 @@ int GnapEngine::getSequenceTotalDuration(int resourceId) {
int maxValue = 0;
for (int i = 0; i < sequenceResource->_animationsCount; ++i) {
SequenceAnimation *animation = &sequenceResource->_animations[i];
- if (animation->field_4 + animation->field_A > maxValue)
- maxValue = animation->field_4 + animation->field_A;
+ if (animation->_additionalDelay + animation->_maxTotalDuration > maxValue)
+ maxValue = animation->_additionalDelay + animation->_maxTotalDuration;
}
int totalDuration = maxValue + sequenceResource->_totalDuration;
_sequenceCache->release(resourceId);
diff --git a/engines/gnap/resource.cpp b/engines/gnap/resource.cpp
index e1d991afa5..17fe8f918a 100644
--- a/engines/gnap/resource.cpp
+++ b/engines/gnap/resource.cpp
@@ -43,14 +43,14 @@ void SequenceFrame::loadFromStream(Common::MemoryReadStream &stream) {
// SequenceAnimation
void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) {
- field_0 = stream.readUint16LE();
- field_2 = stream.readUint16LE();
- field_4 = stream.readUint32LE();
- framesCount = stream.readUint16LE();
- field_A = stream.readUint16LE();
- debug(1, "SequenceAnimation() framesCount: %d", framesCount);
- frames = new SequenceFrame[framesCount];
- for (int i = 0; i < framesCount; ++i)
+ _unusedVal1 = stream.readUint16LE();
+ _unusedVal2 = stream.readUint16LE();
+ _additionalDelay = stream.readUint32LE();
+ _framesCount = stream.readUint16LE();
+ _maxTotalDuration = stream.readUint16LE();
+ debug(1, "SequenceAnimation() framesCount: %d", _framesCount);
+ frames = new SequenceFrame[_framesCount];
+ for (int i = 0; i < _framesCount; ++i)
frames[i].loadFromStream(stream);
}
@@ -58,11 +58,11 @@ void SequenceAnimation::loadFromStream(Common::MemoryReadStream &stream) {
SequenceResource::SequenceResource(int resourceId, byte *data, uint32 size) {
Common::MemoryReadStream stream(data, size, DisposeAfterUse::NO);
- _field_0 = stream.readUint32LE();
+ _unusedVal1 = stream.readUint32LE();
_sequenceId = stream.readUint32LE();
- _field_8 = stream.readUint32LE();
+ _defaultId = stream.readUint32LE();
_sequenceId2 = stream.readUint32LE();
- _field_10 = stream.readUint32LE();
+ _defaultId2 = stream.readUint32LE();
_flags = stream.readUint32LE();
_totalDuration = stream.readUint32LE();
_xOffs = stream.readUint16LE();
@@ -91,8 +91,8 @@ SpriteResource::SpriteResource(int resourceId, byte *data, uint32 size) {
_data = data;
_width = READ_LE_UINT16(_data);
_height = READ_LE_UINT16(_data + 2);
- _unk1 = READ_LE_UINT16(_data + 4);
- _unk2 = READ_LE_UINT16(_data + 6);
+ _unknownVal1 = READ_LE_UINT16(_data + 4);
+ _unknownVal2 = READ_LE_UINT16(_data + 6);
_transparent = READ_LE_UINT16(_data + 8);
_colorsCount = READ_LE_UINT16(_data + 10);
_palette = (uint32*)(_data + 12);
diff --git a/engines/gnap/resource.h b/engines/gnap/resource.h
index 8e0c591614..2ae933f3f7 100644
--- a/engines/gnap/resource.h
+++ b/engines/gnap/resource.h
@@ -56,13 +56,13 @@ struct SequenceFrame {
};
struct SequenceAnimation {
- int16 field_0;
- int16 field_2;
- int32 field_4;
- int16 framesCount;
- int16 field_A;
+ int16 _unusedVal1;
+ int16 _unusedVal2;
+ int32 _additionalDelay;
+ int16 _framesCount;
+ int16 _maxTotalDuration;
SequenceFrame *frames;
- SequenceAnimation() : frames(0) {}
+ SequenceAnimation() : frames(nullptr) {}
~SequenceAnimation() { delete[] frames; }
void loadFromStream(Common::MemoryReadStream &stream);
};
@@ -72,11 +72,11 @@ public:
SequenceResource(int resourceId, byte *data, uint32 size);
~SequenceResource();
public:
- uint32 _field_0;
+ uint32 _unusedVal1;
int32 _sequenceId;
- int32 _field_8;
+ int32 _defaultId;
int32 _sequenceId2;
- uint32 _field_10;
+ uint32 _defaultId2;
uint32 _flags;
int32 _totalDuration;
int16 _xOffs;
@@ -94,8 +94,8 @@ public:
byte *_pixels;
uint32 *_palette;
int16 _width, _height;
- uint16 _unk1;
- uint16 _unk2;
+ uint16 _unknownVal1;
+ uint16 _unknownVal2;
uint16 _transparent;
uint16 _colorsCount;
};