1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-18 02:16:23 -05:00

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

View File

@ -30,8 +30,7 @@ const (
hiddenLength = 1 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 Prop1 byte
Sequence byte Sequence byte
Unknown1 byte Unknown1 byte
@ -43,11 +42,11 @@ type FloorShadow struct {
YAdjust int YAdjust int
} }
// Floor represents a floor record in a DS1 file. (it is just an alias of FloorShadow). // Floor represents a floor record in a DS1 file. (it is just an alias of floorShadow).
type Floor = FloorShadow type Floor = floorShadow
// Shadow represents a shadow record in a DS1 file. (it is just an alias of FloorShadow). // Shadow represents a shadow record in a DS1 file. (it is just an alias of floorShadow).
type Shadow = FloorShadow type Shadow = floorShadow
// Hidden returns if floor/shadow is hidden // Hidden returns if floor/shadow is hidden
func (f *Floor) Hidden() bool { 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++ { for x := 0; x < rect.Width; x++ {
tile := g.engine.Tile(rect.Left+x, rect.Top+y) tile := g.engine.Tile(rect.Left+x, rect.Top+y)
tile.RegionType = d2enum.RegionIdType(levelDetails.LevelType) 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) 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 var img d2interface.Surface
if !tile.Animated { if !tile.Animated {
img = mr.getImageCacheRecord(tile.Style, tile.Sequence, 0, tile.RandomIndex) 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) 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) img := mr.getImageCacheRecord(tile.Style, tile.Sequence, 13, tile.RandomIndex)
if img == nil { if img == nil {
mr.Warningf("Render called on uncached shadow {%v,%v}", tile.Style, tile.Sequence) 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) tileOptions := mr.mapEngine.GetTiles(int(tile.Style), int(tile.Sequence), 0)
var tileData []*d2dt1.Tile 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) tileOptions := mr.mapEngine.GetTiles(int(tile.Style), int(tile.Sequence), d2enum.TileShadow)
var tileData *d2dt1.Tile var tileData *d2dt1.Tile