mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 00:07:58 +03:00
Merge branch 'master' into states_tier_3
This commit is contained in:
commit
051454fd77
9 changed files with 49 additions and 31 deletions
|
@ -8,6 +8,8 @@ Version 1.0.3
|
|||
* Fix TR3 monkey level crash.
|
||||
* Fix occasional ejection when landing on a slope.
|
||||
* Fix slow centaur projectile velocity.
|
||||
* Adjust sprint jump timing.
|
||||
* Fix grabbing narrow ledges below ceilings.
|
||||
|
||||
|
||||
Version 1.0.2
|
||||
|
|
|
@ -62,6 +62,7 @@ We do not and have never worked for Core Design, Eidos Interactive, or Square En
|
|||
- TokyoSU (entity and vehicle decompilation)
|
||||
- Troye (general coding, refactoring)
|
||||
- WolfCheese (general coding)
|
||||
- l.m. (general coding, bug fixing)
|
||||
|
||||
## Testers
|
||||
- Adngel
|
||||
|
|
|
@ -71,7 +71,7 @@ constexpr auto LARA_SWIM_INTERTIA_VELOCITY_MIN = 33.5f;
|
|||
constexpr auto LARA_POSITION_ADJUST_MAX_TIME = FPS * 3; // 30 frames * 3 = 3 seconds allowed for position adjustment.
|
||||
constexpr auto LARA_POSE_TIME = FPS * 30; // 30 frames * 30 = 30 seconds to AFK pose.
|
||||
constexpr auto LARA_RUN_JUMP_TIME = 22; // Frames to count before a running jump is possible.
|
||||
constexpr auto LARA_SPRINT_JUMP_TIME = 50; // Frames to count before a sprint jump is possible.
|
||||
constexpr auto LARA_SPRINT_JUMP_TIME = 46; // Frames to count before a sprint jump is possible.
|
||||
|
||||
constexpr auto LARA_HEALTH_MAX = 1000.0f;
|
||||
constexpr auto LARA_HEALTH_CRITICAL = LARA_HEALTH_MAX / 4;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
using namespace TEN::Entities::Generic;
|
||||
using namespace TEN::Input;
|
||||
using std::vector;
|
||||
|
||||
ItemInfo* LastTargets[MAX_TARGETS];
|
||||
ItemInfo* TargetList[MAX_TARGETS];
|
||||
|
@ -261,8 +262,8 @@ WeaponInfo Weapons[(int)LaraWeaponType::NumWeapons] =
|
|||
}
|
||||
};
|
||||
|
||||
// States in which Lara will hold a flare out in front.
|
||||
const std::vector<LaraState> FlarePoseStates =
|
||||
// States in which Lara will hold an active flare out in front.
|
||||
const vector<int> FlarePoseStates =
|
||||
{
|
||||
LS_WALK_FORWARD,
|
||||
LS_RUN_FORWARD,
|
||||
|
@ -283,6 +284,7 @@ const std::vector<LaraState> FlarePoseStates =
|
|||
LS_CROUCH_TURN_RIGHT,
|
||||
LS_SOFT_SPLAT
|
||||
};
|
||||
|
||||
GAME_OBJECT_ID WeaponObject(LaraWeaponType weaponType)
|
||||
{
|
||||
switch (weaponType)
|
||||
|
@ -603,8 +605,7 @@ void LaraGun(ItemInfo* laraItem)
|
|||
case HandStatus::Free:
|
||||
if (lara->Control.Weapon.GunType == LaraWeaponType::Flare)
|
||||
{
|
||||
if (lara->Vehicle != NO_ITEM ||
|
||||
CheckLaraState((LaraState)laraItem->Animation.ActiveState, FlarePoseStates))
|
||||
if (lara->Vehicle != NO_ITEM || TestState(laraItem->Animation.ActiveState, FlarePoseStates))
|
||||
{
|
||||
if (lara->Flare.ControlLeft)
|
||||
{
|
||||
|
@ -634,7 +635,7 @@ void LaraGun(ItemInfo* laraItem)
|
|||
{
|
||||
if (lara->MeshPtrs[LM_LHAND] == Objects[ID_FLARE_ANIM].meshIndex + LM_LHAND)
|
||||
{
|
||||
lara->Flare.ControlLeft = (lara->Vehicle != NO_ITEM || CheckLaraState((LaraState)laraItem->Animation.ActiveState, FlarePoseStates));
|
||||
lara->Flare.ControlLeft = (lara->Vehicle != NO_ITEM || TestState(laraItem->Animation.ActiveState, FlarePoseStates));
|
||||
DoFlareInHand(laraItem, lara->Flare.Life);
|
||||
SetFlareArm(laraItem, lara->LeftArm.FrameNumber);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
using namespace TEN::Floordata;
|
||||
using namespace TEN::Input;
|
||||
using namespace TEN::Renderer;
|
||||
using std::vector;
|
||||
|
||||
// -----------------------------
|
||||
// TEST FUNCTIONS
|
||||
|
@ -919,12 +920,11 @@ void GetTightropeFallOff(ItemInfo* item, int regularity)
|
|||
}
|
||||
#endif
|
||||
|
||||
// TODO: Organise all of this properly. -- Sezz 2022.07.28
|
||||
bool CheckLaraState(LaraState referenceState, const std::vector<LaraState>& stateList)
|
||||
bool TestLaraWeaponType(LaraWeaponType refWeaponType, const vector<LaraWeaponType>& weaponTypeList)
|
||||
{
|
||||
for (auto& state : stateList)
|
||||
for (const auto& weaponType : weaponTypeList)
|
||||
{
|
||||
if (state == referenceState)
|
||||
if (weaponType == refWeaponType)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -960,7 +960,7 @@ bool IsStandingWeapon(ItemInfo* item, LaraWeaponType weaponType)
|
|||
|
||||
bool IsVaultState(LaraState state)
|
||||
{
|
||||
static const std::vector<LaraState> vaultStates
|
||||
static const std::vector<int> vaultStates
|
||||
{
|
||||
LS_VAULT,
|
||||
LS_VAULT_2_STEPS,
|
||||
|
@ -970,12 +970,12 @@ bool IsVaultState(LaraState state)
|
|||
LS_VAULT_3_STEPS_CROUCH,
|
||||
LS_AUTO_JUMP
|
||||
};
|
||||
return CheckLaraState(state, vaultStates);
|
||||
return TestState(state, vaultStates);
|
||||
}
|
||||
|
||||
bool IsJumpState(LaraState state)
|
||||
{
|
||||
static const std::vector<LaraState> jumpStates
|
||||
static const std::vector<int> jumpStates
|
||||
{
|
||||
LS_JUMP_FORWARD,
|
||||
LS_JUMP_BACK,
|
||||
|
@ -988,24 +988,24 @@ bool IsJumpState(LaraState state)
|
|||
LS_FREEFALL_DIVE,
|
||||
LS_FREEFALL
|
||||
};
|
||||
return CheckLaraState(state, jumpStates);
|
||||
return TestState(state, jumpStates);
|
||||
}
|
||||
|
||||
bool IsRunJumpQueueableState(LaraState state)
|
||||
{
|
||||
static const std::vector<LaraState> runningJumpQueuableStates
|
||||
static const std::vector<int> runningJumpQueuableStates
|
||||
{
|
||||
LS_RUN_FORWARD,
|
||||
LS_SPRINT,
|
||||
LS_STEP_UP,
|
||||
LS_STEP_DOWN
|
||||
};
|
||||
return CheckLaraState(state, runningJumpQueuableStates);
|
||||
return TestState(state, runningJumpQueuableStates);
|
||||
}
|
||||
|
||||
bool IsRunJumpCountableState(LaraState state)
|
||||
{
|
||||
static const std::vector<LaraState> runningJumpTimerStates
|
||||
static const std::vector<int> runningJumpTimerStates
|
||||
{
|
||||
LS_WALK_FORWARD,
|
||||
LS_RUN_FORWARD,
|
||||
|
@ -1013,7 +1013,7 @@ bool IsRunJumpCountableState(LaraState state)
|
|||
LS_SPRINT_DIVE,
|
||||
LS_JUMP_FORWARD
|
||||
};
|
||||
return CheckLaraState(state, runningJumpTimerStates);
|
||||
return TestState(state, runningJumpTimerStates);
|
||||
}
|
||||
|
||||
bool TestLaraSlide(ItemInfo* item, CollisionInfo* coll)
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "Game/Lara/lara_struct.h"
|
||||
#include "Game/Lara/lara_test_structs.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
struct ItemInfo;
|
||||
struct CollisionInfo;
|
||||
|
||||
|
@ -44,14 +46,12 @@ void TestLaraWaterDepth(ItemInfo* item, CollisionInfo* coll);
|
|||
void GetTightropeFallOff(ItemInfo* item, int regularity);
|
||||
#endif
|
||||
|
||||
bool CheckLaraState(LaraState referenceState, const std::vector<LaraState>& stateList);
|
||||
bool CheckLaraWeaponType(LaraWeaponType referenceWeaponType, const std::vector<LaraWeaponType>& weaponTypeList);
|
||||
|
||||
bool TestLaraWeaponType(LaraWeaponType refWeaponType, const vector<LaraWeaponType>& weaponTypeList);
|
||||
bool IsStandingWeapon(ItemInfo* item, LaraWeaponType weaponType);
|
||||
bool IsVaultState(LaraState state);
|
||||
bool IsJumpState(LaraState state);
|
||||
bool IsRunJumpQueueableState(LaraState state);
|
||||
bool IsRunJumpCountableState(LaraState state);
|
||||
bool IsVaultState(int state);
|
||||
bool IsJumpState(int state);
|
||||
bool IsRunJumpQueueableState(int state);
|
||||
bool IsRunJumpCountableState(int state);
|
||||
|
||||
bool TestLaraSlide(ItemInfo* item, CollisionInfo* coll);
|
||||
bool TestLaraLand(ItemInfo* item, CollisionInfo* coll);
|
||||
|
|
|
@ -150,6 +150,17 @@ bool ItemInfo::IsCreature()
|
|||
return this->Data.is<CreatureInfo>();
|
||||
}
|
||||
|
||||
bool TestState(int refState, const vector<int>& stateList)
|
||||
{
|
||||
for (const auto& state : stateList)
|
||||
{
|
||||
if (state == refState)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClearItem(short itemNumber)
|
||||
{
|
||||
auto* item = &g_Level.Items[itemNumber];
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "Specific/newtypes.h"
|
||||
#include "Specific/phd_global.h"
|
||||
|
||||
using std::vector;
|
||||
|
||||
enum GAME_OBJECT_ID : short;
|
||||
|
||||
constexpr auto NO_ITEM = -1;
|
||||
|
@ -134,6 +136,7 @@ struct ItemInfo
|
|||
bool IsCreature();
|
||||
};
|
||||
|
||||
bool TestState(int refState, const vector<int>& stateList);
|
||||
void EffectNewRoom(short fxNumber, short roomNumber);
|
||||
void ItemNewRoom(short itemNumber, short roomNumber);
|
||||
void AddActiveItem(short itemNumber);
|
||||
|
|
|
@ -20,7 +20,7 @@ using std::vector;
|
|||
|
||||
namespace TEN::Entities::Generic
|
||||
{
|
||||
const vector<LaraState> VPoleMountedStates =
|
||||
const vector<int> VPoleMountedStates =
|
||||
{
|
||||
LS_POLE_IDLE,
|
||||
LS_POLE_UP,
|
||||
|
@ -28,7 +28,7 @@ namespace TEN::Entities::Generic
|
|||
LS_POLE_TURN_CLOCKWISE,
|
||||
LS_POLE_TURN_COUNTER_CLOCKWISE
|
||||
};
|
||||
const vector<LaraState> VPoleGroundedMountStates =
|
||||
const vector<int> VPoleGroundedMountStates =
|
||||
{
|
||||
LS_IDLE,
|
||||
LS_TURN_LEFT_SLOW,
|
||||
|
@ -38,7 +38,7 @@ namespace TEN::Entities::Generic
|
|||
LS_WALK_FORWARD,
|
||||
LS_RUN_FORWARD
|
||||
};
|
||||
const vector<LaraState> VPoleAirborneMountStates =
|
||||
const vector<int> VPoleAirborneMountStates =
|
||||
{
|
||||
LS_REACH,
|
||||
LS_JUMP_UP
|
||||
|
@ -67,7 +67,7 @@ namespace TEN::Entities::Generic
|
|||
|
||||
// Mount while grounded.
|
||||
if (TrInput & IN_ACTION && isFacingPole &&
|
||||
CheckLaraState((LaraState)laraItem->Animation.ActiveState, VPoleGroundedMountStates) &&
|
||||
TestState(laraItem->Animation.ActiveState, VPoleGroundedMountStates) &&
|
||||
lara->Control.HandStatus == HandStatus::Free ||
|
||||
(lara->Control.IsMoving && lara->InteractedItem == itemNumber))
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ namespace TEN::Entities::Generic
|
|||
|
||||
// Mount while airborne.
|
||||
if (TrInput & IN_ACTION && isFacingPole &&
|
||||
CheckLaraState((LaraState)laraItem->Animation.ActiveState, VPoleAirborneMountStates) &&
|
||||
TestState(laraItem->Animation.ActiveState, VPoleAirborneMountStates) &&
|
||||
laraItem->Animation.IsAirborne &&
|
||||
laraItem->Animation.Velocity.y > 0.0f &&
|
||||
lara->Control.HandStatus == HandStatus::Free)
|
||||
|
@ -148,7 +148,7 @@ namespace TEN::Entities::Generic
|
|||
}
|
||||
|
||||
// Player is not interacting with vertical pole; do regular object collision.
|
||||
if (!CheckLaraState((LaraState)laraItem->Animation.ActiveState, VPoleMountedStates) &&
|
||||
if (!TestState(laraItem->Animation.ActiveState, VPoleMountedStates) &&
|
||||
laraItem->Animation.ActiveState != LS_JUMP_BACK)
|
||||
{
|
||||
ObjectCollision(itemNumber, laraItem, coll);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue