Wolf3DExtract icon indicating copy to clipboard operation
Wolf3DExtract copied to clipboard

problem in map_extract

Open JO0238962 opened this issue 11 months ago • 4 comments

First: nice and good project !

I want to report an error in map_extract functionality. I used the project for some time, but after some time I saw a problem. I think it is something with the compression part.

I work with Win10 64 bit

  • mostly with cygwin64 and gcc as compiler

We can make the assumption that on the border (x==0 or x==63 or y==0 or y==63) of the map [0..63]x[0..63] is a wall. Therefore I first was searching only for "leaks" (no walls on border).

With the Wolf3D map editor(s) I saw differences (when I compared the editor results and my pictures based on map_extract), but they have no source code. Later I made with another program a comparison on each field. My own program now is based on https://github.com/cxong/cwolfmap . I can upload comparison pictures.

WL6 (Wolfenstein3D Activision Version or Apogee 1.4): I see a problem with 4 maps (of the 60 maps) at the end of the map. You get no dump. The filesize is also o.k. The data are wrong if you visualize the data or use it for other things.

Problem in Map E1M5 Leak in Map E4M5
Leak in Map E5M1
Leak in Map E6M10

WL9 ( https://www.moddb.com/mods/wolfenstein-3d-definitive-edition/downloads/wolfenstein-3d-30th-anniversary-edition ) Leak in Map E1M2
Leak in Map E2M5 Leak in Map E4M1
Leak in Map E4M2
Leak in Map E5M1
Leak in Map E7M6
Leak in Map E8M3 Leak in Map E8M5
Leak in Map E8M6
Leak in Map E8M7
Leak in Map E8M8
Leak in Map E9M3
Leak in Map E9M5

Some more tested WL6-Mods have also problems.

The Spear of Destiny games (SOD/SD2/SD3/RIP) seems to be o.k.

Blake Stone (BS6) has more problems. Perhaps it is not suppported.

Could you please check ? I know it is/was an older project ... I will upload one file as attachment.

Image

JO0238962 avatar Jan 21 '25 19:01 JO0238962

Oh wow, this is a real blast from the past. I was much less experience back then, I had just learned C, I did not use automated testing and my debugger was printf. To be honest I don't know if I even want to go back to this, and if I did I would probably rewrite most of it. Are you relying on my extractor for something?

HiPhish avatar Jan 26 '25 17:01 HiPhish

I will share some sides from my analysis the last days. For you and the community ....if somebody reads this

(A) https://moddingwiki.shikadi.net/wiki/GameMaps_Format we have "RLEW + Carmackization - Compression" (now say Wolf3D Games) we have "RLEW-only - Compression" (now say BlakeStone Games)

(B) https://github.com/vpoupet/wolfenstein/blob/master/docs/files.md or https://vpoupet.github.io/wolfenstein/docs/files (very good with specification)

Sure, every Source Port has the extract-map-coding, but not very isolated. So these are my sides I want to recommend for map extracting.

(1) https://github.com/cxong/cwolfmap - support Wolf3D Games + BlakeStone Games you must add some own code

(2) https://github.com/vpoupet/wolfenstein --> see the addtional python part instead of javascript part https://github.com/vpoupet/wolfenstein/tree/master/python - support Wolf3D Games - with quick+easy code change -> support BlakeStone Games you must add some own code

(3) https://github.com/HiPhish/Wolf3DExtract - support Wolf3D Games No own code needed :-)

so, forget my last remark in the first message that BS6 has problems -> it's not supported by design .. ok

(4) I wrote a program based on spec of (B) - support BlakeStone Games (the easy part)

I plan to write the Wolf3D part this week if I have time ...

Perhaps then it is easier for me to understand where the problem in your coding is.

You said "Writing new is easier than searching the error". Perhaps this is the truth in this special case.

To your questions: For me it is not important that there is a (fast) correction. I only think that you should report problems if the project is good. For bad projects I would never report an error.

What I did with your code: I write/wrote from time-to-time on a Wolf3d-to-Quake Converter. Just for Fun. So I get the Wolf3D-Level-Description and created the map format which can be compiled with BSP compiler and then play with Quake-SourcePorts.

Good Luck, if you search the problem ...

JO0238962 avatar Jan 27 '25 18:01 JO0238962

hello , I think I found the error: Not in the decompression. In file map_extract/map_extract.c In method word *load_map(FILE *gamemaps, struct level_header *header, uint map) {

the length of RLEW compression in byte is always even ==> o.k. x = y/2 the length of Carmack compression in byte can be even or odd ==> therefore x = y/2 +1

Here my changed coding: line 150 the missing "+1" is important

line 143: word *carmack_buffer = malloc(header->cc_length[map] * sizeof(word)); // too big (header->cc_length[map])/2 + 1 is enough

Line 150: // fread(carmack_buffer, sizeof(word), header->cc_length[map] / 2, gamemaps); // the length is in bytes // this is NOT enough !! fread(carmack_buffer, sizeof(word), header->cc_length[map] / 2 + 1, gamemaps); // read 1 byte (or word) more

Line 163: // --carmack_buffer; // move the Carmack buffer back one word to go back to the word we skipped earlier // needed ?

best regards

JO0238962 avatar Feb 19 '25 18:02 JO0238962

a little additional remark to my last comment:

wrong: fread(carmack_buffer, sizeof(word), header->cc_length[map] / 2, gamemaps); good : fread(carmack_buffer, sizeof(word), header->cc_length[map] / 2 + 1, gamemaps); better: fread(carmack_buffer, sizeof(word), (header->cc_length[map] +1) / 2 , gamemaps);

JO0238962 avatar Feb 19 '25 19:02 JO0238962