Skip to content

Commit 446b5b2

Browse files
Lucy fixes:
-fix for hands exported from blender (you no longer have to reassign the motion references) -fix for silent error / script freeze when getting player accuracy in scripts -animation fixes (shotgun shell didn't sync with add cartridge and close anims) -game no longer crashes on missing item section when loading a save (should be possible to uninstall most mods mid-game now) -fix for mutants stuck running in place (many thanks to Arszi for finding it) -fix for two handed detector/device animations (swaying is now applied to both arms instead of only the left one) -it's now possible to play script particle effects in hud_mode with :play(true) / :play_at_pos(pos, true) -the game will now display a crash message when crashing due to empty translation string
1 parent d369db0 commit 446b5b2

File tree

11 files changed

+50
-26
lines changed

11 files changed

+50
-26
lines changed

src/Layers/xrRender/SkeletonAnimated.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,20 @@ void CKinematicsAnimated::Load(const char* N, IReader* data, u32 dwFlags)
813813
string_path nm;
814814
for (u32 k = 0; k < set_cnt; ++k)
815815
{
816-
_GetItem(items_nm, k, nm);
816+
if (strstr(nm, "\\*.omf"))
817+
{
818+
FS_FileSet fset;
819+
FS.file_list(fset, "$game_meshes$", FS_ListFiles, nm);
820+
FS.file_list(fset, "$level$", FS_ListFiles, nm);
821+
822+
m_Motions.reserve(fset.size() - 1);
823+
824+
for (FS_FileSet::iterator it = fset.begin(); it != fset.end(); it++)
825+
loadOMF((*it).name.c_str());
826+
827+
continue;
828+
}
829+
817830
xr_strcat(nm, ".omf");
818831
loadOMF(nm);
819832
}

src/xrGame/Actor_Weapon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ float CActor::GetWeaponAccuracy() const
7474
}
7575
}
7676

77-
if (W->m_lastCartridge.param_s.buckShot > 1)
77+
if (W && W->m_lastCartridge.param_s.buckShot > 1)
7878
dispersion *= GetWeaponParam(W, Get_PDM_BuckShot(), 1.0f);
7979

8080
return dispersion;

src/xrGame/WeaponAutomaticShotgun.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,17 @@ void CWeaponAutomaticShotgun::PlayAnimOpenWeapon()
179179
void CWeaponAutomaticShotgun::PlayAnimAddOneCartridgeWeapon()
180180
{
181181
VERIFY(GetState()==eReload);
182-
PlayHUDMotion("anm_add_cartridge",TRUE, this, GetState(), 1.f, 0.f, false);
182+
PlayHUDMotion("anm_add_cartridge",FALSE, this, GetState());
183183
}
184184

185185
void CWeaponAutomaticShotgun::PlayAnimCloseWeapon()
186186
{
187187
VERIFY(GetState()==eReload);
188188

189189
if (BeginReloadWasEmpty && HudAnimationExist("anm_close_empty"))
190-
PlayHUDMotion("anm_close_empty", TRUE, this, GetState(), 1.f, 0.f, false);
190+
PlayHUDMotion("anm_close_empty", FALSE, this, GetState());
191191
else
192-
PlayHUDMotion("anm_close",TRUE, this, GetState(), 1.f, 0.f, false);
192+
PlayHUDMotion("anm_close", FALSE, this, GetState());
193193
}
194194

195195
bool CWeaponAutomaticShotgun::HaveCartridgeInInventory(u8 cnt)

src/xrGame/WeaponShotgun.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ void CWeaponShotgun::PlayAnimOpenWeapon()
186186
void CWeaponShotgun::PlayAnimAddOneCartridgeWeapon()
187187
{
188188
VERIFY(GetState()==eReload);
189-
PlayHUDMotion("anm_add_cartridge",TRUE, this, GetState(), 1.f, 0.f, false);
189+
PlayHUDMotion("anm_add_cartridge", FALSE, this, GetState());
190190
}
191191

192192
void CWeaponShotgun::PlayAnimCloseWeapon()
193193
{
194194
VERIFY(GetState()==eReload);
195195

196196
if (BeginReloadWasEmpty && HudAnimationExist("anm_close_empty"))
197-
PlayHUDMotion("anm_close_empty", TRUE, this, GetState(), 1.f, 0.f, false);
197+
PlayHUDMotion("anm_close_empty", FALSE, this, GetState());
198198
else
199-
PlayHUDMotion("anm_close", TRUE, this, GetState(), 1.f, 0.f, false);
199+
PlayHUDMotion("anm_close", FALSE, this, GetState());
200200
}
201201

202202
bool CWeaponShotgun::HaveCartridgeInInventory(u8 cnt)

src/xrGame/alife_object_registry.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ CSE_ALifeDynamicObject* CALifeObjectRegistry::get_object(IReader& file_stream)
112112
#endif
113113
// create entity
114114
CSE_Abstract* tpSE_Abstract = F_entity_Create(s_name);
115-
R_ASSERT2(tpSE_Abstract, "Can't create entity.");
115+
if (!tpSE_Abstract)
116+
{
117+
Msg("! Can't create entity '%s'", s_name);
118+
tNetPacket.B.count = file_stream.r_u16();
119+
file_stream.advance(tNetPacket.B.count);
120+
return nullptr;
121+
}
116122
CSE_ALifeDynamicObject* tpALifeDynamicObject = smart_cast<CSE_ALifeDynamicObject*>(tpSE_Abstract);
117123
R_ASSERT2(tpALifeDynamicObject, "Non-ALife object in the saved game!");
118124
tpALifeDynamicObject->Spawn_Read(tNetPacket);
@@ -135,15 +141,14 @@ void CALifeObjectRegistry::load(IReader& file_stream)
135141
m_objects.clear();
136142

137143
u32 count = file_stream.r_u32();
138-
CSE_ALifeDynamicObject** objects = (CSE_ALifeDynamicObject**)_alloca(count * sizeof(CSE_ALifeDynamicObject*));
139-
140-
CSE_ALifeDynamicObject** I = objects;
141-
CSE_ALifeDynamicObject** E = objects + count;
142-
for (; I != E; ++I)
144+
for (u32 I = 0; I < count; ++I)
143145
{
144-
*I = get_object(file_stream);
145-
add(*I);
146+
CSE_ALifeDynamicObject* tpSE_Abstract = get_object(file_stream);
147+
if (!tpSE_Abstract)
148+
continue;
149+
150+
add(tpSE_Abstract);
146151
}
147152

148-
Msg("* %d objects are successfully loaded", count);
153+
Msg("* %d objects are successfully loaded", m_objects.size());
149154
}

src/xrGame/movement_manager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ void CMovementManager::on_restrictions_change()
360360

361361
bool CMovementManager::can_use_distributed_computations(u32 option) const
362362
{
363-
return (!m_build_at_once && g_mt_config.test(option) && !object().getDestroy());
363+
//return (!m_build_at_once && g_mt_config.test(option) && !object().getDestroy());
364+
return false; // Fix for bug which makes mutants running in one place. Something happens with the thread, and the mutants will wait for a thread which will never finish running.
365+
// Many thanks to Arszi for finding this <3
364366
}
365367

366368
void CMovementManager::on_frame(CPHMovementControl* movement_control, Fvector& dest_position)

src/xrGame/player_hud.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,11 @@ void player_hud::update(const Fmatrix& cam_trans)
896896
if (wep && wep->IsZoomed())
897897
trans_2.mulB_43(wep->m_shoot_shake_mat);
898898
}
899-
else
899+
900+
if (m_attached_items[0] && !m_attached_items[1])
900901
trans_2 = trans;
902+
else if (m_attached_items[1] && !m_attached_items[0])
903+
trans = trans_2;
901904

902905
// override hand offset for single hand animation
903906
if (script_anim_part == 2 || (script_anim_part && !m_attached_items[0] && !m_attached_items[1]))

src/xrGame/script_particles.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ CScriptParticles::~CScriptParticles()
113113
}
114114
}
115115

116-
void CScriptParticles::Play()
116+
void CScriptParticles::Play(bool bHudMode)
117117
{
118118
VERIFY(m_particles);
119-
m_particles->Play(false);
119+
m_particles->Play(bHudMode);
120120
}
121121

122-
void CScriptParticles::PlayAtPos(const Fvector& position)
122+
void CScriptParticles::PlayAtPos(const Fvector& position, bool bHudMode)
123123
{
124124
VERIFY(m_particles);
125125
//m_particles->play_at_pos (position);
126126
m_transform.translate_over(position);
127127
m_particles->UpdateParent(m_transform, zero_vel);
128-
m_particles->Play(false);
128+
m_particles->Play(bHudMode);
129129
m_particles->UpdateParent(m_transform, zero_vel);
130130
}
131131

src/xrGame/script_particles.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class CScriptParticles
4242
CScriptParticles(LPCSTR caParticlesName);
4343
virtual ~CScriptParticles();
4444

45-
void Play();
46-
void PlayAtPos(const Fvector& pos);
45+
void Play(bool bHudMode = false);
46+
void PlayAtPos(const Fvector& pos, bool bHudMode = false);
4747
void Stop();
4848
void StopDeffered();
4949

src/xrGame/string_table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void CStringTable::Load(LPCSTR xml_file_full)
100100
if (m_bWriteErrorsToLog && string_text)
101101
Msg("[string table] '%s' no translation in '%s'", string_name, pData->m_sLanguage.c_str());
102102

103-
VERIFY3(string_text, "string table entry does not have a text", string_name);
103+
R_ASSERT3(string_text, "string table entry does not have a text", string_name);
104104

105105
STRING_VALUE str_val = ParseLine(string_text, string_name, true);
106106

0 commit comments

Comments
 (0)