Ignore:
Timestamp:
08/26/14 04:03:10 (11 years ago)
Author:
epyon
Message:
  • nova now compiles again under all three compilers with -Winsane and no warnings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/formats/md3_loader.cc

    r319 r323  
    234234
    235235md3_loader::md3_loader( bool merge_all )
    236         : m_md3( nullptr ), m_merge_all( merge_all )
     236        : m_merge_all( merge_all ), m_md3( nullptr )
    237237{
    238238        if ( !s_normal_ready )
     
    286286{
    287287        md3_t* md3 = (md3_t*)m_md3;
    288         key_raw_channel* result = key_raw_channel::create<md3_key>( md3->header.num_frames );
     288        key_raw_channel* result = key_raw_channel::create<md3_key>( (uint32)md3->header.num_frames );
    289289        // TODO: is this brain damaged in efficiency (loop nest order) or what?
    290290        for ( sint32 f = 0; f < md3->header.num_frames; ++f )
     
    322322{
    323323        mesh_data* data = new mesh_data;
    324         release_mesh_frame( data, -1, index );
     324        release_mesh_frame( data, -1, (sint32)index );
    325325        return data;
    326326}
     
    329329{
    330330        md3_t* md3 = (md3_t*)m_md3;
    331         sint32 num_surfaces  = md3->header.num_surfaces;
    332         sint32 num_verts     = 0;
    333         sint32 current_frame = ( frame == -1 ? 0 : frame );
    334         sint32 frame_count   = ( frame == -1 ? md3->header.num_frames : 1 );
    335         sint32 current_surf  = ( surface == -1 ? 0 : surface );
    336         sint32 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
    337         sint32 index_count   = 0;
     331        uint32 num_surfaces  = (uint32)md3->header.num_surfaces;
     332        uint32 num_verts     = 0;
     333        uint32 current_frame = ( frame == -1 ? 0 : (uint32)frame );
     334        uint32 frame_count   = ( frame == -1 ? (uint32)md3->header.num_frames : 1 );
     335        uint32 current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     336        uint32 surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
     337        uint32 index_count   = 0;
    338338
    339339        if ( surface >= 0 )
    340340        {
    341                 index_count = md3->surfaces[surface].header.num_triangles * 3;
    342                 num_verts   = md3->surfaces[surface].header.num_verts;
     341                index_count = (uint32)md3->surfaces[(uint32)surface].header.num_triangles * 3;
     342                num_verts   = (uint32)md3->surfaces[(uint32)surface].header.num_verts;
    343343        }
    344344        else
    345                 for ( sint32 i = 0; i < num_surfaces; ++i )
    346                 {
    347                         index_count += md3->surfaces[i].header.num_triangles * 3;
    348                         num_verts   += md3->surfaces[i].header.num_verts;
     345                for ( uint32 i = 0; i < num_surfaces; ++i )
     346                {
     347                        index_count += (uint32)md3->surfaces[i].header.num_triangles * 3;
     348                        num_verts   += (uint32)md3->surfaces[i].header.num_verts;
    349349                }
    350350
     
    362362        while ( surf_count > 0 )
    363363        {
    364                 const md3_surface_t& surface = md3->surfaces[ current_surf ];
    365                 const uint32         vcount  = static_cast< uint32 >( surface.header.num_verts );
    366                 const uint32         tcount  = static_cast< uint32 >( surface.header.num_triangles );
     364                const md3_surface_t& sface = md3->surfaces[ current_surf ];
     365                const uint32         vcount = static_cast< uint32 >( sface.header.num_verts );
     366                const uint32         tcount = static_cast< uint32 >( sface.header.num_triangles );
    367367
    368368                for (uint32 j = 0; j < vcount; ++j )
    369369                {
    370                         vtx_t[index++].texcoord = md3_texcoord( surface.st[j] );
     370                        vtx_t[index++].texcoord = md3_texcoord( sface.st[j] );
    371371                }
    372372
    373373                for (size_t j = 0; j < tcount; ++j )
    374374                {
    375                         const md3_triangle_t& t = surface.triangles[j];
     375                        const md3_triangle_t& t = sface.triangles[j];
    376376                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[0] );
    377377                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[1] );
    378378                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[2] );
    379379                }
    380                 index_base += surface.header.num_verts;
     380                index_base += sface.header.num_verts;
    381381                ++current_surf;
    382382                --surf_count;
     
    386386        while ( frame_count > 0 )
    387387        {
    388                 current_surf  = ( surface == -1 ? 0 : surface );
    389                 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
     388                current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     389                surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
    390390
    391391                while ( surf_count > 0 )
    392392                {
    393                         md3_surface_t& surface = md3->surfaces[current_surf];
    394                         sint32         vcount  = surface.header.num_verts;
    395                         sint32         offset = vcount * current_frame;
    396                         sint32         limit   = vcount + offset;
    397                         for (sint32 j = offset; j < limit; ++j )
     393                        md3_surface_t& sface = md3->surfaces[current_surf];
     394                        uint32         vcount = (uint32)sface.header.num_verts;
     395                        uint32         offset = vcount * current_frame;
     396                        uint32         limit  = vcount + offset;
     397                        for (uint32 j = offset; j < limit; ++j )
    398398                        {
    399                                 md3_vertex_t& v = surface.vertices[j];
     399                                md3_vertex_t& v = sface.vertices[j];
    400400                                vtx_pn[index].position = vec3( v.x * MD3_XYZ_SCALE, v.z * MD3_XYZ_SCALE, v.y * MD3_XYZ_SCALE );
    401401                                vtx_pn[index].normal   = s_normal_cache[ v.normal ];
     
    418418{
    419419        md3_t* md3 = (md3_t*)m_md3;
    420         uint32 node_count = md3->header.num_tags;
     420        uint32 node_count = (uint32)md3->header.num_tags;
    421421        if ( node_count == 0 ) return nullptr;;
    422422        mesh_node_data* nodes = new mesh_node_data[ node_count ];
     
    451451        else
    452452        {
    453                 count = md3->header.num_surfaces;
     453                count = (uint32)md3->header.num_surfaces;
    454454                data = new mesh_data[ count ];
    455455                for ( uint32 i = 0; i < count; ++i )
    456456                {
    457                         release_mesh_frame( &data[i], -1, i );
     457                        release_mesh_frame( &data[i], -1, (sint32)i );
    458458                        data[i].set_name( (char*)md3->surfaces[i].header.name );
    459459                }
Note: See TracChangeset for help on using the changeset viewer.