aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-14 20:13:49 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-04-14 20:13:49 +0000
commit41fb69060a05f80ca82bf4bd8bb0dcdb745e1ee7 (patch)
tree7cd055e17e46a15e7582b64e1884abe1dcedd014 /code
parentce3190ed59121a8153e6d94e12a466a89093b009 (diff)
downloadioquake3-aero-41fb69060a05f80ca82bf4bd8bb0dcdb745e1ee7.tar.gz
ioquake3-aero-41fb69060a05f80ca82bf4bd8bb0dcdb745e1ee7.zip
* Fixes to MDR implementation from Thilo Schulz
git-svn-id: svn://svn.icculus.org/quake3/trunk@702 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/renderer/tr_model.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/code/renderer/tr_model.c b/code/renderer/tr_model.c
index a6bfb5d..de91065 100644
--- a/code/renderer/tr_model.c
+++ b/code/renderer/tr_model.c
@@ -660,19 +660,20 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char
curtri++;
}
- // tri and curtri now point to the end of their surfaces.
+ // tri now points to the end of the surface.
surf->ofsEnd = (byte *) tri - (byte *) surf;
-
- // find the next surface
surf = (mdrSurface_t *) tri;
- cursurf = (mdrSurface_t *) curtri;
+
+ // find the next surface.
+ cursurf = (mdrSurface_t *) ((byte *) cursurf + LittleLong(cursurf->ofsEnd));
}
// surf points to the next lod now.
lod->ofsEnd = (int)((byte *) surf - (byte *) lod);
-
lod = (mdrLOD_t *) surf;
- curlod = (mdrLOD_t *) cursurf;
+
+ // find the next LOD.
+ curlod = (mdrLOD_t *)((byte *) curlod + LittleLong(curlod->ofsEnd));
}
// lod points to the first tag now, so update the offset too.
@@ -958,7 +959,7 @@ static md3Tag_t *R_GetTag( md3Header_t *mod, int frame, const char *tagName ) {
#ifdef RAVENMD4
void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
{
- int i;
+ int i, j, k;
int frameSize;
mdrFrame_t *frame;
mdrTag_t *tag;
@@ -980,20 +981,13 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t
//
frameSize = (long)( &((mdrFrame_t *)0)->bones[ mod->numBones ] );
frame = (mdrFrame_t *)((byte *)mod + mod->ofsFrames + framenum * frameSize );
- #if 1
- VectorCopy(&frame->bones[tag->boneIndex].matrix[0][0], dest->axis[0] );
- VectorCopy(&frame->bones[tag->boneIndex].matrix[1][0], dest->axis[1] );
- VectorCopy(&frame->bones[tag->boneIndex].matrix[2][0], dest->axis[2] );
- #else
+
+ for (j = 0; j < 3; j++)
{
- int j,k;
- for (j=0;j<3;j++)
- {
- for (k=0;k<3;k++)
- dest->axis[j][k]=frame->bones[tag->boneIndex].matrix[k][j];
- }
+ for (k = 0; k < 3; k++)
+ dest->axis[j][k]=frame->bones[tag->boneIndex].matrix[k][j];
}
- #endif
+
dest->origin[0]=frame->bones[tag->boneIndex].matrix[0][3];
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];