![]() |
Airfix DogFighter Programmer's Manual |
||||||
| |||||||
|
<< Page 3 Tutorial Page 5 >> |
|||||||
|
This is the format of the MODL-block for the FW190: |
|||||||
| MODL 63 00 00 00 | Header and Descriptor Length (RHN) | ||||||
| 0B 39 17 42 49 2E 7F 40 86 BB 43 40 | X- Z- and Y parameters (RHN) | ||||||
| 00 00 00 00 0C 5F 01 BD 00 00 00 80 | Pitch, Rotate and Bank parameters (RHN) | ||||||
| dining_room 00 | Location + End Byte | ||||||
| Game\Objects\Aircrafts\AcFw190.object 00 | Object Descriptor Ref. + End Byte | ||||||
| model1 00 | Object Label + End Byte | ||||||
| 00 00 00 00 | Set Team | ||||||
| 00 | Set Squad End Byte | ||||||
| 01 00 | Set AI = true | ||||||
| 00 00 | ?? | ||||||
| 00 | End Byte for SetPickUpType | ||||||
| 01 00 00 00 | AISetStayRoom (RHN) = true | ||||||
| 32 00 00 00 | AISetAggression (RHN) = 50 | ||||||
|
We need to realise that, if we insert these two strings at the places indicated below, we add 11 characters to
the MODL-Descriptor string. We therefore have to adjust the String Length Descriptor for this MODL Block.
The MODL-block length was Hex 63. We should add Decimal 11, i.e. Hex B, so that will give Hex
6E. Change the 63 after MODL to 6E, change the Object Label from model1 to Fw_190, change the first pair of Zeroes for the SetTeam-parameter to 03 and then insert the strings for the SetSquad- and SetPickupType-properties: 000000A0 00 32 00 00 00 4D 4F 44 4C
6E 00 00 00 0B 39 17 .2...MODLn....9. If you save this and try to run it, the program will crash. Why? What we haven't discussed yet is the first Block in the
file: the FHOU-Block.... If you look at the listing of the .level-file in 3.2 (page 3), you see that the first line contains: FHOU 8A 03 00 00, where bold is once again Hexadecimal values. Since by now we know about RHN, we can see that the actual value here is 00 00 03 8A, or in short Hex(38A). If we look at the end of the complete file we notice that it is actually Hex(39D) long, which is a difference of Hex(13), or Decimal 19. We added 11 characters/bytes in our update, the other 8 in the extra length are the 8 bytes of the FHOU-block itself. So, we need to include the 11 bytes we added in our update into the file-length, but not the 8 bytes of the FHOU-Block, as its file length descriptor excludes its own length. We therefore need to adjust the FHOU-Block to mention a length of Hex(38A) + Dec(11). This is equivalent to Hex(38A) + Hex(B), which makes it Hex(395), or in full: 00 00 03 95. In the RHN-notation that would be: 95 03 00 00. So before we can run the updated game, we need to adjust 8A 03 00 00 in the first line to 95 03 00 00. When we run the updated level straight away, we will be a bit disappointed as no changes seem to have been made. Why not? You might recall that the Game Engine takes its info about models from the .asf-file, not the .level-file. The .asf-file is created automatically when the level is saved in the House Editor.... Start the House Editor, open sample1, have a look at the Focke Wulf to see
that it now displays the Object Label "Fw_190"
(by hovering the mouse over the model), SAVE the Level again and exit the
House Editor. If you haven't touched anything this will leave the .level-file
unchanged, but will regenerate the .asf-file. You might have noticed that we haven't taken off from an airfield but from the carpet: an airfield isn't really necessary as it is the PSP that determines where you take off from. But we will include some airfields later because they can play a vital role in Missions... |
|||||||
|
<< Page 3 Tutorial Page 5 >> |
|||||||