Today, I did something illegal. I took and recieved the source code to the 'Solitare' game in Microsoft Windows. Now, it won't compile (missing headers), but I can tell you that there is more than meets the eye.
For example, there is 2 different '3 of spades' images in the bmp/ directory. The second design was obviously never used (does the fact the Microsoft named it 'foo.dib' have anything to do with it?)
I have come forward to comment on this blunder.
Let's take a look in cards.c, ok...
While there isn't anything really intresting in the code (although this seems to be the basis of CARDS.DLL), there is this one function which seems a bit odd:
void SaveCorners(HDC hdc, LONG FAR *rgRGB, INT x, INT y, INT dx, INT dy)
{
if(dx != dxCard || dy != dyCard)
return;
/* Upper Left */
rgRGB[0] = GetPixel(hdc, x, y);
rgRGB[1] = GetPixel(hdc, x+1, y);
rgRGB[2] = GetPixel(hdc, x, y+1);
/* Upper Right */
x += dx -1;
rgRGB[3] = GetPixel(hdc, x, y);
rgRGB[4] = GetPixel(hdc, x-1, y);
rgRGB[5] = GetPixel(hdc, x, y+1);
/* Lower Right */
y += dy-1;
rgRGB[6] = GetPixel(hdc, x, y);
rgRGB[7] = GetPixel(hdc, x, y-1);
rgRGB[8] = GetPixel(hdc, x-1, y);
/* Lower Left */
x -= dx-1;
rgRGB[9] = GetPixel(hdc, x, y);
rgRGB[10] = GetPixel(hdc, x+1, y);
rgRGB[11] = GetPixel(hdc, x, y-1);
}
Now, if you are a programmer, you can obvioulsy tell that Microsoft does shit the same as everybody else. They ain't God, they ain't special. Their shit stinks too.
Here's a better one:
BOOL APIENTRY cdtDraw(HDC hdc, INT x, INT y, INT cd, INT mode, DWORD rgbBgnd)
/*
* Parameters:
* hdc HDC to window to draw cards on
* x, y Where you'd like them
* cd Card to be drawn
* mode Way you want it drawn
*
* Returns:
* True if card successfully drawn, False otherwise
*/
{
return cdtDrawExt(hdc, x, y, dxCard, dyCard, cd, mode, rgbBgnd);
}
The irony of this is that Microsoft has to write one completely pointless function to save programmers a few keystrokes down the line... jeesh no wonder they're bloated! pointless functions for pointless code!
Here's another bloated fnction we could have lived without:
VOID MyDeleteHbm(HBITMAP hbm)
{
if(hbm != NULL)
DeleteObject(hbm);
}
If the Microsoft programmers actually took tiem to go through their code, this would not be nessessrary. Damn Microsoft idiots!
That is my view.
No comments:
Post a Comment