Formalise a bit in each cell as an "IsActive()" bit
This commit is contained in:
@@ -69,8 +69,8 @@ func (h Header) MapSetFilename() string {
|
||||
}
|
||||
|
||||
type ObjRef struct {
|
||||
AreaByte byte
|
||||
FrameAndUnknownByte byte
|
||||
AreaByte byte
|
||||
SpriteAndFlagByte byte
|
||||
}
|
||||
|
||||
// The index into a set palette to retrieve the object
|
||||
@@ -78,8 +78,14 @@ func (o ObjRef) Index() int {
|
||||
return int(o.AreaByte)
|
||||
}
|
||||
|
||||
func (o ObjRef) Frame() int {
|
||||
return int(o.FrameAndUnknownByte - 0x80)
|
||||
func (o ObjRef) Sprite() int {
|
||||
// The top bit seems to be a flag of some kind
|
||||
return int(o.SpriteAndFlagByte & 0x7f)
|
||||
}
|
||||
|
||||
// The top bit seems to say whether we should draw or not.
|
||||
func (o ObjRef) IsActive() bool {
|
||||
return (o.SpriteAndFlagByte & 0x80) == 0x80
|
||||
}
|
||||
|
||||
type Cell struct {
|
||||
@@ -108,19 +114,19 @@ func (c *Cell) At(n int) byte {
|
||||
case 3:
|
||||
return c.Surface.AreaByte
|
||||
case 4:
|
||||
return c.Surface.FrameAndUnknownByte
|
||||
return c.Surface.SpriteAndFlagByte
|
||||
case 5:
|
||||
return c.Left.AreaByte
|
||||
case 6:
|
||||
return c.Left.FrameAndUnknownByte
|
||||
return c.Left.SpriteAndFlagByte
|
||||
case 7:
|
||||
return c.Right.AreaByte
|
||||
case 8:
|
||||
return c.Right.FrameAndUnknownByte
|
||||
return c.Right.SpriteAndFlagByte
|
||||
case 9:
|
||||
return c.Center.AreaByte
|
||||
case 10:
|
||||
return c.Center.FrameAndUnknownByte
|
||||
return c.Center.SpriteAndFlagByte
|
||||
case 11:
|
||||
return c.Unknown11
|
||||
case 12:
|
||||
@@ -139,7 +145,6 @@ func (c *Cell) At(n int) byte {
|
||||
// Cells is always a fixed size; use At to get a cell according to x,y,z
|
||||
type Cells []Cell
|
||||
|
||||
// FIXME: Ordering may be incorrect? I assume z,y,x for now...
|
||||
func (c Cells) At(x, y, z int) Cell {
|
||||
return c[(z*MaxLength*MaxWidth)+(y*MaxWidth)+x]
|
||||
}
|
||||
|
Reference in New Issue
Block a user