Commit 4e212a34 authored by Loïc Petit's avatar Loïc Petit

#7 Display basic ranges and type all the boxes

parent 432be2d2
......@@ -8,6 +8,7 @@ from list_diff import clean_diff
from load import load_char
output_path = "C:/Users/WydD/Desktop/export/"
char_path = "D:/Steam/SteamApps/common/StreetFighterV/StreetFighterV/Content/Paks/moves/StreetFighterV/Content/Chara"
chars = sorted(a for a in os.listdir(char_path) if a != "NDK")
versions = {re.sub("s([0-9\.]*)-.*","\\1", version): {line[:3]: line[4:] for line in open("../sfv-simulator/versions/"+version).read().strip().split("\n")} for version in os.listdir("../sfv-simulator/versions") if version[-3:] == "txt"}
......@@ -20,7 +21,7 @@ for c in chars:
if current == previous:
continue
current_data = load_char(char_path, c, current)
path_diff = "result/diffs/%s_%s_%s.bin" % (c, previous, current)
path_diff = output_path+"diffs/%s_%s_%s.bin" % (c, previous, current)
if previous_data is not None: #: and not os.path.exists(path_diff):
diff = DeepDiff(previous_data, current_data, exclude_paths=["root['version']"])
diff = transform_diff(clean_diff(diff, previous_data, current_data))
......
......@@ -220,6 +220,12 @@
border-bottom: 1px solid gray;
height: 350px;
}
#rangebox {
position: absolute;
top: 40px;
padding: 1em;
font-size: smaller;
}
.positions {
position: absolute;
right: 0;
......@@ -437,12 +443,18 @@ dd ul {
border-radius: 10px;
}
@media (max-width: 1280px) {
#nav {
margin-bottom: 0 !important;
}
.version-menu .listing > a {
width: 50%;
}
h2 {
overflow-wrap: break-word;
}
#rangebox {
top: 0px;
}
}
@media (max-width: 768px) {
.version-selection .char-img {
......
......@@ -5,6 +5,20 @@ function shiftPosition(posX, posY, container, tick) {
return [bsX, bsY];
}
var currentTick = 0;
function getCoord(selector, left) {
var res = (Math.max(...$("#position-shift "+selector+":visible").map(function(i, e) { return $(e).offset().left + $(e).width(); })) - left)/100.0;
if (isFinite(res)) {
return res;
}
return null;
}
function formatRange(label, hitRange, shiftX) {
if (hitRange === null)
return "";
return label+": " + (+hitRange.toFixed(5)) + "<br/>&nbsp;&nbsp;&nbsp;&nbsp;(relative: " + (+(hitRange - shiftX).toFixed(5)) + ")<br/>";
}
function onTickClick(tick, gridElement) {
if (tick >= totalTicks || tick < 0) return;
currentTick = tick;
......@@ -42,6 +56,20 @@ function onTickClick(tick, gridElement) {
$el.clone().attr("id", "#" + box+"-old").appendTo("#old-hitbox-shift").addClass("temporary").addClass("old").show();
}
}
var left = $(".zero").offset().left;
var shiftX = ($(".cross-y").offset().left - left)/100.0;
var rangeBox = "<h4>Ranges</h4>Position: "+ (+shiftX.toFixed(5))+"<br>";
var hitRange = getCoord(".hit", left);
rangeBox += formatRange("Hit", hitRange, shiftX);
var throwRange = getCoord(".hurt.throw", left);
rangeBox += formatRange("Throw", throwRange, shiftX);
var projectileRange = getCoord(".hurt.projectile", left);
rangeBox += formatRange("Projectile", projectileRange, shiftX);
var strikeRange = getCoord(".hurt.strike", left);
rangeBox += formatRange("Strike", strikeRange, shiftX);
var range = $("<div id='rangebox'>").html(rangeBox);
$("#rangebox").remove();
range.prependTo($(".box-container"));
}
function deselect(e) {
e.stopPropagation();
......
......@@ -160,6 +160,10 @@ version_map = extract_version_map(basepath)
# print(version)
# write_version(basepath, version_map, "SKR", "000")
for char, versions in sorted(version_map.items()):
# if char != "URN":
# continue
for version, version_content in sorted(versions.items()):
# if version != "020":
# continue
print(char, version, version_content)
write_version(basepath, version_map, char, version)
......@@ -5,7 +5,7 @@ def get_box_style(path, h):
if path == "Hurtboxes":
if h.get("Type") == "Armor":
return "hurt armor"
return "hurt"
return "hurt "+" ".join([e.lower() for e in h["Sensitivity"]])
if path == "Pushboxes":
return "push"
if h["HitType"] == "Proximity Guard":
......@@ -26,6 +26,8 @@ def render_boxes(script, diff):
"TickStart": property_diff["TickStart"]["change"]["old_value"] if "TickStart" in property_diff else h["TickStart"],
"TickEnd": property_diff["TickEnd"]["change"]["old_value"] if "TickEnd" in property_diff else h["TickEnd"],
"HitType": h.get("HitType"),
"Sensitivity": h.get("Sensitivity"),
"Type": h.get("Type"),
"X": property_diff["X"]["change"]["old_value"] if "X" in property_diff else h["X"],
"Y": property_diff["Y"]["change"]["old_value"] if "Y" in property_diff else h["Y"],
"Width": property_diff["Width"]["change"]["old_value"] if "Width" in property_diff else h["Width"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment