summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2014-05-06 20:39:17 -0500
committerTim Angus <tim@ngus.net>2014-06-17 17:43:42 +0100
commitf38f1ac0608d0408c399212f33c1547dae1eea37 (patch)
tree0fab42b94eeedc692b5126eae843d9c900e63701
parent5a62c378be6dc66dee96c6916f700c0de71e2c78 (diff)
Make R_LerpTag return qfalse if MDR tag does not exist
Elite Force SDK has trap_R_LerpTag return void, so this shouldn't cause issues for iostvef. Allows new games to check if a tag exists in a MDR model.
-rw-r--r--src/renderergl1/tr_model.c33
-rw-r--r--src/renderergl2/tr_model.c32
2 files changed, 26 insertions, 39 deletions
diff --git a/src/renderergl1/tr_model.c b/src/renderergl1/tr_model.c
index 3f7423c3..0023f178 100644
--- a/src/renderergl1/tr_model.c
+++ b/src/renderergl1/tr_model.c
@@ -967,7 +967,7 @@ static md3Tag_t *R_GetTag( md3Header_t *mod, int frame, const char *tagName ) {
return NULL;
}
-void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
+md3Tag_t *R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
{
int i, j, k;
int frameSize;
@@ -1002,13 +1002,11 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
- return;
+ return dest;
}
}
- AxisClear( dest->axis );
- VectorClear( dest->origin );
- strcpy(dest->name,"");
+ return NULL;
}
/*
@@ -1029,34 +1027,29 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram
{
if(model->type == MOD_MDR)
{
- start = &start_space;
- end = &end_space;
- R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
- R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
+ start = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, &start_space);
+ end = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, &end_space);
}
else if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
-
- AxisClear( tag->axis );
- VectorClear( tag->origin );
- return qfalse;
-
+ start = end = NULL;
}
}
else
{
start = R_GetTag( model->md3[0], startFrame, tagName );
end = R_GetTag( model->md3[0], endFrame, tagName );
- if ( !start || !end ) {
- AxisClear( tag->axis );
- VectorClear( tag->origin );
- return qfalse;
- }
}
-
+
+ if ( !start || !end ) {
+ AxisClear( tag->axis );
+ VectorClear( tag->origin );
+ return qfalse;
+ }
+
frontLerp = frac;
backLerp = 1.0f - frac;
diff --git a/src/renderergl2/tr_model.c b/src/renderergl2/tr_model.c
index 7ac9f149..7a7e220c 100644
--- a/src/renderergl2/tr_model.c
+++ b/src/renderergl2/tr_model.c
@@ -1231,7 +1231,7 @@ static mdvTag_t *R_GetTag( mdvModel_t *mod, int frame, const char *_tagName ) {
return NULL;
}
-void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t * dest)
+mdvTag_t *R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t * dest)
{
int i, j, k;
int frameSize;
@@ -1264,12 +1264,11 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
- return;
+ return dest;
}
}
- AxisClear( dest->axis );
- VectorClear( dest->origin );
+ return NULL;
}
/*
@@ -1290,34 +1289,29 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram
{
if(model->type == MOD_MDR)
{
- start = &start_space;
- end = &end_space;
- R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
- R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
+ start = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, &start_space);
+ end = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, &end_space);
}
else if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
-
- AxisClear( tag->axis );
- VectorClear( tag->origin );
- return qfalse;
-
+ start = end = NULL;
}
}
else
{
start = R_GetTag( model->mdv[0], startFrame, tagName );
end = R_GetTag( model->mdv[0], endFrame, tagName );
- if ( !start || !end ) {
- AxisClear( tag->axis );
- VectorClear( tag->origin );
- return qfalse;
- }
}
-
+
+ if ( !start || !end ) {
+ AxisClear( tag->axis );
+ VectorClear( tag->origin );
+ return qfalse;
+ }
+
frontLerp = frac;
backLerp = 1.0f - frac;