Technical Questions to the Game
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- ChristopheF
- Encyclopedist
- Posts: 1540
- Joined: Sun Oct 24, 1999 2:36 pm
- Location: France
- Contact:
Re: Technical Questions to the Game
Open D:\ReDMCSB\Toolchains\Common\Base\Start-ReDMCSBBuild.ps1 in a text editor
Copy the whole function named Copy-ReDMCSBCustomSource into a PowerShell window
Run this command line:
Copy-ReDMCSBCustomSource -InputPath D:\ReDMCSB\Toolchains\Common\Source -OutputPath D:\ReDMCSB\Output -TagSet "I34E_I34M"
Result will be in D:\ReDMCSB\Output\I34E_I34M
Copy the whole function named Copy-ReDMCSBCustomSource into a PowerShell window
Run this command line:
Copy-ReDMCSBCustomSource -InputPath D:\ReDMCSB\Toolchains\Common\Source -OutputPath D:\ReDMCSB\Output -TagSet "I34E_I34M"
Result will be in D:\ReDMCSB\Output\I34E_I34M
Christophe - Dungeon Master Encyclopaedia
Re: Technical Questions to the Game
Thanks for all these examples Cycl0ne, that's a good insight. I would definitively try more of these -- that might even help some works on DCS or SKWin ..
No modulo needed here, you're always between 0 and 3 for a tile and DM reference item tells on which quarter/face it is. In DCS, I actually handle float coordinates, but still need to know the quarter-position.
You generally draw far items before the closer ones.
You first get the quarter-position in tile of the item from this order 0 to 3 : NW - NE - SE - SW. If in alcove, its on the wall face N - E - S - W.@Sphenx: Can you give me please a peek into your flooritems calc/draw routine? im sitting here with paper and doing all stuff to convert my enums N,E,W,S with NE, SE, SW, NW -> (var+3)%4
No modulo needed here, you're always between 0 and 3 for a tile and DM reference item tells on which quarter/face it is. In DCS, I actually handle float coordinates, but still need to know the quarter-position.
You generally draw far items before the closer ones.
Re: Technical Questions to the Game
That i already do, but i only got an array where all items are stored on the tile and i iterate through the array. what the difficult for me (or my brain is).Sphenx wrote: ↑Fri Sep 22, 2023 9:35 am You first get the quarter-position in tile of the item from this order 0 to 3 : NW - NE - SE - SW. If in alcove, its on the wall face N - E - S - W.
No modulo needed here, you're always between 0 and 3 for a tile and DM reference item tells on which quarter/face it is. In DCS, I actually handle float coordinates, but still need to know the quarter-position.
You generally draw far items before the closer ones.
Im facing south, so all NE, NW are front and SE and SW are back, when im facing EAST -> SW and NW are front and SE/NE are back. This is something where i think i need modulo or?
Example of my WallDeco Source:
Code: Select all
// Confusing but true: if we look straight and have right a wall, then the items "left" need to be drawn
// this works, but normaly we have this.position-> need to check brainlogic here
if (this.position > Position.Center){
const leftIndex = cell.deco[(dir + 3) % 4]; // +3 represents the left direction
if (leftIndex && this.wallornateSide[leftIndex-1]) this.wallornateSide[leftIndex-1].setVisible(true);
} else
{
const rightIndex = cell.deco[(dir + 1) % 4];
if (rightIndex&& this.wallornateSide[rightIndex-1]) this.wallornateSide[rightIndex-1].setVisible(true);
}
}
Re: Technical Questions to the Game
Didnt work. there is for a milisecond a red error and the whole powershell window closes. i will see how i can get around thisChristopheF wrote: ↑Fri Sep 22, 2023 9:24 am Open D:\ReDMCSB\Toolchains\Common\Base\Start-ReDMCSBBuild.ps1 in a text editor
Copy the whole function named Copy-ReDMCSBCustomSource into a PowerShell window
Run this command line:
Copy-ReDMCSBCustomSource -InputPath D:\ReDMCSB\Toolchains\Common\Source -OutputPath D:\ReDMCSB\Output -TagSet "I34E_I34M"
Result will be in D:\ReDMCSB\Output\I34E_I34M
---
a suggestion for improvement Why dont you create small .bat files in a subfolder named: CreateSourceAmiga.bat, CreateSourcePC.bat,... for future people like me asking
- ChristopheF
- Encyclopedist
- Posts: 1540
- Joined: Sun Oct 24, 1999 2:36 pm
- Location: France
- Contact:
Re: Technical Questions to the Game
I use PowerShell version 5.1 on Windows 10. Can you check if you are using the same? Maybe it fails with newer versions.
Christophe - Dungeon Master Encyclopaedia
Re: Technical Questions to the Game
one failure: you need to call it from the dir common/base since you access Remove-Folder.ps1 which cant be found i f called from:ReDMCSB_WIP20210206/ dir.ChristopheF wrote: ↑Sat Sep 23, 2023 1:08 pm I use PowerShell version 5.1 on Windows 10. Can you check if you are using the same? Maybe it fails with newer versions.
still investigating. Even doing it with ps ISE, it hard closes the window
Running windows 11. Not sure which PS version.
Re: Technical Questions to the Game
It worked now. i changed the function to a script.. :
then i changed the restriction level of my os:
then it worked..
Code is now much better to read, whats still anoying:
#ifdef X707_I34E_I34M
#endif
cant we just leave them out, since im on a I34 Version?
Code: Select all
param(
[Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$InputPath,
[Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$OutputPath,
[Parameter(Mandatory=$true)][String[]]$TagSet
)
# Make sure MEDIA*.H files (containing '#define MEDIAxxx_' directives) are processed after all others
$SourceFiles = @()
$SourceFiles += (Get-Item "$InputPath\*.C")
$SourceFiles += (Get-Item "$InputPath\*.H" -Exclude "MEDIA*.H")
$SourceFiles += (Get-Item "$InputPath\MEDIA*.H")
if ($SourceFiles -eq $null) {
Write-Host "No source files found in input path [$InputPath], aborting."
exit
}
# Create empty output folder
$OutputFolderPath = "$OutputPath\$TagSet"
if (Test-Path -Path $OutputFolderPath -PathType Container) {
Remove-Item -Path $OutputFolderPath -Recurse -Force
}
$null = New-Item $OutputFolderPath -ItemType Directory -Force
if (-not (Test-Path -Path $OutputFolderPath -PathType Container)) {
Write-Host "Failed to create custom source folder [$OutputFolderPath], aborting."
exit
}
$OutputLine = New-Object -TypeName Bool[] -ArgumentList 100
$Tags = $TagSet -split "_"
$CompileTagsToXTags = @{}
$Encoding = [System.Text.Encoding]::GetEncoding("iso-8859-1")
foreach ($SourceFile in $SourceFiles) {
$StreamReader = New-Object -TypeName System.IO.StreamReader($SourceFile, $Encoding)
$OutputFileContent = New-Object -TypeName System.Text.StringBuilder
$CurrentDepth = 0
$FileHasContent = $false
$OutputLine[$CurrentDepth] = $true
while (-not $StreamReader.EndOfStream ) {
$SourceFileLine = $StreamReader.ReadLine()
if ($SourceFileLine -match "(?<StartOfLine>^\s*#define )(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") {
$TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)"
if ($CompileTagsToXTags.Contains($TagString)) {
if ($CompileTagsToXTags[$TagString] -ne $null) {
$null = $OutputFileContent.AppendLine("$($Matches.StartOfLine)$($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)")
}
}
continue
}
if ($SourceFileLine.StartsWith("#endif")) {
if ($OutputLine[$CurrentDepth]) {
$null = $OutputFileContent.AppendLine($SourceFileLine)
}
$CurrentDepth--
continue
}
if ($SourceFileLine.StartsWith("#if")) {
$CurrentDepth++
$OutputLine[$CurrentDepth] = $OutputLine[$CurrentDepth - 1]
if ($SourceFileLine -match "(^\s*#ifdef MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") {
$TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)"
$CompileTagSet = $Matches.TagSet
$CompileTags = $CompileTagSet.Split("_")
$CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent
if ($CommonTags -eq $null) {
$OutputLine[$CurrentDepth] = $false
} else {
$JoinedCommonTags = $CommonTags -join '_'
if ($OutputLine[$CurrentDepth]) {
if (-not $CompileTagsToXTags.Contains($TagString)) {
$CompileTagsToXTags.Add($TagString, "X$($Matches.TagId)_$($JoinedCommonTags)")
}
$null = $OutputFileContent.AppendLine("#ifdef $($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)")
}
}
continue
} else {
if ($OutputLine[$CurrentDepth]) {
$RegExMatches = ([regex]"(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)").Matches($SourceFileLine)
foreach ($RegExMatch in $RegExMatches) {
$TagString = $RegExMatch.Value
$CompileTagSet = $RegExMatch.Groups["TagSet"].Value
$CompileTags = $CompileTagSet.Split("_")
$CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent
if ($CommonTags -ne $null) {
$JoinedCommonTags = $CommonTags -join '_'
if (-not $CompileTagsToXTags.Contains($TagString)) {
$CompileTagsToXTags.Add($TagString, "X$($RegExMatch.Groups["TagId"].Value)_$($JoinedCommonTags)")
}
$SourceFileLine = $SourceFileLine -replace $TagString,$CompileTagsToXTags[$TagString]
}
}
$null = $OutputFileContent.AppendLine($SourceFileLine)
}
}
continue
}
if ($OutputLine[$CurrentDepth]) {
$FileHasContent = $true
$RegExMatches = ([regex]"(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)").Matches($SourceFileLine)
foreach ($RegExMatch in $RegExMatches) {
$TagString = $RegExMatch.Value
$CompileTagSet = $RegExMatch.Groups["TagSet"].Value
$CompileTags = $CompileTagSet.Split("_")
$CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent
if ($CommonTags -ne $null) {
$JoinedCommonTags = $CommonTags -join '_'
if (-not $CompileTagsToXTags.Contains($TagString)) {
$CompileTagsToXTags.Add($TagString, "X$($RegExMatch.Groups["TagId"].Value)_$($JoinedCommonTags)")
}
$SourceFileLine = $SourceFileLine -replace $TagString,$CompileTagsToXTags[$TagString]
}
}
$null = $OutputFileContent.AppendLine($SourceFileLine)
}
}
$StreamReader.Close()
if ($FileHasContent) {
$Content = $OutputFileContent.ToString()
if ($Content -ne "#ifndef COMPILE_H`r`n#include `"COMPILE.H`"`r`n#endif`r`n") {
[System.IO.File]::WriteAllText("$OutputFolderPath\$($SourceFile.Name)", $Content, $Encoding)
}
}
}
Code: Select all
Set-ExecutionPolicy Unrestricted
Code is now much better to read, whats still anoying:
#ifdef X707_I34E_I34M
#endif
cant we just leave them out, since im on a I34 Version?
Re: Technical Questions to the Game
Ah yes. Considering your display viewport and viewer facing, yes, there is array transposition and modulo involved depending on the rotation.
If you turn left, transpose +3 (or -1); if you turn right, transpose +1 (or -3). Then modulo 4.
You can consider this image, with the original position of items in the center, and the different viewport visions depending on orientation.
Hope this helps.
- ChristopheF
- Encyclopedist
- Posts: 1540
- Joined: Sun Oct 24, 1999 2:36 pm
- Location: France
- Contact:
Re: Technical Questions to the Game
Here is an updated version of the function that should fix the issue and get rid of the useless #defines :
Code: Select all
function Copy-ReDMCSBCustomSource {
Param(
[Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$InputPath,
[Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$OutputPath,
[Parameter(Mandatory=$true)][String[]]$TagSet
)
# Make sure MEDIA*.H files (containing '#define MEDIAxxx_' directives) are processed after all others
$SourceFiles = @()
$SourceFiles += (Get-Item "$InputPath\*.C")
$SourceFiles += (Get-Item "$InputPath\*.H" -Exclude "MEDIA*.H")
$SourceFiles += (Get-Item "$InputPath\MEDIA*.H")
if ($SourceFiles -eq $null) {
Write-Host "No source files found in input path [$InputPath], aborting."
pause
}
# Create empty output folder
$OutputFolderPath = "$OutputPath\$TagSet"
if (Test-Path -Path $OutputFolderPath -PathType Container) {
& "D:\ReDMCSB\Toolchains\Common\Base\Remove-Folder.ps1" -Path $OutputFolderPath -TemporaryPath $OutputPath
if (Test-Path -Path $OutputFolderPath -PathType Container) {
Write-Host "Failed to delete custom source folder [$OutputFolderPath], aborting."
pause
}
}
$null = New-Item $OutputFolderPath -ItemType Directory -Force
if (-not (Test-Path -Path $OutputFolderPath -PathType Container)) {
Write-Host "Failed to create custom source folder [$OutputFolderPath], aborting."
pause
}
$OutputLine = New-Object -TypeName Bool[] -ArgumentList 100
$OutputTag = New-Object -TypeName Bool[] -ArgumentList 100
$Tags = $TagSet -split "_"
$CompileTagsToXTags = @{}
$Encoding = [System.Text.Encoding]::GetEncoding("iso-8859-1")
foreach ($SourceFile in $SourceFiles) {
$StreamReader = New-Object -TypeName System.IO.StreamReader($SourceFile, $Encoding)
$OutputFileContent = New-Object -TypeName System.Text.StringBuilder
$CurrentDepth = 0
$FileHasContent = $false
$OutputLine[$CurrentDepth] = $true
$OutputTag[$CurrentDepth] = $true
while (-not $StreamReader.EndOfStream ) {
$SourceFileLine = $StreamReader.ReadLine()
if ($SourceFileLine -match "(?<StartOfLine>^\s*#define )(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") {
$TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)"
# Translate MEDIA tag to X tag
if ($CompileTagsToXTags.Contains($TagString)) {
if ($CompileTagsToXTags[$TagString] -ne $null) {
$null = $OutputFileContent.AppendLine("$($Matches.StartOfLine)$($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)")
}
}
continue
}
if ($SourceFileLine.StartsWith("#endif")) {
if ($OutputTag[$CurrentDepth]) {
$null = $OutputFileContent.AppendLine($SourceFileLine)
}
$CurrentDepth--
continue
}
if ($SourceFileLine.StartsWith("#if")) {
$CurrentDepth++
$OutputLine[$CurrentDepth] = $OutputLine[$CurrentDepth - 1]
$OutputTag[$CurrentDepth] = $OutputTag[$CurrentDepth - 1]
if ($SourceFileLine -match "(^\s*#ifdef MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") {
$TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)"
$CompileTagSet = $Matches.TagSet
$CompileTags = $CompileTagSet.Split("_")
$CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent
if ($CommonTags -eq $null) {
$OutputLine[$CurrentDepth] = $false
$OutputTag[$CurrentDepth] = $false
} else {
$JoinedCommonTags = ($CommonTags | Sort-Object) -join '_'
if ($OutputLine[$CurrentDepth]) {
if (-not $CompileTagsToXTags.Contains($TagString)) {
$CompileTagsToXTags.Add($TagString, "X$($Matches.TagId)_$($JoinedCommonTags)")
}
if ($OutputLine[$CurrentDepth]) {
if ($JoinedCommonTags -ne $TagSet) {
$null = $OutputFileContent.AppendLine("#ifdef $($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)")
$OutputTag[$CurrentDepth] = $true
} else {
$OutputTag[$CurrentDepth] = $false
}
}
}
}
continue
} else {
# Search for MEDIA tags on an #if line and map them to their corresponding X tags
if ($OutputLine[$CurrentDepth]) {
$OutputTag[$CurrentDepth] = $true
$RegExMatches = ([regex]"(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)").Matches($SourceFileLine)
foreach ($RegExMatch in $RegExMatches) {
$TagString = $RegExMatch.Value
$CompileTagSet = $RegExMatch.Groups["TagSet"].Value
$CompileTags = $CompileTagSet.Split("_")
$CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent
if ($CommonTags -ne $null) {
$JoinedCommonTags = $CommonTags -join '_'
if (-not $CompileTagsToXTags.Contains($TagString)) {
$CompileTagsToXTags.Add($TagString, "X$($RegExMatch.Groups["TagId"].Value)_$($JoinedCommonTags)")
}
$SourceFileLine = $SourceFileLine -replace $TagString,$CompileTagsToXTags[$TagString]
}
}
}
}
}
if ($OutputLine[$CurrentDepth]) {
$null = $OutputFileContent.AppendLine($SourceFileLine)
if ($CurrentDepth -gt 0) {
$FileHasContent = $true
}
}
}
$StreamReader.Close()
if ($FileHasContent) {
$Content = $OutputFileContent.ToString()
if ($Content -ne "#ifndef COMPILE_H`r`n#include `"COMPILE.H`"`r`n#endif`r`n") {
[System.IO.File]::WriteAllText("$OutputFolderPath\$($SourceFile.Name)", $Content, $Encoding)
}
}
}
}
Christophe - Dungeon Master Encyclopaedia
Re: Technical Questions to the Game
Yesx this i have on paper, but i still cant figure out how i can do it computional. i could go with a switch() and then a case. The thing is, my code works like a popup cardSphenx wrote: ↑Sat Sep 23, 2023 7:18 pm Ah yes. Considering your display viewport and viewer facing, yes, there is array transposition and modulo involved depending on the rotation.
If you turn left, transpose +3 (or -1); if you turn right, transpose +1 (or -3). Then modulo 4.
You can consider this image, with the original position of items in the center, and the different viewport visions depending on orientation.
Hope this helps.
so all gfx are there in a manager and i just say: .setVisible(true) and false with the coordinates already stored in the image itself. But in the situation of the items now this is new for me (and where i have to think about it) since the grafic engine now has to display the gfx with coordinates and not just say: oh i see you there: .setvisible(true). so in the array i need to pick out the gfx and print it to screen to the position calculated. so yes, maybe with a switch().
DSB in its source 0.74 does it more traditional and just calls a function (drawflooritems) with a parameter D1-D3 and a view parameter (x+3)%4. And then comes alot of boring code. im checking for all sorts of things. i want it sleak and nice
ps: should i split this threas? one for the DeCSB and one for "coding" for dummies?
Re: Technical Questions to the Game
ill give it a try. Worked, but some are still there. but ok.ChristopheF wrote: ↑Sat Sep 23, 2023 7:35 pm Here is an updated version of the function that should fix the issue and get rid of the useless #defines :
Code: Select all
function Copy-ReDMCSBCustomSource { Param( [Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$InputPath, [Parameter(Mandatory=$true)][ValidateScript({Test-Path -Path $_ -PathType Container})][String]$OutputPath, [Parameter(Mandatory=$true)][String[]]$TagSet ) # Make sure MEDIA*.H files (containing '#define MEDIAxxx_' directives) are processed after all others $SourceFiles = @() $SourceFiles += (Get-Item "$InputPath\*.C") $SourceFiles += (Get-Item "$InputPath\*.H" -Exclude "MEDIA*.H") $SourceFiles += (Get-Item "$InputPath\MEDIA*.H") if ($SourceFiles -eq $null) { Write-Host "No source files found in input path [$InputPath], aborting." pause } # Create empty output folder $OutputFolderPath = "$OutputPath\$TagSet" if (Test-Path -Path $OutputFolderPath -PathType Container) { & "D:\ReDMCSB\Toolchains\Common\Base\Remove-Folder.ps1" -Path $OutputFolderPath -TemporaryPath $OutputPath if (Test-Path -Path $OutputFolderPath -PathType Container) { Write-Host "Failed to delete custom source folder [$OutputFolderPath], aborting." pause } } $null = New-Item $OutputFolderPath -ItemType Directory -Force if (-not (Test-Path -Path $OutputFolderPath -PathType Container)) { Write-Host "Failed to create custom source folder [$OutputFolderPath], aborting." pause } $OutputLine = New-Object -TypeName Bool[] -ArgumentList 100 $OutputTag = New-Object -TypeName Bool[] -ArgumentList 100 $Tags = $TagSet -split "_" $CompileTagsToXTags = @{} $Encoding = [System.Text.Encoding]::GetEncoding("iso-8859-1") foreach ($SourceFile in $SourceFiles) { $StreamReader = New-Object -TypeName System.IO.StreamReader($SourceFile, $Encoding) $OutputFileContent = New-Object -TypeName System.Text.StringBuilder $CurrentDepth = 0 $FileHasContent = $false $OutputLine[$CurrentDepth] = $true $OutputTag[$CurrentDepth] = $true while (-not $StreamReader.EndOfStream ) { $SourceFileLine = $StreamReader.ReadLine() if ($SourceFileLine -match "(?<StartOfLine>^\s*#define )(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") { $TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)" # Translate MEDIA tag to X tag if ($CompileTagsToXTags.Contains($TagString)) { if ($CompileTagsToXTags[$TagString] -ne $null) { $null = $OutputFileContent.AppendLine("$($Matches.StartOfLine)$($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)") } } continue } if ($SourceFileLine.StartsWith("#endif")) { if ($OutputTag[$CurrentDepth]) { $null = $OutputFileContent.AppendLine($SourceFileLine) } $CurrentDepth-- continue } if ($SourceFileLine.StartsWith("#if")) { $CurrentDepth++ $OutputLine[$CurrentDepth] = $OutputLine[$CurrentDepth - 1] $OutputTag[$CurrentDepth] = $OutputTag[$CurrentDepth - 1] if ($SourceFileLine -match "(^\s*#ifdef MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)(?<EndOfLine>.*)") { $TagString = "MEDIA$($Matches.TagId)$($Matches.TagSet)" $CompileTagSet = $Matches.TagSet $CompileTags = $CompileTagSet.Split("_") $CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent if ($CommonTags -eq $null) { $OutputLine[$CurrentDepth] = $false $OutputTag[$CurrentDepth] = $false } else { $JoinedCommonTags = ($CommonTags | Sort-Object) -join '_' if ($OutputLine[$CurrentDepth]) { if (-not $CompileTagsToXTags.Contains($TagString)) { $CompileTagsToXTags.Add($TagString, "X$($Matches.TagId)_$($JoinedCommonTags)") } if ($OutputLine[$CurrentDepth]) { if ($JoinedCommonTags -ne $TagSet) { $null = $OutputFileContent.AppendLine("#ifdef $($CompileTagsToXTags[$TagString])$($Matches.EndOfLine)") $OutputTag[$CurrentDepth] = $true } else { $OutputTag[$CurrentDepth] = $false } } } } continue } else { # Search for MEDIA tags on an #if line and map them to their corresponding X tags if ($OutputLine[$CurrentDepth]) { $OutputTag[$CurrentDepth] = $true $RegExMatches = ([regex]"(MEDIA)(?<TagId>\d\d\d)(?<TagSet>_[a-zA-Z0-9_]*)").Matches($SourceFileLine) foreach ($RegExMatch in $RegExMatches) { $TagString = $RegExMatch.Value $CompileTagSet = $RegExMatch.Groups["TagSet"].Value $CompileTags = $CompileTagSet.Split("_") $CommonTags = Compare-Object -ReferenceObject $CompileTags -DifferenceObject $Tags -PassThru -IncludeEqual -ExcludeDifferent if ($CommonTags -ne $null) { $JoinedCommonTags = $CommonTags -join '_' if (-not $CompileTagsToXTags.Contains($TagString)) { $CompileTagsToXTags.Add($TagString, "X$($RegExMatch.Groups["TagId"].Value)_$($JoinedCommonTags)") } $SourceFileLine = $SourceFileLine -replace $TagString,$CompileTagsToXTags[$TagString] } } } } } if ($OutputLine[$CurrentDepth]) { $null = $OutputFileContent.AppendLine($SourceFileLine) if ($CurrentDepth -gt 0) { $FileHasContent = $true } } } $StreamReader.Close() if ($FileHasContent) { $Content = $OutputFileContent.ToString() if ($Content -ne "#ifndef COMPILE_H`r`n#include `"COMPILE.H`"`r`n#endif`r`n") { [System.IO.File]::WriteAllText("$OutputFolderPath\$($SourceFile.Name)", $Content, $Encoding) } } } }
Source looks now really nice and readable. so readable that im temping to put it on my list to transcode this to Javascript for a 1:1 conversion
Re: Technical Questions to the Game
I think I was not following correctly your issue on that one. So now you have to write the manager code for these pink / blue / red / green balloons At some point, even for OO, some logic has to be coded, isn't it ? at least prepare some parameters for other methods/objects. I shall pop up later then.
Re: Technical Questions to the Game
yes i have to think about it. if i follow my path with popup i will need to create 27 sprite for each item possible on floor, since you can have in D0C 2, in D1C 4, in D1L, 3, ... this combined with 84 items in game. not sure if this will be some stupid memory overhead (and before you say it: yes and 7 possible positions in wall (alcove)).
I think i have to leave my path, since in my world only one item can be there, if there are two or three rocks.. wont work.. ok i will think about an array and blit approach..
I think i have to leave my path, since in my world only one item can be there, if there are two or three rocks.. wont work.. ok i will think about an array and blit approach..