diff options
-rw-r--r-- | engines/cryo/clhnm.cpp | 49 | ||||
-rw-r--r-- | engines/cryo/cryolib.h | 2 | ||||
-rw-r--r-- | engines/cryo/eden.cpp | 2 | ||||
-rw-r--r-- | engines/cryo/staticdata.cpp | 78 |
4 files changed, 63 insertions, 68 deletions
diff --git a/engines/cryo/clhnm.cpp b/engines/cryo/clhnm.cpp index c36955c2ea..b1ab6a8790 100644 --- a/engines/cryo/clhnm.cpp +++ b/engines/cryo/clhnm.cpp @@ -26,19 +26,19 @@ namespace Cryo { -static int16 safe_palette = 0; +static bool safe_palette = false; static int16 pred_r = 0, pred_l = 0; -static int16 use_adpcm = 0; +static bool use_adpcm = false; static float hnm_rate = 0.0; static float next_frame_time = 0.0; static float expected_frame_time = 0.0; static float time_drift = 0.0; -static int16 use_mono = 0; -static int16 use_sound = 0; -static int16 use_sound_sync = 0; +static bool use_mono = false; +static bool use_sound = false; +static bool use_sound_sync = false; static int16 pending_sounds = 0; -static int16 sound_started = 0; -static int16 preserve_color0 = 0; +static bool sound_started = false; +static bool preserve_color0 = false; static soundchannel_t *soundChannel_adpcm = 0; static soundgroup_t *soundGroup_adpcm = 0; static soundchannel_t *soundChannel = 0; @@ -193,7 +193,7 @@ void CLHNM_DecompUBA(byte *output, byte *curr_buffer, byte *prev_buffer, void CLHNM_Init() { use_preload = 0; custom_chunk_handler = 0; - preserve_color0 = 0; + preserve_color0 = false; CLNoError; } @@ -210,7 +210,7 @@ void CLHNM_WaitLoop(hnm_t *hnm) { expected_frame_time += hnm_rate; next_frame_time = expected_frame_time - time_drift; if (use_sound_sync && TimerTicks > 1000.0 + next_frame_time) - use_sound = 0; + use_sound = false; while (TimerTicks < next_frame_time) ; // waste time time_drift = TimerTicks - next_frame_time; } @@ -248,7 +248,7 @@ void CLHNM_CloseSound() { } } -void CLHNM_SetForceZero2Black(int16 forceblack) { +void CLHNM_SetForceZero2Black(bool forceblack) { preserve_color0 = forceblack; } @@ -262,10 +262,9 @@ hnm_t *CLHNM_New(int preload_size) { hnm = (hnm_t *)CLMemory_Alloc(sizeof(*hnm)); CLCheckError(); if (hnm) { - if (preload_size) { + if (preload_size) use_preload = 1; - } if (!__libError) { hnm->frame = 0; hnm->ff_4 = 0; @@ -293,7 +292,6 @@ void CLHNM_Dispose(hnm_t *hnm) { CLBeginCheck; if (use_preload) { - } CLMemory_Free(hnm); @@ -377,7 +375,6 @@ void CLHNM_Read(hnm_t *hnm, int size) { long _size = size; if (!use_preload) { CLFile_Read(*hnm->file, hnm->read_buffer, &_size); - } else { } } @@ -509,7 +506,7 @@ void CLHNM_Reset(hnm_t *hnm) { hnm->frame = 0; hnm->ff_4 = 0; hnm->total_read = 0; - sound_started = 0; + sound_started = false; pending_sounds = 0; CLHNM_ResetInternalTimer(); CLNoError; @@ -546,7 +543,7 @@ int16 CLHNM_LoadFrame(hnm_t *hnm) { return 1; } -void CLHNM_WantsSound(int16 sound) { +void CLHNM_WantsSound(bool sound) { use_sound = sound; } @@ -572,12 +569,12 @@ void CLHNM_DecompADPCM(byte *buffer, int16 *output, int size) { pred_r = r; } -void CLHNM_SoundInADPCM(int16 is_adpcm) { - use_adpcm = is_adpcm; +void CLHNM_SoundInADPCM(bool isAdpcm) { + use_adpcm = isAdpcm; } -void CLHNM_SoundMono(int16 is_mono) { - use_mono = is_mono; +void CLHNM_SoundMono(bool isMono) { + use_mono = isMono; } int16 CLHNM_NextElement(hnm_t *hnm) { @@ -632,14 +629,12 @@ int16 CLHNM_NextElement(hnm_t *hnm) { if (!sound_started) { for (i = 0; i < pending_sounds; i++) CLSoundGroup_PlayNextSample(soundGroup_adpcm, soundChannel); - sound_started = 1; - } - } else { - if (!sound_started) { - for (i = 0; i < pending_sounds; i++) - CLSoundGroup_PlayNextSample(soundGroup, soundChannel); - sound_started = 1; + sound_started = true; } + } else if (!sound_started) { + for (i = 0; i < pending_sounds; i++) + CLSoundGroup_PlayNextSample(soundGroup, soundChannel); + sound_started = true; } goto end_frame; case BE16('IU'): diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h index 7bc324c8b4..7a7ffe1909 100644 --- a/engines/cryo/cryolib.h +++ b/engines/cryo/cryolib.h @@ -327,7 +327,7 @@ void CLHNM_WaitLoop(hnm_t *hnm); void CLHNM_SetupSound(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode); void CLHNM_SetupSoundADPCM(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode); void CLHNM_CloseSound(); -void CLHNM_SetForceZero2Black(int16 forceblack); +void CLHNM_SetForceZero2Black(bool forceblack); hnm_t *CLHNM_New(int preload_size); void CLHNM_Dispose(hnm_t *hnm); void CLHNM_SetFile(hnm_t *hnm, file_t *file); diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 4a3f2d6dc3..c9e261f9d7 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -5456,7 +5456,7 @@ void EdenGame::run() { // CRYOLib_InstallEmergencyExit(EmergencyExit); CRYOLib_SetupEnvironment(); CLHNM_SetupSound(5, 0x2000, 8, 11025 * 65536.0 , 0); - CLHNM_SetForceZero2Black(1); + CLHNM_SetForceZero2Black(true); CLHNM_SetupTimer(12.5); voiceSound = CLSoundRaw_New(0, 11025 * 65536.0, 8, 0); hnmsound_ch = CLHNM_GetSoundChannel(); diff --git a/engines/cryo/staticdata.cpp b/engines/cryo/staticdata.cpp index 7b700d720e..00856ed6f0 100644 --- a/engines/cryo/staticdata.cpp +++ b/engines/cryo/staticdata.cpp @@ -112,7 +112,7 @@ goto_t gotos[] = { { 0, 7, 106, 2, 101 }, { 0, 10, 79, 3, 102 }, { 0, 12, 0, 3, 0 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 1, 3, 58, 2, 104 }, { 1, 4, 100, 4, 104 }, { 1, 5, 107, 6, 104 }, @@ -121,15 +121,15 @@ goto_t gotos[] = { { 1, 8, 169, 6, 104 }, { 1, 10, 111, 2, 104 }, { 1, 11, 164, 4, 104 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 1, 3, 161, 3, 102 }, { 1, 4, 163, 6, 102 }, { 1, 5, 157, 9, 102 }, { 1, 9, 160, 9, 102 }, { 1, 10, 79, 3, 102 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 1, 3, 0, 3, 153 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 3, 1, 154, 2, 103 }, { 3, 4, 100, 2, 103 }, { 3, 5, 107, 4, 103 }, @@ -138,14 +138,14 @@ goto_t gotos[] = { { 3, 8, 169, 6, 103 }, { 3, 10, 111, 4, 103 }, { 3, 11, 164, 6, 103 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 3, 1, 162, 3, 22 }, { 3, 4, 163, 6, 22 }, { 3, 5, 157, 9, 22 }, { 3, 9, 160, 9, 22 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 3, 1, 0, 3, 166 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 4, 1, 154, 4, 51 }, { 4, 3, 58, 2, 51 }, { 4, 5, 107, 2, 51 }, @@ -154,12 +154,12 @@ goto_t gotos[] = { { 4, 8, 169, 8, 51 }, { 4, 10, 111, 6, 51 }, { 4, 11, 164, 8, 51 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 4, 1, 162, 3, 109 }, { 4, 3, 161, 6, 109 }, { 4, 5, 157, 9, 109 }, { 4, 9, 160, 9, 109 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 5, 1, 154, 6, 33 }, { 5, 3, 58, 4, 33 }, { 5, 4, 100, 2, 33 }, @@ -168,17 +168,17 @@ goto_t gotos[] = { { 5, 8, 169, 8, 33 }, { 5, 10, 111, 8, 33 }, { 5, 11, 164, 8, 33 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 5, 1, 162, 3, 99 }, { 5, 3, 161, 6, 99 }, { 5, 4, 163, 9, 99 }, { 5, 9, 160, 9, 99 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 9, 1, 162, 3, 167 }, { 9, 3, 161, 6, 167 }, { 9, 4, 163, 9, 167 }, { 9, 5, 157, 9, 167 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 6, 1, 154, 8, 105 }, { 6, 3, 58, 6, 105 }, { 6, 4, 100, 4, 105 }, @@ -187,7 +187,7 @@ goto_t gotos[] = { { 6, 8, 169, 10, 105 }, { 6, 10, 111, 6, 105 }, { 6, 11, 164, 8, 105 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 7, 1, 154, 4, 158 }, { 7, 3, 58, 6, 158 }, { 7, 4, 100, 6, 158 }, @@ -196,7 +196,7 @@ goto_t gotos[] = { { 7, 8, 169, 8, 158 }, { 7, 10, 111, 4, 158 }, { 7, 11, 164, 6, 158 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 8, 1, 154, 2, 159 }, { 8, 3, 58, 4, 159 }, { 8, 4, 100, 6, 159 }, @@ -205,7 +205,7 @@ goto_t gotos[] = { { 8, 7, 165, 8, 159 }, { 8, 10, 111, 6, 159 }, { 8, 11, 164, 4, 159 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 10, 1, 154, 2, 77 }, { 10, 3, 58, 4, 77 }, { 10, 4, 100, 6, 77 }, @@ -214,7 +214,7 @@ goto_t gotos[] = { { 10, 7, 165, 4, 77 }, { 10, 8, 169, 6, 77 }, { 10, 11, 164, 4, 77 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 11, 1, 154, 2, 80 }, { 11, 3, 58, 4, 80 }, { 11, 4, 100, 6, 80 }, @@ -223,7 +223,7 @@ goto_t gotos[] = { { 11, 7, 165, 6, 80 }, { 11, 8, 169, 2, 80 }, { 11, 10, 111, 4, 80 }, - { -1, -1, -1, -1, -1 }, + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, { 12, 1, 154, 8, 56 }, { 12, 3, 58, 4, 56 }, { 12, 4, 100, 4, 56 }, @@ -233,7 +233,7 @@ goto_t gotos[] = { { 12, 8, 169, 4, 56 }, { 12, 10, 111, 10, 56 }, { 12, 11, 164, 6, 56 }, - { -1, -1, -1, -1, -1 } + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, }; #define SUB_LINE(start, end) \ @@ -424,7 +424,7 @@ perso_t kPersons[] = { { 0x618, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, { 0x71B, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, { 0x81B, 243, PersonMask::pmEnemy , PersonId::pidEnemy , PersonFlags::pf80 | PersonFlags::pftTyrann , 0, 0, 0, 0, 0, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, + { 0xFFFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF}, { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 80, 9, 0, 0, 8, 35, 0, 0 }, { 0x628, 237, PersonMask::pmEve , PersonId::pidEve , 0, 78, 10, 0, 0, 7, 35, 0, 0 } }; @@ -532,26 +532,26 @@ prect_t perso_rects[] = { //TODO: just an array of int16s? }; byte tab_persxx[][5] = { //TODO: struc? - { 8, 15, 23, 25, -1}, - { 0, 9, -1 }, - { 0, 9, -1 }, - { 0, 9, -1 }, - { 0, 13, -1 }, - { 16, 21, -1 }, - { 11, 20, -1 }, - { 0, 12, -1 }, - { 0, 9, -1 }, - { 0, 9, -1 }, - { 5, 13, -1 }, - { -1 }, - { 0, 8, -1 }, - { -1 }, - { 0, 7, -1 }, - { 0, 8, -1 }, - { 8, 12, -1 }, - { 0, 5, -1 }, - { 0, 4, -1 }, - { -1 } + { 8, 15, 23, 25, 0xFF}, + { 0, 9, 0xFF }, + { 0, 9, 0xFF }, + { 0, 9, 0xFF }, + { 0, 13, 0xFF }, + { 16, 21, 0xFF }, + { 11, 20, 0xFF }, + { 0, 12, 0xFF }, + { 0, 9, 0xFF }, + { 0, 9, 0xFF }, + { 5, 13, 0xFF }, + { 0xFF }, + { 0, 8, 0xFF }, + { 0xFF }, + { 0, 7, 0xFF }, + { 0, 8, 0xFF }, + { 8, 12, 0xFF }, + { 0, 5, 0xFF }, + { 0, 4, 0xFF }, + { 0xFF } }; area_t kAreasTable[] = { |