CBisson
Posted: Apr 12 2004, 08:45 PM
//******************************************************************
//*Notes:
//* You may use this code for your own mods. Simply change
//* whatever RESREFs you need.
//* Do not change any of the variables that have already been
//* made up, particulary those that alter offsets as it
//* will mess up the area file.
//* If you plan on adding more than one type of header (such as
//* two actors, you'll need to duplicate this code exactly.
//* Of course, you can alter any of the X,Y points to your own decimals.
//* I've only included the most popular changes to headers, so
//* if you need to change the number of times an actor has been
//* spoken to, for example, you'll have to figure out the offset.
//* When adding this code to your own .TP2, do not include these notes or
//* the BEGIN 'How to....' line
//*
//******************************************************************
BEGIN ~How To Add Ambiants To ARE files With Weidu.~
//Choose the area file to modify:
COPY_EXISTING ~AR0020.ARE~ ~override/AR0020.ARE~
//Prepare for the area modification.
//---------------------------------DO NOT ALTER FROM HERE TO THE FOLLOWING BREAK.
READ_SHORT ~0x058~ ~#ofActor~
READ_SHORT ~0x054~ ~actorOff~
READ_SHORT ~0x05a~ ~#ofTrigg~
READ_SHORT ~0x05c~ ~triggOff~
READ_SHORT ~0x064~ ~#ofSpawn~
READ_SHORT ~0x060~ ~spawnOff~
READ_SHORT ~0x06c~ ~#ofEntra~
READ_SHORT ~0x068~ ~entraOff~
READ_SHORT ~0x074~ ~#ofConta~
READ_SHORT ~0x070~ ~contaOff~
READ_SHORT ~0x076~ ~#ofItems~
READ_SHORT ~0x078~ ~itemsOff~
READ_SHORT ~0x080~ ~#ofVerti~
READ_SHORT ~0x07c~ ~vertiOff~
READ_SHORT ~0x082~ ~#ofAmbia~
READ_SHORT ~0x084~ ~ambiaOff~
READ_SHORT ~0x08c~ ~#ofVaria~
READ_SHORT ~0x088~ ~variaOff~
READ_SHORT ~0x09c~ ~#ofExplo~
READ_SHORT ~0x0A0~ ~exploOff~
READ_SHORT ~0x0A4~ ~#ofDoors~
READ_SHORT ~0x0A8~ ~doorsOff~
READ_SHORT ~0x0AC~ ~#ofAnima~
READ_SHORT ~0x0B0~ ~animaOff~
READ_SHORT ~0x0B4~ ~#ofTiled~
READ_SHORT ~0x0B8~ ~tiledOff~
READ_SHORT ~0x0BC~ ~songsOff~
READ_SHORT ~0x0C0~ ~restcOff~
READ_SHORT ~0x0C8~ ~#ofAutom~
READ_SHORT ~0x0C4~ ~automOff~
//Increase the number of Actors and correct the offsets
WRITE_SHORT 0x082 (~%#ofAmbia%~ + 1)
WRITE_SHORT 0x07c (~%vertiOff%~ + 212)
WRITE_SHORT 0x088 (~%variaOff%~ + 212)
WRITE_SHORT 0x0A0 (~%exploOff%~ + 212)
WRITE_SHORT 0x0A8 (~%doorsOff%~ + 212)
WRITE_SHORT 0x0B0 (~%animaOff%~ + 212)
WRITE_SHORT 0x0B8 (~%tiledOff%~ + 212)
WRITE_SHORT 0x0BC (~%songsOff%~ + 212)
WRITE_SHORT 0x0C0 (~%restcOff%~ + 212)
WRITE_SHORT 0x0C4 (~%automOff%~ + 212)
//Complete the prep work by adding a bunch of blank bytes.
INSERT_BYTES (~%ambiaOff%~ + ~%#ofAmbia%~ * 212) 212
//Prep work is done.
//-----------------------------DO NOT ALTER ANYTHING ABOVE HERE TO THE TOP BREAK.
//Modify the specifics for your Ambiant below.
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 0) ~Your Ambiants Name~
//You can change the 'Your Ambiants Name' but do not go above 32 characters.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 32) 282
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 34) 787
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 36) 500
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 46) 100
//Above, in order, X, Y, Radius, Volume %.
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 48) ~AM1200B~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 56) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 64) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 72) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 80) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 88) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 96) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 104) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 112) ~~
WRITE_ASCII (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 120) ~~
//Insert the RESREFs of what sounds you want between the above tildes.
// REMEMBER, the sound you pick may be keyed in a different biff than what the game
// reads for the area file, so if you're not careful, you could cause a crash.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 128) 1
//Match the written decimal with the number of sounds you want.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 130) 1
//Match the written decimal with the number of sounds you want.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 132) 10
//The number of seconds between each sound.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 136) 1
//Number of sounds to use in each 'set'
//Visibility schedule- REM out or delete the groups you won't be using.
//ALL HOURS:
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 140) 65535
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 142) 65535
//DAY ONLY:
// WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 140) 65472
// WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 142) 63
//NIGHT ONLY:
// WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 140) 63
// WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 142) 65472
//You can also get other combinations in 0x0h from NI, but remember to convert the hex bytes to decimals.
WRITE_LONG (~%ambiaOff%~ + ~%#ofAmbia%~ * 212 + 144) 7
//Common flags that control the ambiant:
//Enabled, Point: 3
//Enabled, Point, Main: 7
//Enabled, Main, Area: 13