X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Flightmaps.c;h=34213d109709cf8ca1fd1b4286c1dd36f425b5de;hp=13f5c533bccd40a312e392cf2dc65a9a091b351d;hb=e4287c28bb2dafedc81c66e63951d947cfbeb225;hpb=203343b01a7ad87cb3d136689c9936ff5bc23c01 diff --git a/tools/quake3/q3map2/lightmaps.c b/tools/quake3/q3map2/lightmaps.c index 13f5c533..34213d10 100644 --- a/tools/quake3/q3map2/lightmaps.c +++ b/tools/quake3/q3map2/lightmaps.c @@ -1,45 +1,45 @@ /* -Copyright (C) 1999-2007 id Software, Inc. and contributors. -For a list of contributors, see the accompanying CONTRIBUTORS file. + Copyright (C) 1999-2007 id Software, Inc. and contributors. + For a list of contributors, see the accompanying CONTRIBUTORS file. -This file is part of GtkRadiant. + This file is part of GtkRadiant. -GtkRadiant 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. + GtkRadiant 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. -GtkRadiant 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. + GtkRadiant 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 GtkRadiant; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include "qbsp.h" /* - Lightmap allocation has to be done after all flood filling and - visible surface determination. + Lightmap allocation has to be done after all flood filling and + visible surface determination. -*/ + */ -int numSortShaders; -mapDrawSurface_t **surfsOnShader; +int numSortShaders; +mapDrawSurface_t **surfsOnShader; int allocatedSurfsOnShader; -int allocated[ LIGHTMAP_WIDTH ]; +int allocated[ LIGHTMAP_WIDTH ]; -int numLightmaps = 1; -int c_exactLightmap = 0; -int c_planarPatch = 0; -int c_nonplanarLightmap = 0; +int numLightmaps = 1; +int c_exactLightmap = 0; +int c_planarPatch = 0; +int c_nonplanarLightmap = 0; void PrepareNewLightmap( void ) { @@ -48,41 +48,40 @@ void PrepareNewLightmap( void ) { } /* -=============== -AllocLMBlock + =============== + AllocLMBlock -returns a texture number and the position inside it -=============== -*/ -qboolean AllocLMBlock (int w, int h, int *x, int *y) -{ - int i, j; - int best, best2; + returns a texture number and the position inside it + =============== + */ +qboolean AllocLMBlock( int w, int h, int *x, int *y ){ + int i, j; + int best, best2; best = LIGHTMAP_HEIGHT; - for ( i=0 ; i <= LIGHTMAP_WIDTH-w ; i++ ) { + for ( i = 0 ; i <= LIGHTMAP_WIDTH - w ; i++ ) { best2 = 0; - for (j=0 ; j= best) { + for ( j = 0 ; j < w ; j++ ) { + if ( allocated[i + j] >= best ) { break; } - if (allocated[i+j] > best2) { - best2 = allocated[i+j]; + if ( allocated[i + j] > best2 ) { + best2 = allocated[i + j]; } } - if (j == w) { // this is a valid spot + if ( j == w ) { // this is a valid spot *x = i; *y = best = best2; } } - if (best + h > LIGHTMAP_HEIGHT) { + if ( best + h > LIGHTMAP_HEIGHT ) { return qfalse; } - for (i=0 ; i