void AGOSEngine_Simon1::playSpeech(uint16 speech_id, uint16 vgaSpriteId) { if (speech_id == 9999) { if (_subtitles) return; if (!getBitFlag(14) && !getBitFlag(28)) { setBitFlag(14, true); _variableArray[100] = 15; animate(4, 1, 130, 0, 0, 0); waitForSync(130); } _skipVgaWait = true; } else { if (_subtitles && _scriptVar2) { animate(4, 2, 204, 0, 0, 0); waitForSync(204); stopAnimate(204); } if (vgaSpriteId < 100) stopAnimate(201 + vgaSpriteId); loadVoice(speech_id); if (vgaSpriteId < 100) animate(4, 2, 201 + vgaSpriteId, 0, 0, 0); } }
void View::setAnimated(bool _isAnimate) { if(_isAnimate) startAnimate(); else stopAnimate(); }
void ChipsAnimate::startAnimate(int from, int to, const CChips& chips, int sound) { stopAnimate(); sound_ = sound; CTableView* pV = CTableView::Instance(); pView_ = pV; ASSERT(pView_); chips_ = chips; Player* pFrom = pV->getPlayer(from); Player* pTo = pV->getPlayer(to); if (pFrom && pTo) { player_ = from; msecs_ = Global::GetAnimationTime() / 2; ticks_ = 0; // Animation does not go to the pot right away, // chips move to the pot only after betting round // ends. start_ = pFrom->getChipStartPos(); end_ = pFrom->getChipBetPos(); //end_ = pTo->getChipPos(); pos_ = start_; CDC* pDC = pView_->GetDC(); if (pDC) { Chips::Instance().startAnimate(pDC, chips_, start_); pView_->ReleaseDC(pDC); } // Fix up the 'end' position so the bottom left corner // of the rectangle will hit there CSize s = Chips::Instance().getAnimationBufferSize(); end_.y -= (s.cy - Chips::Height_); } }
BOOL ChipsAnimate::stepAnimate(DWORD dt) { if (msecs_ == 0) return FALSE; /* if (Registry::GetInstanceNumber() != 1) { stopAnimate(); return FALSE; } */ BOOL rc = TRUE; ticks_ += dt; if (ticks_ < msecs_) { // // Do a piece of the animation // CPoint diff = end_ - start_; float d = float(ticks_) / float(msecs_); diff.x *= d; diff.y *= d; CPoint newPos = start_ + diff; animate(newPos, pos_); pos_ = newPos; } else { // // Animation is complete // stopAnimate(); rc = FALSE; } return rc; }
void AGOSEngine::skipSpeech() { _sound->stopVoice(); if (!getBitFlag(28)) { setBitFlag(14, true); if (getGameType() == GType_FF) { _variableArray[103] = 5; animate(4, 2, 13, 0, 0, 0); waitForSync(213); stopAnimateSimon2(2, 1); } else if (getGameType() == GType_SIMON2) { _variableArray[100] = 5; animate(4, 1, 30, 0, 0, 0); waitForSync(130); stopAnimateSimon2(2, 1); } else { _variableArray[100] = 15; animate(4, 1, 130, 0, 0, 0); waitForSync(130); stopAnimate(1); } } }
void AGOSEngine_PN::opn_opcode54() { stopAnimate(varval()); setScriptReturn(true); }
View::~View() { stopAnimate(); delete m_camera; }
void AGOSEngine::printScreenText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) { char convertedString[320]; char *convertedString2 = convertedString; int16 height, talkDelay; int stringLength = strlen(string); int padding, lettersPerRow, lettersPerRowJustified; const int textHeight = 10; height = textHeight; lettersPerRow = width / 6; lettersPerRowJustified = stringLength / (stringLength / lettersPerRow + 1) + 1; talkDelay = (stringLength + 3) / 3; if (getGameType() == GType_SIMON1 && (getFeatures() & GF_TALKIE)) { if (_variableArray[141] == 0) _variableArray[141] = 9; _variableArray[85] = _variableArray[141] * talkDelay; } else { if (_variableArray[86] == 0) talkDelay /= 2; if (_variableArray[86] == 2) talkDelay *= 2; _variableArray[85] = talkDelay * 5; } assert(stringLength > 0); while (stringLength > 0) { int pos = 0; if (stringLength > lettersPerRow) { int removeLastWord = 0; if (lettersPerRow > lettersPerRowJustified) { pos = lettersPerRowJustified; while (string[pos] != ' ') pos++; if (pos > lettersPerRow) removeLastWord = 1; } if (lettersPerRow <= lettersPerRowJustified || removeLastWord) { pos = lettersPerRow; while (string[pos] != ' ' && pos > 0) pos--; } height += textHeight; y -= textHeight; } else pos = stringLength; padding = ((lettersPerRow - pos) % 2) ? (lettersPerRow - pos) / 2 + 1 : (lettersPerRow - pos) / 2; while (padding--) *convertedString2++ = ' '; stringLength -= pos; while (pos--) *convertedString2++ = *string++; *convertedString2++ = '\n'; string++; // skip space stringLength--; // skip space } *(convertedString2 - 1) = '\0'; if (getGameType() == GType_SIMON1) stopAnimate(vgaSpriteId + 199); else stopAnimateSimon2(2, vgaSpriteId); if (getPlatform() == Common::kPlatformAmiga) { color = color * 3 + 1; renderStringAmiga(vgaSpriteId, color, width, height, convertedString); } else { color = color * 3 + 192; renderString(vgaSpriteId, color, width, height, convertedString); } uint16 windowNum = (!getBitFlag(133)) ? 3 : 4; if (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) windowNum = 4; x /= 8; if (y < 2) y = 2; if (getGameType() == GType_SIMON1) { uint16 id = 199 + vgaSpriteId; animate(windowNum, id / 100, id, x, y, 12); } else { animate(windowNum, 2, vgaSpriteId, x, y, 12); } }
void AGOSEngine_Waxworks::printBox() { uint16 BoxSize; *_boxBufferPtr = 0; _linePtrs[0] = _boxBuffer; if (_boxCR == 0) _boxLineCount++; stopAnimate(105); BoxSize = getBoxSize(); _variableArray[53] = BoxSize; animate(3, 1, 100, 0, 0, 0); changeWindow(5); switch (BoxSize) { case 1: _textWindow->x = 10; _textWindow->y = 163; _textWindow->width = 20; _textWindow->height = 1; _textWindow->textMaxLength = 26; break; case 2: _textWindow->x = 8; _textWindow->y = 160; _textWindow->width = 24; _textWindow->height = 2; _textWindow->textMaxLength = 32; break; case 3: _textWindow->x = 6; _textWindow->y = 156; _textWindow->width = 28; _textWindow->height = 3; _textWindow->textMaxLength = 37; break; case 4: _textWindow->x = 4; _textWindow->y = 153; _textWindow->width = 32; _textWindow->height = 4; _textWindow->textMaxLength = 42; break; case 5: _textWindow->x = 2; _textWindow->y = 150; _textWindow->width = 36; _textWindow->height = 5; _textWindow->textMaxLength = 48; break; default:_textWindow->x = 1; _textWindow->y = 147; _textWindow->width = 38; _textWindow->height = 6; _textWindow->textMaxLength = 50; break; } _textWindow->textColumn = 0; _textWindow->textRow = 0; _textWindow->textColumnOffset = 0; _textWindow->textLength = 0; justifyStart(); waitForSync(99); _boxBufferPtr = _boxBuffer; while (*_boxBufferPtr) justifyOutPut(*_boxBufferPtr++); _boxLineCount = 0; _boxBufferPtr = _boxBuffer; _lineCounts[0] = 0; _lineCounts[1] = 0; _lineCounts[2] = 0; _lineCounts[3] = 0; _lineCounts[4] = 0; _lineCounts[5] = 0; changeWindow(0); }
void display() { /* This function is used to display the content on to the screen... This is not important for the participant... He can skip it */ int gridDup[6][7],moveDup=move,endGameFlagDup,rowNum; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glLoadIdentity(); drawGrid(grid); if(animate) { drawPiece(result,displacement,move); if(stopAnimate(grid,result,displacement)) { animate=0; if(!errorFlag) { rowNum=updateGrid(move,grid,result); // update the grid implying the move has been made drawGrid(grid); if(checkWinOrLose(grid,result,rowNum)) { // check for win condition win=move; // win will contain which bot has won endGameFlag=1; } else if(checkDraw(grid)) { // check for draw condition win=0; // win=0 implies draw endGameFlag=1; } move*=-1; // toggle between plaper 1 and player 2 } } } if(errorFlag) // If error occurs text(displayStr,-1.5,-1.8,font3); if(endGameFlag) { // If game ends if(win>0) // player 1 wins strcpy(displayStr,"Bot 1 wins!!!"); else if(win<0) // player 2 wins strcpy(displayStr,"Bot 2 wins!!!"); else // draw strcpy(displayStr,"Game drawn!!!"); text(displayStr,-1.5,-1.8,font3); printf("\n\n\t%s\n\n\t\tgrid content : \n\n",displayStr); displayStatus(grid); } glFlush(); glutSwapBuffers(); if(animate) displacement+=0.005; if(!endGameFlag && !errorFlag && !animate) { copyGrid(grid,gridDup); moveDup=move; endGameFlagDup=endGameFlag; if(move>0) result=bot1(grid,move); else result=bot2(grid,move); if(!(equalGrid(grid,gridDup) && move==moveDup && endGameFlagDup==endGameFlag)) { // grid() and move variables should not be changed sprintf(displayStr,"Bot %d error : Grid or move is modified!!!",move); errorFlag=1; } checkForErrors(result,move,grid); // errors like result should be within the 0 to 6 range, etc... animate=1; displacement=0; } }
void DemoWidget::endGdiplusAnimate() { _GdiplusAnimatorView.hide(); stopAnimate(); }
void DemoWidget::endSkiaAnimate() { _SkiaAnimatorView.hide(); stopAnimate(); }