// Copyright (C) 2018 Arno Ansems
// 
// This program is free software: you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by 
// the Free Software Foundation, either version 3 of the License, or 
// (at your option) any later version. 
// 
// This program is distributed in the hope that it will be useful, 
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
// GNU General Public License for more details. 
// 
// You should have received a copy of the GNU General Public License 
// along with this program.  If not, see http://www.gnu.org/licenses/ 

//
// AudioRepositoryAbyss
//
// Data structures required for reading the Catacomb Abyss audio repository.
// Catacomb Abyss v1.13 and v1.24 share the same audio repository.
//
#pragma once

#include "../Engine/AudioRepository.h"
#include <vector>

const huffmanTable audioDictionaryAbyss =
{
    { 171, 173 },
    { 256, 175 },
    { 257, 185 },
    { 258, 187 },
    { 259, 206 },
    { 260, 208 },
    { 261, 213 },
    { 262, 215 },
    { 263, 217 },
    { 264, 220 },
    { 265, 222 },
    { 266, 231 },
    { 267, 238 },
    { 268, 248 },
    { 269, 250 },
    { 270, 252 },
    { 271, 253 },
    { 272, 254 },
    { 273, 189 },
    { 274, 224 },
    { 225, 227 },
    { 229, 234 },
    { 247, 275 },
    { 194, 199 },
    { 218, 276 },
    { 226, 277 },
    { 230, 89 },
    { 201, 210 },
    { 221, 233 },
    { 236, 278 },
    { 251, 87 },
    { 279, 203 },
    { 214, 216 },
    { 280, 281 },
    { 237, 133 },
    { 134, 143 },
    { 161, 166 },
    { 219, 282 },
    { 232, 94 },
    { 140, 145 },
    { 154, 283 },
    { 284, 285 },
    { 243, 246 },
    { 124, 147 },
    { 169, 286 },
    { 82, 113 },
    { 152, 287 },
    { 202, 288 },
    { 289, 245 },
    { 59, 73 },
    { 131, 159 },
    { 174, 188 },
    { 190, 209 },
    { 290, 78 },
    { 101, 120 },
    { 126, 129 },
    { 291, 141 },
    { 292, 176 },
    { 191, 204 },
    { 293, 223 },
    { 244, 121 },
    { 142, 157 },
    { 164, 168 },
    { 192, 195 },
    { 196, 205 },
    { 294, 12 },
    { 13, 96 },
    { 108, 130 },
    { 295, 296 },
    { 197, 297 },
    { 298, 61 },
    { 104, 110 },
    { 127, 136 },
    { 144, 106 },
    { 299, 137 },
    { 138, 158 },
    { 300, 193 },
    { 211, 8 },
    { 24, 71 },
    { 93, 115 },
    { 151, 177 },
    { 200, 301 },
    { 91, 100 },
    { 117, 146 },
    { 149, 302 },
    { 303, 304 },
    { 235, 241 },
    { 249, 255 },
    { 19, 55 },
    { 75, 114 },
    { 172, 212 },
    { 305, 66 },
    { 68, 92 },
    { 95, 107 },
    { 116, 306 },
    { 160, 307 },
    { 308, 70 },
    { 99, 111 },
    { 155, 165 },
    { 309, 28 },
    { 60, 310 },
    { 119, 311 },
    { 312, 313 },
    { 314, 315 },
    { 239, 36 },
    { 37, 53 },
    { 58, 88 },
    { 125, 153 },
    { 316, 7 },
    { 77, 86 },
    { 98, 135 },
    { 317, 318 },
    { 319, 320 },
    { 9, 45 },
    { 64, 109 },
    { 321, 322 },
    { 29, 80 },
    { 323, 112 },
    { 132, 324 },
    { 162, 170 },
    { 325, 167 },
    { 182, 326 },
    { 21, 31 },
    { 74, 327 },
    { 328, 128 },
    { 23, 62 },
    { 69, 123 },
    { 329, 27 },
    { 51, 103 },
    { 330, 331 },
    { 332, 32 },
    { 44, 333 },
    { 228, 334 },
    { 65, 335 },
    { 102, 336 },
    { 186, 72 },
    { 81, 90 },
    { 337, 57 },
    { 338, 339 },
    { 139, 340 },
    { 150, 341 },
    { 342, 343 },
    { 35, 38 },
    { 54, 198 },
    { 16, 344 },
    { 345, 346 },
    { 180, 18 },
    { 20, 39 },
    { 52, 56 },
    { 83, 97 },
    { 347, 348 },
    { 349, 350 },
    { 351, 79 },
    { 352, 25 },
    { 48, 50 },
    { 84, 353 },
    { 354, 11 },
    { 355, 15 },
    { 33, 356 },
    { 357, 358 },
    { 359, 360 },
    { 30, 361 },
    { 47, 362 },
    { 363, 148 },
    { 181, 207 },
    { 364, 34 },
    { 365, 366 },
    { 367, 368 },
    { 2, 40 },
    { 369, 370 },
    { 240, 26 },
    { 371, 372 },
    { 373, 374 },
    { 375, 85 },
    { 105, 376 },
    { 41, 377 },
    { 46, 378 },
    { 379, 380 },
    { 242, 381 },
    { 382, 383 },
    { 163, 178 },
    { 384, 385 },
    { 4, 386 },
    { 6, 17 },
    { 387, 118 },
    { 388, 389 },
    { 390, 391 },
    { 14, 392 },
    { 156, 393 },
    { 394, 395 },
    { 396, 397 },
    { 398, 399 },
    { 122, 400 },
    { 401, 402 },
    { 403, 404 },
    { 405, 3 },
    { 76, 406 },
    { 63, 407 },
    { 408, 409 },
    { 410, 411 },
    { 22, 412 },
    { 5, 43 },
    { 413, 414 },
    { 415, 184 },
    { 416, 417 },
    { 418, 67 },
    { 419, 420 },
    { 421, 422 },
    { 423, 183 },
    { 424, 425 },
    { 426, 427 },
    { 428, 429 },
    { 430, 431 },
    { 432, 433 },
    { 434, 435 },
    { 436, 179 },
    { 437, 438 },
    { 439, 440 },
    { 441, 442 },
    { 443, 49 },
    { 444, 1 },
    { 445, 446 },
    { 447, 448 },
    { 449, 450 },
    { 451, 10 },
    { 452, 453 },
    { 454, 455 },
    { 456, 457 },
    { 458, 459 },
    { 460, 461 },
    { 42, 462 },
    { 463, 464 },
    { 465, 466 },
    { 467, 468 },
    { 469, 470 },
    { 471, 472 },
    { 473, 474 },
    { 475, 476 },
    { 477, 478 },
    { 479, 480 },
    { 481, 482 },
    { 483, 484 },
    { 485, 486 },
    { 487, 488 },
    { 489, 490 },
    { 491, 492 },
    { 493, 494 },
    { 495, 496 },
    { 497, 498 },
    { 499, 500 },
    { 501, 502 },
    { 503, 504 },
    { 505, 506 },
    { 507, 0 },
    { 508, 509 },
    { 0, 0 }
};

const std::vector<int32_t> audioRepositoryOffsetsAbyss =
{
    0,
    29,
    203,
    328,
    398,
    444,
    509,
    623,
    687,
    700,
    734,
    792,
    863,
    948,
    982,
    991,
    1000,
    1066,
    1096,
    1283,
    1312,
    1364,
    1444,
    1490,
    1536,
    1545,
    1577,
    1737,
    1842,
    1933,
    2050,
    2155,
    2244,
    2344,
    2360,
    2401,
    2595,
    2731,
    2821,
    2889,
    2978,
    3104,
    3187,
    3218,
    3328,
    3448,
    3539,
    3604,
    3656,
    3677,
    3697,
    3746,
    3785,
    3991,
    4033,
    4099,
    4199,
    4300,
    4357,
    4381,
    4433,
    4453,
    4476,
    4517,
    4707,
    4845,
    4950,
    5063,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    6090,
    5099,
    6904
};

typedef enum {
    HITWALLSND,              // 0
    WARPUPSND,               // 1
    WARPDOWNSND,             // 2
    GETBOLTSND,              // 3
    GETNUKESND,              // 4
    GETPOTIONSND,            // 5
    GETKEYSND,               // 6
    GETSCROLLSND,            // 7
    GETPOINTSSND,            // 8
    USEBOLTSND,              // 9
    USENUKESND,              // 10
    USEPOTIONSND,            // 11
    USEKEYSND,               // 12
    NOITEMSND,               // 13
    WALK1SND,                // 14
    WALK2SND,                // 15
    TAKEDAMAGESND,           // 16
    MONSTERMISSSND,          // 17
    GAMEOVERSND,             // 18
    SHOOTSND,                // 19
    BIGSHOOTSND,             // 20
    SHOOTWALLSND,            // 21
    SHOOTMONSTERSND,         // 22
    TAKEDMGHURTSND,          // 23
    BALLBOUNCESND,           // 24
    NOWAYSND,                // 25
    WARPSND,                 // 26
    HIT_GATESND,             // 27
    GETGEMSND,               // 28
    BOOMSND,                 // 29
    GRELM_DEADSND,           // 30
    FREEZETIMESND,           // 31
    TIMERETURNSND,           // 32
    TICKSND,                 // 33
    LASTSOUND
} audioAbyss;

const audioRepositoryStaticData audioRepositoryAbyss =
{
    "AUDIO.ABS",
    audioRepositoryOffsetsAbyss,
    audioDictionaryAbyss,
    LASTSOUND,
    true
};
