| 1 | |
| 2 | /** |
| 3 | * |
| 4 | * @file jj1sceneload.cpp |
| 5 | * |
| 6 | * Part of the OpenJazz project |
| 7 | * |
| 8 | * @par History: |
| 9 | * - 23rd August 2005: Created scene.c |
| 10 | * - 3rd February 2009: Created scene.h from parts of scene.c |
| 11 | * - 3rd February 2009: Renamed scene.c to scene.cpp |
| 12 | * - 27th March 2010: Created sceneload.cpp from parts of scene.cpp |
| 13 | * - 1st August 2012: Renamed sceneload.cpp to jj1sceneload.cpp |
| 14 | * |
| 15 | * @par Licence: |
| 16 | * Copyright (c) 2005-2012 AJ Thomson |
| 17 | * Copyright (c) 2015-2024 Carsten Teibes |
| 18 | * |
| 19 | * OpenJazz is distributed under the terms of |
| 20 | * the GNU General Public License, version 2.0 |
| 21 | * |
| 22 | * @par Description: |
| 23 | * Deals with the loading of cutscene data. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | |
| 28 | #include "jj1scene.h"cxx . . $ `<file>/src/jj1/scene/jj1scene.h`/ |
| 29 | |
| 30 | #include "io/file.h"cxx . . $ `<file>/src/io/file.h`/ |
| 31 | #include "io/gfx/font.h"cxx . . $ `<file>/src/io/gfx/font.h`/ |
| 32 | #include "io/gfx/video.h"cxx . . $ `<file>/src/io/gfx/video.h`/ |
| 33 | #include "io/sound.h"cxx . . $ `<file>/src/io/sound.h`/ |
| 34 | #include "util.h"cxx . . $ `<file>/src/util.h`/ |
| 35 | #include "io/log.h"cxx . . $ `<file>/src/io/log.h`/ |
| 36 | |
| 37 | #include <string.h> |
| 38 | |
| 39 | #define DEBUG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:39:9`! 0 |
| 40 | #define DEBUG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:40:9`! 0 |
| 41 | #define DEBUG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:41:9`! 0 |
| 42 | #define DEBUG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:42:9`! 0 |
| 43 | |
| 44 | #if DEBUG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:39:9`! |
| 45 | #define LOG_CM(...) LOG_MAX(__VA_ARGS__) |
| 46 | #else |
| 47 | #define LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!(...) |
| 48 | #endif |
| 49 | #if DEBUG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:40:9`! |
| 50 | #define LOG_FF(...) LOG_MAX(__VA_ARGS__) |
| 51 | #else |
| 52 | #define LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!(...) |
| 53 | #endif |
| 54 | #if DEBUG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:41:9`! |
| 55 | #define LOG_ANIM(...) LOG_MAX(__VA_ARGS__) |
| 56 | #else |
| 57 | #define LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!(...) |
| 58 | #endif |
| 59 | #if DEBUG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:42:9`! |
| 60 | #define LOG_SCRIPT(...) LOG_MAX(__VA_ARGS__) |
| 61 | #else |
| 62 | #define LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!(...) |
| 63 | #endif |
| 64 | |
| 65 | /** |
| 66 | * Load a short from a buffer and advance the pointer past it. |
| 67 | * |
| 68 | * @param data Pointer to data in a buffer |
| 69 | * |
| 70 | * @return The loaded short |
| 71 | */ |
| 72 | unsigned short int JJ1Scenecxx . . $ JJ1Scene#::loadShortMemcxx . . $ JJ1Scene#loadShortMem(32075f85936231b2). (unsigned char** data) { |
| 73 | |
| 74 | unsigned short int val; |
| 75 | |
| 76 | val = **data; |
| 77 | (*data)++; |
| 78 | val += ((unsigned short)(**data)) << 8; |
| 79 | (*data)++; |
| 80 | |
| 81 | return val; |
| 82 | |
| 83 | } |
| 84 | |
| 85 | |
| 86 | /** |
| 87 | * Decompress JJ1 cutscene graphical data. |
| 88 | * |
| 89 | * @param size The size of the compressed data |
| 90 | * @param frameData The compressed data |
| 91 | * @param pixels Buffer to contain the decompressed data |
| 92 | */ |
| 93 | void JJ1Scenecxx . . $ JJ1Scene#::loadFullFrameMemcxx . . $ JJ1Scene#loadFullFrameMem(5ccf0e86133c4e4d). (int size, unsigned char* frameData, unsigned char* pixels) { |
| 94 | unsigned char* nextPixel = pixels; |
| 95 | unsigned char* nextData = frameData; |
| 96 | int fillWidth = 0; |
| 97 | bool trans = true; |
| 98 | |
| 99 | #if DEBUG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:40:9`! |
| 100 | FILE* out = fopen("ff-output.dat", "wb"); |
| 101 | fwrite(frameData, size, 1, out); |
| 102 | fclose(out); |
| 103 | #endif |
| 104 | |
| 105 | while ((nextData < frameData + size) && (nextPixel < pixels + (SWcxx . . $ `src/io/gfx/video.h:38:9`! * SHcxx . . $ `src/io/gfx/video.h:39:9`!))) { |
| 106 | unsigned char header = *nextData; |
| 107 | nextData++; |
| 108 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Frame header: 0x%x", header); |
| 109 | |
| 110 | if ((header & 0x7F) == 0x7F) { |
| 111 | fillWidth = loadShortMemcxx . . $ JJ1Scene#loadShortMem(32075f85936231b2).(&nextData); |
| 112 | if (trans) fillWidth += 255; |
| 113 | |
| 114 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Skip %d pixels", fillWidth); |
| 115 | } else if (header) { |
| 116 | |
| 117 | if(trans) { |
| 118 | fillWidth = header; |
| 119 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF SKIP %d transparent pixels", fillWidth); |
| 120 | } else { |
| 121 | fillWidth = header & 0x1F; |
| 122 | |
| 123 | switch (header & 0x60) { |
| 124 | default: |
| 125 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Unknown operation: 0x%x", header); |
| 126 | break; |
| 127 | |
| 128 | case 0x00: |
| 129 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Copy %d pixels", fillWidth); |
| 130 | memcpy(nextPixel, nextData, fillWidth); |
| 131 | nextData += fillWidth; |
| 132 | break; |
| 133 | |
| 134 | case 0x20: |
| 135 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Copy %d pixels of previous line", fillWidth); |
| 136 | if (nextPixel - SWcxx . . $ `src/io/gfx/video.h:38:9`! >= pixels) |
| 137 | memcpy(nextPixel, nextPixel - SWcxx . . $ `src/io/gfx/video.h:38:9`!, fillWidth); |
| 138 | break; |
| 139 | |
| 140 | case 0x60: |
| 141 | fillWidth = header&0x3F; |
| 142 | /* FALLTHROUGH */ |
| 143 | case 0x40: |
| 144 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF Fill %d pixels of row with color 0x%x", fillWidth, *nextData); |
| 145 | memset(nextPixel, *nextData, fillWidth); |
| 146 | nextData++; |
| 147 | break; |
| 148 | } |
| 149 | } |
| 150 | } else { |
| 151 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF FAULTY END OF STREAM: %d", size); |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | nextPixel += fillWidth; |
| 156 | |
| 157 | if (header & 0x80) trans = false; |
| 158 | else trans = !trans; |
| 159 | } |
| 160 | |
| 161 | LOG_FFcxx . . $ `src/jj1/scene/jj1sceneload.cpp:52:10`!("PL FF pixels: %d", (unsigned int)(nextPixel - pixels)); |
| 162 | } |
| 163 | |
| 164 | |
| 165 | /** |
| 166 | * Decompress JJ1 cutscene graphical data. |
| 167 | * |
| 168 | * @param size The size of the compressed data |
| 169 | * @param frameData The compressed data |
| 170 | * @param pixels Buffer to contain the decompressed data |
| 171 | */ |
| 172 | void JJ1Scenecxx . . $ JJ1Scene#::loadCompactedMemcxx . . $ JJ1Scene#loadCompactedMem(5ccf0e86133c4e4d). (int size, unsigned char* frameData, unsigned char* pixels) { |
| 173 | |
| 174 | unsigned char* nextPixel = pixels; |
| 175 | unsigned char* endpixdata = pixels + (SWcxx . . $ `src/io/gfx/video.h:38:9`! * SHcxx . . $ `src/io/gfx/video.h:39:9`!); |
| 176 | unsigned char* fillstart = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 177 | int fillWidth; |
| 178 | |
| 179 | #if DEBUG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:39:9`! |
| 180 | FILE* out = fopen("cm-output.dat", "wb"); |
| 181 | fwrite(frameData, size, 1, out); |
| 182 | fclose(out); |
| 183 | #endif |
| 184 | |
| 185 | auto fillColumns = [&](unsigned char color, int columns) { |
| 186 | LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!("PL CM Fill %d columns with color 0x%x", columns, color); |
| 187 | |
| 188 | fillstart = nextPixel; |
| 189 | while (fillstart + columns <= endpixdata) { |
| 190 | memset(fillstart, color, columns); |
| 191 | fillstart += SWcxx . . $ `src/io/gfx/video.h:38:9`!; |
| 192 | } |
| 193 | if(fillstart < endpixdata) { |
| 194 | // Filling bottom row |
| 195 | memset(fillstart, color, endpixdata-fillstart); |
| 196 | } |
| 197 | }; |
| 198 | |
| 199 | while (size > 0) { |
| 200 | |
| 201 | unsigned char header = *frameData; |
| 202 | frameData++; |
| 203 | |
| 204 | if (header == 0x7F) { |
| 205 | fillWidth = loadShortMemcxx . . $ JJ1Scene#loadShortMem(32075f85936231b2).(&frameData); |
| 206 | unsigned char fillColor = *frameData; |
| 207 | frameData++; |
| 208 | fillColumns(cxx . . $ JJ1Scene#loadCompactedMem(5ccf0e86133c4e4d).$anonymous_type_0#`operator()`(7ce84bf4a5c4253).fillColor, fillWidth); |
| 209 | |
| 210 | size -= 3; |
| 211 | } else if (header == 0xFF) { |
| 212 | fillWidth = loadShortMemcxx . . $ JJ1Scene#loadShortMem(32075f85936231b2).(&frameData); |
| 213 | LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!("PL CM Skip %d pixels", fillWidth); |
| 214 | |
| 215 | size -= 2; |
| 216 | } else if (header & 0x80) { |
| 217 | fillWidth = (header - 0x80) + 1; // max 0xFE |
| 218 | LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!("PL CM Skip %d pixels", fillWidth); |
| 219 | } else if (header & 0x40) { |
| 220 | unsigned char fillColor = *frameData; |
| 221 | frameData++; |
| 222 | fillWidth = (header - 0x40) + 1; // max 0x7E |
| 223 | fillColumns(cxx . . $ JJ1Scene#loadCompactedMem(5ccf0e86133c4e4d).$anonymous_type_0#`operator()`(7ce84bf4a5c4253).fillColor, fillWidth); |
| 224 | |
| 225 | size--; |
| 226 | } else { |
| 227 | fillWidth = (header & 0x3F) + 1; // max 0x3F |
| 228 | LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!("PL CM Fill %d columns with raw pixels", fillWidth); |
| 229 | |
| 230 | for (int col = 0; col < fillWidth; col++) { |
| 231 | unsigned char color = *frameData; |
| 232 | frameData++; |
| 233 | |
| 234 | if (color != 0xFF) { |
| 235 | fillstart = nextPixel + col; |
| 236 | |
| 237 | while (fillstart < endpixdata) { |
| 238 | *fillstart = color; |
| 239 | fillstart += SWcxx . . $ `src/io/gfx/video.h:38:9`!; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | size--; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | nextPixel += fillWidth; |
| 248 | size--; |
| 249 | } |
| 250 | |
| 251 | LOG_CMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:47:10`!("PL CM pixels: %d", (unsigned int)(nextPixel - pixels)); |
| 252 | } |
| 253 | |
| 254 | |
| 255 | /** |
| 256 | * Load JJ1 cutscene animation. |
| 257 | * |
| 258 | * @param scene Object to hold animation data |
| 259 | * @param f File from which to load animation |
| 260 | * @param dataIndex Index |
| 261 | */ |
| 262 | void JJ1Scenecxx . . $ JJ1Scene#::loadAnicxx . . $ JJ1Scene#loadAni(cd2e435217ca1efd). (JJ1SceneAnimationcxx . . $ JJ1SceneAnimation# &scene, Filecxx . . $ File# *f, int dataIndex) { |
| 263 | |
| 264 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("ParseAni DataLen: 0x%x", f->loadShort()); // should be 0x02 |
| 265 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("ParseAni Frames: %d", f->loadShort()); |
| 266 | unsigned short int type = 0; |
| 267 | int loop; |
| 268 | |
| 269 | while (type != EPlayListAniHeadercxx . . $ EPlayListAniHeader.) { |
| 270 | |
| 271 | type = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 272 | |
| 273 | if (type == ESoundListAniHeadercxx . . $ ESoundListAniHeader.) { |
| 274 | |
| 275 | /*unsigned short int offset =*/ f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 276 | unsigned char nSounds = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 277 | |
| 278 | for(loop = 0; loop < nSounds; loop++) { |
| 279 | |
| 280 | char* soundName = f->loadTerminatedStringcxx . . $ File#loadTerminatedString(ff224f080444ee45).(); |
| 281 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("Soundname: %s", soundName); |
| 282 | resampleSoundcxx . . $ resampleSound(d77166e5f335409f).(loop, soundName, 11025); |
| 283 | delete[] soundName; |
| 284 | |
| 285 | } |
| 286 | |
| 287 | } else if (type == EPlayListAniHeadercxx . . $ EPlayListAniHeader.) { |
| 288 | int nextPos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 289 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read position: %d", nextPos); |
| 290 | f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); // Length |
| 291 | |
| 292 | palettescxx . . $ JJ1Scene#palettes..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(dataIndex); |
| 293 | auto &scenePalette = palettescxx . . $ JJ1Scene#palettes..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 294 | f->loadPalettecxx . . $ File#loadPalette(a8e7e0a5cf0a5bef).(scenePalette.palettecxx . . $ JJ1ScenePalette#palette., false); |
| 295 | |
| 296 | #if DEBUG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:41:9`! |
| 297 | int items = 0; |
| 298 | #endif |
| 299 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read position start: %d", f->tell()); |
| 300 | |
| 301 | int validValue = true; |
| 302 | while (validValue) { |
| 303 | |
| 304 | unsigned short int value = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 305 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read block start tag: 0x%x", value); |
| 306 | int size = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 307 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Anim block size: %d", size); |
| 308 | nextPos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 309 | // next pos is intial position + size and four bytes header |
| 310 | nextPos += size; |
| 311 | |
| 312 | switch (value) { |
| 313 | |
| 314 | case EEndAniHeadercxx . . $ EEndAniHeader.: // END MARKER |
| 315 | validValue = false; |
| 316 | break; |
| 317 | |
| 318 | case E11AniHeadercxx . . $ E11AniHeader.: |
| 319 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL 11 Background Type: 0"); |
| 320 | scene.backgroundcxx . . $ JJ1SceneAnimation#background. = f->loadSurfacecxx . . $ File#loadSurface(efa8a2aaf13882cf).(SWcxx . . $ `src/io/gfx/video.h:38:9`!, SHcxx . . $ `src/io/gfx/video.h:39:9`!, false); |
| 321 | |
| 322 | // Use the most recently loaded palette |
| 323 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(scenePalette.palettecxx . . $ JJ1ScenePalette#palette.); |
| 324 | break; |
| 325 | |
| 326 | case E1LAniHeadercxx . . $ E1LAniHeader.: |
| 327 | { |
| 328 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL 1L Background Type: 0"); |
| 329 | unsigned char* pixels = new unsigned char[SWcxx . . $ `src/io/gfx/video.h:38:9`!* SHcxx . . $ `src/io/gfx/video.h:39:9`!]; |
| 330 | memset(pixels, 0, SWcxx . . $ `src/io/gfx/video.h:38:9`!*SHcxx . . $ `src/io/gfx/video.h:39:9`!); |
| 331 | unsigned char* frameData = f->loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56).(size); |
| 332 | loadCompactedMemcxx . . $ JJ1Scene#loadCompactedMem(5ccf0e86133c4e4d).(size, frameData, pixels); |
| 333 | delete[] frameData; |
| 334 | scene.backgroundcxx . . $ JJ1SceneAnimation#background. = videocxx . . $ video..createSurfacecxx . . $ Video#createSurface(5ec4649223a2dfef).(pixels, SWcxx . . $ `src/io/gfx/video.h:38:9`!, SHcxx . . $ `src/io/gfx/video.h:39:9`!); |
| 335 | delete[] pixels; |
| 336 | |
| 337 | // Use the most recently loaded palette |
| 338 | videocxx . . $ video..setPalettecxx . . $ Video#setPalette(d5421d17e1a4b2b2).(scenePalette.palettecxx . . $ JJ1ScenePalette#palette.); |
| 339 | } |
| 340 | break; |
| 341 | |
| 342 | case EFullFrameAniHeadercxx . . $ EFullFrameAniHeader.: |
| 343 | { |
| 344 | unsigned char* blockData = f->loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56).(size); |
| 345 | scene.addFramecxx . . $ JJ1SceneAnimation#addFrame(dde21517a502ab05).(EFullFrameAniHeadercxx . . $ EFullFrameAniHeader., blockData, size); |
| 346 | } |
| 347 | break; |
| 348 | |
| 349 | case ERNAniHeadercxx . . $ ERNAniHeader.: |
| 350 | case ERBAniHeadercxx . . $ ERBAniHeader.: |
| 351 | case ERLAniHeadercxx . . $ ERLAniHeader.: |
| 352 | case EMXAniHeadercxx . . $ EMXAniHeader.: |
| 353 | LOG_DEBUGcxx . . $ `src/io/log.h:75:9`!("PL Read Unsupported animation type 0x%x", value); |
| 354 | break; |
| 355 | |
| 356 | case EReverseAniHeadercxx . . $ EReverseAniHeader.: |
| 357 | scene.reverseAnimationcxx . . $ JJ1SceneAnimation#reverseAnimation. = 1; |
| 358 | break; |
| 359 | |
| 360 | case ERCAniHeadercxx . . $ ERCAniHeader.: |
| 361 | { |
| 362 | unsigned char* blockData = f->loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56).(size); |
| 363 | scene.addFramecxx . . $ JJ1SceneAnimation#addFrame(dde21517a502ab05).(ERCAniHeadercxx . . $ ERCAniHeader., blockData, size); |
| 364 | } |
| 365 | break; |
| 366 | |
| 367 | case ECompactedAniHeadercxx . . $ ECompactedAniHeader.: |
| 368 | { |
| 369 | unsigned char* blockData = f->loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56).(size); |
| 370 | scene.addFramecxx . . $ JJ1SceneAnimation#addFrame(dde21517a502ab05).(ECompactedAniHeadercxx . . $ ECompactedAniHeader., blockData, size); |
| 371 | } |
| 372 | break; |
| 373 | |
| 374 | case ESoundTagAniHeadercxx . . $ ESoundTagAniHeader.: |
| 375 | { |
| 376 | auto se = static_cast<SEcxx . . $ SE/::Typecxx . . $ SE/Type#>(f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).()); |
| 377 | if (!isValidSoundIndexcxx . . $ isValidSoundIndex(856ce1a3dc69003b).(se)) { |
| 378 | LOG_WARNcxx . . $ `src/io/log.h:77:9`!("PL Audio tag with invalid index: %d", se); |
| 379 | scene.lastFramecxx . . $ JJ1SceneAnimation#lastFrame.->soundIdcxx . . $ JJ1SceneFrame#soundId. = SEcxx . . $ SE/::NONEcxx . . $ SE/NONE.; |
| 380 | } else { |
| 381 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Audio tag with index: %d", se); |
| 382 | scene.lastFramecxx . . $ JJ1SceneAnimation#lastFrame.->soundIdcxx . . $ JJ1SceneFrame#soundId. = se; |
| 383 | } |
| 384 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Audio tag play at: 0x%x", f->loadChar()); |
| 385 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Audio tag play offset: 0x%x", f->loadChar()); |
| 386 | } |
| 387 | break; |
| 388 | |
| 389 | case E00AniHeadercxx . . $ E00AniHeader.: // FIXME: wait command? |
| 390 | { |
| 391 | int longvalue = f->loadIntcxx . . $ File#loadInt(b126dc7c1de90089).(); |
| 392 | |
| 393 | while (longvalue == 0) { |
| 394 | |
| 395 | longvalue = f->loadIntcxx . . $ File#loadInt(b126dc7c1de90089).(); |
| 396 | nextPos += 4; |
| 397 | |
| 398 | } |
| 399 | |
| 400 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(-4, false); |
| 401 | value = longvalue; |
| 402 | |
| 403 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read Long: 0x%x", value); |
| 404 | } |
| 405 | break; |
| 406 | |
| 407 | default: |
| 408 | |
| 409 | LOG_DEBUGcxx . . $ `src/io/log.h:75:9`!("PL Read Unknown type: 0x%x", value); |
| 410 | validValue = false; |
| 411 | |
| 412 | break; |
| 413 | |
| 414 | } |
| 415 | |
| 416 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read position after block should be: %d", nextPos); |
| 417 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(nextPos, true); |
| 418 | |
| 419 | #if DEBUG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:41:9`! |
| 420 | if(validValue) |
| 421 | items++; |
| 422 | #endif |
| 423 | } |
| 424 | |
| 425 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Parsed through number of items skipping 0 items: %d", items); |
| 426 | LOG_ANIMcxx . . $ `src/jj1/scene/jj1sceneload.cpp:57:10`!("PL Read position after parsing anim blocks: %d", f->tell()); |
| 427 | |
| 428 | } |
| 429 | |
| 430 | } |
| 431 | |
| 432 | } |
| 433 | |
| 434 | |
| 435 | /** |
| 436 | * Load JJ1 cutscene data. |
| 437 | * |
| 438 | * @param f File from which to load the data |
| 439 | */ |
| 440 | void JJ1Scenecxx . . $ JJ1Scene#::loadDatacxx . . $ JJ1Scene#loadData(cbcd11eaff6dd399). (Filecxx . . $ File# *f) { |
| 441 | |
| 442 | for (int loop = 0; loop < dataItemscxx . . $ JJ1Scene#dataItems.; loop++) { |
| 443 | |
| 444 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(dataOffsetscxx . . $ JJ1Scene#dataOffsets.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).loop], true); // Seek to data start |
| 445 | unsigned short int dataLen = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); // Get get the length of the datablock |
| 446 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Data dataLen: %d", dataLen); |
| 447 | |
| 448 | if (dataLen == EAniHeadercxx . . $ EAniHeader.) { |
| 449 | |
| 450 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Data Type: ANI"); |
| 451 | animationscxx . . $ JJ1Scene#animations..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(loop); |
| 452 | auto &sceneAnimation = animationscxx . . $ JJ1Scene#animations..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 453 | loadAnicxx . . $ JJ1Scene#loadAni(cd2e435217ca1efd).(sceneAnimation, f, loop); |
| 454 | |
| 455 | } else { |
| 456 | |
| 457 | unsigned char type = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 458 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Data Type: %d", type); |
| 459 | |
| 460 | switch (type) { |
| 461 | |
| 462 | case 3: |
| 463 | case 4: // image |
| 464 | case 5: |
| 465 | case 6: |
| 466 | case 7: |
| 467 | { |
| 468 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Data Type: Image, index: %d", loop); |
| 469 | unsigned short int width = f->loadShortcxx . . $ File#loadShort(a18c05e4017afb3d).(SWcxx . . $ `src/io/gfx/video.h:38:9`!); // Get width |
| 470 | unsigned short int height; |
| 471 | |
| 472 | // Get height |
| 473 | if (type == 3) height = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 474 | else height = f->loadShortcxx . . $ File#loadShort(a18c05e4017afb3d).(SHcxx . . $ `src/io/gfx/video.h:39:9`!); |
| 475 | |
| 476 | imagescxx . . $ JJ1Scene#images..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(loop); |
| 477 | auto& sceneImage = imagescxx . . $ JJ1Scene#images..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 478 | |
| 479 | if (type >= 5 && type <= 7) { |
| 480 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(-5, false); // account for metadata 2 + 2 |
| 481 | unsigned char* pixels = unpackRLEcxx . . $ unpackRLE(75cab8e1ec3de26e).(f->loadBlockcxx . . $ File#loadBlock(f18dc31a6ecbac56).(dataLen), dataLen, width * height + 4); |
| 482 | sceneImage.imagecxx . . $ JJ1SceneImage#image. = videocxx . . $ video..createSurfacecxx . . $ Video#createSurface(5ec4649223a2dfef).(pixels + 4, width, height); |
| 483 | delete[] pixels; |
| 484 | } else { |
| 485 | sceneImage.imagecxx . . $ JJ1SceneImage#image. = f->loadSurfacecxx . . $ File#loadSurface(efa8a2aaf13882cf).(width, height, false); |
| 486 | } |
| 487 | } |
| 488 | break; |
| 489 | |
| 490 | default: |
| 491 | |
| 492 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Data Type: Palette, index: %d", loop); |
| 493 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(-3, false); // fake an RLE block size marker and use first palette byte |
| 494 | |
| 495 | palettescxx . . $ JJ1Scene#palettes..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(loop); |
| 496 | auto& palette = palettescxx . . $ JJ1Scene#palettes..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 497 | f->loadPalettecxx . . $ File#loadPalette(a8e7e0a5cf0a5bef).(palette.palettecxx . . $ JJ1ScenePalette#palette.); |
| 498 | |
| 499 | break; |
| 500 | |
| 501 | } |
| 502 | |
| 503 | } |
| 504 | |
| 505 | } |
| 506 | |
| 507 | } |
| 508 | |
| 509 | |
| 510 | /** |
| 511 | * Load JJ1 cutscene scripts. |
| 512 | * |
| 513 | * @param f File from which to load the scripts |
| 514 | */ |
| 515 | void JJ1Scenecxx . . $ JJ1Scene#::loadScriptscxx . . $ JJ1Scene#loadScripts(cbcd11eaff6dd399). (Filecxx . . $ File# *f) { |
| 516 | |
| 517 | int textAlignment = 0; |
| 518 | int textFont = 0; |
| 519 | int textShadow = -1; |
| 520 | int textColour = 0; |
| 521 | int loop = 0; |
| 522 | |
| 523 | for(auto &page : pagescxx . . $ JJ1Scene#pages.) { |
| 524 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Parse Script: %d", loop); |
| 525 | |
| 526 | SDL_Rect textRect = { 0,0,0,0 }; |
| 527 | f->seekcxx . . $ File#seek(918ebd27a9ddbad3).(scriptStartscxx . . $ JJ1Scene#scriptStarts.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).loop], true); // Seek to data start |
| 528 | |
| 529 | if (f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).() == 0x50) { // Script tag |
| 530 | |
| 531 | LOG_MAXcxx . . $ `src/io/log.h:73:9`!("Script id: 0x%x", f->loadShort()); |
| 532 | int palette = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 533 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("Script default palette: %d", palette); |
| 534 | page.paletteIndexcxx . . $ JJ1ScenePage#paletteIndex. = palette; |
| 535 | |
| 536 | bool breakloop = false; |
| 537 | int pos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 538 | |
| 539 | int textPosX = -1; |
| 540 | int textPosY = -1; |
| 541 | int extraheight = -1; |
| 542 | bool textRectValid = false; |
| 543 | |
| 544 | while(!breakloop && pos < dataOffsetscxx . . $ JJ1Scene#dataOffsets.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).0]) { |
| 545 | |
| 546 | unsigned char type = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 547 | |
| 548 | switch(type) { |
| 549 | |
| 550 | case ESceneYesNocxx . . $ ESceneYesNo.: |
| 551 | { |
| 552 | page.askForYesNocxx . . $ JJ1ScenePage#askForYesNo. = true; |
| 553 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneYesNo"); |
| 554 | } |
| 555 | break; |
| 556 | case ESceneStopMusiccxx . . $ ESceneStopMusic.: |
| 557 | { |
| 558 | page.stopMusiccxx . . $ JJ1ScenePage#stopMusic. = true; |
| 559 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneStopMusic"); |
| 560 | } |
| 561 | break; |
| 562 | case ESceneAnimationcxx . . $ ESceneAnimation.: |
| 563 | { |
| 564 | page.animLoopscxx . . $ JJ1ScenePage#animLoops. = f->loadIntcxx . . $ File#loadInt(b126dc7c1de90089).(); |
| 565 | page.animSpeedcxx . . $ JJ1ScenePage#animSpeed. = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 566 | page.animIndexcxx . . $ JJ1ScenePage#animIndex. = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 567 | |
| 568 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneAnimation: loops %d, speed %d, anim num %d", |
| 569 | page.animLoops, page.animSpeed, page.animIndex); |
| 570 | } |
| 571 | break; |
| 572 | |
| 573 | case ESceneAnimationPlayAndContinuecxx . . $ ESceneAnimationPlayAndContinue.: |
| 574 | { |
| 575 | page.nextPageAfterAnimcxx . . $ JJ1ScenePage#nextPageAfterAnim. = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 576 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneAnimationPlayAndContinue: %d", page.nextPageAfterAnim); |
| 577 | } |
| 578 | break; |
| 579 | |
| 580 | case ESceneTransitionTypecxx . . $ ESceneTransitionType.: |
| 581 | { |
| 582 | page.transitionTypecxx . . $ JJ1ScenePage#transitionType. = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 583 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTransitionType: %d", page.transitionType); |
| 584 | } |
| 585 | break; |
| 586 | |
| 587 | case ESceneBackgroundcxx . . $ ESceneBackground.: |
| 588 | |
| 589 | page.bgXcxx . . $ JJ1ScenePage#bgX.[page.backgroundscxx . . $ JJ1ScenePage#backgrounds.] = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 590 | page.bgYcxx . . $ JJ1ScenePage#bgY.[page.backgroundscxx . . $ JJ1ScenePage#backgrounds.] = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 591 | page.bgIndexcxx . . $ JJ1ScenePage#bgIndex.[page.backgroundscxx . . $ JJ1ScenePage#backgrounds.] = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 592 | |
| 593 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneBackground: x %d, y %d, index %d", page.bgX[page.backgrounds], |
| 594 | page.bgY[page.backgrounds], page.bgIndex[page.backgrounds]); |
| 595 | |
| 596 | page.backgroundscxx . . $ JJ1ScenePage#backgrounds.++; |
| 597 | |
| 598 | break; |
| 599 | |
| 600 | case ESceneMusiccxx . . $ ESceneMusic.: |
| 601 | |
| 602 | page.musicFilecxx . . $ JJ1ScenePage#musicFile. = f->loadTerminatedStringcxx . . $ File#loadTerminatedString(ff224f080444ee45).(); |
| 603 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneMusic: %s", page.musicFile); |
| 604 | |
| 605 | break; |
| 606 | |
| 607 | case ESceneMusicTransitioncxx . . $ ESceneMusicTransition.: |
| 608 | { |
| 609 | char musicTransition = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 610 | // This value (-) is mentioned in the moddingwiki, though i encountered 0x45 (E) more often |
| 611 | if(musicTransition == 0x2D) { |
| 612 | page.stopMusiccxx . . $ JJ1ScenePage#stopMusic. = true; // FIXME: maybe means actually fade? |
| 613 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneMusicTransition: off"); |
| 614 | } else |
| 615 | LOG_TRACEcxx . . $ `src/io/log.h:74:9`!("Unknown ESceneMusicTransition: 0x%x", musicTransition); |
| 616 | } |
| 617 | break; |
| 618 | |
| 619 | case ESceneTextRectcxx . . $ ESceneTextRect.: |
| 620 | |
| 621 | textRect.x = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 622 | textRect.y = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 623 | textRect.w = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).() - textRect.x; |
| 624 | textRect.h = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).() - textRect.y; |
| 625 | textRectValid = true; |
| 626 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextRect: x %d, y %d, w %d, h %d", |
| 627 | textRect.x, textRect.y, textRect.w, textRect.h); |
| 628 | |
| 629 | break; |
| 630 | |
| 631 | case ESceneFontDefinecxx . . $ ESceneFontDefine.: |
| 632 | |
| 633 | if (fontscxx . . $ JJ1Scene#fonts..sizecxx . . $ std/__cxx11/list#size(fe4d2d262d4164a8).() < 5) { |
| 634 | int id = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 635 | fontscxx . . $ JJ1Scene#fonts..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(id); |
| 636 | auto &sceneFont = fontscxx . . $ JJ1Scene#fonts..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 637 | char *fontname = f->loadTerminatedStringcxx . . $ File#loadTerminatedString(ff224f080444ee45).(); |
| 638 | |
| 639 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneFontDefine: %s with id %d", fontname, sceneFont.id); |
| 640 | |
| 641 | if (strcmp(fontname, "FONT2") == 0) |
| 642 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = font2cxx . . $ font2.; |
| 643 | else if (strcmp(fontname, "FONTBIG") == 0) |
| 644 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = fontbigcxx . . $ fontbig.; |
| 645 | else if (strcmp(fontname, "FONTINY") == 0) |
| 646 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = fontinycxx . . $ fontiny.; |
| 647 | else if (strcmp(fontname, "FONTMN1") == 0) |
| 648 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = fontmn1cxx . . $ fontmn1.; |
| 649 | else if (strcmp(fontname, "FONTMN2") == 0) |
| 650 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = fontmn2cxx . . $ fontmn2.; |
| 651 | else { |
| 652 | LOG_WARNcxx . . $ `src/io/log.h:77:9`!("ESceneFontDefine: Unknown font name, using font2"); |
| 653 | sceneFont.fontcxx . . $ JJ1SceneFont#font. = font2cxx . . $ font2.; |
| 654 | } |
| 655 | |
| 656 | delete[] fontname; |
| 657 | } |
| 658 | break; |
| 659 | |
| 660 | case ESceneTextPositioncxx . . $ ESceneTextPosition.: |
| 661 | |
| 662 | textPosX = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 663 | textPosY = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 664 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextPosition: x %d, y %d", textPosX, textPosY); |
| 665 | |
| 666 | break; |
| 667 | |
| 668 | case ESceneTextColourcxx . . $ ESceneTextColour.: |
| 669 | |
| 670 | textColour = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 671 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextColour: %d", textColour); |
| 672 | |
| 673 | break; |
| 674 | |
| 675 | case ESceneFontFuncxx . . $ ESceneFontFun.: |
| 676 | { |
| 677 | LOG_TRACEcxx . . $ `src/io/log.h:74:9`!("Unimplemented ESceneFontFun len: %d", f->loadShort()); |
| 678 | |
| 679 | /*while (len) { |
| 680 | |
| 681 | unsigned char data = f->loadChar(); |
| 682 | len--; |
| 683 | |
| 684 | }*/ |
| 685 | } |
| 686 | break; |
| 687 | |
| 688 | case ESceneFontIndexcxx . . $ ESceneFontIndex.: |
| 689 | |
| 690 | textFont = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 691 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneFontIndex: %d", textFont); |
| 692 | |
| 693 | break; |
| 694 | |
| 695 | case ESceneTextVAdjustcxx . . $ ESceneTextVAdjust.: |
| 696 | |
| 697 | extraheight = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 698 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextVAdjust: %d", extraheight); |
| 699 | |
| 700 | break; |
| 701 | |
| 702 | case ESceneBackgroundFadecxx . . $ ESceneBackgroundFade.: |
| 703 | { |
| 704 | page.backgroundFadecxx . . $ JJ1ScenePage#backgroundFade. = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 705 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneBackgroundFade: %d", page.backgroundFade); |
| 706 | } |
| 707 | break; |
| 708 | |
| 709 | case ESceneTextShadowcxx . . $ ESceneTextShadow.: |
| 710 | { |
| 711 | char enableShadow = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 712 | if(enableShadow) { |
| 713 | textShadow = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 714 | } else { |
| 715 | f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); // Skip this value since shadows are turned off |
| 716 | textShadow = -1; // Turn off shadow , -1 means no shadow colour |
| 717 | } |
| 718 | |
| 719 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextShadow: %d", textShadow); |
| 720 | } |
| 721 | break; |
| 722 | |
| 723 | case ESceneTextAligncxx . . $ ESceneTextAlign.: |
| 724 | |
| 725 | textAlignment = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 726 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("ESceneTextAlign: %d", textAlignment); |
| 727 | |
| 728 | break; |
| 729 | |
| 730 | case ESceneTextAlign2cxx . . $ ESceneTextAlign2.: |
| 731 | { |
| 732 | char a = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 733 | int b = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 734 | LOG_TRACEcxx . . $ `src/io/log.h:74:9`!("Unimplemented ESceneTextAlign2: a 0x%x, b 0x%x", a, b); |
| 735 | } |
| 736 | break; |
| 737 | |
| 738 | case ESceneTextSomethingcxx . . $ ESceneTextSomething.: |
| 739 | { |
| 740 | char a = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 741 | int b = f->loadShortcxx . . $ File#loadShort(32a7769d58713265).(); |
| 742 | LOG_TRACEcxx . . $ `src/io/log.h:74:9`!("Unimplemented ESceneTextSomething: a 0x%x, b 0x%x", a, b); |
| 743 | } |
| 744 | break; |
| 745 | |
| 746 | case ESceneTextLinecxx . . $ ESceneTextLine.: |
| 747 | case ESceneTextBlockcxx . . $ ESceneTextBlock.: |
| 748 | { |
| 749 | unsigned char datalen = f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 750 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("Text len: %d", datalen); |
| 751 | |
| 752 | page.textscxx . . $ JJ1ScenePage#texts..emplace_backcxx . . $ std/__cxx11/list#emplace_back(b3d147e3bb711c35).(); |
| 753 | auto &sceneText = page.textscxx . . $ JJ1ScenePage#texts..backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).(); |
| 754 | |
| 755 | if (datalen > 0) { |
| 756 | sceneText.textcxx . . $ JJ1SceneText#text. = reinterpret_cast<unsigned char *>(f->loadStringcxx . . $ File#loadString(ff224f080444ee45).(datalen)); |
| 757 | |
| 758 | // Convert number placeholders |
| 759 | if (type == ESceneTextLinecxx . . $ ESceneTextLine.) { |
| 760 | for (int textPos = 1; textPos < datalen; textPos++) { |
| 761 | |
| 762 | if (sceneText.textcxx . . $ JJ1SceneText#text.[textPos] == 0x8B) { |
| 763 | // Current page |
| 764 | if (loop >= 9) |
| 765 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos - 1] = ((loop + 1) / 10) + 53; |
| 766 | |
| 767 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos] = ((loop + 1) % 10) + 53; |
| 768 | } else if (sceneText.textcxx . . $ JJ1SceneText#text.[textPos] == 0x8A) { |
| 769 | // Number of pages |
| 770 | if (scriptItemscxx . . $ JJ1Scene#scriptItems. >= 10) |
| 771 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos - 1] = (scriptItemscxx . . $ JJ1Scene#scriptItems. / 10) + 53; |
| 772 | |
| 773 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos] = (scriptItemscxx . . $ JJ1Scene#scriptItems. % 10) + 53; |
| 774 | } else if (sceneText.textcxx . . $ JJ1SceneText#text.[textPos] == 0x8C) { |
| 775 | // FIXME: seems not used at all |
| 776 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos-2] = '0'; |
| 777 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos-1] = '0'; |
| 778 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos] = '0'; |
| 779 | } else if (sceneText.textcxx . . $ JJ1SceneText#text.[textPos] > 0x8C) { |
| 780 | // internal |
| 781 | sceneText.textcxx . . $ JJ1SceneText#text.[textPos] = '0'; |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | sceneText.alignmentcxx . . $ JJ1SceneText#alignment. = textAlignment; |
| 788 | sceneText.fontIdcxx . . $ JJ1SceneText#fontId. = textFont; |
| 789 | sceneText.textColourcxx . . $ JJ1SceneText#textColour. = textColour; |
| 790 | sceneText.shadowColourcxx . . $ JJ1SceneText#shadowColour. = textShadow; |
| 791 | |
| 792 | if(textPosX != -1) { |
| 793 | |
| 794 | sceneText.xcxx . . $ JJ1SceneText#x. = textPosX; |
| 795 | sceneText.ycxx . . $ JJ1SceneText#y. = textPosY; |
| 796 | textPosX = -1; |
| 797 | textPosY = -1; |
| 798 | |
| 799 | } |
| 800 | |
| 801 | if(textRectValid) { |
| 802 | |
| 803 | sceneText.textRectcxx . . $ JJ1SceneText#textRect. = textRect; |
| 804 | textRectValid = false; |
| 805 | |
| 806 | } |
| 807 | |
| 808 | if(extraheight != -1) { |
| 809 | |
| 810 | sceneText.extraLineHeightcxx . . $ JJ1SceneText#extraLineHeight. = extraheight; |
| 811 | extraheight = -1; |
| 812 | |
| 813 | } |
| 814 | } |
| 815 | |
| 816 | break; |
| 817 | |
| 818 | case ESceneTimecxx . . $ ESceneTime.: |
| 819 | |
| 820 | page.pageTimecxx . . $ JJ1ScenePage#pageTime. = (f->loadShortcxx . . $ File#loadShort(32a7769d58713265).()); |
| 821 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("Scene time: %d", page.pageTime); |
| 822 | page.pageTimecxx . . $ JJ1ScenePage#pageTime.&=255; |
| 823 | break; |
| 824 | |
| 825 | case ESceneBreakercxx . . $ ESceneBreaker.: |
| 826 | case 0x3e: |
| 827 | |
| 828 | pos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 829 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("Parse script end at position: %d, with: 0x%x", pos, type); |
| 830 | breakloop = true; |
| 831 | f->loadCharcxx . . $ File#loadChar(7c4be072098b358f).(); |
| 832 | |
| 833 | break; |
| 834 | |
| 835 | default: |
| 836 | |
| 837 | pos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 838 | LOG_SCRIPTcxx . . $ `src/jj1/scene/jj1sceneload.cpp:62:10`!("Parse script end at position: %d, breaker: 0x%x", pos, type); |
| 839 | breakloop = true; |
| 840 | |
| 841 | break; |
| 842 | |
| 843 | } |
| 844 | |
| 845 | pos = f->tellcxx . . $ File#tell(b126dc7c1de90089).(); |
| 846 | |
| 847 | } |
| 848 | |
| 849 | } |
| 850 | |
| 851 | loop++; |
| 852 | } |
| 853 | |
| 854 | } |