Use depth-scaled sphere silhouettes for native rapid-count view checks

This commit is contained in:
NINI
2026-10-06 23:56:16 +09:00
parent 35e063b17b
commit d14a49d629
2 changed files with 13 additions and 2 deletions
+12 -1
View File
@@ -3,6 +3,13 @@ param([Parameter(Mandatory)][string]$ApkPath,[Parameter(Mandatory)][string]$Evid
# This suite never pushes a save or injects completed stages. Every checkpoint is read from the APK. # This suite never pushes a save or injects completed stages. Every checkpoint is read from the APK.
function Board($State,[int]$Stage) { return @($State.puzzleStates | Where-Object stageId -eq $Stage)[0] } function Board($State,[int]$Stage) { return @($State.puzzleStates | Where-Object stageId -eq $Stage)[0] }
function Counts($Board) { return (@($Board.groups | ForEach-Object {$_.ballIds.Count} | Sort-Object) -join ',') } function Counts($Board) { return (@($Board.groups | ForEach-Object {$_.ballIds.Count} | Sort-Object) -join ',') }
function BallRadiusPixels($CurrentBoard,$Ball) {
$camera=$CurrentBoard.camera
$rotation=[Numerics.Quaternion]::new($camera.rotation.x,$camera.rotation.y,$camera.rotation.z,$camera.rotation.w)
$origin=[Numerics.Vector3]::new($camera.target.x,($camera.target.y+.65),$camera.target.z)+[Numerics.Vector3]::Transform([Numerics.Vector3]::new(0,0,-$camera.distance),$rotation)
$local=[Numerics.Vector3]::Transform([Numerics.Vector3]::new($Ball.position.x,$Ball.position.y,$Ball.position.z)-$origin,[Numerics.Quaternion]::Inverse($rotation))
return 540*.55/([Math]::Tan(31*[Math]::PI/180)*$local.Z)
}
function Orbit([string]$Name,$CurrentBoard) { function Orbit([string]$Name,$CurrentBoard) {
if(!$CurrentBoard){$saved=Save "$Name-view";$CurrentBoard=if($saved.puzzleStates.Count){$saved.puzzleStates[-1]}else{$saved.latestFreePlay}} if(!$CurrentBoard){$saved=Save "$Name-view";$CurrentBoard=if($saved.puzzleStates.Count){$saved.puzzleStates[-1]}else{$saved.latestFreePlay}}
$points=@($CurrentBoard.balls|ForEach-Object{,(BallPoint $CurrentBoard $_.id)}) $points=@($CurrentBoard.balls|ForEach-Object{,(BallPoint $CurrentBoard $_.id)})
@@ -160,7 +167,11 @@ try {
$actual=Board (Save "twenty-before-rapid-view-$view") 20 $actual=Board (Save "twenty-before-rapid-view-$view") 20
$points=@($actual.balls|ForEach-Object{,(BallPoint $actual $_.id)}) $points=@($actual.balls|ForEach-Object{,(BallPoint $actual $_.id)})
$visible=@($points|Where-Object{!(WorldSafe $_)}).Count-eq0 $visible=@($points|Where-Object{!(WorldSafe $_)}).Count-eq0
for($a=0;$a-lt$points.Count;$a++){for($b=$a+1;$b-lt$points.Count;$b++){if([Math]::Pow($points[$a][0]-$points[$b][0],2)+[Math]::Pow($points[$a][1]-$points[$b][1],2)-lt10000){$visible=$false}}} $radii=@($actual.balls|ForEach-Object{BallRadiusPixels $actual $_})
for($a=0;$a-lt$points.Count;$a++){for($b=$a+1;$b-lt$points.Count;$b++){
$centreDistanceSquared=[Math]::Pow($points[$a][0]-$points[$b][0],2)+[Math]::Pow($points[$a][1]-$points[$b][1],2)
if($centreDistanceSquared-lt[Math]::Pow([Math]::Max($radii[$a],$radii[$b])+8,2)){$visible=$false}
}}
if($visible){break};Orbit "twenty-rapid-safe-view-$view" $actual if($visible){break};Orbit "twenty-rapid-safe-view-$view" $actual
} }
Check 'twenty-all-ten-safe-separated-projections' $visible ($points|ConvertTo-Json -Compress) Check 'twenty-all-ten-safe-separated-projections' $visible ($points|ConvertTo-Json -Compress)
+1 -1
View File
@@ -34,7 +34,7 @@ function BallPoint($Board,[string]$Id) {
$scale=($height/2)/([Math]::Tan(31*[Math]::PI/180)*$local.Z) $scale=($height/2)/([Math]::Tan(31*[Math]::PI/180)*$local.Z)
return @([int][Math]::Round(($width/2)+$local.X*$scale),[int][Math]::Round(($height/2)-$local.Y*$scale)) return @([int][Math]::Round(($width/2)+$local.X*$scale),[int][Math]::Round(($height/2)-$local.Y*$scale))
} }
function WorldSafe($Point) { return $Point[0]-ge530-and$Point[0]-le1900-and$Point[1]-ge280-and$Point[1]-le750 } function WorldSafe($Point) { return $Point[0]-ge530-and$Point[0]-le1850-and$Point[1]-ge280-and$Point[1]-le750 }
function TapBall([string]$Name,$Board,[string]$Id) { function TapBall([string]$Name,$Board,[string]$Id) {
$point=BallPoint $Board $Id $point=BallPoint $Board $Id
if(!(WorldSafe $point)){throw "Refused unsafe native ball tap $Id at $($point-join',')"} if(!(WorldSafe $point)){throw "Refused unsafe native ball tap $Id at $($point-join',')"}