Skip to content

Commit a31a78b

Browse files
revolucasXottab-DUTY
authored andcommitted
= Consumables greater then 1x1 inv_grid_width will no longer crash the game when dragged onto a quick slot because they are ignored
1 parent 2a9d686 commit a31a78b

File tree

5 files changed

+17
-25
lines changed

5 files changed

+17
-25
lines changed

src/xrGame/ShootingObject.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ void CShootingObject::Load(LPCSTR section)
6969
modeShotTime = 60.f / modeShotTime;
7070

7171
//Cycle down RPM after first 2 shots; used for Abakan/AN-94
72-
cycleDown = READ_IF_EXISTS(pSettings, r_bool, section, "cycle_down", false);
72+
if (pSettings->line_exist(section, "cycle_down"))
73+
cycleDown = pSettings->r_bool(section, "cycle_down");
74+
else
75+
cycleDown = false;
7376
//Alundaio: END
7477

7578
LoadFireParams(section);

src/xrGame/ai/stalker/ai_stalker_misc.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ void CAI_Stalker::process_enemies()
177177
typedef MemorySpace::squad_mask_type squad_mask_type;
178178
typedef CVisualMemoryManager::VISIBLES VISIBLES;
179179

180-
bool found = false;
181180
squad_mask_type mask = memory().visual().mask();
182181
VISIBLES::const_iterator I = memory().visual().objects().begin();
183182
VISIBLES::const_iterator E = memory().visual().objects().end();
@@ -209,7 +208,6 @@ void CAI_Stalker::process_enemies()
209208
//Alundaio: END
210209

211210
memory().make_object_visible_somewhen(member->memory().enemy().selected());
212-
found = true;
213211
break;
214212
}
215213
}

src/xrGame/stalker_combat_actions.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,14 @@ void CStalkerActionKillEnemy::execute()
441441
CMemoryInfo mem_object = object().memory().memory(enemy);
442442
if (mem_object.m_object)
443443
object().best_cover(mem_object.m_object_params.m_position);
444-
u32 last_time_seen = object().memory().visual().visible_object_time_last_seen(enemy);
445444

446-
//Here NPC will only fire at not visible enemy for no more than 3 seconds instead of shooting at walls like morons
447-
if (last_time_seen != u32(-1) && Device.dwTimeGlobal - last_time_seen <= 3000)
445+
if (object().memory().visual().visible_now(enemy))
448446
{
449447
object().sight().setup(CSightAction(enemy, true, true));
450448
fire();
451449
}
450+
else if (mem_object.m_object)
451+
object().sight().setup(CSightAction(SightManager::eSightTypePosition,mem_object.m_object_params.m_position,true));
452452
}
453453
else
454454
object().sight().setup(CSightAction(SightManager::eSightTypePathDirection, true, true));
@@ -544,21 +544,14 @@ void CStalkerActionTakeCover::execute()
544544
m_storage->set_property(eWorldPropertyInCover, true);
545545
}
546546

547-
//Don't shoot if enemy not visible for longer than 3 seconds
548-
u32 last_time_seen = object().memory().visual().visible_object_time_last_seen(enemy);
549-
if (last_time_seen != u32(-1) && Device.dwTimeGlobal - last_time_seen <= 3000 && fire_make_sense())
550-
{
551-
fire();
552-
}
553-
else
554-
aim_ready();
555-
556547
if (object().memory().visual().visible_now(enemy))
557548
{
558-
object().sight().setup(CSightAction(object().memory().enemy().selected(), true, true));
549+
object().sight().setup(CSightAction(enemy, true, true));
550+
fire();
559551
}
560552
else
561553
{
554+
aim_ready();
562555
if (_abs(object().Position().y - mem_object.m_object_params.m_position.y) > 3.5f)
563556
{
564557
Fvector3 Vpos = { mem_object.m_object_params.m_position.x, object().Position().y + 1.f, mem_object.m_object_params.m_position.z };
@@ -724,13 +717,6 @@ void CStalkerActionHoldPosition::execute()
724717
inherited::execute();
725718

726719
//Alundaio: Cleaned up
727-
/*
728-
Possible TODO : This action is a good place to prevent stalkers staring at walls.
729-
A simple ray query each execute can do the trick by rotating the stalker until
730-
the differences between the last query and new query are larger than some defined threshold.
731-
This way you can detect edges of walls and would give the illusion of stalkers looking at corridors or chokepoints instead of through a wall.
732-
*/
733-
734720
const CEntityAlive* enemy = object().memory().enemy().selected();
735721
if (!enemy)
736722
return;

src/xrGame/stalker_property_evaluators.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,12 @@ CStalkerPropertyEvaluatorReadyToKill::CStalkerPropertyEvaluatorReadyToKill(
211211

212212
_value_type CStalkerPropertyEvaluatorReadyToKill::evaluate()
213213
{
214-
if (!m_object->ready_to_kill())
214+
if (!m_object->ready_to_kill() || !m_object->best_weapon())
215215
return (false);
216216

217217
if (!m_min_ammo_count)
218218
return (true);
219219

220-
VERIFY(m_object->best_weapon());
221220
CWeapon& best_weapon = smart_cast<CWeapon&>(*m_object->best_weapon());
222221
if (best_weapon.GetAmmoElapsed() <= (int)m_min_ammo_count)
223222
{

src/xrGame/ui/UIActorMenuInventory.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,12 @@ bool CUIActorMenu::ToQuickSlot(CUICellItem* itm)
738738
if (!eat_item)
739739
return false;
740740

741+
//Alundaio: Prevent icons greater then 1x1 to be quick slotted
742+
Ivector2 iWH = iitem->GetInvGridRect().rb;
743+
if (iWH.x > 1 || iWH.y > 1)
744+
return false;
745+
//Alundaio: END
746+
741747
u8 slot_idx = u8(m_pQuickSlot->PickCell(GetUICursor().GetCursorPosition()).x);
742748
if (slot_idx == 255)
743749
return false;

0 commit comments

Comments
 (0)