Permalink
Browse files

Added CMod_SetupAreasAndPortals

  • Loading branch information...
1 parent ac5527c commit 81b2d6a8ec0d00f334f98cef560cd1f4714fe171 @TheDushan committed Sep 6, 2012
@@ -228,7 +228,6 @@ void CMod_LoadNodes(lump_t * l) {
out->children[j] = child;
}
}
-
}
/*
@@ -266,6 +265,7 @@ void CMod_LoadBrushes(lump_t * l) {
count = l->filelen / sizeof(*in);
cm.brushes = (cbrush_t*)Hunk_Alloc((BOX_BRUSHES + count) * sizeof(*cm.brushes), h_high);
+ cm.brushCheckCounts = (int*)Hunk_Alloc( ( BOX_BRUSHES + count ) * sizeof( *cm.brushCheckCounts ), h_high );
cm.numBrushes = count;
out = cm.brushes;
@@ -285,6 +285,28 @@ void CMod_LoadBrushes(lump_t * l) {
}
+static void CMod_SetupAreasAndPortals( void )
+{
+ int i;
+
+ for( i = 0; i < cm.numLeafs; i++ )
+ {
+ const cLeaf_t *l = cm.leafs + i;
+
+ if( l->cluster >= cm.numClusters )
+ {
+ cm.numClusters = l->cluster + 1;
+ }
+ if( l->area >= cm.numAreas )
+ {
+ cm.numAreas = l->area + 1;
+ }
+ }
+
+ cm.areas = (cArea_t*)Hunk_Alloc( cm.numAreas * sizeof( *cm.areas ), h_high );
+ cm.areaPortals = (int*)Hunk_Alloc( cm.numAreas * cm.numAreas * sizeof( *cm.areaPortals ), h_high );
+}
+
/*
=================
CMod_LoadLeafs
@@ -325,8 +347,7 @@ void CMod_LoadLeafs(lump_t * l) {
}
}
- cm.areas = (cArea_t*)Hunk_Alloc(cm.numAreas * sizeof(*cm.areas), h_high);
- cm.areaPortals = (int*)Hunk_Alloc(cm.numAreas * cm.numAreas * sizeof(*cm.areaPortals), h_high);
+ CMod_SetupAreasAndPortals();
}
/*
@@ -949,6 +970,10 @@ void CM_LoadMapOLD(const char *name, qboolean clientload, int *checksum) {
// we are NOT freeing the file, because it is cached for the ref
FS_FreeFile(buf);
+
+ cm.brushCheckCounts = (int*)Hunk_Alloc( cm.numBrushes * sizeof( int ), h_high );
+ CMod_SetupAreasAndPortals();
+
CM_InitBoxHull();
CM_FloodAreaConnections();
@@ -957,6 +982,7 @@ void CM_LoadMapOLD(const char *name, qboolean clientload, int *checksum) {
if(!clientload) {
Q_strncpyz(cm.name, name, sizeof(cm.name));
}
+
}
/*
@@ -152,6 +152,7 @@ typedef struct {
cmodel_t *cmodels;
int numBrushes;
cbrush_t *brushes;
+ int *brushCheckCounts;
int numClusters;
int clusterBytes;
byte *visibility;
@@ -118,10 +118,10 @@ void CM_StoreBrushes(leafList_t * ll, int nodenum) {
for(k = 0; k < leaf->numLeafBrushes; k++) {
brushnum = cm.leafbrushes[leaf->firstLeafBrush + k];
b = &cm.brushes[brushnum];
- if(b->checkcount == cm.checkcount) {
+ if ( cm.brushCheckCounts[brushnum] == cm.checkcount ) {
continue; // already checked this brush in another leaf
}
- b->checkcount = cm.checkcount;
+ cm.brushCheckCounts[brushnum] = cm.checkcount;
for(i = 0; i < 3; i++) {
if(b->bounds[0][i] >= ll->bounds[1][i] || b->bounds[1][i] <= ll->bounds[0][i]) {
break;
@@ -342,12 +342,12 @@ void CM_TestInLeaf(traceWork_t * tw, cLeaf_t * leaf) {
{
brushnum = cm.leafbrushes[leaf->firstLeafBrush + k];
b = &cm.brushes[brushnum];
- if(b->checkcount == cm.checkcount) {
+ if( cm.brushCheckCounts[brushnum] == cm.checkcount) {
continue; // already checked this brush in another leaf
}
- b->checkcount = cm.checkcount;
+ cm.brushCheckCounts[brushnum] = cm.checkcount;
- if(!(b->contents & tw->contents)) {
+ if ( !(cm.shaders[b->shaderNum].contentFlags & tw->contents)) {
continue;
}
@@ -1181,12 +1181,12 @@ void CM_TraceThroughLeaf(traceWork_t * tw, cLeaf_t * leaf) {
brushnum = cm.leafbrushes[leaf->firstLeafBrush + k];
b = &cm.brushes[brushnum];
- if(b->checkcount == cm.checkcount) {
+ if ( cm.brushCheckCounts[brushnum] == cm.checkcount ) {
continue; // already checked this brush in another leaf
}
- b->checkcount = cm.checkcount;
+ cm.brushCheckCounts[brushnum] = cm.checkcount;
- if(!(b->contents & tw->contents)) {
+ if ( !(cm.shaders[b->shaderNum].contentFlags & tw->contents) ) {
continue;
}
@@ -183,7 +183,7 @@ SV_SetConfigstring
===============
*/
void SV_SetConfigstring (int index, const char *val) {
- int i;
+ int i, len, maxChunkSize = MAX_STRING_CHARS - 24;
client_t *client;
if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
@@ -218,7 +218,32 @@ void SV_SetConfigstring (int index, const char *val) {
continue;
}
- SV_SendConfigstring(client, index);
+ len = strlen( val );
+ if( len >= maxChunkSize ) {
+ int sent = 0, remaining = len;
+ char *cmd, buf[MAX_STRING_CHARS];
+
+ while (remaining > 0 ) {
+ if ( sent == 0 ) {
+ cmd = "bcs0";
+ }
+ else if( remaining < maxChunkSize ) {
+ cmd = "bcs2";
+ }
+ else {
+ cmd = "bcs1";
+ }
+ Q_strncpyz( buf, &val[sent], maxChunkSize );
+
+ SV_SendServerCommand( client, "%s %i \"%s\"\n", cmd, index, buf );
+
+ sent += (maxChunkSize - 1);
+ remaining -= (maxChunkSize - 1);
+ }
+ } else {
+ // standard cs, just send it
+ SV_SendConfigstring(client, index);
+ }
}
}
}

0 comments on commit 81b2d6a

Please sign in to comment.