Skip to content

Commit

Permalink
fix: fix imp export file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelesaux committed Oct 13, 2021
1 parent c71db8c commit 7fd2801
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions export/file/imp.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ import (
)

type ImpFooter struct {
Height byte
Width byte
Height byte
NbFrames byte
}

func Imp(sprites []byte, nbFrames, width, height, mode uint, filename string, export *x.ExportType) error {
h := height
w := width
switch mode {
case 0:
h /= 2
w /= 2
case 1:
h /= 4
w /= 4
case 2:
h /= 8
w /= 8
}
impHeader := ImpFooter{
Height: byte(h),
Width: byte(width),
Width: byte(w),
Height: byte(height),
NbFrames: byte(nbFrames),
}
output := make([]byte, 0)
Expand Down Expand Up @@ -70,7 +70,7 @@ func TileMap(data []byte, filename string, export *x.ExportType) error {
Size: uint16(binary.Size(output)),
Size2: uint16(binary.Size(output)),
LogicalSize: uint16(binary.Size(output))}
copy(header.Filename[:], export.GetAmsdosFilename(filename, ".IMP"))
copy(header.Filename[:], export.GetAmsdosFilename(filename, ".TIL"))
header.Checksum = uint16(header.ComputedChecksum16())
impPath := filepath.Join(export.OutputPath, export.GetAmsdosFilename(filename, ".TIL"))
fw, err := os.Create(impPath)
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var (
filloutGif = flag.Bool("fillout", false, "Fill out the gif frames needed some case with deltapacking")
saturationPal = flag.Int("contrast", 0, "apply contrast on the color of the palette on amstrad plus screen. (max value 100 and only on CPC PLUS).")
brightnessPal = flag.Int("brightness", 0, "apply brightness on the color of the palette on amstrad plus screen. (max value 100 and only on CPC PLUS).")
appVersion = "0.30"
appVersion = "0.31"
version = flag.Bool("version", false, "print martine's version")
)

Expand Down Expand Up @@ -584,11 +584,11 @@ func main() {
os.Exit(-1)
}
f.Close()
nbFrames++
if i >= maxTiles {
fmt.Fprintf(os.Stderr, "Maximum of %d tiles accepted, skipping...\n", maxTiles)
break
}
nbFrames++
}
}
// save the file sprites
Expand Down

0 comments on commit 7fd2801

Please sign in to comment.