diff --git a/cmd/view-map/main.go b/cmd/view-map/main.go index ea39a8d..0ed89f1 100644 --- a/cmd/view-map/main.go +++ b/cmd/view-map/main.go @@ -163,8 +163,10 @@ func (s *state) present(pWin *pixelgl.Window) { cell := gameMap.Cells.At(x, y, z) - surfaceSprite, _ := s.env.getSprite(s.env.set.SurfacePalette, cell.Surface) - centerSprite, _ := s.env.getSprite(s.env.set.CenterPalette, cell.Center) + surfaceSprite, _ := s.env.getSprite(s.env.set.Palette, cell.Surface) + centerSprite, _ := s.env.getSprite(s.env.set.Palette, cell.Center) + leftSprite, _ := s.env.getSprite(s.env.set.Palette, cell.Left) + rightSprite, _ := s.env.getSprite(s.env.set.Palette, cell.Right) fX := float64(x) fY := float64(y) @@ -185,6 +187,14 @@ func (s *state) present(pWin *pixelgl.Window) { if centerSprite != nil { centerSprite.Spr.Draw(pWin, pixel.IM.Moved(iso)) } + + if leftSprite != nil { + leftSprite.Spr.Draw(pWin, pixel.IM.Moved(iso)) + } + + if rightSprite != nil { + rightSprite.Spr.Draw(pWin, pixel.IM.Moved(iso)) + } } } } diff --git a/doc/formats/img/chapter01-rendering-objects.png b/doc/formats/img/chapter01-rendering-objects.png new file mode 100644 index 0000000..3bc90ef Binary files /dev/null and b/doc/formats/img/chapter01-rendering-objects.png differ diff --git a/doc/formats/maps.md b/doc/formats/maps.md index 3c8b769..7a9610e 100644 --- a/doc/formats/maps.md +++ b/doc/formats/maps.md @@ -375,7 +375,7 @@ Press "U" to get to the screen! ![Debug screen](img/cell-information-debug.png) -I've added a `view-map` command to explore the data graphically. Each of the 16 +I've added a `view-minimap` command to explore the data graphically. Each of the 16 bytes in a cell row must have a function; comparing a known map to how it looks in WH40K_TD.exe can help me to unravel that function. @@ -431,7 +431,20 @@ maps.Cell{ So `CellIdx == 9` points to the center object's Area, looked up in the set file! -![Pinning down cell index 9](img/chapter01_cell_index_9.png +![Pinning down cell index 9](img/chapter01_cell_index_9.png) + +It seems the area numbers are absolute indexes into the set, rather than having +a new set of indices for each type. + +With this information, we can render a given Z index for a map quite easily, +using the new `view-map` binary. It draws the four objects for every cell, and +gives results like this: + +![Rendering all map objects](img/chapter01-rendering-objects.png) + +Some colours are off, but I've verified that I'm using the correct palette, so +this must be due to other things. Perhaps `Data/Cycle.cyc` is the culprit, or +maybe I need to revisit .obj file parsing a few more times! ## Trailer