1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-16 10:04:28 +02:00
This commit is contained in:
XProger
2017-11-28 10:44:07 +03:00
7 changed files with 18 additions and 13 deletions

View File

@@ -946,7 +946,7 @@ struct Controller {
vec3 center = getBoundingBox().center(); vec3 center = getBoundingBox().center();
float maxAtt = 0.0f; float maxAtt = 0.0f;
/*
if (room.flags.sky) { // TODO trace rooms up for sun light, add direct light projection if (room.flags.sky) { // TODO trace rooms up for sun light, add direct light projection
sunLight.x = int32(center.x); sunLight.x = int32(center.x);
sunLight.y = int32(center.y) - 8192; sunLight.y = int32(center.y) - 8192;
@@ -955,6 +955,8 @@ struct Controller {
sunLight.radius = 1000 * 1024; sunLight.radius = 1000 * 1024;
targetLight = &sunLight; targetLight = &sunLight;
} else { } else {
*/
{
for (int i = 0; i < room.lightsCount; i++) { for (int i = 0; i < room.lightsCount; i++) {
TR::Room::Light &light = room.lights[i]; TR::Room::Light &light = room.lights[i];
if ((light.color.r | light.color.g | light.color.b) == 0) continue; if ((light.color.r | light.color.g | light.color.b) == 0) continue;

View File

@@ -466,7 +466,7 @@ namespace Debug {
Controller *controller = (Controller*)e.controller; Controller *controller = (Controller*)e.controller;
if (!controller || controller->flags.invisible) return; if (!controller || controller->flags.invisible) return;
sprintf(buf, "%s (%d)", getEntityName(level, e), (int)e.type, i); sprintf(buf, "%s (%d)", getEntityName(level, e), i);
Debug::Draw::text(controller->pos + randf() * 64, controller->flags.active ? vec4(0, 0, 0.8f, 1) : vec4(0.8f, 0, 0, 1), buf); Debug::Draw::text(controller->pos + randf() * 64, controller->flags.active ? vec4(0, 0, 0.8f, 1) : vec4(0.8f, 0, 0, 1), buf);
} }

View File

@@ -106,7 +106,11 @@ namespace Game {
Input::down[ikL] = false; Input::down[ikL] = false;
} }
*/ */
Core::deltaTime = delta = min(0.2f, delta);
if (!level->level.isCutsceneLevel())
delta = min(0.2f, delta);
Core::deltaTime = delta;
UI::update(); UI::update();
while (delta > EPS) { while (delta > EPS) {

View File

@@ -409,7 +409,7 @@ struct Lara : Character {
} }
void render(MeshBuilder *mesh) { void render(MeshBuilder *mesh) {
Core::active.shader->setParam(uBasis, basis[0], jointsCount); Core::active.shader->setParam(uBasis, basis[0], jointsCount - 1);
mesh->renderModel(lara->level->extra.braid); mesh->renderModel(lara->level->extra.braid);
} }
@@ -2595,7 +2595,8 @@ struct Lara : Character {
if (level->isCutsceneLevel()) { if (level->isCutsceneLevel()) {
updateAnimation(true); updateAnimation(true);
vec3 p = getPos(); vec3 p = pos;
pos = getPos();
//checkRoom(); //checkRoom();
updateLights(); updateLights();
pos = p; pos = p;

View File

@@ -68,10 +68,7 @@ struct Level : IGame {
strcat(buf, "3/"); strcat(buf, "3/");
strcat(buf, TR::LEVEL_INFO[id].name); strcat(buf, TR::LEVEL_INFO[id].name);
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
if (level.version & TR::VER_TR3) strcat(buf, ".PSX");
strcat(buf, ".TR2");
else
strcat(buf, ".PSX");
#else #else
switch (level.version) { switch (level.version) {
case TR::VER_TR1_PC : strcat(buf, ".PHD"); break; case TR::VER_TR1_PC : strcat(buf, ".PHD"); break;
@@ -558,10 +555,11 @@ struct Level : IGame {
case TR::VER_TR3_PSX : case TR::VER_TR3_PSX :
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
playAsync(Sound::openWAD(NULL, track), this); playAsync(Sound::openWAD(NULL, track), this);
return;
#else #else
sprintf(title, "audio/3/track_%02d.ogg", int(track)); sprintf(title, "audio/3/track_%02d.ogg", int(track));
#endif #endif
return; break;
default : return; default : return;
} }

View File

@@ -2,7 +2,7 @@
cls cls
set SRC=main.cpp ../../libs/stb_vorbis/stb_vorbis.c set SRC=main.cpp ../../libs/stb_vorbis/stb_vorbis.c
set PROJ=OpenLara set PROJ=OpenLara
set FLAGS=-O3 -Wno-deprecated-register --llvm-opts 2 -fmax-type-align=2 -std=c++11 -Wall -I../../ set FLAGS=-O3 -Wno-deprecated-register --llvm-opts 2 -fmax-type-align=2 -std=c++11 -s ALLOW_MEMORY_GROWTH=1 -Wall -I../../
echo. echo.
call em++ %SRC% %FLAGS% -o %PROJ%.js --preload-file ./level/TITLE.PSX --preload-file ./level/TITLEH.PCX --preload-file ./audio/dummy call em++ %SRC% %FLAGS% -o %PROJ%.js --preload-file ./level/TITLE.PSX --preload-file ./level/TITLEH.PCX --preload-file ./audio/dummy --preload-file ./level/2/dummy --preload-file ./level/3/dummy --preload-file ./audio/2/dummy --preload-file ./audio/3/dummy
gzip.exe -9 -f %PROJ%.data %PROJ%.js %PROJ%.js.mem gzip.exe -9 -f %PROJ%.data %PROJ%.js %PROJ%.js.mem

View File

@@ -682,7 +682,7 @@ namespace Sound {
} }
Stream *openWAD(const char *name, int index = -1) { Stream *openWAD(const char *name, int index = -1) {
Stream *stream = new Stream("cdaudio.wad"); Stream *stream = new Stream("audio/3/cdaudio.wad");
if (stream->size) { if (stream->size) {
struct Item { struct Item {
char name[260]; char name[260];