X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=fractalnoise.c;h=eabe7ead9c45097e392b4925d80528261a2724bd;hp=4574902fa496379d920554fddf5022bf24f759fa;hb=aa33d8f8642530f7f266d6cde1422f95aa74b2be;hpb=ea7c24e1fb41f3b1df984ac0eed6881c9fde16f5 diff --git a/fractalnoise.c b/fractalnoise.c index 4574902f..eabe7ead 100644 --- a/fractalnoise.c +++ b/fractalnoise.c @@ -9,16 +9,22 @@ void fractalnoise(qbyte *noise, int size, int startgrid) for (sizepower = 0;(1 << sizepower) < size;sizepower++); if (size != (1 << sizepower)) - Sys_Error("fractalnoise: size must be power of 2\n"); + { + Con_Printf("fractalnoise: size must be power of 2\n"); + return; + } for (gridpower = 0;(1 << gridpower) < startgrid;gridpower++); if (startgrid != (1 << gridpower)) - Sys_Error("fractalnoise: grid must be power of 2\n"); + { + Con_Printf("fractalnoise: grid must be power of 2\n"); + return; + } startgrid = bound(0, startgrid, size); amplitude = 0xFFFF; // this gets halved before use - noisebuf = Mem_Alloc(tempmempool, size*size*sizeof(int)); + noisebuf = (int *)Mem_Alloc(tempmempool, size*size*sizeof(int)); memset(noisebuf, 0, size*size*sizeof(int)); for (g2 = startgrid;g2;g2 >>= 1) @@ -32,7 +38,7 @@ void fractalnoise(qbyte *noise, int size, int startgrid) g = g2 >> 1; if (g) { - // subdivide, diamond-square algorythm (really this has little to do with squares) + // subdivide, diamond-square algorithm (really this has little to do with squares) // diamond for (y = 0;y < size;y += g2) for (x = 0;x < size;x += g2) @@ -72,11 +78,17 @@ void fractalnoisequick(qbyte *noise, int size, int startgrid) for (sizepower = 0;(1 << sizepower) < size;sizepower++); if (size != (1 << sizepower)) - Sys_Error("fractalnoise: size must be power of 2\n"); + { + Con_Printf("fractalnoise: size must be power of 2\n"); + return; + } for (gridpower = 0;(1 << gridpower) < startgrid;gridpower++); if (startgrid != (1 << gridpower)) - Sys_Error("fractalnoise: grid must be power of 2\n"); + { + Con_Printf("fractalnoise: grid must be power of 2\n"); + return; + } startgrid = bound(0, startgrid, size); @@ -94,7 +106,7 @@ void fractalnoisequick(qbyte *noise, int size, int startgrid) g = g2 >> 1; if (g) { - // subdivide, diamond-square algorythm (really this has little to do with squares) + // subdivide, diamond-square algorithm (really this has little to do with squares) // diamond for (y = 0;y < size;y += g2) for (x = 0;x < size;x += g2)