Skip to content

Commit 247c64c

Browse files
sodat1dev2v3v4
andcommitted
Fix actor's car animations
Co-authored-by: v2v3v4 <terran.erre@mail.ru>
1 parent 241ecdc commit 247c64c

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/xrGame/ActorAnimation.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -268,28 +268,29 @@ SVehicleAnimCollection::SVehicleAnimCollection()
268268

269269
void SVehicleAnimCollection::Create(IKinematicsAnimated* V,u16 num)
270270
{
271-
string128 buf,buff1,buff2;
272-
xr_strconcat(buff1,_itoa(num,buf,10),"_");
273-
steer_left= V->ID_Cycle(xr_strconcat(buf,"steering_idle_",buff1,"ls"));
274-
steer_right=V->ID_Cycle(xr_strconcat(buf,"steering_idle_",buff1,"rs"));
275-
276-
for(int i=0;MAX_IDLES>i;++i){
277-
idles[i]=V->ID_Cycle_Safe(xr_strconcat(buf,"steering_idle_",buff1,_itoa(i,buff2,10)));
278-
if(idles[i]) idles_num++;
279-
else break;
280-
}
271+
steer_left = V->ID_Cycle_Safe("steering_torso_ls");
272+
steer_right = V->ID_Cycle_Safe("steering_torso_rs");
273+
idles[0] = V->ID_Cycle_Safe("steering_torso_idle");
274+
idles[1] = V->ID_Cycle_Safe("steering_legs_idle");
281275
}
282276

283277
void CActor::steer_Vehicle(float angle)
284278
{
285279
if(!m_holder) return;
286280

287-
CCar* car = smart_cast<CCar*>(m_holder);
288-
u16 anim_type = car->DriverAnimationType();
289-
SVehicleAnimCollection& anims=m_vehicle_anims->m_vehicles_type_collections[anim_type];
290-
if(angle==0.f) smart_cast<IKinematicsAnimated*> (Visual())->PlayCycle(anims.idles[0]);
291-
else if(angle>0.f) smart_cast<IKinematicsAnimated*> (Visual())->PlayCycle(anims.steer_right);
292-
else smart_cast<IKinematicsAnimated*> (Visual())->PlayCycle(anims.steer_left);
281+
CCar* car = smart_cast<CCar*>(m_holder);
282+
u16 anim_type = car->DriverAnimationType();
283+
IKinematicsAnimated* ka = smart_cast<IKinematicsAnimated*>(Visual());
284+
SVehicleAnimCollection& anims = m_vehicle_anims->m_vehicles_type_collections[anim_type];
285+
if(angle==0.f)
286+
{
287+
ka->PlayCycle(anims.idles[0]);
288+
ka->PlayCycle(anims.idles[1]);
289+
}
290+
else if(angle>0.f)
291+
ka->PlayCycle(anims.steer_right);
292+
else
293+
ka->PlayCycle(anims.steer_left);
293294
}
294295

295296
void legs_play_callback (CBlend *blend)

src/xrGame/ActorVehicle.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void CActor::attach_Vehicle(CHolderCustom* vehicle)
4545
u16 anim_type = car->DriverAnimationType();
4646
SVehicleAnimCollection& anims = m_vehicle_anims->m_vehicles_type_collections[anim_type];
4747
V->PlayCycle (anims.idles[0],FALSE);
48+
V->PlayCycle (anims.idles[1],FALSE);
4849

4950
ResetCallbacks ();
5051
u16 head_bone = pK->LL_BoneID("bip01_head");
@@ -54,7 +55,7 @@ void CActor::attach_Vehicle(CHolderCustom* vehicle)
5455
mstate_wishful = 0;
5556
m_holderID=car->ID ();
5657

57-
SetWeaponHideState (INV_STATE_CAR, true);
58+
SetWeaponHideState (INV_STATE_BLOCK_ALL, true);
5859

5960
CStepManager::on_animation_start(MotionID(), 0);
6061

@@ -97,7 +98,7 @@ void CActor::detach_Vehicle()
9798
m_holderID=u16(-1);
9899

99100
//. SetWeaponHideState(whs_CAR, FALSE);
100-
SetWeaponHideState(INV_STATE_CAR, false);
101+
SetWeaponHideState(INV_STATE_BLOCK_ALL, false);
101102
this->callback(GameObject::eDetachVehicle)(car->lua_game_object());
102103
}
103104

src/xrGame/Inventory.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ using namespace InventoryUtilities;
2828

2929
// what to block
3030
u16 INV_STATE_LADDER = INV_STATE_BLOCK_ALL;
31-
u16 INV_STATE_CAR = (1 << INV_SLOT_3 | 1 << BINOCULAR_SLOT);
3231
u16 INV_STATE_BLOCK_ALL = 0xffff;
3332
u16 INV_STATE_INV_WND = INV_STATE_BLOCK_ALL;
3433
u16 INV_STATE_BUY_MENU = INV_STATE_BLOCK_ALL;

src/xrServerEntities/inventory_space.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ struct SInvItemPlace
6262
};
6363

6464
extern u16 INV_STATE_LADDER;
65-
extern u16 INV_STATE_CAR;
6665
extern u16 INV_STATE_BLOCK_ALL;
6766
extern u16 INV_STATE_INV_WND;
6867
extern u16 INV_STATE_BUY_MENU;

0 commit comments

Comments
 (0)