Correctly render all four objects for every cell in a map

This commit is contained in:
2018-03-25 00:36:23 +00:00
parent c8238f1853
commit 6a90bb16cf
3 changed files with 27 additions and 4 deletions

View File

@@ -163,8 +163,10 @@ func (s *state) present(pWin *pixelgl.Window) {
cell := gameMap.Cells.At(x, y, z) cell := gameMap.Cells.At(x, y, z)
surfaceSprite, _ := s.env.getSprite(s.env.set.SurfacePalette, cell.Surface) surfaceSprite, _ := s.env.getSprite(s.env.set.Palette, cell.Surface)
centerSprite, _ := s.env.getSprite(s.env.set.CenterPalette, cell.Center) 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) fX := float64(x)
fY := float64(y) fY := float64(y)
@@ -185,6 +187,14 @@ func (s *state) present(pWin *pixelgl.Window) {
if centerSprite != nil { if centerSprite != nil {
centerSprite.Spr.Draw(pWin, pixel.IM.Moved(iso)) 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))
}
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

View File

@@ -375,7 +375,7 @@ Press "U" to get to the screen!
![Debug screen](img/cell-information-debug.png) ![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 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. 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! 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 ## Trailer