titant3k

masker. out.h

Nov 17th, 2020
407
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. typedef unsigned int tm_engine;
  2.  
  3. #define MASK_engine_eye 255
  4. #define MASK_engine_leg 16128
  5. #define MASK_engine_arm 114688
  6.  
  7. #define NBITS_engine_eye    8
  8. #define NBITS_engine_leg    6
  9. #define NBITS_engine_arm    3
  10.  
  11. #define MAXV_engine_eye 255
  12. #define MAXV_engine_leg 63
  13. #define MAXV_engine_arm 7
  14.  
  15. #define SHIFT_engine_eye    0
  16. #define SHIFT_engine_leg    8
  17. #define SHIFT_engine_arm    14
  18.  
  19. #define MREAD_engine_eye(x)     (((x)&(MASK_engine_eye))>>(SHIFT_engine_eye))
  20. #define MREAD_engine_leg(x)     (((x)&(MASK_engine_leg))>>(SHIFT_engine_leg))
  21. #define MREAD_engine_arm(x)     (((x)&(MASK_engine_arm))>>(SHIFT_engine_arm))
  22.  
  23. #define MWRITE_engine_eye(dest,val)     ((dest))=((((dest))&(~(MASK_engine_eye)))|(val<<SHIFT_engine_eye))
  24. #define MWRITE_engine_leg(dest,val)     ((dest))=((((dest))&(~(MASK_engine_leg)))|(val<<SHIFT_engine_leg))
  25. #define MWRITE_engine_arm(dest,val)     ((dest))=((((dest))&(~(MASK_engine_arm)))|(val<<SHIFT_engine_arm))
  26.  
  27. unsigned char CMWRITE_engine_eye(tm_engine dest, tm_engine val)
  28.  {
  29.   if(val>MAXV_engine_eye) { printf("[ERR] out of limits in engine_eye\n"); return 0; }
  30.   MWRITE_engine_eye(dest,val); return 1;
  31.  }
  32. unsigned char CMWRITE_engine_leg(tm_engine dest, tm_engine val)
  33.  {
  34.   if(val>MAXV_engine_leg) { printf("[ERR] out of limits in engine_leg\n"); return 0; }
  35.   MWRITE_engine_leg(dest,val); return 1;
  36.  }
  37. unsigned char CMWRITE_engine_arm(tm_engine dest, tm_engine val)
  38.  {
  39.   if(val>MAXV_engine_arm) { printf("[ERR] out of limits in engine_arm\n"); return 0; }
  40.   MWRITE_engine_arm(dest,val); return 1;
  41.  }
  42.  
  43.  
  44. typedef unsigned int tm_tony;
  45.  
  46. #define MASK_tony_eye   63
  47. #define MASK_tony_leg   16320
  48. #define MASK_tony_arm   114688
  49.  
  50. #define NBITS_tony_eye  6
  51. #define NBITS_tony_leg  8
  52. #define NBITS_tony_arm  3
  53.  
  54. #define MAXV_tony_eye   63
  55. #define MAXV_tony_leg   255
  56. #define MAXV_tony_arm   7
  57.  
  58. #define SHIFT_tony_eye  0
  59. #define SHIFT_tony_leg  6
  60. #define SHIFT_tony_arm  14
  61.  
  62. #define MREAD_tony_eye(x)   (((x)&(MASK_tony_eye))>>(SHIFT_tony_eye))
  63. #define MREAD_tony_leg(x)   (((x)&(MASK_tony_leg))>>(SHIFT_tony_leg))
  64. #define MREAD_tony_arm(x)   (((x)&(MASK_tony_arm))>>(SHIFT_tony_arm))
  65.  
  66. #define MWRITE_tony_eye(dest,val)   ((dest))=((((dest))&(~(MASK_tony_eye)))|(val<<SHIFT_tony_eye))
  67. #define MWRITE_tony_leg(dest,val)   ((dest))=((((dest))&(~(MASK_tony_leg)))|(val<<SHIFT_tony_leg))
  68. #define MWRITE_tony_arm(dest,val)   ((dest))=((((dest))&(~(MASK_tony_arm)))|(val<<SHIFT_tony_arm))
  69.  
  70. unsigned char CMWRITE_tony_eye(tm_tony dest, tm_tony val)
  71.  {
  72.   if(val>MAXV_tony_eye) { printf("[ERR] out of limits in tony_eye\n"); return 0; }
  73.   MWRITE_tony_eye(dest,val); return 1;
  74.  }
  75. unsigned char CMWRITE_tony_leg(tm_tony dest, tm_tony val)
  76.  {
  77.   if(val>MAXV_tony_leg) { printf("[ERR] out of limits in tony_leg\n"); return 0; }
  78.   MWRITE_tony_leg(dest,val); return 1;
  79.  }
  80. unsigned char CMWRITE_tony_arm(tm_tony dest, tm_tony val)
  81.  {
  82.   if(val>MAXV_tony_arm) { printf("[ERR] out of limits in tony_arm\n"); return 0; }
  83.   MWRITE_tony_arm(dest,val); return 1;
  84.  }
  85.  
  86.  
  87. typedef unsigned long tm_masky2;
  88.  
  89. #define MASK_masky2_tod 65535
  90. #define MASK_masky2_tud 4294901760
  91. #define MASK_masky2_toc 1095216660480
  92. #define MASK_masky2_tic 280375465082880
  93.  
  94. #define NBITS_masky2_tod    16
  95. #define NBITS_masky2_tud    16
  96. #define NBITS_masky2_toc    8
  97. #define NBITS_masky2_tic    8
  98.  
  99. #define MAXV_masky2_tod 65535
  100. #define MAXV_masky2_tud 65535
  101. #define MAXV_masky2_toc 255
  102. #define MAXV_masky2_tic 255
  103.  
  104. #define SHIFT_masky2_tod    0
  105. #define SHIFT_masky2_tud    16
  106. #define SHIFT_masky2_toc    32
  107. #define SHIFT_masky2_tic    40
  108.  
  109. #define MREAD_masky2_tod(x)     (((x)&(MASK_masky2_tod))>>(SHIFT_masky2_tod))
  110. #define MREAD_masky2_tud(x)     (((x)&(MASK_masky2_tud))>>(SHIFT_masky2_tud))
  111. #define MREAD_masky2_toc(x)     (((x)&(MASK_masky2_toc))>>(SHIFT_masky2_toc))
  112. #define MREAD_masky2_tic(x)     (((x)&(MASK_masky2_tic))>>(SHIFT_masky2_tic))
  113.  
  114. #define MWRITE_masky2_tod(dest,val)     ((dest))=((((dest))&(~(MASK_masky2_tod)))|(val<<SHIFT_masky2_tod))
  115. #define MWRITE_masky2_tud(dest,val)     ((dest))=((((dest))&(~(MASK_masky2_tud)))|(val<<SHIFT_masky2_tud))
  116. #define MWRITE_masky2_toc(dest,val)     ((dest))=((((dest))&(~(MASK_masky2_toc)))|(val<<SHIFT_masky2_toc))
  117. #define MWRITE_masky2_tic(dest,val)     ((dest))=((((dest))&(~(MASK_masky2_tic)))|(val<<SHIFT_masky2_tic))
  118.  
  119. unsigned char CMWRITE_masky2_tod(tm_masky2 dest, tm_masky2 val)
  120.  {
  121.   if(val>MAXV_masky2_tod) { printf("[ERR] out of limits in masky2_tod\n"); return 0; }
  122.   MWRITE_masky2_tod(dest,val); return 1;
  123.  }
  124. unsigned char CMWRITE_masky2_tud(tm_masky2 dest, tm_masky2 val)
  125.  {
  126.   if(val>MAXV_masky2_tud) { printf("[ERR] out of limits in masky2_tud\n"); return 0; }
  127.   MWRITE_masky2_tud(dest,val); return 1;
  128.  }
  129. unsigned char CMWRITE_masky2_toc(tm_masky2 dest, tm_masky2 val)
  130.  {
  131.   if(val>MAXV_masky2_toc) { printf("[ERR] out of limits in masky2_toc\n"); return 0; }
  132.   MWRITE_masky2_toc(dest,val); return 1;
  133.  }
  134. unsigned char CMWRITE_masky2_tic(tm_masky2 dest, tm_masky2 val)
  135.  {
  136.   if(val>MAXV_masky2_tic) { printf("[ERR] out of limits in masky2_tic\n"); return 0; }
  137.   MWRITE_masky2_tic(dest,val); return 1;
  138.  }
  139.  
  140.  
RAW Paste Data