Game Development Reference
In-Depth Information
for(i=0; i<keytotal; i++){
if (key[i].frame == frame){
//Adjust keyframe to new value
for (i=0; i<objcount; i++)
key->level[i] = morphitem[i].level;
return &key[i];
}
if (key[i].frame>frame){
//Create memory for existing keys plus one
ikey = new MORPHKEY[keytotal + 1];
if (!ikey){
TRACE(”CLight::CreateKey>>
Problem creating keys\n”);
return NULL;
}
//Copy earlier keys
if (i) memcpy(ikey, keys, sizeof(MORPHKEY)*i);
ikey[i].frame = frame;
//Insert new key
for (i=0; i<objcount; i++)
key->level[i] = morphitem[i].level;
//Assign default parameters
ikey[i].linear = 0;
ikey[i].tn = 0.0;
ikey[i].ct = 0.0;
ikey[i].bs = 0.0;
//Copy following keys
if (i<keytotal){
memcpy(&ikey[i+1], &keys[i],
sizeof(MORPHKEY)*(keytotal-i));
}
keytotal++;
//Clear old keys
delete [] keys;
//Point keys at new array
keys = ikey;
return &keys[i];
}
}
Search Nedrilad ::




Custom Search