Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Jun 19, 2013 3:32 pm

All times are UTC




Post new topic Reply to topic  [ 75 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Sat May 28, 2005 11:53 pm 
Offline
Director
Director
User avatar

Joined: Mon Nov 15, 2004 7:46 pm
Posts: 625
Location: Berlin, Germany
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:
File comment: Apply to 0.4.0.1
daynight.diff [1.3 KiB]
Downloaded 478 times


Last edited by prissi on Thu Sep 28, 2006 8:18 am, edited 2 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 12:37 am 
Offline
Traffic Manager
Traffic Manager

Joined: Wed Apr 13, 2005 5:41 am
Posts: 196
prissi,

I tried applying your patch using TortoiseSVN for windows, and it gave me the following error:

Code:
The line "Index:" was not found!
Either this is not a diff file or the file is empty.


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


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 2:01 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
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 1665
Code:
memcmp(old_val, _cur_palette + 217*3, c*3);
is supposed to do. That memcmp *was* controlling an if statement, but you pulled controlled block, without pulling the controlling statement


Attachments:
daynight.patch [1.95 KiB]
Downloaded 299 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
Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 10:23 am 
Offline
Director
Director
User avatar

Joined: Mon Nov 15, 2004 7:46 pm
Posts: 625
Location: Berlin, Germany
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.


Attachments:
File comment: hopefully now in the desired format
daynight.diff [2.18 KiB]
Downloaded 253 times
Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 11:04 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Apr 18, 2004 8:27 pm
Posts: 1228
How often is the day / night loop supposed to occur? I have been running it for a few months and as of yet nothing has happened. Also, I am sure the water wasn't purple before......

_________________
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 11:18 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jul 10, 2002 3:08 pm
Posts: 8684
Location: Enschede, The Netherlands
Maybe it's not water but lemonade :O

_________________
GoneWacko. Making #tycoon sexy and exciting since 1784.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 11:51 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sun Apr 18, 2004 8:27 pm
Posts: 1228
I still haven't seen purple / pink lemonade before though, must be cherryade. :P

_________________
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 11:54 am 
Offline
Traffic Manager
Traffic Manager

Joined: Sat Jan 08, 2005 4:08 pm
Posts: 151
Patched, compiled, 3 years passed, nothing.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 1:07 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Wed Apr 13, 2005 5:41 am
Posts: 196
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

Code:
   YearMonthDay YMD;   
   ConvertDayToYMD(&YMD, _date);
   uint8 new_dark_state = (_game_mode != GM_MENU) ? dark_state[YMD.day-1] : 0;


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:

Code:
   uint8 new_dark_state
   YearMonthDay YMD;   
   ConvertDayToYMD(&YMD, _date);
   new_dark_state = (_game_mode != GM_MENU) ? dark_state[YMD.day-1] : 0;

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


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 1:26 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Sat Jan 08, 2005 4:08 pm
Posts: 151
can anybody post a build? it just doesn't work for me.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 1:36 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Wed Apr 13, 2005 5:41 am
Posts: 196
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.


Attachments:
File comment: Day and Night implemented
HazelrahsBuild001.zip [973 KiB]
Downloaded 354 times
Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 1:49 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jul 10, 2002 3:08 pm
Posts: 8684
Location: Enschede, The Netherlands
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.


If I remember correctly it's also against the coding rules/standards, unless they've changed this bit recently.

_________________
GoneWacko. Making #tycoon sexy and exciting since 1784.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 1:55 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Wed Apr 13, 2005 5:41 am
Posts: 196
You do remember correctly. It's the third blue dot down.

http://wiki.openttd.com/index.php/Coding_guidelines

-Hazelrah


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 2:44 pm 
Offline
Director
Director
User avatar

Joined: Mon Nov 15, 2004 7:46 pm
Posts: 625
Location: Berlin, Germany
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.)


Attachments:
File comment: Declaration fixed
daynight.diff [2.39 KiB]
Downloaded 230 times
Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 3:01 pm 
Offline
Chief Executive
Chief Executive
User avatar

Joined: Wed Jan 12, 2005 9:56 pm
Posts: 701
Location: Lisboa, Portugal
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 :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 :lol:

_________________
Uncle Dex Says: Follow the KISS Principle!


Top
 Profile  
 
 Post subject: Re: Day & Night cycle
PostPosted: Sun May 29, 2005 3:10 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed Jul 10, 2002 3:08 pm
Posts: 8684
Location: Enschede, The Netherlands
prissi wrote:
Not configurable, since I really did not want to dig into the gui.


Doing the GUI is my favorite part ^^
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 #tycoon sexy and exciting since 1784.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 3:15 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Sat Jan 08, 2005 4:08 pm
Posts: 151
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 3:32 pm 
Offline
Cymedrolwr
Cymedrolwr
User avatar

Joined: Tue Dec 10, 2002 8:36 pm
Posts: 7445
Location: Wrexham, Wales
prssi : Great work. It works like a charm, but I have a few tiffs with it:

1. Night and Day should last a LOT longer, or be a configurable thing

2. It shouldn't affect the GUI.

3. The water colour at night is a bit light.

_________________
Image
FacebookFlickr PhotosBlogTwitterHosting


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 4:44 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Aug 28, 2003 9:38 am
Posts: 3311
Can anyone post a screenshot ,please? :D


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2005 4:55 pm 
Offline
Director
Director
User avatar

Joined: Mon Nov 15, 2004 7:46 pm
Posts: 625
Location: Berlin, Germany
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.)


Attachments:
File comment: Night
night.png
night.png [ 89.5 KiB | Viewed 11345 times ]
File comment: Darker Water
daynight.diff [3.31 KiB]
Downloaded 249 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 75 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: 3iff, kamnet, Phrossi_TTD and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.