Mercurial > mm7
comparison Arcomage.cpp @ 2139:f9b55be70c1b
Слияние
author | Ritor1 |
---|---|
date | Thu, 02 Jan 2014 09:11:28 +0600 |
parents | 259df09dfb50 |
children | d28d3c006077 |
comparison
equal
deleted
inserted
replaced
2138:7cc14d9d966d | 2139:f9b55be70c1b |
---|---|
68 void __fastcall am_IntToString(int val, char *pOut); | 68 void __fastcall am_IntToString(int val, char *pOut); |
69 | 69 |
70 //----- (0040DEDB) -------------------------------------------------------- | 70 //----- (0040DEDB) -------------------------------------------------------- |
71 unsigned int R8G8B8_to_TargetFormat(int uColor) | 71 unsigned int R8G8B8_to_TargetFormat(int uColor) |
72 { | 72 { |
73 return TargetColor(LOBYTE(uColor), BYTE1(uColor), BYTE2(uColor)); | 73 return Color16(LOBYTE(uColor), BYTE1(uColor), BYTE2(uColor)); |
74 } | 74 } |
75 | 75 |
76 /* 388 */ | 76 /* 388 */ |
77 #pragma pack(push, 1) | 77 #pragma pack(push, 1) |
78 struct ArcomageStartConditions | 78 struct ArcomageStartConditions |
622 //----- (0040D7EC) -------------------------------------------------------- | 622 //----- (0040D7EC) -------------------------------------------------------- |
623 void __fastcall Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode) | 623 void __fastcall Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode) |
624 { | 624 { |
625 | 625 |
626 unsigned __int16 *pSrc; // eax@2 | 626 unsigned __int16 *pSrc; // eax@2 |
627 unsigned __int16 *dest_surf_pos; // edi@3 | 627 //unsigned __int16 *dest_surf_pos; // edi@3 |
628 int uSrcTotalWidth; // ecx@4 | 628 int uSrcTotalWidth; // ecx@4 |
629 unsigned int v10; // esi@9 | 629 unsigned int v10; // esi@9 |
630 int v21; // [sp+Ch] [bp-18h]@8 | 630 int v21; // [sp+Ch] [bp-18h]@8 |
631 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 | 631 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 |
632 __int32 src_width; // [sp+14h] [bp-10h]@3 | 632 __int32 src_width; // [sp+14h] [bp-10h]@3 |
637 if ( !pRenderer->uNumSceneBegins ) | 637 if ( !pRenderer->uNumSceneBegins ) |
638 return; | 638 return; |
639 if ( !pArcomageGame->pBlit_Copy_pixels ) | 639 if ( !pArcomageGame->pBlit_Copy_pixels ) |
640 return; | 640 return; |
641 | 641 |
642 dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; | 642 //dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; |
643 src_width = pSrcRect->right - pSrcRect->left; | 643 src_width = pSrcRect->right - pSrcRect->left; |
644 src_height = pSrcRect->bottom - pSrcRect->top; | 644 src_height = pSrcRect->bottom - pSrcRect->top; |
645 | 645 |
646 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) | 646 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) |
647 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; | 647 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; |
669 for (int i=0; i< src_height; ++i) | 669 for (int i=0; i< src_height; ++i) |
670 { | 670 { |
671 for (int j=0; j< src_width; ++j) | 671 for (int j=0; j< src_width; ++j) |
672 { | 672 { |
673 if ( *src_surf_pos != v10 ) | 673 if ( *src_surf_pos != v10 ) |
674 *dest_surf_pos = *src_surf_pos; | 674 pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos); |
675 ++dest_surf_pos; | 675 //*dest_surf_pos = *src_surf_pos; |
676 //++dest_surf_pos; | |
676 ++src_surf_pos; | 677 ++src_surf_pos; |
677 } | 678 } |
678 src_surf_pos+=uSrcPitch; | 679 src_surf_pos+=uSrcPitch; |
679 dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; | 680 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
680 } | 681 } |
681 } | 682 } |
682 else | 683 else |
683 { | 684 { |
684 uSrcPitch = (uSrcPitch - src_width); | 685 uSrcPitch = (uSrcPitch - src_width); |
685 for (int i=0; i< src_height; ++i) | 686 for (int i=0; i< src_height; ++i) |
686 { | 687 { |
687 for (int j=0; j< src_width; ++j) | 688 for (int j=0; j< src_width; ++j) |
688 { | 689 { |
689 if ( *src_surf_pos != v10 ) | 690 if ( *src_surf_pos != v10 ) |
690 *dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); | 691 pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (pRenderer->ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1))); |
691 ++dest_surf_pos; | 692 //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); |
693 //++dest_surf_pos; | |
692 ++src_surf_pos; | 694 ++src_surf_pos; |
693 } | 695 } |
694 src_surf_pos+=uSrcPitch; | 696 src_surf_pos+=uSrcPitch; |
695 dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; | 697 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
696 } | 698 } |
697 } | 699 } |
698 | 700 |
699 } | 701 } |
700 | 702 |
701 //----- (0040D9B1) -------------------------------------------------------- | 703 //----- (0040D9B1) -------------------------------------------------------- |
702 void Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode ) | 704 void Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode ) |
703 { | 705 { |
704 | 706 |
705 unsigned __int16 *pSrc; // eax@2 | 707 unsigned __int16 *pSrc; // eax@2 |
706 unsigned __int16 *dest_surf_pos; // edi@3 | 708 //unsigned __int16 *dest_surf_pos; // edi@3 |
707 int uSrcTotalWidth; // ecx@4 | 709 int uSrcTotalWidth; // ecx@4 |
708 int v21; // [sp+Ch] [bp-18h]@8 | 710 int v21; // [sp+Ch] [bp-18h]@8 |
709 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 | 711 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 |
710 __int32 src_width; // [sp+14h] [bp-10h]@3 | 712 __int32 src_width; // [sp+14h] [bp-10h]@3 |
711 __int32 src_height; // [sp+18h] [bp-Ch]@3 | 713 __int32 src_height; // [sp+18h] [bp-Ch]@3 |
714 if ( !pRenderer->uNumSceneBegins ) | 716 if ( !pRenderer->uNumSceneBegins ) |
715 return; | 717 return; |
716 if ( !pArcomageGame->pBlit_Copy_pixels ) | 718 if ( !pArcomageGame->pBlit_Copy_pixels ) |
717 return; | 719 return; |
718 | 720 |
719 dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; | 721 //dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; |
720 src_width = pSrcRect->right - pSrcRect->left; | 722 src_width = pSrcRect->right - pSrcRect->left; |
721 src_height = pSrcRect->bottom - pSrcRect->top; | 723 src_height = pSrcRect->bottom - pSrcRect->top; |
722 | 724 |
723 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) | 725 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) |
724 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; | 726 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; |
742 { | 744 { |
743 uSrcPitch = (uSrcPitch - src_width); | 745 uSrcPitch = (uSrcPitch - src_width); |
744 for (int i=0; i< src_height; ++i) | 746 for (int i=0; i< src_height; ++i) |
745 { | 747 { |
746 for (int j=0; j< src_width; ++j) | 748 for (int j=0; j< src_width; ++j) |
747 { | 749 { |
748 *dest_surf_pos = *src_surf_pos; | 750 pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos); |
749 ++dest_surf_pos; | 751 //*dest_surf_pos = *src_surf_pos; |
752 //++dest_surf_pos; | |
750 ++src_surf_pos; | 753 ++src_surf_pos; |
751 } | 754 } |
752 src_surf_pos+=uSrcPitch; | 755 src_surf_pos+=uSrcPitch; |
753 dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; | 756 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
754 } | 757 } |
755 } | 758 } |
756 else | 759 else |
757 { | 760 { |
758 uSrcPitch = (uSrcPitch - src_width); | 761 uSrcPitch = (uSrcPitch - src_width); |
759 for (int i=0; i< src_height; ++i) | 762 for (int i=0; i< src_height; ++i) |
760 { | 763 { |
761 for (int j=0; j< src_width; ++j) | 764 for (int j=0; j< src_width; ++j) |
762 { | 765 { |
763 *dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); | 766 //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); |
764 ++dest_surf_pos; | 767 //++dest_surf_pos; |
768 pRenderer->WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (pRenderer->ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1))); | |
765 ++src_surf_pos; | 769 ++src_surf_pos; |
766 } | 770 } |
767 src_surf_pos+=uSrcPitch; | 771 src_surf_pos+=uSrcPitch; |
768 dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; | 772 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
769 } | 773 } |
770 } | 774 } |
771 } | 775 } |
772 | 776 |
773 //----- (0040DB10) -------------------------------------------------------- | 777 //----- (0040DB10) -------------------------------------------------------- |
4083 } | 4087 } |
4084 pRenderer->EndScene(); | 4088 pRenderer->EndScene(); |
4085 } | 4089 } |
4086 | 4090 |
4087 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor ) | 4091 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor ) |
4088 { | 4092 { |
4089 pRenderer->BeginScene(); | 4093 pRenderer->BeginScene(); |
4090 if ( pRenderer->uNumSceneBegins ) | 4094 if ( pRenderer->uNumSceneBegins ) |
4091 { | 4095 { |
4092 int xVal = pTargetXY->x; | 4096 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y, uColor); |
4097 pRenderer->WritePixel16(pTargetXY->x + 1, pTargetXY->y, uColor); | |
4098 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y + 1, uColor); | |
4099 pRenderer->WritePixel16(pTargetXY->x + 1, pTargetXY->y + 1, uColor); | |
4100 /*int xVal = pTargetXY->x; | |
4093 int yVal = pTargetXY->y; | 4101 int yVal = pTargetXY->y; |
4094 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) | 4102 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) |
4095 { | 4103 { |
4096 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; | 4104 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; |
4097 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * yVal] = uColor; | 4105 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * yVal] = uColor; |
4098 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; | 4106 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; |
4099 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; | 4107 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; |
4100 } | 4108 }*/ |
4101 pRenderer->EndScene(); | 4109 pRenderer->EndScene(); |
4102 } | 4110 } |
4103 } | 4111 } |
4104 | 4112 |
4105 //----- (0040DBD3) -------------------------------------------------------- | 4113 //----- (0040DBD3) -------------------------------------------------------- |
4106 void DrawPixel( POINT *pTargetXY, unsigned __int16 uColor ) | 4114 void DrawPixel( POINT *pTargetXY, unsigned __int16 uColor ) |
4107 { | 4115 { |
4108 pRenderer->BeginScene(); | 4116 pRenderer->BeginScene(); |
4109 if ( pRenderer->uNumSceneBegins ) | 4117 if ( pRenderer->uNumSceneBegins ) |
4110 { | 4118 { |
4111 int xVal = pTargetXY->x; | 4119 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y, uColor); |
4120 /*int xVal = pTargetXY->x; | |
4112 int yVal = pTargetXY->y; | 4121 int yVal = pTargetXY->y; |
4113 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) | 4122 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) |
4114 { | 4123 { |
4115 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; | 4124 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; |
4116 } | 4125 }*/ |
4117 pRenderer->EndScene(); | 4126 pRenderer->EndScene(); |
4118 } | 4127 } |
4119 } | 4128 } |
4120 | 4129 |
4121 | 4130 |
4122 //----- (0040DDB1) -------------------------------------------------------- | 4131 //----- (0040DDB1) -------------------------------------------------------- |
4123 int rand_interval( int min, int max ) | 4132 int rand_interval( int min, int max ) |
4124 { | 4133 { |