lara: add TR2+ swimming option

This commit is contained in:
pas-de-2 2024-07-31 13:51:57 -04:00 committed by Marcin Kurczewski
parent 4411e140e7
commit 0e27908821
13 changed files with 103 additions and 27 deletions

View file

@ -1,6 +1,7 @@
## [Unreleased](https://github.com/LostArtefacts/TR1X/compare/stable...develop) - ××××-××-××
- added deadly water feature from TR2+ for custom levels (#1404)
- added skybox support, with a default option provided for Lost Valley, Colosseum and Obelisk of Khamoon (#94)
- added an option for Lara to use her underwater swimming physics from TR2+ (#1003)
- changed the turbo cheat to no longer affect the gameplay time (#1420)
- fixed adjacent Midas Touch objects potentially allowing gold bar duplication in custom levels (#1415)
- fixed the excessive pitch and playback speed correction for music files with sampling rate other than 44100 Hz (#1417, regression from 2.0)

View file

@ -449,6 +449,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- added ability to jump at any point while running like in TR2+
- added ability to automatically walk to items when nearby
- added ability to roll while underwater like in TR2+
- added ability to use Lara's underwater swimming physics from TR2+
- added a pause screen
- added a choice whether to play NG or NG+ without having to play the entire game
- added Japanese mode (guns deal twice the damage, inspired by JP release of TR3); available for both NG and NG+

View file

@ -77,6 +77,7 @@ typedef struct {
bool fix_texture_issues;
bool enable_swing_cancel;
bool enable_tr2_jumping;
bool enable_tr2_swimming;
bool load_current_music;
bool load_music_triggers;
bool fix_item_rots;

View file

@ -70,6 +70,7 @@ CFG_INT32(camera_speed, 5)
CFG_BOOL(fix_texture_issues, true)
CFG_BOOL(enable_swing_cancel, true)
CFG_BOOL(enable_tr2_jumping, false)
CFG_BOOL(enable_tr2_swimming, false)
CFG_BOOL(load_current_music, true)
CFG_BOOL(load_music_triggers, true)
CFG_BOOL(fix_item_rots, true)

View file

@ -345,16 +345,21 @@ void Lara_HandleUnderwater(ITEM_INFO *item, COLL_INFO *coll)
item->rot.z -= 2 * LARA_LEAN_UNDO;
}
if (item->rot.x < -100 * PHD_DEGREE) {
item->rot.x = -100 * PHD_DEGREE;
} else if (item->rot.x > 100 * PHD_DEGREE) {
item->rot.x = 100 * PHD_DEGREE;
}
if (g_Config.enable_tr2_swimming) {
CLAMP(item->rot.x, -85 * PHD_DEGREE, 85 * PHD_DEGREE);
CLAMP(item->rot.z, -LARA_LEAN_MAX_UW, LARA_LEAN_MAX_UW);
if (item->rot.z < -LARA_LEAN_MAX_UW) {
item->rot.z = -LARA_LEAN_MAX_UW;
} else if (item->rot.z > LARA_LEAN_MAX_UW) {
item->rot.z = LARA_LEAN_MAX_UW;
if (g_Lara.turn_rate < -LARA_TURN_UNDO) {
g_Lara.turn_rate += LARA_TURN_UNDO;
} else if (g_Lara.turn_rate > LARA_TURN_UNDO) {
g_Lara.turn_rate -= LARA_TURN_UNDO;
} else {
g_Lara.turn_rate = 0;
}
item->rot.y += g_Lara.turn_rate;
} else {
CLAMP(item->rot.x, -100 * PHD_DEGREE, 100 * PHD_DEGREE);
CLAMP(item->rot.z, -LARA_LEAN_MAX_UW, LARA_LEAN_MAX_UW);
}
if (g_Lara.current_active && g_Lara.water_status != LWS_CHEAT) {

View file

@ -1025,12 +1025,24 @@ void Lara_State_Swim(ITEM_INFO *item, COLL_INFO *coll)
if (g_Input.back) {
item->rot.x += 2 * PHD_DEGREE;
}
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
if (g_Config.enable_tr2_swimming) {
if (g_Input.left) {
g_Lara.turn_rate -= LARA_TURN_RATE;
CLAMPL(g_Lara.turn_rate, -LARA_MED_TURN);
item->rot.z -= LARA_LEAN_RATE_SWIM;
} else if (g_Input.right) {
g_Lara.turn_rate += LARA_TURN_RATE;
CLAMPG(g_Lara.turn_rate, LARA_MED_TURN);
item->rot.z += LARA_LEAN_RATE_SWIM;
}
} else {
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
}
}
item->fall_speed += 8;
@ -1066,13 +1078,26 @@ void Lara_State_Glide(ITEM_INFO *item, COLL_INFO *coll)
} else if (g_Input.back) {
item->rot.x += 2 * PHD_DEGREE;
}
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
if (g_Config.enable_tr2_swimming) {
if (g_Input.left) {
g_Lara.turn_rate -= LARA_TURN_RATE;
CLAMPL(g_Lara.turn_rate, -LARA_MED_TURN);
item->rot.z -= LARA_LEAN_RATE_SWIM;
} else if (g_Input.right) {
g_Lara.turn_rate += LARA_TURN_RATE;
CLAMPG(g_Lara.turn_rate, LARA_MED_TURN);
item->rot.z += LARA_LEAN_RATE_SWIM;
}
} else {
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
}
}
if (g_Input.jump) {
item->goal_anim_state = LS_SWIM;
}
@ -1112,13 +1137,26 @@ void Lara_State_Tread(ITEM_INFO *item, COLL_INFO *coll)
} else if (g_Input.back) {
item->rot.x += 2 * PHD_DEGREE;
}
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
if (g_Config.enable_tr2_swimming) {
if (g_Input.left) {
g_Lara.turn_rate -= LARA_TURN_RATE;
CLAMPL(g_Lara.turn_rate, -LARA_MED_TURN);
item->rot.z -= LARA_LEAN_RATE_SWIM;
} else if (g_Input.right) {
g_Lara.turn_rate += LARA_TURN_RATE;
CLAMPG(g_Lara.turn_rate, LARA_MED_TURN);
item->rot.z += LARA_LEAN_RATE_SWIM;
}
} else {
if (g_Input.left) {
item->rot.y -= LARA_MED_TURN;
item->rot.z -= LARA_LEAN_RATE * 2;
} else if (g_Input.right) {
item->rot.y += LARA_MED_TURN;
item->rot.z += LARA_LEAN_RATE * 2;
}
}
if (g_Input.jump) {
item->goal_anim_state = LS_SWIM;
}

View file

@ -40,6 +40,7 @@ typedef enum STATE {
static bool m_OldEnhancedLook;
static bool m_OldTR2Jumping;
static bool m_OldTR2Swimming;
static bool m_oldFixBearAI;
static TARGET_LOCK_MODE m_OldTargetMode;
static RESUME_INFO m_OldResumeInfo;
@ -151,10 +152,12 @@ static void Phase_Demo_Start(void *arg)
// so temporarily turn off all the TR1X enhancements
m_OldEnhancedLook = g_Config.enable_enhanced_look;
m_OldTR2Jumping = g_Config.enable_tr2_jumping;
m_OldTR2Swimming = g_Config.enable_tr2_swimming;
m_OldTargetMode = g_Config.target_mode;
m_oldFixBearAI = g_Config.fix_bear_ai;
g_Config.enable_enhanced_look = false;
g_Config.enable_tr2_jumping = false;
g_Config.enable_tr2_swimming = false;
g_Config.target_mode = TLM_FULL;
g_Config.fix_bear_ai = false;
@ -212,6 +215,7 @@ static void Phase_Demo_End(void)
g_Config.target_mode = m_OldTargetMode;
g_Config.enable_enhanced_look = m_OldEnhancedLook;
g_Config.enable_tr2_jumping = m_OldTR2Jumping;
g_Config.enable_tr2_swimming = m_OldTR2Swimming;
g_Config.fix_bear_ai = m_oldFixBearAI;
}

View file

@ -43,13 +43,17 @@
#define LARA_MAX_AIR 1800
#define LARA_TURN_UNDO (2 * PHD_DEGREE) // = 364
#define LARA_TURN_RATE ((PHD_DEGREE / 4) + LARA_TURN_UNDO) // = 409
#define LARA_TURN_RATE_UW (2 * PHD_DEGREE) // = 364
#define LARA_SLOW_TURN ((PHD_DEGREE * 2) + LARA_TURN_UNDO) // = 728
#define LARA_JUMP_TURN ((PHD_DEGREE * 1) + LARA_TURN_UNDO) // = 546
#define LARA_MED_TURN ((PHD_DEGREE * 4) + LARA_TURN_UNDO) // = 1092
#define LARA_FAST_TURN ((PHD_DEGREE * 6) + LARA_TURN_UNDO) // = 1456
#define LARA_LEAN_UNDO PHD_DEGREE
#define LARA_LEAN_UNDO_SURF (LARA_LEAN_UNDO * 2) // = 364
#define LARA_LEAN_UNDO_UW LARA_LEAN_UNDO_SURF // = 364
#define LARA_DEF_ADD_EDGE (5 * PHD_DEGREE) // = 910
#define LARA_LEAN_RATE 273
#define LARA_LEAN_RATE_SWIM (LARA_LEAN_RATE * 2) // = 546
#define LARA_LEAN_MAX ((10 * PHD_DEGREE) + LARA_LEAN_UNDO) // = 2002
#define LARA_LEAN_MAX_UW (LARA_LEAN_MAX * 2)
#define LARA_FASTFALL_SPEED (FASTFALL_SPEED + 3) // = 131

View file

@ -117,6 +117,10 @@
"Title": "Underwater roll",
"Description": "Allows Lara to roll while underwater, similar to TR2+."
},
"enable_tr2_swimming": {
"Title": "Smooth swimming",
"Description": "Gives Lara's underwater turn rate an acceleration curve for smoother movement, similar to TR2+."
},
"enable_target_change": {
"Title": "Target change",
"Description": "Enables TR4+ target changing while aiming weapons. Press look while aiming to change targets."

View file

@ -241,6 +241,10 @@
"Title": "Giro en el agua",
"Description": "Permite que Lara realice un giro mientras está bajo el agua, similar a TR2+."
},
"enable_tr2_swimming": {
"Title": "Nadar suave",
"Description": "Le da al giro bajo el agua de Lara una curva de aceleración para un movimiento más suave, similar a TR2+."
},
"enable_target_change": {
"Title": "Cambio de objetivo",
"Description": "Permite cambiar de objetivo como en TR4+ mientras apuntas con armas. Presiona mirar mientras apuntas para cambiar de objetivo."

View file

@ -117,6 +117,10 @@
"Title": "Retourné sous-marin",
"Description": "Permet à Lara de faire un demi tour immédiat, sous l'eau, similaire a TR2+."
},
"enable_tr2_swimming": {
"Title": "Natation fluide",
"Description": "Donne au taux de rotation sous l'eau de Lara une courbe d'accélération pour un mouvement plus fluide, similaire à TR2+."
},
"enable_target_change": {
"Title": "Changement de cible",
"Description": "Permet de changer de cible en visant avec une arme. Appuyez sur la touche Regarder tout en visant pour changer de cible comme dans TR4+."

View file

@ -117,6 +117,10 @@
"Title": "Rotolare sott'acqua",
"Description": "Permette a Lara di rotolare sott'acqua, in modo simile a TR2+."
},
"enable_tr2_swimming": {
"Title": "Nuoto liscio",
"Description": "Fornisce alla velocità di virata subacquea di Lara una curva di accelerazione per movimenti più fluidi, simile a TR2+."
},
"enable_target_change": {
"Title": "Cambio bersaglio",
"Description": "Abilita il cambio di bersaglio in stile TR4+ mentre si punta l'arma. Premi Guarda mentre miri per cambiare bersaglio."

View file

@ -87,6 +87,11 @@
"DataType": "Bool",
"DefaultValue": true
},
{
"Field": "enable_tr2_swimming",
"DataType": "Bool",
"DefaultValue": false
},
{
"Field": "enable_target_change",
"DataType": "Bool",