facets

Diskussion und Informationen über UO:KR
Antworten
Nachricht
Autor
Benutzeravatar
Torfo
Moderator (Sphere)
Beiträge: 828
Registriert: 13 Jan 2004 12:00
Kontaktdaten:

facets

#1 Beitrag von Torfo » 08 Jul 2007 20:28

And again: It's not my work!

Code: Alles auswählen

Map is matrix of 112x64 blocks

Each file is a block of 64x64 tiles

Map sizes are width=112x64=7168 height=64x64=4096

XBlock = Int(XPos/64)
YBlock = Int(YPos/64)
Block Number = (XBlock * 64) + YBlock

Blocks are loaded from top to bottom than left to right.
Cells are loaded from blocks top to bottom then left to right.

Every files in facetX.uop is a block, execpt for the first file that contains map size.

In a block file there are 3 type of elements:

- LandTile
- Delimiter
- StaticTile

Header for all elements:

BYTE Unk1
BYTE Type1
BYTE Type2

if(Type1!=0) elem is a Delimiter, Type1 is # boundary blocks, Type 2 is Relative Direction of first block
if(Type1==0) && (Type2!=0) elem is a StaticTile, Type2 is # static blocks
else elem is a LandTile

The first element is always a LandTile, with WORD (Type1,Type2) set to current Block ID.


Then for each types continues as it follows:


for LandTile:

SBYTE Z (-127,127)
WORD New Graphic (8==Snow 5==Sea 1==Grass ...)
WORD Legacy Graphic flipped



for Delimiters: 
(it appears only after cells placed on the boundaries of the blocks if they confine with other map blocks)

SBYTE Last Cell Z
WORD Last Cell New Graphic

if( # boundary blocks>1)
  for each boundary block
	BYTE Unkk1
	BYTE 0
	BYTE Relative Direction
	SBYTE Last Cell Z
	WORD Last Cell type of terrain
  end for
endif

Relative Direction is one of this values:

1     2      7
  ----------
  |        |
  |   Map  |
0 |  Block | 3
  |        |
  |        |
  ----------
6     5      4




for StaticTile:

WORD Graphic
BYTES(2) UnkS
SBYTE Z
BYTE UnkS2
if( # static blocks>1)
  for each static block
	BYTES(3) 0
	WORD Graphic
	BYTES(2) Unk (seems always 0)
	SBYTE Z
	WORD Color ( Last byte overlaps next elem byte)
  end for
endif

File EOF is 0x00 0x00 0x00
Bild

Kons

#2 Beitrag von Kons » 06 Jun 2008 15:53

I used this file to analyze facets and write my own cause i think this one is not so clear :)

Code: Alles auswählen

Facet Analysis:

Each decompressed file starts with:
- BYTE Facet
- WORD File ID
- LandTile with NO header

Construction:

Each element has a Header
-BYTE Unk (Seems always 0,1,2,7,3D )
-BYTE Type1
-BYTE Type2


if (T1 == 0 && T2 == 0 )
Element is LANDTIPE:
-SBYTE Z
-WORD KR Graphic = byte G1 + byte G2, G2 seems always 0
-WORD ML Graphic = byte G3 + byte G4, G3 is 1 for 256+ n elements

if (T1 == 1 || T1 > 1 )
Element is DELIMITER, T1 is number of Delimiters%u3a
(u28 T1 == 1 )
- BYTE Direction == Type2 (same byte, not same value )
- SBYTE Z
- WORD Graphic == byte G1 + byte G2, G2 seems always 0
IF(T1 > 1 )
- 2 BYTES == 0 (Unk and Type1 substitutes )
- BYTE Direction
- SBYTE Z
- WORD Graphic == byte G1 + byte G2, G2 seems always 0

if (T1 == 0 && T2 != 0 )
Element is STATIC, T2 is number of statics%u3a
IF (T2 == 1 )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z 
- WORD Color == byte C1 + byte C2, C2 is always next element byte (0 ? )
IF (T2 > 1)
- 3 BYTES == 0 (header subtitute )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z 
- WORD Color == byte C1 + byte C2, C2 is always next element byte(0 ? )

WORD Color can be read as BYTE Color, unless you find a Color different by 0 ( i did not :\ ) 
Values are in Hex
Edit: added G3 description
Edit: added Unk possibilities

Kons

#3 Beitrag von Kons » 02 Jul 2008 16:52

Changes:

Code: Alles auswählen

KR Facet Diagram:

Each file starts with:
- BYTE Facet
- WORD File ID
- LandTile

Each element has a Header
-BYTE Type1
-BYTE Type2

-------------------------

if ( T1 == 0 && T2 == 0 )
Element is LANDTIPE:

-SBYTE Z
-WORD KR Graphic
-BYTE Type3 = koksi knows what is it.
-WORD ML Graphic = Reversed

Tile : T1  T2  Z   GK  GK T3 GL GL 

-------------------------

if ( T1 == 1 || T1 > 1 )
Element is DELIMITER, T1 is number of Delimiters:

IF( T1 == 1 )
- BYTE Direction == Type2 ( same byte, not same value )
- SBYTE Z
- WORD Graphic
- BYTE Unk ( maybe 3 bytes graphic )

IF( T1 > 1 )
- BYTE == 0 ( Type1 substitutes )
- BYTE Direction
- SBYTE Z
- WORD Graphic
- BYTE Unk ( maybe 3 bytes graphic )

Delimiter:  T1 D  Z   G1 G2 U2

-------------------------

if ( T1 == 0 && T2 != 0 )
Element is STATIC, T2 is number of statics:

IF ( T2 == 1 )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z 
- WORD Color

IF ( T2 > 1 )
- 2 BYTES == 0 ( header subtitute )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z 
- WORD Color

Static : T1 T2 G1 G2 U  U  Z  C1 C2

------------------------

EXAMPLE : 

Facet : 1  

T1  T2  Z   GK  GK T3 GL GL  
FF  14  25  9B  0  0  71  0  

T1 D  Z   G1 U  U2
3  0  25  2  0  0  
0  1  25  2  0  0  
0  2  25  2  0  0  

T1 T2 G1 G2 U  U  Z  C1 C2
0  3  8  5  0  0  39  0  0  
0  0  27  2  0  0  25  0  0  
0  0  24  4  0  0  3A  0  0  

RadstaR
Junior Mitglied
Beiträge: 70
Registriert: 29 Dez 2006 06:22
Kontaktdaten:

#4 Beitrag von RadstaR » 03 Jul 2008 14:54

UOKR Facet Reader 1.5 Source code :
http://ultima.lonet.cz/download_uokr.php

TheUndisputed

#5 Beitrag von TheUndisputed » 03 Jul 2008 16:27

This Facet Reader work good when ML graphic is smaller than 1byte , but when ML Graphic is bigger than 1byte your facet reader read only one byte from MLgraphic and is not correct.
This is because after KR graphic you can see 1byte (KR Graphic Type common 0 , but you can see 1 and 2) after that is ML Reversed Graphic
And unk is last part of ML graphic and last part of Color for static and is after element not before.

Sorry for my bad english.

RadstaR
Junior Mitglied
Beiträge: 70
Registriert: 29 Dez 2006 06:22
Kontaktdaten:

#6 Beitrag von RadstaR » 03 Jul 2008 19:33

TheUndisputed : Thanx for info. I create this program few mouths ago and no more update it.

Kons

#7 Beitrag von Kons » 03 Jul 2008 19:38

TheUndisputed = Koksi = the one who knows what type3 is. lol.

Antworten