117 lines
4.1 KiB
C
117 lines
4.1 KiB
C
/*
|
|
* PVVMUD a 3D MUD
|
|
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*/
|
|
#include <stdio.h>
|
|
#include "namedb.H"
|
|
|
|
#define SIZE 4
|
|
#define SIZE2 SIZE*SIZE
|
|
|
|
#define WIDTH 500.0f
|
|
#define HEIGHT WIDTH
|
|
|
|
int wrap(int index,int size){
|
|
if (index < 0) return index + size;
|
|
if (index >= size) return index - size;
|
|
return index;
|
|
}
|
|
|
|
#define GEO(geoName) geondb->findId(geoName)
|
|
|
|
void main(void){
|
|
int cell[SIZE][SIZE];
|
|
int x1,y1;
|
|
int x2,y2;
|
|
int i,j;
|
|
|
|
CNameDB * geondb = new CNameDB();
|
|
geondb->load("libgos/gosbog.ndb");
|
|
|
|
for (y1 =0;y1<SIZE;y1++){
|
|
for (x1 =0;x1<SIZE;x1++){
|
|
cell[x1][y1] = x1 + y1*SIZE;
|
|
}
|
|
}
|
|
|
|
FILE * WORLD = fopen("world","w");
|
|
|
|
for (y1 =0;y1<SIZE;y1++){
|
|
for (x1 =0;x1<SIZE;x1++){
|
|
|
|
int c = cell[x1][y1];
|
|
char cell_file[256];
|
|
sprintf(cell_file,"cell%i",c);
|
|
|
|
fprintf(WORLD,"%i %s 8\n",c,cell_file);
|
|
|
|
for (j=-1;j<=1;j++){
|
|
for (i=-1;i<=1;i++){
|
|
if ((j!=0)||(i!=0)){
|
|
int posx = wrap(x1+i,SIZE);
|
|
int posy = wrap(y1+j,SIZE);
|
|
int pvs = cell[posx][posy];
|
|
fprintf(WORLD,"%i %f %f %f\n",pvs,WIDTH*i,HEIGHT*j,0.0f);
|
|
}
|
|
}
|
|
}
|
|
|
|
FILE * CELL = fopen(cell_file,"w");
|
|
|
|
switch(c){
|
|
case 1:
|
|
fprintf(CELL,"cell %i 0.0 0.0 0.0 5\n",GEO("geometry/terrain/ground"));
|
|
fprintf(CELL,"object %i 5.0 -230.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_3"));
|
|
fprintf(CELL,"object %i -5.0 0.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
break;
|
|
case 5:
|
|
fprintf(CELL,"cell %i 0.0 0.0 0.0 7\n",GEO("geometry/terrain/ground"));
|
|
fprintf(CELL,"object %i -20.0 5.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
fprintf(CELL,"object %i 30.0 5.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_2"));
|
|
fprintf(CELL,"object %i 20.0 -25.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
fprintf(CELL,"object %i 20.0 245.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_3"));
|
|
fprintf(CELL,"object %i -20.0 245.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_2"));
|
|
fprintf(CELL,"object %i 2.0 0.0 1.5 eagle 0\n",GEO("geometry/common/animal/eagle1"));
|
|
fprintf(CELL,"object %i -2.0 0.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
break;
|
|
case 6:
|
|
fprintf(CELL,"cell %i 0.0 0.0 0.0 3\n",GEO("geometry/terrain/ground"));
|
|
fprintf(CELL,"object %i 25.0 5.0 0.0 pavilion 0\n",GEO("geometry/common/buildings/pavilion"));
|
|
fprintf(CELL,"object %i 20.0 15.0 0.0 hut 0\n",GEO("geometry/common/buildings/hut"));
|
|
fprintf(CELL,"object %i -10.0 -5.0 0.0 church 0\n",GEO("geometry/common/buildings/church"));
|
|
break;
|
|
case 9:
|
|
fprintf(CELL,"cell %i 0.0 0.0 0.0 4\n",GEO("geometry/terrain/crater"));
|
|
fprintf(CELL,"object %i 5.0 -230.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
fprintf(CELL,"object %i 5.0 -200.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_3"));
|
|
fprintf(CELL,"object %i 5.0 200.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_2"));
|
|
fprintf(CELL,"object %i -5.0 245.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_3"));
|
|
break;
|
|
default:
|
|
fprintf(CELL,"cell %i 0.0 0.0 0.0 1\n",GEO("geometry/terrain/ground"));
|
|
fprintf(CELL,"object %i 50.0 34.0 0.0 tree 0\n",GEO("geometry/common/plants/tree_1"));
|
|
break;
|
|
}
|
|
fclose(CELL);
|
|
|
|
}
|
|
}
|
|
|
|
fclose(WORLD);
|
|
}
|