

This is for people who want to make a new playscene that doesn't overwrite the original.
If you are content to overwrite the original, then I'd advise using my "easy-edit" package.

If you want to see how much alteration can be done to a playscene, download and try out
my "Secret Wood" playscene, which was made from the Family Room.

How to hex Petz 3 Playscenes
============================

Contents: You need a hex editor! (and useful tools)
          How to make a Petz 3 scene from an original.
          Changing the sounds.
          Altering what's in the Adoption Centre Scene (or any others)

You need a hex editor! (and useful tools)
========================================

First, for this you have to use a hex editor at least some of the time.  If you don't have one, there are loads of them available for download, and they all do the same basic tasks, although some of them have complicated "bells and whistles" too for power-users.  You can get various freeware ones, such as: 
Axe, available from my site or Daniel's Odd-petz site amongst others.
Hexedit, from
http://www.okinfoweb.com/moe/files/hexedit.zip 
Hexedit (yes, same name, different program) from
http://www-physics.mps.ohio-state.edu/~prewett/hexedit/index.html

There are others which are popular these days, I gather; Hexplorer and Fhreddy are talked about on the forums.  All of them are pretty straightforward to install, anyawy, and once you've found one that you like, just learn how to use it before starting to hex in earnest.  If you have the shortcut to your chosen one on your desktop, you can drag-and-drop any file you want to investigate onto it.  They all show files in a similar way: there are three sections, the left-hand one being the "Address" section and containing numbers which show which byte you're looking at (in Hex numbers usually), and it starts at 00.  The middle section is the meat of the thing, being the actual data of the file shown as hexadecimal numbers.  The right-hand side shows the file itself also, but in this case as raw ASCII so that you see it as a mix of weird symbols or dots and text.  Most of the time you will be looking at that right-hand section in order to find or fiddle with bits of text.

Other useful tools
------------------

Notepad.exe -- came with Windows.  Used for altering the text part of scene files (e.g. the sound list).

Mspaint.exe -- came with Windows; you will want it (or a paint package of your choice) to edit the background bitmaps.

Sndrec32.exe -- comes with Windows, I think -- or preferably some better Wav sound editor. This is really just if you're going to do species other than dogs or cats; then you may want to change the sounds. There are quite a few freeware or shareware Wav file editors on the Internet.  Try http://www.winfiles.com/apps/98/wav.html and see which one suits you best.

How to make a Petz 3 scene from an original.
============================================

Before you start, make sure you have a copy of your P.F.Magic originals safely stored (or the original of whichever hexed scene you want to start with).

Okay, open up your chosen scene file in your hex editor.  I'll use the Family Room as an example, but they all work on the same principle.  The structure of the file is very similar to that of a breedfile; there is the List Of Everything that's in the file -- it starts with what looks like 

..B.M.P...F.A.M.
I.L.Y.R.O.O.M...

and directly beneath it you will see the words Family Room followed by a lot of dots, followed by BM4.  Okay, as with the breedfiles, the "offset number" is contained in that area of dots; if you look on the line just above the BM4, in the hex numbers columns, you will see

0000 0000 8C13 0000 0500 0000 0000 0000

This is where you'll see the ID number.  If you don't change that, the game will think your playscene and the otiginal one are the same scene.  You want to change the 8C or 13 to a different hexadecimal number, in order to be able to make this scene non-overwriting.

In case you're not familiar with the way Hex numbers count upwards, here's a table of our normal Decimal system alongside the Hexadecimal:

Dec	Hex
 0	00
 1	01
 2	02
 3	03
 4	04
 5	05
 6	06
 7	07
 8	08
 9	09
 10	0A
 11	0B
 12	0C
 13	0D
 14	0E
 15	0F
 16	10
 17	11
 18	12
etc

If you're still not sure, use the calculator that comes with Windows; choose View > Scientific.  You can then put in a number in Decimal (Dec) and see it converted to Hex.

Although you can easily choose a number that won't clash with other scenes on your computer, if you want to make your scene available to others, you're going to come up against one small problem that we all have; making sure that our scenes don't clash with anyone else's.  I don't think that anyone is keeping a database of the numbers for playscenes, so you'll have to make a guess and warn people what to do if yours does clash with any on their computer.

You'll want to rename the scene too, of course; that's done in the same way as for breeds, down at the bottom of the file.  Search for the hex string 50004600 and you will eventually get to the part which says P.F...M.a.g.i.c.,. .I.n.c and then some null bytes and the name of the scene twice, followed by a third version of the name which you should not touch.

Replace the letters in the first two names with those of your chosen one.  Don't go changing the dots in between the letters -- those _have_ to be null bytes (hex 00).  They aren't periods or full-stops or spaces or anything else that they may look like in the ASCII pane of your hex editor -- they are hex 00.  Now, if the name is longer than the original, you'll have to add the extra letters to the end of the name, with 00 between each letter.  This makes the breedfile longer than it was so, in the area of null bytes after the third name, delete four bytes.  Also, the letter count is wrong.  "Eh?  Wot letter count?"  I hear you cry...  Well, take a look at the three dots between the two first names, in the hex section of the editor.  You should see (for the Family Room), 00 0B 00. This tells the program that the name is 11 letters long. You need to tell the program that your name is however many, say, 13 letters long -- so, change that 0B to 0D -- in front of the first name too! -- and the letter count is correct.

If the new name were to be shorter than the original, you could leave the letter count alone and simply fill in the unused letters with null bytes.

You should now be able to open your scene and the original in the same game if you rename the scene in Windows Explorer (or (My Computer) to match the name inside.

Editing the playscene to look different
=======================================

Okay, now you come to the bitmaps.  There are two; one for the background, and one for the icon.  My advice to you would be to stick with the external bitmaps and filmstrips such as I have in my Easy-edit packages; you would need to alter the B.M.P, F.L.H. and F.L.M in the List Of Everything that's in the file to something like C.M.P, C.L.H, C.L.M so that the game thinks the files aren't there and looks on the hard drive for them.  But maybe you wnat to have everything internal; if so, and you use a hex editor for this, you'll need to make sure everything is the same size.  If you use ResHacker, available from http://www.users.on.net/johnson/resourcehacker/, replacing the files may seem easier for you -- I don't do ResHacker tutorials, though, so the following method uses a straightforward hex editor.

So, if you've chosen to do the whole thing internally, here's how to do it with a hex editor.  The first bitmap, in the case of the Family Room, begins with the BM4, so put your cursor just before that and then highlight all the way down to just before the next BM; you can select C0438 (in hex nos) bytes from the start of the first BM, if your hex editor supports block selection, or you can find where that second one is by doing a case-sensitive search for BM and making a note of exactly how far down the file it is.  Then you can select the whole block from the first to the second by putting your cursor before the first, and scrolling down the side-bar until (in the case of the Family room it's 0CB327)  Copy that to a new file and save it as back.bmp.  If you keep that part selected in your scene, you can paste the replacement picture in later without having to re-select...

You can now open it into your favourite paint package and edit it or paste your own picture into it.  All you need to do with the picture is make sure that it will make sense in the finished scene (so that ledges etc are in the right place), or that you've made it deliberately wacky :-)  I don't think anyone has yet figured out how to insert new places for pets to jump onto.  This sort of thing is presumably dealt with, in Petz 4, by the Scene editing tool.

The finished, saved picture must be 1024 pixels wide, 768 high, 256 colours, 8 bits per pixel; and the file must be 717,512 bytes in size (you can check that last size by right-clicking on it and choosing "properties").  Now copy and paste that back into your scene and save it.  

You can do the same thing with the smaller bitmap for the icon, only in this case it's a little more difficult to spot the end and it's a 25x25 pixel bitmap, 256 colour, and 1771 bytes in size.  It stops just before the first of the filmstrip sections, which is difficult to spot, I'm afraid.  But if you select 1771 bytes (06EB in hex), you won't go wrong.

Right, you're now at the filmstrip (FLM or FLH) section.  Remember the List Of Everything -- the bit which started:

..B.M.P...F.A.M.
I.L.Y.R.O.O.M...
I.C.O.N._.F.A.M.
I.L.Y.R.O.O.M...

Well, that continues on 

F.L.H...F.A.M.I.
L.Y.R.O.O.M._.F.
I.R.E...F.A.M.I.

If you look at it, you'll see that it's saying

F L H
F A M I L Y R O O M _ F I R E
F A M I L Y R O O M _ L A I R _ A 
F A M I L Y R O O M _ L A I R _ B  
F A M I L Y R O O M _ S E A T 
F A M I L Y R O O M _ W I N D O W A 
F L M

See the idea?  It's a list of FLH (and .flm) files for the parts of the scene that you can interact with, which start down at the part we've just been looking at.  There's the fire, the two mouse lairs, the seat (which actually doesn't seem to have a purpose, and the window.  You can edit them of course (if you're using the Family Room as base, you can use my handy prepared filmstrips for that, as per the easy-edit instructions).  Or, you can make it so that the game ignores one or more of them.  So, perhaps you want to remove the mouseholes.  Okay, you need to scroll up to where there is this text:

?AVFilmstrip@@ 
\Art\Sprites\Area\FamilyRoom\Sounds_Area_FamilyRoom_Fire.txt
FireA   
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Fire.flm    
Fire    BurnA   DoneA   BurnC   BurnB   KnobA
?AVXDownloadBase
?AVGoal@@
?AVGoalWatchFire@@
?AV?$XTSmartPtr@
PAVAlpoSprite@@@@
?AVCharacterSprite@@
?AVPetSprite@@
?AVSprite_WinF@@   
\Art\Sprites\Area\FamilyRoom\Sounds_Area_FamilyRoom_Window.txt 
OpenA   
\Art\Sprites\Area\FamilyRoom\FamilyRoom_WindowA.flm Window 
?AVSprite_Lair@@ 
?AVLedge@@ 
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Lair_B.flm
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Lair_A.flm  
Blue Dog Brush  
Blue Pillow Wool 
Scratching Post    
White Pillow    
Yellow Picture Frame    
Cuckoo Clock

Well, for a giggle, change 
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Lair_B.flm and 
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Lair_A.flm to 
\Art\Sprites\Area\FamilyRoom\FamilyRoom_Fire.flm

You'll have to fill out each of them with a couple of null bytes (hex 00) at the end of .flm, of course, or the file will end up the wrong size.  I say "for a giggle" because if you do that, you will find that the mice both come out of the fire switch afterwards :-)

An important note, now; you could end up with your scene causing the fire in the original one to stop working unless you rename the \Art\Sprites\Area\FamilyRoom\FamilyRoom_Fire.flm  and (in the List Of Everything) F A M I L Y R O O M _ F I R E; something like changing the "e" to "f" in both should do the trick.  It's the same theory, really, as for breeds that start talking each others' language.  You need to do this change of name preferably for all fimpstrips that you have changed, indeed really it's best to do it for the bitmaps too, although it doesn't seem to cause the same problems there.

If you want to remove something completely -- such as the fire -- then you need to replace the bytes at the beginning of that .flm with hex 00.  Just go down to where the end of the icon bitmap is, and select a good-sized chunk of bytes -- say, down to BurnC -- and fill those bytes with 00.  That will disable the fire for you, and anything else that you've renamed to use the fire filmstrip, including the mouse lairs in my daft suggestion above.

Using the same principle, you can also remove anything that you've renamed to use any similarly deleted filmstrip in other scenes, including items that you didn't want popping up in your scene (such as shells in the Beach scene).  Of course, you can always experiment with using other filmstrips, but they would need to be smaller (spaced out at the end with null bytes) and you would need to make sure that you have the correct .flh to go with your replaced .flm.  If you're going to experiment with that kind of thing, you'd be best doing it with external files first, as per my easy-edit package.

Then you can change the on-screen tip for your scene, if you want to; this is directly above the sound section.  Do a search for "Sounds root path=" and you'll see the tips directly above that.  Edit them if you wish, but don't make the text any longer than what's already there -- and fill out with spaces if your text is shorter.

Another thing you may want to change is the toyz which are in the scene when it first starts up.  This is done in the same part which you alter to change or remove filmstrips from the scene; in the Family Room:

00040432 2E3F 4156 4C65 6467 6540 4000 5C41 7274 .?AVLedge@@.\Art
00040448 5C53 7072 6974 6573 5C41 7265 615C 4661 \Sprites\Area\Fa
00040464 6D69 6C79 526F 6F6D 5C46 616D 696C 7952 milyRoom\FamilyR
00040480 6F6F 6D5F 4C61 6972 5F42 2E66 6C6D 0000 oom_Lair_B.flm..
00040496 5C41 7274 5C53 7072 6974 6573 5C41 7265 \Art\Sprites\Are
00040512 615C 4661 6D69 6C79 526F 6F6D 5C46 616D a\FamilyRoom\Fam
00040528 696C 7952 6F6F 6D5F 4C61 6972 5F41 2E66 ilyRoom_Lair_A.f
00040544 6C6D 0000 426C 7565 2044 6F67 2042 7275 lm..Blue Dog Bru
00040560 7368 0000 426C 7565 2050 696C 6C6F 7700 sh..Blue Pillow.
00040576 576F 6F6C 2053 6372 6174 6368 696E 6720 Wool Scratching 
00040592 506F 7374 0000 0000 5768 6974 6520 5069 Post....White Pi
00040608 6C6C 6F77 0000 0000 5965 6C6C 6F77 2050 llow....Yellow P
00040624 6963 7475 7265 2046 7261 6D65 0000 0000 icture Frame....
00040640 4375 636B 6F6F 2043 6C6F 636B 0000 0000 Cuckoo Clock....

Where it's got Blue Dog Brush etc, you can copy over each toy name with the name of another toy (the name has to be either the same size or shorter; if it's shorter, fill out with spaces) or you can remove the toy name completely (by filling it with spaces) if you don't want it there.

Your scene is now usable -- but if you want to change the sounds:

Changing the sounds
===================

You can either replace the sounds within the file with new ones which you have made to be the exact same size as the original, or with ones which are external to the file.  The principle is exactly the same as for a breedfile.  The key is the list which starts 

Sounds root path=.
Ptzfiles\cat\Sharedsnd\all\newcatfoot1.wav

and goes on through a series of sounds of animals walking or landing until it gets to this

    Sounds root path=.
Art\Sprites\Area\FamilyRoom\Sounds\eng_fireplaceturnon01.wav
Art\Sprites\Area\FamilyRoom\Sounds\env_firehissloop.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_firecrackle1.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_firecrackle2.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_firecrackle3.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_firehissfadeout.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_fireplaceswitch02.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_fireplaceswitch04.wav
Art\Sprites\Area\FamilyRoom\Sounds\eng_fireplaceswitch05.wav
    Sounds root path=.
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirp03.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirp18.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirp19.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping23.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping24.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping25.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping26.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping27.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping28.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping29.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping30.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping31.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_birdschirping32.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_windowopen.wav
Art\Sprites\Area\FamilyRoom\Sounds\fmrm_windowclose.wav

all of these can be changed, of course.  I always copy this out to a new text file and open it into Notepad for editing; it makes things a lot quicker.

NOTE:  The Family Room has three separate sounds lists, one of which is for the room generally, one is for the window sounds, and one is for the fire sounds.

Well, you can change the Sounds root path to be whatever you wish -- make a subdirectory off your Petz 3\Resource\Area directory if you wish, called "bird", perhaps, and change the sounds list to:

Sounds root path=resource\area\bird
birdsong1.wav
birdsong2.wav

etc.  Of course, you must fill out with spaces or null bytes, and make sure that you have the same number of sounds (you can enter NONE.WAV if you want to skip one).  Then, get yourself a series of suitable .Wav files, making sure that they are the same form as the P.F.Magic originals (22,050 Hz, 4 bit, Mono), name them according to your list, and put them in the directory.

If you do it this way, you can highlight all the area of internal Wav files, starting at the first word RIFF and going right down to the area where the file itself is named, and fill it with null bytes (hex 00).  This won't make the file any smaller on your HD, but it will make it zip up smaller if you want to let people download it!

If you want to put the sounds inside the file itself, then you will need to look at the List Of Everything that's in the file, which starts 

..B.M.P...F.A.M.
I.L.Y.R.O.O.M...

You will see that it lists the sound files also:

W A V 
E N V _ F I R E C R A C K L E 1 
E N V _ F I R E C R A C K L E 2 
E N V _ F I R E C R A C K L E 3 
E N V _ F I R E H I S S F A D E O U T 
E N V _ F I R E H I S S L O O P 
E N V _ F I R E P L A C E S W I T C H 0 2 
E N V _ F I R E P L A C E S W I T C H 0 4 

etc.

Now, this is a list of the sounds inside the file in actual order of appearance.  So the first wav file, from the first RIFF up to the beginning of the next, is the first filrecrackling sound.  If you wish to replace that with another sound, just replace the sound file with another which is either exactly the same size in bytes, or is slightly smaller but has been made to fit with extra null bytes.  and of course the sound should again be 22.050 Hz, 4 bit, Mono.  It's probably best also to change the name -- just alter one letter of E N V _ F I R E C R A C K L E 1 up here, and also in the sound list Art\Sprites\Area\FamilyRoom\Sounds\eng_firecrackle1.wav, so that the game engine doesn't get confused between playscenes.

You now have your own very special playscene :-))

Altering what's in the Adoption Centre Scene.
=============================================

Some people get bothered by hairballs hanging around in the Adoption Centre area and they don't have obliging dogz to dig holes to get rid of them, or they don't want to lose a precious shell collection by resetting the Registry (hold down Ctrl and Shift while launching the program).

For the creatively-minded, you could hex-edit the "hair ball.toy" so that it's something attractive, of course.  As with my Sapphire hairball for Dragonz :-)

But even better, you can edit it out.  The bonus of this method is that you can also edit anything you want to _into_ it; at present I've got bowls of food and the Cuckoo clock in there.  Here's how it's done:

You will have a subdirectory called "Keys" directly off your Petz3\resource directory.  In there are a few files with the extension .LKV.  This is where the game can store information on what items are in which playscene.  You are almost bound to have one called

Host Adoption Center's AlpoInfo.lkv

If you don't, it doesn't matter; copy one of the other ones and re-name the copy:

Host Adoption Center's AlpoInfo.lkv

Now, you have to use the Hex editor.  Make a copy of the file you're going to edit, just in case it gets messed up and you want to get back to where you were.  (It's also best to make a copy of the Windows Registry, because you are going to want to run a little .reg file and we don't want that to go wrong either.)

Open the "Host Adoption Center's AlpoInfo.lkv" file into it and count the number of toys which are mentioned there.  If the Hair Ball.toy is mentioned there, you want to highlight from the beginning of 

\Resource\Toyz\Hair Ball.toy

to the beginning of the next \Resource.  If there is no other \Resource, then highlight to the end of the file.  Cut this.  In a similar fashion, you can add new toyz to the file; copy them from other .LKV files.  Once again, count the number of toys mentioned; each toy will be mentioned twice, once in the \Resource\Toyz pointer and once a little further on, but it's still just the one toy.  Make a note of the number, save what you've done and quit the editor.

Now you want to enter the number of toys and the name of the .LKV file 
into the Registry.  All you have to do is copy the text which is between 
the two lines ******** below:

********
REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\PF.Magic\Petz 3\3.00.01]
"Host Adoption Center's ListSize"=hex:04,00,00,00
"Host Adoption Center's AlpoInfo"="C:\\Program Files\\PF.Magic\\Petz 3\\Resource\\Keys\\Host Adoption Center's AlpoInfo.lkv"
********

into a text file.  You're going to have to change it a bit; where it says hex=04, put the number of toys in your .LKV.  So if it was six, put hex=06,00,00,00

Also you'll want to change the line C:\\Program Files\\ etc to point to the directory where _you_ have your petz 3 program (remembering to use the double \\ marks instead of the usual single \ that's usual for directories).

When you're sure you've got all that right, rename the textfile to have a .reg extension, and double-click on it.  You should get a message that the information was entered into the Registry correctly.

Run the game, and you should not only find the hairball gone, but your other toys should be in there.  If you see no toys at all in there, then you did something wrong; maybe you counted the toys wrongly or changed the .reg file to point to the wrong place.

Of course, this can be done with any playscenes; but it's not really necessary because you can clear up other areas or carry stuff from one to another using the case.

With any luck, you are now in full control of your playscenes now, and can make whatever new ones you like.

Enjoy!

Carolyn
