Newgrf : Action 00 for Houses v.0.2.5 (SourceForge Submit)
Posted: 17 Oct 2005 00:03
Following Bjarni's suggestion, I'll try to explain what this patch do and will do:
There are a lot of graphics files (GRF) available here and there, that allow to change the properties of trains, ships, planes etc. Or you can add new vehicles (mostly by replacing their attributes) or simply create new sets of vehicles.
Houses can be replaced or upgraded the same way in TTDPatch. As an example, you can think of Zimmlock's Total Town Replacment Total Town Replacment
) set. In this set, the graphics have been redefined, but also the definition of those buildings been replaced. Unfortunately, OpenTTD does not offer the possibility to use thatset. The problem is that everything that regards houses in Openttd is hardcoded.
My patch, still in development, tries to correct the situation. I'm concentrating on what is called Action 00 for Houses.
An action is a sequence of numbers that represent some features regrading the NewGrf format. Action 00 stands for replacment. I will not go into teaching NFO, I'm no expert. If you want to learn more about that subject, I suggest This manual.
So far, here is the status of the different properties I have been able to implement :
Number Status Description
08 DONE Substitute building type
09 DONE Building flags
0A DONE Availablity years
0B DONE Population
0C DONE Mail generation multiplier
0D DONE Passenger acceptance
0E DONE Mail acceptance
0F DONE Goods, food or fizzy drinks acceptance
10 DONE LA rating decrease on removal (should be set to the same value for every tile for multi-tile buildings)
11 DONE Removal cost multiplier (should be set to the same value for every tile for multi-tile buildings)
12 DONE Building name ID
13 DONE Building availablity mask
14 NOT House callback flags
15 DONE House override byte
16 NOT Periodic refresh multiplier
17 DONE Four random colours to use
18 POSSIBLE Relative probablity of appearing
19 NOT Extra flags
1A NOT Animation frames
1B NOT Animation speed
1C NOT Class of the building type
1D NOT Callback flags 2
1E NOT Accepted cargo types
NOT stands for : not implemented, unknown if I can
POSSIBLE stands for : I have an idea how it can be done.
The futur versions will not necessary implement every other props, but will likely be more complete. TTDPatch and OpenTTD do not handle the houses quite the same way, so some properties might not be possible to implement, nor necessary.
It has been made agaisnt revision 3164
Release:
Ver 0.2.5 :
-Mostly strenghtening and optimizing the code
Ver 0.2.4 :
-a little bug has been corrected in newgrf.c. I forgot about a previously declared varisble and created a new one with same name.
-I removed all my spacing and replaced them with tabs ,except for town_land.h, which is almost a new file. Thanks Peter1138 for the lesson
Ver 0.2.3 :
-newgrf.c now have the possibility (for houses) to add random colors.
-town_cmd.c has been rearranged in order to support new array of house definition
-A lot more replacement of magic numbers by enums/const, mainly on town_land.h
-sprites.h has been reformated without tabs. Palette names have been corrected and completed
Ver 0.2.2 :
-Added variable 0x9D for Action 07/09 function SkipIf in newgrf.c, after PatchMan's intervention (I'm honored ). This means we can now differentiate versions between TTDPatch and OpenTTD specific
-Replaced a few magic numbers by enums/const both in town_land.h and town_cmd.c
-Correct some ways of doing in my code in newgrf.c
-Started to remove a lot of TABS in sprites.h. Haven't finished yet.
-I have tested a few more properties, and they all do work perfectly
Ver 0.2.1 : property 0x15 now works. Specify the houseID you want this building to replace will eliminate the overriden one.
Ver 0.2 : some properties are now working!
Ver 0.1 : initial release (buggy)
Future:
Ver 0.3 : keep on change some numbers with enums/conts
Ver 0.4 : Incorporate the array _town_draw_tile_data once I understand it completely
Ver 0.5 : Change the house layout
For the rest...we'll see...
Thanks a lot Peter1138. You are of a great help
Thanks to Czaboka, your documentation is quite thorough and helpfull
There are a lot of graphics files (GRF) available here and there, that allow to change the properties of trains, ships, planes etc. Or you can add new vehicles (mostly by replacing their attributes) or simply create new sets of vehicles.
Houses can be replaced or upgraded the same way in TTDPatch. As an example, you can think of Zimmlock's Total Town Replacment Total Town Replacment
) set. In this set, the graphics have been redefined, but also the definition of those buildings been replaced. Unfortunately, OpenTTD does not offer the possibility to use thatset. The problem is that everything that regards houses in Openttd is hardcoded.
My patch, still in development, tries to correct the situation. I'm concentrating on what is called Action 00 for Houses.
An action is a sequence of numbers that represent some features regrading the NewGrf format. Action 00 stands for replacment. I will not go into teaching NFO, I'm no expert. If you want to learn more about that subject, I suggest This manual.
So far, here is the status of the different properties I have been able to implement :
Number Status Description
08 DONE Substitute building type
09 DONE Building flags
0A DONE Availablity years
0B DONE Population
0C DONE Mail generation multiplier
0D DONE Passenger acceptance
0E DONE Mail acceptance
0F DONE Goods, food or fizzy drinks acceptance
10 DONE LA rating decrease on removal (should be set to the same value for every tile for multi-tile buildings)
11 DONE Removal cost multiplier (should be set to the same value for every tile for multi-tile buildings)
12 DONE Building name ID
13 DONE Building availablity mask
14 NOT House callback flags
15 DONE House override byte
16 NOT Periodic refresh multiplier
17 DONE Four random colours to use
18 POSSIBLE Relative probablity of appearing
19 NOT Extra flags
1A NOT Animation frames
1B NOT Animation speed
1C NOT Class of the building type
1D NOT Callback flags 2
1E NOT Accepted cargo types
NOT stands for : not implemented, unknown if I can
POSSIBLE stands for : I have an idea how it can be done.
The futur versions will not necessary implement every other props, but will likely be more complete. TTDPatch and OpenTTD do not handle the houses quite the same way, so some properties might not be possible to implement, nor necessary.
It has been made agaisnt revision 3164
Release:
Ver 0.2.5 :
-Mostly strenghtening and optimizing the code
Ver 0.2.4 :
-a little bug has been corrected in newgrf.c. I forgot about a previously declared varisble and created a new one with same name.
-I removed all my spacing and replaced them with tabs ,except for town_land.h, which is almost a new file. Thanks Peter1138 for the lesson
Ver 0.2.3 :
-newgrf.c now have the possibility (for houses) to add random colors.
-town_cmd.c has been rearranged in order to support new array of house definition
-A lot more replacement of magic numbers by enums/const, mainly on town_land.h
-sprites.h has been reformated without tabs. Palette names have been corrected and completed
Ver 0.2.2 :
-Added variable 0x9D for Action 07/09 function SkipIf in newgrf.c, after PatchMan's intervention (I'm honored ). This means we can now differentiate versions between TTDPatch and OpenTTD specific
-Replaced a few magic numbers by enums/const both in town_land.h and town_cmd.c
-Correct some ways of doing in my code in newgrf.c
-Started to remove a lot of TABS in sprites.h. Haven't finished yet.
-I have tested a few more properties, and they all do work perfectly
Ver 0.2.1 : property 0x15 now works. Specify the houseID you want this building to replace will eliminate the overriden one.
Ver 0.2 : some properties are now working!
Ver 0.1 : initial release (buggy)
Future:
Ver 0.3 : keep on change some numbers with enums/conts
Ver 0.4 : Incorporate the array _town_draw_tile_data once I understand it completely
Ver 0.5 : Change the house layout
For the rest...we'll see...
Thanks a lot Peter1138. You are of a great help
Thanks to Czaboka, your documentation is quite thorough and helpfull