View Issue Details

IDProjectCategoryView StatusLast Update
0001151The Dark ModPhysicspublic10.01.2012 07:23
ReporterIshtvan Assigned ToIshtvan  
PrioritynormalSeveritycrashReproducibilitysometimes
Status closedResolutionfixed 
Summary0001151: Melee Combat Crash (Intermittent When Clipmodel Starts Out In Solid)
DescriptionI was leaning into an AI's head (or possibly hammer) and blackjacking and got a crash to desktop. The last thing in the log was "Attack clipmodel started out inside something it hits."

It seems this code in CMeleeWeapon::AcivateAttack is causing a problem:
[code]
    // If we started out in something we hit, we're already done
    if ( tr.fraction < 1.0f )
    {
        DM_LOG(LC_WEAPON,LT_DEBUG)LOGSTRING("Attack clipmodel started out inside something it hits.\r");

        MeleeCollision( gameLocal.world, vec3_zero, &tr, -1 );
        DeactivateAttack();
    }
[/code]

One weird thing I see is that I'm passing in the worldspawn entity. I'm not sure why I did that, I would have thought I would have used the entity from the trace. It could be there's some conflict between the world being passed in and the entity in the trace being passed in. Could be that it sees a joint index > 0, knows that it hit an AF body and tries to cast the world to an AF or something.

I'll try fixing it by replacing world with the entity actually colliding.
TagsNo tags attached.

Relationships

related to 0002973 resolvedgreebo Fix uninitialised pointers returned by CollisionModelManager::Translate() 

Activities

Ishtvan

Ishtvan

23.09.2008 09:18

reporter   ~0001629

Last edited: 23.09.2008 09:21

I fixed the code below to transmit the right entity, but I'm not entirely sure if this fixed the crash, since the crash happened rarely to start with. Need feedback on whether hitting stuff extremely close to you (objects, the world, AI) still causes an intermittent crash.

Ishtvan

Ishtvan

23.09.2008 10:18

reporter   ~0001631

Nope, crash is still happening. For some reason it happens right away when I load up test/stack and hit the brick wall near the stacked bottles/boards. It seems like the first attack hits nothing (when it sould have hit the world), then the second attack crashes. I swung at the pile of carrots before this.

This is the last in the log:
[.\DarkMod\MeleeWeapon.cpp ( 99):DEB (WEAPON) FR: 1169] Activate attack called. Weapon CMeleeWeapon_attachment_meleetest_shortsword_339, owner player1, attack name slash_rl.
[.\DarkMod\MeleeWeapon.cpp ( 99):DEB (WEAPON) FR: 1294] Activate attack called. Weapon CMeleeWeapon_attachment_meleetest_shortsword_339, owner player1, attack name slash_rl.
[.\DarkMod\MeleeWeapon.cpp ( 153):DEB (WEAPON) FR: 1294] Attack clipmodel started out inside something it hits.

The first is the attack that doesn't seem to hit anything, second is the one that crashes.
greebo

greebo

23.09.2008 17:12

administrator   ~0001632

Last edited: 23.09.2008 17:21

The stacktrace is showing that the access violation is here:

if( tr->c.material != NULL )
   type = tr->c.material->GetSurfaceType(); // crash

This is due to the material pointer pointing to uninitialised memory (0xbaadf00d). I see that the trace_t tr structure is not cleared after construction, I'll try to nullify the structure's contents with memset and see whether the crash is still happening.

greebo

greebo

23.09.2008 17:20

administrator   ~0001633

Last edited: 23.09.2008 17:21

No, this didn't help. I see that the call to the closed source method in line Clip.cpp:1055

collisionModelManager->Translation( &results, start, end, trm, trmAxis, contentMask, 0, vec3_origin, mat3_default );

is returning a trace_t structure with a pointer set to invalid memory. I'll see what can be done here.

Ishtvan

Ishtvan

12.10.2008 22:04

reporter   ~0001975

resolved, with some aesthetic problems (now all surfaces make the default metal surface sounds when you hit them at point blank... maybe change the defaults? Also, velocity direction is somewhat wrong when you hit moveables point blank)

Issue History

Date Modified Username Field Change
20.09.2008 20:58 Ishtvan New Issue
20.09.2008 20:58 Ishtvan Status new => assigned
20.09.2008 20:58 Ishtvan Assigned To => Ishtvan
23.09.2008 09:18 Ishtvan Note Added: 0001629
23.09.2008 09:18 Ishtvan Status assigned => feedback
23.09.2008 09:21 Ishtvan Note Edited: 0001629
23.09.2008 10:18 Ishtvan Note Added: 0001631
23.09.2008 10:18 Ishtvan Status feedback => confirmed
23.09.2008 17:12 greebo Note Added: 0001632
23.09.2008 17:20 greebo Note Added: 0001633
23.09.2008 17:21 greebo Note Edited: 0001632
23.09.2008 17:21 greebo Note Edited: 0001633
23.09.2008 17:21 greebo Note Edited: 0001633
12.10.2008 22:04 Ishtvan Note Added: 0001975
12.10.2008 22:04 Ishtvan Status confirmed => resolved
12.10.2008 22:04 Ishtvan Resolution open => fixed
29.06.2009 08:06 greebo Status resolved => closed
10.01.2012 07:23 greebo Relationship added related to 0002973