Ryandor.com
http://www.ryandor.com/forum/

[solved] Determine the coordinates of a static when drawn?
http://www.ryandor.com/forum/viewtopic.php?f=20&t=3224
Page 1 of 1

Author:  farfromhomefish [ Thu Apr 12, 2007 4:11 am ]
Post subject:  [solved] Determine the coordinates of a static when drawn?

I've been working on a UO client for a wee bit now, and I've come to a point where I can't make any headway. Doubtless this question has a simple answer, but for the life of me, I can't figure it out:

How are statics drawn to the screen?

I know the altitude of the tile I'm drawing the statics on, the altitude of the static, the 'height' value of the static... but for the life of me, I can't figure out how to combine these into a simple coordinate to display the static from.

Are there any special cases? [ ex., where width < 44, x = x + (44-width)/2 ]

Thanks so much!

Author:  Pallando [ Thu Apr 12, 2007 9:54 am ]
Post subject:  >BLINK<

Ummm, what did you say?

If you explain alittle (cough) more... we might be able to help.

What are you doing?
is your map ingame an your manually placing statics?

more info please

Author:  farfromhomefish [ Thu Apr 12, 2007 11:02 am ]
Post subject: 

=) I wasn't sure I was going to get a response here at all - certainly not so quickly. Thanks for responding - I'll try to be a little clearer.

I'm programming a UO client. Right now, all I want to do is display the original map0.mul (along with its statics). I'm not using any custom data at all.

So far, I have the terrain displaying perfectly , along with altitude, etc.

However, I can't figure out how to display the statics at the correct positions.

Here's my question: what is the method of determining where a static should be drawn on the screen, if it is drawn on a tile that is currently displayed at the screen coordinate tileX, tileY? For example, could it be:

staticX = tileX + (44 - static.pixelWidth);
staticY = tileY + static.altitude * c_pixelsPerAltitudeByte + static.height;

(static.altitude would be loaded from the statics0.mul file, whereas static.height is one of the values that is loaded from tiledata.mul).

Obviously, that particular function isn't it. =/ I worked on this for about three hours last night, and finally gave up in frustration. Finding out how to load the graphics and display the map, even with altitude data, is easy. Placing the statics on screen, on the other hand, isn't. =/

On a related note, how are statics ordered, so that the top-most ones display over the bottom-most ones (i.e., roofs over walls over floors).

Thanks again!

Author:  punt [ Thu Apr 12, 2007 5:00 pm ]
Post subject: 

One could look at the source for WorldMaker Map editor. It would have the sorting algorithm, and the static placement code.

Author:  farfromhomefish [ Thu Apr 12, 2007 6:01 pm ]
Post subject: 

For those people who are looking for the same thing I am (or something related), I was able to find the source code for WorldMaker Map editor at this website: http://ultima.lonet.cz/download.php

Now I'm going to see if I can hunt down the proper bit of code...

Thanks for your help!

[update]
Great, statics are working now. Thanks again for your help, punt. =)
Image

Author:  HellRazor [ Fri Apr 13, 2007 12:10 am ]
Post subject: 

I've been meaning to upload punt's stuff to the Ryandor files section, I just keep putting it off.

I'll try to knock that out over the weekend. Sorry for the delay!

P.S. I don't know if this helps at all since it refers mainly to the map and not the statics; but just in case:

http://www.ryandor.com/forum/viewtopic.php?t=2386

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/