Will pc users ever have access...
Okay.
I am tired of waiting for a friend to throw away a Mac so I can run Amber. Here is a tcl script I wrote to start me off.
Tcl is interpreted, like perl, so this can run on anything.
You have Myth on your AIX machine somehow? This will run on it.
This script just extracts some key data from a previously extracted collection tag (I extracted mine with Topaz). There is more to come, but I figured since I just spent 10 hours doing this I should deliver it to the only customers who might want it before it disappears into the Myth Ether like for instance, the source to Amber and Apathy. It was also posted to alt.games.myth so Google can archive it for all time, and so I can be inundated with more Viagra and Penis Enlargement spam (I just wish those guys would coordinate!)
Comments are welcome. Especially the wicked detailed ones.
Industry
-------------------------------------------------------
#!/usr/bin/tclsh
#
# tagheader.tcl April 12, 2004 hinnersd
# This extracts the relevant fields from a Myth tag.
#
if {$argc !=1} {
error "Usage: tagheader.tcl filename"
}
set filehandle [open [lindex $argv 0] r]
seek $filehandle 4
set tagname [read $filehandle 32]
set tagtype [read $filehandle 4]
set tagid [read $filehandle 4]
set hexlastbits [read $filehandle 4]
binary scan $hexlastbits I* lastbits
set hexlength [read $filehandle 4]
binary scan $hexlength I* shortlength
set taglength [expr $lastbits + $shortlength ]
set hexuserflags [read $filehandle 4]
set unknown02 [read $filehandle 4]
set gameversion [read $filehandle 4]
##
# Check User Flags
# Flags for types of bitmaps in tag.
# 0x01 textures
# 0x02 monsters
# 0x04 projectiles
# 0x08 scenery
# 0x10 atmospheric
# 0x20 interface
# 0x29 textures and scenery and interface
# multiple flags are "or" together
# "and" the flag with each of these values if the result equals
# the flag, then that flag is set.
binary scan $hexuserflags I* userflags
if { [expr $userflags & 1] == 1} {
set texturesflag 1
} else {
set texturesflag 0
}
if { [expr $userflags & 2] == 2} {
set monstersflag 1
} else {
set monstersflag 0
}
if { [expr $userflags & 4] == 4} {
set projectilesflag 1
} else {
set projectilesflag 0
}
if { [expr $userflags & 8] == 8} {
set sceneryflag 1
} else {
set sceneryflag 0
}
if { [expr $userflags & 16] == 16} {
set atmosphericflag 1
} else {
set atmosphericflag 0
}
if { [expr $userflags & 32] == 32} {
set interfaceflag 1
} else {
set interfaceflag 0
}
#
# Color Table references in header
# (start 128 bytes into header)
seek $filehandle 128
set hexpaletteEntries [read $filehandle 4]
binary scan $hexpaletteEntries I* paletteEntries
set hexpaletteOffset [read $filehandle 4]
binary scan $hexpaletteOffset I* paletteOffset
set hexpaletteLength [read $filehandle 4]
binary scan $hexpaletteLength I* paletteLength
#
# Swap Color Reference
# (starts 144 bytes into header)
seek $filehandle 144 start
set hexswapColors [read $filehandle 4]
binary scan $hexswapColors I* swapColors
set hexswapColorOffset [read $filehandle 4]
binary scan $hexswapColorOffset I* swapColorOffset
set hexswapColorLength [read $filehandle 4]
binary scan $hexswapColorLength I* swapColorLength
#
# Sprite Lookup Tables Header Reference
# (starts 160 bytes into header)
seek $filehandle 160 start
set hexsprites [read $filehandle 4]
binary scan $hexsprites I* sprites
set hexspritesOffset [read $filehandle 4]
binary scan $hexspritesOffset I* spritesOffset
set hexspritesLength [read $filehandle 4]
binary scan $hexspritesLength I* spritesLength
#
# Bitmap Descriptors Reference
# (starts 176 bytes into header)
seek $filehandle 176 start
set hexbitmapDescriptors [read $filehandle 4]
binary scan $hexbitmapDescriptors I* bitmapDescriptors
set hexbitmapDescriptorsOffset [read $filehandle 4]
binary scan $hexbitmapDescriptorsOffset I* bitmapDescriptorsOffset
set hexbitmapDescriptorsLength [read $filehandle 4]
binary scan $hexbitmapDescriptorsLength I* bitmapDescriptorsLength
#
# Sequences Table Header Reference
# (starts 192 bytes into header)
seek $filehandle 192
set hexSequencesNumber [read $filehandle 4]
binary scan $hexSequencesNumber I* SequencesNumber
set hexSequencesOffset [read $filehandle 4]
binary scan $hexSequencesOffset I* SequencesOffset
set hexSequencesLength [read $filehandle 4]
binary scan $hexSequencesLength I* SequencesLength
#
# Get Sequence Names
# there is a whole bunch of info in here but this is all I can figure out
# right now.
# Each Sequence Table entry is 128 bytes long
# It looks like the name is the first 64 bytes
#
puts "Sequence Names\t Sequence Number"
set offset [expr $SequencesOffset + 384]
seek $filehandle $offset start
for {set sequencenumber 1} {$sequencenumber <= $SequencesNumber} {incr sequencenumber +1} {
set sequenceName($sequencenumber) [read $filehandle 64]
puts "$sequenceName($sequencenumber)\t\t\t$sequencenumber"
seek $filehandle 64 current
}
close $filehandle
#
# Output data
#
puts "Tag Name: $tagname"
puts "Tag Type: $tagtype"
puts "Tag Id: $tagid"
puts "Length (in bytes): $shortlength"
puts "User Flags: $userflags"
puts "\tTextures: $texturesflag"
puts "\tMonsters: $monstersflag"
puts "\tProjectiles: $projectilesflag"
puts "\tScenery: $sceneryflag"
puts "\tAtmospheric: $atmosphericflag"
puts "\tInterface: $interfaceflag"
puts "Game Version: $gameversion"
puts "Color Table Info:"
puts "\tNumber of palettes: $paletteEntries"
puts "\tPalette offset (from end of header): $paletteOffset"
puts "\tPalette Length: $paletteLength"
puts "Swap Colors Info:"
puts "\tNumber of Swap Color Palettes: $swapColors"
puts "\tSwap Color Offset: $swapColorOffset"
puts "\tSwap Color Table Length: $swapColorLength"
puts "Sprite Lookup Table Info:"
puts "\tNumber of Sprites: $sprites"
puts "\tSprite Table Offset (from end of 384 byte header): $spritesOffset"
puts "\tSprite Table Length: $spritesLength"
puts "Bitmap Descriptors Table Info:"
puts "\tNumber of Descriptors: $bitmapDescriptors"
puts "\tBitmap Descriptor Offset (from end of 384 byte header): $bitmapDescriptorsOffset"
puts "\tBitmap Descriptor Table Length: $bitmapDescriptorsLength"
puts "Sequences Table Info:"
puts "\tNumber of Sequences: $SequencesNumber"
puts "\tSequence Table Offset (from end of 384 byte header): $SequencesOffset"
puts "\tSequence Table Length: $SequencesLength"
-----------------------------------------------------
Yeah, this puts line was the end.
I am tired of waiting for a friend to throw away a Mac so I can run Amber. Here is a tcl script I wrote to start me off.
Tcl is interpreted, like perl, so this can run on anything.
You have Myth on your AIX machine somehow? This will run on it.
This script just extracts some key data from a previously extracted collection tag (I extracted mine with Topaz). There is more to come, but I figured since I just spent 10 hours doing this I should deliver it to the only customers who might want it before it disappears into the Myth Ether like for instance, the source to Amber and Apathy. It was also posted to alt.games.myth so Google can archive it for all time, and so I can be inundated with more Viagra and Penis Enlargement spam (I just wish those guys would coordinate!)
Comments are welcome. Especially the wicked detailed ones.
Industry
-------------------------------------------------------
#!/usr/bin/tclsh
#
# tagheader.tcl April 12, 2004 hinnersd
# This extracts the relevant fields from a Myth tag.
#
if {$argc !=1} {
error "Usage: tagheader.tcl filename"
}
set filehandle [open [lindex $argv 0] r]
seek $filehandle 4
set tagname [read $filehandle 32]
set tagtype [read $filehandle 4]
set tagid [read $filehandle 4]
set hexlastbits [read $filehandle 4]
binary scan $hexlastbits I* lastbits
set hexlength [read $filehandle 4]
binary scan $hexlength I* shortlength
set taglength [expr $lastbits + $shortlength ]
set hexuserflags [read $filehandle 4]
set unknown02 [read $filehandle 4]
set gameversion [read $filehandle 4]
##
# Check User Flags
# Flags for types of bitmaps in tag.
# 0x01 textures
# 0x02 monsters
# 0x04 projectiles
# 0x08 scenery
# 0x10 atmospheric
# 0x20 interface
# 0x29 textures and scenery and interface
# multiple flags are "or" together
# "and" the flag with each of these values if the result equals
# the flag, then that flag is set.
binary scan $hexuserflags I* userflags
if { [expr $userflags & 1] == 1} {
set texturesflag 1
} else {
set texturesflag 0
}
if { [expr $userflags & 2] == 2} {
set monstersflag 1
} else {
set monstersflag 0
}
if { [expr $userflags & 4] == 4} {
set projectilesflag 1
} else {
set projectilesflag 0
}
if { [expr $userflags & 8] == 8} {
set sceneryflag 1
} else {
set sceneryflag 0
}
if { [expr $userflags & 16] == 16} {
set atmosphericflag 1
} else {
set atmosphericflag 0
}
if { [expr $userflags & 32] == 32} {
set interfaceflag 1
} else {
set interfaceflag 0
}
#
# Color Table references in header
# (start 128 bytes into header)
seek $filehandle 128
set hexpaletteEntries [read $filehandle 4]
binary scan $hexpaletteEntries I* paletteEntries
set hexpaletteOffset [read $filehandle 4]
binary scan $hexpaletteOffset I* paletteOffset
set hexpaletteLength [read $filehandle 4]
binary scan $hexpaletteLength I* paletteLength
#
# Swap Color Reference
# (starts 144 bytes into header)
seek $filehandle 144 start
set hexswapColors [read $filehandle 4]
binary scan $hexswapColors I* swapColors
set hexswapColorOffset [read $filehandle 4]
binary scan $hexswapColorOffset I* swapColorOffset
set hexswapColorLength [read $filehandle 4]
binary scan $hexswapColorLength I* swapColorLength
#
# Sprite Lookup Tables Header Reference
# (starts 160 bytes into header)
seek $filehandle 160 start
set hexsprites [read $filehandle 4]
binary scan $hexsprites I* sprites
set hexspritesOffset [read $filehandle 4]
binary scan $hexspritesOffset I* spritesOffset
set hexspritesLength [read $filehandle 4]
binary scan $hexspritesLength I* spritesLength
#
# Bitmap Descriptors Reference
# (starts 176 bytes into header)
seek $filehandle 176 start
set hexbitmapDescriptors [read $filehandle 4]
binary scan $hexbitmapDescriptors I* bitmapDescriptors
set hexbitmapDescriptorsOffset [read $filehandle 4]
binary scan $hexbitmapDescriptorsOffset I* bitmapDescriptorsOffset
set hexbitmapDescriptorsLength [read $filehandle 4]
binary scan $hexbitmapDescriptorsLength I* bitmapDescriptorsLength
#
# Sequences Table Header Reference
# (starts 192 bytes into header)
seek $filehandle 192
set hexSequencesNumber [read $filehandle 4]
binary scan $hexSequencesNumber I* SequencesNumber
set hexSequencesOffset [read $filehandle 4]
binary scan $hexSequencesOffset I* SequencesOffset
set hexSequencesLength [read $filehandle 4]
binary scan $hexSequencesLength I* SequencesLength
#
# Get Sequence Names
# there is a whole bunch of info in here but this is all I can figure out
# right now.
# Each Sequence Table entry is 128 bytes long
# It looks like the name is the first 64 bytes
#
puts "Sequence Names\t Sequence Number"
set offset [expr $SequencesOffset + 384]
seek $filehandle $offset start
for {set sequencenumber 1} {$sequencenumber <= $SequencesNumber} {incr sequencenumber +1} {
set sequenceName($sequencenumber) [read $filehandle 64]
puts "$sequenceName($sequencenumber)\t\t\t$sequencenumber"
seek $filehandle 64 current
}
close $filehandle
#
# Output data
#
puts "Tag Name: $tagname"
puts "Tag Type: $tagtype"
puts "Tag Id: $tagid"
puts "Length (in bytes): $shortlength"
puts "User Flags: $userflags"
puts "\tTextures: $texturesflag"
puts "\tMonsters: $monstersflag"
puts "\tProjectiles: $projectilesflag"
puts "\tScenery: $sceneryflag"
puts "\tAtmospheric: $atmosphericflag"
puts "\tInterface: $interfaceflag"
puts "Game Version: $gameversion"
puts "Color Table Info:"
puts "\tNumber of palettes: $paletteEntries"
puts "\tPalette offset (from end of header): $paletteOffset"
puts "\tPalette Length: $paletteLength"
puts "Swap Colors Info:"
puts "\tNumber of Swap Color Palettes: $swapColors"
puts "\tSwap Color Offset: $swapColorOffset"
puts "\tSwap Color Table Length: $swapColorLength"
puts "Sprite Lookup Table Info:"
puts "\tNumber of Sprites: $sprites"
puts "\tSprite Table Offset (from end of 384 byte header): $spritesOffset"
puts "\tSprite Table Length: $spritesLength"
puts "Bitmap Descriptors Table Info:"
puts "\tNumber of Descriptors: $bitmapDescriptors"
puts "\tBitmap Descriptor Offset (from end of 384 byte header): $bitmapDescriptorsOffset"
puts "\tBitmap Descriptor Table Length: $bitmapDescriptorsLength"
puts "Sequences Table Info:"
puts "\tNumber of Sequences: $SequencesNumber"
puts "\tSequence Table Offset (from end of 384 byte header): $SequencesOffset"
puts "\tSequence Table Length: $SequencesLength"
-----------------------------------------------------
Yeah, this puts line was the end.