diff --git a/sc2/src/msvc++/UrQuanMasters.dsp b/sc2/src/msvc++/UrQuanMasters.dsp index 2e9ac7591..126916bf1 100644 --- a/sc2/src/msvc++/UrQuanMasters.dsp +++ b/sc2/src/msvc++/UrQuanMasters.dsp @@ -1894,14 +1894,6 @@ SOURCE=..\sc2code\planets\plangen.c # End Source File # Begin Source File -SOURCE=..\sc2code\planets\planmap.c -# End Source File -# Begin Source File - -SOURCE=..\sc2code\planets\planscan.c -# End Source File -# Begin Source File - SOURCE=..\sc2code\planets\pstarmap.c # End Source File # Begin Source File diff --git a/sc2/src/sc2code/planets/Makeinfo b/sc2/src/sc2code/planets/Makeinfo index 7d1dea6ed..9c6eea9f9 100644 --- a/sc2/src/sc2code/planets/Makeinfo +++ b/sc2/src/sc2code/planets/Makeinfo @@ -3,5 +3,5 @@ uqm_CFILES="calc.c cargo.c devices.c genburv.c genchmmr.c gencol.c genrain.c gensam.c genshof.c gensly.c gensol.c genspa.c gensup.c gensyr.c genthrad.c gentopo.c genutw.c genvault.c genvux.c genwreck.c genyeh.c genzoq.c lander.c orbits.c oval.c pl_stuff.c - planets.c plangen.c planmap.c planscan.c pstarmap.c report.c + planets.c plangen.c pstarmap.c report.c roster.c scan.c solarsys.c surface.c" diff --git a/sc2/src/sc2code/planets/planmap.c b/sc2/src/sc2code/planets/planmap.c deleted file mode 100644 index 7b1c46792..000000000 --- a/sc2/src/sc2code/planets/planmap.c +++ /dev/null @@ -1,249 +0,0 @@ -//Copyright Paul Reiche, Fred Ford. 1992-2002 - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include "gfxlib.h" -#include "scan.h" -#include "libs/compiler.h" -#include "libs/graphics/drawable.h" - -typedef struct -{ - BYTE bit0, bit1, bit2, bit3; - COUNT index0, index1, index2, index3; -} MAP_BLOCK; - -BOOLEAN -MapMask (FRAMEPTR SrcFramePtr, FRAMEPTR DstFramePtr, PRECT pSrcRect, - PSCAN_BLOCK pscan_block) -{ - COUNT num_scans; - COORD loc_x, x; - PBYTE lpSrcMask, lpDstMask; - SIZE width, height, src_error, src_delta, src_bump; - COUNT src_mask_incr, src_byte_count, dst_byte_count; - MAP_BLOCK SrcBlock; - PPOINT point_array; - PSCAN_DESC scan_array; - - loc_x = pSrcRect->corner.x; - width = pSrcRect->extent.width; - height = pSrcRect->extent.height; - - src_mask_incr = SCAN_WIDTH (GetFrameWidth (SrcFramePtr)); - lpSrcMask = (BYTE *)SrcFramePtr + SrcFramePtr->DataOffs; - if (0) - lpSrcMask += GetFrameWidth (SrcFramePtr) - * GetFrameHeight (SrcFramePtr); - src_byte_count = src_mask_incr - * GetFrameHeight (SrcFramePtr); - - lpDstMask = (BYTE *)DstFramePtr + DstFramePtr->DataOffs; - if (0) - lpDstMask += GetFrameWidth (DstFramePtr) - * GetFrameHeight (DstFramePtr); - dst_byte_count = SCAN_WIDTH (GetFrameWidth (DstFramePtr)) - * GetFrameHeight (DstFramePtr); - memset (lpDstMask, 0, dst_byte_count * 3); - - x = loc_x + (width >> 1); - SrcBlock.bit0 = SrcBlock.bit1 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (x)); - SrcBlock.index0 = SrcBlock.index1 = BYTE_POS (x); - SrcBlock.bit2 = (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (loc_x)); - SrcBlock.index2 = BYTE_POS (loc_x); - x = loc_x + width - 1; - SrcBlock.bit3 = (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (x)); - SrcBlock.index3 = BYTE_POS (x); - - num_scans = pscan_block->num_scans; - - src_delta = (height - 1) << 1; - src_bump = (num_scans - pscan_block->num_same_scans - 1) << 1; - src_error = src_bump; - - point_array = pscan_block->line_base; - scan_array = pscan_block->scan_base; - do - { - COORD y; - - y = scan_array->num_dots >> 1; - if (y) - { - COORD offs_x, offs_y; - SIZE error_term, bump, incr; - PPOINT pdot0, pdot1, pdot2, pdot3; - SIZE ig, idgr, idgd; - MAP_BLOCK SBlock, DBlock; - - offs_x = scan_array->start.x; - offs_y = scan_array->start.y; - pdot0 = pdot1 = &point_array[scan_array->start_dot + y]; - pdot2 = &point_array[scan_array->start_dot]; - pdot3 = &point_array[scan_array->start_dot + scan_array->num_dots - 1]; - - x = pdot0->x + offs_x; - DBlock.bit0 = DBlock.bit1 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (x)); - DBlock.index0 = DBlock.index1 = BYTE_POS (x) + pdot0->y + offs_y; - x = pdot2->x + offs_x; - DBlock.bit2 = (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (x)); - DBlock.index2 = BYTE_POS (x) + pdot2->y + offs_y; - x = pdot3->x + offs_x; - DBlock.bit3 = (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (x)); - DBlock.index3 = BYTE_POS (x) + pdot3->y + offs_y; - - SBlock = SrcBlock; - - incr = scan_array->dots_per_semi << 1; - bump = width << 1; - error_term = width; - - x = 0; - ig = (y << 1) - 3; - idgr = -6; - idgd = (y << 2) - 10; - do - { - if (lpSrcMask[SBlock.index0] & SBlock.bit0) - lpDstMask[DBlock.index0] |= DBlock.bit0; - SBlock.index0 += src_byte_count; - DBlock.index0 += dst_byte_count; - if (lpSrcMask[SBlock.index0] & SBlock.bit0) - lpDstMask[DBlock.index0] |= DBlock.bit0; - SBlock.index0 += src_byte_count; - DBlock.index0 += dst_byte_count; - if (lpSrcMask[SBlock.index0] & SBlock.bit0) - lpDstMask[DBlock.index0] |= DBlock.bit0; - if ((SBlock.bit0 >>= 1) == 0) - { - SBlock.bit0 = (BYTE)0x80; - ++SBlock.index0; - } - SBlock.index0 -= src_byte_count << 1; - DBlock.index0 -= dst_byte_count << 1; - - if (lpSrcMask[SBlock.index1] & SBlock.bit1) - lpDstMask[DBlock.index1] |= DBlock.bit1; - SBlock.index1 += src_byte_count; - DBlock.index1 += dst_byte_count; - if (lpSrcMask[SBlock.index1] & SBlock.bit1) - lpDstMask[DBlock.index1] |= DBlock.bit1; - SBlock.index1 += src_byte_count; - DBlock.index1 += dst_byte_count; - if (lpSrcMask[SBlock.index1] & SBlock.bit1) - lpDstMask[DBlock.index1] |= DBlock.bit1; - if ((SBlock.bit1 <<= 1) == 0) - { - SBlock.bit1 = (BYTE)0x01; - --SBlock.index1; - } - SBlock.index1 -= src_byte_count << 1; - DBlock.index1 -= dst_byte_count << 1; - - if (lpSrcMask[SBlock.index2] & SBlock.bit2) - lpDstMask[DBlock.index2] |= DBlock.bit2; - SBlock.index2 += src_byte_count; - DBlock.index2 += dst_byte_count; - if (lpSrcMask[SBlock.index2] & SBlock.bit2) - lpDstMask[DBlock.index2] |= DBlock.bit2; - SBlock.index2 += src_byte_count; - DBlock.index2 += dst_byte_count; - if (lpSrcMask[SBlock.index2] & SBlock.bit2) - lpDstMask[DBlock.index2] |= DBlock.bit2; - if ((SBlock.bit2 >>= 1) == 0) - { - SBlock.bit2 = (BYTE)0x80; - ++SBlock.index2; - } - SBlock.index2 -= src_byte_count << 1; - DBlock.index2 -= dst_byte_count << 1; - - if (lpSrcMask[SBlock.index3] & SBlock.bit3) - lpDstMask[DBlock.index3] |= DBlock.bit3; - SBlock.index3 += src_byte_count; - DBlock.index3 += dst_byte_count; - if (lpSrcMask[SBlock.index3] & SBlock.bit3) - lpDstMask[DBlock.index3] |= DBlock.bit3; - SBlock.index3 += src_byte_count; - DBlock.index3 += dst_byte_count; - if (lpSrcMask[SBlock.index3] & SBlock.bit3) - lpDstMask[DBlock.index3] |= DBlock.bit3; - if ((SBlock.bit3 <<= 1) == 0) - { - SBlock.bit3 = (BYTE)0x01; - --SBlock.index3; - } - SBlock.index3 -= src_byte_count << 1; - DBlock.index3 -= dst_byte_count << 1; - - if ((error_term -= incr) <= 0) - { - error_term += bump; - if (ig >= 0) - { - ig += idgr; - idgd -= 4; - } - else - { - ig += idgd; - idgd -= 8; - --y; - ++pdot2; - loc_x = pdot2->x + offs_x; - DBlock.bit2 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (loc_x)); - DBlock.index2 = BYTE_POS (loc_x) + pdot2->y + offs_y; - --pdot3; - loc_x = pdot3->x + offs_x; - DBlock.bit3 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (loc_x)); - DBlock.index3 = BYTE_POS (loc_x) + pdot3->y + offs_y; - } - idgr -= 4; - ++x; - ++pdot0; - loc_x = pdot0->x + offs_x; - DBlock.bit0 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (loc_x)); - DBlock.index0 = BYTE_POS (loc_x) + pdot0->y + offs_y; - --pdot1; - loc_x = pdot1->x + offs_x; - DBlock.bit1 = - (BYTE)((BYTE)0x80 >> (BYTE)BYTE_OFFS (loc_x)); - DBlock.index1 = BYTE_POS (loc_x) + pdot1->y + offs_y; - } - } while (y >= x); - } - - if ((src_error -= src_delta) <= 0) - { - if (--height > 0) - { - src_error += src_bump; - lpSrcMask += src_mask_incr; - } - } - ++scan_array; - } while (--num_scans); - - return (TRUE); -} - diff --git a/sc2/src/sc2code/planets/planscan.c b/sc2/src/sc2code/planets/planscan.c deleted file mode 100644 index cc578a147..000000000 --- a/sc2/src/sc2code/planets/planscan.c +++ /dev/null @@ -1,310 +0,0 @@ -//Copyright Paul Reiche, Fred Ford. 1992-2002 - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "graphics/gfxintrn.h" -#include "scan.h" -#include "units.h" - -void -GenerateRotatedScans (FRAMEPTR FramePtr, PSCAN_BLOCK pscan_block, COUNT - angle) -{ - SIZE width, height, dst_mask_incr; - PBYTE lpBase; - SIZE cosA1xcosA2, sinA1xcosA2, - sinA1xsinA2, cosA1xsinA2; - POINT center; - LINE left_edge, right_edge; - SIZE delta_x0, delta_y0, delta_x1, delta_y1; - SIZE xincr0, yincr0, xincr1, yincr1; - SIZE error0; - SIZE xerror1, yerror1; - SIZE bump0, bump1, nd, num_dots0, num_dots1; - PPOINT point_array; - PSCAN_DESC scan_array; - - width = GetFrameWidth (FramePtr); - height = GetFrameHeight (FramePtr); - dst_mask_incr = SCAN_WIDTH (width); - lpBase = (PBYTE)FramePtr + FramePtr->DataOffs; - if (0) - lpBase += width * height; - - center.x = width >> 1; - center.y = height >> 1; - - if (width > height) - bump0 = (width >> 1); - else - bump0 = (height >> 1); - bump0 += 4; /* allow for a little extra room */ - - cosA1xcosA2 = sinA1xcosA2 = COSINE (angle, bump0); - sinA1xsinA2 = cosA1xsinA2 = SINE (angle, bump0); - left_edge.first.x = (-cosA1xcosA2 - -sinA1xsinA2) + center.x; - left_edge.first.y = (-cosA1xsinA2 + -sinA1xcosA2) + center.y; - left_edge.second.x = (-cosA1xcosA2 - sinA1xsinA2) + center.x; - left_edge.second.y = (-cosA1xsinA2 + sinA1xcosA2) + center.y; - right_edge.first.x = (cosA1xcosA2 - -sinA1xsinA2) + center.x; - right_edge.first.y = (cosA1xsinA2 + -sinA1xcosA2) + center.y; - right_edge.second.x = (cosA1xcosA2 - sinA1xsinA2) + center.x; - right_edge.second.y = (cosA1xsinA2 + sinA1xcosA2) + center.y; - - delta_x0 = left_edge.second.x - left_edge.first.x; - if (delta_x0 >= 0) - xincr0 = 1; - else - { - xincr0 = -1; - delta_x0 = -delta_x0; - } - delta_y0 = left_edge.second.y - left_edge.first.y; - if (delta_y0 >= 0) - yincr0 = 1; - else - { - yincr0 = -1; - delta_y0 = -delta_y0; - } - - num_dots0 = delta_x0 + delta_y0; /* four connect */ - delta_x0 <<= 1; - error0 = bump0 = num_dots0 << 1; - - delta_x1 = right_edge.first.x - left_edge.first.x; - if (delta_x1 >= 0) - xincr1 = 1; - else - { - xincr1 = -1; - delta_x1 = -delta_x1; - } - delta_y1 = right_edge.first.y - left_edge.first.y; - if (delta_y1 >= 0) - yincr1 = 1; - else - { - yincr1 = -1; - delta_y1 = -delta_y1; - } - - if (delta_x1 >= delta_y1) - { - num_dots1 = delta_x1; - delta_x1 <<= 1; - delta_y1 <<= 1; - bump1 = delta_x1; - } - else - { - num_dots1 = delta_y1; - delta_x1 <<= 1; - delta_y1 <<= 1; - bump1 = delta_y1; - } - -#ifdef DEBUG -{ -LINE loc_line, loc_left_edge, loc_right_edge; - -loc_left_edge = left_edge; -loc_left_edge.first.x += 160 - center.x; -loc_left_edge.first.y += 100 - center.y; -loc_left_edge.second.x += 160 - center.x; -loc_left_edge.second.y += 100 - center.y; -loc_right_edge = right_edge; -loc_right_edge.first.x += 160 - center.x; -loc_right_edge.first.y += 100 - center.y; -loc_right_edge.second.x += 160 - center.x; -loc_right_edge.second.y += 100 - center.y; - -loc_line = loc_left_edge; -DrawLine (&loc_line); -loc_line.second = loc_right_edge.first; -DrawLine (&loc_line); -loc_line.first = loc_right_edge.second; -DrawLine (&loc_line); -loc_line.second = loc_left_edge.second; -DrawLine (&loc_line); -} -#endif /* DEBUG */ - - pscan_block->num_same_scans = 0; - - point_array = pscan_block->line_base; - left_edge.second.x = left_edge.second.y = 0; - xerror1 = yerror1 = nd = num_dots1; - do - { - *point_array++ = left_edge.second; - if ((xerror1 -= delta_x1) <= 0) - { - left_edge.second.x += xincr1; - xerror1 += bump1; - } - if ((yerror1 -= delta_y1) <= 0) - { - left_edge.second.y += yincr1 * dst_mask_incr; - yerror1 += bump1; - } - - } while (nd--); - - scan_array = pscan_block->scan_base; - do - { - BYTE on; - PBYTE lpScan; - - on = 0; - left_edge.second = left_edge.first; - lpScan = lpBase + (left_edge.second.y * dst_mask_incr); - - xerror1 = yerror1 = nd = num_dots1; -#ifdef DEBUG -SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0xA, 0xA), 0x0C)); -#endif /* DEBUG */ - do - { -#ifdef DEBUG -POINT pt; -pt.x = left_edge.second.x + 160 - center.x; -pt.y = left_edge.second.y + 100 - center.y; -#endif /* DEBUG */ - if (!(on & 1)) - { - if (left_edge.second.x >= 0 && left_edge.second.y >= 0 - && left_edge.second.x < width - && left_edge.second.y < height - && (lpScan[BYTE_POS (left_edge.second.x)] - & (BYTE)((BYTE)0x80 >> BYTE_OFFS (left_edge.second.x)))) - { -#ifdef DEBUG -SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F)); -DrawPoint (&pt); -#endif /* DEBUG */ - scan_array->start = left_edge.first; - scan_array->start.y *= dst_mask_incr; - - scan_array->start_dot = num_dots1 - nd; - scan_array->num_dots = nd; - - ++on; - } -#ifdef DEBUG -else -DrawPoint (&pt); -#endif /* DEBUG */ - } - else - { - if (left_edge.second.x < 0 || left_edge.second.y < 0 - || left_edge.second.x >= width - || left_edge.second.y >= height - || !(lpScan[BYTE_POS (left_edge.second.x)] - & (BYTE)((BYTE)0x80 >> BYTE_OFFS (left_edge.second.x)))) - { -#ifdef DEBUG -SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0x1F, 0xA, 0xA), 0x0C)); -#endif /* DEBUG */ - scan_array->num_dots -= nd; - /* calculate number of dots in semi-circle */ - scan_array->dots_per_semi = (SIZE)((DWORD)(scan_array->num_dots - * SCALED_ROOT_TWO) >> SCALE_FACTOR); - if (on > 1) - { - scan_array->num_dots |= SAME_SCAN; - ++pscan_block->num_same_scans; - } -#ifdef DEBUG - fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u%s\n", - scan_array->start.x, scan_array->start.y, - scan_array->end.x, scan_array->end.y, - scan_array->xerror, scan_array->yerror, - scan_array->num_dots & ~SAME_SCAN, - (scan_array->num_dots & SAME_SCAN) ? - ", SAME SCAN" : ""); -#endif /* DEBUG */ - ++scan_array; - - ++on; - } -#ifdef DEBUG -DrawPoint (&pt); -#endif /* DEBUG */ - } - - if ((xerror1 -= delta_x1) <= 0) - { - left_edge.second.x += xincr1; - xerror1 += bump1; - } - if ((yerror1 -= delta_y1) <= 0) - { - left_edge.second.y += yincr1; - yerror1 += bump1; - - lpScan = lpBase + (left_edge.second.y * dst_mask_incr); - } - - } while (nd--); - if (on & 1) - { - scan_array->num_dots -= nd; - /* calculate number of dots in semi-circle */ - scan_array->dots_per_semi = (SIZE)((DWORD)(scan_array->num_dots - * SCALED_ROOT_TWO) >> SCALE_FACTOR); - if (on > 1) - { - scan_array->num_dots |= SAME_SCAN; - ++pscan_block->num_same_scans; - } -#ifdef DEBUG - fprintf (stderr, "<%d, %d>-<%d, %d>, %d, %d, %u\n", - scan_array->start.x, scan_array->start.y, - scan_array->end.x, scan_array->end.y, - scan_array->xerror, scan_array->yerror, - scan_array->num_dots & ~SAME_SCAN, - (scan_array->num_dots & SAME_SCAN) ? ", SAME SCAN" : ""); -#endif /* DEBUG */ - ++scan_array; - } - - if ((error0 -= delta_x0) > 0) - left_edge.first.y += yincr0; - else - { - left_edge.first.x += xincr0; - error0 += bump0; - } - - } while (num_dots0--); - - pscan_block->num_scans = (COUNT)(scan_array - pscan_block->scan_base); -#ifdef DEBUG - { - extern DWORD AnyButtonPress (BOOLEAN CheckSpecial); - fprintf (stderr, "num_scans = %u\n", pscan_block->num_scans); - while (!AnyButtonPress (TRUE)) - ; - } -#endif /* DEBUG */ -} - - -