Well guys, I'm stuck trying to add the additional directions to my wld generation. I know it should be something simple, but it keeps slipping my mind.
Code:
#include <stdio.h>
#include <stdlib.h>
void main()
{
int WIDTH=180,
HEIGHT=180,
VNUM_START=100,
VNUM_END=WIDTH*HEIGHT+(VNUM_START-1),
vnum,n,e,s,w,line_pos;
FILE *fp=fopen("2.wld","w");
printf("#*********************************#\n");
printf("# GENERATING %3d BY %3d AREA FILE #\n",WIDTH,HEIGHT );
printf("#*********************************#\n");
for ( vnum=VNUM_START ; vnum<=VNUM_END ; vnum++)
{ /* for every room */
n=vnum-WIDTH;
s=vnum+WIDTH;
e=vnum+1;
w=vnum-1;
/*where it is on the line 0 to (WIDTH-1)*/
line_pos=(vnum-VNUM_START+1)%(WIDTH);
if (line_pos==0) line_pos=WIDTH;
/*north border*/
if ( (vnum >= VNUM_START) && (vnum < VNUM_START+WIDTH) ) {
n=(VNUM_END-WIDTH)+(line_pos);
}
/*south border*/
if ( (vnum > VNUM_END-WIDTH) && (vnum <= VNUM_END) ) {
s=(VNUM_START)+(line_pos-1);
}
/*east border*/
if ( (vnum-VNUM_START+1)%(WIDTH)==0 ) {
e=vnum-WIDTH+1;
}
/*west border*/
if ( (vnum-VNUM_START+1)%(WIDTH)==1 ) {
w=vnum+WIDTH-1;
}
fprintf(fp,"#%d\nSpace~\nThis room was generated by Liko's world generator.\n~\n1 0 0 0 0 11\n",vnum);
fprintf(fp,"D0\n~\n~\n0 0 %d\n",n);
fprintf(fp,"D1\n~\n~\n0 0 %d\n",e);
fprintf(fp,"D2\n~\n~\n0 0 %d\n",s);
fprintf(fp,"D3\n~\n~\n0 0 %d\n",w);
fprintf(fp,"S\n");
}
fprintf(fp,"$~\n");
}
I know in the saves nw,ne,se,sw using D6-9. I believe I am just missing the simple formula for directions themselves. I have it working for north, east, south, and west. Connects and links them all. I just need the new directions.