Sunday, June 1, 2014

Sectors and Setups Again

Continued from the previous entry

In the last post, we examined the sectors and setups in the set files for EMI and GRIM and identified the problem spot.

In the ResisdualVM source, these are the places where the substring check of the sector name is used:
  • Actor::setShadowPlane (called from Lua_V1::SetActorShadowPlane)
  • Lua_V1::IsPointInSector
  • Lua_V1::IsActorInSector
  • Lua_V1::GetSectorOppositeEdge
After a bunch of decompilation and poking through the game with a debugger, I found that for GRIM:
  • SetActorShadowPlane appears to use an exact string comparison
  • IsPointInSector uses a substring check (_strstr)
  • IsActorInSector uses a substring check (_strstr)
  • GetSectorOppositeEdge appears to use an exact string comparison
The functions SetActorShadowPlane and GetSectorOppositeEdge both use a byte by byte comparison to check the string equality.

In EMI, in the original retail version:
  • SetActorShadowPlane is not present in EMI
  • IsPointInSector is not used in the EMI game scripts
  • IsActorInSector appears to use an exact string comparison
  • GetSectorOppositeEdge appears to use an exact string comparison
I was also given the suggestion to replace the call to getSectorByName(String &str, Vector3d &pos) and getSectorByName(char *name, Vector3d &pos) by using the versions without the Vector3d parameter. This ultimately won't work because the GRIM implementation will return incorrect sectors due to the substring string compare.

With all of this information, I can finally say that the updated PR should have the correct behavior for both GRIM and EMI. Whew, that was a lot of work for very little code contribution! Hopefully next week is more productive!

No comments:

Post a Comment