1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-01-17 21:09:00 +01:00

#8 PSX cutscenes support

This commit is contained in:
XProger 2016-12-31 02:56:01 +03:00
parent b0e380e064
commit acb31d366e
3 changed files with 23 additions and 27 deletions

Binary file not shown.

View File

@ -824,11 +824,10 @@ namespace TR {
int16 weapons[4];
} extra;
Level(Stream &stream, bool demo) : cutEntity(-1) {
tiles4 = NULL;
Tile8 *tiles8 = NULL;
cluts = NULL;
palette = NULL;
Level(Stream &stream, bool demo) {
memset(this, 0, sizeof(*this));
cutEntity = -1;
Tile8 *tiles8 = NULL;
int soundOffset = 0;
@ -837,8 +836,8 @@ namespace TR {
soundOffset = version;
stream.read(version);
}
if (version != VER_TR1_PC && version != VER_TR1_PSX) {
if (version && version != VER_TR1_PC && version != VER_TR1_PSX) {
LOG("unsupported level format\n");
ASSERT(false);
memset(this, 0, sizeof(*this));
@ -868,19 +867,21 @@ namespace TR {
// sound data
stream.setPos(2600 + numSounds * 512);
stream.read(soundData, soundDataSize);
// tiles
stream.setPos(offsetTexTiles + 8);
stream.read(tiles4, tilesCount = 13);
stream.read(cluts, 512);
stream.seek(0x4000 + 4);
} else {
soundSize = NULL;
stream.setPos(offsetTexTiles + 8);
} else if (version == VER_TR1_PC) {
// tiles
stream.read(tiles8, stream.read(tilesCount));
stream.read(unused);
}
if (!version /*PSX cutscene*/ || version == VER_TR1_PSX) {
version = VER_TR1_PSX;
// tiles
stream.read(tiles4, tilesCount = 13);
stream.read(cluts, 512);
stream.seek(0x4000 + 4);
}
// rooms
rooms = new Room[stream.read(roomsCount)];
for (int i = 0; i < roomsCount; i++) {
@ -994,11 +995,10 @@ namespace TR {
if (!demo)
stream.read(palette, 256);
// cinematic frames for cameras (PC)
stream.read(cameraFrames, stream.read(cameraFramesCount));
stream.read(cameraFrames, stream.read(cameraFramesCount));
// demo data
stream.read(demoData, stream.read(demoDataSize));
} else
demoData = NULL;
stream.read(demoData, stream.read(demoDataSize));
}
// sounds
stream.read(soundsMap, 256);
@ -1008,8 +1008,10 @@ namespace TR {
stream.read(soundOffsets, stream.read(soundOffsetsCount));
}
// cinematic frames for cameras (PSX)
if (version == VER_TR1_PSX)
stream.read(cameraFrames, stream.read(cameraFramesCount));
if (version == VER_TR1_PSX) {
stream.seek(4); // unknown 4 bytes always == 6
stream.read(cameraFrames, stream.read(cameraFramesCount));
}
initTiles(tiles4, tiles8, palette, cluts);

View File

@ -1,8 +1,6 @@
#ifndef H_GAME_TR
#define H_GAME_TR
//#define FREE_CAMERA
#include "core.h"
#include "format.h"
#include "level.h"
@ -17,7 +15,6 @@ namespace Game {
#ifndef __EMSCRIPTEN__
//Sound::play(Sound::openWAD("05_Lara's_Themes.wav"), 1, 1, 0);
Sound::play(new Stream(sndName), vec3(0.0f), 1, 1, Sound::Flags::LOOP);
//Sound::play(new Stream("03.mp3"), 1, 1, 0);
#endif
}
@ -32,9 +29,6 @@ namespace Game {
if (!lvlName) lvlName = (char*)"LEVEL2.PSX";
if (!sndName) sndName = (char*)"05.ogg";
//lstartLevel("LEVEL2_DEMO.PHD", true, false);
//lstartLevel("GYM.PSX", false, true);
//lstartLevel("LEVEL3A.PHD", false, false);
startLevel(lvlName, sndName, false, false);
}