aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2016-11-27 22:07:37 -0800
committerEugene Sandulenko2017-01-25 22:42:08 +0100
commit2b4b3a3daf1db4f4c63745ba2129162c8d3e8ffa (patch)
treee752d1ce4d434a869d0fcb2279cdf43850526622 /engines
parent9410c8563bab7867e6e28c3871812e5d1e469f16 (diff)
downloadscummvm-rg350-2b4b3a3daf1db4f4c63745ba2129162c8d3e8ffa.tar.gz
scummvm-rg350-2b4b3a3daf1db4f4c63745ba2129162c8d3e8ffa.tar.bz2
scummvm-rg350-2b4b3a3daf1db4f4c63745ba2129162c8d3e8ffa.zip
CRYO: Move some more functions to HnmPlayer
Diffstat (limited to 'engines')
-rw-r--r--engines/cryo/clhnm.cpp27
-rw-r--r--engines/cryo/cryolib.h2
-rw-r--r--engines/cryo/eden.cpp4
-rw-r--r--engines/cryo/video.cpp30
-rw-r--r--engines/cryo/video.h2
5 files changed, 33 insertions, 32 deletions
diff --git a/engines/cryo/clhnm.cpp b/engines/cryo/clhnm.cpp
index 1e67001d30..e980341d5d 100644
--- a/engines/cryo/clhnm.cpp
+++ b/engines/cryo/clhnm.cpp
@@ -31,37 +31,10 @@ static bool use_mono = false;
void CLHNM_Done() {
}
-hnm_t *CLHNM_New(int preload_size) {
- hnm_t *hnm = (hnm_t *)malloc(sizeof(*hnm));
-
- hnm->_frameNum = 0;
- hnm->ff_4 = 0;
- hnm->_file = nullptr;
- hnm->tmpBuffer[0] = nullptr;
- hnm->tmpBuffer[1] = nullptr;
- hnm->finalBuffer = nullptr;
- hnm->_readBuffer = nullptr;
- hnm->ff_896 = 0;
- hnm->_totalRead = 0;
- for (int i = 0; i < 256; i++) {
- hnm->_palette[i].a = 0;
- hnm->_palette[i].r = 0;
- hnm->_palette[i].g = 0;
- hnm->_palette[i].b = 0;
- }
-
- return hnm;
-}
-
void CLHNM_Dispose(hnm_t *hnm) {
free(hnm);
}
-
-void CLHNM_SetFile(hnm_t *hnm, file_t *file) {
- hnm->_file = file;
-}
-
void CLHNM_GiveTime(hnm_t *hnm) {
}
diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h
index 4c2d81965f..d4ac7cbbc6 100644
--- a/engines/cryo/cryolib.h
+++ b/engines/cryo/cryolib.h
@@ -253,9 +253,7 @@ void CRYOLib_ManagersInit();
void CRYOLib_ManagersDone();
void CLHNM_Done();
-hnm_t *CLHNM_New(int preload_size);
void CLHNM_Dispose(hnm_t *hnm);
-void CLHNM_SetFile(hnm_t *hnm, file_t *file);
void CLHNM_CanLoop(hnm_t *hnm, bool canLoop);
void CLHNM_WantsSound(int16 sound);
void CLHNM_SoundMono(int16 is_mono);
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 1541562354..0b79260bb5 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -4653,8 +4653,8 @@ void EdenGame::openbigfile() {
h_bigfile.open("EDEN.DAT");
h_bigfile.read(bigfile_header, size);
- _hnmContext = CLHNM_New(128);
- CLHNM_SetFile(_hnmContext, &h_bigfile);
+ _hnmContext = _vm->_video->resetInternals(128);
+ _vm->_video->setFile(_hnmContext, &h_bigfile);
}
void EdenGame::closebigfile() {
diff --git a/engines/cryo/video.cpp b/engines/cryo/video.cpp
index 8e4f7835d2..1e769adae3 100644
--- a/engines/cryo/video.cpp
+++ b/engines/cryo/video.cpp
@@ -48,6 +48,34 @@ HnmPlayer::HnmPlayer(CryoEngine *vm) : _vm(vm) {
decomp_table[i] = 0;
}
+// Original name: CLHNM_New
+hnm_t *HnmPlayer::resetInternals(int preload_size) {
+ hnm_t *hnm = (hnm_t *)malloc(sizeof(*hnm));
+
+ hnm->_frameNum = 0;
+ hnm->ff_4 = 0;
+ hnm->_file = nullptr;
+ hnm->tmpBuffer[0] = nullptr;
+ hnm->tmpBuffer[1] = nullptr;
+ hnm->finalBuffer = nullptr;
+ hnm->_readBuffer = nullptr;
+ hnm->ff_896 = 0;
+ hnm->_totalRead = 0;
+ for (int i = 0; i < 256; i++) {
+ hnm->_palette[i].a = 0;
+ hnm->_palette[i].r = 0;
+ hnm->_palette[i].g = 0;
+ hnm->_palette[i].b = 0;
+ }
+
+ return hnm;
+}
+
+// Original name: CLHNM_SetFile
+void HnmPlayer::setFile(hnm_t *hnm, file_t *file) {
+ hnm->_file = file;
+}
+
// Original name: CLHNM_SetupTimer
void HnmPlayer::setupTimer(float rate) {
hnm_rate = 100.0 / rate;
@@ -406,7 +434,7 @@ void HnmPlayer::decompUBA(byte *output, byte *curr_buffer, byte *prev_buffer, by
assert(0);
//HNM4 hires
for (;;) {
- unsigned int code = PLE32(input) & 0xFFFFFF;
+ code = PLE32(input) & 0xFFFFFF;
input++;
count = code & 0x3F;
if (count) {
diff --git a/engines/cryo/video.h b/engines/cryo/video.h
index fdb0d2403c..61021c5208 100644
--- a/engines/cryo/video.h
+++ b/engines/cryo/video.h
@@ -88,6 +88,8 @@ public:
void deallocMemory(hnm_t *hnm);
void setFinalBuffer(hnm_t *hnm, byte *buffer);
int getFrameNum(hnm_t *hnm);
+ hnm_t *resetInternals(int preload_size); // TODO: Remove useless parameter
+ void setFile(hnm_t *hnm, file_t *file);
soundchannel_t *getSoundChannel();
};