Error in LAY1 Excel spreadsheet

Use this forum to discuss dungeon editors and other tools, like DMute (by George Gilbert, also working for RTC dungeons), DM Builder (by Sphenx), and ADGE by `rain. Includes DM editing tips and tricks.
Forum rules
Please read the Forum rules and policies before posting.
Post Reply
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

Not sure if you will fix this, but there is an error in the excel sheet for LAY1 Info: 2nd Tab: Comments:
Line: 884-887:
Coordinates to display door button D3 on the right 1A38 6712 828 0000 0004 00c7 0029 199 41 1950 079E
D3 on the left 1A40 6720 829 0000 0004 008b 002b 139 43 1951 079F
D2 straight ahead 1A48 6728 830 0000 0004 0099 002d 153 45 1952 07A0
D1 straight ahead 1A50 6736 831 0000 0004 00ab 0030 171 48 1953 07A1

Should say:
Coordinates to display door button D3 on the right 1A38 6712 828 0000 0004 00c7 0029 199 41 1950 079E
D3 straight ahead 1A40 6720 829 0000 0004 008b 002b 139 43 1951 079F
D2 straight ahead 1A48 6728 830 0000 0004 0099 002d 153 45 1952 07A0
D1 straight ahead 1A50 6736 831 0000 0004 00ab 0030 171 48 1953 07A1

The values listed there is for D1, D2, D3 Center and D3 right and not D3 left/right.

Cheers
C.
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Error in LAY1 Excel spreadsheet

Post by ChristopheF »

Thank you, I have uploaded a fixed spreasheet.
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

overall i like the spreadsheet. when you know how to use the colors.. its perfect :-) Good work.

oh and another possible fix: You are using R/L in French: D/G .. Was confusing.
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Error in LAY1 Excel spreadsheet

Post by ChristopheF »

I did not build this spreadsheet myself so all credits go to "Jean-Claude" who did all this work
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

I read that, is he in forum? ;-) If i got time, i will update it in more english maybe.
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Error in LAY1 Excel spreadsheet

Post by ChristopheF »

I don't think he has an account here. We corresponded by mail years ago.
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

Another Error:
[X] Y coordinates to display wall texts 1st Wall text line
2nd Wall text line
3rd Wall text line
4th wall text line

Line 615-618:

it has to be the other way round. Since we are aligned to bottom.. the higher the Y is, the higher it is blitted:
112 48
112 59
112 73
112 85

so, first is Text4, then 3, then 2 then 1.

Cheers
C.
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

Forget it my fault. forget that the font needs an offset of 32 for the player space .. ;-) so all ok.. fits.
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

Hey Christophe,

i got an understanding problem in LAY1. im extracting now the data directly and in Group 0:
Group #0:
index align parent coords
#1 9 [0] [320-200]
#2 1 [1] [0-0]
#3 9 [0] [224-136]
#4 1 [3] [0-0]
#5 10 [2] [0-0]
#6 10 [4] [0-0]
#7 1 [3] [0-33]
#8 9 [2] [87-45]
#9 3 [8] [319-168]
#10 9 [2] [87-45]
#11 2 [10] [319-77]
#12 9 [2] [87-33]
#13 3 [12] [319-74]
#14 9 [2] [320-27]
#15 4 [14] [0-199]
#16 9 [2] [87-6]

the first one are self explantory:
item 1
item 2 - item 1
320x200 - 0,0

now to the understanding:
no 6 -> Parent 4 = 0,0 so its 0,0 - 0,0 ? doesnt make sense or?

or do i have to iterate:

Item 6- item 4- item 3
0,0 0,0 223,136

why does the game use this iteration?

oh and the excel sheet is also there a bit confusing.. sorry :)
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

ahh, i found it here:
"In order to get the absolute coordinates, the full list of linked records must be processed."
so i need to iterate..
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

there is an error in the excel sheet. It stops at 436 in line 90.. but there are 2 more values there..
{"self": 437, "align": 10, "parent": 2, "x": 0, "y": 52, "info": "C437_ZONE_ENDGAME_RESTART_THIS_GAME"},
{"self": 438, "align": 10, "parent": 2, "x": 0, "y": 77, "info": "C438_ZONE_ENDGAME_QUIT"},

i coded in python the CalcAlign from the C code.. looks good:

Code: Select all

Getting Val for: C007_ZONE_VIEWPORT
0 33 224 136
Getting Val for: C700_ZONE_VIEWPORT_CEILING_AREA
0 0 224 39
Getting Val for: C701_ZONE_VIEWPORT_FLOOR_AREA
0 39 224 97
Getting Val for: C002_ZONE_SCREEN
0 0 320 200
Getting Val for: C004_ZONE_EXPLOSION_PATTERN_D0C
0 0 224 136
Getting Val for: C005_ZONE_SCREEN_CENTERED_DIALOG
0 0 224 136
Getting Val for: C006_ZONE_VIEWPORT_CENTERED_TEXT
0 0 224 136
Getting Val for: C007_ZONE_VIEWPORT
0 33 224 136
Getting Val for: C009_ZONE_MOVEMENT_ARROWS
233 124 85 43
Getting Val for: C011_ZONE_ACTION_AREA
233 77 85 45
Getting Val for: C013_ZONE_SPELL_AREA
233 42 85 31
Getting Val for: C015_ZONE_MESSAGE_AREA
0 173 320 25
Getting Val for: C017_ZONE_LEADER_HAND_OBJECT_NAME
233 33 87 6
Only compain to the author of lay1: he should have putten a flag somewhere telling you: this is a global dimension, this is a dimension which is in another..
GetZone() from C Source -> only takes global if you have a zone which is relative (C700/C701) you need to call directly calcAlign.
:roll: :roll: :roll: :roll: :roll:
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Error in LAY1 Excel spreadsheet

Post by ChristopheF »

The excel spreadsheet was made from the PC version of DM. I see only range 400 to 436 in that file... Are you referring to another version or am I missing something?
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

Hmmm, ok, i use the graphics.dat from the Amiga Version. Its also referenced in DEFS.h

ok had a look: C437_ZONE_ENDGAME_RESTART_THIS_GAMEis referenced here in Amiga Version (ENDGAME.C):

Code: Select all

                        F1011_(C437_ZONE_ENDGAME_RESTART_THIS_GAME, "RESTART THIS GAME", G0446_as_Graphic561_PrimaryMouseInput_RestartGame);
in PC Version, they use static data:

Code: Select all

                       F0732_FillScreenArea(G2019_ai_XYZ_Endgame_Restart_Outer, C01_COLOR_DARK_GRAY);
                        F0732_FillScreenArea(G2020_ai_XYZ_Endgame_Restart_Inner, C00_COLOR_BLACK);
The C438_ZONE_ENDGAME_QUIT is used here:

Code: Select all

#ifdef MEDIA760_A36M_A35M
                        F1011_(C438_ZONE_ENDGAME_QUIT, F0758_TranslateLanguage(C103_QUIT), &G0446_as_Graphic561_PrimaryMouseInput_RestartGame[1]);
#endif
MEDIA760? Isnt A35M/A36M Amiga? in the extracted AmigaSource it wont show up.
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Error in LAY1 Excel spreadsheet

Post by ChristopheF »

MEDIA760? Isnt A35M/A36M Amiga?
A35M is CSB Amiga 3.5 multilanguage and A36M is DM Amiga 3.6 multilanguage.
You may find the full list of media values and their descriptions in the ReDMCSB_WIP20210206.7z archive, in the 'Documentation' folder, in the 'ReDMCSB.xlsx' file, in the 'Media' tab.
in the extracted AmigaSource it wont show up
How did you extract the source? Maybe you only extracted versions 2.x?
Cycl0ne
Craftsman
Posts: 103
Joined: Mon Apr 19, 2010 11:33 am

Re: Error in LAY1 Excel spreadsheet

Post by Cycl0ne »

hmm i used the modified powershell script from you:

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
)

#Set-ExecutionPolicy Unrestricted

# 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)
				}
		}
}
With TAGS: A35M_A36M. But doesnt matter. As you can see in the post above.. both values are there in lay1 and used.
Post Reply

Return to “Editors and Tools (DMute, DM Builder, ADGE, etc.)”