void MultiHorizontalFlip(OBJECT *pFlipObj) { // validate object pointer assert(pFlipObj >= objectList && pFlipObj <= objectList + NUM_OBJECTS - 1); // for all the objects that make up this multi-part do { // horizontally flip the next part AnimateObjectFlags(pFlipObj, pFlipObj->flags ^ DMA_FLIPH, pFlipObj->hImg); // next obj in list pFlipObj = pFlipObj->pSlave; } while (pFlipObj != NULL); }
void MultiVerticalFlip(OBJECT *pFlipObj) { // validate object pointer assert(isValidObject(pFlipObj)); // for all the objects that make up this multi-part do { // vertically flip the next part AnimateObjectFlags(pFlipObj, pFlipObj->flags ^ DMA_FLIPV, pFlipObj->hImg); // next obj in list pFlipObj = pFlipObj->pSlave; } while (pFlipObj != NULL); }
/** * Init a ANIM structure for single stepping through a animation script. * @param pAnim Animation data structure * @param pAniObj Object to animate * @param hNewScript Script of multipart frames * @param aniSpeed Sets speed of animation in frames */ void InitStepAnimScript(ANIM *pAnim, OBJECT *pAniObj, SCNHANDLE hNewScript, int aniSpeed) { OBJECT *pObj; // multi-object list iterator debugC(DEBUG_DETAILED, kTinselDebugAnimations, "InitStepAnimScript Object=(%d,%d,%xh) script=%xh aniSpeed=%d rec=%ph", !pAniObj ? 0 : fracToInt(pAniObj->xPos), !pAniObj ? 0 : fracToInt(pAniObj->yPos), !pAniObj ? 0 : pAniObj->hImg, hNewScript, aniSpeed, (byte *)pAnim); pAnim->aniDelta = 1; // will animate on next call to NextAnimRate pAnim->pObject = pAniObj; // set object to animate pAnim->hScript = hNewScript; // set animation script pAnim->scriptIndex = 0; // start of script pAnim->aniRate = aniSpeed; // set speed of animation // reset flip flags for the object - let the script do the flipping for (pObj = pAniObj; pObj != NULL; pObj = pObj->pSlave) { AnimateObjectFlags(pObj, pObj->flags & ~(DMA_FLIPH | DMA_FLIPV), pObj->hImg); } }
/** * Give an object a new image. * @param pAniObj Object to animate * @param hNewImg Objects new image */ void AnimateObject(OBJECT *pAniObj, SCNHANDLE hNewImg) { // dont change the objects flags AnimateObjectFlags(pAniObj, pAniObj->flags, hNewImg); }