Jump to content


Photo

BGT/BWP - Can't Load Beregost at Night, Get CTD


  • Please log in to reply
24 replies to this topic

#21 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 22 May 2020 - 03:23 AM

Ideally, the patch should go in both Sirine's Call and Graphics Overhaul (detecting whether the other is installed for maximum install-order compatibility).
 
The code Lollorian posted looks decidedly orcish (i.e. I believe I added the door for berelinde way back in the Bodacious Era or something), so maybe it just wasn't patching properly for the proper WEDs. I'm not sure if Sirine's Call patches or overwrites, but the same concept would apply (determining the door vertices and patching them accordingly).

 

COPY_EXISTING ~ar6700.wed~ override
              ~ar6700n.wed~ override
  sz = SOURCE_SIZE
  PATCH_IF sz > 0x48 BEGIN
    READ_LONG 0x8 ovr_count //Read initial offsets
    READ_LONG 0xc door_count
    READ_LONG 0x10 ovr_offset
    READ_LONG 0x14 sec_hdr
    READ_LONG 0x18 door_offset
    READ_LONG 0x1c dtc_indices
    READ_LONG sec_hdr poly_count
    READ_LONG (sec_hdr + 4) poly_offset
    READ_LONG (sec_hdr + 8 ) vert_offset
    READ_LONG (sec_hdr + 0xc) wall_offset
    READ_LONG (sec_hdr + 0x10) poly_table
    new_door_offset = door_offset + door_count * 0x1a
    new_vert_index = ((SOURCE_SIZE - vert_offset) / 4)

    INSERT_BYTES sz 0x20 //Insert 8 new vertex pairs
    WRITE_SHORT sz 2370 //Open door
    WRITE_SHORT (sz + 2) 1563
    WRITE_SHORT (sz + 4) 2325
    WRITE_SHORT (sz + 6) 1563
    WRITE_SHORT (sz + 8 ) 2325
    WRITE_SHORT (sz + 0xa) 1478
    WRITE_SHORT (sz + 0xc) 2370
    WRITE_SHORT (sz + 0xe) 1478
    WRITE_SHORT (sz + 0x10) 2370 //Closed door
    WRITE_SHORT (sz + 0x12) 1562
    WRITE_SHORT (sz + 0x14) 2330
    WRITE_SHORT (sz + 0x16) 1620
    WRITE_SHORT (sz + 0x18) 2330
    WRITE_SHORT (sz + 0x1a) 1536
    WRITE_SHORT (sz + 0x1c) 2370
    WRITE_SHORT (sz + 0x1e) 1478

    INSERT_BYTES poly_table 0x24 //Insert 2 new polygons
    WRITE_LONG poly_table new_vert_index //Starting vertex index
    WRITE_LONG (poly_table + 4) 4 //Vertex count
    WRITE_BYTE (poly_table + 8 ) 0x80 //Open door
    WRITE_BYTE (poly_table + 9) 0xff //Unknown
    WRITE_SHORT (poly_table + 0xa) 2325 //Boundary minimum X coordinate
    WRITE_SHORT (poly_table + 0xc) 2370 //Boundary maximum X coordinate
    WRITE_SHORT (poly_table + 0xe) 1478 //Boundary minimum Y coordinate
    WRITE_SHORT (poly_table + 0x10) 1563 //Boundary maximum Y coordinate
    WRITE_LONG (poly_table + 0x12) (new_vert_index + 4) //Starting vertex index
    WRITE_LONG (poly_table + 0x16) 4 //Vertex count
    WRITE_BYTE (poly_table + 0x1a) 0x80 //Closed door
    WRITE_BYTE (poly_table + 0x1b) 0xff //Unknown
    WRITE_SHORT (poly_table + 0x1c) 2330 //Boundary minimum X coordinate
    WRITE_SHORT (poly_table + 0x1e) 2370 //Boundary maximum X coordinate
    WRITE_SHORT (poly_table + 0x20) 1478 //Boundary minimum Y coordinate
    WRITE_SHORT (poly_table + 0x22) 1620 //Boundary maximum Y coordinate

    FOR (i = 0; i < door_count; i += 1) BEGIN //Update door polygon offsets
      WRITE_LONG (i * 0x1a + door_offset + 0x12) (THIS + 0x1a) //Open polygons offset
      WRITE_LONG (i * 0x1a + door_offset + 0x16) (THIS + 0x1a) //Closed polygons offset
      PATCH_IF (i = (door_count - 1)) BEGIN
        READ_SHORT (i * 0x1a + door_offset + 0xa) tile_index
        READ_SHORT (i * 0x1a + door_offset + 0xc) tile_count
      END
    END

    INSERT_BYTES new_door_offset 0x1a //Insert new door
    WRITE_ASCII new_door_offset ~DOOR3337~ //Name
    WRITE_SHORT (new_door_offset + 8 ) 1 //Closed
    WRITE_SHORT (new_door_offset + 0xa) (tile_index + tile_count) //Tile cell index
    WRITE_SHORT (new_door_offset + 0xe) 1 //Open polygons count
    WRITE_SHORT (new_door_offset + 0x10) 1 //Closed polygons count
    WRITE_LONG (new_door_offset + 0x12) (poly_table + 0x1a) //Open polygons offset
    WRITE_LONG (new_door_offset + 0x16) (poly_table + 0x1a + 0x12) //Closed polygons offset

    //Update offsets for new objects
    FOR (j = 0; j < ovr_count; j += 1) BEGIN //Update overlays
      WRITE_LONG (j * 0x18 + ovr_offset + 0x10) (THIS + 0x1a) //Tilemap offset
      WRITE_LONG (j * 0x18 + ovr_offset + 0x14) (THIS + 0x1a) //Tile index lookup offset
    END
    door_count += 1
    WRITE_LONG 0xc door_count
    WRITE_LONG 0x1c (dtc_indices + 0x1a)
    WRITE_LONG (sec_hdr + 4) (poly_offset + 0x1a)
    WRITE_LONG (sec_hdr + 8 ) (vert_offset + 0x1a + 0x24)
    WRITE_LONG (sec_hdr + 0xc) (wall_offset + 0x1a)
    WRITE_LONG (sec_hdr + 0x10) (poly_table + 0x1a + 0x24)
  END
BUT_ONLY

(Wtf happened to SPOILER tags? Well, it's not much code.)


Edited by Miloch, 22 May 2020 - 03:26 AM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#22 jastey

jastey
  • Administrator
  • 3219 posts

Posted 22 May 2020 - 06:28 AM

Awesome, thank you! This would be what I'd need to put into Sirine's Call, instead of overwriting the wed?



#23 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 24 May 2020 - 01:34 PM

Awesome, thank you! This would be what I'd need to put into Sirine's Call, instead of overwriting the wed?

I'm guessing so, but I'd have to look at the code to be sure (feel free to attach some or point me toward it if you want me to look at it; I don't have the recent mod offhand). The only tricky part is defining the door vertices, but those should be easy enough to pick out via DLTCEP or NI if they already exist. For Gavin, I had to draw new doors (open and closed) from scratch, but I suppose that could be easier in one sense (especially since I cheated by hiding it behind an existing wall IIRC, heh).


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#24 ALIEN

ALIEN
  • Modder
  • 983 posts

Posted 24 May 2020 - 09:55 PM

You can use this repository: https://github.com/I...ityMods/BGGOEET , there are no releases yet so just download master branch: link. I can handle git-stuff for you.


Edited by ALIEN, 24 May 2020 - 09:55 PM.

Project Infinity public BETA - mod manager for Infinity Engine games

Infinity Auto Packager - automatically generate and adds mod packages to GitHub release

Modder's Guide to GitHub - you cannot have progress without committing changes


#25 jastey

jastey
  • Administrator
  • 3219 posts

Posted 24 May 2020 - 11:34 PM

Current Sirine's Call is here: https://github.com/P...s_Call/releases