DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

Mapedit 8.5 doesn't work with higher wall addresses
Page 1 of 1
DieHard Wolfers Forum Index -> Mapping Mania View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 589
Location: New Jersey, USA
usa.gif

PostPosted: Sun Feb 15, 2015 6:41 am
   Subject: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

When adding over 64 walls using Chris' tutorial MAXWALLTILES/MAXDOORS - Removing the hard coded limits, the newly-added walls will cause Mapedit 8.5 to not start, complaining about "Too many items in the MAPDATA.WL6 file" - even if you add only one of the new walls, so the message itself is faulty.

In my new EXE, I used WALLSHIFT 7, and added an offset of 1000 to the new walls, as Chris did in his example. Everything works fine in ChaosEdit and in the game itself, but the mapper's preference is Mapedit 8.5.

Is there any way to get Mapedit 8.5 updated to bypass this annoying checking for addresses? Older versions of Mapedit did not check for addresses like this, though they did fail at some point (4.2 comes to mind). Mapedit 7.2 does work with the new data, but has some unacceptable bugs and is lacking in some functionality, so is not considered a long-term solution for this mapper.

I notice that versions 8.4 and 8.5 do not have source code released with them (presumably because 8.x was made to prevent shareware editing) so I assume Chris hex-edited the EXE to create 8.5.

If 8.5 cannot be hex-edited to bypass the address checking, perhaps 7.2 can be updated to work more like 8.5, since that version does have the source code included.

Thanks,
Andy
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:38 ago.

Topics: 160
Posts: 8008
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Feb 15, 2015 11:42 am
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Andy_Nonymous wrote:
I notice that versions 8.4 and 8.5 do not have source code released with them (presumably because 8.x was made to prevent shareware editing) so I assume Chris hex-edited the EXE to create 8.5.
The patch was done through an "EXE patch" program done by the makers of Turbo Pascal. The original EXEs compiled with Turbo Pascal crashed in many cases. The patch utility simply changes the EXE's content so the crash doesn't happen.

Quote:
If 8.5 cannot be hex-edited to bypass the address checking, perhaps 7.2 can be updated to work more like 8.5, since that version does have the source code included.
I'm all for having the code updated to v8.6. BT was planning on having the the code updated himself, but - the last time I checked - he didn't know how to get the Clipboard function working.

I still have the original Pascal programming book that came with my 80286, and it was specifically written for Turbo Pascal. So let me know if I can consult anything in the book for you. Smile
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

Topics: 55
Posts: 2115
Location: Canada
blank.gif

PostPosted: Sun Feb 15, 2015 9:13 pm
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Andy_Nonymous wrote:
In my new EXE, I used WALLSHIFT 7, and added an offset of 1000 to the new walls, as Chris did in his example. Everything works fine in ChaosEdit and in the game itself, but the mapper's preference is Mapedit 8.5.

I should update that tutorial. A better solution than starting at 1000 is to shift the doors and floorcodes up, so that walls can use all the first tiles (I believe this is the way Havoc did it as well). This is because at least deaf guards still check if the value is equal to or above AREATILE, so if there are walls above the floorcodes, they may still be interpreted as floorcodes here.

I can confirm that Mapedit 8.5 only seems to go up to 768 (nice catch!), so the workaround above should work, if you shift the doors and floorcodes up by, say 512, which would put the walls at 1-601, doors at 602-613, and floorcodes at 618-655. I think these areas you would need to change in the source instead of the purple code in the original for that to work:

WL_DEF.H
::: CODE :::
//
// tile constants
//

#define ICONARROWS      90
#define PUSHABLETILE    98
#define EXITTILE        99          // at end of castle
#define AREATILE        619         // first of NUMAREAS floor tiles
#define NUMAREAS        37
#define ELEVATORTILE    21
#define AMBUSHTILE      618
#define ALTELEVATORTILE 619

#define NUMBERCHARS     9

WL_GAME.CPP
::: CODE :::
//
// copy the wall data to a data segment array
//
    memset (tilemap,0,sizeof(tilemap));
    memset (actorat,0,sizeof(actorat));
    map = mapsegs[0];
    for (y=0;y<mapheight;y++)
    {
        for (x=0;x<mapwidth;x++)
        {
            tile = *map++;
            if (tile<AREATILE)
            {
                // solid wall
                tilemap[x][y] = (byte) tile;
                actorat[x][y] = (objtype *)(uintptr_t) tile;
            }
            else

            {
                // area floor
                tilemap[x][y] = 0;
                actorat[x][y] = 0;
            }
        }
    }

//
// spawn doors
//
    InitActorList ();                       // start spawning things with a clean slate
    InitDoorList ();
    InitStaticList ();

    map = mapsegs[0];
    for (y=0;y<mapheight;y++)
    {
        for (x=0;x<mapwidth;x++)
        {
            tile = *map++;
            if (tile >= 602 && tile <= 613)
            {
                // door
                switch (tile)
                {
                    case 602:
                    case 604:
                    case 606:
                    case 608:
                    case 610:
                    case 612:
                        SpawnDoor (x,y,1,(tile-602)/2);
                        break;
                    case 603:
                    case 605:
                    case 607:
                    case 609:
                    case 611:
                    case 613:
                        SpawnDoor (x,y,0,(tile-603)/2);
                        break;
                }
            }
        }
    }

MAPDATA.WL6 (mapedit definition file)
::: CODE :::
003f 1540 Garbled image 10
0040 1440 Wall 64
0041 1440 Wall 65
0042 1440 Wall 66

...etc...
0259 1440 Wall 601
0260 4070 Stuck door-N/S holo
0261 4060 Stuck door-E/W holo
025a 7070 Unlocked door-E/W
025b 7060 Unlocked door-N/S
025c e070 Locked door-E/W
025d e060 Locked door-N/S
025e b070 Locked door-E/W
025f b060 Locked door-N/S
0264 e00 Elevator door-E/W
0265 e00 Elevator door-N/S
026a 71d0 Deaf guard
026b e0d0 In elevator to secret floor
026c 0350 Floor
026d 0450 Floor
026e 0550 Floor
...etc...
028f 80c0 Floor

I didn't test this so there might be more changes needed. I just used "+512" because it's easy to change the 0s to 2s. "+39" (walls 1-128, 129-140 doors, floors 145-182) or "+625" (walls 1-714, doors 715-726, floors 731-768) would work just as well.

If you already have levels made in the original format, feel free to send them to my email and I'll convert them. Smile

You could also change "1000" to "200" in the purple version and it would use 264+ (for example), I just picked 1000 because it was an easy round number, but I would take extra care with it to find occurrences of AREATILE and change them like this too:

WL_GAME.CPP
::: CODE :::
//
// take out the ambush markers
//
    map = mapsegs[0];
    for (y=0;y<mapheight;y++)
    {
        for (x=0;x<mapwidth;x++)
        {
            tile = *map++;
            if (tile == AMBUSHTILE)
            {
                tilemap[x][y] = 0;
                if ( (unsigned)(uintptr_t)actorat[x][y] == AMBUSHTILE)
                    actorat[x][y] = NULL;

                if (*map >= AREATILE && *map < (AREATILE+NUMAREAS))
                    tile = *map;
                if (*(map-1-mapwidth) >= AREATILE && *(map-1-mapwidth) < (AREATILE+NUMAREAS))
                    tile = *(map-1-mapwidth);
                if (*(map-1+mapwidth) >= AREATILE && *(map-1+mapwidth) < (AREATILE+NUMAREAS))
                    tile = *(map-1+mapwidth);
                if ( *(map-2) >= AREATILE && *(map-2) < (AREATILE+NUMAREAS))
                    tile = *(map-2);

                *(map-1) = tile;
            }
        }
    }

WL_ACT2.CPP
::: CODE :::
    map = mapsegs[0]+(tiley<<mapshift)+tilex;
    tile = *map;
    if (tile == AMBUSHTILE)
    {
        tilemap[tilex][tiley] = 0;

        if (*(map+1) >= AREATILE && *(map+1) < (AREATILE+NUMAREAS))
            tile = *(map+1);
        if (*(map-mapwidth) >= AREATILE && *(map-mapwidth) < (AREATILE+NUMAREAS))
            tile = *(map-mapwidth);
        if (*(map+mapwidth) >= AREATILE && *(map+mapwidth) < (AREATILE+NUMAREAS))
            tile = *(map+mapwidth);
        if ( *(map-1) >= AREATILE && *(map-1) < (AREATILE+NUMAREAS))
            tile = *(map-1);

(if you have under 90 walls though, neither this red code or any purple code should be necessary at all... I believe)



Andy_Nonymous wrote:
Older versions of Mapedit did not check for addresses like this, though they did fail at some point (4.2 comes to mind). Mapedit 7.2 does work with the new data, but has some unacceptable bugs and is lacking in some functionality

What are some of the bugs you noticed? I noticed that older versions which don't have a MAPSWAP dir can crash if you scroll through about 50 large maps (like the ones in Conflict in the Fatherland) if they're opened with less than 600k of main memory.

Tricob wrote:
I'm all for having the code updated to v8.6. BT was planning on having the the code updated himself, but - the last time I checked - he didn't know how to get the Clipboard function working.

Same here. I found that thread where Brothertank was talking about his Mapedit 9 progress (based off 7.x):

http://diehardwolfers.areyep.com/viewtopic.php?p=65537#65537

I've gotten the 4.1 and 7.2 source code to compile and work using Turbo Pascal as well (don't remember which version but I noticed that Greg uploaded version 7 here). I think it would be fun to make Mapedit work with 128x128 maps, say, by shifting the 64x64 canvas by 32 each time you hit the arrow keys, and giving Mapedit the ability to do Carmack Compression, although that can be quite slow for 60 maps in DosBox in my tests. Hex editing 8.5 to get rid of the check Andy mentioned might be a challenge because there's probably a lot of 000 003 (768s) in the code, if that's what it uses... maybe I'll check this out later.
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:38 ago.

Topics: 160
Posts: 8008
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Feb 16, 2015 4:35 am
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris wrote:
Andy_Nonymous wrote:
In my new EXE, I used WALLSHIFT 7, and added an offset of 1000 to the new walls, as Chris did in his example. Everything works fine in ChaosEdit and in the game itself, but the mapper's preference is Mapedit 8.5.

I should update that tutorial. A better solution than starting at 1000 is to shift the doors and floorcodes up, so that walls can use all the first tiles (I believe this is the way Havoc did it as well).
I don't agree that it's a better solution, but I do admit that the tutorial needed some touching up to fix the problems you mentioned. I believe I fixed all of the problems you posted about before I uploaded the code as part of my Base Of Operations package.

If you can spawn any problems in my EXE builds of that project, please let me know about it. Thanks. Smile
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

Topics: 55
Posts: 2115
Location: Canada
blank.gif

PostPosted: Mon Feb 16, 2015 5:00 am
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
I don't agree that it's a better solution, but I do admit that the tutorial needed some touching up to fix the problems you mentioned. I believe I fixed all of the problems you posted about before I uploaded the code as part of my Base Of Operations package.

I didn't at first either. I wanted to keep it simple and preserve the original door/floorcode numbers, but that >= AREATILE thing sort of made me take a step back and say "wait a minute..." later when I was playing around with your suggestion in this thread and the holowall trick. Theoretically, a wall higher than a floorcode should mess up some deaf guards without that purple check above, or at least the floor underneath them, if the wall is directly to the left of them (among other possible things), I think, but I've never tested the theory yet, and don't even have an SDL compiler on this computer so the jury is still out... Laughing
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 589
Location: New Jersey, USA
usa.gif

PostPosted: Mon Feb 16, 2015 9:33 am
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
Andy_Nonymous wrote:
I notice that versions 8.4 and 8.5 do not have source code released with them (presumably because 8.x was made to prevent shareware editing) so I assume Chris hex-edited the EXE to create 8.5.
The patch was done through an "EXE patch" program done by the makers of Turbo Pascal. The original EXEs compiled with Turbo Pascal crashed in many cases. The patch utility simply changes the EXE's content so the crash doesn't happen.

I could have sworn Chris hacked this...maybe he said he'd try to do so before Turbo Pascal makers actually patched it...or I am just "misremembering" things.

Chris wrote:
Andy_Nonymous wrote:
Older versions of Mapedit did not check for addresses like this, though they did fail at some point (4.2 comes to mind). Mapedit 7.2 does work with the new data, but has some unacceptable bugs and is lacking in some functionality

What are some of the bugs you noticed? I noticed that older versions which don't have a MAPSWAP dir can crash if you scroll through about 50 large maps (like the ones in Conflict in the Fatherland) if they're opened with less than 600k of main memory.

Two complaints I have been given are that accidentally hitting "C" deletes a map without any prompt to confirm and some colors such as teal are not available for tile usage.

Chris wrote:
(if you have under 90 walls though, neither this red code or any purple code should be necessary at all... I believe)

Confirmed. Making WALLSHIFT 7 makes 64-89 available for walls without needing anything else done. This *may* actually be enough for us to work with, not sure yet.

@Chris: Is the purple code you posted above only needed for certain values of NEWTILE_OFFSET? Would it hurt to always add this purple checking code, regardless of offset value? I think I would prefer that rather than having to redefine all of the door and floorcode numbers. If always checking doesn't hurt, maybe you could just add the purple stuff above to your original tutorial, adding some notes on valid numbers to use for the offset, citing the pros and cons of each.

In any case, I am glad this issue has come up, regardless of what is done about it. Mapedit could certainly use an update. Greg's WIP version of Mapedit is certainly intriguing, wish we could see it released!

Andy
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:38 ago.

Topics: 160
Posts: 8008
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Feb 16, 2015 1:47 pm
   Subject: Re: Mapedit 8.5 doesn't work with higher wall addresses
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Chris wrote:
I didn't at first either. I wanted to keep it simple and preserve the original door/floorcode numbers, but that >= AREATILE thing sort of made me take a step back and say "wait a minute..." later when I was playing around with your suggestion in this thread and the holowall trick. Theoretically, a wall higher than a floorcode should mess up some deaf guards without that purple check above, or at least the floor underneath them, if the wall is directly to the left of them (among other possible things), I think, but I've never tested the theory yet, and don't even have an SDL compiler on this computer so the jury is still out... Laughing
IIRC, I wrote a sloppy little true/false routine to check for valid floorcodes, so the code you posted in purple is actually rewritten into an easier-to-read version. I guarantee it's not the fastest way to simplify the code - especially since I haven't taken the time to rewrite the routine into smaller steps.

I'll probably go through my old code again when my compiler's up and running. I've given the Code Blocks compiler an honest-to-God try, but every time I try it, I end up not wanting to code at all. So, I'm installing Win98 SE in VirtualBox, and installing Dev C++ like I had before. I can always upload the compiled EXE to DropBox and download it through my current version of Windows. If Dev C++ is what you prefer with coding, this might be the route for you as well.

You can code circles around me for sure, so feel free to optimize the routine ruthlessly when you're ready to start coding again. Smile
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Mapping Mania View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Broken Mapedit 8.3
Author: lucky_foot
5 1225 Thu Feb 17, 2005 7:27 pm
Mikey X View latest post
No new posts mapping help for Die Hard Wolfer's TC needed
Author: Ringman
16 3156 Sun Aug 01, 2004 6:53 pm
Ringman View latest post
No new posts mapedit prob
Author: Guest
3 64 Wed Dec 17, 2003 2:20 am
Guest View latest post
No new posts Tip #1 - randomize the "variation" textures
Author: Adhesive_Boy
4 1481 Thu Sep 25, 2003 2:16 am
Chris View latest post
No new posts HOw do dogs go through walls?
Author: Guest
7 120 Thu Apr 17, 2003 4:33 pm
UberMutant View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group