#4455662 - 01/01/19 04:43 PM
Terrain Utilities problem
|
Joined: Mar 2008
Posts: 296
Soczkien
Member
|
Member
Joined: Mar 2008
Posts: 296
Poland
|
Hello guys, I need your help with some programs in terrain_utilities .. I'm using watcom to compile programs. I've described problem in this pdf file: Map problem.pdf Here is original terrain_utilities (the same as in Craigmire website): terrain utilities Terrain files i get from terraingen program: generated terrain files Terrain files generated by importer program: terrain generated by importer Grand terraform program edited by me and used to create poland map with terrain files from importer: grand terraform edited Importer program edited by me: importer edited Please help me to solve problem why grand_terraform gives this error !
|
|
#4456291 - 01/06/19 02:59 PM
Re: Terrain Utilities problem
[Re: Soczkien]
|
Joined: Apr 2003
Posts: 619
Craigmire
Member
|
Member
Joined: Apr 2003
Posts: 619
Colorado
|
Have you tried running the importer and importing the same .lwo file that was exported, before it was modified, just for a test to see if it works?
Here is the place where the error is printed:
if(!(terrain_sectors[sec_z][sec_x].points_y = malloc(sizeof(terrain_3d_point_y) * terrain_sectors[sec_z][sec_x].number_of_points))){ printf("No memory for points_y sector %d x %d\n", sec_z, sec_x); exit(1);
malloc (memory allocation) is a standard C function that returns a pointer to a chunck of memory on your computer. If it is unsuccessful it returns a zero or false. The exclamation point is the logic NOT symbol. That line could be read in English "if not true then print error message". Since it had been running for a while before it failed then I would say it failed because your computer ran out of memory. That statement is inside of two loops. Maybe something is screwed up with one or both of those loops. Look a short way above that point and you see where the loops are setup.
fread(&rgb_4byte_header, sizeof(int), 1, rgb_in); HERE: for( sec_z = 0 ; sec_z < map_height ; sec_z ++){ outer loop for( sec_x = 0 ; sec_x < map_width ; sec_x ++){ inner loop ///////////////////////////////////////////////////////////////// // read in all the stats for each sector /////////////////////////////////////////////////////////////////
Inbetween the "fread" line and the "for" line put two print statments. Like this:
printf("map_height = %d\n", map_height ); printf("map_width = %d\n", map_width );
When it runs you should see your map size. It is read in from the default.sec file.
Does this only happen after you have imported a modified .lwo file?
I thought you had this working a while back when you found the problem was not saving as lw5 object.
"There is nothing wrong with laziness. The old saying 'The early bird gets the worm', just goes to show you the worm should have stayed in bed. So, when I volunteered for WW II, I signed up to be a fighter pilot because it was a sittin' down job." -- Robert Heinlein
|
|
#4456333 - 01/06/19 09:06 PM
Re: Terrain Utilities problem
[Re: Soczkien]
|
Joined: Mar 2008
Posts: 296
Soczkien
Member
|
Member
Joined: Mar 2008
Posts: 296
Poland
|
Thanks Craigmire for your reply, Problem exist even if I import non modified file. I found something strange. If i take just generated terrain -> use New_exporter with export_all.exe. I take example one sector file and put it into importer mod_lw_objs. I import it. Then when I take those new generated terrain files to export_all.exe - sectors from 031x081 to 085x081 looks to be corrupted - they are 3KB size instead of 11KB that all other have.
Last edited by Soczkien; 01/06/19 09:17 PM.
|
|
#4456404 - 01/07/19 01:18 PM
Re: Terrain Utilities problem
[Re: Soczkien]
|
Joined: Apr 2003
Posts: 619
Craigmire
Member
|
Member
Joined: Apr 2003
Posts: 619
Colorado
|
You didn't say if this is the same thing you were doing the last time I talked to you. Wasn't this working? Was it a different map? This is a brand new map you made from scratch?
That is strange and interesting what you found and I'm having a hard time making sense of it. It can't be a coincidence that 031x081.lwo is the first corrupted file and the error is for sector 81 x 31. But, I check in the program that is sector z = 81 by x = 31. In the export program if you export_all the file names are x by z.lwo so that makes sense. There is also exportzx.exe that exports a single sector with the specified command line parameters. Like this "exportzx.exe 81 31" and here I reversed the x and z so the file name is z by x.lwo. That wasn't too smart. It looks like the import program has to have the name format x by z.lwo. You might want to double check me on this. I wonder how I had it working. I imported 100's of sectors in the Grand Canyon. The river had to be added by hand with Lightwave.
So, the import looks like the problem right? I see in import there is this.
// // these are terrain types used for the import because that's what // what was used for the export, probably change these eventually // the new types are assigned locally for sorting by surface for the // whole map //
int used_texture_list[] = { TERRAIN_TYPE_RIVER, TERRAIN_TYPE_TRENCH, TERRAIN_TYPE_LAND, TERRAIN_TYPE_FIELD1, TERRAIN_TYPE_ALTERED_LAND1, TERRAIN_TYPE_ALTERED_LAND2, TERRAIN_TYPE_ALTERED_LAND3, TERRAIN_TYPE_FOREST_FLOOR, TERRAIN_TYPE_ROAD, TERRAIN_TYPE_FOREST_TOP };
Could your map have a terrain type that is not one of those? Maybe SEA?
I'm sure if I can figure this out. The export function is a part of Razorworks source code and I just copied it and then reverse engineered it to make the import.
Is the trouble specific to this map?
Your pdf file says my map have 085x081 sectors but grand-terraform says the map size is 082x086 and that might be 086x082 depending.
"There is nothing wrong with laziness. The old saying 'The early bird gets the worm', just goes to show you the worm should have stayed in bed. So, when I volunteered for WW II, I signed up to be a fighter pilot because it was a sittin' down job." -- Robert Heinlein
|
|
#4456527 - 01/08/19 11:47 AM
Re: Terrain Utilities problem
[Re: Soczkien]
|
Joined: Apr 2003
Posts: 619
Craigmire
Member
|
Member
Joined: Apr 2003
Posts: 619
Colorado
|
The number of sectors makes sense because the first sector is 0 x 0 so if the last sector is 85 x 81 then you have 86 x 82 sectors. I think problem is the missing terrain type in import.c. There is number_of_textures_used = 10; change that to eleven. number_of_textures_used = 11; Add the sea terrain type like this:
int used_texture_list[] = { TERRAIN_TYPE_RIVER, TERRAIN_TYPE_TRENCH, TERRAIN_TYPE_LAND, TERRAIN_TYPE_FIELD1, TERRAIN_TYPE_ALTERED_LAND1, TERRAIN_TYPE_ALTERED_LAND2, TERRAIN_TYPE_ALTERED_LAND3, TERRAIN_TYPE_FOREST_FLOOR, TERRAIN_TYPE_ROAD, TERRAIN_TYPE_FOREST_TOP, TERRAIN_TYPE_SEA };
"There is nothing wrong with laziness. The old saying 'The early bird gets the worm', just goes to show you the worm should have stayed in bed. So, when I volunteered for WW II, I signed up to be a fighter pilot because it was a sittin' down job." -- Robert Heinlein
|
|
|
|
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
|
|
|
|
|
|
|
|
|
|