This commit is contained in:
a 2024-08-05 23:27:48 -05:00
parent eebde0a484
commit c04079691b
Signed by: a
GPG Key ID: 374BC539FE795AF0
30 changed files with 31 additions and 12 deletions

BIN
_data/char/Trs001.nri Normal file

Binary file not shown.

BIN
_data/char/Trs002.nri Normal file

Binary file not shown.

BIN
_data/char/chr001.nri Normal file

Binary file not shown.

BIN
_data/char/chr003.nri Normal file

Binary file not shown.

BIN
_data/char/chr004.nri Normal file

Binary file not shown.

BIN
_data/char/chr005.nri Normal file

Binary file not shown.

BIN
_data/char/chr006.nri Normal file

Binary file not shown.

BIN
_data/char/chr007.nri Normal file

Binary file not shown.

BIN
_data/char/chr008.nri Normal file

Binary file not shown.

BIN
_data/char/chr009.nri Normal file

Binary file not shown.

BIN
_data/char/chr010.nri Normal file

Binary file not shown.

BIN
_data/char/chr011.nri Normal file

Binary file not shown.

BIN
_data/char/chr013.nri Normal file

Binary file not shown.

BIN
_data/char/chr014.nri Normal file

Binary file not shown.

BIN
_data/char/chr015.nri Normal file

Binary file not shown.

BIN
_data/char/chr016.nri Normal file

Binary file not shown.

BIN
_data/char/chr017.nri Normal file

Binary file not shown.

BIN
_data/char/chr018.nri Normal file

Binary file not shown.

BIN
_data/char/chr019.nri Normal file

Binary file not shown.

BIN
_data/char/chr020.nri Normal file

Binary file not shown.

BIN
_data/char/chr021.nri Normal file

Binary file not shown.

BIN
_data/char/chr022.nri Normal file

Binary file not shown.

BIN
_data/char/chr023.nri Normal file

Binary file not shown.

BIN
_data/char/chr024.nri Normal file

Binary file not shown.

BIN
_data/char/chr025.nri Normal file

Binary file not shown.

BIN
_data/char/chr026.nri Normal file

Binary file not shown.

BIN
_data/char/chr027.nri Normal file

Binary file not shown.

BIN
_data/char/chr100.nri Normal file

Binary file not shown.

BIN
_data/char/chr101.nri Normal file

Binary file not shown.

View File

@ -5,15 +5,16 @@ import (
"fmt"
"image/color"
"io"
"log"
)
type PaletteSection struct {
Version uint32
Params [4]uint32
Divided bool
OpaqueIndexCount uint32
DataLength uint32
Palette [256]color.Color
MainBound [2]uint32
Palette [256]*color.RGBA
MainBounds [2]uint32
lastSignature [4]byte
}
@ -25,18 +26,16 @@ func (p *PaletteSection) Decode(rd io.Reader) error {
if sig, target := string(p.lastSignature[:]), "PAL_"; sig != target {
return fmt.Errorf("bad sig: want %s, got %s", target, sig)
}
p.Palette = [256]color.Color{}
p.Palette = [256]*color.RGBA{}
if err := binary.Read(rd, end, &p.Version); err != nil {
return err
}
if err := binary.Read(rd, end, p.Params[:]); err != nil {
return err
}
var cast uint32
if err := binary.Read(rd, end, &cast); err != nil {
if err := binary.Read(rd, end, &p.OpaqueIndexCount); err != nil {
return err
}
p.Divided = (cast > 0)
if err := binary.Read(rd, end, &p.DataLength); err != nil {
return err
}
@ -58,10 +57,30 @@ func (p *PaletteSection) Decode(rd io.Reader) error {
alpha,
}
}
if p.Divided {
if err := binary.Read(rd, end, p.MainBound[:]); err != nil {
for i := uint32(0); i < p.OpaqueIndexCount; i++ {
var first uint32
if err := binary.Read(rd, end, &first); err != nil {
return err
}
var last uint32
if err := binary.Read(rd, end, &last); err != nil {
return err
}
log.Println("oic", p.OpaqueIndexCount, i, first, last)
// TODO: figure out what setBoard actually does
//p.setBoard(first, last, 255)
}
return nil
}
func (p *PaletteSection) setBoard(start uint32, end uint32, alpha int32) {
if !(start >= 0 && end >= 0 && start < 256 && end < 256) {
return
}
for i := start; i <= end; i++ {
p.Palette[i].A = uint8(alpha)
}
}