Jump to content

Adding BAMs via WeiDu


Yovaneth

Recommended Posts

I would like to add the graphic of a door to an existing area - just the graphic; it doesn't need to work - and the only way I can think to do it is to create a BAM and add that to the area via WeiDU. However, my patching knowledge of WeiDU is extremely limited and I have no idea even if this can be done. If it's possible, could someone please explain in words of one syllable and with copious coding examples, how I can achieve this?

 

Thank you.

 

-Y-

Link to comment

I'm pretty sure it could be done but unfortunately I can't giving you any coding examples. We are doing something similar for BG1UB, concerning patching in a container to non-TotSC versions. Ascension64 had this to say about it:

Adding a container can be quite tricky. The most efficient way would be to add the container by inserting a specific number of bytes at the containers offset, then filling in the details. Then, the container's vertices will need to be added by adding the appropriate vertices at the vertices offset. Finally, to preserve offset and ordering, all offsets after containers will need to be updated (e.g. if music offset is after container offset, music offset needs to be incremented by the number of bytes inserted). Then, the vertex indices of all containers, info/trigger points, doors, and such, will need to be updated to reflect their correct vertices. But beware that only the indices that need to be updated should be updated (indices greater than where you inserted the vertices).

 

Perhaps a slightly quicker way to add the container is to the end of the pack of containers rather than the start, which means fewer vertices need to be updated. But, the tricky part is to know exactly which index to add the vertices.

Now, maybe none of that really answers your question (adding a BAM) but I would think that'd be the least trickiest part (but I could be wrong).
Link to comment

Can you add the bam like a spell effect, play the bam on the location and it would look like there was a door there?

 

Thinking about it, this would seem to be quite easy. The tricky part would be if you wanted it to be a working door. You would then need to add triggers to the area file, though there is a tutorial on this around. I think it was by SConrad.

 

I don't think anyone has done it the proper way by adding a proper door tile to an area other than overwriting the area with an updated area containing the new tiles.

Link to comment

You want to add an ARE animation structure. All the stuff isn't entirely known, so you'd have to play around with it for a bit, but it shouldn't be impossible. Unlike containers or actual doors or trigger points, animations don't need vertices (praise Jesus!) and obviously don't need items, so it's as simple as INSERT_BYTES the structure and updating the offsets.

 

You're screwed if the player disables animations or has other low settings, though.

 

I'm sure Nyth or somebody will be along to give you code for adding animations.

Link to comment

Sure, happy to help with the code if you'd like.

 

Bear in mind that an animation structure never can work like a door and won't bar progress - but unless you feel like going through the .wed and .tis files too it will give you the look you're going for without the bother of creating a new door :rant:

Link to comment
Sure, happy to help with the code if you'd like.

 

Bear in mind that an animation structure never can work like a door and won't bar progress - but unless you feel like going through the .wed and .tis files too it will give you the look you're going for without the bother of creating a new door :)

You have no idea how grateful I'd be.... :rant: I really only want to give the appearance of a door (actually an arch in one wall of the Bridge District). What information do you need from me?

 

-Y-

 

[EDIT: Grrr.. typo. I hate those].

Link to comment

COPY_EXISTING ~ar0500.are~  ~override~
 PATCH_IF (SOURCE_SIZE > 0x11b) THEN BEGIN
READ_LONG   0x0054 "Offset_of_actors"
READ_LONG   0x005c "Offset_of_info_points"
READ_LONG   0x0060 "Offset_of_spawn_points"
READ_LONG   0x0068 "Offset_of_entrances"
READ_LONG   0x0070 "Offset_of_containers"
READ_LONG   0x0078 "Offset_of_items"
READ_LONG   0x007c "Offset_of_vertices"
READ_LONG   0x0084 "Offset_of_ambients"
READ_LONG   0x0088 "Offset_of_variables"
READ_LONG   0x00a0 "Offset_to_explored_bitmask"
READ_LONG   0x00a8 "Offset_to_doors_structures"
READ_LONG   0x00ac "Count_of_animations"
READ_LONG   0x00b0 "Offset_to_animation_structures"
READ_LONG   0x00b8 "Tiled_objects_offset"
READ_LONG   0x00bc "Offset_to_Songs_entries"
READ_LONG   0x00c0 "Offset_to_interruption_of_rest_party"
READ_LONG   0x00c4 "Offset_of_the_automap_note"
READ_LONG   0x00cc "Offset_to_the_projectile_traps"
SET "o" = ("Offset_to_animation_structures" + (0x4c * "Count_of_animations"))
SET "Count_of_animations" += 0x1
PATCH_IF NOT ("Offset_of_actors"					 < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_actors" += 0x4c
END
PATCH_IF NOT ("Offset_of_info_points"				< "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_info_points" += 0x4c
END
PATCH_IF NOT ("Offset_of_spawn_points"			   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_spawn_points" += 0x4c
END
PATCH_IF NOT ("Offset_of_entrances"				  < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_entrances" += 0x4c
END
PATCH_IF NOT ("Offset_of_containers"				 < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_containers" += 0x4c
END
PATCH_IF NOT ("Offset_of_items"					  < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_items" += 0x4c
END
PATCH_IF NOT ("Offset_of_vertices"				   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_vertices" += 0x4c
END
PATCH_IF NOT ("Offset_of_ambients"				   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_ambients" += 0x4c
END
PATCH_IF NOT ("Offset_of_variables"				  < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_variables" += 0x4c
END
PATCH_IF NOT ("Offset_to_explored_bitmask"		   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_to_explored_bitmask" += 0x4c
END
PATCH_IF NOT ("Offset_to_doors_structures"		   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_to_doors_structures" += 0x4c
END
PATCH_IF NOT ("Tiled_objects_offset"				 < "Offset_to_animation_structures") THEN BEGIN
  SET "Tiled_objects_offset" += 0x4c
END
PATCH_IF NOT ("Offset_to_Songs_entries"			  < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_to_Songs_entries" += 0x4c
END
PATCH_IF NOT ("Offset_to_interruption_of_rest_party" < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_to_interruption_of_rest_party" += 0x4c
END
PATCH_IF NOT ("Offset_of_the_automap_note"		   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_of_the_automap_note" += 0x4c
END
PATCH_IF NOT ("Offset_to_the_projectile_traps"	   < "Offset_to_animation_structures") THEN BEGIN
  SET "Offset_to_the_projectile_traps" += 0x4c
END
WRITE_LONG  0x0054 "Offset_of_actors"
WRITE_LONG  0x005c "Offset_of_info_points"
WRITE_LONG  0x0060 "Offset_of_spawn_points"
WRITE_LONG  0x0068 "Offset_of_entrances"
WRITE_LONG  0x0070 "Offset_of_containers"
WRITE_LONG  0x0078 "Offset_of_items"
WRITE_LONG  0x007c "Offset_of_vertices"
WRITE_LONG  0x0084 "Offset_of_ambients"
WRITE_LONG  0x0088 "Offset_of_variables"
WRITE_LONG  0x00a0 "Offset_to_explored_bitmask"
WRITE_LONG  0x00a8 "Offset_to_doors_structures"
WRITE_LONG  0x00ac "Count_of_animations"
WRITE_LONG  0x00b0 "Offset_to_animation_structures"
WRITE_LONG  0x00b8 "Tiled_objects_offset"
WRITE_LONG  0x00bc "Offset_to_Songs_entries"
WRITE_LONG  0x00c0 "Offset_to_interruption_of_rest_party"
WRITE_LONG  0x00c4 "Offset_of_the_automap_note"
WRITE_LONG  0x00cc "Offset_to_the_projectile_traps"
INSERT_BYTES ("o" + 0x00) 0x4c
WRITE_ASCII  ("o" + 0x00) ~GiveMeANamePlease~ // name this animation entry, you've got 32 characters to work with
WRITE_SHORT  ("o" + 0x20) 0x0 // center point x coordinate, you'll have to find these
WRITE_SHORT  ("o" + 0x22) 0x0 // center point y coordinate, you'll have to find these
WRITE_LONG   ("o" + 0x24) 0xffffffff //hours when it's active, this is active all the time
WRITE_ASCII  ("o" + 0x28) ~resref~ // your eight character resource reference for the bam you've made
WRITE_SHORT  ("o" + 0x30) 0x0 // animation number within the .bam, I'm assuming there's just one
WRITE_SHORT  ("o" + 0x32) 0x0 // stopping frame number within the .bam
WRITE_LONG   ("o" + 0x34) 0b00000000000000000001000000000101 // various flags, we're setting "is shown", "not light source", and "display in combat"
WRITE_SHORT  ("o" + 0x38) 0x0 // center point z coordinate, you'll have to find these
WRITE_SHORT  ("o" + 0x3a) 0x0 // transparency, use a higher number if the door's made of glass :)
WRITE_SHORT  ("o" + 0x3c) 0x0 // starting frame number, the door only needs one frame anyway
WRITE_BYTE   ("o" + 0x3e) 0x0 // looping chance where zero equals 100 percent
WRITE_BYTE   ("o" + 0x3f) 0x0 // starting delay, shouldn't be any
WRITE_ASCII  ("o" + 0x40) ~~  // resref to your palette bitmap, if you have one at all - otherwise, leave blank
WRITE_LONG   ("o" + 0x48) 0x0 // unused
 END

 

The stuff at the bottom that has comments is the actual animation structure, everything above that is reading and setting offsets (using lots of SET to make devSin weep).

 

You need:

 

WRITE_ASCII ("o" + 0x00) ~GiveMeANamePlease~ // name this animation entry, you've got 32

a script name here for your animation

 

WRITE_SHORT ("o" + 0x20) 0x0 // center point x coordinate, you'll have to find these

WRITE_SHORT ("o" + 0x22) 0x0 // center point y coordinate, you'll have to find these

WRITE_SHORT ("o" + 0x38) 0x0 // center point z coordinate, you'll have to find these

x, y, and z coordinates so the game knows where to play the animation

 

WRITE_ASCII ("o" + 0x28) ~resref~ // your eight character resource reference for the bam you've made

a .bam that looks like a door :rant:

Link to comment

Ah, very interesting development. I may have some use for that. :rant:

 

 

You should be able to attach a file to a post if you want a screenshot added. Pictures should also display on the post. Unless you've run out of attachement space, of course.

Link to comment
You should be able to attach a file to a post if you want a screenshot added. Pictures should also display on the post. Unless you've run out of attachement space, of course.

 

I must be thick but when I click on Insert Image, it asks for a URL. [/img] doesn't work either. I cannot find any way of attaching anything to a post?

 

 

-Y-

Link to comment

Oh, er, yes, that could be it. :rant: I have an option to attach a file right above the Post Icons when I do a full reply.

 

If you can upload an image to a web address (like Amber's Website, I suppose), you should be able to link it in with the HTML link at least.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...