This was alot simplier then I thought it would be. With this you can have characters wearing different combinations of clothing.
Download in .rar
#include "DarkGDK.h"
#include "dinput.h"
void DarkGDK ( void )
{
bool bArmor = false;
bool bArms = false;
bool bLegs = false;
bool bFeet = false; // The Rest
bool bRebuild = true;
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadObject("L-Knight-Move.x", 1);
dbPositionObject(1, 0, -1, 0.5f);
dbSetImageColorKey(255, 0, 255);
dbLoadImage("face.bmp", 10, 1);
dbLoadImage("armor.bmp", 11, 1);
dbLoadImage("arms.bmp", 12, 1);
dbLoadImage("legs.bmp", 13, 1);
dbLoadImage("feet.bmp", 14, 1);
// Could only get BMP file format to work
while ( LoopGDK ( ) )
{
dbText(10, 10, "Push 1 2 3 4 to add/remove armor");
if (dbKeyState(DIK_1))
{
while(dbKeyState(DIK_1)) {}
if (bArmor) bArmor = false;
else bArmor = true;
bRebuild = true;
}
if (dbKeyState(DIK_2))
{
while(dbKeyState(DIK_2)) {}
if (bArms) bArms = false;
else bArms = true;
bRebuild = true;
}
if (dbKeyState(DIK_3))
{
while(dbKeyState(DIK_3)) {}
if (bLegs) bLegs = false;
else bLegs = true;
bRebuild = true;
}
if (dbKeyState(DIK_4))
{
while(dbKeyState(DIK_4)) {}
if (bFeet) bFeet = false;
else bFeet = true;
bRebuild = true;
}
if (bRebuild == true)
{
bRebuild = false;
dbCreateBitmap(1, 256, 256);
dbSetCurrentBitmap(1);
dbPasteImage(10, 0, 0, 1);
if (bArmor == true) dbPasteImage(11, 0, 0, 1);
if (bArms == true) dbPasteImage(12, 0, 0, 1);
if (bLegs == true) dbPasteImage(13, 0, 0, 1);
if (bFeet == true) dbPasteImage(14, 0, 0, 1);
dbGetImage(6, 0, 0, 256, 256);
///dbDeleteMemblock(1);
dbDeleteBitmap(1);
dbSetCurrentBitmap(0);
dbTextureObject(1, 6);
}
dbSync ( );
}
return;
}