Skip to content

Commit

Permalink
Rework anim_fake object dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Drombeys committed Aug 4, 2024
1 parent 3f5765d commit 747b226
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 62 deletions.
13 changes: 7 additions & 6 deletions gamedata/configs/game_global.ltx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[actor_item]
bolt_item = bolt
pda_item = device_pda

[render]
default_wallmark = explosion_marks
[actor_item]
bolt_item = bolt
pda_item = device_pda
anim_fake_item = anim_fake

[render]
default_wallmark = explosion_marks
1 change: 0 additions & 1 deletion gamedata/configs/gameplay/character_desc_general.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<supplies>
[spawn] \n
device_torch \n
anim_fake \n
wpn_binoc \n
wpn_knife \n
detector_simple \n
Expand Down
96 changes: 48 additions & 48 deletions gamedata/configs/misc/anim_slot.ltx
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
[anim_fake]:identity_immunities
class = F_ANMITM
slot = 22
can_trade = false
can_take = true
cost = 0
inv_weight = 0
inv_name = "animfake"
inv_name_short = "animfake"
default_to_ruck = false
sprint_allowed = true

; hud sect
animation_slot = 2
control_inertion_factor = 1
hud_fov = 45
hud = anim_fake

; For Debug
inv_grid_width = 1
inv_grid_height = 1
inv_grid_x = 11
inv_grid_y = 9

visual = dynamics\devices\dev_aptechka\dev_aptechka_low.ogf ; unused

; Hud attach
item_visual = dynamics\devices\dev_aptechka\dev_aptechka_low.ogf ; unused
attach_place_idx = 0

hands_position = 0, 0, 0
hands_orientation = 0, 0, 0
hands_position_16x9 = 0, 0, 0
hands_orientation_16x9 = 0, 0, 0

aim_hud_offset_pos = 0, 0, 0
aim_hud_offset_rot = 0, 0, 0
aim_hud_offset_pos_16x9 = 0, 0, 0
aim_hud_offset_rot_16x9 = 0, 0, 0


gl_hud_offset_pos = 0, 0, 0
gl_hud_offset_rot = 0, 0, 0
gl_hud_offset_pos_16x9 = 0, 0, 0
gl_hud_offset_rot_16x9 = 0, 0, 0

item_position = 0, 0, 0
item_orientation = 0, 0, 0
[anim_fake]:identity_immunities
class = F_ANMITM
slot = 22
can_trade = false
can_take = true
cost = 0
inv_weight = 0
inv_name = "animfake"
inv_name_short = "animfake"
default_to_ruck = false
sprint_allowed = true

; hud sect
animation_slot = 2
control_inertion_factor = 1
hud_fov = 45
hud = anim_fake

; For Debug
inv_grid_width = 1
inv_grid_height = 1
inv_grid_x = 0
inv_grid_y = 40

visual = dynamics\devices\dev_aptechka\dev_aptechka_low.ogf ; unused

; Hud attach
item_visual = dynamics\devices\dev_aptechka\dev_aptechka_low.ogf ; unused
attach_place_idx = 0

hands_position = 0, 0, 0
hands_orientation = 0, 0, 0
hands_position_16x9 = 0, 0, 0
hands_orientation_16x9 = 0, 0, 0

aim_hud_offset_pos = 0, 0, 0
aim_hud_offset_rot = 0, 0, 0
aim_hud_offset_pos_16x9 = 0, 0, 0
aim_hud_offset_rot_16x9 = 0, 0, 0


gl_hud_offset_pos = 0, 0, 0
gl_hud_offset_rot = 0, 0, 0
gl_hud_offset_pos_16x9 = 0, 0, 0
gl_hud_offset_rot_16x9 = 0, 0, 0

item_position = 0, 0, 0
item_orientation = 0, 0, 0
9 changes: 9 additions & 0 deletions src/xrGame/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,15 @@ void CActor::spawn_supplies ()
{
inherited::spawn_supplies ();
CInventoryOwner::spawn_supplies ();

if (!pSettings->section_exist("anim_fake"))
{
Msg("! Animation slot not registered");
Msg("! [anim_fake] section missing");
return;
}

Level().spawn_item(pGameGlobals->r_string("actor_item", "anim_fake_item"), Position(), ai_location().level_vertex_id(), ID());
}


Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/HUDAnimItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ void CHUDAnimItem::PlayHudAnim(const char* Section, const char* Anim)
ThisItem->CurrentMotion = Anim;

Actor()->inventory().Activate(ANIM_SLOT);
}
}
2 changes: 1 addition & 1 deletion src/xrServerEntities/object_factory_register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void CObjectFactory::register_classes ()
ADD(CHelicopter ,CSE_ALifeHelicopter ,CLSID_VEHICLE_HELICOPTER ,"helicopter");
#endif // #ifndef NO_SINGLE

ADD(CHUDAnimItem ,CSE_ALifeItem ,CLSID_OBJECT_ANINFAKE, "animfakeitem");
ADD(CHUDAnimItem , CSE_ALifeItemsNotSave, CLSID_OBJECT_ANINFAKE, "animfakeitem");

// Artefacts
ADD(CMercuryBall ,CSE_ALifeItemArtefact ,CLSID_AF_MERCURY_BALL ,"art_mercury_ball");
Expand Down
3 changes: 2 additions & 1 deletion src/xrServerEntities/script_engine_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Module : script_engine_export.cpp
// Created : 01.04.2004
// Modified : 22.06.2004
// Author : Åáëàí Êîí÷åííûé
// Author : Еблан Конченный
// Description : XRay Script Engine export
////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -87,6 +87,7 @@ void export_classes (lua_State *L)
CSE_ALifeItemGrenade::script_register(L);
CSE_ALifeItemExplosive::script_register(L);
CSE_ALifeItemBolt::script_register(L);
CSE_ALifeItemsNotSave::script_register(L);
CSE_ALifeItemHelmet::script_register(L);
CSE_ALifeItemCustomOutfit::script_register(L);
//CSE_ALifeStationaryMgun::script_register(L);
Expand Down
60 changes: 58 additions & 2 deletions src/xrServerEntities/xrServer_Objects_ALife_Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,9 +1241,65 @@ bool CSE_ALifeItemBolt::used_ai_locations () const
}

#ifndef XRGAME_EXPORTS
void CSE_ALifeItemBolt::FillProps (LPCSTR pref, PropItemVec& values)
void CSE_ALifeItemBolt::FillProps(LPCSTR pref, PropItemVec& values)
{
inherited::FillProps (pref, values);
inherited::FillProps(pref, values);
}
#endif // #ifndef XRGAME_EXPORTS

////////////////////////////////////////////////////////////////////////////
// CSE_ALifeItemsNotSave
////////////////////////////////////////////////////////////////////////////
CSE_ALifeItemsNotSave::CSE_ALifeItemsNotSave(LPCSTR caSection) : CSE_ALifeItem(caSection)
{
m_flags.set(flUseSwitches, FALSE);
m_flags.set(flSwitchOffline, FALSE);
m_ef_weapon_type = READ_IF_EXISTS(pSettings, r_u32, caSection, "ef_weapon_type", u32(-1));
}

CSE_ALifeItemsNotSave::~CSE_ALifeItemsNotSave()
{
}

u32 CSE_ALifeItemsNotSave::ef_weapon_type() const
{
VERIFY(m_ef_weapon_type != u32(-1));
return (m_ef_weapon_type);
}

void CSE_ALifeItemsNotSave::STATE_Write(NET_Packet& tNetPacket)
{
inherited::STATE_Write(tNetPacket);
}

void CSE_ALifeItemsNotSave::STATE_Read(NET_Packet& tNetPacket, u16 size)
{
inherited::STATE_Read(tNetPacket, size);
}

void CSE_ALifeItemsNotSave::UPDATE_Write(NET_Packet& tNetPacket)
{
inherited::UPDATE_Write(tNetPacket);
};

void CSE_ALifeItemsNotSave::UPDATE_Read(NET_Packet& tNetPacket)
{
inherited::UPDATE_Read(tNetPacket);
};

bool CSE_ALifeItemsNotSave::can_save() const
{
return (false);//!attached());
}
bool CSE_ALifeItemsNotSave::used_ai_locations() const
{
return false;
}

#ifndef XRGAME_EXPORTS
void CSE_ALifeItemsNotSave::FillProps(LPCSTR pref, PropItemVec& values)
{
inherited::FillProps(pref, values);
}
#endif // #ifndef XRGAME_EXPORTS

Expand Down
13 changes: 11 additions & 2 deletions src/xrServerEntities/xrServer_Objects_ALife_Items.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ SERVER_ENTITY_DECLARE_BEGIN2(CSE_ALifeItem,CSE_ALifeDynamicObjectVisual,CSE_ALif
SERVER_ENTITY_DECLARE_END

SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeItemTorch,CSE_ALifeItem)
//ôëàãè
//флаги
enum EStats{
eTorchActive = (1<<0),
eNightVisionActive = (1<<1),
Expand Down Expand Up @@ -131,7 +131,7 @@ SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeItemWeapon,CSE_ALifeItem)

typedef ALife::EWeaponAddonStatus EWeaponAddonStatus;

//òåêóùåå ñîñòîÿíèå àääîíîâ
//текущее состояние аддонов
enum EWeaponAddonState
{
eWeaponAddonScope = 0x01,
Expand Down Expand Up @@ -280,6 +280,15 @@ SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeItemBolt,CSE_ALifeItem)
virtual u32 ef_weapon_type () const;
SERVER_ENTITY_DECLARE_END

SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeItemsNotSave, CSE_ALifeItem)
u32 m_ef_weapon_type;
CSE_ALifeItemsNotSave(LPCSTR caSection);
virtual ~CSE_ALifeItemsNotSave();
virtual bool can_save() const;
virtual bool used_ai_locations() const;
virtual u32 ef_weapon_type() const;
SERVER_ENTITY_DECLARE_END

SERVER_ENTITY_DECLARE_BEGIN(CSE_ALifeItemCustomOutfit,CSE_ALifeItem)
u32 m_ef_equipment_type;
CSE_ALifeItemCustomOutfit (LPCSTR caSection);
Expand Down
10 changes: 10 additions & 0 deletions src/xrServerEntities/xrServer_Objects_ALife_Items_script2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ void CSE_ALifeItemBolt::script_register(lua_State *L)
];
}

void CSE_ALifeItemsNotSave::script_register(lua_State* L) {
module(L)[
luabind_class_item1(
CSE_ALifeItemsNotSave,
"cse_alife_item_not_save",
CSE_ALifeItem
)
];
}

void CSE_ALifeItemCustomOutfit::script_register(lua_State *L)
{
module(L)[
Expand Down

0 comments on commit 747b226

Please sign in to comment.