#include <acknex.h>
STRING *str = "";
TEXT *txtLevels =
{
string = ( "level00", "level01" );
}
TEXT *txtConfigs =
{
string = (
" -pal palette.pcx -az 0 -el 60 -sunrgb 58 58 58 -ambrgb 19 19 19 -fog1 100 100 100 -fog2 19 39 100 -fog3 100 19 19 -noportals -hiprec -litmapsonly -writelog -mesh -mergeacross -terralit -tesselate -close -solidsky -nodetail -quiet -supsam -threads 4 -gamma 2.25 -phongangle 120 -lmambient 50 -sizeshaded 236 -litres 0.37 -litcomp 0.20 -litmax 255 -litscale 0.68 -radsubdiv 64 -radbounce 3 -bound 56000 -fat 64 48 8 -narrow 32 32 0"
" -pal palette.pcx -az 0 -el 60 -sunrgb 58 58 58 -ambrgb 19 19 19 -fog1 100 100 100 -fog2 19 39 100 -fog3 100 19 19 -noportals -hiprec -litmapsonly -writelog -mesh -mergeacross -terralit -tesselate -close -solidsky -nodetail -quiet -supsam -threads 4 -gamma 2.25 -phongangle 120 -lmambient 50 -sizeshaded 236 -litres 0.37 -litcomp 0.20 -litmax 255 -litscale 0.68 -radsubdiv 64 -radbounce 3 -bound 56000 -fat 64 48 8 -narrow 32 32 0"
);
}
typedef struct
{
char buffer[6000];
char *chr;
long size;
} ENT_BUFFER;
ENT_BUFFER entBuffer;
void entBuffer_startup ()
{
entBuffer.chr = entBuffer.buffer;
entBuffer.size = 0;
}
void entBufferLevel ( STRING *_str )
{
long _size = str_len ( _str );
memcpy ( entBuffer.chr, _str->chars, _size );
entBuffer.chr += _size;
*entBuffer.chr = 13;
entBuffer.chr ++;
*entBuffer.chr = 10;
entBuffer.chr ++;
entBuffer.size += _size + 2;
}
void entBufferAdd ( char *_chr, long _size )
{
memcpy ( entBuffer.chr, _chr, _size );
entBuffer.chr += _size;
entBuffer.size += _size;
}
void main ()
{
wait(1);
var levelIndex = 0;
for ( ; levelIndex<txtLevels->strings; levelIndex+=1 )
{
entBufferLevel ( (txtLevels->pstring)[levelIndex] );
var entIndex = 0;
str_cpy ( str, (txtLevels->pstring)[levelIndex] );
str_cat ( str, ".$$M" );
char *entityBlock = NULL;
long size;
char *buffer0 = file_load ( str, NULL, &size );
char *buffer = buffer0;
char *bufferLast = buffer + size;
for ( ; buffer<buffer0+size; buffer++ )
{
if ( *buffer == 123 ) // {
{
var pos = str_stri ( buffer, "model" );
if ( pos )
if ( pos < 10 )
entityBlock = buffer;
}
if ( entityBlock )
{
if ( *buffer == 125 ) // }
{
long size2 = 3 + (long)buffer - (long)entityBlock;
entBufferAdd ( entityBlock, size2 );
long size3 = size;
size3 -= (long)buffer - (long)buffer0;
memcpy ( entityBlock, buffer+3, size3 );
size -= size2;
buffer = entityBlock - 1;
entityBlock = NULL;
}
}
}
file_save ( str, buffer0, size );
file_load ( NULL, buffer0, &size );
str_cat ( str, (txtConfigs->pstring)[levelIndex] );
exec_wait ( "wwmp2wmb.exe", str );
}
file_save ( "level_entities.txt", entBuffer.buffer, entBuffer.size );
sys_exit ( NULL );
}