my own uncrustify run
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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 "imageq2.h"
|
||||
|
||||
@@ -37,19 +37,17 @@ class ImageDependencies : public GlobalFileSystemModuleRef
|
||||
|
||||
class ImageWalAPI
|
||||
{
|
||||
_QERPlugImageTable m_imagewal;
|
||||
_QERPlugImageTable m_imagewal;
|
||||
public:
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT(Name, "wal");
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT( Name, "wal" );
|
||||
|
||||
ImageWalAPI()
|
||||
{
|
||||
m_imagewal.loadImage = LoadWal;
|
||||
}
|
||||
_QERPlugImageTable* getTable()
|
||||
{
|
||||
return &m_imagewal;
|
||||
}
|
||||
ImageWalAPI(){
|
||||
m_imagewal.loadImage = LoadWal;
|
||||
}
|
||||
_QERPlugImageTable* getTable(){
|
||||
return &m_imagewal;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<ImageWalAPI, ImageDependencies> ImageWalModule;
|
||||
@@ -60,19 +58,17 @@ ImageWalModule g_ImageWalModule;
|
||||
|
||||
class ImageM8API
|
||||
{
|
||||
_QERPlugImageTable m_imagem8;
|
||||
_QERPlugImageTable m_imagem8;
|
||||
public:
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT(Name, "m8");
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT( Name, "m8" );
|
||||
|
||||
ImageM8API()
|
||||
{
|
||||
m_imagem8.loadImage = LoadM8;
|
||||
}
|
||||
_QERPlugImageTable* getTable()
|
||||
{
|
||||
return &m_imagem8;
|
||||
}
|
||||
ImageM8API(){
|
||||
m_imagem8.loadImage = LoadM8;
|
||||
}
|
||||
_QERPlugImageTable* getTable(){
|
||||
return &m_imagem8;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<ImageM8API, ImageDependencies> ImageM8Module;
|
||||
@@ -83,19 +79,17 @@ ImageM8Module g_ImageM8Module;
|
||||
|
||||
class ImageM32API
|
||||
{
|
||||
_QERPlugImageTable m_imagem32;
|
||||
_QERPlugImageTable m_imagem32;
|
||||
public:
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT(Name, "m32");
|
||||
typedef _QERPlugImageTable Type;
|
||||
STRING_CONSTANT( Name, "m32" );
|
||||
|
||||
ImageM32API()
|
||||
{
|
||||
m_imagem32.loadImage = LoadM32;
|
||||
}
|
||||
_QERPlugImageTable* getTable()
|
||||
{
|
||||
return &m_imagem32;
|
||||
}
|
||||
ImageM32API(){
|
||||
m_imagem32.loadImage = LoadM32;
|
||||
}
|
||||
_QERPlugImageTable* getTable(){
|
||||
return &m_imagem32;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SingletonModule<ImageM32API, ImageDependencies> ImageM32Module;
|
||||
@@ -104,11 +98,10 @@ ImageM32Module g_ImageM32Module;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
|
||||
{
|
||||
initialiseModule(server);
|
||||
extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
|
||||
initialiseModule( server );
|
||||
|
||||
g_ImageWalModule.selfRegister();
|
||||
g_ImageM8Module.selfRegister();
|
||||
g_ImageM32Module.selfRegister();
|
||||
g_ImageWalModule.selfRegister();
|
||||
g_ImageM8Module.selfRegister();
|
||||
g_ImageM32Module.selfRegister();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IMAGEQ2_H)
|
||||
#if !defined( INCLUDED_IMAGEQ2_H )
|
||||
#define INCLUDED_IMAGEQ2_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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 "wal.h"
|
||||
|
||||
@@ -35,123 +35,120 @@ typedef unsigned char byte;
|
||||
|
||||
struct pcx_header_t
|
||||
{
|
||||
char manufacturer;
|
||||
char version;
|
||||
char encoding;
|
||||
char bits_per_pixel;
|
||||
char manufacturer;
|
||||
char version;
|
||||
char encoding;
|
||||
char bits_per_pixel;
|
||||
};
|
||||
|
||||
void LoadPCXPalette(const char *filename, byte palette[768])
|
||||
{
|
||||
byte* buffer;
|
||||
int length = vfsLoadFile (filename, (void **)&buffer);
|
||||
if(buffer == 0)
|
||||
void LoadPCXPalette( const char *filename, byte palette[768] ){
|
||||
byte* buffer;
|
||||
int length = vfsLoadFile( filename, (void **)&buffer );
|
||||
if ( buffer == 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pcx_header_t* pcx = reinterpret_cast<const pcx_header_t*>(buffer);
|
||||
const pcx_header_t* pcx = reinterpret_cast<const pcx_header_t*>( buffer );
|
||||
|
||||
if (pcx->manufacturer != 0x0a
|
||||
|| pcx->version != 5
|
||||
|| pcx->encoding != 1
|
||||
|| pcx->bits_per_pixel != 8)
|
||||
return;
|
||||
if ( pcx->manufacturer != 0x0a
|
||||
|| pcx->version != 5
|
||||
|| pcx->encoding != 1
|
||||
|| pcx->bits_per_pixel != 8 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(palette, buffer + length - 768, 768);
|
||||
memcpy( palette, buffer + length - 768, 768 );
|
||||
|
||||
vfsFreeFile(buffer);
|
||||
vfsFreeFile( buffer );
|
||||
}
|
||||
|
||||
const int WAL_NAME_LENGTH = 32;
|
||||
const int WAL_MIPMAP_COUNT = 4;
|
||||
struct wal_header_t
|
||||
{
|
||||
char name[WAL_NAME_LENGTH];
|
||||
unsigned width, height;
|
||||
unsigned offsets[WAL_MIPMAP_COUNT]; // four mip maps stored
|
||||
char animname[WAL_NAME_LENGTH]; // next frame in animation chain
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
char name[WAL_NAME_LENGTH];
|
||||
unsigned width, height;
|
||||
unsigned offsets[WAL_MIPMAP_COUNT]; // four mip maps stored
|
||||
char animname[WAL_NAME_LENGTH]; // next frame in animation chain
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
};
|
||||
|
||||
const int M8_NAME_LENGTH = 32;
|
||||
const int M8_MIPMAP_COUNT = 16;
|
||||
struct m8_header_t
|
||||
{
|
||||
int version;
|
||||
char name[M8_NAME_LENGTH];
|
||||
unsigned width[M8_MIPMAP_COUNT], height[M8_MIPMAP_COUNT]; // width and height of each mipmap
|
||||
unsigned offsets[M8_MIPMAP_COUNT]; // 16 mip maps stored
|
||||
char animname[M8_NAME_LENGTH]; // next frame in animation chain
|
||||
byte palette[768]; // palette stored in m8
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
int version;
|
||||
char name[M8_NAME_LENGTH];
|
||||
unsigned width[M8_MIPMAP_COUNT], height[M8_MIPMAP_COUNT]; // width and height of each mipmap
|
||||
unsigned offsets[M8_MIPMAP_COUNT]; // 16 mip maps stored
|
||||
char animname[M8_NAME_LENGTH]; // next frame in animation chain
|
||||
byte palette[768]; // palette stored in m8
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
};
|
||||
|
||||
Image* LoadMipTex(byte* buffer, byte TypeofTex)
|
||||
{
|
||||
int w, h, offset, flags, contents, value;
|
||||
byte palette[768];
|
||||
byte* source;
|
||||
Image* LoadMipTex( byte* buffer, byte TypeofTex ){
|
||||
int w, h, offset, flags, contents, value;
|
||||
byte palette[768];
|
||||
byte* source;
|
||||
|
||||
PointerInputStream inputStream(buffer);
|
||||
PointerInputStream inputStream( buffer );
|
||||
|
||||
if ( TypeofTex == HERETIC2_M8 )
|
||||
{
|
||||
inputStream.seek(4 + M8_NAME_LENGTH); // version, name
|
||||
w = istream_read_int32_le(inputStream);
|
||||
inputStream.seek(4 * (M8_MIPMAP_COUNT - 1)); // remaining widths
|
||||
h = istream_read_int32_le(inputStream);
|
||||
inputStream.seek(4 * (M8_MIPMAP_COUNT - 1)); // remaining heights
|
||||
offset = istream_read_int32_le(inputStream);
|
||||
inputStream.seek(4 * (M8_MIPMAP_COUNT - 1)); // remaining offsets
|
||||
inputStream.seek(M8_NAME_LENGTH); // animname
|
||||
inputStream.read(palette, 768);
|
||||
flags = istream_read_int32_le(inputStream);
|
||||
contents = istream_read_int32_le(inputStream);
|
||||
value = istream_read_int32_le(inputStream);
|
||||
source = buffer + offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadPCXPalette("pics/colormap.pcx", palette);
|
||||
if ( TypeofTex == HERETIC2_M8 ) {
|
||||
inputStream.seek( 4 + M8_NAME_LENGTH ); // version, name
|
||||
w = istream_read_int32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M8_MIPMAP_COUNT - 1 ) ); // remaining widths
|
||||
h = istream_read_int32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M8_MIPMAP_COUNT - 1 ) ); // remaining heights
|
||||
offset = istream_read_int32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M8_MIPMAP_COUNT - 1 ) ); // remaining offsets
|
||||
inputStream.seek( M8_NAME_LENGTH ); // animname
|
||||
inputStream.read( palette, 768 );
|
||||
flags = istream_read_int32_le( inputStream );
|
||||
contents = istream_read_int32_le( inputStream );
|
||||
value = istream_read_int32_le( inputStream );
|
||||
source = buffer + offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadPCXPalette( "pics/colormap.pcx", palette );
|
||||
|
||||
inputStream.seek(WAL_NAME_LENGTH); // name
|
||||
w = istream_read_int32_le(inputStream);
|
||||
h = istream_read_int32_le(inputStream);
|
||||
offset = istream_read_int32_le(inputStream);
|
||||
inputStream.seek(4 * (WAL_MIPMAP_COUNT - 1)); // remaining offsets
|
||||
inputStream.seek(WAL_NAME_LENGTH); // animname
|
||||
flags = istream_read_int32_le(inputStream);
|
||||
contents = istream_read_int32_le(inputStream);
|
||||
value = istream_read_int32_le(inputStream);
|
||||
source = buffer + offset;
|
||||
}
|
||||
inputStream.seek( WAL_NAME_LENGTH ); // name
|
||||
w = istream_read_int32_le( inputStream );
|
||||
h = istream_read_int32_le( inputStream );
|
||||
offset = istream_read_int32_le( inputStream );
|
||||
inputStream.seek( 4 * ( WAL_MIPMAP_COUNT - 1 ) ); // remaining offsets
|
||||
inputStream.seek( WAL_NAME_LENGTH ); // animname
|
||||
flags = istream_read_int32_le( inputStream );
|
||||
contents = istream_read_int32_le( inputStream );
|
||||
value = istream_read_int32_le( inputStream );
|
||||
source = buffer + offset;
|
||||
}
|
||||
|
||||
RGBAImageFlags* image = new RGBAImageFlags(w, h, flags, contents, value);
|
||||
RGBAImageFlags* image = new RGBAImageFlags( w, h, flags, contents, value );
|
||||
|
||||
byte* dest = image->getRGBAPixels();
|
||||
byte* end = source + (w * h);
|
||||
for(; source != end; ++source, dest += 4)
|
||||
{
|
||||
*(dest + 0) = palette[*source * 3 + 0];
|
||||
*(dest + 1) = palette[*source * 3 + 1];
|
||||
*(dest + 2) = palette[*source * 3 + 2];
|
||||
*(dest + 3) = 255;
|
||||
}
|
||||
byte* dest = image->getRGBAPixels();
|
||||
byte* end = source + ( w * h );
|
||||
for (; source != end; ++source, dest += 4 )
|
||||
{
|
||||
*( dest + 0 ) = palette[*source * 3 + 0];
|
||||
*( dest + 1 ) = palette[*source * 3 + 1];
|
||||
*( dest + 2 ) = palette[*source * 3 + 2];
|
||||
*( dest + 3 ) = 255;
|
||||
}
|
||||
|
||||
return image;
|
||||
return image;
|
||||
}
|
||||
|
||||
Image* LoadWal(ArchiveFile& file)
|
||||
{
|
||||
ScopedArchiveBuffer buffer(file);
|
||||
return LoadMipTex( buffer.buffer, QUAKE2_WAL );
|
||||
Image* LoadWal( ArchiveFile& file ){
|
||||
ScopedArchiveBuffer buffer( file );
|
||||
return LoadMipTex( buffer.buffer, QUAKE2_WAL );
|
||||
}
|
||||
|
||||
Image* LoadM8(ArchiveFile& file)
|
||||
{
|
||||
ScopedArchiveBuffer buffer(file);
|
||||
return LoadMipTex( buffer.buffer, HERETIC2_M8 );
|
||||
Image* LoadM8( ArchiveFile& file ){
|
||||
ScopedArchiveBuffer buffer( file );
|
||||
return LoadMipTex( buffer.buffer, HERETIC2_M8 );
|
||||
}
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined (INCLUDED_WAL_H)
|
||||
#if !defined ( INCLUDED_WAL_H )
|
||||
#define INCLUDED_WAL_H
|
||||
|
||||
class Image;
|
||||
class ArchiveFile;
|
||||
|
||||
Image* LoadWal(ArchiveFile& file);
|
||||
Image* LoadM8(ArchiveFile& file);
|
||||
Image* LoadWal( ArchiveFile& file );
|
||||
Image* LoadM8( ArchiveFile& file );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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 "wal32.h"
|
||||
|
||||
@@ -33,60 +33,57 @@ const int M32_MIPMAP_COUNT = 16;
|
||||
|
||||
typedef struct m32_header_t
|
||||
{
|
||||
int version;
|
||||
char name[M32_NAME_LENGTH];
|
||||
char altname[M32_NAME_LENGTH]; // texture substitution
|
||||
char animname[M32_NAME_LENGTH]; // next frame in animation chain
|
||||
char damagename[M32_NAME_LENGTH]; // image that should be shown when damaged
|
||||
unsigned width[M32_MIPMAP_COUNT], height[M32_MIPMAP_COUNT];
|
||||
unsigned offsets[M32_MIPMAP_COUNT];
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
float scale_x, scale_y;
|
||||
int mip_scale;
|
||||
int version;
|
||||
char name[M32_NAME_LENGTH];
|
||||
char altname[M32_NAME_LENGTH]; // texture substitution
|
||||
char animname[M32_NAME_LENGTH]; // next frame in animation chain
|
||||
char damagename[M32_NAME_LENGTH]; // image that should be shown when damaged
|
||||
unsigned width[M32_MIPMAP_COUNT], height[M32_MIPMAP_COUNT];
|
||||
unsigned offsets[M32_MIPMAP_COUNT];
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
float scale_x, scale_y;
|
||||
int mip_scale;
|
||||
|
||||
// detail texturing info
|
||||
char dt_name[M32_NAME_LENGTH]; // detailed texture name
|
||||
float dt_scale_x, dt_scale_y;
|
||||
float dt_u, dt_v;
|
||||
float dt_alpha;
|
||||
int dt_src_blend_mode, dt_dst_blend_mode;
|
||||
// detail texturing info
|
||||
char dt_name[M32_NAME_LENGTH]; // detailed texture name
|
||||
float dt_scale_x, dt_scale_y;
|
||||
float dt_u, dt_v;
|
||||
float dt_alpha;
|
||||
int dt_src_blend_mode, dt_dst_blend_mode;
|
||||
|
||||
int unused[20]; // future expansion to maintain compatibility with h2
|
||||
int unused[20]; // future expansion to maintain compatibility with h2
|
||||
} m32_header_t;
|
||||
|
||||
|
||||
Image* LoadM32Buff(byte* buffer)
|
||||
{
|
||||
PointerInputStream inputStream(buffer);
|
||||
Image* LoadM32Buff( byte* buffer ){
|
||||
PointerInputStream inputStream( buffer );
|
||||
|
||||
inputStream.seek(4 // version
|
||||
+ M32_NAME_LENGTH // name
|
||||
+ M32_NAME_LENGTH // altname
|
||||
+ M32_NAME_LENGTH // animname
|
||||
+ M32_NAME_LENGTH); // damagename
|
||||
int w = istream_read_uint32_le(inputStream);
|
||||
inputStream.seek(4 * (M32_MIPMAP_COUNT - 1)); // remaining widths
|
||||
int h = istream_read_uint32_le(inputStream);
|
||||
inputStream.seek(4 * (M32_MIPMAP_COUNT - 1)); // remaining heights
|
||||
int offset = istream_read_uint32_le(inputStream);
|
||||
inputStream.seek(4 * (M32_MIPMAP_COUNT - 1)); // remaining offsets
|
||||
int flags = istream_read_uint32_le(inputStream);
|
||||
int contents = istream_read_uint32_le(inputStream);
|
||||
int value = istream_read_uint32_le(inputStream);
|
||||
inputStream.seek( 4 // version
|
||||
+ M32_NAME_LENGTH // name
|
||||
+ M32_NAME_LENGTH // altname
|
||||
+ M32_NAME_LENGTH // animname
|
||||
+ M32_NAME_LENGTH ); // damagename
|
||||
int w = istream_read_uint32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M32_MIPMAP_COUNT - 1 ) ); // remaining widths
|
||||
int h = istream_read_uint32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M32_MIPMAP_COUNT - 1 ) ); // remaining heights
|
||||
int offset = istream_read_uint32_le( inputStream );
|
||||
inputStream.seek( 4 * ( M32_MIPMAP_COUNT - 1 ) ); // remaining offsets
|
||||
int flags = istream_read_uint32_le( inputStream );
|
||||
int contents = istream_read_uint32_le( inputStream );
|
||||
int value = istream_read_uint32_le( inputStream );
|
||||
|
||||
RGBAImageFlags* image = new RGBAImageFlags(w, h, flags, contents, value);
|
||||
RGBAImageFlags* image = new RGBAImageFlags( w, h, flags, contents, value );
|
||||
|
||||
const byte* source = buffer + offset;
|
||||
std::copy(source, source + (w * h * 4), image->getRGBAPixels());
|
||||
const byte* source = buffer + offset;
|
||||
std::copy( source, source + ( w * h * 4 ), image->getRGBAPixels() );
|
||||
|
||||
return image;
|
||||
return image;
|
||||
}
|
||||
|
||||
Image* LoadM32(ArchiveFile& file)
|
||||
{
|
||||
ScopedArchiveBuffer buffer(file);
|
||||
return LoadM32Buff(buffer.buffer);
|
||||
Image* LoadM32( ArchiveFile& file ){
|
||||
ScopedArchiveBuffer buffer( file );
|
||||
return LoadM32Buff( buffer.buffer );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#if !defined (INCLUDED_WAL32_H)
|
||||
#if !defined ( INCLUDED_WAL32_H )
|
||||
#define INCLUDED_WAL32_H
|
||||
|
||||
class Image;
|
||||
class ArchiveFile;
|
||||
|
||||
Image* LoadM32(ArchiveFile& file);
|
||||
Image* LoadM32( ArchiveFile& file );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user