Newgrf : Action 00 for Houses v.0.2.5 (SourceForge Submit)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Newgrf : Action 00 for Houses v.0.2.5 (SourceForge Submit)

Post by belugas »

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
Attachments
openttd.zip
Win32 binary.
Contains a test grf, which will replace the temperate church with the arctic church.
Add source for AllChurchesInTemp.grf
(431.77 KiB) Downloaded 306 times
Action00Housesv025.zip
Contains two patches
patch a : all files moderately been modified. Tabs instead of spaces
patch b : town_land.h heavily rewritten, with spaces, mainly because it is a huge array initialization
Included also, the town_land.h itself, in order to view i
(34.37 KiB) Downloaded 324 times
Here's an example of the possibilities.
<br />Arctic church in temperate set!
Here's an example of the possibilities.
Arctic church in temperate set!
Unnamed, 13th Jan 1950.png (79.14 KiB) Viewed 8896 times
Last edited by belugas on 11 Nov 2005 01:35, edited 13 times in total.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

I've been looking at the diff, seems you've made a lot of great job!
I'd like to test it, I just need to know what sets would be proper... Urban Renewal, Zimmlock's town buildings?
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

I did some testing and tweeking on it yesterday.
It does not work, so far. I know why, now.
I need aout an hour or more of work.

I don't think Zimmlock's set will work, because his set uses a lot more then just action 00, which are not already implemented...
AS for URban REnewal, I don't know, I never used it/saw it :(
Any pointers on it?

And thanks MeusH. Coming from you, I appreciate it!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Urban renewal is about halfway down http://users2.tt-forums.net/ttdur/ttdur.htm. It, however, is a pure action A GRF; no interesting stuff.

(OK, so it's really a GRD.)
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Thanks DaleStan.
Indeed, not much to do with that Urban Renewal...
Although, it is a good looking one!
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

After thinking moments, trial and errors, swearing and sweting, I've been able to change the temperate church to an arctic church. :!:
It is now working and ready to test!
I doubt Zimmlock's set will be working right now.
But it will, eventually..

New version reads properties correctly, as check if property 8 (house to replace) has been set before doing anything else.
So if anyone writes a grf withou property 8, the changes will not be taking into account. Thus is in concordance with NFO specs, as well as with logic... :)

Got on the first post of this topic for updates
And thanks for testing!
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Re: Newgrf : Action 00 for Houses patch v. 0.2

Post by Bjarni »

belugas wrote:Ver 0.2 : some properties are now working!
Ver 0.1 : initial release (buggy)
maybe you can tell a little more about what your patch is actually able to do. Most of the people reading this don't bother to look up all the action numbers and what they do
There is no point in coding a brilliant diff if it's not human understandable
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Newgrf : Action 00 for Houses patch v. 0.2

Post by belugas »

Bjarni wrote:
belugas wrote:Ver 0.2 : some properties are now working!
Ver 0.1 : initial release (buggy)
maybe you can tell a little more about what your patch is actually able to do. Most of the people reading this don't bother to look up all the action numbers and what they do
There is no point in coding a brilliant diff if it's not human understandable
I hope it is clearer...
I think that trying to explain what grf can do on such a short medium is hard...
I will have to make a readme quite more extensive...
You're right. I guess I wrote the "announcment" for programmers who actually know that stuff...
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Personally, I would put this line in the changelog:
- Implemented newhouse props 08..13
and call that good enough. Anyone who actually cares what those are either knows, or, more likely, knows enough to RTFM.
Those who don't care can just read the word "newhouse" and that should be sufficient.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

"or, more likely, knows enough to RTFM. "

We have a manual for this stuff somewhere?
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Yes. There is a newgrf manual, or, more accurately, a newgrf manpage.

http://wiki.ttdpatch.net/tiki-index.php ... phicsSpecs

That is the newgrf manual, at least until the OTTD-devs feel like creating and maintaining an OTTD-specific newgrf manual.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
jacke
Director
Director
Posts: 533
Joined: 19 May 2002 14:47
Location: Sweden

Post by jacke »

Great, newhouses for openttd! Keep up the good work Belugas ! :)
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Thank you jacke, it is appreciated. :D
I will post some grf files soon showing the different possiblities of this patch.
As for newhouses, well... yes, in a way, it can be viewed as new houses.

DaleStan: I do not know about the other actions, but Action 00 for houses will be a little different indeed from the patch. Different enough to have its own page? I doubt. Rather a note on some global Actions page, I wold rather think so...

RTFM... what an expression... how often do I hear or say it daily.... :roll:
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

belugas wrote:I do not know about the other actions, but Action 00 for houses will be a little different indeed from the patch. Different enough to have its own page? I doubt. Rather a note on some global Actions page,
I'd suggest a note either on Action0Houses page, or in the OpenTTD wiki. I don't know Patchman's views on OTTD stuff in the TTDPatch wiki, but I believe he said that you're welcome to add to or change the format if you provide a way for GRF files to determine whether they're being loaded by TTDPatch or OTTD.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

How will it be different?
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

belugas wrote:... but Action 00 for houses will be a little different indeed from the patch...
When I said different, it was not in the idea of new features, but rather some features from the patch that are not going to be there, unless the town_cmd.c file gets a big face lift... Well... looks like i'm already doing it, so...;)
DaleStan wrote: I'd suggest a note either on Action0Houses page, or in the OpenTTD wiki. I don't know Patchman's views on OTTD stuff in the TTDPatch wiki, but I believe he said that you're welcome to add to or change the format if you provide a way for GRF files to determine whether they're being loaded by TTDPatch or OTTD.
I'm speaking for myself here, without having consulted anyone. I think it can be really interesting for the futur, to be able to distinguish grfs from the two games, still having a "common" documentation to work with.
Quickly, from the top of my head ( :!: ), I can see an easy way of specifying OpenTTD from the Patch : Action 07/09, variable 0x8D : Values 00 for Dos, 01 for Windows and 02 for OpenTTD.
OpenTTD does not care (from what I can see anyway) about that, since the palette in use is already windows based

But before any of that can come up to life, I guess I have to finish my work, first...

Food for though... thanks for that, Dalestan :)
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

belugas wrote:Quickly, from the top of my head ( :!: ), I can see an easy way of specifying OpenTTD from the Patch : Action 07/09, variable 0x8D : Values 00 for Dos, 01 for Windows and 02 for OpenTTD.
OpenTTD does not care (from what I can see anyway) about that, since the palette in use is already windows based
No, that wouldn't be good. There are several grf files which check this, and use different colour maps depending on whether the value is 0 or 1. Also, I though OTTD can use DOS grfs...

This should really be a new variable that's 0 for patch and 1 for OTTD.
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Patchman wrote:How will it be different?
As I was answering to Dalestan, not knowing you already dropped in, I meant lacking features rather different ones. But that is so far. I have no specific new features right now in mind, but I'm sure that until this patch is done, I may have a few ideas...
Let's make a deal : as soon as I have something, after thinking and reading and coding and testing long enough, i'll PM you about it and see what we can do.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Patchman wrote: No, that wouldn't be good. There are several grf files which check this, and use different colour maps depending on whether the value is 0 or 1.
I see. And is it possible to imagine something like :

Code: Select all

if value > 1 then value := 1;
? This way, you'll be able to choose the correct palette, assuming the windows one would be chosen, since (2) would be a OpenTTD specifier
Patchman wrote:Also, I though OTTD can use DOS grfs...
Yes, it does, but I think I read somewhere that it only uses WinPalette. I should have kept a bookmark on it...
Patchman wrote:This should really be a new variable that's 0 for patch and 1 for OTTD.
Indeed, it would be the best solution. BUt who am I to ask for the Patch to change? :oops:
Is it hard to implement a new one?


For everyone : new version of the patch! Look at the first post
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

belugas wrote:I see. And is it possible to imagine something like :

Code: Select all

if value > 1 then value := 1;
? This way, you'll be able to choose the correct palette, assuming the windows one would be chosen, since (2) would be a OpenTTD specifier
Yes, but it would break existing files. I don't like doing that, unless it is absolutely necessary.
Patchman wrote:This should really be a new variable that's 0 for patch and 1 for OTTD.
Indeed, it would be the best solution. BUt who am I to ask for the Patch to change? :oops:
Is it hard to implement a new one?
Not at all.

[5 seconds later.]

Done.

(Sorry, just a bit too late to make it into alpha 65 :mrgreen:)
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests