Пример #1
0
void CMovement::Init(CXMLParser::TXML* movementData, CCharacter *owner) {
	_owner = owner;
	_characterPosition = owner->getPosition();
	_position = new Vector2(0,0);
	_position->setXY(_characterPosition->getX(),_characterPosition->getY());

	char *auxTag;
	for(vu8 i = 0; i < movementData->numChilds; ++i){
		auxTag = movementData->childs[i]->tag;
		
		if(strcmp(auxTag, "name") == 0){
			strcpy(_name, movementData->childs[i]->value);
		}else if(strcmp(auxTag, "command") == 0){
			_command = CInputs::getInstance()->stringToCommand(movementData->childs[i]->value);
		}else if(strcmp(auxTag, "priority") == 0){
			_priority = atoi(movementData->childs[i]->value);
		}else if(strcmp(auxTag, "sprite") == 0){
			initSprite(movementData->childs[i]);
		}else if(strcmp(auxTag, "totalDuration") == 0){
			_totalDuration = atof(movementData->childs[i]->value);
		}else if(strcmp(auxTag, "loopable") == 0){
			_loopeable = strcmp(movementData->childs[i]->value, "true") == 0?true:false;
		}else if(strcmp(auxTag, "canBeBlocked") == 0){
			_canBeBlock = strcmp(movementData->childs[i]->value, "true") == 0?true:false;
		}else if(strcmp(auxTag, "movementData") == 0){
			
			initFrames(movementData->childs[i]);
		} // end if

	} // end for
		
	_sprite->setDurationPerFrame(_durationPerFrame);
} // Init
Пример #2
0
Auth::Auth()
{
    std::cout << "[GameMode] Auth started" << std::endl << std::flush;

    std::ifstream keyFile("key/dofus.key", std::ios::binary);
    std::copy(std::istreambuf_iterator<char>(keyFile), std::istreambuf_iterator<char>(), std::back_inserter(_key));

    initFrames();
}
Пример #3
0
JointManager::JointManager(const std::vector< std::string > &modelJointList, QWidget *parent)
 : QWidget(parent)
 , m_currentFrame()
{
	jointsLayout = new QGridLayout();
	setLayout(jointsLayout);

	m_jointList = modelJointList;
	initFrames(stripList(modelJointList));
}
Пример #4
0
// this func calculate the number of frames
// require for the ram and then acc to that
// create no. of frames which will be required for it
// and also mark the space which is preoccupied
// by the kernel
void init_mm(u32int ram_sz_bytes)
{
	// create a bitmap for the record
	// which blocks is allocated
	// and which isn't
	initFrames(ram_sz_bytes);
	// right now bit is full of zero 
	// means nothing is allocated yet
	// so we have place one to show that 
	// kernel is here you can't allocate
	// here
	allocate_kernel();
}
Пример #5
0
//=========================================================//
//=========================================================//
GLvoid UpdateHorse() //cosin and sin take sinputs as radians, and angle converts to radians
{
	if (!horse.initialized)
	{
		initFrames();
	}
	static int frameCounter = 0;

	horse.rad = PI*horse.angle / 180.0;
	horse.x += sin(horse.rad)*horseSpeed / 500.0;
	horse.z += cos(horse.rad)*horseSpeed / 500.0;

	static time_t lasttime = time(nullptr);
	time_t currenttime = time(nullptr);
	if (currenttime - lasttime > 0.001)
	{
		lasttime = currenttime;
		frameCounter++;
		if (frameCounter > 1)
		{
			frameCounter = 0;
		}
	}

	if (horse.state == 1)
	{
		DrawHorse(still);
	}
	else if (horse.state == 2)
	{
		DrawHorse(walk[frameCounter]);
	}
	else if (horse.state == 3)
	{
		DrawHorse(trot[frameCounter]);
	}
	else if (horse.state == 4)
	{
		DrawHorse(gallop[frameCounter]);
	}


	DrawHorse(walk[frameCounter]);
}
// ********************************************************************************************** //
//                                                                                                //
// ********************************************************************************************** //
classPlayer::classPlayer(std::string set_name, int playerNumber) : teleporter_n(-1), selected_weapon(WEAPON_DEFAULT), l_key_released(true), r_key_released(true)
{
	_number = playerNumber-1;
	max_projectiles = game_data.players[_number].max_shots;
    //std::cout << "classPlayer::classPlayer - max_projectiles: " << max_projectiles << std::endl;
	position.y = -TILESIZE;
	position.x = 80;
	hit_duration = 2500;
	//hitPoints.total = game_data.players[_number].HP;
	hitPoints.total = PLAYER_INITIAL_HP;
	hitPoints.current = hitPoints.total;
	name = set_name;
	add_graphic();
	init_weapon_colors();
	initFrames();
	shield_type = SHIELD_FRONT; /// @TODO: from editor
	// load items from save
	if (game_data.players[_number].can_slide == true) {
		slide_type = 1;
	}
    _jump_accel = game_data.players[_number].jump_gravity;
    move_speed = game_data.players[_number].move_speed/10;

    double temp_move_speed = game_data.players[_number].move_speed;
    temp_move_speed = temp_move_speed / 10;
    double intpart;
    double fractpart = modf(temp_move_speed , &intpart);


    if (fractpart > 0) { // calculates how many frames we need to give an extra pixel movement
        _fractional_move_speed = 10 - fractpart*10;
    }

    std::cout << ">>>>>>>>>>>>> move_speed: " << move_speed << ", fractpart: " << fractpart << ", _fractional_move_speed: " << _fractional_move_speed << std::endl;

    _touch_damage_reductor = game_data.players[_number].touch_damage_reduction;
    if (_touch_damage_reductor > 0) {
        _hit_move_back_dist = TILESIZE;
    }
    _charged_shot_projectile_id = game_data.players[_number].full_charged_projectile_id;
    //std::cout << "Player[" << name << "].jump_gravity: " << _jump_accel << std::endl;
    _simultaneous_shots = game_data.players[_number].simultaneous_shots;
}
Пример #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    initFrames();
    initBoxes();
    turn = 0;
    memset(grid, 0, sizeof(grid));
    strategy = new Strategy();

    for (int i = 0; i < 9; ++i) {
        for (int j = 0; j < 9; ++j) {
            QSignalMapper *signalMapper = new QSignalMapper(this);
            connect(boxes[i][j], SIGNAL(clicked()),signalMapper, SLOT(map()));
            signalMapper -> setMapping(boxes[i][j], (i*9 + j)) ;
            connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(fillBoxes(int)));
        }
    }
}
Пример #8
0
//start programu. PROGRAM-> FUNKCE . eof
tChyba PROGRAM () {					
	//inicializace labelu pro if a while na 0
	lab = 0;	
	lab_while = 0;						//nacitani prvniho tokenu je v komentu, protoze na konci je pomocna funkce, kde se uz nacita token, pri vyslednem kodu, bude toto nacteni tokenu odkomentovano
	/*token = getNextToken();
	if(token.stav == s_lex_error) {			
		return S_LEXIKALNI_CHYBA;
	}*/
	//lokalni promenna, do ni se nacita vystup funkci	
	int analyza;					
	//vytvoreni globalni a lokalni(main) hash tabulky
	int ret = initFrames();
	byla_funkce = false;
	pocitani_parametru = 0;

	if(ret != S_BEZ_CHYB ) {
		return S_INTERNI_CHYBA;
	}

	if(token.stav == s_klicove && (!strcmp(token.data, "function") || !strcmp(token.data, "var") || !strcmp(token.data, "begin"))) {
							//podminka kde se kontroluje, zda nacteny token je klicove slovo a nasledne se rozhodne, ktere konkretne. Pote dojde k zavolani funkce FUNKCE, kde jsou 3 pravidla, ktere zacinaji terminala vyse
		analyza = FUNKCE ();
		if (analyza != S_BEZ_CHYB) {		//pokud se vrati po zavolani FUNKCE() s_bez_chyb pokracuje se dal, jinak se vraci chybovy kod, ktery funkce vratila

		return analyza;
		}

		if(token.stav == s_tecka) {		//porovnava se ciselna hodnota tokenu s ciselnou hodnotu tecky (tecka neni primo nadefinovana jako tecka, ale je pro ni vyhrazen unikatni identifikator ciselny, ktery porovnavam s id prvku v nactenem tokenu)
			token = getNextToken();
			if(token.stav == s_lex_error) {	//jakmile nacitam token okamzite kontroluju, jestli se nevyskytla lexikalni chyba
				return S_LEXIKALNI_CHYBA;
			}

			if(token.stav == s_eof) {	//jakmile dojdeme ke konci souboru, vrati funkce syntakticka analyza ok a mame vyhrano
				return S_BEZ_CHYB;
			}
		}
	}
		return S_SYNTAKTICKA_CHYBA;		//pokud nejaky token neodpovida predem danym terminalum z pravidel, vraci chybu
}
void CProjectileMovement::Init(CXMLParser::TXML* projectileMovementData, CCharacter *owner, CPalette *palette) {
		
	CMovement::Init(projectileMovementData, owner, palette);

	_projectile = true;
	//_position = new Vector2(0,0);
	//_position->setXY(_characterPosition->getX(),_characterPosition->getY());
	
	_firstPosOffset = new Vector2();
	char *auxTag;
	for(vu8 i = 0; i < projectileMovementData->numChilds; ++i){
		auxTag = projectileMovementData->childs[i]->tag;
		
		if(strcmp(auxTag, "speedX") == 0){
			_speedX = atof(projectileMovementData->childs[i]->value);
		}else if(strcmp(auxTag, "speedY") == 0){
			_speedY = atof(projectileMovementData->childs[i]->value);
		}else if(strcmp(auxTag, "firstPositionX") == 0){
			_firstPosOffset->setX( atoi(projectileMovementData->childs[i]->value));
		}else if(strcmp(auxTag, "firstPositionY") == 0){
			_firstPosOffset->setY( atoi(projectileMovementData->childs[i]->value));
		}else if(strcmp(auxTag, "numProjectiles") == 0){
			_numProjectiles = atoi(projectileMovementData->childs[i]->value);
			//_totalDuration = atof(projectileMovementData->childs[i]->value);
		}else if(strcmp(auxTag, "dispersion") == 0){
			_dispersion = atof(projectileMovementData->childs[i]->value);
		}else if(strcmp(auxTag, "projMovementData") == 0){
			initFrames(projectileMovementData->childs[i]);
		} // end if

	} // end for
		
	_sprite->setDurationPerFrame(_durationPerFrame);
	
	initProjectiles();


} // Init
Пример #10
0
Frames::Frames()
{
    initFrames();
}
Пример #11
0
WindowsImageData::WindowsImageData(WinComPtr<IWICBitmapDecoder>& bitmapDecoder)
    : m_bitmapDecoder(bitmapDecoder)
{
    initFrames();
}