Correctly render all four objects for every cell in a map
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
doc/formats/img/chapter01-rendering-objects.png
Normal file
BIN
doc/formats/img/chapter01-rendering-objects.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 MiB |
@@ -375,7 +375,7 @@ Press "U" to get to the screen!
|
||||
|
||||

|
||||
|
||||
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!
|
||||
|
||||

|
||||
|
||||
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:
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user