diff options
Diffstat (limited to 'engines/cryo')
-rw-r--r-- | engines/cryo/eden.cpp | 1 | ||||
-rw-r--r-- | engines/cryo/video.cpp | 47 | ||||
-rw-r--r-- | engines/cryo/video.h | 52 |
3 files changed, 44 insertions, 56 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index a2af07414f..c76029d824 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -6436,7 +6436,6 @@ void EdenGame::playHNM(int16 num) { _videoCanceledFlag = false; shnmfl(num); _vm->_video->reset(); - _vm->_video->flushPreloadBuffer(); if (_needToFade) { fadeToBlack(4); clearScreen(); diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp index 1647c9d1d2..c2b35829e9 100644 --- a/engines/cryo/video.cpp +++ b/engines/cryo/video.cpp @@ -52,13 +52,11 @@ HnmPlayer::HnmPlayer(CryoEngine *vm) : _vm(vm) { // Original name: CLHNM_New void HnmPlayer::resetInternals() { _frameNum = 0; - _unused04 = 0; _file = nullptr; - tmpBuffer[0] = nullptr; - tmpBuffer[1] = nullptr; + _tmpBuffer[0] = nullptr; + _tmpBuffer[1] = nullptr; _finalBuffer = nullptr; _readBuffer = nullptr; - _unused896 = 0; _totalRead = 0; for (int i = 0; i < 256; i++) { _palette[i].a = 0; @@ -87,7 +85,6 @@ void HnmPlayer::resetInternalTimer() { // Original name: CLHNM_Reset void HnmPlayer::reset() { _frameNum = 0; - _unused04 = 0; _totalRead = 0; _soundStarted = false; _pendingSounds = 0; @@ -213,36 +210,36 @@ int16 HnmPlayer::getVersion() { // Original name: CLHNM_AllocMemory void HnmPlayer::allocMemory() { // TODO: rework this code - tmpBuffer[0] = (byte *)malloc(_header._bufferSize + 2); + _tmpBuffer[0] = (byte *)malloc(_header._bufferSize + 2); - if (!tmpBuffer[0]) + if (!_tmpBuffer[0]) return; - tmpBuffer[1] = (byte *)malloc(_header._bufferSize + 2); + _tmpBuffer[1] = (byte *)malloc(_header._bufferSize + 2); - if (!tmpBuffer[1]) { - free(tmpBuffer[0]); - tmpBuffer[0] = nullptr; + if (!_tmpBuffer[1]) { + free(_tmpBuffer[0]); + _tmpBuffer[0] = nullptr; return; } _readBuffer = (byte *)malloc(_header._bufferSize + 2); if (!_readBuffer) { - free(tmpBuffer[0]); - tmpBuffer[0] = nullptr; - free(tmpBuffer[1]); - tmpBuffer[1] = nullptr; + free(_tmpBuffer[0]); + _tmpBuffer[0] = nullptr; + free(_tmpBuffer[1]); + _tmpBuffer[1] = nullptr; } } // Original name: CLHNM_DeallocMemory void HnmPlayer::deallocMemory() { - free(tmpBuffer[0]); - free(tmpBuffer[1]); + free(_tmpBuffer[0]); + free(_tmpBuffer[1]); free(_readBuffer); - tmpBuffer[0] = nullptr; - tmpBuffer[1] = nullptr; + _tmpBuffer[0] = nullptr; + _tmpBuffer[1] = nullptr; _readBuffer = nullptr; } @@ -581,10 +578,6 @@ SoundChannel *HnmPlayer::getSoundChannel() { return _soundChannel; } -// Original name: CLHNM_FlushPreloadBuffer -void HnmPlayer::flushPreloadBuffer() { -} - // Original name: CLHNM_ChangePalette void HnmPlayer::changePalette() { CLPalette_GetLastPalette(_palette); @@ -648,11 +641,11 @@ void HnmPlayer::changePalette() { // Original name: CLHNM_SelectBuffers void HnmPlayer::selectBuffers() { if (_frameNum % 2) { - _newFrameBuffer = tmpBuffer[1]; - _oldFrameBuffer = tmpBuffer[0]; + _newFrameBuffer = _tmpBuffer[1]; + _oldFrameBuffer = _tmpBuffer[0]; } else { - _newFrameBuffer = tmpBuffer[0]; - _oldFrameBuffer = tmpBuffer[1]; + _newFrameBuffer = _tmpBuffer[0]; + _oldFrameBuffer = _tmpBuffer[1]; } } diff --git a/engines/cryo/video.h b/engines/cryo/video.h index fa853e6d36..2c55baa5d9 100644 --- a/engines/cryo/video.h +++ b/engines/cryo/video.h @@ -29,21 +29,8 @@ class CryoEngine; class HnmPlayer { public: - int _frameNum; - int _unused04; Common::File *_file; HNMHeader _header; - byte *tmpBuffer[2]; - byte *_finalBuffer; - byte *_newFrameBuffer; - byte *_oldFrameBuffer; - byte *_readBuffer; - byte *_dataPtr; - color_t _palette[256]; - bool _canLoop; - int16 _unused896; - int16 _chunkId; - int _totalRead; private: CryoEngine *_vm; @@ -60,6 +47,8 @@ private: void desentrelace320(byte *frame_buffer, byte *final_buffer, uint16 height); void desentrelace(); void decompUBA(byte *output, byte *curr_buffer, byte *prev_buffer, byte *input, int width, char flags); + void setupSoundADPCM(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode); + void init(); // Unused void done(); @@ -83,6 +72,17 @@ private: bool _preserveColor0; int16 decompTable[256]; bool _safePalette; + int _frameNum; + byte *_tmpBuffer[2]; + byte *_finalBuffer; + byte *_newFrameBuffer; + byte *_oldFrameBuffer; + byte *_readBuffer; + byte *_dataPtr; + color_t _palette[256]; + bool _canLoop; + int16 _chunkId; + int _totalRead; void (*_customChunkHandler)(byte *buffer, int size, int16 id, char h6, char h7); @@ -96,26 +96,22 @@ public: HnmPlayer(CryoEngine *vm); - void setupTimer(float rate); - void reset(); - void closeSound(); - void waitLoop(); - void flushPreloadBuffer(); - void setupSound(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode); - void setupSoundADPCM(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode); - bool nextElement(); - void init(); - void setForceZero2Black(bool forceblack); - void readHeader(); - int16 getVersion(); void allocMemory(); + void closeSound(); void deallocMemory(); - void setFinalBuffer(byte *buffer); int getFrameNum(); + SoundChannel *getSoundChannel(); + int16 getVersion(); + bool nextElement(); + void reset(); + void readHeader(); void resetInternals(); void setFile(Common::File *file); - - SoundChannel *getSoundChannel(); + void setFinalBuffer(byte *buffer); + void setForceZero2Black(bool forceblack); + void setupSound(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode); + void setupTimer(float rate); + void waitLoop(); }; } // End of namespace Cryo |