================= R_LoadSubmodels ================= */
| 735 | ================= |
| 736 | */ |
| 737 | static void R_LoadSubmodels( lump_t *l, world_t &worldData, int index ) { |
| 738 | dmodel_t *in; |
| 739 | bmodel_t *out; |
| 740 | int i, j, count; |
| 741 | |
| 742 | in = (dmodel_t *)(fileBase + l->fileofs); |
| 743 | if (l->filelen % sizeof(*in)) |
| 744 | Com_Error (ERR_DROP, "LoadMap: funny lump size in %s",worldData.name); |
| 745 | count = l->filelen / sizeof(*in); |
| 746 | |
| 747 | worldData.bmodels = out = (bmodel_t *) R_Hunk_Alloc( count * sizeof(*out), qtrue ); |
| 748 | |
| 749 | for ( i=0 ; i<count ; i++, in++, out++ ) { |
| 750 | model_t *model; |
| 751 | |
| 752 | model = R_AllocModel(); |
| 753 | |
| 754 | assert( model != NULL ); // this should never happen |
| 755 | if ( model == NULL ) { |
| 756 | ri.Error(ERR_DROP, "R_LoadSubmodels: R_AllocModel() failed"); |
| 757 | } |
| 758 | |
| 759 | model->type = MOD_BRUSH; |
| 760 | model->bmodel = out; |
| 761 | if (index) |
| 762 | { |
| 763 | Com_sprintf( model->name, sizeof( model->name ), "*%d-%d", index, i ); |
| 764 | model->bspInstance = true; |
| 765 | } |
| 766 | else |
| 767 | { |
| 768 | Com_sprintf( model->name, sizeof( model->name ), "*%d", i); |
| 769 | } |
| 770 | |
| 771 | for (j=0 ; j<3 ; j++) { |
| 772 | out->bounds[0][j] = LittleFloat (in->mins[j]); |
| 773 | out->bounds[1][j] = LittleFloat (in->maxs[j]); |
| 774 | } |
| 775 | /* |
| 776 | Ghoul2 Insert Start |
| 777 | */ |
| 778 | |
| 779 | RE_InsertModelIntoHash(model->name, model); |
| 780 | /* |
| 781 | Ghoul2 Insert End |
| 782 | */ |
| 783 | |
| 784 | out->firstSurface = worldData.surfaces + LittleLong( in->firstSurface ); |
| 785 | out->numSurfaces = LittleLong( in->numSurfaces ); |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | |
| 790 |
no test coverage detected