void Player::advance(int phase) { if(!phase) return; qreal xa = 0, ya =0; if(pSpriteMove->getIsRunning()){ setSpeedWalking(DEFAULT_SPEED_WALKING *3); }else{ setSpeedWalking(DEFAULT_SPEED_WALKING); } setAnimDelta(getAnimDelta()+1); setAnimTime(getAnimTime()+ getSpeedWalking()); /* On gère l'animation de déplacement */ if(getAnimDelta() >= getAnimTime()){ setAnimFrame(getAnimFrame()+1); setAnimDelta(0); if(getAnimFrame() > DEFAULT_ANIME_FRAME){ setAnimFrame(0); } } /*On définie les coordonnées de déplacement *par rapport au sens où le player doit aller.*/ if(pSpriteMove->getIsLookingUp()){ ya -= getSpeedWalking(); }else if(pSpriteMove->getIsLookingDown()){ ya += getSpeedWalking(); }else if(pSpriteMove->getIsLookingLeft()){ xa -= getSpeedWalking(); }else if(pSpriteMove->getIsLookingRight()){ xa += getSpeedWalking(); } /* On effectue le déplacement du player*/ if(xa != 0 || ya != 0){ pSpriteMove->setIsWalking(true); move(xa,ya); }else{ pSpriteMove->setIsWalking(false); } setAnimTime(DEFAULT_ANIME_TIME); }
animation_* getAnimation(unsigned char *image8bpp, int wi, int anim, int wf, int hf, int time, int collision) { int i; animation_* result; animFrame_** frames; unsigned char* sequence; int numFrame; // get max number of frame numFrame = wi / wf; // allocate result result = malloc(sizeof(animation_)); result->numFrame = numFrame; // allocate animFrame array frames = malloc(numFrame * sizeof(animFrame_*)); result->frames = frames; // default sequence result->length = numFrame; // allocate sequence sequence = malloc(numFrame * sizeof(unsigned char)); result->sequence = sequence; // default: loop to frame 0 result->loop = 0; for(i = 0; i < numFrame; i++) { *frames = getAnimFrame(image8bpp, wi, i, anim, wf, hf, time, collision); if (*frames == NULL) return NULL; frames++; *sequence++ = i; } return result; }
void Player::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); /*Gère l'affichage du player*/ pSpriteMove->render(0,0,getWidth(),getHeight(),painter,getDirMove(),getAnimFrame()); }
void NcpEnnemy::advance(int phase) { if(!phase) return; if(!chasingMode){ targetInAgressiveZone(); }else{ setAnimDelta(getAnimDelta()+1); setAnimTime(getAnimTime()+ getSpeedWalking()); if(getAnimDelta() >= getAnimTime()){ setAnimFrame(getAnimFrame()+1); setAnimDelta(0); if(getAnimFrame() > DEFAULT_ANIME_FRAME){ setAnimFrame(0); } findPathToTarget(); } setAnimTime(DEFAULT_ANIME_E_TIME); } }
void IgorEngine::PART_85_UPDATE_DIALOGUE_PHILIP_LAURA(int action) { switch (action) { case kUpdateDialogueAnimEndOfSentence: decodeAnimFrame(_animFramesBuffer - 1 + READ_LE_UINT16(_animFramesBuffer + 0x7480), _screenVGA, true); break; case kUpdateDialogueAnimMiddleOfSentence: if (VAR_CURRENT_TALKING_ACTOR != 0) { _gameState.counter[0] = getRandomNumber(5) + 8; } else { _gameState.counter[0] = getRandomNumber(5) + 13; } decodeAnimFrame(getAnimFrame(0, 0x7480, _gameState.counter[0]), _screenVGA, true); break; } }
void NcpEnnemy::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); getPSpriteMove()->render(0,0,getWidth(),getHeight(),painter,getDirMove(),getAnimFrame()); }
void IgorEngine::PART_85() { playMusic(2); loadRoomData(PAL_SpringRock, IMG_SpringRock, BOX_SpringRock, MSK_SpringRock, TXT_SpringRock); memcpy(_screenLayer2, _screenLayer1, 46080); loadRoomData(PAL_SpringBridgeIntro, IMG_SpringBridgeIntro, 0, 0, TXT_SpringBridgeIntro); static const int anm[] = { ANM_PhilipLauraIntro, AOF_PhilipLauraIntro, ANM_LauraIntro, AOF_LauraIntro, 0 }; loadAnimData(anm); memcpy(_screenVGA, _screenLayer1, 46080); _updateDialogue = &IgorEngine::PART_85_UPDATE_DIALOGUE_PHILIP_LAURA; _updateRoomBackground = &IgorEngine::PART_85_UPDATE_ROOM_BACKGROUND; VAR_WATER_SOUND_PLAYING = true; playSound(17, 1); decodeAnimFrame(getAnimFrame(0, 0x7480, 1), _screenVGA, true); fadeInPalette(768); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0, 0x7481, 2, 7, 32); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(201, 3, 545); ADD_DIALOGUE_TEXT(204, 1, 546); SET_DIALOGUE_TEXT(1, 2); startCutsceneDialogue(89, 56, 63, 63, 0); VAR_CURRENT_TALKING_ACTOR = 0; waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(205, 3, 547); SET_DIALOGUE_TEXT(1, 1); startCutsceneDialogue(113, 59, 63, 0, 38); VAR_CURRENT_TALKING_ACTOR = 1; waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(208, 1, 548); SET_DIALOGUE_TEXT(1, 1); startCutsceneDialogue(89, 56, 63, 63, 0); VAR_CURRENT_TALKING_ACTOR = 0; waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(209, 2, 549); ADD_DIALOGUE_TEXT(211, 1, 550); ADD_DIALOGUE_TEXT(212, 1, 551); ADD_DIALOGUE_TEXT(213, 1, 552); ADD_DIALOGUE_TEXT(214, 1, 553); SET_DIALOGUE_TEXT(1, 5); startCutsceneDialogue(113, 59, 63, 0, 38); VAR_CURRENT_TALKING_ACTOR = 1; waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0, 0x7481, 2, 7, 32); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(215, 1, 554); ADD_DIALOGUE_TEXT(216, 2, 555); ADD_DIALOGUE_TEXT(218, 1, 556); SET_DIALOGUE_TEXT(1, 3); startCutsceneDialogue(89, 56, 63, 63, 0); VAR_CURRENT_TALKING_ACTOR = 0; waitForEndOfCutsceneDialogue(89, 56, 63, 63, 0); if (_inputVars[kInputEscape]) goto PART_85_EXIT; ADD_DIALOGUE_TEXT(219, 2, 557); ADD_DIALOGUE_TEXT(221, 2, 558); SET_DIALOGUE_TEXT(1, 2); startCutsceneDialogue(113, 59, 63, 0, 38); VAR_CURRENT_TALKING_ACTOR = 1; waitForEndOfCutsceneDialogue(113, 59, 63, 0, 38); if (_inputVars[kInputEscape]) goto PART_85_EXIT; decodeAnimFrame(getAnimFrame(0, 0x7480, 1), _screenVGA, true); PART_85_HELPER_1(0, 0x7481, 2, 7, 32); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0, 0x7481, 18, 37, 20); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_2(); VAR_WATER_SOUND_PLAYING = false; stopSound(); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0x74CA, 0xA6C4, 1, 6, 32); if (_inputVars[kInputEscape]) goto PART_85_EXIT; for (int i = 0; i <= 200 / kTimerTicksCount; ++i) { PART_85_UPDATE_ROOM_BACKGROUND(); if (_inputVars[kInputEscape]) goto PART_85_EXIT; waitForTimer(); } _walkData[0].x = 251; _walkData[0].y = 125; _walkData[0].scaleWidth = 50; _walkDataLastIndex = 1; _walkCurrentPos = 4; ADD_DIALOGUE_TEXT(223, 2, 559); SET_DIALOGUE_TEXT(1, 1); startIgorDialogue(); waitForEndOfIgorDialogue(); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0x74CA, 0xA6C4, 7, 9, 32); if (_inputVars[kInputEscape]) goto PART_85_EXIT; _walkData[0].x = 250; _walkData[0].y = 119; _walkCurrentPos = 3; ADD_DIALOGUE_TEXT(225, 2, 560); ADD_DIALOGUE_TEXT(227, 3, 561); SET_DIALOGUE_TEXT(1, 2); startIgorDialogue(); waitForEndOfIgorDialogue(); if (_inputVars[kInputEscape]) goto PART_85_EXIT; PART_85_HELPER_1(0x74CA, 0xA6C4, 10, 24, 16); PART_85_EXIT: stopSound(); _gameState.dialogueTextRunning = false; _inputVars[kInputEscape] = 0; _walkData[0].setPos(155, 121, 4, 0); _walkData[0].setDefaultScale(); copyArea(_screenLayer2, 23180, 320, _facingIgorFrames[3], 30, 30, 50, true); memcpy(_screenVGA, _screenLayer2, 46080); memset(_currentPalette + 0x270, 0, 0x8D); setPaletteRange(208, 254); _currentPart = 61; _updateDialogue = 0; _updateRoomBackground = 0; }