Discover how frames are encoded, use that knowledge to (finally) get the viewport locked in

This commit is contained in:
2018-03-18 15:39:50 +00:00
parent 2f02c7bbf3
commit 961a213752
4 changed files with 53 additions and 49 deletions

View File

@@ -28,7 +28,7 @@ var (
type env struct {
gameMap *maps.GameMap
set sets.MapSet
set *sets.MapSet
}
type runState struct {
@@ -159,8 +159,8 @@ func present(win *pixelgl.Window, state *runState) {
// Draw the boundary
rect := pixel.R(
float64(gameMap.MinWidth)-1, float64(gameMap.MinLength)-1,
float64(gameMap.MaxWidth)+1, float64(gameMap.MaxLength)+1,
float64(gameMap.MinWidth)-0.5, float64(gameMap.MinLength)-0.5,
float64(gameMap.MaxWidth)+0.5, float64(gameMap.MaxLength)+0.5,
)
imd.Color = pixel.RGB(255, 0, 0)
@@ -210,9 +210,10 @@ func makeColour(cell *maps.Cell, colIdx int) pixel.RGBA {
scale = mult(0.004)
case 14:
scale = mult(0.004)
case 15:
scale = mult(1.0)
default:
scale = mult(0.01) // close to maximum resolution, low-value fields will be lost
}
col := scale(float64(cell.At(colIdx)))
@@ -290,9 +291,9 @@ func runStep(win *pixelgl.Window, state *runState) *runState {
log.Printf("%#v -> %d,%d", vec, x, y)
cell := state.env.gameMap.Cells.At(x, y, state.zIdx)
log.Printf(
"x=%d y=%d z=%d Object0SurfaceArea=%d Object3CenterArea=%d (%s) SquadRelated=%d",
"x=%d y=%d z=%d SurfaceTile=%d (%s) SurfaceFrame=%d SquadRelated=%d",
x, y, state.zIdx,
cell.Object0SurfaceArea, cell.Object3CenterArea, state.env.set.Palette[int(cell.Object3CenterArea)],
cell.Surface.Index(), state.env.set.Palette[int(cell.Surface.Index())], cell.Surface.Frame(),
cell.SquadRelated,
)
log.Printf("CellIdx%d=%d. Full cell data: %#v", state.cellIdx, cell.At(state.cellIdx), cell)