X-Git-Url: https://sfsrealm.hopto.org/projects/gitweb.cgi?a=blobdiff_plain;f=drawgrp%2Fdrawgrp.cpp;h=8a4898033047357e6e4f36af4978ff482493fa5e;hb=8e36282a2286480dbda718cc5437dc878b87ccfc;hp=9b5e286f6e4556791e0120ac936517e2fc9dcac3;hpb=c483a082ba5c516a59a3ae91e3efee095f0f59a3;p=grpapi.git diff --git a/drawgrp/drawgrp.cpp b/drawgrp/drawgrp.cpp index 9b5e286..8a48980 100644 --- a/drawgrp/drawgrp.cpp +++ b/drawgrp/drawgrp.cpp @@ -3,6 +3,7 @@ #define _CRT_RAND_S #include +#include #include "stdafx.h" @@ -39,7 +40,10 @@ void WINAPI WritePixelToBuffer(BufferInfo *pBI, int X, int Y, COLORREF clrColor) if (pBI->nFrame == 0xFFFF) pBI->pBuffer[(Y * pBI->nWidth) + X] = (signed short)clrColor; else - pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)clrColor; + //if (clrColor < 1 || clrColor > 13) + // pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)((BYTE)-clrColor); + //else + pBI->pBuffer[(pBI->nFrame * pBI->nWidth * pBI->nHeight) + (Y * pBI->nWidth) + X] = (signed short)clrColor; } int main(int argc, char* argv[]) @@ -59,7 +63,7 @@ int main(int argc, char* argv[]) SFileOpenArchive(buffer,3000,0,&hMPQ3); } BufferInfo BI; - LoadPalette("tileset\\Jungle.wpe",dwPalette); + LoadPalette("tileset\\Platform.wpe",dwPalette); HANDLE hGrp, hGrp2; if (argc>1) hGrp = LoadGrp(argv[1]); @@ -70,6 +74,8 @@ int main(int argc, char* argv[]) if (GetGrpInfo(hGrp,&GrpInfo)==0) {GrpInfo.nFrames=0;GrpInfo.wMaxWidth=0;GrpInfo.wMaxHeight=0;} BI.nWidth = GrpInfo.wMaxWidth; BI.nHeight = GrpInfo.wMaxHeight; + //BI.nWidth = 255; + //BI.nHeight = 255; BI.pBuffer = (signed short *)malloc(GrpInfo.nFrames * BI.nWidth * BI.nHeight * sizeof(short)); WORD i,x,y; DWORD j, nGrpSize; @@ -88,39 +94,54 @@ int main(int argc, char* argv[]) rand_s(&v); u = u % 800; v = v % 600; - //DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040); + DrawGrp(hGrp,hDC,u,v,i,dwPalette,ALPHA_BLEND,0x404040); } } SetFunctionGetPixel((GETPIXELPROC)ReadPixelFromBuffer); SetFunctionSetPixel((SETPIXELPROC)WritePixelToBuffer); for (i=0;i