1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-11 07:34:33 +02:00

fix running jump for TR2 & TR3

This commit is contained in:
XProger
2019-01-13 09:30:35 +03:00
parent e1b9b9d2c1
commit fd65596235

View File

@@ -68,6 +68,8 @@ struct Lara : Character {
// http://www.tombraiderforums.com/showthread.php?t=148859 // http://www.tombraiderforums.com/showthread.php?t=148859
enum { enum {
ANIM_RUN = 0,
ANIM_STAND_LEFT = 2, ANIM_STAND_LEFT = 2,
ANIM_STAND_RIGHT = 3, ANIM_STAND_RIGHT = 3,
@@ -276,8 +278,6 @@ struct Lara : Character {
JOINT_MASK_BRAID = JOINT_MASK_HEAD | JOINT_MASK_CHEST | JOINT_MASK_ARM_L1 | JOINT_MASK_ARM_L2 | JOINT_MASK_ARM_R1 | JOINT_MASK_ARM_R2, JOINT_MASK_BRAID = JOINT_MASK_HEAD | JOINT_MASK_CHEST | JOINT_MASK_ARM_L1 | JOINT_MASK_ARM_L2 | JOINT_MASK_ARM_R1 | JOINT_MASK_ARM_R2,
}; };
bool dozy;
struct Weapon { struct Weapon {
enum State { IS_HIDDEN, IS_ARMED, IS_FIRING }; enum State { IS_HIDDEN, IS_ARMED, IS_FIRING };
struct Anim { struct Anim {
@@ -322,6 +322,9 @@ struct Lara : Character {
float hitTimer; float hitTimer;
bool dozy;
bool canJump;
int32 networkInput; int32 networkInput;
#ifdef _DEBUG #ifdef _DEBUG
@@ -495,13 +498,16 @@ struct Lara : Character {
} *braid; } *braid;
Lara(IGame *game, int entity) : Character(game, entity, LARA_MAX_HEALTH), dozy(false), wpnCurrent(TR::Entity::NONE), wpnNext(TR::Entity::NONE), braid(NULL) { Lara(IGame *game, int entity) : Character(game, entity, LARA_MAX_HEALTH), wpnCurrent(TR::Entity::NONE), wpnNext(TR::Entity::NONE), braid(NULL) {
camera = new Camera(game, this); camera = new Camera(game, this);
itemHolster = TR::Entity::NONE; itemHolster = TR::Entity::NONE;
hitTimer = 0.0f; hitTimer = 0.0f;
networkInput = -1; networkInput = -1;
dozy = false;
canJump = true;
if (level->extra.laraSkin > -1) if (level->extra.laraSkin > -1)
level->entities[entity].modelIndex = level->extra.laraSkin + 1; level->entities[entity].modelIndex = level->extra.laraSkin + 1;
@@ -2519,11 +2525,23 @@ struct Lara : Character {
return res; return res;
} }
if (state == STATE_RUN) {
if (animation.index == ANIM_RUN_START) {
canJump = false;
} else if (animation.index == ANIM_RUN) {
if (animation.frameIndex >= 4 && animation.frameIndex <= 5) {
canJump = true;
}
} else {
canJump = true;
}
}
// jump button is pressed // jump button is pressed
if (input & JUMP) { if (input & JUMP) {
if ((input & FORTH) && state == STATE_FORWARD_JUMP) if ((input & FORTH) && state == STATE_FORWARD_JUMP)
return STATE_RUN; return STATE_RUN;
if (state == STATE_RUN) if (state == STATE_RUN && canJump)
return STATE_FORWARD_JUMP; return STATE_FORWARD_JUMP;
if (animation.index == ANIM_SLIDE_BACK) // TODO: animation index? %) if (animation.index == ANIM_SLIDE_BACK) // TODO: animation index? %)
return STATE_SLIDE_BACK; return STATE_SLIDE_BACK;