Esempio n. 1
0
cUnit::cUnit(  cHouse *pHouse, word pType, word pMapIndex, byte pAngle, word pAction, word pHealth  ) : cObject(pHouse, pMapIndex, pHealth) {

	_surface = new cVideoSurface( 32, 32 );
	_surface->colorKeySet( 0xFF );

	_objectType = pType;
	_UnitData = g_DuneEngine->resourcesGet()->unitGet( _objectType );

	_actionCurrent = pAction;

	// Put the unit in the mapcell
	if(pMapIndex != 0xFFFF)
		(*mapCellGet())->objectEnter( this );

	angleSet(pAngle, false, &_angleBase);
	angleSet(pAngle, false, &_angleTop);

	_X = 0;
	_Y = 0;
}
Esempio n. 2
0
/* AngleControl::updateAngle
 * Updates the visual angle buttons
 *******************************************************************/
void AngleControl::updateAngle()
{
	// Set angle button
	for (unsigned a = 0; a < 8; a++)
		rb_angles[a]->SetValue(false);

	if (angleSet())
	{
		switch (angle)
		{
		case 0:		rb_angles[0]->SetValue(true); break;
		case 45:	rb_angles[1]->SetValue(true); break;
		case 90:	rb_angles[2]->SetValue(true); break;
		case 135:	rb_angles[3]->SetValue(true); break;
		case 180:	rb_angles[4]->SetValue(true); break;
		case 225:	rb_angles[5]->SetValue(true); break;
		case 270:	rb_angles[6]->SetValue(true); break;
		case 315:	rb_angles[7]->SetValue(true); break;
		default:	break;
		}
	}
}