Skip to content

Commit

Permalink
updated weapon check logic;
Browse files Browse the repository at this point in the history
  • Loading branch information
TeslaRus committed Feb 1, 2018
1 parent 96f9d84 commit 8c47541
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion autoexec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ noclip(0);
--loadMap(base_path .. "tests/heavy1/LEVEL1.PHD");
--loadMap(base_path .. "tests/TRIGGERS.PHD");
--setgamef(1, 0);
--dofile(base_path .. "save/qsave.lua");
dofile(base_path .. "save/qsave.lua");
36 changes: 28 additions & 8 deletions src/state_control/state_control_Lara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,33 @@ void StateControl_LaraSetKeyAnim(struct entity_s *ent, struct ss_animation_s *ss

static bool StateControl_LaraCanUseWeapon(struct entity_s *ent, int weapon_model)
{
int ver;
switch(Anim_GetCurrentState(&ent->bf->animations))
{
case TR_STATE_LARA_UNDERWATER_STOP:
case TR_STATE_LARA_UNDERWATER_FORWARD:
case TR_STATE_LARA_UNDERWATER_INERTIA:
case TR_STATE_LARA_UNDERWATER_TURNAROUND:
if(weapon_model != 123)
ver = World_GetVersion();
if(ver < TR_II)
{
return false;
}
if(ver < TR_III)
{
if(weapon_model != 8)
{
return false;
}
}
else if(ver < TR_IV)
{
if(weapon_model != 9)
{
return false;
}
}
else
{
return false;
}
Expand All @@ -183,6 +203,7 @@ static bool StateControl_LaraCanUseWeapon(struct entity_s *ent, int weapon_model
case TR_STATE_LARA_WALK_RIGHT:
case TR_STATE_LARA_WALK_LEFT:
case TR_STATE_LARA_ROLL_BACKWARD:
case TR_STATE_LARA_ROLL_FORWARD:
case TR_STATE_LARA_SLIDE_FORWARD:
case TR_STATE_LARA_JUMP_BACK:
case TR_STATE_LARA_JUMP_LEFT:
Expand Down Expand Up @@ -230,13 +251,12 @@ int StateControl_Lara(struct entity_s *ent, struct ss_animation_s *ss_anim)
state->sprint = 0x00;
state->crouch = 0x00;
state->tightrope = (current_state >= TR_STATE_LARA_TIGHTROPE_IDLE) && (current_state <= TR_STATE_LARA_TIGHTROPE_EXIT);
/*
* - On floor animations
* - Climbing animations
* - Landing animations
* - Free fall animations
* - Water animations
*/

if((ent->character->weapon_state != WEAPON_STATE_HIDE) && !StateControl_LaraCanUseWeapon(ent, ent->character->weapon_id))
{
ent->character->cmd.ready_weapon = 0x01;
}

switch(current_state)
{
/*
Expand Down

0 comments on commit 8c47541

Please sign in to comment.