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       

[Code] Automap Fun - Putting an Automap on the HUD - Chris
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials 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
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 24 Jun 2017

Topics: 54
Posts: 2095
Location: Canada
blank.gif

PostPosted: Mon Feb 16, 2004 12:46 pm
   Subject: [Code] Automap Fun - Putting an Automap on the HUD - Chris
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Heh. I was just thinking about how fun it would be to make an Automap (the original HUGE one with garbled numbers everywhere wasn't really too helpful - lol). Anyone have any cool ideas for a better one? Smile

I started coding a few of them today, the first one had a 192x192 map displayed on the left side (3x3 for each wall, getting all the colours of the walls to match the original), while having the players game screen on the right; which seemed pretty cool, than I switched to dumping the level map into the memory of a vswap tile, so that when you get to that area; you can see the entire level on the wall.

Here's another idea I was playing around with. It seems to have that cool feel of V1.0's Tab-O, but it takes up hardly any space on the screen...



If you want to try it out, just replace the original DrawWeapon() in WL_AGENT.C with this code:

::: CODE :::
void DrawWeapon (void)
{
//   StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
}

void DrawLevelMap (void)
{
   int x=player->tilex,y=player->tiley;
   int offx,offy,midx=249,midy=165,lenx=61,leny=31;
   offx = x*4/64; offy = y*34/64;

   for (x=0;x<lenx;x++)
      for (y=0;y<leny;y++)
      {
         if (tilemap[offx+x][offy+y] == 0)
         {
            VWB_Plot(midx+x,midy+y,0);
            if (actorat[offx+x][offy+y] != 0)
            {
               if ((unsigned)actorat[offx+x][offy+y] == 1)
                  VWB_Plot(midx+x,midy+y,158);
               else
                  VWB_Plot(midx+x,midy+y,150);
            }
         }
         else
            VWB_Plot(midx+x,midy+y,154);
      }

   VWB_Plot(player->tilex+midx-offx,player->tiley+midy-offy,140);
   VW_UpdateScreen ();
}

Than just connect to the function in places like below "long basex,basey;" in ClipMove() and above "UpdateFace ();" in T_Player (both also in WL_AGENT.C) with this line:

::: CODE :::
DrawLevelMap();

I don't really know much about how Buffering and Caching works (everything here is just getting sent to the screen as it's posted), so there's a drawback to plugging or not plugging the "DrawLevelMap()" into different places. If you put it in alot of places, it will slow down your frame rate; but if you don't put in certain places, it won't draw the screen enough times to look perfect. Using those two places (ClipMove() and T_Player) make an ok middle ground so far; but I'll keep looking around for even more efficiant ones.

Feel free to post some of your ideas if you find this interesting, or if you want your automap to do anything in particular. I've done alot of other easy things with them, like making appear when you press Enter, when you pick up a crown, switching colours on different levels. Anything is possible, and maps are pretty fun to play around with. Wink
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 23 Jun 2017

Topics: 45
Posts: 2274
Location: USA
usa.gif

PostPosted: Mon Feb 16, 2004 1:14 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Very nice looking! Much better than the number mess... I remember having a discussion with you about maps, etc... I still haven't got the number mess to actually show up correctly, but hey. Laughing

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Mon Feb 16, 2004 1:28 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chris....

First off... Amazing...

lol... Now for the tough questions....

1. Can you convert this so that the player only sees places that he's been.... Ie we don't want it giving away pushwall locations and things like that.

2. Which variables need to be changed to locate the Automap in say the top right or left hand corner of the screen, rather than on the statusbar?

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 23 Jun 2017

Topics: 45
Posts: 2274
Location: USA
usa.gif

PostPosted: Mon Feb 16, 2004 2:42 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm not Chris, but for #2 it looks like:
::: CODE :::
int offx,offy,midx=249,midy=165,lenx=61,leny=31;

might be of interest... midx,midy = top left corner, lenx,leny = width/height...

side note: The "quote" button seems to have disappeared...

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Mon Feb 16, 2004 3:21 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Looks really nice ;D
Hmm, I guess real automapping should be possible with a new map array (possibly using only one bit per field to save space) and letting the AsmRefresh function set the fields of the automap to visible, where the raytracer runs through (just like it sets "spotvis" to true for all those fields for every frame). Or you could update the automap with the spotvis array AFTER AsmRefresh and make every field visible where the spotvis field is true.
And according to the automap array you could draw the nice map as already done ;D
Guest




Last Visit:





PostPosted: Mon Feb 16, 2004 3:39 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
side note: The "quote" button seems to have disappeared...



Yes, I noticed that icon been removed.

sometime I used to write "quote" with copy & paste when I ready to reply.

Sound cool tutorial, I would to see the automap' colour that they want to choose the colour to match their statusbar's colour instead of blue. Any idea will be great Mr Green
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Mon Feb 16, 2004 5:24 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Nice! All you need to do now is apply a key-on/key-off function to the map, basically, if the TAB key is held down, the map appears, but when you let up on it, the map disappears. This obviously would require the map to be in the middle of the screen, then I guess other functions could be added later, like pausing the game, darkening the rest of the screen, showing enemies, and even an item to pickup that shows all areas on the map.

_________________
This isn't revenge; it's punishment.
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Thu Feb 19, 2004 5:55 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Quote:
dumping the level map into the memory of a vswap tile, so that when you get to that area; you can see the entire level on the wall


That sounds like what Ken Silverman did in the (un)popular Wolf ripoff; Ken's Labyrinth. From what I understand about what you did, using the same method of printing the wall on the status bar, implementing the way Wolf draws walls, somehow enabled the game to update your position on the wall. That certain tile you place down draws a map on the wall in the game.

If this is what you did, isn't that killer on your framerate?

_________________
This isn't revenge; it's punishment.
Reivax44
Bring 'em On
Bring 'em On


Joined: 25 Apr 2003
Last Visit: 26 Aug 2010

Topics: 3
Posts: 140
Location: Adelaide.
australia.gif

PostPosted: Thu Feb 19, 2004 6:07 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@ Chris. That is some hellova feature! As Brother Tank said, if you could remove the secrets then that would be the icing on the cake!

a Thing of coding Beauty!

_________________
95% of people tip-toe through life hoping to make it safely to DEATH!
Arielus
Moderator
<B>Moderator</B>


Joined: 13 Mar 2003
Last Visit: 0:13 ago.

Topics: 20
Posts: 670
Location: Buenos Aires, Argentina
argentina.gif

PostPosted: Thu Feb 19, 2004 6:58 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

LOL! That's the first map of the trilogy I made for the Map Making Mania Melée mod! Ha ha ha ha ha...

The purple walls and that full well in the middle of the scene made me think it was my opening level, but I didn't want to go shouting it out loud without being completely sure... Then I thought to myself: "Hey moron, what's this thread all about? Can't you f***ing see the map on Chris's status bar? You can, can you not? Then why don't you place your eyes on it and see whether you are right or not?"... LOL... So I saw it, and my suspicions were confirmed... Ha ha ha ha ha...

Ariel.

_________________
Hot to Rock - Long Live Metal!
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 24 Jun 2017

Topics: 54
Posts: 2095
Location: Canada
blank.gif

PostPosted: Thu Feb 19, 2004 10:50 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hahahahahaha. Damn straight Ariel! Your message made me freakin' fall of my chair with laughter man! My roommates probably thought I was INSANE, I mean... who actually laughs out loud on their computer screen? Me, from this crazily hilarious message of yours! hahaha. Laughing


Last edited by Chris on Wed Aug 03, 2011 11:22 am; edited 1 time in total
Guest




Last Visit:





PostPosted: Fri Feb 20, 2004 2:25 pm
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I'll stay a bit on topic, and state that this feature you've pulled out, Chris, looks purdy useful. It's something I, personally, will try out as soon as I get the five minutes necessary to copy and paste your section of coding. It's a fantastic piece of work you've thrown together, and a large stack of kudos you've earned. =)

And yes, I dare say that Ariel could gain such a title, Chris. You, obviously, have played through the maps he's created, and only the almighty creator could have developed such engenious layouts. Laughing So, once again, time to deal kudos to the subject of this paragraph: Ariel

Once again, directing to the thread's topic, Chris, this is an excellent feature you've created. I may try, though unlikely I'll succeed, I'll see if I can improve this piece of art.
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Sun Mar 14, 2004 10:37 am
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yes, dead topic, I know, but if any of you guys want to expand on the feature, I've made some useful discoveries in how this work for the less source-code inclined:

::: CODE :::

int offx,offy,midx=249,midy=165,lenx=61,leny=31;
   offx = x*4/64; offy = y*34/64;


Okay, midx is the X coordinate where the map starts drawing. Same with midy, except for the Y coordinate. lenx and leny are the length in X (horizontal) and Y (veritcal)

offx and offy seem to be offsets, if you draw in the lower right corner to cover DrawWeapon(); If you are making a 64x64 map, these should be
x/64 and y/64

::: CODE :::

for (x=0;x<lenx;x++)
      for (y=0;y<leny;y++)

While the X and Y pixels that draw the map are less than the length in X and Y of the map...

::: CODE :::

VWB_Plot(midx+x,midy+y,0);

If the current map tile is nothing, draw 0, a black square.
SIDE NOTE: The last variable in the VWB_Plot is the color. This is the decimal of the Hex codes used for colors, so 00 is 0, for black.

::: CODE :::

if ((unsigned)actorat[offx+x][offy+y] == 1)
                  VWB_Plot(midx+x,midy+y,158);
               else
                  VWB_Plot(midx+x,midy+y,150);

If there is an actor at said pixel, draw the light blue square, if not, it's a wall, and draw the darker blue pixel.

::: CODE :::

VWB_Plot(player->tilex+midx-offx,player->tiley+midy-offy,140);

This is where the player is, so we draw the near-white blue square.

Glad to be of some help. Smile

_________________
This isn't revenge; it's punishment.
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 903
Location: Seattle
usa.gif

PostPosted: Wed Mar 17, 2004 4:44 pm
   Subject: Re: [CODE] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Damn fine job, Chris! Very interesting indeed... About making sure only rooms you've been to show up... Hmm... While I don't have the source with me to look into it, I started thinking about the floor code system, and possibly making it so that once you've entered a floor code, the entire floor code shows up on the map, but that would completely defeat the purpose of pushwalls. While a few rewrites that remove the "pushwall rooms have to have the same code" rule (as was done in Blake Stone), there's probably a better solution... Again, this is off the top of my head, so if I'm babbling, let me know Smile

EDIT: Guess I should mention this since last year I couldn't on the appropriate day... It's mah birfday Twisted Evil

_________________
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Thu Mar 18, 2004 11:45 am
   Subject: Re: [CODE] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hey Dugtrio, haven't seen ya in a while. Happy (late) birfday Cake !

Anyways, I did think of the floor codes concept, but for that to work, I guess map editing needs to be done. This is fine for a new TC, but it doesn't exactly work for the original Wolf3D. DOOM accomplishes this by only drawing what you've seen. Of course, DOOM uses lines and vertices for its walls, so this won't be too much of a hassle with Wolf since each wall is one tile, and not a whole wall as you'd see in real life.

Maybe Chris (who wrote this code here) knows how...

_________________
This isn't revenge; it's punishment.
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Sun Aug 29, 2004 11:28 am
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've done it, but the secret walls are drawn anyway... However, there's my edited code, which replaces just the "DrawWeapon()" function (it activates while pressing the "o" key):

::: CODE :::

boolean WalkedFloor[NUMAREAS];

void DrawWeapon (void)
{
   VL_Bar(249,165,61,31,0x97);
   
   WalkedFloor[player->areanumber] = true;
   
   if (!Keyboard[sc_O])
      StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
   else if (!Keyboard[sc_Tab])
   {
      int x=player->tilex,y=player->tiley;
      int offx,offy,midx=249,midy=165,lenx=61,leny=31;
      offx = x*4/64; offy = y*34/64;
      for (x=0;x<lenx;x++)
         for (y=0;y<leny;y++)
         {
            if (tilemap[offx+x][offy+y] == 0)
            {
               if (WalkedFloor[MAPSPOT(offx+x,offy+y,0)-AREATILE])
                  VL_Plot(midx+x,midy+y,0x00);
               else
               {
                  VL_Plot(midx+x,midy+y,0x97);
                  continue;
               }
               if (actorat[offx+x][offy+y] != NULL)
               {
                  if ((unsigned)actorat[offx+x][offy+y] == 1)
                     VL_Plot(midx+x,midy+y,0x80);
                  else
                     VL_Plot(midx+x,midy+y,0x77);
               }
            }
            else
               VL_Plot(midx+x,midy+y,0x97);
         }
      VL_Plot(player->tilex+midx-offx,player->tiley+midy-offy,0x0F);
   }
}


The "WalkedFloor" is an array which keeps track of the walked areas. Reset it in the "GameLoop()" function, just after the "restart:" label this way:

::: CODE :::

restart: // ===>>> word to search, don't rewrite it <<<===
   memset(WalkedFloor,0,NUMAREAS);


Remember to add "extern boolean WalkedFloor[NUMAREAS];" to the end of "WL_DEF.H"
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Fri Dec 17, 2004 2:26 am
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I pride myself on keeping old topics alive!

I tried putting a trigger key, so that when you press 'o' you can turn the automap on and off. To do this I made a gamestate.automap, then did something similar to the crosshair in BW2 SE.

The problem is that when I press it to turn it off, the image of the weapon appears, but the automap edges can still be seen around the status bar image.

Anyone help?

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 23 Jun 2017

Topics: 45
Posts: 2274
Location: USA
usa.gif

PostPosted: Fri Dec 17, 2004 6:07 am
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Deathshead: Two ideas:
1) Redraw the status bar, face, ammo, etc again, just for completeness.
2) Make the automap fit only in the status bar weapon space. (I thought it did, but maybe I'm wrong)

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Fri Dec 17, 2004 8:25 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
@Deathshead: Two ideas:
1) Redraw the status bar, face, ammo, etc again, just for completeness.
2) Make the automap fit only in the status bar weapon space. (I thought it did, but maybe I'm wrong)


With the second point, thats what I did. The automap fills the weapon space, and when O is pressed, it turns on and off.

http://www.freewebs.com/dethshead/Picture1.png

This is before I have it on.

http://www.freewebs.com/dethshead/Picture3.png

This is it activated

http://www.freewebs.com/dethshead/Picture2.png

This is the problem. The automap fails to disappear completely.

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Fri Dec 17, 2004 9:24 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yes Deathshead...

As Adam explained you have 2 options (actually 3, and I'll add the third to the list)...


  1. Have your souce redraw the status bar completely... Thus it writes over the existing and will renew the screen.

  2. Adjust the output of the draw routine to match the size of the weapon image

  3. Lastly, you can change the size of the weapon image displayed on the status bar to the same size as the automap draw... but you will have to make sure to update the screen locations for the DrawWeapon routine.



The choices are yours... We understand completely what you want and what the problem is (without the pictures). You just haven't understood the answers given.

Greg
BrotherTank

_________________

The probability of someone watching you is directly related to the Stupidity of your actions
&
The two most abundant things in the Universe are Hydrogen & Stupidity - H.Ellison

Which of those is more relevant to you??
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Sat Dec 18, 2004 12:02 am
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks and SORRY, I didn't understand, as BrotherTank said.

I had already tried redrawing it, maybe i put it in the wrong place. Where should I put it?

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
Executor
DieHard Officer
DieHard Officer


Joined: 28 Mar 2003
Last Visit: 13:37 ago.

Topics: 53
Posts: 699

usa.gif

PostPosted: Sun Mar 05, 2006 4:13 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Megabump.
The "WalkedFloor" is an array which keeps track of the walked areas. Reset it in the "GameLoop()" function, just after the "restart:" label this way:

::: CODE :::

restart: // ===>>> word to search, don't rewrite it <<<===
   memset(WalkedFloor,0,NUMAREAS);


Where is this gameloop function? It's not in WL_AGENT.C or WL_DEF.H. ALWAYS specify the file that you should look in for a line.

EDIT: Found it in WL_GAME. It still doesn't work when I hit O or Tab-O.

_________________
My Wolf3D mods on ModDB
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Mon Mar 06, 2006 5:57 am
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Strange. It works perfectly with me. Try by adding it to "ThreeDRefresh()"! It could be overwritten by a "US_UpdateScreen()" call.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 24 Jun 2017

Topics: 54
Posts: 2095
Location: Canada
blank.gif

PostPosted: Mon Mar 06, 2006 10:59 am
   Subject: Re: Automap Fun
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Executor: There was another idea for the "WalkedFloor" thing posted too...

Ripper wrote:
Hmm, I guess real automapping should be possible with a new map array (possibly using only one bit per field to save space) and letting the AsmRefresh function set the fields of the automap to visible, where the raytracer runs through (just like it sets "spotvis" to true for all those fields for every frame). Or you could update the automap with the spotvis array AFTER AsmRefresh and make every field visible where the spotvis field is true.

I tried a similar idea to this a long time ago, and it worked, so I midaswell post an example on how to do it. Instead of making it so all objects with a spotvis are visible, I just made it so only objects with a spotvis of 1 should be visible. Like this (in DrawScaleds of WL_DRAW.C):

::: CODE :::
      if (*statptr->visspot != 1)
         continue;                  // not visable

::: CODE :::
      //
      // could be in any of the nine surrounding tiles
      //
      if (*visspot == 1
      || ( *(visspot-1) == 1 && !*(tilespot-1) )
      || ( *(visspot+1) == 1 && !*(tilespot+1) )
      || ( *(visspot-65) == 1 && !*(tilespot-65) )
      || ( *(visspot-64) == 1 && !*(tilespot-64) )
      || ( *(visspot-63) == 1 && !*(tilespot-63) )
      || ( *(visspot+65) == 1 && !*(tilespot+65) )
      || ( *(visspot+64) == 1 && !*(tilespot+64) )
      || ( *(visspot+63) == 1 && !*(tilespot+63) ) )

Then you can just set spotvis to something higher if it's already seen instead of clearing it, like this:

::: CODE :::
void   ThreeDRefresh (void)
{
   int tracedir,x,y;

// this wouldn't need to be done except for my debugger/video wierdness
   outportb (SC_INDEX,SC_MAPMASK);

//
// clear out the traced array
//
   for (x=0;x<MAPSIZE;x++)
      for (y=0;y<MAPSIZE;y++)

      {
         VWB_Plot(x,y,2-spotvis[x][y]);

         if (spotvis[x][y])
            spotvis[x][y]=2;

      }


   bufferofs += screenofs;

The code in blue is just for testing so you can see how the map is now marked (adjust your screen size to something smaller to see it). I encourage you to try and optimize this so it can go faster if you want (only running it when TimeCount%number == 0, converting it to asm, etc.). You might want to use Ripper's fixes in this thread too if your screen ends up getting filled with gray lines/border, because it usually does for me when I mess around with the ThreeDRefresh.

Once you do that, just add this to SetupGameLevel of WL_GAME.C so it can be reset:

::: CODE :::
//
// copy the wall data to a data segment array
//
   memset (tilemap,0,sizeof(tilemap));
   memset (actorat,0,sizeof(actorat));
   memset (spotvis,0,sizeof(spotvis));
   map = mapsegs[0];

With that idea, you could detect wherever you've been by checking if spotvis is true for that tilex/tiley location. As an example, if you really want to use that original automap code I posted, you'd probably just have to change this line:

::: CODE :::
if (tilemap[offx+x][offy+y] == 0)

To this:

::: CODE :::
if (spotvis[offx+x][offy+y])

Just thought I'd post that idea, to give this place some more concepts to think about.
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 07 Jun 2016

Topics: 101
Posts: 1614
Location: A hole in the wall
australia.gif

PostPosted: Tue Jun 06, 2006 6:48 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How about dumping one to a wall tile? How would one do that?

_________________
Zombieskittles

Welcome to 2016, where DHW still thinks it is okay to ban the world's most popular email service provider, and I can't have an avatar over 10kb
jasonbay
Can I Play Daddy
Can I Play Daddy


Joined: 22 Feb 2008
Last Visit: 12 Mar 2010

Topics: 20
Posts: 48
Location: u.s.a.
usa.gif

Warnings : 1
PostPosted: Fri Feb 29, 2008 2:37 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chr
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Deathwish wrote:
Thanks and SORRY, I didn't understand, as BrotherTank said.

I had already tried redrawing it, maybe i put it in the wrong place. Where should I put it?


try putting it after everything (im no coder and no clue how to get the map working)
TheTalentedMrLeo
Moderator
<B>Moderator</B>


Joined: 14 Mar 2003
Last Visit: 22 Jun 2017

Topics: 35
Posts: 672
Location: Sometimes in Canada
usa.gif

PostPosted: Wed Mar 12, 2008 1:50 pm
   Subject: Re: [Code] Automap Fun - Putting an Automap on the HUD - Chris
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Jason, this thread died almost 2 YEARS ago. The problem has most likely been solved, so please don't bump these threads.
kary
Registered User
Registered User


Joined: 15 Mar 2017
Last Visit: 16 Mar 2017

Topics: None
Posts: 2


PostPosted: Wed Mar 15, 2017 1:34 pm
   Subject: [Code] Automap Fun - Putting an Automap on the HUD - Chris
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Sorry to crash this ancient post... but here is a somewhat improved version of this - it also shows the doors (orange pixel) and blocking sprites (teal), i used it in my TC...
The whole function i have in WL_DRAW.C :
::: CODE :::

void automap()
 {
    int x=player->tilex,y=player->tiley;
    int offx,offy,midx=249,midy=165,lenx=61,leny=31;
    offx = x*4/64; offy = y*34/64;

    for (x=0;x<lenx;x++)
       for (y=0;y<leny;y++)
       {
          if (tilemap[offx+x][offy+y]==0)
       {
             VWB_Plot(midx+x,midy+y,0);
        if ((unsigned)actorat[offx+x][offy+y] == 1)
                VWB_Plot(midx+x,midy+y,254);
       }
          else if (tilemap[offx+x][offy+y]&0x80)
             VWB_Plot(midx+x,midy+y,60);
          else
             VWB_Plot(midx+x,midy+y,27);
       }

    VWB_Plot(player->tilex+midx-offx,player->tiley+midy-offy,96);
    VW_UpdateScreen ();
 }
[/code]
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials 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 [Code] Add Text to Screen at Skill Level select - Chris
Author: Chris
3 2240 Tue Sep 28, 2010 6:59 pm
Tricob View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2198 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 1809 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2493 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 606 Tue Jul 29, 2003 3:00 pm
Codetech84 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