Add transparent officer portrait cutouts
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.6 MiB |
@@ -106,6 +106,17 @@ func _check_battle_visual_data(failures: Array[String]) -> void:
|
||||
]:
|
||||
_check_alpha_cutout_path(failures, path, "unit cutout %s" % path)
|
||||
|
||||
for path in [
|
||||
"res://art/portraits/cao_cao.png",
|
||||
"res://art/portraits/cao_ren.png",
|
||||
"res://art/portraits/dian_wei.png",
|
||||
"res://art/portraits/guo_jia.png",
|
||||
"res://art/portraits/xiahou_dun.png",
|
||||
"res://art/portraits/xiahou_yuan.png",
|
||||
"res://art/portraits/zhang_he.png"
|
||||
]:
|
||||
_check_alpha_cutout_path(failures, path, "officer portrait cutout %s" % path)
|
||||
|
||||
var gate_state = BattleStateScript.new()
|
||||
if not gate_state.load_battle("res://data/scenarios/002_sishui_gate.json"):
|
||||
failures.append("could not load Sishui Gate for enemy cavalry sprite")
|
||||
|
||||
@@ -1851,6 +1851,9 @@ function Check-Portrait-Path($Portrait, [string]$Context) {
|
||||
Fail "$Context references missing file: $Portrait"
|
||||
}
|
||||
Check-Portrait-Image $absolutePath ([string]$Portrait) $Context
|
||||
if ($relativePath -match '^art[\\/]+portraits[\\/]+.+\.png$') {
|
||||
Check-Alpha-Cutout-File $absolutePath ([string]$Portrait) $Context
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Portrait-Image([string]$AbsolutePath, [string]$Portrait, [string]$Context) {
|
||||
@@ -1876,14 +1879,12 @@ function Check-Portrait-Image([string]$AbsolutePath, [string]$Portrait, [string]
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Item-Icon-Cutout([string]$Icon, [string]$Context) {
|
||||
$relativePath = $Icon.Substring("res://".Length)
|
||||
$absolutePath = [System.IO.Path]::GetFullPath((Join-Path ([System.IO.Path]::GetFullPath($Root)) $relativePath))
|
||||
function Check-Alpha-Cutout-File([string]$AbsolutePath, [string]$DisplayPath, [string]$Context) {
|
||||
$bitmap = $null
|
||||
try {
|
||||
$bitmap = [System.Drawing.Bitmap]::FromFile($absolutePath)
|
||||
$bitmap = [System.Drawing.Bitmap]::FromFile($AbsolutePath)
|
||||
if (-not [System.Drawing.Image]::IsAlphaPixelFormat($bitmap.PixelFormat)) {
|
||||
Fail "$Context must be an alpha PNG cutout: $Icon"
|
||||
Fail "$Context must be an alpha PNG cutout: $DisplayPath"
|
||||
}
|
||||
$cornerPixels = @(
|
||||
$bitmap.GetPixel(0, 0),
|
||||
@@ -1893,7 +1894,7 @@ function Check-Item-Icon-Cutout([string]$Icon, [string]$Context) {
|
||||
)
|
||||
foreach ($pixel in $cornerPixels) {
|
||||
if ($pixel.A -gt 3) {
|
||||
Fail "$Context must have transparent corners: $Icon"
|
||||
Fail "$Context must have transparent corners: $DisplayPath"
|
||||
}
|
||||
}
|
||||
$transparentSamples = 0
|
||||
@@ -1907,13 +1908,13 @@ function Check-Item-Icon-Cutout([string]$Icon, [string]$Context) {
|
||||
}
|
||||
}
|
||||
if ($transparentSamples -lt [int]($totalSamples * 0.20)) {
|
||||
Fail "$Context must have substantial transparent background: $Icon ($transparentSamples/$totalSamples sampled pixels)"
|
||||
Fail "$Context must have substantial transparent background: $DisplayPath ($transparentSamples/$totalSamples sampled pixels)"
|
||||
}
|
||||
} catch {
|
||||
if ($_.Exception.Message -like "$Context*") {
|
||||
throw
|
||||
}
|
||||
Fail "$Context could not inspect alpha cutout data: $Icon"
|
||||
Fail "$Context could not inspect alpha cutout data: $DisplayPath"
|
||||
} finally {
|
||||
if ($null -ne $bitmap) {
|
||||
$bitmap.Dispose()
|
||||
@@ -1921,6 +1922,12 @@ function Check-Item-Icon-Cutout([string]$Icon, [string]$Context) {
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Item-Icon-Cutout([string]$Icon, [string]$Context) {
|
||||
$relativePath = $Icon.Substring("res://".Length)
|
||||
$absolutePath = [System.IO.Path]::GetFullPath((Join-Path ([System.IO.Path]::GetFullPath($Root)) $relativePath))
|
||||
Check-Alpha-Cutout-File $absolutePath $Icon $Context
|
||||
}
|
||||
|
||||
function Check-Post-Battle-Dialogue($Dialogue, [string]$ScenarioId) {
|
||||
if ($null -eq $Dialogue) {
|
||||
return
|
||||
|
||||