d2ds1.FloorShadow is now private

This commit is contained in:
gravestench 2021-02-17 10:16:10 -08:00 committed by Dylan Knuth
parent ee758b785c
commit 87d0803a4f
5 changed files with 15 additions and 16 deletions

View File

@ -215,10 +215,10 @@ func TestDS1_SetTiles(t *testing.T) {
ds1 := exampleDS1()
exampleTile1 := Tile{
Floors: []FloorShadow{
Floors: []floorShadow{
{0, 0, 2, 3, 4, 55, 33, true, 999},
},
Shadows: []FloorShadow{
Shadows: []floorShadow{
{2, 4, 5, 33, 6, 7, 0, false, 1024},
},
}
@ -227,7 +227,7 @@ func TestDS1_SetTiles(t *testing.T) {
Walls: []Wall{
{2, 3, 4, 5, 3, 2, 3, 0, 33, 99},
},
Shadows: []FloorShadow{
Shadows: []floorShadow{
{2, 4, 5, 33, 6, 7, 0, false, 1024},
},
}
@ -267,14 +267,14 @@ func TestDS1_SetTile(t *testing.T) {
ds1 := exampleDS1()
exampleTile := Tile{
Floors: []FloorShadow{
Floors: []floorShadow{
{5, 8, 9, 4, 3, 4, 2, true, 1024},
{8, 22, 7, 9, 6, 3, 0, false, 1024},
},
Walls: []Wall{
{2, 3, 4, 5, 3, 2, 3, 0, 33, 99},
},
Shadows: []FloorShadow{
Shadows: []floorShadow{
{2, 44, 99, 2, 4, 3, 2, true, 933},
},
}

View File

@ -30,8 +30,7 @@ const (
hiddenLength = 1
)
// FloorShadow represents a floor or shadow record in a DS1 file (they share a common struct).
type FloorShadow struct {
type floorShadow struct {
Prop1 byte
Sequence byte
Unknown1 byte
@ -43,11 +42,11 @@ type FloorShadow struct {
YAdjust int
}
// Floor represents a floor record in a DS1 file. (it is just an alias of FloorShadow).
type Floor = FloorShadow
// Floor represents a floor record in a DS1 file. (it is just an alias of floorShadow).
type Floor = floorShadow
// Shadow represents a shadow record in a DS1 file. (it is just an alias of FloorShadow).
type Shadow = FloorShadow
// Shadow represents a shadow record in a DS1 file. (it is just an alias of floorShadow).
type Shadow = floorShadow
// Hidden returns if floor/shadow is hidden
func (f *Floor) Hidden() bool {

View File

@ -284,7 +284,7 @@ func (g *MapGenerator) generateWilderness1Contents(rect d2geom.Rectangle) {
for x := 0; x < rect.Width; x++ {
tile := g.engine.Tile(rect.Left+x, rect.Top+y)
tile.RegionType = d2enum.RegionIdType(levelDetails.LevelType)
tile.Components.Floors = []d2ds1.FloorShadow{{Prop1: 1, Style: 0, Sequence: 0}} // wildernessGrass
tile.Components.Floors = []d2ds1.Floor{{Prop1: 1, Style: 0, Sequence: 0}} // wildernessGrass
tile.PrepareTile(x, y, g.engine)
}
}

View File

@ -393,7 +393,7 @@ func (mr *MapRenderer) renderTilePass3(tile *d2mapengine.MapTile, target d2inter
}
}
func (mr *MapRenderer) renderFloor(tile d2ds1.FloorShadow, target d2interface.Surface) {
func (mr *MapRenderer) renderFloor(tile d2ds1.Floor, target d2interface.Surface) {
var img d2interface.Surface
if !tile.Animated {
img = mr.getImageCacheRecord(tile.Style, tile.Sequence, 0, tile.RandomIndex)
@ -431,7 +431,7 @@ func (mr *MapRenderer) renderWall(tile d2ds1.Wall, viewport *Viewport, target d2
target.Render(img)
}
func (mr *MapRenderer) renderShadow(tile d2ds1.FloorShadow, target d2interface.Surface) {
func (mr *MapRenderer) renderShadow(tile d2ds1.Shadow, target d2interface.Surface) {
img := mr.getImageCacheRecord(tile.Style, tile.Sequence, 13, tile.RandomIndex)
if img == nil {
mr.Warningf("Render called on uncached shadow {%v,%v}", tile.Style, tile.Sequence)

View File

@ -53,7 +53,7 @@ func (mr *MapRenderer) generateTileCache() {
}
}
func (mr *MapRenderer) generateFloorCache(tile *d2ds1.FloorShadow) {
func (mr *MapRenderer) generateFloorCache(tile *d2ds1.Floor) {
tileOptions := mr.mapEngine.GetTiles(int(tile.Style), int(tile.Sequence), 0)
var tileData []*d2dt1.Tile
@ -110,7 +110,7 @@ func (mr *MapRenderer) generateFloorCache(tile *d2ds1.FloorShadow) {
}
}
func (mr *MapRenderer) generateShadowCache(tile *d2ds1.FloorShadow) {
func (mr *MapRenderer) generateShadowCache(tile *d2ds1.Shadow) {
tileOptions := mr.mapEngine.GetTiles(int(tile.Style), int(tile.Sequence), d2enum.TileShadow)
var tileData *d2dt1.Tile