md3 = (const md3_t*) buffer;
/* check md3 magic */
- if ( *( (const int*) md3->magic ) != *( (const int*) MD3_MAGIC ) ) {
+ if ( memcmp( md3->magic, MD3_MAGIC, 4 ) != 0 ) {
return PICO_PMV_ERROR_IDENT;
}
md3 = (md3_t*) bb;
/* check ident and version */
- if ( *( (int*) md3->magic ) != *( (int*) MD3_MAGIC ) || _pico_little_long( md3->version ) != MD3_VERSION ) {
+ if ( memcmp( md3->magic, MD3_MAGIC, 4 ) != 0 || _pico_little_long( md3->version ) != MD3_VERSION ) {
/* not an md3 file (todo: set error) */
_pico_free( bb0 );
return NULL;
SwapBlock( (int*) ( (byte*) header + sizeof( int ) ), sizeof( *header ) - sizeof( int ) );
/* make sure it matches the format we're trying to load */
- if ( force == qfalse && *( (int*) header->ident ) != *( (int*) game->bspIdent ) ) {
+ if ( force == qfalse && memcmp( header->ident, game->bspIdent, 4 ) != 0 ) {
Error( "%s is not a %s file", filename, game->bspIdent );
}
if ( force == qfalse && header->version != game->bspVersion ) {
//% Swapfile();
/* set up header */
- *( (int*) (bspHeader_t*) header->ident ) = *( (int*) game->bspIdent );
+ memcpy(header->ident, game->bspIdent, 4);
header->version = LittleLong( game->bspVersion );
/* write initial header */
/* add marker lump */
const char marker[] = "I LOVE MY Q3MAP2";
- AddLump( file, header, 0, marker, strlen( marker ) + 1 );
+ AddLump( file, (bspHeader_t*) header, 0, marker, strlen( marker ) + 1 );
/* add lumps */
AddLump( file, (bspHeader_t*) header, LUMP_SHADERS, bspShaders, numBSPShaders * sizeof( bspShader_t ) );
/* clear lightgrid */
for ( i = 0; i < numRawGridPoints; i++ )
{
- VectorCopy( ambientColor, rawGridPoints[ i ].ambient[ j ] );
+ VectorCopy( ambientColor, rawGridPoints[ i ].ambient[ 0 ] );
rawGridPoints[ i ].styles[ 0 ] = LS_NORMAL;
bspGridPoints[ i ].styles[ 0 ] = LS_NORMAL;
for ( j = 1; j < MAX_LIGHTMAPS; j++ )
{
+ VectorCopy( ambientColor, rawGridPoints[ i ].ambient[ j ] );
rawGridPoints[ i ].styles[ j ] = LS_NONE;
bspGridPoints[ i ].styles[ j ] = LS_NONE;
}