Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool get_box(int h, RECT * box_crap, RECT * box_real)
- {
- RECT math;
- int sz, sy, x_offset, y_offset;
- int mplayx = playx;
- int mplayl = playl;
- int mplayy = playy;
- if (spr[h].noclip)
- {
- mplayx = 640;
- mplayl = 0;
- mplayy = 480;
- }
- RECT krect;
- if (getpic(h) < 1)
- {
- if (dinkedit)
- {
- Debug::Msg("Yo, sprite %d has a bad pic. (Map %d) Seq %d, Frame %d", h, cur_map, spr[h].pseq, spr[h].pframe);
- }
- else
- {
- Debug::Msg("Yo, sprite %d has a bad pic. (Map %d) Seq %d, Frame %d", h, *pmap, spr[h].pseq, spr[h].pframe);
- }
- if (spr[h].pseq != 0)
- {
- check_seq_status(spr[h].pseq);
- }
- }
- int txoffset = k[getpic(h)].xoffset;
- int tyoffset = k[getpic(h)].yoffset;
- *box_real = k[getpic(h)].box;
- CopyRect(&krect, &k[getpic(h)].box);
- if (spr[h].size != 100)
- {
- sz = ((krect.right * spr[h].size) / 100);
- }
- else
- {
- sz = 0;
- }
- if (spr[h].size != 100)
- {
- sy = ((krect.bottom * spr[h].size) / 100);
- }
- else
- {
- sy = 0;
- }
- if (spr[h].size != 100)
- {
- sz = ((sz - krect.right) / 2);
- sy = ((sy - krect.bottom) / 2);
- }
- box_crap->left = spr[h].x - txoffset - sz;
- math.left = spr[h].x - txoffset;
- box_crap->top = spr[h].y - tyoffset - sy;
- math.top = spr[h].y - tyoffset;
- box_crap->right = (math.left + (krect.right - krect.left)) + sz;
- math.right = math.left + krect.right;
- box_crap->bottom = (math.top + (krect.bottom - krect.top)) + sy;
- math.bottom = math.top + krect.bottom;
- if ((spr[h].alt.right != 0) | (spr[h].alt.left != 0) | (spr[h].alt.top != 0) | (spr[h].alt.right != 0))
- {
- if (spr[h].alt.left < 0)
- spr[h].alt.left = 0;
- if (spr[h].alt.left > k[getpic(h)].box.right)
- spr[h].alt.left = k[getpic(h)].box.right;
- if (spr[h].alt.top < 0)
- spr[h].alt.top = 0;
- if (spr[h].alt.top > k[getpic(h)].box.bottom)
- spr[h].alt.top = k[getpic(h)].box.bottom;
- if (spr[h].alt.right < 0)
- spr[h].alt.right = 0;
- if (spr[h].alt.right > k[getpic(h)].box.right)
- spr[h].alt.right = k[getpic(h)].box.right;
- if (spr[h].alt.bottom < 0)
- spr[h].alt.bottom = 0;
- if (spr[h].alt.bottom > k[getpic(h)].box.bottom)
- spr[h].alt.bottom = k[getpic(h)].box.bottom;
- box_crap->left = box_crap->left + spr[h].alt.left;
- box_crap->top = box_crap->top + spr[h].alt.top;
- box_crap->right = box_crap->right - (k[getpic(h)].box.right - spr[h].alt.right);
- box_crap->bottom = box_crap->bottom - (k[getpic(h)].box.bottom - spr[h].alt.bottom);
- CopyRect(box_real, &spr[h].alt);
- }
- if (spr[h].size == 0) spr[h].size = 100;
- if (dinkedit) if ((mode == 1) | (mode == 5)) if (draw_map_tiny < 1) goto do_draw;
- if (box_crap->left < mplayl)
- {
- x_offset = box_crap->left * (-1) + mplayl;
- box_crap->left = mplayl;
- if (spr[h].size != 100)
- box_real->left += (((x_offset * 100) / (spr[h].size))); else
- box_real->left += x_offset;
- if (box_crap->right - 1 < mplayl) goto nodraw;
- }
- if (box_crap->top < 0)
- {
- y_offset = box_crap->top * (-1);
- box_crap->top = 0;
- if (spr[h].size != 100)
- box_real->top += (((y_offset * 100) / (spr[h].size)));
- else box_real->top += y_offset;
- if (box_crap->bottom - 1 < 0) goto nodraw;
- }
- if (box_crap->right > mplayx)
- {
- x_offset = (box_crap->right) - mplayx;
- box_crap->right = mplayx;
- if (spr[h].size != 100)
- box_real->right -= ((x_offset * 100) / (spr[h].size));
- else box_real->right -= x_offset;
- if (box_crap->left + 1 > mplayx) goto nodraw;
- }
- if (box_crap->bottom > mplayy)
- {
- y_offset = (box_crap->bottom) - mplayy;
- box_crap->bottom = mplayy;
- if (spr[h].size != 100)
- box_real->bottom -= ((y_offset * 100) / (spr[h].size));
- else box_real->bottom -= y_offset;
- if (box_crap->top + 1 > mplayy) goto nodraw;
- }
- do_draw:
- return(true);
- nodraw:
- return(false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement