Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




ShadowFlare [Sat, 7 Oct 2006 07:21:48 +0000 (07:21 +0000)]
drawgrp/drawgrp.cpp

index e2f41c8..8a48980 100644 (file)
@@ -63,7 +63,7 @@ int main(int argc, char* argv[])
                SFileOpenArchive(buffer,3000,0,&hMPQ3);\r
        }\r
        BufferInfo BI;\r
-       LoadPalette("tileset\\Jungle.wpe",dwPalette);\r
+       LoadPalette("tileset\\Platform.wpe",dwPalette);\r
        HANDLE hGrp, hGrp2;\r
        if (argc>1)\r
                hGrp = LoadGrp(argv[1]);\r
@@ -74,6 +74,8 @@ int main(int argc, char* argv[])
        if (GetGrpInfo(hGrp,&GrpInfo)==0) {GrpInfo.nFrames=0;GrpInfo.wMaxWidth=0;GrpInfo.wMaxHeight=0;}\r
        BI.nWidth = GrpInfo.wMaxWidth;\r
        BI.nHeight = GrpInfo.wMaxHeight;\r
+       //BI.nWidth = 255;\r
+       //BI.nHeight = 255;\r
        BI.pBuffer = (signed short *)malloc(GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short));\r
        WORD i,x,y;\r
        DWORD j, nGrpSize;\r
@@ -92,30 +94,33 @@ int main(int argc, char* argv[])
                        rand_s(&v);\r
                        u = u % 800;\r
                        v = v % 600;\r
-                       //DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040);\r
+                       DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040);\r
                }\r
        }\r
        SetFunctionGetPixel((GETPIXELPROC)ReadPixelFromBuffer);\r
        SetFunctionSetPixel((SETPIXELPROC)WritePixelToBuffer);\r
        for (i=0;i<GrpInfo.nFrames;i++) {\r
                BI.nFrame = i;\r
+               u = (BI.nWidth - GrpInfo.wMaxWidth) / 2;\r
+               v = (BI.nHeight - GrpInfo.wMaxHeight) / 2;\r
                for (y = 0; y < BI.nHeight; y++) {\r
                        for (x = 0; x < BI.nWidth; x++) {\r
-                               WritePixelToBuffer(&BI, x, y, -1);\r
+                               WritePixelToBuffer(&BI, x, y, 0);\r
                        }\r
                }\r
-               DrawGrp(hGrp,(HDC)&BI,0,0,i,0,USE_INDEX,0);\r
+               DrawGrp(hGrp,(HDC)&BI,u,v,i,0,USE_INDEX,0);\r
        }\r
        hGrp2 = hGrp;\r
-       hGrp = CreateGrp(BI.pBuffer, GrpInfo.nFrames, GrpInfo.wMaxWidth, GrpInfo.wMaxHeight, FALSE, &nGrpSize);\r
+       hGrp = CreateGrp(BI.pBuffer, GrpInfo.nFrames, BI.nWidth, BI.nHeight, FALSE, &nGrpSize);\r
        /*HANDLE hFile;\r
-       hFile = CreateFile("generated ultralisk.grp", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);\r
+       hFile = CreateFile("generated zergling.grp", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);\r
        if (hFile != INVALID_HANDLE_VALUE) {\r
                WriteFile(hFile, hGrp, nGrpSize, &j, 0);\r
                CloseHandle(hFile);\r
        }*/\r
        BI.nFrame = 0xFFFF;\r
        j=0;\r
+       \r
        for (i=0;i<GrpInfo.nFrames;i+=1) {\r
                rect.left = rect.top = 0;\r
                rect.right = rect.left + BI.nWidth;\r
@@ -163,6 +168,7 @@ int main(int argc, char* argv[])
                        if (clrPixel != -1) SetPixelV(hDC, 400 + i, 300 + j, dwPalette[clrPixel]);\r
                }\r
        //}\r
+       \r
        ReleaseDC(0,hDC);\r
        free(BI.pBuffer);\r
     DestroyGrp(hGrp);\r