22 if (version != 0x20) {
27 if (unfinishedBusiness)
42 if (unfinishedBusiness)
53 if (!unfinishedBusiness)
67 for (
int i = 0; i < 256; i++) {
73 static const uint8_t lightFactor = 4;
78 glm::vec4 c(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
85 for (
unsigned int i = 0; i < numTextures; i++) {
86 std::array<uint8_t, 256 * 256> arr;
104 for (
unsigned int l = 0; l < numLights; l++) {
119 for (
unsigned int s = 0; s < numStaticMeshes; s++) {
136 staticModels.push_back(
new StaticModel(glm::vec3(x, y, z),
137 glm::radians((rotation >> 14) * 90.0f),
153 for (
unsigned int i = 0; i < numItems; i++) {
170 static_cast<float>(x),
171 static_cast<float>(y),
172 static_cast<float>(z)
177 glm::radians(((angle >> 14) & 0x03) * 90.0f),
197 for (
unsigned int b = 0; b < numBoxes; b++) {
214 std::vector<std::vector<uint16_t>> overlaps;
215 overlaps.emplace_back();
216 unsigned int list = 0;
217 for (
unsigned int o = 0; o < numOverlaps; o++) {
222 overlaps.at(list).push_back(e);
224 overlaps.emplace_back();
231 for (
unsigned int z = 0; z < numBoxes; z++) {
245 if ((numBoxes > 0) || (numOverlaps > 0))
247 <<
", " << numOverlaps <<
", " << list <<
"), unimplemented!" <<
Log::endl;
253 for (
int i = 0; i < 256; i++) {
260 std::vector<uint8_t> buffer;
261 for (
int i = 0; i < soundSampleSize; i++) {
266 for (
unsigned int i = 0; i < numSampleIndices; i++) {
270 char* tmpPtr =
reinterpret_cast<char*
>(&buffer[sampleOffset]);
271 BinaryMemory sample(tmpPtr, soundSampleSize - sampleOffset);
276 if (numSampleIndices > 0)
287 uint16_t startingMesh, uint32_t meshTree,
288 uint32_t numMeshTrees, std::vector<int32_t> meshTrees) {
296 uint16_t numValues = frame.
readU16();
298 for (
int i = 0; i < numValues; i++) {
299 int mesh = startingMesh + i;
300 glm::vec3 offset(0.0f, 0.0f, 0.0f);
301 float rotation[3] = { 0.0f, 0.0f, 0.0f };
302 char flag = (i == 0) ? 2 : 0;
306 char* tmp =
reinterpret_cast<char*
>(&meshTrees[0]) + meshTree;
308 BinaryMemory tree(tmp, (numMeshTrees * 4) - meshTree - ((i - 1) * 16));
317 rotation[0] = (a & 0x3FF0) >> 4;
318 rotation[1] = ((a & 0x000F) << 6) | ((b & 0xFC00) >> 10);
319 rotation[2] = b & 0x03FF;
320 for (
int i = 0; i < 3; i++)
321 rotation[i] = rotation[i] * 360.0f / 1024.0f;
324 glm::vec3 rot(rotation[0], rotation[1], rotation[2]);
virtual void loadTextures()
String handling utilities.
virtual void loadAnimatedTextures()
virtual int load(std::string f)
virtual void loadAngleSet(BoneFrame *bf, BinaryReader &frame, uint16_t numMeshes, uint16_t startingMesh, uint32_t meshTree, uint32_t numMeshTrees, std::vector< int32_t > meshTrees)
virtual void loadSoundSources()
virtual void loadRoomStaticMeshes(std::vector< StaticModel * > &staticModels)
virtual int loadSoundFiles(BinaryReader &sfx, unsigned int count=0)
virtual void loadCinematicFrames()
virtual void seek(long long pos=0)
static LogLevel & get(int level)
virtual void loadTextiles()
virtual void loadMeshes()
virtual void loadStaticMeshes()
bool stringEndsWith(std::string s, std::string suffix, bool casesensitive=false)
static void addIndexedTexture(unsigned char *image, unsigned int width, unsigned int height)
virtual void loadSoundMap()
virtual void loadSoundSamples()
static void addSampleIndex(int index)
virtual void loadPalette()
virtual void loadSprites()
virtual void loadCameras()
virtual uint16_t readU16()
static void addSoundMapEntry(int id)
virtual void loadBoxesOverlapsZones()
virtual void loadMoveables()
virtual void loadSoundDetails()
#define assertEqual(x, y)
virtual int getPaletteIndex(uint16_t index)
virtual uint32_t readU32()
static void setLara(long lara)
virtual void loadDemoData()
virtual void loadRoomVertex(RoomVertexTR2 &vert)
static void setPalette(int index, glm::vec4 color)
void addEntity(Entity *entity)
#define assertLessThan(x, y)
virtual void loadFloorData()
virtual void loadRoomLights()
int open(std::string f="")