Here I'll document all the stupid shit I've done. Hopefully I will learn from these if I write them down

1)
Frigging linking errors. I've encountered this error like 1000 times and I just never learn. In visual c++, project -> Linker "additional library diectories" must point to where the libs are, but in addition to that each lib to be used must be specified in project ->Linker -> Input "additional dependancies".
Why isn't giving the directory enough information?? The compiler can see what I use or don't use in the code can't it?
2)
SoundFirst I made a directx wav player, using the sample source for wav playing that comes with the DirectX sdk, DXUTSound.h/cpp which you can find in your directx directory, \Samples\C++\Common.
Then I realised the song is a mod file, so I used fmod.
FSOUND_Init(44100, 32, 0);
FMUSIC_MODULE * sawng = FMUSIC_LoadSong("8.mod");
FMUSIC_PlaySong(sawng);But the pitch was all wrong, shockwave helped me with that here.
http://dbfinteractive.com/forum/index.php?topic=3596.0Then I realised I was using the wrong song! (don't ask

)
The actual song is a "future composer" file which fmod can't play. No problem, I went to the resources section and used the tiny fc replayer. It didn't play at all till I moved the "play" function call before ptc_open. No idea why.
But of course one of the rules is that all files must be part of the exe, but this lib only loads stuff from the hard drive.
So I got this updated lib from the same guy on the net, which can play from memory.
http://www.vectronixhq.de/?page_id=26May I suggest we replace the tiny fc player with it?
This is how I loaded song as a resource FYI
BYTE *data;
//IDR_SONG1 is just a unique integer to identify the resource. "song" is the type that I made
//when I imported the data. I think you could just say RC_DATA instead for any binary stuff.
HRSRC handle = FindResource(NULL, MAKEINTRESOURCE(IDR_SONG1), TEXT("song"));
if ( handle != NULL )
{
HGLOBAL ptr = LoadResource(NULL, handle);
if ( ptr != NULL)
{
data = (BYTE*)LockResource(ptr);
}
}
int size = sizeof(data); //doesnt work
//had to manually specify size of the song in bytes
playOSMEMusicMem(data, 19980,1);
3)
BitmapsI was using Freeimage (
http://freeimage.sourceforge.net/) originally to load the jpgs I had ripped from the demo. But freeimage cant be linked statically AFAICT. So I had to convert the stuff to bitmap resources and load them using WINAPI. But they were pretty huge so I changed them to 8 bit paletted. Here is the code to load paletted bitmaps as a resource. I had some trouble getting them to display right, but it was an issue of using the pitch instead of the width and multiplying by the number of bytes per pixel in some areas.
HBITMAP LoadResourceBitmap(HINSTANCE hInstance, LPSTR lpString, HPALETTE FAR* lphPalette);
HPALETTE CreateDIBPalette (LPBITMAPINFO lpbmi, LPINT lpiNumColors);
int main();
HBITMAP LoadResourceBitmap(HINSTANCE hInstance, LPSTR lpString,
HPALETTE FAR* lphPalette)
{
HRSRC hRsrc;
HGLOBAL hGlobal;
HBITMAP hBitmapFinal = NULL;
LPBITMAPINFOHEADER lpbi;
HDC hdc;
int iNumColors;
if (hRsrc = FindResource(hInstance, lpString, RT_BITMAP))
{
hGlobal = LoadResource(hInstance, hRsrc);
lpbi = (LPBITMAPINFOHEADER)LockResource(hGlobal);
hdc = GetDC(NULL);
*lphPalette = CreateDIBPalette ((LPBITMAPINFO)lpbi, &iNumColors);
if (*lphPalette)
{
SelectPalette(hdc,*lphPalette,FALSE);
RealizePalette(hdc);
}
hBitmapFinal = CreateDIBitmap(hdc,
(LPBITMAPINFOHEADER)lpbi,
(LONG)CBM_INIT,
(LPSTR)lpbi + lpbi->biSize + iNumColors * sizeof(RGBQUAD),
(LPBITMAPINFO)lpbi,
DIB_RGB_COLORS );
ReleaseDC(NULL,hdc);
UnlockResource(hGlobal);
FreeResource(hGlobal);
}
return (hBitmapFinal);
}
HPALETTE CreateDIBPalette (LPBITMAPINFO lpbmi, LPINT lpiNumColors)
{
LPBITMAPINFOHEADER lpbi;
LPLOGPALETTE lpPal;
HANDLE hLogPal;
HPALETTE hPal = NULL;
int i;
lpbi = (LPBITMAPINFOHEADER)lpbmi;
if (lpbi->biBitCount <= 8)
*lpiNumColors = (1 << lpbi->biBitCount);
else
*lpiNumColors = 0; // No palette needed for 24 BPP DIB
if (lpbi->biClrUsed > 0)
*lpiNumColors = lpbi->biClrUsed; // Use biClrUsed
if (*lpiNumColors)
{
hLogPal = GlobalAlloc (GHND, sizeof (LOGPALETTE) +
sizeof (PALETTEENTRY) * (*lpiNumColors));
lpPal = (LPLOGPALETTE) GlobalLock (hLogPal);
lpPal->palVersion = 0x300;
lpPal->palNumEntries = *lpiNumColors;
for (i = 0; i < *lpiNumColors; i++)
{
lpPal->palPalEntry[i].peRed = lpbmi->bmiColors[i].rgbRed;
lpPal->palPalEntry[i].peGreen = lpbmi->bmiColors[i].rgbGreen;
lpPal->palPalEntry[i].peBlue = lpbmi->bmiColors[i].rgbBlue;
lpPal->palPalEntry[i].peFlags = 0;
}
hPal = CreatePalette (lpPal);
GlobalUnlock (hLogPal);
GlobalFree (hLogPal);
}
return hPal;
}
int main()
{
HPALETTE hPalette;
HBITMAP file = LoadResourceBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BITMAP1), &hPalette);
BITMAP bmp;
GetObject( file, sizeof(bmp), &bmp);
width = bmp.bmWidth;
height = bmp.bmHeight;
bpp = bmp.bmBitsPixel;
pitch = bmp.bmWidthBytes/ (bpp/8);
if ( data != NULL) delete data;
data = new unsigned int[ height*pitch];
GetBitmapBits( file, height * pitch * 4, data );
DeleteObject( file );
// data is the 32 bit image array now ready for blitting
}
4) resolution
This is what I'm about to do, the original is 320x200 (I think). The rules specified 640x480 as the minimum so Ill just draw each pixel as 4 blocks and adjust a bit here and there. Also have to code a fullscreen thingy.
5) Font. Gonna have to build up a font image by copy pasting each character from screenshots. Getting the text will b easy though as explained in the help thread.
6) Demo
and here I get to actually start coding the demo. Not much to it though. Just got to get the sine pattern right and make the text transition effect.