View Issue Details

IDProjectCategoryView StatusLast Update
0005542The Dark ModCodingpublic17.10.2023 01:47
Reporterstgatilov Assigned Tostgatilov  
PriorityhighSeveritycrashReproducibilityhave not tried
Status resolvedResolutionfixed 
Product VersionTDM 2.09 
Target VersionTDM 2.10Fixed in VersionTDM 2.10 
Summary0005542: Crash in idEntity::Event_Frob when lockpick is selected
DescriptionBy Zeen:
  My Heart of Lone Salvation mission save started to crash whenever I tried to select lockpicks or keys.
  Other items (I tested potions, reading material) seem to be fine, but whenever I select lockpicks or keys the game freezes and crashes to desktop.
  I restarted the mission and it seem to run fine is there a way to solve this without restarting the mission?
Steps To ReproduceLoad the attached savefile in release209.
Then select key (press 'K') or lockpick (press 'P').
It will crash within a second.
Additional InformationOriginal report:
  https://forums.thedarkmod.com/index.php?/topic/20798-lockpick-key-selection-causes-crash-heart-of-lone-salvation-209/
TagsNo tags attached.

Activities

stgatilov

stgatilov

22.02.2021 08:30

administrator   ~0013712

The original save file.
CrashSave.save (3,160,042 bytes)
stgatilov

stgatilov

22.02.2021 08:31

administrator   ~0013713

(From forums)

Call stack is:
> TheDarkModx64.exe!idPlayer::PerformFrob(EImpulseState impulseState, idEntity * target) Line 11496 C++
     TheDarkModx64.exe!idClass::ProcessEventArgPtr(const idEventDef * ev, __int64 * data) Line 1047 C++
     TheDarkModx64.exe!idInterpreter::CallEvent(const function_t * func, int argsize) Line 819 C++
     TheDarkModx64.exe!idInterpreter::Execute() Line 1092 C++
     TheDarkModx64.exe!idThread::Execute() Line 872 C++
     TheDarkModx64.exe!idClass::ProcessEventArgPtr(const idEventDef * ev, __int64 * data) Line 1047 C++
     TheDarkModx64.exe!idEvent::ServiceEvents() Line 598 C++
     TheDarkModx64.exe!idGameLocal::RunFrame(const usercmd_t * clientCmds, int timestepMs) Line 3393 C++
     TheDarkModx64.exe!idSessionLocal::RunGameTic(int timestepMs) Line 3072 C++
     [Inline Frame] TheDarkModx64.exe!idSessionLocal::RunGameTics() Line 3114 C++
     TheDarkModx64.exe!idSessionLocal::FrontendThreadFunction() Line 3160 C++
     [Inline Frame] TheDarkModx64.exe!idSessionLocal::StartFrontendThread::__l2::<lambda_6b7828b12cf509cf76fb3406570c8cd1>::operator()(void *) Line 3254 C++
     TheDarkModx64.exe!<lambda_6b7828b12cf509cf76fb3406570c8cd1>::<lambda_invoker_cdecl>(void * x) Line 3256 C++

Basically, stim-response script calls idEntity::Event_Frob on target entity WaterUpBut.
It redirects to idPlayer::PerformFrob, where idEntity* highlightedEntity = m_FrobEntity.GetEntity(); is NULL.
But later this pointer is used in if ( (item != NULL) && item->UseOnFrob() && highlightedEntity->CanBeUsedBy(item, true)), because some inventory item with "use on frob" is selected by player.

I assume in this FM and in this state the corresponding stim-response is generated repeatedly for some reason. So as soon as player decides to select key or lockpick, the game crashes on next event.

The main question is: if it is possible to generate a "frob" from game script, is it valid to take gameplay settings into account?
It means that FMs using this frob event will behave differently depending on gameplay settings, which is often very bad and can break mission.
stgatilov

stgatilov

22.02.2021 08:32

administrator   ~0013714

Here is the entity definition which generates response:

// entity 868
{
"classname" "atdm:mover_lever"
"name" "PlugLever"
"frobbox_size" "15"
"interruptable" "0"
"model" "PlugLever"
"move_time" "0.7"
"origin" "76.875 5432 233"
"rotate" "0 0 0"
"sr_class_1" "R"
"sr_effect_1_1" "effect_frob"
"sr_effect_1_1_arg1" "WaterUpBut"
"sr_state_1" "1"
"sr_type_1" "1000"
"target" "BathPlug"
"target2" "DrainOnlyWhenOpen"
"translate" "0 0 -29"
"trigger_on_close" "1"
"trigger_on_open" "1"
"trigger_when_opened" "0"


And here is one which generates the stim:

// entity 869
{
"classname" "atdm:mover_lever"
"name" "PouringWater"
"frobable" "0"
"model" "PouringWater"
"noShadows" "1"
"origin" "76.875 5456.13 337.937"
"rotate" "0 0 0"
"snd_move" "noSound"
"sr_class_1" "S"
"sr_radius_1" "32"
"sr_state_1" "1"
"sr_time_interval_1" "1000"
"sr_type_1" "1000"
"target" "WaterPouringSound"
"translate" "0 0 -110"
stgatilov

stgatilov

22.02.2021 08:58

administrator   ~0013715

Fixed null pointer problem in svn rev 9144.
This is suitable for hotfix release.

However, this fix is not complete.
Now whenever player has lockpick/key selected and looks at some door/lock, it gets picked every second.
stgatilov

stgatilov

23.02.2021 05:52

administrator   ~0013719

Committed one more fix in svn rev 9148.

Now "frob" generated form script of stim-response never triggers "use current inventory item" behavior.
stgatilov

stgatilov

06.05.2021 06:33

administrator   ~0013966

One more instance of the same problem is in "Hidden Hands: Anomaly".
Game crashes when pressing switch in decontamination chamber while having key selected:
  https://forums.thedarkmod.com/index.php?/topic/20909-hidden-hands-the-anomaly/&do=findComment&comment=460267

Crashes when accessing highlightedEntity = NULL.
Should work properly on SVN.

Issue History

Date Modified Username Field Change
22.02.2021 08:30 stgatilov New Issue
22.02.2021 08:30 stgatilov Status new => assigned
22.02.2021 08:30 stgatilov Assigned To => stgatilov
22.02.2021 08:30 stgatilov Note Added: 0013712
22.02.2021 08:30 stgatilov File Added: CrashSave.save
22.02.2021 08:31 stgatilov Note Added: 0013713
22.02.2021 08:32 stgatilov Note Added: 0013714
22.02.2021 08:58 stgatilov Note Added: 0013715
23.02.2021 05:52 stgatilov Note Added: 0013719
23.02.2021 05:53 stgatilov Status assigned => resolved
23.02.2021 05:53 stgatilov Resolution open => fixed
23.02.2021 05:53 stgatilov Fixed in Version => TDM 2.10
06.05.2021 06:33 stgatilov Note Added: 0013966