1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-01 08:54:20 -04:00

run goimports to format all Go source files of the project (#88)

Actual command run:
    find . -type f -name '*.go' | xargs -I '{}' goimports -w '{}'
This commit is contained in:
Robin Eklind 2019-11-05 19:46:52 -06:00 committed by Tim Sarbin
parent 4a24fc0b8c
commit ab7d19197e
4 changed files with 477 additions and 479 deletions

View File

@ -8,7 +8,7 @@ import (
) )
type LevelPresetRecord struct { type LevelPresetRecord struct {
Name string Name string
DefinitionId int DefinitionId int
LevelId int LevelId int
Populate bool Populate bool
@ -26,7 +26,7 @@ type LevelPresetRecord struct {
FileCount int FileCount int
Files [6]string Files [6]string
Dt1Mask uint Dt1Mask uint
Beta bool Beta bool
Expansion bool Expansion bool
} }
@ -38,22 +38,22 @@ func createLevelPresetRecord(props []string) LevelPresetRecord {
return i return i
} }
result := LevelPresetRecord{ result := LevelPresetRecord{
Name: props[inc()], Name: props[inc()],
DefinitionId: StringToInt(props[inc()]), DefinitionId: StringToInt(props[inc()]),
LevelId: StringToInt(props[inc()]), LevelId: StringToInt(props[inc()]),
Populate: StringToUint8(props[inc()]) == 1, Populate: StringToUint8(props[inc()]) == 1,
Logicals: StringToUint8(props[inc()]) == 1, Logicals: StringToUint8(props[inc()]) == 1,
Outdoors: StringToUint8(props[inc()]) == 1, Outdoors: StringToUint8(props[inc()]) == 1,
Animate: StringToUint8(props[inc()]) == 1, Animate: StringToUint8(props[inc()]) == 1,
KillEdge: StringToUint8(props[inc()]) == 1, KillEdge: StringToUint8(props[inc()]) == 1,
FillBlanks: StringToUint8(props[inc()]) == 1, FillBlanks: StringToUint8(props[inc()]) == 1,
SizeX: StringToInt(props[inc()]), SizeX: StringToInt(props[inc()]),
SizeY: StringToInt(props[inc()]), SizeY: StringToInt(props[inc()]),
AutoMap: StringToUint8(props[inc()]) == 1, AutoMap: StringToUint8(props[inc()]) == 1,
Scan: StringToUint8(props[inc()]) == 1, Scan: StringToUint8(props[inc()]) == 1,
Pops: StringToInt(props[inc()]), Pops: StringToInt(props[inc()]),
PopPad: StringToInt(props[inc()]), PopPad: StringToInt(props[inc()]),
FileCount: StringToInt(props[inc()]), FileCount: StringToInt(props[inc()]),
Files: [6]string{ Files: [6]string{
props[inc()], props[inc()],
props[inc()], props[inc()],
@ -62,8 +62,8 @@ func createLevelPresetRecord(props []string) LevelPresetRecord {
props[inc()], props[inc()],
props[inc()], props[inc()],
}, },
Dt1Mask: StringToUint(props[inc()]), Dt1Mask: StringToUint(props[inc()]),
Beta: StringToUint8(props[inc()]) == 1, Beta: StringToUint8(props[inc()]) == 1,
Expansion: StringToUint8(props[inc()]) == 1, Expansion: StringToUint8(props[inc()]) == 1,
} }
return result return result
@ -79,11 +79,11 @@ func LoadLevelPresets(fileProvider FileProvider) {
continue continue
} }
props := strings.Split(line, "\t") props := strings.Split(line, "\t")
if(props[1] == "") { if props[1] == "" {
continue // any line without a definition id is skipped (e.g. the "Expansion" line) continue // any line without a definition id is skipped (e.g. the "Expansion" line)
} }
rec := createLevelPresetRecord(props) rec := createLevelPresetRecord(props)
LevelPresets[rec.DefinitionId] = &rec LevelPresets[rec.DefinitionId] = &rec
} }
log.Printf("Loaded %d level presets", len(LevelPresets)) log.Printf("Loaded %d level presets", len(LevelPresets))
} }

View File

@ -34,16 +34,16 @@ type MissileAnimation struct {
AnimationRate int // seems to do nothing AnimationRate int // seems to do nothing
AnimationLength int AnimationLength int
AnimationSpeed int AnimationSpeed int
StartingFrame int // called "RandFrame" StartingFrame int // called "RandFrame"
HasSubLoop bool // runs after first animation ends HasSubLoop bool // runs after first animation ends
SubStartingFrame int SubStartingFrame int
SubEndingFrame int SubEndingFrame int
} }
type MissileCollision struct { type MissileCollision struct {
CollisionType int // controls the kind of collision CollisionType int // controls the kind of collision
// 0 = none, 1 = units only, 3 = normal (units, walls), // 0 = none, 1 = units only, 3 = normal (units, walls),
// 6 = walls only, 8 = walls, units, and floors // 6 = walls only, 8 = walls, units, and floors
DestroyedUponCollision bool DestroyedUponCollision bool
FriendlyFire bool FriendlyFire bool
LastCollide bool // unknown LastCollide bool // unknown
@ -51,141 +51,141 @@ type MissileCollision struct {
ClientCollision bool // unknown ClientCollision bool // unknown
ClientSend bool // unclear ClientSend bool // unclear
UseCollisionTimer bool // after hit, use timer before dying UseCollisionTimer bool // after hit, use timer before dying
TimerFrames int // how many frames to persist TimerFrames int // how many frames to persist
} }
type MissileDamage struct { type MissileDamage struct {
MinDamage int MinDamage int
MaxDamage int MaxDamage int
MinLevelDamage [5]int // additional damage per missile level MinLevelDamage [5]int // additional damage per missile level
// [0]: lvs 2-8, [1]: lvs 9-16, [2]: lvs 17-22, [3]: lvs 23-28, [4]: lv 29+ // [0]: lvs 2-8, [1]: lvs 9-16, [2]: lvs 17-22, [3]: lvs 23-28, [4]: lv 29+
MaxLevelDamage [5]int // see above MaxLevelDamage [5]int // see above
DamageSynergyPerCalc string // works like synergy in skills.txt, not clear DamageSynergyPerCalc string // works like synergy in skills.txt, not clear
} }
type MissileElementalDamage struct { type MissileElementalDamage struct {
Damage MissileDamage Damage MissileDamage
ElementType string ElementType string
Duration int // frames, 25 = 1 second Duration int // frames, 25 = 1 second
LevelDuration [3]int // 0,1,2, unknown level intervals, bonus duration per level LevelDuration [3]int // 0,1,2, unknown level intervals, bonus duration per level
} }
type MissileRecord struct { type MissileRecord struct {
Name string Name string
Id int Id int
ClientMovementFunc int ClientMovementFunc int
ClientCollisionFunc int ClientCollisionFunc int
ServerMovementFunc int ServerMovementFunc int
ServerCollisionFunc int ServerCollisionFunc int
ServerDamageFunc int ServerDamageFunc int
ServerMovementCalc MissileCalc ServerMovementCalc MissileCalc
ClientMovementCalc MissileCalc ClientMovementCalc MissileCalc
ServerCollisionCalc MissileCalc ServerCollisionCalc MissileCalc
ClientCollisionCalc MissileCalc ClientCollisionCalc MissileCalc
ServerDamageCalc MissileCalc ServerDamageCalc MissileCalc
Velocity int Velocity int
MaxVelocity int MaxVelocity int
LevelVelocityBonus int LevelVelocityBonus int
Accel int Accel int
Range int Range int
LevelRangeBonus int LevelRangeBonus int
Light MissileLight Light MissileLight
Animation MissileAnimation Animation MissileAnimation
Collision MissileCollision Collision MissileCollision
XOffset int XOffset int
YOffset int YOffset int
ZOffset int ZOffset int
Size int // diameter Size int // diameter
DestroyedByTP bool // if true, destroyed when source player teleports to town DestroyedByTP bool // if true, destroyed when source player teleports to town
DestroyedByTPFrame int // see above, for client side, (this is a guess) which frame it vanishes on DestroyedByTPFrame int // see above, for client side, (this is a guess) which frame it vanishes on
CanDestroy bool // unknown CanDestroy bool // unknown
UseAttackRating bool // if true, uses 'attack rating' to determine if it hits or misses UseAttackRating bool // if true, uses 'attack rating' to determine if it hits or misses
// if false, has a 95% chance to hit. // if false, has a 95% chance to hit.
AlwaysExplode bool // if true, always calls its collision function when it is destroyed, even if it doesn't hit anything AlwaysExplode bool // if true, always calls its collision function when it is destroyed, even if it doesn't hit anything
// note that some collision functions (lightning fury) seem to ignore this and always explode regardless of setting (requires investigation) // note that some collision functions (lightning fury) seem to ignore this and always explode regardless of setting (requires investigation)
ClientExplosion bool // if true, does not really exist ClientExplosion bool // if true, does not really exist
// is only aesthetic / client side // is only aesthetic / client side
TownSafe bool // if true, doesn't vanish when spawned in town TownSafe bool // if true, doesn't vanish when spawned in town
// if false, vanishes when spawned in town // if false, vanishes when spawned in town
IgnoreBossModifiers bool // if true, doesn't get bonuses from boss mods IgnoreBossModifiers bool // if true, doesn't get bonuses from boss mods
IgnoreMultishot bool // if true, can't gain the mulitshot modifier IgnoreMultishot bool // if true, can't gain the mulitshot modifier
HolyFilterType int // specifies what this missile can hit HolyFilterType int // specifies what this missile can hit
// 0 = all units, 1 = undead only, 2 = demons only, 3 = all units (again?) // 0 = all units, 1 = undead only, 2 = demons only, 3 = all units (again?)
CanBeSlowed bool // if true, is affected by skill_handofathena CanBeSlowed bool // if true, is affected by skill_handofathena
TriggersHitEvents bool // if true, triggers events that happen "upon getting hit" on targets TriggersHitEvents bool // if true, triggers events that happen "upon getting hit" on targets
TriggersGetHit bool // if true, can cause target to enter hit recovery mode TriggersGetHit bool // if true, can cause target to enter hit recovery mode
SoftHit bool // unknown SoftHit bool // unknown
KnockbackPercent int // chance of knocking the target back, 0-100 KnockbackPercent int // chance of knocking the target back, 0-100
TransparencyMode int // controls rendering TransparencyMode int // controls rendering
// 0 = normal, 1 = alpha blending (darker = more transparent) // 0 = normal, 1 = alpha blending (darker = more transparent)
// 2 = special (black and white?) // 2 = special (black and white?)
UseQuantity bool // if true, uses quantity UseQuantity bool // if true, uses quantity
// not clear what this means. Also apparently requires a special starting function in skills.txt // not clear what this means. Also apparently requires a special starting function in skills.txt
AffectedByPierce bool // if true, affected by the pierce modifier and the Pierce skill AffectedByPierce bool // if true, affected by the pierce modifier and the Pierce skill
SpecialSetup bool // unknown, only true for potions SpecialSetup bool // unknown, only true for potions
MissileSkill bool // if true, applies elemental damage from items to the splash radius instead of normal damage modifiers MissileSkill bool // if true, applies elemental damage from items to the splash radius instead of normal damage modifiers
SkillName string // if not empty, the missile will refer to this skill instead of its own data for the following: SkillName string // if not empty, the missile will refer to this skill instead of its own data for the following:
// "ResultFlags, HitFlags, HitShift, HitClass, SrcDamage (SrcDam in skills.txt!), // "ResultFlags, HitFlags, HitShift, HitClass, SrcDamage (SrcDam in skills.txt!),
// MinDam, MinLevDam1-5, MaxDam, MaxLevDam1-5, DmgSymPerCalc, EType, EMin, EMinLev1-5, // MinDam, MinLevDam1-5, MaxDam, MaxLevDam1-5, DmgSymPerCalc, EType, EMin, EMinLev1-5,
// EMax, EMaxLev1-5, EDmgSymPerCalc, ELen, ELenLev1-3, ELenSymPerCalc" // EMax, EMaxLev1-5, EDmgSymPerCalc, ELen, ELenLev1-3, ELenSymPerCalc"
ResultFlags int // unknown ResultFlags int // unknown
// 4 = normal missiles, 5 = explosions, 8 = non-damaging missiles // 4 = normal missiles, 5 = explosions, 8 = non-damaging missiles
HitFlags int // unknown HitFlags int // unknown
// 2 = explosions, 5 = freezing arrow // 2 = explosions, 5 = freezing arrow
HitShift int // damage is measured in 256s HitShift int // damage is measured in 256s
// the actual damage is [damage] * 2 ^ [hitshift] // the actual damage is [damage] * 2 ^ [hitshift]
// e.g. 100 damage, 8 hitshift = 100 * 2 ^ 8 = 100 * 256 = 25600 // e.g. 100 damage, 8 hitshift = 100 * 2 ^ 8 = 100 * 256 = 25600
// (visually, the damage is this result / 256) // (visually, the damage is this result / 256)
ApplyMastery bool // unknown ApplyMastery bool // unknown
SourceDamage int // 0-128, 128 is 100% SourceDamage int // 0-128, 128 is 100%
// percentage of source units attack properties to apply to the missile? // percentage of source units attack properties to apply to the missile?
// not only affects damage but also other modifiers like lifesteal and manasteal (need a complete list) // not only affects damage but also other modifiers like lifesteal and manasteal (need a complete list)
// setting this to -1 "gets rid of SrcDmg from skills.txt", not clear what that means // setting this to -1 "gets rid of SrcDmg from skills.txt", not clear what that means
HalfDamageForTwoHander bool // if true, damage is halved when a two-handed weapon is used HalfDamageForTwoHander bool // if true, damage is halved when a two-handed weapon is used
SourceMissDamage int // 0-128, 128 is 100% SourceMissDamage int // 0-128, 128 is 100%
// unknown, only used for poison clouds. // unknown, only used for poison clouds.
Damage MissileDamage Damage MissileDamage
ElementalDamage MissileElementalDamage ElementalDamage MissileElementalDamage
HitClass int // controls clientside aesthetic effects for collisions HitClass int // controls clientside aesthetic effects for collisions
// particularly sound effects that are played on a hit // particularly sound effects that are played on a hit
NumDirections int // count of dirs in the DCC loaded by CelFile NumDirections int // count of dirs in the DCC loaded by CelFile
// apparently this value is no longer needed in D2 // apparently this value is no longer needed in D2
LocalBlood int // blood effects? LocalBlood int // blood effects?
// 0 = no blood, 1 = blood, 2 = blood and affected by open wounds // 0 = no blood, 1 = blood, 2 = blood and affected by open wounds
DamageReductionRate int // how many frames between applications of the DamageReductionRate int // how many frames between applications of the
// magic_damage_reduced stat, so for instance on a 0 this stat applies every frame // magic_damage_reduced stat, so for instance on a 0 this stat applies every frame
// on a 3, only every 4th frame has damage reduced // on a 3, only every 4th frame has damage reduced
TravelSound string // name of sound to play during lifetime TravelSound string // name of sound to play during lifetime
// whether or not it loops depends on the specific sound's settings? // whether or not it loops depends on the specific sound's settings?
// if it doesn't loop, it's just a on-spawn sound effect // if it doesn't loop, it's just a on-spawn sound effect
HitSound string // sound plays upon collision HitSound string // sound plays upon collision
ProgSound string // plays at "special events", like a mariachi band ProgSound string // plays at "special events", like a mariachi band
ProgOverlay string // name of an overlay from overlays.txt to use at special events ProgOverlay string // name of an overlay from overlays.txt to use at special events
ExplosionMissile string // name of a missile from missiles.txt that is created upon collision ExplosionMissile string // name of a missile from missiles.txt that is created upon collision
// or anytime it is destroyed if AlwaysExplode is true // or anytime it is destroyed if AlwaysExplode is true
SubMissile [3]string // 0,1,2 name of missiles spawned by movement function SubMissile [3]string // 0,1,2 name of missiles spawned by movement function
HitSubMissile [4]string // 0,1,2 name of missiles spawned by collision function HitSubMissile [4]string // 0,1,2 name of missiles spawned by collision function
ClientSubMissile [3]string // see above, but for client only ClientSubMissile [3]string // see above, but for client only
ClientHitSubMissile [4]string // see above, but for client only ClientHitSubMissile [4]string // see above, but for client only
} }
func createMissileRecord(line string) MissileRecord { func createMissileRecord(line string) MissileRecord {
@ -199,26 +199,26 @@ func createMissileRecord(line string) MissileRecord {
// be wrapped in an EmptyToZero transform // be wrapped in an EmptyToZero transform
result := MissileRecord{ result := MissileRecord{
Name: r[inc()], Name: r[inc()],
Id: StringToInt(EmptyToZero(r[inc()])), Id: StringToInt(EmptyToZero(r[inc()])),
ClientMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ClientMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ClientCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ClientCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ServerMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ServerMovementFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ServerCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ServerCollisionFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ServerDamageFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ServerDamageFunc: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ServerMovementCalc: loadMissileCalc(&r, inc, 5), ServerMovementCalc: loadMissileCalc(&r, inc, 5),
ClientMovementCalc: loadMissileCalc(&r, inc, 5), ClientMovementCalc: loadMissileCalc(&r, inc, 5),
ServerCollisionCalc: loadMissileCalc(&r, inc, 3), ServerCollisionCalc: loadMissileCalc(&r, inc, 3),
ClientCollisionCalc: loadMissileCalc(&r, inc, 3), ClientCollisionCalc: loadMissileCalc(&r, inc, 3),
ServerDamageCalc: loadMissileCalc(&r, inc, 2), ServerDamageCalc: loadMissileCalc(&r, inc, 2),
Velocity: StringToInt(EmptyToZero(r[inc()])), Velocity: StringToInt(EmptyToZero(r[inc()])),
MaxVelocity: StringToInt(EmptyToZero(r[inc()])), MaxVelocity: StringToInt(EmptyToZero(r[inc()])),
LevelVelocityBonus: StringToInt(EmptyToZero(r[inc()])), LevelVelocityBonus: StringToInt(EmptyToZero(r[inc()])),
Accel: StringToInt(EmptyToZero(r[inc()])), Accel: StringToInt(EmptyToZero(r[inc()])),
Range: StringToInt(EmptyToZero(r[inc()])), Range: StringToInt(EmptyToZero(r[inc()])),
LevelRangeBonus: StringToInt(EmptyToZero(r[inc()])), LevelRangeBonus: StringToInt(EmptyToZero(r[inc()])),
Light: loadMissileLight(&r, inc), Light: loadMissileLight(&r, inc),
@ -229,61 +229,61 @@ func createMissileRecord(line string) MissileRecord {
XOffset: StringToInt(EmptyToZero(r[inc()])), XOffset: StringToInt(EmptyToZero(r[inc()])),
YOffset: StringToInt(EmptyToZero(r[inc()])), YOffset: StringToInt(EmptyToZero(r[inc()])),
ZOffset: StringToInt(EmptyToZero(r[inc()])), ZOffset: StringToInt(EmptyToZero(r[inc()])),
Size: StringToInt(EmptyToZero(r[inc()])), Size: StringToInt(EmptyToZero(r[inc()])),
DestroyedByTP: StringToInt(EmptyToZero(r[inc()])) == 1, DestroyedByTP: StringToInt(EmptyToZero(r[inc()])) == 1,
DestroyedByTPFrame: StringToInt(EmptyToZero(r[inc()])), DestroyedByTPFrame: StringToInt(EmptyToZero(r[inc()])),
CanDestroy: StringToInt(EmptyToZero(r[inc()])) == 1, CanDestroy: StringToInt(EmptyToZero(r[inc()])) == 1,
UseAttackRating: StringToInt(EmptyToZero(r[inc()])) == 1, UseAttackRating: StringToInt(EmptyToZero(r[inc()])) == 1,
AlwaysExplode: StringToInt(EmptyToZero(r[inc()])) == 1, AlwaysExplode: StringToInt(EmptyToZero(r[inc()])) == 1,
ClientExplosion: StringToInt(EmptyToZero(r[inc()])) == 1, ClientExplosion: StringToInt(EmptyToZero(r[inc()])) == 1,
TownSafe: StringToInt(EmptyToZero(r[inc()])) == 1, TownSafe: StringToInt(EmptyToZero(r[inc()])) == 1,
IgnoreBossModifiers: StringToInt(EmptyToZero(r[inc()])) == 1, IgnoreBossModifiers: StringToInt(EmptyToZero(r[inc()])) == 1,
IgnoreMultishot: StringToInt(EmptyToZero(r[inc()])) == 1, IgnoreMultishot: StringToInt(EmptyToZero(r[inc()])) == 1,
HolyFilterType: StringToInt(EmptyToZero(r[inc()])), HolyFilterType: StringToInt(EmptyToZero(r[inc()])),
CanBeSlowed: StringToInt(EmptyToZero(r[inc()])) == 1, CanBeSlowed: StringToInt(EmptyToZero(r[inc()])) == 1,
TriggersHitEvents: StringToInt(EmptyToZero(r[inc()])) == 1, TriggersHitEvents: StringToInt(EmptyToZero(r[inc()])) == 1,
TriggersGetHit: StringToInt(EmptyToZero(r[inc()])) == 1, TriggersGetHit: StringToInt(EmptyToZero(r[inc()])) == 1,
SoftHit: StringToInt(EmptyToZero(r[inc()])) == 1, SoftHit: StringToInt(EmptyToZero(r[inc()])) == 1,
KnockbackPercent: StringToInt(EmptyToZero(r[inc()])), KnockbackPercent: StringToInt(EmptyToZero(r[inc()])),
TransparencyMode: StringToInt(EmptyToZero(r[inc()])), TransparencyMode: StringToInt(EmptyToZero(r[inc()])),
UseQuantity: StringToInt(EmptyToZero(r[inc()])) == 1, UseQuantity: StringToInt(EmptyToZero(r[inc()])) == 1,
AffectedByPierce: StringToInt(EmptyToZero(r[inc()])) == 1, AffectedByPierce: StringToInt(EmptyToZero(r[inc()])) == 1,
SpecialSetup: StringToInt(EmptyToZero(r[inc()])) == 1, SpecialSetup: StringToInt(EmptyToZero(r[inc()])) == 1,
MissileSkill: StringToInt(EmptyToZero(r[inc()])) == 1, MissileSkill: StringToInt(EmptyToZero(r[inc()])) == 1,
SkillName: r[inc()], SkillName: r[inc()],
ResultFlags: StringToInt(EmptyToZero(r[inc()])), ResultFlags: StringToInt(EmptyToZero(r[inc()])),
HitFlags: StringToInt(EmptyToZero(r[inc()])), HitFlags: StringToInt(EmptyToZero(r[inc()])),
HitShift: StringToInt(EmptyToZero(r[inc()])), HitShift: StringToInt(EmptyToZero(r[inc()])),
ApplyMastery: StringToInt(EmptyToZero(r[inc()])) == 1, ApplyMastery: StringToInt(EmptyToZero(r[inc()])) == 1,
SourceDamage: StringToInt(EmptyToZero(r[inc()])), SourceDamage: StringToInt(EmptyToZero(r[inc()])),
HalfDamageForTwoHander: StringToInt(EmptyToZero(r[inc()])) == 1, HalfDamageForTwoHander: StringToInt(EmptyToZero(r[inc()])) == 1,
SourceMissDamage: StringToInt(EmptyToZero(r[inc()])), SourceMissDamage: StringToInt(EmptyToZero(r[inc()])),
Damage: loadMissileDamage(&r, inc), Damage: loadMissileDamage(&r, inc),
ElementalDamage: loadMissileElementalDamage(&r, inc), ElementalDamage: loadMissileElementalDamage(&r, inc),
HitClass: StringToInt(EmptyToZero(r[inc()])), HitClass: StringToInt(EmptyToZero(r[inc()])),
NumDirections: StringToInt(EmptyToZero(r[inc()])), NumDirections: StringToInt(EmptyToZero(r[inc()])),
LocalBlood: StringToInt(EmptyToZero(r[inc()])), LocalBlood: StringToInt(EmptyToZero(r[inc()])),
DamageReductionRate: StringToInt(EmptyToZero(r[inc()])), DamageReductionRate: StringToInt(EmptyToZero(r[inc()])),
TravelSound: r[inc()], TravelSound: r[inc()],
HitSound: r[inc()], HitSound: r[inc()],
ProgSound: r[inc()], ProgSound: r[inc()],
ProgOverlay: r[inc()], ProgOverlay: r[inc()],
ExplosionMissile: r[inc()], ExplosionMissile: r[inc()],
SubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, SubMissile: [3]string{r[inc()], r[inc()], r[inc()]},
HitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]}, HitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]},
ClientSubMissile: [3]string{r[inc()], r[inc()], r[inc()]}, ClientSubMissile: [3]string{r[inc()], r[inc()], r[inc()]},
ClientHitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]}, ClientHitSubMissile: [4]string{r[inc()], r[inc()], r[inc()], r[inc()]},
} }
return result return result
@ -307,7 +307,7 @@ func LoadMissiles(fileProvider FileProvider) {
func loadMissileCalcParam(r *[]string, inc func() int) MissileCalcParam { func loadMissileCalcParam(r *[]string, inc func() int) MissileCalcParam {
result := MissileCalcParam{ result := MissileCalcParam{
Param: StringToInt(EmptyToZero((*r)[inc()])), Param: StringToInt(EmptyToZero((*r)[inc()])),
Desc: (*r)[inc()], Desc: (*r)[inc()],
} }
return result return result
} }
@ -319,7 +319,7 @@ func loadMissileCalc(r *[]string, inc func() int, params int) MissileCalc {
} }
result.Params = make([]MissileCalcParam, params) result.Params = make([]MissileCalcParam, params)
for p := 0; p < params; p++ { for p := 0; p < params; p++ {
result.Params[p] = loadMissileCalcParam(r, inc); result.Params[p] = loadMissileCalcParam(r, inc)
} }
return result return result
} }
@ -327,10 +327,10 @@ func loadMissileCalc(r *[]string, inc func() int, params int) MissileCalc {
func loadMissileLight(r *[]string, inc func() int) MissileLight { func loadMissileLight(r *[]string, inc func() int) MissileLight {
result := MissileLight{ result := MissileLight{
Diameter: StringToInt(EmptyToZero((*r)[inc()])), Diameter: StringToInt(EmptyToZero((*r)[inc()])),
Flicker: StringToInt(EmptyToZero((*r)[inc()])), Flicker: StringToInt(EmptyToZero((*r)[inc()])),
Red: StringToUint8(EmptyToZero((*r)[inc()])), Red: StringToUint8(EmptyToZero((*r)[inc()])),
Green: StringToUint8(EmptyToZero((*r)[inc()])), Green: StringToUint8(EmptyToZero((*r)[inc()])),
Blue: StringToUint8(EmptyToZero((*r)[inc()])), Blue: StringToUint8(EmptyToZero((*r)[inc()])),
} }
return result return result
} }
@ -338,54 +338,54 @@ func loadMissileLight(r *[]string, inc func() int) MissileLight {
func loadMissileAnimation(r *[]string, inc func() int) MissileAnimation { func loadMissileAnimation(r *[]string, inc func() int) MissileAnimation {
result := MissileAnimation{ result := MissileAnimation{
StepsBeforeVisible: StringToInt(EmptyToZero((*r)[inc()])), StepsBeforeVisible: StringToInt(EmptyToZero((*r)[inc()])),
StepsBeforeActive: StringToInt(EmptyToZero((*r)[inc()])), StepsBeforeActive: StringToInt(EmptyToZero((*r)[inc()])),
LoopAnimation: StringToInt(EmptyToZero((*r)[inc()])) == 1, LoopAnimation: StringToInt(EmptyToZero((*r)[inc()])) == 1,
CelFileName: (*r)[inc()], CelFileName: (*r)[inc()],
AnimationRate: StringToInt(EmptyToZero((*r)[inc()])), AnimationRate: StringToInt(EmptyToZero((*r)[inc()])),
AnimationLength: StringToInt(EmptyToZero((*r)[inc()])), AnimationLength: StringToInt(EmptyToZero((*r)[inc()])),
AnimationSpeed: StringToInt(EmptyToZero((*r)[inc()])), AnimationSpeed: StringToInt(EmptyToZero((*r)[inc()])),
StartingFrame: StringToInt(EmptyToZero((*r)[inc()])), StartingFrame: StringToInt(EmptyToZero((*r)[inc()])),
HasSubLoop: StringToInt(EmptyToZero((*r)[inc()])) == 1, HasSubLoop: StringToInt(EmptyToZero((*r)[inc()])) == 1,
SubStartingFrame: StringToInt(EmptyToZero((*r)[inc()])), SubStartingFrame: StringToInt(EmptyToZero((*r)[inc()])),
SubEndingFrame: StringToInt(EmptyToZero((*r)[inc()])), SubEndingFrame: StringToInt(EmptyToZero((*r)[inc()])),
} }
return result return result
} }
func loadMissileCollision(r *[]string, inc func() int) MissileCollision { func loadMissileCollision(r *[]string, inc func() int) MissileCollision {
result := MissileCollision{ result := MissileCollision{
CollisionType: StringToInt(EmptyToZero((*r)[inc()])), CollisionType: StringToInt(EmptyToZero((*r)[inc()])),
DestroyedUponCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1, DestroyedUponCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1,
FriendlyFire: StringToInt(EmptyToZero((*r)[inc()])) == 1, FriendlyFire: StringToInt(EmptyToZero((*r)[inc()])) == 1,
LastCollide: StringToInt(EmptyToZero((*r)[inc()])) == 1, LastCollide: StringToInt(EmptyToZero((*r)[inc()])) == 1,
Collision: StringToInt(EmptyToZero((*r)[inc()])) == 1, Collision: StringToInt(EmptyToZero((*r)[inc()])) == 1,
ClientCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1, ClientCollision: StringToInt(EmptyToZero((*r)[inc()])) == 1,
ClientSend: StringToInt(EmptyToZero((*r)[inc()])) == 1, ClientSend: StringToInt(EmptyToZero((*r)[inc()])) == 1,
UseCollisionTimer: StringToInt(EmptyToZero((*r)[inc()])) == 1, UseCollisionTimer: StringToInt(EmptyToZero((*r)[inc()])) == 1,
TimerFrames: StringToInt(EmptyToZero((*r)[inc()])), TimerFrames: StringToInt(EmptyToZero((*r)[inc()])),
} }
return result return result
} }
func loadMissileDamage(r *[]string, inc func() int) MissileDamage { func loadMissileDamage(r *[]string, inc func() int) MissileDamage {
result := MissileDamage{ result := MissileDamage{
MinDamage: StringToInt(EmptyToZero((*r)[inc()])), MinDamage: StringToInt(EmptyToZero((*r)[inc()])),
MinLevelDamage: [5]int{ MinLevelDamage: [5]int{
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
}, },
MaxDamage: StringToInt(EmptyToZero((*r)[inc()])), MaxDamage: StringToInt(EmptyToZero((*r)[inc()])),
MaxLevelDamage: [5]int{ MaxLevelDamage: [5]int{
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
}, },
DamageSynergyPerCalc: (*r)[inc()], DamageSynergyPerCalc: (*r)[inc()],
} }
return result return result
} }
@ -393,13 +393,13 @@ func loadMissileDamage(r *[]string, inc func() int) MissileDamage {
func loadMissileElementalDamage(r *[]string, inc func() int) MissileElementalDamage { func loadMissileElementalDamage(r *[]string, inc func() int) MissileElementalDamage {
result := MissileElementalDamage{ result := MissileElementalDamage{
ElementType: (*r)[inc()], ElementType: (*r)[inc()],
Damage: loadMissileDamage(r, inc), Damage: loadMissileDamage(r, inc),
Duration: StringToInt(EmptyToZero((*r)[inc()])), Duration: StringToInt(EmptyToZero((*r)[inc()])),
LevelDuration: [3]int{ LevelDuration: [3]int{
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
StringToInt(EmptyToZero((*r)[inc()])), StringToInt(EmptyToZero((*r)[inc()])),
}, },
} }
return result return result
} }

View File

@ -9,14 +9,14 @@ import (
// An ObjectRecord represents the settings for one type of object from objects.txt // An ObjectRecord represents the settings for one type of object from objects.txt
type ObjectRecord struct { type ObjectRecord struct {
Name string Name string
Description string Description string
Id int Id int
Token string // refers to what graphics this object uses Token string // refers to what graphics this object uses
SpawnMax int // unused? SpawnMax int // unused?
Selectable [8]bool // is this mode selectable Selectable [8]bool // is this mode selectable
TrapProbability int // unused TrapProbability int // unused
SizeX int SizeX int
SizeY int SizeY int
@ -26,32 +26,32 @@ type ObjectRecord struct {
NTgtBX int // unknown NTgtBX int // unknown
NTgtBY int // unknown NTgtBY int // unknown
FrameCount [8]int // how many frames does this mode have, 0 = skip FrameCount [8]int // how many frames does this mode have, 0 = skip
FrameDelta [8]int // what rate is the animation played at (256 = 100% speed) FrameDelta [8]int // what rate is the animation played at (256 = 100% speed)
CycleAnimation [8]bool // probably whether animation loops CycleAnimation [8]bool // probably whether animation loops
LightDiameter [8]int LightDiameter [8]int
BlocksLight [8]bool BlocksLight [8]bool
HasCollision [8]bool HasCollision [8]bool
IsAttackable bool // do we kick it when interacting IsAttackable bool // do we kick it when interacting
StartFrame [8]int StartFrame [8]int
EnvEffect bool // unknown EnvEffect bool // unknown
IsDoor bool IsDoor bool
BlockVisibility bool // only works with IsDoor BlockVisibility bool // only works with IsDoor
Orientation int // unknown (1=sw, 2=nw, 3=se, 4=ne) Orientation int // unknown (1=sw, 2=nw, 3=se, 4=ne)
Trans int // controls palette mapping Trans int // controls palette mapping
OrderFlag [8]int // 0 = object, 1 = floor, 2 = wall OrderFlag [8]int // 0 = object, 1 = floor, 2 = wall
PreOperate bool // unknown PreOperate bool // unknown
HasAnimationMode [8]bool // 'Mode' in source, true if this mode is used HasAnimationMode [8]bool // 'Mode' in source, true if this mode is used
XOffset int // in pixels offset XOffset int // in pixels offset
YOffset int YOffset int
Draw bool // if false, object isn't drawn (shadow is still drawn and player can still select though) Draw bool // if false, object isn't drawn (shadow is still drawn and player can still select though)
LightRed byte // if lightdiameter is set, rgb of the light LightRed byte // if lightdiameter is set, rgb of the light
LightGreen byte LightGreen byte
LightBlue byte LightBlue byte
SelHD bool // whether these DCC components are selectable SelHD bool // whether these DCC components are selectable
SelTR bool SelTR bool
@ -61,10 +61,10 @@ type ObjectRecord struct {
SelRH bool SelRH bool
SelLH bool SelLH bool
SelSH bool SelSH bool
SelS [8]bool SelS [8]bool
TotalPieces int // selectable DCC components count TotalPieces int // selectable DCC components count
SubClass int // subclass of object: SubClass int // subclass of object:
// 1 = shrine // 1 = shrine
// 2 = obelisk // 2 = obelisk
// 4 = portal // 4 = portal
@ -79,25 +79,25 @@ type ObjectRecord struct {
NameOffset int // pixels to offset the name from the animation pivot NameOffset int // pixels to offset the name from the animation pivot
MonsterOk bool // unknown MonsterOk bool // unknown
OperateRange int // distance object can be used from, might be unused OperateRange int // distance object can be used from, might be unused
ShrineFunction int // unused ShrineFunction int // unused
Restore bool // if true, object is stored in memory and will be retained if you leave and re-enter the area Restore bool // if true, object is stored in memory and will be retained if you leave and re-enter the area
Parm [8]int // unknown Parm [8]int // unknown
Act int // what acts this object can appear in (15 = all three) Act int // what acts this object can appear in (15 = all three)
Lockable bool Lockable bool
Gore bool // unknown, something with corpses Gore bool // unknown, something with corpses
Sync bool // unknown Sync bool // unknown
Flicker bool // light flickers if true Flicker bool // light flickers if true
Damage int // amount of damage done by this (used depending on operatefn) Damage int // amount of damage done by this (used depending on operatefn)
Beta bool // if true, appeared in the beta? Beta bool // if true, appeared in the beta?
Overlay bool // unknown Overlay bool // unknown
CollisionSubst bool // unknown, controls some kind of special collision checking? CollisionSubst bool // unknown, controls some kind of special collision checking?
Left int // unknown, clickable bounding box? Left int // unknown, clickable bounding box?
Top int Top int
Width int Width int
Height int Height int
OperateFn int // what function is called when the player clicks on the object OperateFn int // what function is called when the player clicks on the object
@ -111,9 +111,9 @@ type ObjectRecord struct {
// (see above todo) // (see above todo)
RestoreVirgins bool // if true, only restores unused objects (see Restore) RestoreVirgins bool // if true, only restores unused objects (see Restore)
BlockMissile bool // if true, missiles collide with this BlockMissile bool // if true, missiles collide with this
DrawUnder bool // if true, drawn as a floor tile is DrawUnder bool // if true, drawn as a floor tile is
OpenWarp bool // needs clarification, controls whether highlighting shows OpenWarp bool // needs clarification, controls whether highlighting shows
// 'To ...' or 'trap door' when highlighting, not sure which is T/F // 'To ...' or 'trap door' when highlighting, not sure which is T/F
AutoMap int // controls how this object appears on the map AutoMap int // controls how this object appears on the map
// 0 = it doesn't, rest of modes need to be analyzed // 0 = it doesn't, rest of modes need to be analyzed
@ -127,12 +127,12 @@ func createObjectRecord(props []string) ObjectRecord {
return i return i
} }
result := ObjectRecord{ result := ObjectRecord{
Name: props[inc()], Name: props[inc()],
Description: props[inc()], Description: props[inc()],
Id: StringToInt(props[inc()]), Id: StringToInt(props[inc()]),
Token: props[inc()], Token: props[inc()],
SpawnMax: StringToInt(props[inc()]), SpawnMax: StringToInt(props[inc()]),
Selectable: [8]bool{ Selectable: [8]bool{
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
@ -143,16 +143,16 @@ func createObjectRecord(props []string) ObjectRecord {
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
}, },
TrapProbability: StringToInt(props[inc()]), TrapProbability: StringToInt(props[inc()]),
SizeX: StringToInt(props[inc()]), SizeX: StringToInt(props[inc()]),
SizeY: StringToInt(props[inc()]), SizeY: StringToInt(props[inc()]),
NTgtFX: StringToInt(props[inc()]), NTgtFX: StringToInt(props[inc()]),
NTgtFY: StringToInt(props[inc()]), NTgtFY: StringToInt(props[inc()]),
NTgtBX: StringToInt(props[inc()]), NTgtBX: StringToInt(props[inc()]),
NTgtBY: StringToInt(props[inc()]), NTgtBY: StringToInt(props[inc()]),
FrameCount: [8]int{ FrameCount: [8]int{
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
@ -213,7 +213,7 @@ func createObjectRecord(props []string) ObjectRecord {
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
}, },
IsAttackable: StringToUint8(props[inc()]) == 1, IsAttackable: StringToUint8(props[inc()]) == 1,
StartFrame: [8]int{ StartFrame: [8]int{
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
@ -224,13 +224,13 @@ func createObjectRecord(props []string) ObjectRecord {
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
}, },
EnvEffect: StringToUint8(props[inc()]) == 1, EnvEffect: StringToUint8(props[inc()]) == 1,
IsDoor: StringToUint8(props[inc()]) == 1, IsDoor: StringToUint8(props[inc()]) == 1,
BlockVisibility: StringToUint8(props[inc()]) == 1, BlockVisibility: StringToUint8(props[inc()]) == 1,
Orientation: StringToInt(props[inc()]), Orientation: StringToInt(props[inc()]),
Trans: StringToInt(props[inc()]), Trans: StringToInt(props[inc()]),
OrderFlag: [8]int{ OrderFlag: [8]int{
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
@ -241,7 +241,7 @@ func createObjectRecord(props []string) ObjectRecord {
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
}, },
PreOperate: StringToUint8(props[inc()]) == 1, PreOperate: StringToUint8(props[inc()]) == 1,
HasAnimationMode: [8]bool{ HasAnimationMode: [8]bool{
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
@ -252,16 +252,16 @@ func createObjectRecord(props []string) ObjectRecord {
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
}, },
XOffset: StringToInt(props[inc()]), XOffset: StringToInt(props[inc()]),
YOffset: StringToInt(props[inc()]), YOffset: StringToInt(props[inc()]),
Draw: StringToUint8(props[inc()]) == 1, Draw: StringToUint8(props[inc()]) == 1,
LightRed: StringToUint8(props[inc()]), LightRed: StringToUint8(props[inc()]),
LightGreen: StringToUint8(props[inc()]), LightGreen: StringToUint8(props[inc()]),
LightBlue: StringToUint8(props[inc()]), LightBlue: StringToUint8(props[inc()]),
SelHD: StringToUint8(props[inc()]) == 1, SelHD: StringToUint8(props[inc()]) == 1,
SelTR: StringToUint8(props[inc()]) == 1, SelTR: StringToUint8(props[inc()]) == 1,
SelLG: StringToUint8(props[inc()]) == 1, SelLG: StringToUint8(props[inc()]) == 1,
SelRA: StringToUint8(props[inc()]) == 1, SelRA: StringToUint8(props[inc()]) == 1,
@ -279,20 +279,20 @@ func createObjectRecord(props []string) ObjectRecord {
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
StringToUint8(props[inc()]) == 1, StringToUint8(props[inc()]) == 1,
}, },
TotalPieces: StringToInt(props[inc()]), TotalPieces: StringToInt(props[inc()]),
SubClass: StringToInt(props[inc()]), SubClass: StringToInt(props[inc()]),
XSpace: StringToInt(props[inc()]), XSpace: StringToInt(props[inc()]),
YSpace: StringToInt(props[inc()]), YSpace: StringToInt(props[inc()]),
NameOffset: StringToInt(props[inc()]), NameOffset: StringToInt(props[inc()]),
MonsterOk: StringToUint8(props[inc()]) == 1, MonsterOk: StringToUint8(props[inc()]) == 1,
OperateRange: StringToInt(props[inc()]), OperateRange: StringToInt(props[inc()]),
ShrineFunction: StringToInt(props[inc()]), ShrineFunction: StringToInt(props[inc()]),
Restore: StringToUint8(props[inc()]) == 1, Restore: StringToUint8(props[inc()]) == 1,
Parm: [8]int{ Parm: [8]int{
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
@ -303,32 +303,32 @@ func createObjectRecord(props []string) ObjectRecord {
StringToInt(props[inc()]), StringToInt(props[inc()]),
StringToInt(props[inc()]), StringToInt(props[inc()]),
}, },
Act: StringToInt(props[inc()]), Act: StringToInt(props[inc()]),
Lockable: StringToUint8(props[inc()]) == 1, Lockable: StringToUint8(props[inc()]) == 1,
Gore: StringToUint8(props[inc()]) == 1, Gore: StringToUint8(props[inc()]) == 1,
Sync: StringToUint8(props[inc()]) == 1, Sync: StringToUint8(props[inc()]) == 1,
Flicker: StringToUint8(props[inc()]) == 1, Flicker: StringToUint8(props[inc()]) == 1,
Damage: StringToInt(props[inc()]), Damage: StringToInt(props[inc()]),
Beta: StringToUint8(props[inc()]) == 1, Beta: StringToUint8(props[inc()]) == 1,
Overlay: StringToUint8(props[inc()]) == 1, Overlay: StringToUint8(props[inc()]) == 1,
CollisionSubst: StringToUint8(props[inc()]) == 1, CollisionSubst: StringToUint8(props[inc()]) == 1,
Left: StringToInt(props[inc()]), Left: StringToInt(props[inc()]),
Top: StringToInt(props[inc()]), Top: StringToInt(props[inc()]),
Width: StringToInt(props[inc()]), Width: StringToInt(props[inc()]),
Height: StringToInt(props[inc()]), Height: StringToInt(props[inc()]),
OperateFn: StringToInt(props[inc()]), OperateFn: StringToInt(props[inc()]),
PopulateFn: StringToInt(props[inc()]), PopulateFn: StringToInt(props[inc()]),
InitFn: StringToInt(props[inc()]), InitFn: StringToInt(props[inc()]),
ClientFn: StringToInt(props[inc()]), ClientFn: StringToInt(props[inc()]),
RestoreVirgins: StringToUint8(props[inc()]) == 1, RestoreVirgins: StringToUint8(props[inc()]) == 1,
BlockMissile: StringToUint8(props[inc()]) == 1, BlockMissile: StringToUint8(props[inc()]) == 1,
DrawUnder: StringToUint8(props[inc()]) == 1, DrawUnder: StringToUint8(props[inc()]) == 1,
OpenWarp: StringToUint8(props[inc()]) == 1, OpenWarp: StringToUint8(props[inc()]) == 1,
AutoMap: StringToInt(props[inc()]), AutoMap: StringToInt(props[inc()]),
} }
return result return result
} }
@ -350,4 +350,4 @@ func LoadObjects(fileProvider FileProvider) {
Objects[rec.Id] = &rec Objects[rec.Id] = &rec
} }
log.Printf("Loaded %d objects", len(Objects)) log.Printf("Loaded %d objects", len(Objects))
} }

View File

@ -10,112 +10,112 @@ import (
type WeaponRecord struct { type WeaponRecord struct {
Name string Name string
Type string // base type in ItemTypes.txt Type string // base type in ItemTypes.txt
Type2 string Type2 string
Code string // identifies the item Code string // identifies the item
AlternateGfx string // code of the DCC used when equipped AlternateGfx string // code of the DCC used when equipped
NameString string // seems to be identical to code? NameString string // seems to be identical to code?
Version int // 0 = classic, 100 = expansion Version int // 0 = classic, 100 = expansion
CompactSave bool // if true, doesn't store any stats upon saving CompactSave bool // if true, doesn't store any stats upon saving
Rarity int // higher, the rarer Rarity int // higher, the rarer
Spawnable bool // if 0, cannot spawn in shops Spawnable bool // if 0, cannot spawn in shops
MinDamage int MinDamage int
MaxDamage int MaxDamage int
BarbOneOrTwoHanded bool // if true, barb can wield this in one or two hands BarbOneOrTwoHanded bool // if true, barb can wield this in one or two hands
UsesTwoHands bool // if true, it's a 2handed weapon UsesTwoHands bool // if true, it's a 2handed weapon
Min2HandDamage int Min2HandDamage int
Max2HandDamage int Max2HandDamage int
MinMissileDamage int // ranged damage stats MinMissileDamage int // ranged damage stats
MaxMissileDamage int MaxMissileDamage int
MissileSpeed int // unknown, affects movement speed of wielder during ranged attacks? MissileSpeed int // unknown, affects movement speed of wielder during ranged attacks?
ExtraRange int // base range = 1, if this is non-zero add this to the range ExtraRange int // base range = 1, if this is non-zero add this to the range
Speed int // affects movement speed of wielder, >0 = you move slower, <0 = you move faster Speed int // affects movement speed of wielder, >0 = you move slower, <0 = you move faster
StrengthBonus int StrengthBonus int
DexterityBonus int DexterityBonus int
// final mindam = min * str / strbonus + min * dex / dexbonus // final mindam = min * str / strbonus + min * dex / dexbonus
// same for maxdam // same for maxdam
RequiredStrength int RequiredStrength int
RequiredDexterity int RequiredDexterity int
Durability int // base durability 0-255 Durability int // base durability 0-255
NoDurability bool // if true, item has no durability NoDurability bool // if true, item has no durability
Level int // base item level (controls monster drops, for instance a lv20 monster cannot drop a lv30 item)
RequiredLevel int // required level to wield
Cost int // base cost
GambleCost int // for reference only, not used
MagicLevel int // additional magic level (for gambling?)
AutoPrefix int // prefix automatically assigned to this item on spawn, maps to group column of Automagic.txt
OpenBetaGfx string // unknown
NormalCode string
UberCode string
UltraCode string
WeaponClass string // what kind of attack does this weapon have (i.e. determines attack animations) Level int // base item level (controls monster drops, for instance a lv20 monster cannot drop a lv30 item)
RequiredLevel int // required level to wield
Cost int // base cost
GambleCost int // for reference only, not used
MagicLevel int // additional magic level (for gambling?)
AutoPrefix int // prefix automatically assigned to this item on spawn, maps to group column of Automagic.txt
OpenBetaGfx string // unknown
NormalCode string
UberCode string
UltraCode string
WeaponClass string // what kind of attack does this weapon have (i.e. determines attack animations)
WeaponClass2Hand string // what kind of attack when wielded with two hands WeaponClass2Hand string // what kind of attack when wielded with two hands
Component int // corresponds to Composit.txt, player animation layer used by this Component int // corresponds to Composit.txt, player animation layer used by this
HitClass string // determines sounds/graphic effects when attacking HitClass string // determines sounds/graphic effects when attacking
InventoryWidth int InventoryWidth int
InventoryHeight int InventoryHeight int
Stackable bool // can be stacked in inventory Stackable bool // can be stacked in inventory
MinStack int // min size of stack when item is spawned, used if stackable MinStack int // min size of stack when item is spawned, used if stackable
MaxStack int // max size of stack when item is spawned MaxStack int // max size of stack when item is spawned
SpawnStack int // unknown, something to do with stack size when spawned (sold maybe?) SpawnStack int // unknown, something to do with stack size when spawned (sold maybe?)
FlippyFile string // DC6 file animation to play when item drops on the ground FlippyFile string // DC6 file animation to play when item drops on the ground
InventoryFile string // DC6 file used in your inventory InventoryFile string // DC6 file used in your inventory
UniqueInventoryFile string // DC6 file used by the unique version of this item UniqueInventoryFile string // DC6 file used by the unique version of this item
SetInventoryFile string // DC6 file used by the set version of this item SetInventoryFile string // DC6 file used by the set version of this item
HasInventory bool // if true, item can store gems or runes HasInventory bool // if true, item can store gems or runes
GemSockets int // number of gems to store GemSockets int // number of gems to store
GemApplyType int // what kind of gem effect is applied GemApplyType int // what kind of gem effect is applied
// 0 = weapon, 1= armor or helmet, 2 = shield // 0 = weapon, 1= armor or helmet, 2 = shield
SpecialFeature string // Just a comment SpecialFeature string // Just a comment
Useable bool // can be used via right click if true Useable bool // can be used via right click if true
// game knows what to do if used by item code // game knows what to do if used by item code
DropSound string // sfx for dropping DropSound string // sfx for dropping
DropSfxFrame int // what frame of drop animation the sfx triggers on DropSfxFrame int // what frame of drop animation the sfx triggers on
UseSound string // sfx for using UseSound string // sfx for using
Unique bool // if true, only spawns as unique Unique bool // if true, only spawns as unique
Transparent bool // unused Transparent bool // unused
TransTable int // unknown, related to blending mode? TransTable int // unknown, related to blending mode?
Quivered bool // if true, requires ammo to use Quivered bool // if true, requires ammo to use
LightRadius int // apparently unused LightRadius int // apparently unused
Belt bool // seems to be unused? supposed to be whether this can go in your quick access belt Belt bool // seems to be unused? supposed to be whether this can go in your quick access belt
Quest int // indicates that this item belongs to a given quest? Quest int // indicates that this item belongs to a given quest?
QuestDifficultyCheck bool // if true, item only works in the difficulty it was found in QuestDifficultyCheck bool // if true, item only works in the difficulty it was found in
MissileType int // missile gfx for throwing MissileType int // missile gfx for throwing
DurabilityWarning int // controls what warning icon appears when durability is low DurabilityWarning int // controls what warning icon appears when durability is low
QuantityWarning int // controls at what quantity the low quantity warning appears QuantityWarning int // controls at what quantity the low quantity warning appears
GemOffset int // unknown GemOffset int // unknown
BitField1 int // 1 = leather item, 3 = metal BitField1 int // 1 = leather item, 3 = metal
Vendors map[string]*WeaponVendorParams // controls vendor settings Vendors map[string]*WeaponVendorParams // controls vendor settings
SourceArt string // unused?
GameArt string // unused?
ColorTransform int // colormap to use for player's gfx
InventoryColorTransform int // colormap to use for inventory's gfx
SkipName bool // if true, don't include the base name in the item description SourceArt string // unused?
GameArt string // unused?
ColorTransform int // colormap to use for player's gfx
InventoryColorTransform int // colormap to use for inventory's gfx
SkipName bool // if true, don't include the base name in the item description
NightmareUpgrade string // upgraded in higher difficulties NightmareUpgrade string // upgraded in higher difficulties
HellUpgrade string HellUpgrade string
Nameable bool // if true, item can be personalized Nameable bool // if true, item can be personalized
PermStoreItem bool // if true, vendor will always sell this PermStoreItem bool // if true, vendor will always sell this
} }
type WeaponVendorParams struct { type WeaponVendorParams struct {
Min int // minimum of this item they can stock Min int // minimum of this item they can stock
Max int // max they can stock Max int // max they can stock
MagicMin int MagicMin int
MagicMax int MagicMax int
MagicLevel uint8 MagicLevel uint8
} }
@ -129,105 +129,103 @@ func createWeaponRecord(line string) WeaponRecord {
result := WeaponRecord{ result := WeaponRecord{
Name: r[inc()], Name: r[inc()],
Type: r[inc()], Type: r[inc()],
Type2: r[inc()], Type2: r[inc()],
Code: r[inc()], Code: r[inc()],
AlternateGfx: r[inc()], AlternateGfx: r[inc()],
NameString: r[inc()], NameString: r[inc()],
Version: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Version: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
CompactSave : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, CompactSave: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Rarity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Rarity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Spawnable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, Spawnable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
MinDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MinDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MaxDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MaxDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
BarbOneOrTwoHanded : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, BarbOneOrTwoHanded: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
UsesTwoHands : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, UsesTwoHands: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Min2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Min2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Max2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Max2HandDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MinMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MinMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MaxMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MaxMissileDamage: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MissileSpeed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MissileSpeed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ExtraRange: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), ExtraRange: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Speed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Speed: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
StrengthBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), StrengthBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
DexterityBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), DexterityBonus: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
RequiredStrength: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
RequiredStrength: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
RequiredDexterity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), RequiredDexterity: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Durability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Durability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
NoDurability : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, NoDurability: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Level: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Level: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
RequiredLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), RequiredLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Cost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Cost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
GambleCost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), GambleCost: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MagicLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MagicLevel: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
AutoPrefix: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), AutoPrefix: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
OpenBetaGfx: r[inc()], OpenBetaGfx: r[inc()],
NormalCode: r[inc()], NormalCode: r[inc()],
UberCode: r[inc()], UberCode: r[inc()],
UltraCode: r[inc()], UltraCode: r[inc()],
WeaponClass: r[inc()], WeaponClass: r[inc()],
WeaponClass2Hand: r[inc()], WeaponClass2Hand: r[inc()],
Component: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Component: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
HitClass: r[inc()], HitClass: r[inc()],
InventoryWidth: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), InventoryWidth: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
InventoryHeight: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), InventoryHeight: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Stackable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, Stackable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
MinStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MinStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MaxStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), MaxStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
SpawnStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), SpawnStack: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
FlippyFile: r[inc()], FlippyFile: r[inc()],
InventoryFile: r[inc()], InventoryFile: r[inc()],
UniqueInventoryFile: r[inc()], UniqueInventoryFile: r[inc()],
SetInventoryFile: r[inc()], SetInventoryFile: r[inc()],
HasInventory : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, HasInventory: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
GemSockets: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), GemSockets: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
GemApplyType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), GemApplyType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
SpecialFeature: r[inc()],
SpecialFeature: r[inc()],
Useable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Useable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
DropSound: r[inc()],
DropSound: r[inc()], DropSfxFrame: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
DropSfxFrame: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), UseSound: r[inc()],
UseSound: r[inc()],
Unique: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Unique : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, Transparent: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Transparent : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, TransTable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
TransTable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Quivered: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Quivered : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, LightRadius: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
LightRadius: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), Belt: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Belt : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Quest: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Quest: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), QuestDifficultyCheck: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
QuestDifficultyCheck : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
MissileType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
MissileType: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), DurabilityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
DurabilityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), QuantityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
QuantityWarning: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), GemOffset: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
GemOffset: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), BitField1: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
BitField1: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
Vendors: createWeaponVendorParams(&r, inc),
Vendors: createWeaponVendorParams(&r, inc),
SourceArt: r[inc()],
SourceArt: r[inc()], GameArt: r[inc()],
GameArt: r[inc()], ColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
ColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))), InventoryColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
InventoryColorTransform: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))),
SkipName: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
SkipName : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, NightmareUpgrade: r[inc()],
NightmareUpgrade: r[inc()], HellUpgrade: r[inc()],
HellUpgrade: r[inc()],
Nameable: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
Nameable : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1, PermStoreItem: StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
PermStoreItem : StringToInt(EmptyToZero(AsterToEmpty(r[inc()]))) == 1,
} }
return result return result
} }
@ -255,13 +253,13 @@ func createWeaponVendorParams(r *[]string, inc func() int) map[string]*WeaponVen
for _, name := range vs { for _, name := range vs {
wvp := WeaponVendorParams{ wvp := WeaponVendorParams{
Min: StringToInt(EmptyToZero((*r)[inc()])), Min: StringToInt(EmptyToZero((*r)[inc()])),
Max: StringToInt(EmptyToZero((*r)[inc()])), Max: StringToInt(EmptyToZero((*r)[inc()])),
MagicMin: StringToInt(EmptyToZero((*r)[inc()])), MagicMin: StringToInt(EmptyToZero((*r)[inc()])),
MagicMax: StringToInt(EmptyToZero((*r)[inc()])), MagicMax: StringToInt(EmptyToZero((*r)[inc()])),
MagicLevel: StringToUint8(EmptyToZero((*r)[inc()])), MagicLevel: StringToUint8(EmptyToZero((*r)[inc()])),
} }
result[name] = &wvp; result[name] = &wvp
} }
return result return result
} }
@ -279,4 +277,4 @@ func LoadWeapons(fileProvider FileProvider) {
Weapons[rec.Code] = &rec Weapons[rec.Code] = &rec
} }
log.Printf("Loaded %d weapons", len(Weapons)) log.Printf("Loaded %d weapons", len(Weapons))
} }