struct CSmiley:CSprite
{
	void Init(void);
	void destructor(void);
	void draw(void);
	void fastcall enableSteps(ECX);
	void fastcall setStepsDC(EAX);
//  varibles:
	dword fStepsEnabled;
	dword dcSteps;
	dword hStepsBitmap;
	dword dcStepsBitmap;
};

/*
; --=====================================================================================--
; #METHOD:      CONSTRUCTOR (NONE)
;
; #DESCRIPTION: Basic constructor setup as well as inheriting from CSprite and providing
;               polymorphism for the "draw" method.  As well the constructor will set each
;               instance up with a DC to hold footprints and load the graphic into it.
;               This is the basic purpose demostrated by inheriting the base CSprite class
;               and appending extra freatures to it (foot prints in this case)..
;
; #RETURN:      Nothing..
; --=====================================================================================--*/
void CSmiley::Init(void)
{
	ESI=this;
	ESI.CSprite.Init();
	hStepsBitmap=LoadBitmap(hInst,STEP);
	dcStepsBitmap=CreateCompatibleDC(NULL);
	SelectObject(EAX,hStepsBitmap);
}

/*
; --=====================================================================================--
; #METHOD:      destructor (NONE)
;
; #DESCRIPTION: Will delete the object extra footprint bitmap and the extra DC created for
;               this object.  As well it will then call the SUPER class (CSprite) which this
;               class is inherited from and call its DESTRUCTOR method to do all the extra
;               clean up it provides for its base properties..
;
; #RETURN:      Nothing..
; --=====================================================================================--*/

void CSmiley::destructor(void)
{
	ESI=this;
	ESI.CSprite.destructor();
	EAX=dcStepsBitmap;
	IF(EAX)DeleteDC(EAX);
	EAX=hStepsBitmap;
	IF(EAX)DeleteObject(EAX);
}

/*
; --=====================================================================================--
; #METHOD:      draw (VOID)
;
; #DESCRIPTION: This is the polymorphic draw method specific to CSmiley object instnaces.
;               It re-uses the inherited "draw" code form the base class it inherits from (CSprite),
;               and then does some "extra" functionality to draw footprints as well, provided
;               that that Steps has been enabled for the CSmiley objects instance..
;
; #RETURN:      Nothing..
; --=====================================================================================--*/

void CSmiley::draw(void)
{
// Now, if enabled, draw the footprints as well around this character.
	ESI=this;
	ESI.CSprite.draw();
	IF(fStepsEnabled){
		EAX=Rand32(3)<<4; // * 16 pixels
		BitBlt(dcSteps,xPos,yPos,16,16,dcStepsBitmap,EAX,0,SRCAND);
	}
}

/*
; --=====================================================================================--
; #METHOD:      setStepsDC (hDC)
;
; #DESCRIPTION: Used to set the DC for the footprint graphics for this object..
;
; #PARAM:       hDC    The DC the footprint graphics are to be saved to..
;
; #RETURN:      Nothing..
; --=====================================================================================--*/
void fastcall CSmiley::setStepsDC(EAX)
{
	dcSteps=EAX;
}

/*
; --=====================================================================================--
; #METHOD:      enableSteps (flag)
;
; #DESCRIPTION: Used to set each instance to show or not show footprints when drawn with
;               the polymorphic draw method (by calling draw upon a CSmiley class instance)..
;
; #PARAM:       flag    True, the footprints are drawn, FLASE, they are not..
;
; #RETURN:      Nothing..
; --=====================================================================================--*/

void fastcall CSmiley::enableSteps(ECX)
{
   fStepsEnabled=ECX;
}
