@@ -649,208 +649,6 @@ bool Animate_Frame(void* handle,
649649 view.Unlock ();
650650 return true ;
651651}
652- /* **************************************************************************
653- * ANIMATE_FRAME -- Displays a frame of a given animation *
654- * *
655- * INPUT: void *handle to the animation. *
656- * int frame_number wanted to be displayed *
657- * int x_pixel position of left side of animation on page *
658- * int y_pixel position of top of animation on page *
659- * *
660- * OUTPUT: bool if successfull or not. *
661- * *
662- * WARNINGS: *
663- * *
664- * HISTORY: *
665- * 11/27/1991 SB : Created. *
666- *=========================================================================*/
667- // #pragma argsused
668- #ifdef cuts
669- bool Animate_Frame (void * handle,
670- GraphicViewPortClass& view,
671- int frame_number,
672- int x_pixel,
673- int y_pixel,
674- WSAType flags_and_prio,
675- void * magic_cols,
676- void * magic)
677- {
678- SysAnimHeaderType* sys_header; // fix up the void pointer past in.
679- int curr_frame; // current frame we are on.
680- int total_frames; // number of frames in anim.
681- int distance; // distance to desired frame.
682- int search_dir; // direcion to search for desired frame.
683- int search_frames; // How many frames to search.
684- int loop; // Just a loop varible.
685- char * frame_buffer; // our destination.
686- bool direct_to_dest; // are we going directly to the destination?
687- int dest_width; // the width of the destination buffer or page.
688-
689- // Assign local pointer to the beginning of the buffer where the system information
690- // resides
691- sys_header = (SysAnimHeaderType*)handle;
692-
693- // Get the total number of frames
694- total_frames = sys_header->total_frames ;
695-
696- // Are the animation handle and the frame number valid?
697- if (!handle || (total_frames <= frame_number)) {
698- return false ;
699- }
700-
701- // Decide if we are going to a page or a viewport (part of a buffer).
702- dest_width = view.Get_Width () + view.Get_XAdd ();
703-
704- //
705- // adjust x_pixel and y_pixel by system pixel_x and pixel_y respectively.
706- //
707- x_pixel += (short )sys_header->pixel_x ;
708- y_pixel += (short )sys_header->pixel_y ;
709-
710- //
711- // Check to see if we are using a buffer inside of the animation buffer or if
712- // it is being drawn directly to the destination page or buffer.
713- //
714- if (sys_header->flags & WSA_TARGET_IN_BUFFER ) {
715- // Get a pointer to the frame in animation buffer.
716- frame_buffer = (char *)Add_Long_To_Pointer (sys_header, sizeof (SysAnimHeaderType));
717- direct_to_dest = false ;
718- } else {
719- frame_buffer = (char *)view.Get_Offset ();
720- frame_buffer += (y_pixel * dest_width) + x_pixel;
721- direct_to_dest = true ;
722- }
723- //
724- // If current_frame is equal to tatal_frames, then no animations have taken place
725- // so must uncompress frame 0 in delta buffer to the frame_buffer/page if it
726- // exists.
727- //
728- if (sys_header->current_frame == total_frames) {
729-
730- // Call apply delta telling it wether to copy or to xor depending on if the
731- // target is a page or a buffer.
732-
733- if (!(sys_header->flags & WSA_FRAME_0_ON_PAGE )) {
734- if (direct_to_dest) {
735-
736- // The last parameter says weather to copy or to XOR. If the
737- // first frame is a DELTA, then it must be XOR'd. A true is
738- // copy while false is XOR.
739- Apply_XOR_Delta_To_Page_Or_Viewport (frame_buffer,
740- sys_header->delta_buffer ,
741- sys_header->pixel_width ,
742- dest_width, // dest_width - sys_header->pixel_width,
743- (sys_header->flags & WSA_FRAME_0_IS_DELTA ) ? DO_XOR : DO_COPY );
744- } else {
745- Apply_XOR_Delta (frame_buffer, sys_header->delta_buffer );
746- }
747- }
748- sys_header->current_frame = 0 ;
749- }
750-
751- //
752- // Get the current frame
753- // If no looping aloud, are the trying to do it anyways?
754- //
755- curr_frame = sys_header->current_frame ;
756- #if (false)
757- // This is commented out since we will let them loop even though they should
758- // not - it will be slower.
759- if ((sys_header->flags & WSA_LINEAR_ONLY ) && (frame_number < cur_frame)) {
760- return false ;
761- }
762- #endif
763-
764- // Get absoulte distance from our current frame to the target frame
765- distance = ABS (curr_frame - frame_number);
766-
767- // Assume we are searching right
768- search_dir = 1 ;
769-
770- // Calculate the number of frames to search if we go right and wrap
771-
772- if (frame_number > curr_frame) {
773- search_frames = total_frames - frame_number + curr_frame;
774-
775- // Is going right faster than going backwards?
776- // Or are they trying to loop when the should not?
777- if ((search_frames < distance) && !(sys_header->flags & WSA_LINEAR_ONLY )) {
778- search_dir = -1 ; // No, so go left
779- } else {
780- search_frames = distance;
781- }
782- } else {
783- search_frames = total_frames - curr_frame + frame_number;
784-
785- // Is going right faster than going backwards?
786- // Or are they trying to loop when the should not?
787- if ((search_frames >= distance) || (sys_header->flags & WSA_LINEAR_ONLY )) {
788- search_dir = -1 ; // No, so go left
789- search_frames = distance;
790- }
791- }
792-
793- // Take care of the case when we are searching right (possibly right)
794-
795- if (search_dir > 0 ) {
796- for (loop = 0 ; loop < search_frames; loop++) {
797-
798- // Move the logical frame number ordinally right
799- curr_frame += search_dir;
800-
801- Apply_Delta (sys_header, curr_frame, frame_buffer, dest_width);
802-
803- // Adjust the current frame number, taking into consideration that we could
804- // have wrapped
805-
806- if (curr_frame == total_frames) {
807- curr_frame = 0 ;
808- }
809- }
810- } else {
811- for (loop = 0 ; loop < search_frames; loop++) {
812-
813- // If we are going backwards and we are on frame 0, the delta to get
814- // to the last frame is the n + 1 delta (wrap delta)
815-
816- if (curr_frame == 0 ) {
817- curr_frame = total_frames;
818- }
819-
820- Apply_Delta (sys_header, curr_frame, frame_buffer, dest_width);
821-
822- curr_frame += search_dir;
823- }
824- }
825-
826- sys_header->current_frame = frame_number;
827-
828- // If we did this all in a hidden buffer, then copy it to the desired page or viewport.
829- if (sys_header->flags & WSA_TARGET_IN_BUFFER ) {
830- #if true
831-
832- Buffer_To_Page (x_pixel, y_pixel, sys_header->pixel_width , sys_header->pixel_height , frame_buffer, view);
833-
834- #else
835- int flags = ((unsigned short )flags_and_prio & 0xFF00u ) >> 12u ;
836- int pri = flags_and_prio & 0x00FF ;
837-
838- Buffer_Bitblit_To_LogicPage (x_pixel,
839- y_pixel,
840- sys_header->pixel_width ,
841- sys_header->pixel_height ,
842- 0 ,
843- flags,
844- frame_buffer,
845- pri,
846- magic_cols,
847- magic);
848- #endif
849- }
850-
851- return true ;
852- }
853- #endif
854652
855653/* **************************************************************************
856654 * ANIMATE_FRAME_COUNT -- Return Number of frames in an animation. *
0 commit comments