Seasons (changing snowline, trees, fields)
Moderator: OpenTTD Developers
Seasons (changing snowline, trees, fields)
If you want to have a day and night cycle, here is a diff you have to apply to gfx.c. Know problem: Intro seems to use DOS colors, game is Windows, so the first night colors can be off. Not configurable, since I really did not want to dig into the gui.
- Attachments
-
- daynight.diff
- Apply to 0.4.0.1
- (1.3 KiB) Downloaded 844 times
Last edited by prissi on 28 Sep 2006 08:18, edited 2 times in total.
prissi,
I tried applying your patch using TortoiseSVN for windows, and it gave me the following error:
I opened up the diff file and indeed it is not the same as any other diff I've seen for OTTD. You said I should apply it directly to the file, but TortoiseSVN does not allow you to do this.
I'd like to check it out, so please could you try making the diff file again!
Thanks!
-Hazelrah
I tried applying your patch using TortoiseSVN for windows, and it gave me the following error:
Code: Select all
The line "Index:" was not found!
Either this is not a diff file or the file is empty.
I'd like to check it out, so please could you try making the diff file again!
Thanks!
-Hazelrah
prissi: Please use diff -u. Just diff (or diff -e) creates files in a nearly useless format. Also, please make sure you produce a forward diff. I had to reverse that patch in order to successfully apply it.
Hazelrah: The patch(1) utility (available on Cygwin and all *nix distros) can use that diff file, with a little help.
Here's a unified diff (-u, for "useful"), but I'd like to know what line 1665is supposed to do. That memcmp *was* controlling an if statement, but you pulled controlled block, without pulling the controlling statement
Hazelrah: The patch(1) utility (available on Cygwin and all *nix distros) can use that diff file, with a little help.
Here's a unified diff (-u, for "useful"), but I'd like to know what line 1665
Code: Select all
memcmp(old_val, _cur_palette + 217*3, c*3);
- Attachments
-
- daynight.patch
- (1.95 KiB) Downloaded 420 times
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
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Ok, here i a diff -u which also corrected the initial color problem. I am not quite sure what you mean by forward, but I swapped both input files.
The if(memcpy()) was always executed, since c*3!=0. The settings are now made in the upper block, where decision about day/night is made.
At a more close analysis the memcpy old_val is useless, since old_val is a write only variable.
The if(memcpy()) was always executed, since c*3!=0. The settings are now made in the upper block, where decision about day/night is made.
At a more close analysis the memcpy old_val is useless, since old_val is a write only variable.
- Attachments
-
- daynight.diff
- hopefully now in the desired format
- (2.18 KiB) Downloaded 370 times
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
Maybe it's not water but lemonade
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
prissi,
Sorry, but it still doesn't have the Index: filename.c that TortoiseSVN needs. Maybe because your doing the diff on only one file instead of the entire set of code. I'm not sure. DaleStan, any more hints? I used your diff file with no problems.
Also, I'm compiling with VC++ 6.0 which does not allow you to declare variables except for at the very top of the scope. This means that
results in a compiler error because your calling the function ConvertDayToYMD before declaring new_dark_state. You should change the code to read like this:
I tested the program with that small change, and it works fine for me now. Maybe the problems others are having have something to do with that?
For everyone's information, the cycle goes once a month
On the 24th, start getting dark
On the 26th, compleatly dark
On the 6th, start getting light
On the 8th, back to normal daylight
Since the game starts on the 1st, this means that a new game will be in the night time cycle.
-Hazelrah
Sorry, but it still doesn't have the Index: filename.c that TortoiseSVN needs. Maybe because your doing the diff on only one file instead of the entire set of code. I'm not sure. DaleStan, any more hints? I used your diff file with no problems.
Also, I'm compiling with VC++ 6.0 which does not allow you to declare variables except for at the very top of the scope. This means that
Code: Select all
YearMonthDay YMD;
ConvertDayToYMD(&YMD, _date);
uint8 new_dark_state = (_game_mode != GM_MENU) ? dark_state[YMD.day-1] : 0;
Code: Select all
uint8 new_dark_state
YearMonthDay YMD;
ConvertDayToYMD(&YMD, _date);
new_dark_state = (_game_mode != GM_MENU) ? dark_state[YMD.day-1] : 0;
For everyone's information, the cycle goes once a month
On the 24th, start getting dark
On the 26th, compleatly dark
On the 6th, start getting light
On the 8th, back to normal daylight
Since the game starts on the 1st, this means that a new game will be in the night time cycle.
-Hazelrah
Alright Nanaki, here you go.
Just to warn you though, this is not a clean build. It's got a few other things like PBS (out of date), subsidiaries, remove signal patch, and at least one more, I forget right now.
Just to warn you though, this is not a clean build. It's got a few other things like PBS (out of date), subsidiaries, remove signal patch, and at least one more, I forget right now.
- Attachments
-
- HazelrahsBuild001.zip
- Day and Night implemented
- (973 KiB) Downloaded 597 times
If I remember correctly it's also against the coding rules/standards, unless they've changed this bit recently.Hazelrah wrote:Also, I'm compiling with VC++ 6.0 which does not allow you to declare variables except for at the very top of the scope.
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
You do remember correctly. It's the third blue dot down.
http://wiki.openttd.com/index.php/Coding_guidelines
-Hazelrah
http://wiki.openttd.com/index.php/Coding_guidelines
-Hazelrah
Oops, thank you. Apparently I did too many C99 recently. Actually, we could also save some time, if one only asks for the day if needed.
The darkening should occur from 1-6th day and then again near the end of the month.
And I am not sure, what SVN wants. The only thing I can do is diff -u x y. Naturally, these files have different names. Does SVN wants the same name?
(On Windows 98 svn can commit and download, but merge, patch etc. just crashes the computer or does nothing.)
The darkening should occur from 1-6th day and then again near the end of the month.
And I am not sure, what SVN wants. The only thing I can do is diff -u x y. Naturally, these files have different names. Does SVN wants the same name?
(On Windows 98 svn can commit and download, but merge, patch etc. just crashes the computer or does nothing.)
- Attachments
-
- daynight.diff
- Declaration fixed
- (2.39 KiB) Downloaded 349 times
just tried this out (using Hazelrah build) and it looks cute. The water is a bit glowy in the night so it's either full moon or radioactive waste LOOOOL
Another thig is the fact that the menus are also dark during the night what makes playing a bit hard
But I can see myself playing with this (as long as I could turn it of in the middle of the game), and someway to add small lightspots would be cool LOL
Another thig is the fact that the menus are also dark during the night what makes playing a bit hard
But I can see myself playing with this (as long as I could turn it of in the middle of the game), and someway to add small lightspots would be cool LOL
Uncle Dex Says: Follow the KISS Principle!
Re: Day & Night cycle
Doing the GUI is my favorite part ^^prissi wrote:Not configurable, since I really did not want to dig into the gui.
I love doing GUI stuff in OpenTTD. And from what I've seen on the chat channel I am one of the only ones =/
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
Thanks for the build Hazelrah.
I had problems with it anyway.
I had to delete the config file for it to work.
I found out that the options full animation and full detail influence the night/day cycle.
If you turn them off in the middle of the night it will be night forever... or until game restart i think.
If they're off when you start the game (exe), there will be no cycle.
And my own build doesn't work anyway... dunno why.
And yeah, the dark menus are a bit hard to see.
I had problems with it anyway.
I had to delete the config file for it to work.
I found out that the options full animation and full detail influence the night/day cycle.
If you turn them off in the middle of the night it will be night forever... or until game restart i think.
If they're off when you start the game (exe), there will be no cycle.
And my own build doesn't work anyway... dunno why.
And yeah, the dark menus are a bit hard to see.
- Born Acorn
- Tycoon
- Posts: 7595
- Joined: 10 Dec 2002 20:36
- Skype: bornacorn
- Location: Wrexham, Wales
- Contact:
Darker water: There you go.
The lenght of the night in in the array dark_state[]. Maybe this should be read from the openttd.cfg.
GUI: Please ask an OTTD guru. Might be impossible due to the 256 color limit.
And please, I mainly do other things than programming OTTD. I just did this hack to prove it is very easy to make some day/night. This is no way complete. At least, one can indeed switch this on ore off with full animation.
I feel, that for a real guru, winter and summer changes would be also not much harder, since all sprites exists already. Just the tree has to be picked for season, same for ground tile. (Would make month a global though.)
The lenght of the night in in the array dark_state[]. Maybe this should be read from the openttd.cfg.
GUI: Please ask an OTTD guru. Might be impossible due to the 256 color limit.
And please, I mainly do other things than programming OTTD. I just did this hack to prove it is very easy to make some day/night. This is no way complete. At least, one can indeed switch this on ore off with full animation.
I feel, that for a real guru, winter and summer changes would be also not much harder, since all sprites exists already. Just the tree has to be picked for season, same for ground tile. (Would make month a global though.)
- Attachments
-
- daynight.diff
- Darker Water
- (3.31 KiB) Downloaded 365 times
-
- Night
- night.png (89.5 KiB) Viewed 16632 times
Who is online
Users browsing this forum: No registered users and 2 guests