home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / RG / RES_RIPR.ZIP / RES_RIPR / RIP_VIEW.C < prev    next >
Encoding:
C/C++ Source or Header  |  2005-04-30  |  1.8 KB  |  83 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <tos.h>
  4.  
  5. typedef unsigned char            UBYTE;
  6. typedef signed char                SBYTE;
  7. typedef unsigned int            UWORD;
  8. typedef signed int              SWORD;
  9. typedef unsigned long           ULONG;
  10. typedef signed long             SLONG;
  11.  
  12. typedef unsigned char            U8;
  13. typedef signed char                S8;
  14. typedef unsigned int             U16;
  15. typedef signed int              S16;
  16. typedef unsigned long           U32;
  17. typedef signed long                S32;
  18. typedef float                   FP32;
  19.  
  20. typedef union { U8 b3, b2, b1, b0; U16 w1, w0; U32 ln; } UL;
  21.  
  22.  
  23. typedef struct
  24. {
  25. U8 grip_id[4];
  26. U16 grip_version;
  27. U16 grip_res;
  28. U16 grip_x;
  29. U16 grip_y;
  30. U16 grip_line_length;
  31. U16 grip_pal_type;
  32. U16 grip_data;
  33. } GRIP_STRUCT;
  34.  
  35. void show_grip(GRIP_STRUCT * grip_ptr)
  36. {
  37.  U32 grip_adr;
  38.  U16 * grip_gfx_ptr;
  39.  U16 * d_ptr;
  40.  U16 * sx_ptr;
  41.  U16 * sx2_ptr;
  42.  U16 xwords;    
  43.  S32 xadd;
  44.  U16 i,j;
  45.  
  46.  sx_ptr=(U16 *)0xFFFF8210;
  47.  sx2_ptr=(U16 *)0xFFFF820E;
  48.  grip_gfx_ptr=&grip_ptr->grip_data;
  49.  rlsc_set_screen_mode(grip_ptr->grip_x,grip_ptr->grip_y,grip_ptr->grip_res);    
  50.  grip_adr=(U32)&grip_ptr->grip_data;
  51.  if (grip_ptr->grip_res<4)
  52.  {    
  53.   if(grip_ptr->grip_pal_type)
  54.   {
  55.    rlvc_wait_vbl();
  56.    mg_set_falc_pal(pal_cols[grip_ptr->grip_res],(U32 *)grip_adr);
  57.    grip_adr+=pal_cols[grip_ptr->grip_res]<<2;
  58.   }
  59.   else
  60.   {
  61.    rlvc_wait_vbl();
  62.    rlsc_set_palette_st((U16 *)grip_adr);
  63.    grip_adr+=pal_cols[grip_ptr->grip_res]<<1;
  64.   }
  65.  }  
  66.  
  67.  grip_gfx_ptr=(U16 *)grip_adr;
  68.  
  69.  d_ptr=(U16 *)my_physic;
  70.  xwords=grip_ptr->grip_line_length>>1;
  71.  rlvc_wait_vbl();
  72.  xadd=(*sx_ptr+*sx2_ptr)-xwords;
  73.  if(xadd>0) d_ptr+=xadd>>1;
  74.  for(j=0;j<grip_ptr->grip_y;j++)
  75.  {
  76.   for(i=0;i<xwords;i++)
  77.    *d_ptr++=*grip_gfx_ptr++;                
  78.   d_ptr+=xadd;
  79.  }
  80.  rlsc_set_new_physic(my_physic);
  81.  rlvc_wait_vbl();
  82. }
  83.