Advertisement
Guest User

Untitled

a guest
Jan 6th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. bool get_box(int h, RECT * box_crap, RECT * box_real)
  2. {
  3. RECT math;
  4. int sz, sy, x_offset, y_offset;
  5. int mplayx = playx;
  6. int mplayl = playl;
  7. int mplayy = playy;
  8. if (spr[h].noclip)
  9. {
  10. mplayx = 640;
  11. mplayl = 0;
  12. mplayy = 480;
  13. }
  14. RECT krect;
  15. if (getpic(h) < 1)
  16. {
  17. if (dinkedit)
  18. {
  19. Debug::Msg("Yo, sprite %d has a bad pic. (Map %d) Seq %d, Frame %d", h, cur_map, spr[h].pseq, spr[h].pframe);
  20. }
  21. else
  22. {
  23. Debug::Msg("Yo, sprite %d has a bad pic. (Map %d) Seq %d, Frame %d", h, *pmap, spr[h].pseq, spr[h].pframe);
  24. }
  25. if (spr[h].pseq != 0)
  26. {
  27. check_seq_status(spr[h].pseq);
  28. }
  29. }
  30. int txoffset = k[getpic(h)].xoffset;
  31. int tyoffset = k[getpic(h)].yoffset;
  32. *box_real = k[getpic(h)].box;
  33. CopyRect(&krect, &k[getpic(h)].box);
  34. if (spr[h].size != 100)
  35. {
  36. sz = ((krect.right * spr[h].size) / 100);
  37. }
  38. else
  39. {
  40. sz = 0;
  41. }
  42. if (spr[h].size != 100)
  43. {
  44. sy = ((krect.bottom * spr[h].size) / 100);
  45. }
  46. else
  47. {
  48. sy = 0;
  49. }
  50. if (spr[h].size != 100)
  51. {
  52. sz = ((sz - krect.right) / 2);
  53. sy = ((sy - krect.bottom) / 2);
  54. }
  55. box_crap->left = spr[h].x - txoffset - sz;
  56. math.left = spr[h].x - txoffset;
  57. box_crap->top = spr[h].y - tyoffset - sy;
  58. math.top = spr[h].y - tyoffset;
  59. box_crap->right = (math.left + (krect.right - krect.left)) + sz;
  60. math.right = math.left + krect.right;
  61. box_crap->bottom = (math.top + (krect.bottom - krect.top)) + sy;
  62. math.bottom = math.top + krect.bottom;
  63. if ((spr[h].alt.right != 0) | (spr[h].alt.left != 0) | (spr[h].alt.top != 0) | (spr[h].alt.right != 0))
  64. {
  65. if (spr[h].alt.left < 0)
  66. spr[h].alt.left = 0;
  67. if (spr[h].alt.left > k[getpic(h)].box.right)
  68. spr[h].alt.left = k[getpic(h)].box.right;
  69. if (spr[h].alt.top < 0)
  70. spr[h].alt.top = 0;
  71. if (spr[h].alt.top > k[getpic(h)].box.bottom)
  72. spr[h].alt.top = k[getpic(h)].box.bottom;
  73. if (spr[h].alt.right < 0)
  74. spr[h].alt.right = 0;
  75. if (spr[h].alt.right > k[getpic(h)].box.right)
  76. spr[h].alt.right = k[getpic(h)].box.right;
  77. if (spr[h].alt.bottom < 0)
  78. spr[h].alt.bottom = 0;
  79. if (spr[h].alt.bottom > k[getpic(h)].box.bottom)
  80. spr[h].alt.bottom = k[getpic(h)].box.bottom;
  81. box_crap->left = box_crap->left + spr[h].alt.left;
  82. box_crap->top = box_crap->top + spr[h].alt.top;
  83. box_crap->right = box_crap->right - (k[getpic(h)].box.right - spr[h].alt.right);
  84. box_crap->bottom = box_crap->bottom - (k[getpic(h)].box.bottom - spr[h].alt.bottom);
  85. CopyRect(box_real, &spr[h].alt);
  86. }
  87. if (spr[h].size == 0) spr[h].size = 100;
  88. if (dinkedit) if ((mode == 1) | (mode == 5)) if (draw_map_tiny < 1) goto do_draw;
  89. if (box_crap->left < mplayl)
  90. {
  91. x_offset = box_crap->left * (-1) + mplayl;
  92. box_crap->left = mplayl;
  93. if (spr[h].size != 100)
  94. box_real->left += (((x_offset * 100) / (spr[h].size))); else
  95. box_real->left += x_offset;
  96. if (box_crap->right - 1 < mplayl) goto nodraw;
  97. }
  98. if (box_crap->top < 0)
  99. {
  100. y_offset = box_crap->top * (-1);
  101. box_crap->top = 0;
  102. if (spr[h].size != 100)
  103. box_real->top += (((y_offset * 100) / (spr[h].size)));
  104. else box_real->top += y_offset;
  105. if (box_crap->bottom - 1 < 0) goto nodraw;
  106. }
  107. if (box_crap->right > mplayx)
  108. {
  109. x_offset = (box_crap->right) - mplayx;
  110. box_crap->right = mplayx;
  111. if (spr[h].size != 100)
  112. box_real->right -= ((x_offset * 100) / (spr[h].size));
  113. else box_real->right -= x_offset;
  114. if (box_crap->left + 1 > mplayx) goto nodraw;
  115. }
  116. if (box_crap->bottom > mplayy)
  117. {
  118. y_offset = (box_crap->bottom) - mplayy;
  119. box_crap->bottom = mplayy;
  120. if (spr[h].size != 100)
  121. box_real->bottom -= ((y_offset * 100) / (spr[h].size));
  122. else box_real->bottom -= y_offset;
  123. if (box_crap->top + 1 > mplayy) goto nodraw;
  124. }
  125. do_draw:
  126. return(true);
  127. nodraw:
  128. return(false);
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement