Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
61 lines
1.4 KiB
C++
61 lines
1.4 KiB
C++
#include"image.h"
|
|
#include<math.h>
|
|
|
|
// >>>>>>>>>>>>>>>>>> ImgRGBColor members
|
|
|
|
|
|
// >>>>>>>>>>>>>>>>>> RGBPixel members
|
|
|
|
|
|
|
|
// >>>>>>>>>>>>>>>>>> RGBMask members
|
|
int RGBMask::Set(DWORD r,DWORD g,DWORD b,DWORD a)
|
|
{
|
|
if(!r || !b || !g ) return 1;
|
|
R=r; B=b; G=g; A=a;
|
|
int bct=0;
|
|
irs=igs=ibs=ias=24;
|
|
rbs=gbs=bbs=albs=0;
|
|
|
|
bits=0;
|
|
for(bct=31;bct>=0;bct--)
|
|
{
|
|
if(R&(1<<bct)) {irs=bct; rbs++;} //calululate shifts
|
|
if(G&(1<<bct)) {igs=bct; gbs++;}
|
|
if(B&(1<<bct)) {ibs=bct; bbs++;}
|
|
if(A&(1<<bct)) {ias=bct; albs++;}
|
|
if((!bits) && ((R|G|B|A)&(1<<bct)) ) bits=bct;
|
|
}
|
|
|
|
//rmax=R>>irs; gmax=G>>igs; bmax=B>>ibs; amax=A>>ias;
|
|
if(!R) irs=32;
|
|
if(!B) ibs=32;
|
|
if(!G) igs=32;
|
|
if(!A) ias=32;
|
|
|
|
ras=8-rbs;
|
|
gas=8-gbs;
|
|
bas=8-bbs;
|
|
aas=8-albs;
|
|
//if(A) aas=8-albs; else aas=0;
|
|
|
|
if(bits<=16) bits=16;
|
|
if(bits>16 && bits<=24) bits=24;
|
|
if(bits>24 && bits<=32) bits=32;
|
|
while(bits%2) bits++;
|
|
return 0;
|
|
}
|
|
|
|
|
|
// >>>>>>>>>>>>>>>>>> Point members
|
|
|
|
Point::Point(int ix,int iy,int iz) {x=ix; y=iy; z=iz;}
|
|
int Point::XDist(int px) {return abs(px-x);}
|
|
int Point::YDist(int py) {return abs(py-y);}
|
|
double Point::Dist(int px,int py) {return sqrt((double)((px-x)*(px-x)+(py-y)*(py-y)));}
|
|
int Point::XDist(Point p) {return XDist(p.x); }
|
|
int Point::YDist(Point p) {return YDist(p.y); }
|
|
double Point::Dist(Point p) {return Dist(p.x,p.y);}
|
|
|
|
|