mirror of
https://github.com/XProger/OpenLara.git
synced 2025-04-21 19:41:53 +02:00
This commit is contained in:
parent
f108518de9
commit
4390eb9a96
24
src/lara.h
24
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;
|
||||
}
|
||||
|
||||
|
20
src/mesh.h
20
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);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<span id="status">Starting...</span>
|
||||
<input type="button" value="fullscreen" onclick="Module.requestFullScreen(false, true)"><br><br>
|
||||
<canvas id="canvas" width="160" height="120" oncontextmenu="event.preventDefault()"></canvas><br>
|
||||
<span id="info"><a target="_blank" href="https://github.com/XProger/OpenLara">OpenLara on github</a><br>(controls: move - WASD, jump - Space, action - E/MouseL, walk - Shift, camera - MouseR)</span>
|
||||
<span id="info"><a target="_blank" href="https://github.com/XProger/OpenLara">OpenLara on github</a><br>(controls -> gamepad or keyboad: move - WASD / arrows, jump - Space, action - E/Ctrl, walk - Shift, side steps - ZX/walk+direction, camera - MouseR)</span>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var statusElement = document.getElementById('status');
|
||||
|
Loading…
x
Reference in New Issue
Block a user