diff --git a/src/lara.h b/src/lara.h index 045204f..53c0456 100644 --- a/src/lara.h +++ b/src/lara.h @@ -747,18 +747,18 @@ struct Lara : Controller { virtual int getInputMask() { mask = 0; int &p = Input::joy.POV; - if (Input::down[ikW] || p == 8 || p == 1 || p == 2) mask |= FORTH; - if (Input::down[ikD] || p == 2 || p == 3 || p == 4) mask |= RIGHT; - if (Input::down[ikS] || p == 4 || p == 5 || p == 6) mask |= BACK; - if (Input::down[ikA] || p == 6 || p == 7 || p == 8) mask |= LEFT; - if (Input::down[ikJoyB]) mask = FORTH | BACK; // roll - if (Input::down[ikJoyRT]) mask = WALK | RIGHT; // step right - if (Input::down[ikJoyLT]) mask = WALK | LEFT; // step left - if (Input::down[ikSpace] || Input::down[ikJoyX]) mask |= JUMP; - if (Input::down[ikShift] || Input::down[ikJoyLB]) mask |= WALK; - if (Input::down[ikE] || Input::down[ikMouseL] || Input::down[ikJoyA]) mask |= ACTION; - if (Input::down[ikQ] || Input::down[ikMouseR] || Input::down[ikJoyY]) mask |= WEAPON; - if (health <= 0) mask = DEATH; + if (Input::down[ikW] || Input::down[ikUp] || p == 8 || p == 1 || p == 2) mask |= FORTH; + if (Input::down[ikD] || Input::down[ikRight] || p == 2 || p == 3 || p == 4) mask |= RIGHT; + if (Input::down[ikS] || Input::down[ikDown] || p == 4 || p == 5 || p == 6) mask |= BACK; + if (Input::down[ikA] || Input::down[ikLeft] || p == 6 || p == 7 || p == 8) mask |= LEFT; + if (Input::down[ikJoyB]) mask = FORTH | BACK; // roll + if (Input::down[ikJoyRT] || Input::down[ikX]) mask = WALK | RIGHT; // step right + if (Input::down[ikJoyLT] || Input::down[ikZ]) mask = WALK | LEFT; // step left + if (Input::down[ikSpace] || Input::down[ikJoyX]) mask |= JUMP; + if (Input::down[ikShift] || Input::down[ikJoyLB]) mask |= WALK; + if (Input::down[ikE] || Input::down[ikCtrl] || Input::down[ikJoyA]) mask |= ACTION; + if (Input::down[ikQ] || Input::down[ikAlt] || Input::down[ikJoyY]) mask |= WEAPON; + if (health <= 0) mask = DEATH; return mask; } diff --git a/src/mesh.h b/src/mesh.h index c561eba..e579e88 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -224,8 +224,8 @@ struct MeshBuilder { spriteSequences[i].iCount = level.spriteSequences[i].sCount * 6; iCount += level.spriteSequences[i].sCount * 6; vCount += level.spriteSequences[i].sCount * 4; - aCount += level.spriteSequences[i].sCount; - } + } + aCount += level.spriteSequencesCount; // get size of simple shadow spot mesh (8 triangles, 8 vertices) shadowBlob.vStart = vCount; @@ -444,7 +444,7 @@ struct MeshBuilder { for (int i = 0; i < level.spriteSequencesCount; i++) for (int j = 0; j < level.spriteSequences[i].sCount; j++) { TR::SpriteTexture &sprite = level.spriteTextures[level.spriteSequences[i].sStart + j]; - addSprite(indices, vertices, iCount, vCount, vCount, 0, 0, 0, sprite, 255); + addSprite(indices, vertices, iCount, vCount, spriteSequences[i].vStart, 0, 0, 0, sprite, 255); } // build shadow spot @@ -483,16 +483,7 @@ struct MeshBuilder { } for (int i = 0; i < level.spriteSequencesCount; i++) - for (int j = 0; j < spriteSequences[i].iCount / 6; j++) { // init VAO for each frame - MeshRange range = spriteSequences[i]; - range.iCount = 6; - range.iStart += j * 6; - range.vStart += j * 4; - mesh->initRange(range); - if (j == 0) - spriteSequences[i].aIndex = range.aIndex; - } - + mesh->initRange(spriteSequences[i]); for (int i = 0; i < mCount; i++) mesh->initRange(meshInfo[i]); mesh->initRange(shadowBlob); @@ -671,7 +662,8 @@ struct MeshBuilder { void renderSprite(int sequenceIndex, int frame) { MeshRange range = spriteSequences[sequenceIndex]; - range.aIndex += frame; + range.iCount = 6; + range.iStart += frame * 6; mesh->render(range); } diff --git a/src/platform/web/index.html b/src/platform/web/index.html index 271abc4..974340e 100644 --- a/src/platform/web/index.html +++ b/src/platform/web/index.html @@ -5,7 +5,7 @@ Starting...


- OpenLara on github
(controls: move - WASD, jump - Space, action - E/MouseL, walk - Shift, camera - MouseR)
+ OpenLara on github
(controls -> gamepad or keyboad: move - WASD / arrows, jump - Space, action - E/Ctrl, walk - Shift, side steps - ZX/walk+direction, camera - MouseR)