Forum Announcement, Click Here to Read More From EA_Cade.

Wall masks/cutouts: how/where are they defined?

pboxpbox Posts: 630 Member
edited March 5 in Nominated Threads
I'm not sure if it was the last patch that borked this, or if it's only more obvious now when doors can have darker textures:

63079_141216163802doorbork.jpg

In any case I would like to un-bork this (i.e. make the cutout fit the single tile doors) but I cannot find how/where this is defined. Is it a texture like in previous games? Or something else entirely?
Stuff for TS2 · TS3 · TS4
Post edited by EA_Cade on

Comments

  • pboxpbox Posts: 630 Member
    In the meantime I know what/where the textures are, but what's still unclear to me is how they are referenced. I cannot find anything in the MODL/MLOD resources that would point at the wall mask (I know how all other textures are being referenced, it's just this one that's puzzling me) or elsewhere -- could some shed a little light on this?

    Reason I ask is that I find it very useful for building to have doors and windows available both as one- and two-tile versions, and right now what I'm doing to make those versions involves copying the entire mesh which might be unnecessary .. seeing as I'm not changing it at all. I would like to find out whether there's a more efficient way to do this.
    Stuff for TS2 · TS3 · TS4
  • SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hey pbox,

    Look for the resource with type 0x81ca1a10, this is a table with cutout info, and it defines the mappings. For the Base Game there is one single resource that contains all the cutout info for all objects. For the packs (EP01, GP01) they are loose (i.e. one resource per object) which is actually a bug that we may fix that at some point (it's basically an optimization to load less files).

    The trick with what you are trying to do is that if you want to replace just one cutout entry in the combined resource the only way I can guarantee it will work (without more investigation) is to override the entire resource which of course is brittle since you are replacing a lot of Maxis-authored data unnecessarily.

    Otherwise, you can try to override just one resource that is also defined inside a combined resource. I am not sure it will work though as it will depend on the load order as to which one will win. Note that load order might not be deterministic, although I suspect it is. You might get lucky and it just works, but I can't say for sure off the top of my head.

    The table format itself looks fairly straightforward, but I am sure it would help if I provided a BT file. Let me know if you need that and I'll see what I can do.

    -SGMS
  • pboxpbox Posts: 630 Member
    edited April 2015
    Oooh thank you \o/

    Not sure if you aren’t misunderstanding what I’m after in my second post, though (the first one is ooooooold and I should perhaps not have resurrected it) – back in December, I was still looking to override the cutouts for existing Maxis doors; meanwhile, I’ve already done that (by finding the actual _IMG resources and overriding those – that works fine, just like any other texture override).

    For the packs (EP01, GP01) they are loose (i.e. one resource per object) which is actually a bug that we may fix at some point (it's basically an optimization to load less files).

    Oh. The tool currently I use to clone doors/windows with (TSRW) adds a cutout _IMG to each CC package (with a unique ID, not as an override); from what you say it sounds like it would be exploiting the bug you mention. If you’re going to fix that, will there still be a way for custom objects to define their own cutouts at all?

    Anyway, for those two-tile doors I currently do it would be just fine to be able to reference a different existing cutout instead of having an actual custom one (they tend to be pretty rectangular anyway) -- but is there any reference in the object at all? Or does that 0x81ca1a10 table (which I can’t look at right now, am on the wrong computer) basically tell the game which cutout to use based on ID of the MODL or something? That would certainly also explain why my doors got borked when I tried to remove the cloned mesh and reference the original one instead ..

    Otherwise, you can try to override just one resource that is also defined inside a combined resource. I am not sure it will work though [..]

    Do you mean a cutout resource, or some other kind of resource? If it's the latter, a BT would be cool, yes =).


    ETA, *lightbulb* -- 0x81ca1a10, does that happen to be MTBL? The one that also defines stuff about how the little snapshots for catalogue thumbnails are taken? Then I know what you mean.
    Stuff for TS2 · TS3 · TS4
  • pboxpbox Posts: 630 Member
    edited April 2015
    OK so I checked and 0x81ca1a10 is indeed what I thought it was when I had that lightbulb moment before (MTBL). Doesn't seem to contain a reference to the _img that is used for the cutout though, only a value that is labeled "Unk1" in s4pe which is 0x00010341 for one tile doors, 0x00010342 for two and 0x00010343 for three tile. Plus ModelIID and an "UnkIID_1" which repeats the ModelIID in the doors I looked at (possibly the modl for the diagonal version? no, that seems to be "plz use the cutout from this MODL" but that gets me back to square one in a way .. how do I know/define what _img that is?), as well as bounding box stuff that AFAIK only affects the catalogue thumbnails.

    I'm curious what you meant by that "just one resource that is also defined inside a combined resource" now ..
    Post edited by pbox on
    Stuff for TS2 · TS3 · TS4
  • brujah236brujah236 Posts: 14 New Member
    @SimGuruModSquad I know this is an older thread but I've been racking my brain trying to figure this one out... Where in the MODL is the cutout referenced? I've even gone so far as to look in the hex and I have not been able to find any links either. Would it be possible to get a .bt for the MODL resource or does one already exist somewhere and I just haven't found it?
  • IngeJonesIngeJones Posts: 3,247 Member
    Brujah are you talking about looking for the reference to the MTBL resource?
  • brujah236brujah236 Posts: 14 New Member
    No. I'm looking for the actual cutout image reference. As pbox said in her last post, the instances in the MTBL point to a MODL.
  • SimGuruModSquadSimGuruModSquad Posts: 597 Member
    Hey @brujah236 ,

    Actually a little bit of magic here, first see http://forums.thesims.com/en_US/discussion/878085 which describes the cutout resource format.

    In the format, there is a baseFileNameHash. The texture key is derived from this key. Generally the string “_0_0_f” is added to the hash, and is the texture key.

    However, if the widthAndMappingFlags indicates multiple textures (i.e. bit 6 is 0) then then it’s slightly different. In this case we add “_x_y_f” where x=level and y=tile. Although it looks to me that this feature is not actually used so you may not run into this case.

    To add to the baseFileNameHash, do something like the following (where baseFileNameHash is the initial hash):
    const uint64 HASH_MULTIPLICAND = 1099511628211;
    uint64 HashString64(const char8 *s, size_t len, uint64 initialHash)
    {
        uint64_t hash = initialHash;
    
        while(len--)
            hash = (hash * HASH_MULTIPLICAND) ^ Tolower(*s++);
    
        return hash;
    }
    

    An example:
    baseFileNameHash =  0xd0777af4228641d0
    Texture key      = 0x865cc5bd8daac443 (type is 0x00b2d882)
    

    -SGMS
  • brujah236brujah236 Posts: 14 New Member
    Thanks a million!
  • pboxpbox Posts: 630 Member
    The texture key is derived from this key. Generally the string “_0_0_f” is added to the hash, and is the texture key.

    Thanks a lot for that explanation -- that is exactly what I wanted to know, above!
    Stuff for TS2 · TS3 · TS4

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file
Return to top