Town Name Sets - Scenario Opportunity

Got an idea for a new feature in TTDPatch? Post it here.

Moderator: TTDPatch Moderators

User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

I guess this could be patched into TTDPatch aswell, but the impact may be bigger in TTDPatch.
Still loading a height map into TTDPatch would be nice as well, I wonder if someone could send me a heightmap.s (gcc -S)
from OTTD, -edit- Have copied the relevant part and produced my own assembler dump
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Oskar, I installed r2073, made sure I had a 256x256 headerless raw image named height.raw in my TTDX folder, started TTDX and entered the Scenario editor and ran cht: heightmap. I got an error message: Cannot carry out sign cheat action Invalid parameter.
I tried cht: heightmap height, cht: heightmap height.raw, and cht: heightmap 6 (assuming that a height might be needed) and I got the same error each time.
Just in case, I checked my new patch cfg for a switch but there was none.
Did I do something wrong? Or maybe the cheat is not ready for use yet?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

I guess I should add some more error checking at the evening, currently this cheat has no error checking then telling it failed...

You could send me the heightmap please so I can look into it, thanks...
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

eis_os wrote:You could send me the heightmap please so I can look into it, thanks...
I thought you might ask ... It is posted below, but, before you open it, you must promise not to laugh. :D
Attachments
height.zip
(4.17 KiB) Downloaded 155 times
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

That seems to be true color, currently the code loader only supports gray scale, the filesize needs to be exact 65536 bytes, or 64KiB.


The problem is that currently TTDPatch doesn't allow dynamic allocations so porting libpng isn't a trivial task
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

eis_os wrote:That seems to be true color, currently the code loader only supports gray scale, the filesize needs to be exact 65536 bytes, or 64KiB.


The problem is that currently TTDPatch doesn't allow dynamic allocations so porting libpng isn't a trivial task
I will convert it to gray scale and try again. :mrgreen:
User avatar
Lakie
TTDPatch Developer
TTDPatch Developer
Posts: 1799
Joined: 26 May 2004 16:37
Location: Britain
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by Lakie »

eis_os wrote:That seems to be true color, currently the code loader only supports gray scale, the filesize needs to be exact 65536 bytes, or 64KiB.
So, does this want an image in a specific format, or does it want 64KiB's worth of bytes representing height?

~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by DaleStan »

My understanding is that it wants the latter. I have not looked at the code, though.
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
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

IT WORKS! IT WORKS!
The attached zip contains the raw file I used. It also contains four png screenshots.
I was able to build a town using the Canadian Town Set. Sorry ... It's not in the screenshots.
Note that the invalid parameter error still occurs, but hey! IT WORKS!

The only thing I would change, besides the error, is to make the raw file selecteable instead of having to rename it to height.raw.

Cookies are cooking :bow: :bow: :bow:
Attachments
height.zip
(84.2 KiB) Downloaded 148 times
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

Lakie wrote:
eis_os wrote:That seems to be true color, currently the code loader only supports gray scale, the filesize needs to be exact 65536 bytes, or 64KiB.
So, does this want an image in a specific format, or does it want 64KiB's worth of bytes representing height?

~ Lakie
Currently 256x256 Bytes, this is called raw or binary data in graphic applications. (Not raw as in camera files, but it's the same idea, get the rough binary data from the camera chip)

No idea why it doesn't set the flags right so the cheat is successfully, as I said the current code doesn't do much error checking, it still lacks a reset landscape call and checking if it's in a scenario editor or not...

I do think supporting a real file format would be nice, any idea maybe including a GPL compatible lib we can add to TTDPatch?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by DaleStan »

Success is indicated by the carry flag upon return from the cheat handler. Clear means success: http://svn.ttdpatch.net/trac/browser/tr ... ht.asm#L83
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
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

eis_os wrote:I do think supporting a real file format would be nice, any idea maybe including a GPL compatible lib we can add to TTDPatch?
png?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

libpng is quite big and as far as I remember it tries to do direct fileio via fopen/fclose... , it isn't GPL either...


- edit-
DaleStan: it's simply a missing jmp before .fail
http://svn.ttdpatch.net/trac/browser/tr ... p.asm#L193
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by DaleStan »

Oskar, can you add a comment explaining those NOPs, please? Also, why you used a 5-byte AND instead of a 3-byte MOVZX?

Finally, ax is not a valid 16-bit address register, but I've fixed that one.
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
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

Simply bad code quality and simply the fact I didn't work much on TTDPatch actually nothing.

The nops are a debugging session place holder.. should be removed.
Post Reply

Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 15 guests