diff --git a/docs/rh-log.txt b/docs/rh-log.txt index bde460a68..425b41ac8 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ June 21, 2006 (Changes by Graf Zahl) +- Fixed: Decal actors with an invalid decal texture caused a crash. - Fixed: Player could crouch while dead. - Fixed: The sidedef loader could allocate insufficient memory if a map contained unused sidedefs. diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index da2c2de56..3a4cfc082 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -722,29 +722,37 @@ void ADecal::BeginPlay () // If no decal is specified, don't try to create one. if (args[0] != 0 && (tpl = DecalLibrary.GetDecalByNum (args[0])) != 0) { - // Look for a wall within 64 units behind the actor. If none can be - // found, then no decal is created, and this actor is destroyed - // without effectively doing anything. - Trace (x, y, z, Sector, - finecosine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], - finesine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], 0, - 64*FRACUNIT, 0, 0, NULL, trace, TRACE_NoSky); - - if (trace.HitType == TRACE_HitWall) + if (tpl->PicNum == 65535) { - decal = new DBaseDecal (this); - wall = sides + trace.Line->sidenum[trace.Side]; - decal->StickToWall (wall, trace.X, trace.Y); - tpl->ApplyToDecal (decal, wall); - // Spread decal to nearby walls if it does not all fit on this one - if (cl_spreaddecals) - { - decal->Spread (tpl, wall, trace.X, trace.Y, z); - } + Printf("Decal actor at (%ld,%ld) does not have a valid texture\n", x>>FRACBITS, y>>FRACBITS); + } else { - DPrintf ("Could not find a wall to stick decal to at (%ld,%ld)\n", x>>FRACBITS, y>>FRACBITS); + // Look for a wall within 64 units behind the actor. If none can be + // found, then no decal is created, and this actor is destroyed + // without effectively doing anything. + Trace (x, y, z, Sector, + finecosine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], + finesine[(angle+ANGLE_180)>>ANGLETOFINESHIFT], 0, + 64*FRACUNIT, 0, 0, NULL, trace, TRACE_NoSky); + + if (trace.HitType == TRACE_HitWall) + { + decal = new DBaseDecal (this); + wall = sides + trace.Line->sidenum[trace.Side]; + decal->StickToWall (wall, trace.X, trace.Y); + tpl->ApplyToDecal (decal, wall); + // Spread decal to nearby walls if it does not all fit on this one + if (cl_spreaddecals) + { + decal->Spread (tpl, wall, trace.X, trace.Y, z); + } + } + else + { + DPrintf ("Could not find a wall to stick decal to at (%ld,%ld)\n", x>>FRACBITS, y>>FRACBITS); + } } } else