On Sat, 2 Feb 2002, Chris "Winston" Litchfield wrote:

there is a snippet to print a world map as an XPM? got a URL?

> Is that not the automap snippet does for you?
>
>
> ----- Original Message -----
> From: "Blue Lang" <[EMAIL PROTECTED]>
> To: "Brian E. Ermovick" <[EMAIL PROTECTED]>
> Cc: <[email protected]>
> Sent: Saturday, February 02, 2002 2:55 PM
> Subject: generating world maps (was Re: DISCUSSION TOPIC: RP vs HACK)
>
>
> >
> > hope you don't mind me copying the list back in..
> >
> > On Sat, 2 Feb 2002, Brian E. Ermovick wrote:
> >
> > > hey - regarding this - could you possibly show me the code that allows
> you
> > > to do that? -- I've been trying to do the exact opposite - generate a
> .xpm
> > > file from my grid to view on www.
> >
> > this should be really easy, if your wilderness is actually a grid. a
> > 10x10, 3 color xpm file looks like this:
> >
> > /* XPM */
> > static char * test[] = {
> > "10 10 4 1", // width, height, num colors, alpha channel (?)
> > "   c None",     // hex color value
> > ".  c #2453B7",  // and glyph key pairs
> > "+  c #000000",  //
> > "@  c #1EDB1E",  //
> > "..........",
> > "..........",
> > ".++++++...",
> > ".+@@@@+...",
> > ".+@@@@+....",
> > ".++++++...",
> > "[EMAIL PROTECTED]",
> > "[EMAIL PROTECTED]",
> > "[EMAIL PROTECTED]",
> > "..........", // height lines of width chars
> > };
> >
> > first, pick one color per wilderness sector type. you can use the gimp or
> > photoshop or whatever to give you the hex values. you can either just
> > write them to the top of a file, or, if you want output mapping to be
> > dynamic (if you have wilderness editing in OLC or something), you can just
> > include em in a header somewhere.
> >
> > then, pick a glyph for each wilderness sector type, corresponding to your
> > entries in merc.h, ie:
> >
> > const char *wilderness_glyphs[] =
> > {
> > "f", //field
> > "F", //forest
> > "H", //hills
> > "M", //mountain
> > "w", //water_swim
> > "W", //water_noswim
> > "A", //air
> > "D"  //desert
> > };
> >
> > etc. then just open an FH for your output file, walk your wilderness, and
> > output one char per room( wilderness_glyphs[wilderness_room->sector] ),
> > ending with a '",'.
> >
> > how that happens depends on how your wilderness is set up.
> >
> > the code i use to create my 512x512 world, after being mangled by indent,
> > looks like this:
> >
> > extern char *terrain_xpm[]; // an xpm created in the gimp with a fixed
> >     // pallette
> >
> > struct world_type {
> >
> >     int posx;
> >     int posy;
> >     int posz; // z is virtualized for flying, ie, not read from the map
> >     int sector;
> >     int area; // which area is linked to pos x,y,z in the world
> >
> > };
> >
> > struct world_type world[512][512];
> >
> > int create_world()
> > {
> >
> >     int x, y;
> >
> >     for (x = 0; x < 512; x++) {
> >     for (y = 0; y < 512; y++) {
> >         world[x][y].posx = x;
> >         world[x][y].posy = y;
> >         world[x][y].posz = 0;
> >         world[x][y].area = 0;
> >         switch (terrain_xpm[x][y]) {
> >         case 'F':
> >         world[x][y].sector = 2;
> >         break;
> >         case 'f':
> >         world[x][y].sector = 3;
> >         break;
> >         case 'W':
> >         world[x][y].sector = 4;
> >         break;
> >         case 'w':
> >         world[x][y].sector = 5;
> >         break;
> >         case 'D':
> >         world[x][y].sector = 6;
> >         break;
> >         case 'd':
> >         world[x][y].sector = 7;
> >         break;
> >         case 'h':
> >         world[x][y].sector = 8;
> >         break;
> >         case 'a':
> >         world[x][y].sector = 9;
> >         break;
> >         case 'j':
> >         world[x][y].sector = 1;
> >         break;
> >         case 'g':
> >         world[x][y].sector = 1;
> >         break;
> >         default:
> >         world[x][y].sector = 0;
> >         break;
> >         }
> >     }
> >     }
> >
> >     return 0;
> > }
> >
> > pretty straightforward. don't be like me and use numbers for your sectors,
> > btw. ;)
> >
> > hope that helps,
> >
> > --
> > Blue Lang                                      http://www.b-side.org/~blue
> >            editor, b-side.org                        http://www.b-side.org
> >            bug generation unit, alanthia mud             alanthia.org 1536
> >            integration engineer, veritas software   http://www.veritas.com
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >
> >
>
>
>

-- 
--
Blue Lang                                      http://www.b-side.org/~blue
           editor, b-side.org                        http://www.b-side.org
           bug generation unit, alanthia mud             alanthia.org 1536
           integration engineer, veritas software   http://www.veritas.com


Reply via email to