Ejemplo n.º 1
0
void FASTCALL printPageNumber(LPWSTR maxGoldText, DWORD x, DWORD y, DWORD color, DWORD bfalse)
{
	if (onRealm || !D2isLODGame() )
	{
		D2PrintString(maxGoldText,x,y,color,bfalse);
		return;
	}

	Unit* ptChar = D2GetClientPlayer();
	WCHAR popupText[100];

	if (PCPY->currentStash)
	{
		bool isShared = PCPY->currentStash->isShared;
		bool isIndex = PCPY->currentStash->isIndex;
		DWORD currentId = PCPY->currentStash->id;

		if (PCPY->currentStash->name && PCPY->currentStash->name[0])
			mbstowcs(popupText,PCPY->currentStash->name,50);//strlen(PCPY->currentStash->name)+1
		else _snwprintf(popupText, sizeof(popupText), getLocalString( isShared ? STR_SHARED_PAGE_NUMBER : STR_PERSONAL_PAGE_NUMBER), currentId+1);
		D2PrintString(popupText, x, y, isShared ? (isIndex ? CRYSTAL_RED : RED) : (isIndex ? BRIGHT_WHITE : WHITE), bfalse);
	} else {
		_snwprintf(popupText, sizeof(popupText), getLocalString(STR_NO_SELECTED_PAGE));
		D2PrintString(popupText, x, y, WHITE, bfalse);
	}

	//printGoldMaxPopup
	DWORD mx = D2GetMouseX();
	DWORD my = D2GetMouseY();
	if ((RX(0x5E) < mx) && (mx < RX(0xF8)) && (RY(0x1C8) < my) && (my < RY(0x1B6)) )
	{
		if (active_sharedGold)
		{
			_snwprintf(popupText, sizeof(popupText), L"%s\n%s: %u", maxGoldText, getLocalString(STR_SHARED_GOLD_QUANTITY), PCPY->sharedGold);
			DWORD x = D2GetPixelLen(maxGoldText);
			DWORD x2 = D2GetPixelLen(popupText) - x;
			D2PrintPopup(popupText, RX(0xA8-max(x,x2)/2), RY(0x1CA), WHITE, 0);
		} else 
			D2PrintPopup(maxGoldText, RX(0xA8), RY(0x1CA), WHITE, 1);
	}
}
Ejemplo n.º 2
0
void manageStatLine(Unit* ptChar, statsInterfaceBIN* statLine, int currentPage, LPWSTR lpText)
{
	if (!statLine->enabled)
		return;

	if (statLine->page != currentPage)
		return;

	if (statLine->font)
		D2SetFont(statLine->font);

	printStat(ptChar, statLine->statsID, RX(statLine->x), RY(statLine->y), statLine->color, lpText);
}
Ejemplo n.º 3
0
	CTransform CTransform::RotateY(const F& angle)
	{
		F sinx = sin(CMath::Deg2Rad(angle));
		F cosx = cos(CMath::Deg2Rad(angle));

		CMatrix4x4 RY(cosx, 0.0,  sinx, 0.0,
			          0.0,  1.0,  0.0,  0.0,
			          -sinx, 0.0, cosx, 0.0,
			          0.0,   0.0, 0.0,  1.0);

		CMatrix4x4 invRY(RY);
		invRY.Transpose();

		return CTransform(RY, invRY);
	}
Ejemplo n.º 4
0
bool Enemy::IsCollision( Character *player )
{
    Rect pl, en;
    pl.x = player->RX();
    pl.y = player->RY();
    pl.w = player->RW();
    pl.h = player->RH();

    en.x = RX();
    en.y = RY();
    en.w = RW();
    en.h= RH();

    return (    pl.x            <       en.x+en.w &&
                pl.x+pl.w       >       en.x &&
                pl.y            <       en.y+en.h &&
                pl.y+pl.h       >       en.y );
}
Ejemplo n.º 5
0
DWORD	getYTakeGoldBtn()		{return RY(posYTakeGoldBtn<0 ? 0x1A8 : posYTakeGoldBtn);}
Ejemplo n.º 6
0
DWORD	getYPutGoldBtn()		{return RY(posYPutGoldBtn<0 ? 0x1A8 : posYPutGoldBtn);}
Ejemplo n.º 7
0
DWORD	getYNextIndexBtn()		{return RY(posYNextIndexBtn<0 ? 0x40 : posYNextIndexBtn);}
Ejemplo n.º 8
0
DWORD	getYPreviousIndexBtn()	{return RY(posYPreviousIndexBtn<0 ? 0x40 : posYPreviousIndexBtn);}
Ejemplo n.º 9
0
DWORD	getYSharedBtn()			{return RY(posYSharedBtn<0 ? 0x40 : posYSharedBtn);}
Ejemplo n.º 10
0
void STDCALL printNewStatsPageTwo(int currentPage)
{
	if (!D2isLODGame()) return D2PrintStatsPage();

	WCHAR text[BUFSIZE];
	LPWSTR lpText;
	bDontPrintBorder = false;

	Unit* ptChar = D2GetClientPlayer();

	d2_assert(!ptChar, "Printing stats page : no character selected",__FILE__,__LINE__);
	d2_assert(ptChar->nUnitType != UNIT_PLAYER, "Printing stats page : bad unit type",__FILE__,__LINE__);

	//Init data for print image
	sDrawImageInfo data;
	ZeroMemory(&data,sizeof(data));

	//print background
	fillRect(RX(0),RY(480),320,432,0,5);//552
	setImage(&data, newStatsInterfaceImages);
	setFrame(&data, 0);
	D2PrintImage(&data, RX(0),	RY(224), -1, 5, 0);
	setFrame(&data, 1);
	D2PrintImage(&data, RX(256),RY(224), -1, 5, 0);//256
	setFrame(&data, 2);
	D2PrintImage(&data, RX(0),	RY(48), -1, 5, 0);//432
	setFrame(&data, 3);
	D2PrintImage(&data, RX(256),RY(48), -1, 5, 0);

	D2SetFont(1);
	for (int i=0; i<nbStatsInterface; i++)
		manageStatLine(ptChar, &statsInterface[i], currentPage, text);

/*
//	DWORD x,y;
//	DWORD curValue;
//	CharStatsBIN* charStats = D2GetCharStatsBIN(ptChar->nPlayerClass);
//	DifficultyLevelsBIN* difficultyLevels = D2GetDifficultyLevelsBIN (D2GetDifficultyLevel());
	//print deadly Strike / Critical Strike
	x=RX(25);
	y=RY(445);
	Unit* ptItem = D2GetSkillItem(ptChar);
	DWORD cs = ptItem ? D2GetCriticalStrikeFromMasteries(ptChar,ptItem,0,2) : 0;
	cs = cs>100?100:cs;
	cs += D2GetPlayerStat(ptChar, STATS_PASSIVE_CRITICAL_STRIKE, 0)*(100-cs)/100;
	cs = cs>100?100:cs;
	//SkillDescBIN* skilldesc = SgptDataTables->skilldesc + 9;
	LPWSTR lpCS = D2GetStringFromIndex(skilldesc->strNameID);

	lpText = D2GetStringFromIndex(getDescStrPos(STATS_ITEM_DEADLYSTRIKE));
	curValue = D2GetPlayerStat(ptChar, STATS_ITEM_DEADLYSTRIKE, 0);

	cs += curValue*(100-cs)/100;
	curValue = cs>100?100:cs;

	swprintf(text,L"%i%% %s/%s",curValue,lpCS,lpText);
	D2SetFont(1);
	D2SetFont( D2GetPixelLen(text)>0x110 ? 6 : 1);
	D2PrintString(text, x, y, WHITE, 0);
*/

	//print background previous/next page buttons
	setImage(&data, statsBackgroundImages);
	setFrame(&data, D2GetResolution()?1:0);
	D2PrintImage(&data, getXPreviousPageBtn()-7, getYPreviousPageBtn()+8, -1, 5, 0);

	//print button close
	setImage(&data, D2LoadBuySelBtn());
	setFrame(&data, 10 + isDownBtn.close);
	D2PrintImage(&data, getXCloseBtn(), getYCloseBtn(), -1, 5, 0);
	
	//print previous page button
	setFrame(&data, 12 + isDownBtn.previousPage);
	D2PrintImage(&data, getXPreviousPageBtn(), getYPreviousPageBtn(), -1, 5, 0);

	//print next page button
	setFrame(&data, 14 + isDownBtn.nextPage);
	D2PrintImage(&data, getXNextPageBtn(), getYNextPageBtn(), -1, 5, 0);


//////////////////// POPUP PRINTING ////////////////////
	//set MouseX & MouseY
	DWORD mx = D2GetMouseX();
	DWORD my = D2GetMouseY();
	
	D2SetFont(1);

	if (isOnCloseBtn(mx,my))			// print popup "close"
	{
		D2PrintPopup(D2GetStringFromIndex(0x1030), getXCloseBtn()+getLCloseBtn()/2, getYCloseBtn()-getHCloseBtn(), WHITE, 1);
	}
	else if (isOnPreviousPageBtn(mx,my))	//print popup "previous page"
	{
		lpText = getLocalString(STR_PREVIOUS_PAGE);
		D2PrintPopup(lpText, getXPreviousPageBtn()+getLPreviousPageBtn()/2, getYPreviousPageBtn()-getHPreviousPageBtn(), WHITE, 1);
	}
	else if (isOnNextPageBtn(mx,my))	//print popup "next page"
	{
		lpText = getLocalString(STR_NEXT_PAGE);
		D2PrintPopup(lpText, getXNextPageBtn()+getLNextPageBtn()/2, getYNextPageBtn()-getHNextPageBtn(), WHITE, 1);
	}
}
Ejemplo n.º 11
0
void MyWidget::MarchingCubes() {

    Vector **triangles = new Vector*[5];
    for (int i = 0; i < 5; i++) {
        triangles[i] = new Vector[3];
    }

    Matrix T(4, 4);
    T.Diag(1);
    T(0, 3) = Tx + 200;
    T(1, 3) = Ty + 150;
    T(2, 3) = Tz;

    Matrix Sc(4, 4);
    Sc(0, 0) = ScX;
    Sc(1, 1) = ScY;
    Sc(2, 2) = ScZ;
    Sc(3, 3) = 1;

    Matrix RX(4, 4);
    RX.Diag(1);
    RX(1, 1) = cos(AlfaX);
    RX(1, 2) = sin(AlfaX);
    RX(2, 1) = -sin(AlfaX);
    RX(2, 2) = cos(AlfaX);

    Matrix RY(4, 4);
    RY.Diag(1);
    RY(0, 0) = cos(AlfaY);
    RY(0, 2) = -sin(AlfaY);
    RY(2, 0) = sin(AlfaY);
    RY(2, 2) = cos(AlfaY);

    Matrix RZ(4, 4);
    RZ.Diag(1);
    RZ(0, 0) = cos(AlfaZ);
    RZ(0, 1) = sin(AlfaZ);
    RZ(1, 0) = -sin(AlfaZ);
    RZ(1, 1) = cos(AlfaZ);

    Matrix m = T.multi(Sc.multi(RX.multi(RY.multi(RZ))));

    T.free();
    Sc.free();
    RX.free();
    RY.free();
    RZ.free();

    Matrix p;

    for (int x = _S; x < fR2; x += _S) {
        for (int y = _S; y < fR2; y += _S) {
            for (int z = _S; z < fR2; z += _S) {
                int n = Polygonise(x, y, z, 1, triangles);
                for (int i = 0; i < n; i++) {
                    Vector tab[3];
                    for (int j = 0; j < 3; j++) {
                        p = m.multi(triangles[i][j]);
                        tab[j] = Vector(p(X, 0), p(Y, 0), p(Z, 0));
                    }
                    Triangle(_bitsDest, tab[0], tab[1], tab[2]);

                    tab[0].free();
                    tab[1].free();
                    tab[2].free();
                }
            }
        }
    }

    m.free();
    p.free();

    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 3; j++) {
            triangles[i][j].free();
        }
    }
}
Ejemplo n.º 12
0
DWORD	getYSkillBtn()			{return RY(posYUnassignSkillBtn<0 ? 0x1B1 : posYUnassignSkillBtn);}
Ejemplo n.º 13
0
int main(int argc, char **argv) 
{
 
    /**
      * Inisialisasi node baru yang bernama "distance_tracker" dan terhubung 
      * dengan argumen command-line.
      */
    ros::init(argc, argv, "distance_tracker");
    
    ros::NodeHandle n;
    
    /** Subscribe terhadap navdata. */
    ros::Subscriber navdataSub = n.subscribe("/ardrone/navdata", 10, navdataCallback);
    /** Publish hasil perhitungan pelacakan ARDrone. */
    //ros::Publisher distancePub = n.advertise<geometry_msgs::Pose>("/drone_pos", 1000);

    // Map
    IplImage *map = cvCreateImage(cvSize(500, 500), IPL_DEPTH_8U, 3);
    cvZero(map);
 
    // Position matrix
    cv::Mat P = cv::Mat::zeros(3, 1, CV_64FC1);
    
    cv::Mat temp = cv::Mat::zeros(3, 1, CV_64FC1);

    float x = 0;
    float y = 0;  
    /** Loop utama untuk menghitung jejak ARDrone per 1 detik. */
    while (ros::ok()) {
        
        //geometry_msgs::Pose targetPose;
        //geometry_msgs::Point point2D;
 
        // Rotation matrices
        double _RX[] = {        1.0,       0.0,        0.0,
                                0.0, cos(::rotX), -sin(::rotX),
                                0.0, sin(::rotX),  cos(::rotX)};
        double _RY[] = { cos(::rotY),       0.0,  sin(::rotY),
                                0.0,       1.0,        0.0,
                        -sin(::rotY),       0.0,  cos(::rotY)};
        double _RZ[] = {   cos(::rotZ), -sin(::rotZ),        0.0,
                           sin(::rotZ),  cos(::rotZ),        0.0,
                                0.0,       0.0,        1.0};
        cv::Mat RX(3, 3, CV_64FC1, _RX);
        cv::Mat RY(3, 3, CV_64FC1, _RY);
        cv::Mat RZ(3, 3, CV_64FC1, _RZ);
 
        // Time
       static double last = ros::Time::now().toSec();
       double dt = (ros::Time::now().toSec() - last);
       last = ros::Time::now().toSec();
        
        //static int last = cv::getTickCount();
        //double dt = (cv::getTickCount() - last) / cv::getTickFrequency();
        //last = cv::getTickCount();

        // Local movement
        double _M[] = {::vx, ::vy, ::vz};
        cv::Mat M(3, 1, CV_64FC1, _M);
 
        // Dead reckoning
        temp = RZ * RY * RX * M;
        P = P + temp;
        
        x = x + dt * ::rotZ * P.at<double>(0,0);
        y = y + dt * ::rotZ * P.at<double>(1,0);

        ros::Duration time(1);
        time.sleep();
       
        // Position (x, y, z)
        double pos[3] = {P.at<double>(0,0), P.at<double>(1,0), P.at<double>(2,0)};
        ROS_INFO("X = %f , Y = %f, Z = %f, Waktu = %f ", pos[0], pos[1], pos[2], dt);
        //ROS_INFO("X = %f , Y = %f, Z = %f, Waktu = %f ", x, y);
        
        // Display the image
        cvDrawCircle(map, cvPoint(-pos[1]*30.0 + map->width/2, -pos[0]*30.0 + map->height/2), 2, CV_RGB(255,0,0));
        cvShowImage("map", map);
        ros::spinOnce();
    }
 
    cvReleaseImage(&map);
 
    return 0;
}