8 Commits
Author SHA1 Message Date
Luxferre f0b4b7bd21 Improved version format selector 2024-10-13 07:17:15 +03:00
Luxferre 218491bc4b Added UNLICENSE 2024-10-12 19:15:59 +03:00
Luxferre 0c65598156 v0.6: compacted UI 2024-10-12 19:09:06 +03:00
Luxferre 3846afaf10 Fixed Health Crates Cure Poison choices, started some UI optimization 2024-10-12 18:49:14 +03:00
Luxferre 140a085ebe v0.5: fixed-point logic fixes 2024-10-12 18:14:52 +03:00
Luxferre 27c669f67f v0.4: fixed default value validation for v3 2024-10-12 17:05:16 +03:00
Luxferre b749722945 bumped version 2024-10-12 16:44:43 +03:00
Luxferre ec2c95ca07 Fixed v3 value scanning 2024-10-12 16:41:58 +03:00
2 changed files with 92 additions and 65 deletions
+24
View File
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
+68 -65
View File
@@ -7,7 +7,7 @@
package require Tk
set appversion 0.2
set appversion 0.7
set scriptpath [file normalize [info script]]
set appdir [file dirname $scriptpath]
# check if we're running from a starpack
@@ -54,11 +54,11 @@ set wa_opts {
{offset 0x1E name {Blood} val {bool}}
{offset 0x23 name {Upgraded Grenade} val {bool}}
{offset 0x24 name {Upgraded Shotgun} val {bool}}
{offset 0x25 name {Upgraded Clusters} val {bool}}
{offset 0x26 name {Upgraded Longbow} val {bool}}
{offset 0x0F name {Sudden Death Event} val {0 {Round ends} 1 {Nuclear strike} 2 {HP drops to 1} 3 {Nothing happens}}}
{offset 0x0D name {Stockpiling Mode} val {0 Replenish 1 Accumulate 2 Reduce}}
{offset 0x0E name {Worm Selection} val {0 Sequential 1 Manual 2 Random}}
{offset 0x25 name {Upgraded Clusters} val {bool}}
{offset 0x26 name {Upgraded Longbow} val {bool}}
}
# names of weapon properties
@@ -202,18 +202,16 @@ set wa_ext_opts {
{offset 0x150 size 1 name {Undetermined Crates} def 128 val {0 Off 1 On 128 Default}}
{offset 0x151 size 1 name {Undetermined Fuses} def 128 val {0 Off 1 On 128 Default}}
{offset 0x14A size 1 name {Rope-Roll Drops} def 0 val {0 {Disabled} 1 {As from rope only} 2 {As from rope or jump}}}
{offset 0x14B size 1 name {Horizontal Impact Loss of Control} def 0 val {0 {Lose control} 255 {No loss of control}}}
{offset 0x143 size 1 name {Phased Worms (Enemy)} def 0 val {
0 {Off}
1 {Worms move through each other}
2 {+ Move through enemy weapon objects}
3 {+ Don't take damage from enemy explosions}
}}
{offset 0x14D size 1 name {Keep Control After Skimming} def 0 val {0 {Lose control} 1 {Keep control} 2 {Keep control and rope}}}
{offset 0x183 size 1 name {RubberWorm Gravity Type} def 0 val {0 {Unmodified} 1 {Standard} 2 {Black hole (constant)} 3 {Black hole (linear)}}}
{offset 0x191 size 1 name {Health Crates Cure Poison} def 1 val {255 {Off} 0 {Cure the collector} 1 {Cure the collector's team} 2 {Cure all allied teams}}}
{offset 0x156 size 1 name {Pneumatic Drill Imparts Velocity} def 128 val {0 Off 1 On 128 Default}}
{offset 0x16D size 1 name {Indian Rope Glitch} def 128 val {0 Off 1 On 128 Default}}
{offset 0x16E size 1 name {Herd-Doubling Glitch} def 128 val {0 Off 1 On 128 Default}}
{offset 0x172 size 1 name {Skipwalking} def 0 val {255 Disabled 0 Possible 1 Facilitated}}
{offset 0x193 size 1 name {Sheep Heaven's Gate} def 7 val {
1 {1. Sheep explode out of all crates}
2 {2. Sheep weapon extended fuse time}
@@ -223,18 +221,20 @@ set wa_ext_opts {
6 {6. Option 2 + Option 4}
7 {7. All of the above}
}}
{offset 0x192 size 1 name {Kaos Mod Preset} def 0 val {
0 {20, 10, 15, 5, 10, 15, 10, 15, 5}
1 {20, 10, 10, 5, 10, 15, 10, 12, 5}
2 {20, 15, 10, 5, 10, 15, 10, 10, 0}
3 {25, 15, 5, 0, 20, 20, 10, 5, 0}
4 {25, 25, 0, 5, 20, 10, 10, 5, 0}
5 {25, 15, 5, 5, 25, 10, 10, 5, 0}
}}
{offset 0x16E size 1 name {Herd-Doubling Glitch} def 128 val {0 Off 1 On 128 Default}}
{offset 0x172 size 1 name {Skipwalking} def 0 val {255 Disabled 0 Possible 1 Facilitated}}
{offset 0x173 size 1 name {Roofing} def 0 val {0 {Allowed} 1 {Block above} 2 {Block everywhere}}}
{offset 0x18E size 1 name {Terrain Overlap Phasing Glitch} def 128 val {0 Off 1 On 128 Default}}
{offset 0x183 size 1 name {RubberWorm Gravity Type} def 0 val {0 {Unmodified} 1 {Standard} 2 {Black hole (constant)} 3 {Black hole (linear)}}}
{offset 0x191 size 1 name {Health Crates Cure Poison} def 1 val {255 {Off} 0 {Cure the collector} 2 {Cure the collector's team} 3 {Cure all allied teams}}}
{offset 0x192 size 1 name {Kaos Mod Preset} def 0 val {
0 {Preset 0}
1 {Preset 1}
2 {Preset 2}
3 {Preset 3}
4 {Preset 4}
5 {Preset 5}
}}
{offset 0x14B size 1 name {Horizontal Impact Loss of Control} def 0 val {0 {Lose control} 255 {No loss of control}}}
{offset 0x14D size 1 name {Keep Control After Skimming} def 0 val {0 {Lose control} 1 {Keep control} 2 {Keep control and rope}}}
}
# special setting processor section
@@ -293,21 +293,22 @@ proc wa_roundtime_write {num} {
# fixedpoint helpers
proc fixed2float {fpint} {
set whole [expr {int($fpint) >> 16}]
set frac [expr {int($fpint) & 65535}]
return [expr {$whole + ($frac / 65536)}]
set fpint [expr {int($fpint)}]
set whole [expr {$fpint >> 16}]
set frac [expr {$fpint % 65536}]
return [expr {$whole + ($frac / 65536.)}]
}
proc float2fixed {flt} {
set whole [expr {int(double($flt))}]
set frac [expr {double($flt) - $whole}]
return [expr {($whole << 16) | int($frac * 65536)}]
set whole [expr {int($flt)}]
set frac [expr {$flt - $whole}]
return [expr {($whole << 16) | int($frac * 65536.)}]
}
# v3-only spec functions
proc wa_petrolturndecay_read {raw} {return [fixed2float $raw]}
proc wa_petrolturndecay_write {num} {return [expr int($num * 65536)]}
proc wa_petrolturndecay_write {num} {return [expr int($num * 65536.)]}
# general logic
@@ -341,7 +342,7 @@ proc fullscanscheme {version} {
set delay 0
set prob 0
catch {
binary scan [string range $rawschemedata $offs [expr {$offs + 4}]] cucucucu ammo power delay prob
binary scan [string range $rawschemedata $offs [expr {$offs + 3}]] cucucucu ammo power delay prob
}
set wsc_data($offs) $ammo
set wsc_data($poweroffs) $power
@@ -359,9 +360,9 @@ proc fullscanscheme {version} {
if {$size eq 1} {set fmt cu}
if {$size eq 2} {set fmt s}
if {$size eq 4} {set fmt i}
catch {
binary scan [string range $rawschemedata [expr {$offs + $size}]] $fmt wscval
}
set newval ""
binary scan [string range $rawschemedata $offs [expr {$offs + $size - 1}]] $fmt newval
if {$newval ne ""} {set wscval $newval}
if {([llength $valopt] > 1) && ([lindex $valopt 0] eq "spec")} {
set readfunc "[lindex $valopt 1]_read"
set wscval [$readfunc $wscval]
@@ -427,7 +428,7 @@ proc savescheme {fname} {
if {$diffbytes > 0} { # expand with nulls
set rawschemedata [string cat $rawschemedata [binary format x$diffbytes]]
} else { # truncate
set rawschemedata [string range $rawschemedata 0 [expr {$datasize - 1}]
set rawschemedata [string range $rawschemedata 0 [expr {$datasize - 1}]]
}
# write the version itself
set binval [binary format cu $wsc_data(version)]
@@ -474,7 +475,7 @@ proc savescheme {fname} {
if {$size eq 2} {set fmt s}
if {$size eq 4} {set fmt i}
if {([llength $valopt] > 1) && ([lindex $valopt 0] eq "spec")} {
set writefunc "[lindex $valopt 1]_read"
set writefunc "[lindex $valopt 1]_write"
set val [$writefunc $val]
} elseif {$valopt eq "fixp"} {
set val [float2fixed $val]
@@ -570,7 +571,7 @@ grid .infoframe -row 1 -column 0 -sticky we
ttk::frame .tabbar.nopts
.tabbar add .tabbar.nopts -text "Options"
ttk::labelframe .tabbar.nopts.opts -text "General options"
grid .tabbar.nopts.opts -column 0 -row 0 -sticky nw -padx 5 -pady 5 -columnspan 6
grid .tabbar.nopts.opts -column 0 -row 0 -sticky nw -padx 5 -pady 5 -columnspan 4
set row 0
set col 0
@@ -590,7 +591,7 @@ foreach opt $wa_opts {
ttk::entry $txtid -width 8 -textvariable $boundvar
pack $lblid -side left -fill x -padx 5
pack $txtid -side right
grid $elpref -column $col -row $row -sticky nwe
grid $elpref -column $col -row $row -sticky nwe -pady 5
} elseif {([lindex $valopt 0] eq "bool")} { # create a checkbox entry
set chkid ".tabbar.nopts.opts.chk$offs"
ttk::checkbutton $chkid -text $name -variable $boundvar -onvalue 1 -offvalue 0
@@ -608,7 +609,7 @@ foreach opt $wa_opts {
grid $comboid -column $col -row $row -sticky news
}
incr col
if {$col > 4} {
if {$col > 3} {
set col 0
incr row
}
@@ -633,25 +634,25 @@ foreach weap $wa_weapons {
set boundvar_prob "wsc_data($proboffs)"
set groupid ".tabbar.weap.$offs"
ttk::labelframe $groupid -text $wname -labelanchor nw
ttk::label "$groupid.ammolbl" -text "Ammo"
ttk::label "$groupid.ammolbl" -text "A"
ttk::entry "$groupid.ammotxt" -textvariable $boundvar_ammo -width 4
grid "$groupid.ammolbl" -column 0 -row 0 -sticky nsw
grid "$groupid.ammotxt" -column 1 -row 0 -sticky nw
ttk::label "$groupid.powerlbl" -text "Power"
ttk::label "$groupid.powerlbl" -text "P"
ttk::entry "$groupid.powertxt" -textvariable $boundvar_power -width 4
grid "$groupid.powerlbl" -column 0 -row 1 -sticky nsw
grid "$groupid.powertxt" -column 1 -row 1 -sticky nw
ttk::label "$groupid.delaylbl" -text "Delay"
grid "$groupid.powerlbl" -column 2 -row 0 -sticky nsw
grid "$groupid.powertxt" -column 3 -row 0 -sticky nw
ttk::label "$groupid.delaylbl" -text "D"
ttk::entry "$groupid.delaytxt" -textvariable $boundvar_delay -width 4
grid "$groupid.delaylbl" -column 0 -row 2 -sticky nsw
grid "$groupid.delaytxt" -column 1 -row 2 -sticky nw
ttk::label "$groupid.problbl" -text "Probability"
grid "$groupid.delaylbl" -column 4 -row 0 -sticky nsw
grid "$groupid.delaytxt" -column 5 -row 0 -sticky nw
ttk::label "$groupid.problbl" -text "Pr"
ttk::entry "$groupid.probtxt" -textvariable $boundvar_prob -width 4
grid "$groupid.problbl" -column 0 -row 3 -sticky nsw
grid "$groupid.probtxt" -column 1 -row 3 -sticky nw
grid "$groupid.problbl" -column 6 -row 0 -sticky nsw
grid "$groupid.probtxt" -column 7 -row 0 -sticky nw
grid $groupid -column $col -row $row -sticky news -padx 5 -pady 3
incr col
if {$col > 10} {
if {$col > 4} {
set col 0
incr row
}
@@ -661,15 +662,14 @@ foreach weap $wa_weapons {
ttk::frame .tabbar.extopts
.tabbar add .tabbar.extopts -text "Extended options (v3)"
# Extended option checkboxes in the first tab
set eflpref ".tabbar.nopts.eflags"
ttk::labelframe $eflpref -text "Extended option flags (v3)"
grid $eflpref -row 1 -column 0 -sticky nw -padx 5 -pady 5 -columnspan 8
# Second extended options tabframe
ttk::frame .tabbar.extflags
.tabbar add .tabbar.extflags -text "Extended option flags (v3)"
# Extended option textboxes in the first tab
set etpref ".tabbar.nopts.etxts"
ttk::labelframe $etpref -text "Extended option parameters (v3)"
grid $etpref -row 2 -column 0 -sticky nw -padx 5 -pady 5 -columnspan 8
grid $etpref -row 2 -column 0 -sticky nw -padx 5 -pady 5 -columnspan 5
set row 0
set col 0
@@ -693,18 +693,18 @@ foreach opt $wa_ext_opts {
ttk::entry $txtid -width 8 -textvariable $boundvar
pack $lblid -side left -fill x -padx 5
pack $txtid -side right
grid $elpref -column $txtcol -row $txtrow -sticky nwe
grid $elpref -column $txtcol -row $txtrow -sticky nwe -pady 5
incr txtcol
if {$txtcol > 5} {
if {$txtcol > 4} {
set txtcol 0
incr txtrow
}
} elseif {([lindex $valopt 0] eq "bool")} { # create a checkbox entry
set chkid ".tabbar.nopts.eflags.chk$offs"
set chkid ".tabbar.extflags.chk$offs"
ttk::checkbutton $chkid -text $name -variable $boundvar -onvalue 1 -offvalue 0
grid $chkid -column $chkcol -row $chkrow -sticky nw
incr chkcol
if {$chkcol > 4} {
if {$chkcol > 3} {
set chkcol 0
incr chkrow
}
@@ -720,7 +720,7 @@ foreach opt $wa_ext_opts {
}
grid $comboid -column $col -row $row -sticky news -padx 5 -pady 3
incr col
if {$col > 5} {
if {$col > 4} {
set col 0
incr row
}
@@ -729,7 +729,7 @@ foreach opt $wa_ext_opts {
# right container of the first tab
ttk::frame .tabbar.nopts.right
grid .tabbar.nopts.right -column 6 -row 0 -sticky ne
grid .tabbar.nopts.right -column 4 -row 0 -sticky nwe
# Mines and barrels calc
set hcalc_mines 0
@@ -740,11 +740,11 @@ ttk::labelframe $calcpref -text "Mines & Barrels Calculator"
grid $calcpref -column 0 -row 0 -sticky nw -padx 5 -pady 5
ttk::label "$calcpref.minelbl" -text Mines
ttk::entry "$calcpref.minetxt" -width 3 -textvariable hcalc_mines
grid $calcpref.minelbl -column 0 -row 0 -sticky nw -padx 5 -pady 5
grid $calcpref.minelbl -column 0 -row 0 -sticky nsw -padx 5 -pady 5
grid $calcpref.minetxt -column 1 -row 0 -sticky nw -padx 5 -pady 5
ttk::label "$calcpref.barrlbl" -text Barrels
ttk::entry "$calcpref.barrtxt" -width 3 -textvariable hcalc_barrels
grid $calcpref.barrlbl -column 0 -row 1 -sticky nw -padx 5 -pady 5
grid $calcpref.barrlbl -column 0 -row 1 -sticky nsw -padx 5 -pady 5
grid $calcpref.barrtxt -column 1 -row 1 -sticky nw -padx 5 -pady 5
ttk::button "$calcpref.reset" -text Reset -command {
set hcalc_mines 0
@@ -840,16 +840,19 @@ ttk::button "$calcpref.docalc" -text Calculate -command {
}
grid $calcpref.docalc -column 2 -row 2 -sticky nw -padx 5 -pady 5
ttk::label "$calcpref.resultlbl" -text "Result:"
grid $calcpref.resultlbl -column 0 -row 2 -sticky nw -padx 5 -pady 5
grid $calcpref.resultlbl -column 0 -row 2 -sticky nsw -padx 5 -pady 5
ttk::label "$calcpref.result" -textvariable hcalc_result
grid $calcpref.result -column 1 -row 2 -sticky nw -padx 5 -pady 5
grid $calcpref.result -column 1 -row 2 -sticky nsw -padx 5 -pady 5
# Version overrider
set verpref ".tabbar.nopts.right.vers"
ttk::labelframe $verpref -text "Version converter"
ttk::label "$verpref.verlbl" -text "Format version"
ttk::entry "$verpref.vertxt" -width 1 -textvariable wsc_data(version)
grid $verpref.verlbl -column 0 -row 1 -sticky nws -padx 5 -pady 5
grid $verpref.vertxt -column 1 -row 1 -sticky nw -padx 5 -pady 5
grid $verpref -column 0 -row 1 -sticky nw -padx 5 -pady 5
set irow 0
set vnames {{} {Version 1 (45 weapons)} {Version 2 (64 weapons)} {Version 3 (extended)}}
foreach v {1 2 3} {
set rbid [string cat $verpref ".opt" $v]
ttk::radiobutton $rbid -variable wsc_data(version) -text [lindex $vnames $v] -value $v
grid $rbid -column 0 -row $irow -sticky nsw
incr irow
}
grid $verpref -row 1 -column 0 -sticky nswe -padx 5