-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamemap.go
61 lines (54 loc) · 1.78 KB
/
gamemap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package retro
import "github.com/kralamoure/retroutil"
type GameMap struct {
Id int
Name string
Width int
Height int
Background int
Ambiance int
Music int
Outdoor bool
Capabilities int
Data string
EncryptedData string
Key string
}
type GameMapPath struct {
CellId int
Dir int
}
func (m GameMap) Cells() ([]retroutil.Cell, error) {
utilCells, err := retroutil.DecompressCells(m.Data, false)
if err != nil {
return nil, err
}
builtCells := retroutil.BuiltCells(nil, false, m.Width, utilCells)
cells := make([]retroutil.Cell, len(builtCells))
for i, v := range builtCells {
cells[i] = retroutil.Cell{
Id: v.Id,
Active: v.Active,
LineOfSight: v.LineOfSight,
LayerGroundRot: v.LayerGroundRot,
GroundLevel: v.GroundLevel,
Movement: v.Movement,
LayerGroundNum: v.LayerGroundNum,
GroundSlope: v.GroundSlope,
LayerGroundFlip: v.LayerGroundFlip,
LayerObject1Num: v.LayerObject1Num,
LayerObject1Rot: v.LayerObject1Rot,
LayerObject1Flip: v.LayerObject1Flip,
LayerObject2Flip: v.LayerObject2Flip,
LayerObject2Interactive: v.LayerObject2Interactive,
LayerObject2Num: v.LayerObject2Num,
PermanentLevel: v.PermanentLevel,
LayerObjectExternal: v.LayerObjectExternal,
LayerObjectExternalInteractive: v.LayerObjectExternalInteractive,
X: v.X,
Y: v.Y,
SpriteOnId: v.SpriteOnId,
}
}
return cells, nil
}