Since the development of PattView has come to a close, I believe the next logical step is to explain how it works so others can duplicate and expand upon my work. Before I get started here, I'd like to thank DsPet and Virus for all of their help in the development of this tool. We all know it would've never happened without them.
Let's dissect the RVFOREST.DAT save file and locate the pattern information. Here is the offset information used in PattView. Each offset will take you to the start of the pattern information for that slot.
Code:
1-1
offset=$1160
player=1
1-2
offset=$19E0
player=1
1-3
offset=$2260
player=1
1-4
offset=$2AE0
player=1
1-5
offset=$3360
player=1
1-6
offset=$3BE0
player=1
1-7
offset=$4460
player=1
1-8
offset=$4CE0
player=1
2-1
offset=$9820
player=2
2-2
offset=$A0A0
player=2
2-3
offset=$A920
player=2
2-4
offset=$B1A0
player=2
2-5
offset=$BA20
player=2
2-6
offset=$C2A0
player=2
2-7
offset= $CB20
player=2
2-8
offset=$D3A0
player=2
3-1
offset=$11EE0
player=3
3-2
offset=$12760
player=3
3-3
offset=$12FE0
player=3
3-4
offset=$13860
player=3
3-5
offset=$140E0
player=3
3-6
offset=$14960
player=3
3-7
offset=$151E0
player=3
3-8
offset=$15A60
player=3
4-1
offset=$1A5A0
player=4
4-2
offset=$1AE20
player=4
4-3
offset=$1B6A0
player=4
4-4
offset=$1BF20
player=4
4-5
offset=$1C7A0
player=4
4-6
offset=$1D020
player=4
4-7
offset=$1D8A0
player=4
4-8
offset=$1E120
player=4
NPC1
offset=$234E0
NPC2
offset=$26520
NPC3
offset=$29560
NPC4
offset=$2C5A0
NPC5
offset=$2F5E0
NPC6
offset=$32620
NPC7
offset=$35660
NPC8
offset=$386A0
NPC9
offset=$3B6E0
NPC10
offset=$3E720
NPC11
offset=$41980
NPC12
offset=$449C0
NPC13
offset=$47A00
NPC14
offset=$4AA40
NPC15
offset=$4DA80
NPC16
offset=$50AC0
NPC17
offset=$53B00
NPC18
offset=$56B40
NPC19
offset=$59B80
NPC20
offset=$5CBC0
G1
offset=$5EC80
G2
offset=$5F500
G3
offset=$5FD80
G4
offset=$60600
G5
offset=$60E80
G6
offset=$61700
G7
offset=$61F80
G8
offset=$62800
Each pattern is 880h bytes in length. The actual image data starts right at the first byte. The length of the image data is 200h bytes per section. There are 4 image data sections, all 1 after the other (as shown in Figure 1). The pattern is rendered in 16 separate pieces, as demonstrated in Figure 1.
Fig. 1 - One Full Pro-Design Pattern
Each of the 16 sections in one pattern are 32 bytes (20h) long and are rendered in the order shown in Figure 1. Each row in one of the 16 sections is 4 bytes long, but 8 cells. Bytes are split to accommodate the color of two cells (ex. 1F, first cell would be color 1 and the second cell would be color F). So one section is 8 cells wide, and 4 bytes.
Byte 86Fh of the pattern data is the palette number. The palette colors in PattView are estimates based on the palettes in-game. There are 15 colors in each palette. The code I used was 0 based (0..14). Here are the color values I used (forgive some windows defaults used).
Code:
Palette 1
0 color=clred
1 color=clgreen
2 color=clblue
3 color=$00004080
4 color=clblack
5 color=$000080FF
6 color=$0000FF80
7 color=$00EAEA00
8 color=clpurple
9 color=clgray
10 color=$00E4CAFF
11 color=clyellow
12 color=$00FDCCAC
13 color=$00B366FF
14 color=clwhite
Palette 2
0 color=$001E56FD
1 color=$0000C400
2 color=$00FB8239
3 color=$000268AC
4 color=clblack
5 color=$004AA5FF
6 color=$0040FF9F
7 color=$00FFA851
8 color=$00FC70EE
9 color=clgray
10 color=$0093C9FF
11 color=$0080FFFF
12 color=$00FFE0C1
13 color=$00E1C4FF
14 color=clwhite
Palette 3
0 color=$00404080
1 color=$00336600
2 color=$00A94B4B
3 color=$00212F4B
4 color=clblack
5 color=$000268AC
6 color=$0054A800
7 color=$00F77B31
8 color=$00863E5F
9 color=$00969696
10 color=$00ACB9DF
11 color=$0000A4A4
12 color=$00CFBA9C
13 color=$00B06FB0
14 color=clwhite
Palette 4
0 color=$000229B0
1 color=$004F9FA2
2 color=$00828200
3 color=$00682B02
4 color=clblack
5 color=$000374FA
6 color=$0047C9E6
7 color=$007DC604
8 color=$00CD5A5A
9 color=clgray
10 color=$00AFD7FE
11 color=$00A8FFFF
12 color=$00C2EBC4
13 color=$00FEB494
14 color=clwhite
Palette 5
0 color=$009C5BD0
1 color=$0002B6EA
2 color=$00FF9122
3 color=$00FF0080
4 color=clblack
5 color=$00CF9FFF
6 color=$0000F4F4
7 color=$00FEC87E
8 color=$00C776B3
9 color=clgray
10 color=$00CCCCEE
11 color=$00B0FFFF
12 color=$00F3F4C1
13 color=$00EFCFE7
14 color=clwhite
Palette 6
0 color=$00400040
1 color=$00054542
2 color=$00626200
3 color=$0059002D
4 color=clblack
5 color=$005F1F98
6 color=$004D6B9D
7 color=$00957D37
8 color=$00BC4371
9 color=clgray
10 color=$00C595EC
11 color=$008AC6CE
12 color=$00CAAE80
13 color=$00FF6AB5
14 color=clwhite
Palette 7
0 color=$00710071
1 color=$00000095
2 color=$00078543
3 color=$00845900
4 color=clblack
5 color=$006C00D9
6 color=$000080FF
7 color=$0000CC66
8 color=$00889704
9 color=clgray
10 color=$00FF93FF
11 color=$0002BAF7
12 color=$0038D8DC
13 color=clAqua
14 color=clwhite
Palette 8
0 color=$00366D6D
1 color=$00A4A4A4
2 color=$00001C37
3 color=$00002D00
4 color=clblack
5 color=$000183AD
6 color=$00B4B4B4
7 color=$00233F5C
8 color=$003A6723
9 color=clgray
10 color=$005BCCD2
11 color=$00E1E1E1
12 color=$006483B0
13 color=$008A9366
14 color=clwhite
Palette 9
0 color=$00404080
1 color=$00666666
2 color=$00373700
3 color=$005C7483
4 color=clblack
5 color=$007E75B3
6 color=$00C3C3C3
7 color=$00413623
8 color=$00659EA3
9 color=clgray
10 color=$00A8A8D7
11 color=$00B9CDD0
12 color=$006D5F5F
13 color=$0098BEC9
14 color=clwhite
Palette 10
0 color=$003654AB
1 color=$000A143D
2 color=$008F3F6B
3 color=$00313479
4 color=clblack
5 color=$006997D6
6 color=$000D396A
7 color=$00AF5050
8 color=$003F42D1
9 color=clgray
10 color=$00BEBEFA
11 color=$0069ABCB
12 color=$00496228
13 color=$00178BFF
14 color=clwhite
Palette 11
0 color=clPurple
1 color=$00400080
2 color=$000059B3
3 color=$00008C8C
4 color=clblack
5 color=$00DF00DF
6 color=$003A01E4
7 color=$000080FF
8 color=clYellow
9 color=clgray
10 color=$00FF8CFF
11 color=$008585D6
12 color=$0078CFFE
13 color=$0080FFFF
14 color=clwhite
Palette 12
0 color=$009B004E
1 color=$00A00000
2 color=$00B58B53
3 color=$00408000
4 color=clblack
5 color=$00FF0080
6 color=$00FD225F
7 color=$00FCCF58
8 color=$005B9D02
9 color=$006F8484
10 color=$00FC96D8
11 color=$00FF9595
12 color=$00FFFF93
13 color=$00A5FE43
14 color=clwhite
Palette 13
0 color=$00498B9E
1 color=$00A7968B
2 color=$008687B7
3 color=$00212143
4 color=clblack
5 color=$003E7EBF
6 color=$00BCB0AF
7 color=$00BFC9DD
8 color=$00452956
9 color=$005B5B5B
10 color=$005BA8BB
11 color=$00D1C1B1
12 color=$00A9CFE0
13 color=$0053538A
14 color=clwhite
Palette 14
0 color=$00353500
1 color=$004B9700
2 color=$00767748
3 color=$00F5F5F5
4 color=$0000468C
5 color=$003C7700
6 color=$008EB702
7 color=$00BFB595
8 color=$00F2F1EA
9 color=$002576CF
10 color=$008DB002
11 color=$0003AB64
12 color=$00E1E1E1
13 color=clwhite
14 color=$0059ADE6
Palette 15
0 color=$00BCABA5
1 color=$00282800
2 color=$00BEA0CB
3 color=$00372839
4 color=clblack
5 color=$00D2C8BD
6 color=$006A5244
7 color=$00CFB0DB
8 color=$00493359
9 color=clgray
10 color=$00DDDDC6
11 color=$00937D68
12 color=$00C7C7E9
13 color=$0076638D
14 color=clwhite
Palette 16
0 color=$008AA9BD
1 color=$00002222
2 color=$00BCBCBC
3 color=$00322323
4 color=clblack
5 color=$00BDD6E6
6 color=$002E5C5C
7 color=$00DBD7D2
8 color=$00554D42
9 color=clgray
10 color=$00E7E7EF
11 color=$00567C7B
12 color=$00EDEAE9
13 color=$006B6B6B
14 color=clwhite
Of course, all of this is great, but you can't do much without a drawing routine. Some way to pinpoint the offset of the cell in your pattern data (0..1FFh). The following code is to pinpoint the offset in a 32x32 grid. I'll explain it after.
Code:
Finding the block value
if (acol < 8) and (arow < 8) then block=0 else
if (acol < 16) and (arow < 8) then block=1 else
if (acol < 24) and (arow < 8) then block=2 else
if (acol < 32) and (arow < 8) then block=3 else
if (acol < 8) and (arow < 16) then block=4 else
if (acol < 16) and (arow < 16) then block=5 else
if (acol < 24) and (arow < 16) then block=6 else
if (acol < 32) and (arow < 16) then block=7 else
if (acol < 8) and (arow < 24) then block=8 else
if (acol < 16) and (arow < 24) then block=9 else
if (acol < 24) and (arow < 24) then block=10 else
if (acol < 32) and (arow < 24) then block=11 else
if (acol < 8) and (arow < 32) then block=12 else
if (acol < 16) and (arow < 32) then block=13 else
if (acol < 24) and (arow < 32) then block=14 else
if (acol < 32) and (arow < 32) then block=15
Finding an offset
value = (32*block)+((arow mod 8)*4)+((acol mod 8) div 2)
There are some hints of delphi code in there, but I did my best to pseudo it up. ACol and ARow are the selected cell's column and row values, respectively. Anyway, the block value pinpoints which section you are in; 1 to 16 as shown in Figure 1 (except they must be 0 based for the algorithm). Then, that is applied to the rest of the general algorithm to give you an offset (0..1FFh). This is the byte where the value (color) for that cell is located in your pattern data.
More on the second post...