1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-13 16:44:50 +02:00

#3 fix frame bbox calculation in air

This commit is contained in:
XProger
2016-10-16 21:30:05 +03:00
parent dddcbd13c5
commit 1a77c2281c
4 changed files with 4 additions and 4 deletions

View File

@@ -955,11 +955,11 @@ struct Lara : Controller {
break;
case STAND_AIR : {
int fSize = sizeof(TR::AnimFrame) + getModel().mCount * sizeof(uint16) * 2;
TR::AnimFrame *frame = (TR::AnimFrame*)&level->frameData[(anim->frameOffset + (int(animTime * 30.0f / anim->frameRate) * fSize) / 2)];
TR::AnimFrame *frame = (TR::AnimFrame*)&level->frameData[((anim->frameOffset + (int(animTime * 30.0f / anim->frameRate) * fSize)) >> 1)];
f = info.floor - (p.y + frame->box.maxY);
c = (p.y + frame->box.minY) - info.ceiling;
canPassGap = f >= -256 && c >= (state == STATE_UP_JUMP ? 0.0f : -256);
canPassGap = f >= -256 && c >= (state == STATE_UP_JUMP ? 0.0f : -256);
break;
}
case STAND_ONWATER : {

View File

@@ -618,7 +618,7 @@ struct Level {
// Debug::Level::rooms(level, lara->pos, lara->getEntity().room);
// Debug::Level::lights(level);
// Debug::Level::portals(level);
// Debug::Level::meshes(level);
Debug::Level::meshes(level);
// Debug::Level::entities(level);
Debug::Level::info(level, lara->getEntity(), (int)lara->state, lara->animIndex, int(lara->animTime * 30.0f));
Debug::end();

View File

@@ -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></span>
<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>
<script type='text/javascript'>
var statusElement = document.getElementById('status');