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




1 // drawgrp.cpp : Defines the entry point for the console application.\r
2 //\r
3 \r
4 #include "stdafx.h"\r
5 \r
6 \r
7 /*int qmain(int argc, char* argv[]);\r
8 \r
9 int main(int argc, char* argv[])\r
10 {\r
11         HINSTANCE hStorm = LoadStorm("Storm.dll");\r
12         if (SFileDestroy!=0) SFileDestroy();\r
13         LoadGrpApi();\r
14         int RetVal = qmain(argc,argv);\r
15         FreeGrpApi();\r
16         if (hStorm!=0) FreeLibrary(hStorm);\r
17         return RetVal;\r
18 }*/\r
19 \r
20 int main(int argc, char* argv[])\r
21 {\r
22         HANDLE hMPQ=0,hMPQ2=0,hMPQ3=0;\r
23         DWORD *dwPalette = (DWORD *)_alloca(1024);\r
24         memset(dwPalette,0,1024);\r
25         if (SFileOpenArchive!=0) {\r
26                 char *buffer = (char *)_alloca(13);\r
27                 memcpy(buffer,"StarDat.mpq",12);\r
28                 if (SFileOpenArchive(buffer,1000,0,&hMPQ)==0) return 0;\r
29                 memcpy(buffer,"BrooDat.mpq",12);\r
30                 SFileOpenArchive(buffer,2000,0,&hMPQ2);\r
31                 memcpy(buffer,"Patch_rt.mpq",13);\r
32                 SFileOpenArchive(buffer,3000,0,&hMPQ3);\r
33         }\r
34         LoadPalette("tileset\\Jungle.wpe",dwPalette);\r
35         HANDLE hGrp;\r
36         if (argc>1)\r
37                 hGrp = LoadGrp(argv[1]);\r
38         else\r
39                 hGrp = LoadGrp("unit\\zerg\\ultra.grp");\r
40         HDC hDC = GetDC(0);\r
41         GRPHEADER GrpInfo;\r
42         if (GetGrpInfo(hGrp,&GrpInfo)==0) {GrpInfo.nFrames=0;GrpInfo.wMaxWidth=0;GrpInfo.wMaxHeight=0;}\r
43         //for (DWORD j=0;j<16;j++){\r
44         /*for (WORD i=0;i<GrpInfo.nFrames;i++) {\r
45                 DrawGrp(hGrp,hDC,0,0,i,dwPalette,ALPHA_BLEND,0x401020);\r
46         }*/\r
47         for (WORD i=8;i<400;i+=17) {\r
48                 for (DWORD j=0;j<8;j++)\r
49                 DrawGrp(hGrp,hDC,i,0,i % (17*8),dwPalette,ALPHA_BLEND,0x401020);\r
50         }\r
51         for (i=8;i<400;i+=17) {\r
52                 for (DWORD j=0;j<8;j++)\r
53                 DrawGrp(hGrp,hDC,400-i,0,i % (17*8),dwPalette,HORIZONTAL_FLIP|ALPHA_BLEND,0x401020);\r
54         }\r
55         //}\r
56         ReleaseDC(0,hDC);\r
57     DestroyGrp(hGrp);\r
58         if (SFileCloseArchive!=0) {\r
59                 if (hMPQ3!=0) SFileCloseArchive(hMPQ3);\r
60                 if (hMPQ2!=0) SFileCloseArchive(hMPQ2);\r
61                 if (hMPQ!=0) SFileCloseArchive(hMPQ);\r
62         }\r
63         return 0;\r
64 }\r
65 \r