home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / Linux / Apps / xanim.tgz / xanim / xanim27064 / xa_dumfx.c < prev    next >
C/C++ Source or Header  |  1997-01-26  |  3KB  |  100 lines

  1.  
  2. /*
  3.  * xa_dumfx.c
  4.  *
  5.  * Copyright (C) 1995,1996,1997 by Mark Podlipec. 
  6.  * All rights reserved.
  7.  *
  8.  * This software may be freely copied, modified and redistributed without
  9.  * fee for non-commerical purposes provided that this copyright notice is
  10.  * preserved intact on all copies and modified copies.
  11.  * 
  12.  * There is no warranty or other guarantee of fitness of this software.
  13.  * It is provided solely "as is". The author(s) disclaim(s) all
  14.  * responsibility and liability with respect to this software's usage
  15.  * or its effect upon hardware or computer systems.
  16.  *
  17.  */
  18.  
  19. #include "xanim.h"
  20.  
  21. xaULONG DUM_Read_File();
  22.  
  23. extern XA_ANIM_SETUP *XA_Get_Anim_Setup();
  24. extern xaULONG FLI_Decode_BLACK();
  25. extern void XA_Free_Anim_Setup();
  26. extern XA_ACTION *ACT_Get_Action();
  27. extern XA_CHDR *ACT_Get_CMAP();
  28. extern void ACT_Setup_Delta();
  29. extern XA_CHDR *CMAP_Create_332();
  30. extern XA_CHDR *CMAP_Create_Gray();
  31.  
  32. xaULONG DUM_Read_File(fname,anim_hdr)
  33. char *fname;
  34. XA_ANIM_HDR *anim_hdr;
  35. { xaULONG i,num_frames;
  36.   XA_ACTION *act;
  37.   ACT_DLTA_HDR *dlta_hdr;
  38.   XA_ANIM_SETUP *dum;
  39.  
  40.   dum = XA_Get_Anim_Setup();
  41.   dum->depth = 8;
  42.   dum->imagex = 320;
  43.   dum->imagey = 20;
  44.   dum->pic_size = dum->imagex * dum->imagey;
  45.   dum->pic = 0;
  46.   dum->vid_time = 100;
  47.   dum->vid_timelo = 0;
  48.  
  49. /*
  50.   dum->chdr = CMAP_Create_Gray(dum->cmap,&dum->imagec);
  51. */
  52.   dum->chdr = CMAP_Create_332(dum->cmap,&dum->imagec);
  53.     
  54.   act = ACT_Get_Action(anim_hdr,ACT_DELTA);
  55.   dlta_hdr = (ACT_DLTA_HDR *)malloc(sizeof(ACT_DLTA_HDR));
  56.   if (dlta_hdr == 0) TheEnd1("DUM delta: malloc failed");
  57.   act->data = (xaUBYTE *)dlta_hdr;
  58.   dlta_hdr->flags = ACT_SNGL_BUF | DLTA_DATA;
  59.   dlta_hdr->fpos = 0; dlta_hdr->fsize = 0;
  60.   dlta_hdr->xpos = dlta_hdr->ypos = 0;
  61.   dlta_hdr->xsize = dum->imagex;
  62.   dlta_hdr->ysize = dum->imagey;
  63.   dlta_hdr->special = 0;
  64.   dlta_hdr->extra = (void *)(0);
  65.   dlta_hdr->xapi_rev = 0x0001;
  66.   dlta_hdr->delta = FLI_Decode_BLACK;
  67.   ACT_Setup_Delta(dum,act,dlta_hdr,0);
  68.  
  69.   if (anim_hdr->total_time)
  70.        num_frames = (anim_hdr->total_time + dum->vid_time - 1) / dum->vid_time;
  71.   else num_frames = 4;
  72.  
  73.   anim_hdr->frame_lst = (XA_FRAME *) malloc( (num_frames+1) * sizeof(XA_FRAME));
  74.   if (anim_hdr->frame_lst == NULL) TheEnd1("DUM_Read_Anim: malloc err");
  75.  
  76.   for(i=0; i < num_frames; i++)
  77.   {
  78.     anim_hdr->frame_lst[i].time_dur    = dum->vid_time;
  79.     anim_hdr->frame_lst[i].zztime    = i * dum->vid_time;
  80.     anim_hdr->frame_lst[i].act        = act;
  81.   }
  82.   anim_hdr->frame_lst[i].zztime        = -1;
  83.   anim_hdr->frame_lst[i].time_dur    = 0;
  84.   anim_hdr->frame_lst[i].act        = 0;
  85.   anim_hdr->loop_frame            = 0;
  86.   anim_hdr->last_frame            = (i - 1);
  87.   anim_hdr->total_time            = i * dum->vid_time;
  88.  
  89.   anim_hdr->imagex = dum->imagex;
  90.   anim_hdr->imagey = dum->imagey;
  91.   anim_hdr->imagec = dum->imagec;
  92.   anim_hdr->imaged = dum->depth;
  93.   anim_hdr->max_fvid_size = 0;
  94.   if (xa_buffer_flag == xaFALSE) anim_hdr->anim_flags |= ANIM_SNG_BUF;
  95.   anim_hdr->fname = anim_hdr->name; /* data file is same as name */
  96.   XA_Free_Anim_Setup(dum);
  97.   return(xaTRUE);
  98. }
  99.  
  100.