void FlipViewProc () { if(twoBoards) { partnerUp = 1; DrawPosition(True, NULL); partnerUp = 0; } flipView = !flipView; DrawPosition(True, NULL); }
void kwxLinearReg::OnMouse(wxMouseEvent& event) { if (m_iStato == 0 && event.Entering()) //dentro nel controllo m_iStato = ENTERED ; else if (m_iStato >= ENTERED && event.Leaving()) //fuori dal controllo m_iStato = LEFT ; else if (m_iStato == ENTERED && event.GetWheelRotation()) // process wheel event { //SetValue(m_iRealVal + (event.GetWheelRotation() * (m_iMax-m_iMin)/kwxLinearReg::MOUSE_STEP / event.GetWheelDelta()) ); SetValue(m_iRealVal + ( m_iBigStep * event.GetWheelRotation() / event.GetWheelDelta()) ); vSendEvent(); // send event return; } else if (m_iStato == ENTERED && event.ButtonDClick()) // process double click { // wxLogTrace("Mouse Premuto") ; m_mousePosition = event.GetPosition(); if( (m_iSnapRange<1) && (m_iStyle & STYLE_SNAP_DOUBLE_CLK) ){ // if no snapping was set.. vSetSnap2Tags(true); // ..snap to next tag. DrawPosition() ; vSetSnap2Tags(false); return; } DrawPosition() ; } else if (m_iStato == ENTERED && event.LeftDown()) //click o inizio trascinamento { // wxLogTrace("Mouse Premuto") ; m_iStato = DRAGED ; if( (m_bEditing) ){ // if control is currently in edit mode if(m_cCurrentRect.Contains(m_mousePosition)){ // mouse click was within text sourrounding rectangle m_bEditing = false; // exit edit mode m_iCaretPosition = 0; // reset edit caret position SetValue(iConvert(m_strCurrent)); Refresh() ; vSendEvent() ; return; } } m_mousePosition = event.GetPosition(); DrawPosition() ; } else if (m_iStato == DRAGED && event.LeftIsDown()) //trascinamento { // wxLogTrace("Mouse trascinato") ; m_mousePosition = event.GetPosition(); DrawPosition() ; } else if (m_iStato == DRAGED && event.LeftUp()) //fine trascinamento o rilascio click { // wxLogTrace("Mouse rilasciato") ; m_iStato = ENTERED ; } event.Skip(false);// }
void NewAstList(char plr, char prog, int M1, int M2, int M3, int M4) { program = prog; /* Sets capsule/shuttle program for "Draws Astronaut attributes" section */ /* 1=Mercury/Vostok, 2=Gemini/Voskhod, 3=Apollo/Soyuz, 4=XMS-2/Lapot, 5=Jupiter/Kvartet */ /* This will be used to highlight the skills for each crew member's role -Leon */ fill_rectangle(13, 86, 231, 122, 3); /* Clear Astro Area */ display::graphics.setForegroundColor(1); if (M1 > 0) { retdel = Data->P[plr].Pool[M1 - 1].RetirementDelay; // Sets whether 'naut has announced retirement sex = Data->P[plr].Pool[M1 - 1].Sex; // Sets whether 'naut is male or female missions = Data->P[plr].Pool[M1 - 1].Missions; AstNames(0, &Data->P[plr].Pool[M1 - 1].Name[0], Data->P[plr].Pool[M1 - 1].Mood); AstStats(plr, 0, M1 - 1); } else { DrawPosition(prog, 1); } if (M2 > 0) { retdel = Data->P[plr].Pool[M2 - 1].RetirementDelay; // Sets whether 'naut has announced retirement sex = Data->P[plr].Pool[M2 - 1].Sex; // Sets whether 'naut is male or female missions = Data->P[plr].Pool[M2 - 1].Missions; AstNames(1, &Data->P[plr].Pool[M2 - 1].Name[0], Data->P[plr].Pool[M2 - 1].Mood); AstStats(plr, 1, M2 - 1); } else { DrawPosition(prog, 2); } if (M3 > 0) { retdel = Data->P[plr].Pool[M3 - 1].RetirementDelay; // Sets whether 'naut has announced retirement sex = Data->P[plr].Pool[M3 - 1].Sex; // Sets whether 'naut is male or female missions = Data->P[plr].Pool[M3 - 1].Missions; AstNames(2, &Data->P[plr].Pool[M3 - 1].Name[0], Data->P[plr].Pool[M3 - 1].Mood); AstStats(plr, 2, M3 - 1); } else { DrawPosition(prog, 3); } if (M4 > 0) { retdel = Data->P[plr].Pool[M4 - 1].RetirementDelay; // Sets whether 'naut has announced retirement sex = Data->P[plr].Pool[M4 - 1].Sex; // Sets whether 'naut is male or female missions = Data->P[plr].Pool[M4 - 1].Missions; AstNames(3, &Data->P[plr].Pool[M4 - 1].Name[0], Data->P[plr].Pool[M4 - 1].Mood); AstStats(plr, 3, M4 - 1); } else { DrawPosition(prog, 4); } return; }
void ShowCoordsProc () { appData.showCoords = !appData.showCoords; MARK_MENU_ITEM("Options.ShowCoords", appData.showCoords); DrawPosition(True, NULL); }
void BlindfoldProc () { appData.blindfold = !appData.blindfold; MARK_MENU_ITEM("Options.Blindfold", appData.blindfold); DrawPosition(True, NULL); }
void CStar::Draw(Vector _mypos, int _timecount){ if (!Visible)return; _timecount += TimeGap; DrawPos = DrawPosition(Pos, _mypos); if(DrawPos.x<-Radius*2-50 || DrawPos.x>WINDOW_WIDTH+Radius*2+50) return; if(DrawPos.y<-Radius*2-50 || DrawPos.y>WINDOW_HEIGHT+Radius*2+50)return; if(Alive){ //Star DrawRotaGraph((int)(DrawPos.x), (int)(DrawPos.y), 1, (_timecount%300)*PI/150, ImgStar, true) ; //Enemy生成タイムゲージ for(int i=0; i<3; i++){ DrawExtendGraph((int)DrawPos.x-12, (int)DrawPos.y-3+8*(i-1), (int)DrawPos.x+12, (int)DrawPos.y+3+8*(i-1), ImgStarGauge[0], true); DrawExtendGraph((int)DrawPos.x-11, (int)DrawPos.y-2+8*(i-1), (int)(DrawPos.x-11 + 22 * (1+(_timecount%EnemyBirthTime[i])) / EnemyBirthTime[i]), (int)DrawPos.y+2+8*(i-1), ImgStarGauge[1], true); } }else{ //ティウンティウン] for (int i=0; i<8; i++){ if(_timecount/5 % 2 == 0) DrawCircle((int)(DeadCircleDrawPos[i].x+DrawPos.x), (int)(DeadCircleDrawPos[i].y+DrawPos.y), 12, GetColor(255,100,0), false); } } }
void CProgressCtrl :: SetPos (UINT iNewPos) { // prüfe Parameter if (iNewPos <= m_iStart || iNewPos >= m_iEnd || m_iStart == m_iEnd) return; DrawPosition (iNewPos); }
void CEnemy::Draw(Vector _mypos){ if(Alive){ Vector DrawPos = DrawPosition(Pos, _mypos); if(DrawPos.x<-PicSizeX || DrawPos.x>WINDOW_WIDTH+PicSizeX) return; if(DrawPos.y<-PicSizeY || DrawPos.y>WINDOW_HEIGHT+PicSizeY)return; //敵絵 DrawRotaGraph((int)(DrawPos.x), (int)(DrawPos.y), 1, -GetAngle(_mypos), ImgEnemy[0], true); DrawRotaGraph((int)(DrawPos.x), (int)(DrawPos.y), 1, -GetAngle(_mypos), ImgEnemy[1], true); //HPゲージ DrawExtendGraph((int)(DrawPos.x-Hp/2), (int)DrawPos.y+PicSizeY/2+5, (int)(DrawPos.x+Hp/2), (int)DrawPos.y+PicSizeY/2+4, ImgEnemy[2], true); } }
void CProgressCtrl :: SetRange (UINT iStart, UINT iEnd) { // alten Parameter löschen m_iDrawPos = m_iStart = m_iEnd = m_iPos = 0; m_dFaktor = 1.0; // prüfe Parameter if (iStart == iEnd || iStart > iEnd) return; // Rechteck nachbearbeiten GetClientRect (&rc); rc.left += iOffsX; rc.top += iOffsY; rc.right -= iOffsX; rc.bottom -= iOffsY; m_dFaktor = (double)(rc.right - rc.left) / (double)(iEnd - iStart); m_iDrawPos = 0; // ZeichenPosition m_iStart = iStart; m_iEnd = iEnd; DrawPosition (0); // Balken löschen }
void SerializableRLE8AnimationFrame::simplifyColors() { // Delete existing data delete simplifiedColorData_; simplifiedColorDataSize_ = width_ * height_; simplifiedColorData_ = new char[simplifiedColorDataSize_]; internalColorMap.clear(); int colorNum = 0; int pos = 0; for (int j = 0; j < height_; j++) { for (int i = 0; i < width_; i++) { DrawColor pixel = getPixel(DrawPosition(i, j)); // Check if this color is in the map ReverseColorMap::iterator colorCheck = internalColorMap.find(pixel); // Add color to map if it's not already there if (colorCheck == internalColorMap.end()) { internalColorMap.insert( ReverseColorMapPair(pixel, colorNum)); // std::cout << "a: " << pixel.a() << std::endl; // std::cout << "r: " << pixel.r() << std::endl; // std::cout << "g: " << pixel.g() << std::endl; // std::cout << "b: " << pixel.b() << std::endl; // std::cout << std::endl; ++colorNum; } // Add compressed pixel simplifiedColorData_[pos] = static_cast<char>(internalColorMap.find(pixel)->second); ++pos; } } }
DrawPosition SDL2GraphicSurface::drawPixels(const DrawPosition& pos, const DrawColor& color, int length) { return DrawPosition(); }
/** * The main capsule building interface. * * Programs refers to the Manned capsule programs, specifically the * ones where astronauts may be assigned. This has the main control * loop for the capsule building user interface. * * \param plr the country running the program * \param prog the capsule style */ void Programs(char plr, char prog) { int i, max, chk, tst; int now2 = 0, count = 0, grp = 0, BarA = 0; int M[100], CrewCount[8]; char ksel = 0; helpText = "i036"; keyHelpText = "k036"; for (i = 0; i < 100; i++) { M[i] = -1; } if (prog > 4) { max = 4; } else if (prog == 4) { max = 3; } else { max = prog; } music_start(M_PRGMTRG); DrawProgs(plr, prog); Flts(0, 0); for (i = 0; i < ASTRONAUT_CREW_MAX; i++) { CrewCount[i] = Data->P[plr].CrewCount[prog][i]; if (CrewCount[i] == 0) { FltsTxt(i, 8); } if (CrewCount[i] < max && CrewCount[i] != 0) { FltsTxt(i, 9); } if (CrewCount[i] == max) { FltsTxt(i, 1); } } for (i = 0; i < Data->P[plr].AstroCount; i++) { if (Data->P[plr].Pool[i].Assign == prog && Data->P[plr].Pool[i].Crew == 0) { M[count++] = i; } } ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); FadeIn(2, 10, 0, 0); chk = CheckProgram(plr, prog); if (chk == 0) { if (plr == 0) { Help("i113"); } else { Help("i114"); } music_stop(); return; } WaitForMouseUp(); while (1) { key = 0; GetMouse(); for (i = 0; i < 8; i++) { // Right Select Box if (x >= 27 && y >= (131 + i * 8) && x <= 151 && y <= (137 + i * 8) && mousebuttons > 0 && (now2 - BarA + i) <= (count - 1)) { // Left now2 -= BarA; now2 += i; BarA = i; fill_rectangle(26, 129, 153, 195, 0); DispLeft(plr, BarA, count, now2, &M[0]); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); BarSkill(plr, BarA, now2, &M[0]); WaitForMouseUp(); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } } if (mousebuttons > 0 || key > 0) { /* Gameplay */ if (((x >= 6 && y >= 130 && x <= 18 && y <= 161 && mousebuttons > 0) || key == UP_ARROW) && count > 0) { /* Lft Up */ InBox(6, 130, 18, 161); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 0) if (now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } i = 51; } } while (mousebuttons == 1 || key == UP_ARROW) { delay(100); if (BarA == 0) if (now2 > 0) { now2--; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA > 0) { fill_rectangle(26, 129, 153, 195, 0); BarA--; now2--; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } key = 0; GetMouse(); } OutBox(6, 130, 18, 161); delay(10); } else if (((x >= 6 && y >= 163 && x <= 18 && y <= 194 && mousebuttons > 0) || key == DN_ARROW) && count > 0) { /* Lft Dwn */ InBox(6, 163, 18, 194); for (i = 0; i < 50; i++) { key = 0; GetMouse(); delay(10); if (mousebuttons == 0) { if (BarA == 7) if (now2 < count - 1) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA < 7) if (now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } i = 51; } } while (mousebuttons == 1 || key == DN_ARROW) { delay(100); if (BarA == 7) if (now2 < count - 1) { now2++; fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } if (BarA < 7) if (now2 < count - 1) { fill_rectangle(26, 129, 153, 195, 0); BarA++; now2++; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } key = 0; GetMouse(); } //WaitForMouseUp(); OutBox(6, 163, 18, 194); } else if (key == K_HOME) { fill_rectangle(26, 129, 153, 195, 0); BarA = 0; now2 = 0; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } else if (key == K_END) { fill_rectangle(26, 129, 153, 195, 0); BarA = MIN(count - 1, 7); now2 = count - 1; ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); } else if (key == 'S') { // Show Skill ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); BarSkill(plr, BarA, now2, &M[0]); } else if (((x >= 4 && y >= 86 && x <= 12 && y <= 92 && mousebuttons > 0) || key == '1') && CrewCount[grp] >= 1) { /* Display Man 1 */ InBox(4, 86, 12, 92); AstLevel(plr, prog, grp, 0); OutBox(4, 86, 12, 92); } else if (((x >= 4 && y >= 95 && x <= 12 && y <= 101 && mousebuttons > 0) || key == '2') && prog >= 2 && CrewCount[grp] >= 2) { /* Display Man 2 */ InBox(4, 95, 12, 101); AstLevel(plr, prog, grp, 1); OutBox(4, 95, 12, 101); } else if (((x >= 4 && y >= 104 && x <= 12 && y <= 110 && mousebuttons > 0) || key == '3') && prog >= 3 && CrewCount[grp] >= 3) { /* Display Man 3 */ InBox(4, 104, 12, 110); AstLevel(plr, prog, grp, 2); OutBox(4, 104, 12, 110); } else if (((x >= 4 && y >= 113 && x <= 12 && y <= 119 && mousebuttons > 0) || key == '4') && prog >= 5 && CrewCount[grp] >= 4) { /* Display Man 4 */ InBox(4, 113, 12, 119); AstLevel(plr, prog, grp, 3); OutBox(4, 113, 12, 119); } else if (key == 'C') { ClearIt(); ksel = grp; //save old flt crew if (grp == 7) { grp = 0; } else { ++grp; } Flts(ksel, grp); NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); if (key > 0) { delay(150); } } else if (x >= 164 && y >= 139 && x <= 238 && y <= 151 && mousebuttons > 0) { /* Flt Crew I */ ClearIt(); Flts(grp, 0); grp = 0; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 154 && x <= 238 && y <= 166 && mousebuttons > 0) { /* Flt Crew II */ ClearIt(); Flts(grp, 1); grp = 1; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 169 && x <= 238 && y <= 181 && mousebuttons > 0) { /* Flt Crew III */ ClearIt(); Flts(grp, 2); grp = 2; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 164 && y >= 184 && x <= 238 && y <= 196 && mousebuttons > 0) { /* Flt Crew IV */ ClearIt(); Flts(grp, 3); grp = 3; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 139 && x <= 315 && y <= 151 && mousebuttons > 0) { /* Flt Crew V */ ClearIt(); Flts(grp, 4); grp = 4; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 154 && x <= 315 && y <= 166 && mousebuttons > 0) { /* Flt Crew VI */ ClearIt(); Flts(grp, 5); grp = 5; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 169 && x <= 315 && y <= 181 && mousebuttons > 0) { /* Flt Crew VII */ ClearIt(); Flts(grp, 6); grp = 6; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (x >= 241 && y >= 184 && x <= 315 && y <= 196 && mousebuttons > 0) { /* Flt Crew VIII */ ClearIt(); Flts(grp, 7); grp = 7; NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); } else if (((x >= 245 && y >= 88 && x <= 314 && y <= 100 && mousebuttons > 0) || key == 'A') && CrewCount[grp] < max) { /* Assign 'Naut */ if (Data->P[plr].Crew[prog][grp][CrewCount[grp]] == 0 && count > 0) { InBox(245, 88, 314, 100); Data->P[plr].Crew[prog][grp][CrewCount[grp]] = M[now2] + 1; AstNames(CrewCount[grp], &Data->P[plr].Pool[M[now2]].Name[0], Data->P[plr].Pool[M[now2]].Mood); Data->P[plr].Pool[M[now2]].Crew = grp + 1; Data->P[plr].Pool[M[now2]].Task = CrewCount[grp]; Data->P[plr].Pool[M[now2]].Unassigned = 1; for (i = now2; i < count; i++) { M[i] = M[i + 1]; } M[i] = -1; count--; if (now2 == count) { if (now2 > 0) { now2--; } if (BarA > 0) { BarA--; } } fill_rectangle(26, 129, 153, 195, 0); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); CrewCount[grp]++; Data->P[plr].CrewCount[prog][grp] = CrewCount[grp]; if (CrewCount[grp] == max) { FltsTxt(grp, 1); } else { FltsTxt(grp, 9); } NewAstList(plr, prog, Data->P[plr].Crew[prog][grp][0], Data->P[plr].Crew[prog][grp][1], Data->P[plr].Crew[prog][grp][2], Data->P[plr].Crew[prog][grp][3]); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 88, 314, 100); } /* End outer if */ } else if ((x >= 245 && y >= 106 && x <= 314 && y <= 118 && mousebuttons > 0) || key == 'B') { /* Break Group */ tst = Data->P[plr].Crew[prog][grp][0] - 1; /* If the crew is assigned to a mission, create an alert * that it cannot be broken while the mission is planned. */ if (Data->P[plr].Pool[tst].Prime > 0) { OutBox(245, 106, 314, 118); /* Copy the screen area into a buffer before drawing * the dialog so it can be repainted after the dialog * is dismissed */ display::LegacySurface buffer(170, 131); buffer.copyFrom(display::graphics.legacyScreen(), 75, 43, 244, 173); /* Draw the alert message */ ShBox(75, 43, 244, 173); IOBox(81, 152, 238, 167); InBox(81, 70, 238, 113); fill_rectangle(82, 71, 237, 112, 7 + 3 * plr); display::graphics.setForegroundColor(1); draw_heading(118, 50, "PROBLEM", 0, -1); draw_string(136, 162, "CONTINUE"); display::graphics.setForegroundColor(11); draw_string(88, 80, "FLIGHT CREW "); draw_number(0, 0, grp + 1); draw_string(0, 0, " IS ALREADY"); draw_string(88, 88, "ASSIGNED TO THE "); if (Data->P[plr].Pool[tst].Prime == 4 || Data->P[plr].Pool[tst].Prime == 3) { draw_string(0, 0, "PRIMARY"); } else { draw_string(0, 0, "BACKUP"); } draw_string(88, 96, "CREW OF A CURRENT MISSION:"); draw_string(88, 104, "CANNOT BREAK THIS CREW."); WaitForMouseUp(); i = 1; while (i == 1) { key = 0; GetMouse(); if (mousebuttons > 0 || key > 0) { if ((x >= 83 && y >= 154 && x <= 236 && y <= 165 && mousebuttons != 0) || key == K_ENTER) { InBox(83, 154, 236, 165); WaitForMouseUp(); OutBox(83, 154, 236, 165); /* Closing the alert message. * Redraw the screen behind it from buffer */ buffer.copyTo(display::graphics.legacyScreen(), 75, 43); i = 2; } } } } else if (Data->P[plr].Crew[prog][grp][0] != 0) { InBox(245, 106, 314, 118); while (CrewCount[grp] > 0) { M[count] = Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] - 1; Data->P[plr].Crew[prog][grp][CrewCount[grp] - 1] = 0; Data->P[plr].Pool[M[count]].Crew = 0; Data->P[plr].Pool[M[count]].Moved = 0; Data->P[plr].Pool[M[now2]].Unassigned = 0; CrewCount[grp]--; count++; } ClearIt(); fill_rectangle(26, 129, 153, 195, 0); FltsTxt(grp, 8); ShBox(26, 130 + BarA * 8, 152, 138 + BarA * 8); DispLeft(plr, BarA, count, now2, &M[0]); for (i = 1; i < 5; i++) { DrawPosition(prog, i); } WaitForMouseUp(); OutBox(245, 106, 314, 118); } } else if ((x >= 245 && y >= 5 && x <= 314 && y <= 17 && mousebuttons > 0) || key == K_ENTER) { /* Exit */ InBox(245, 5, 314, 17); WaitForMouseUp(); if (key > 0) { delay(150); } OutBox(245, 5, 314, 17); delay(10); for (i = 0; i < 8; i++) { if (CrewCount[i] < max) while (CrewCount[i] > 0) { M[count] = Data->P[plr].Crew[prog][i][CrewCount[i] - 1] - 1; Data->P[plr].Crew[prog][i][CrewCount[i] - 1] = 0; Data->P[plr].Pool[M[count]].Crew = 0; Data->P[plr].CrewCount[prog][i] = 0; CrewCount[i]--; count++; } Data->P[plr].CrewCount[prog][i] = CrewCount[i]; } for (i = 0; i < count; i++) { Data->P[plr].Pool[M[i]].Assign = 0; } music_stop(); return; /* Done */ } } } }
void DrawSpinningReels( LOGICAL init ) { //Real sorry about all the static variables. It does look silly, but //it is preferable to maintain the static-ly declared variables within this scope. //could move them to the global, but right now it suits the task. //Remember, this function is called 4 times a second, and it is only this function //that uses these variables, so oh well. Call a spade a spade....they're static to //keep persistent data. int n; static LOGICAL bInit[NUM_REELS]; //static to maintain state. static uint32_t effectcount = 0; //static to maintain state. static LOGICAL bPlaying = FALSE; //static to maintain state. static int iBobble[5] = {0,-54,32,0,0}; //no need to declare this over and over 4 times a second. static INDEX idxBobbleCount[NUM_REELS]; //static to maintain state. uint32_t uiSmartYOffset = ( ( NUM_PICS - NUM_PICS_IN_WINDOW ) / 2 ); static uint32_t bBobbling[NUM_REELS]; // xlprintf(LOG_NOISE)("DrawSpinningReels, init is %s g.flags.bSpinning is %d" // , (init?"TRUE":"FALSE") // , g.flags.bSpinning // ); for( n = 0; n < g.nReels; n++ ) { if( init ) { bInit[n] = TRUE; if( !bPlaying ) { SetReelSpeedStep(); bPlaying = TRUE; BlotScaledImageSizedTo( g.statussurface , g.playing , 0, 0 , 140, 68 ); } } if( g.bReelSpinning[n] ) { //uiStartStep is each reel's random starting order. if ( g.uiStartStep[n] ) { g.uiStartStep[n]--; } else { { //uiSpeedStep demonstrates speed of reel movement (FAST, medium, and ....slllowwww). And stop.stutter.stop. if( g.uiSpeedStep[n] == 0 ) { BlotImageSizedTo( g.subsurface[n] , g.dodges[rand()%NUM_BLURS] , 0, 0 , 0, 0, 96, (96 * NUM_PICS_IN_WINDOW) ); //effectcount is how long reels should be speedy-blurry, and normal-blurry. if( effectcount < (NUM_ITERATIONS / 2 ) ) effectcount++; else { effectcount = 0; g.uiSpeedStep[n]++; } } else if( g.uiSpeedStep[n] == 1 ) { BlotImageSizedTo( g.subsurface[n] , g.blurs[rand()%NUM_BLURS] , 0 ,0 , 0, 0, 96, (96 * NUM_PICS_IN_WINDOW) ); if( effectcount < (NUM_ITERATIONS / 2 ) ) effectcount++; else { effectcount = 0; g.uiSpeedStep[n]++; } } else if( g.uiSpeedStep[n] == 2 ) { if( g.uiSpeedCounter[n] == 0 ) { // could move this entire declaration into the global, and control the init process differently, but for now // declaring static variable arrays suit the task. the reason why these arrays are static is that // state needs to be maintained every time the function is entered and exited, and these variables are // not really global (that is, this scope is the only scope that counts). // count[n] counts the number of times the reel has spun before it begins to stop. // iteration[n] determines the maximum number of times the reel must spin before it begins to stop. // last[y][x] maintains what the last pic was in that position, and is later incremented to demonstrate movement. static INDEX count[NUM_REELS], iteration[NUM_REELS]; static INDEX last[NUM_REELS][NUM_PICS]; if( bInit[n] ) { int y; idxBobbleCount[n] = uiSmartYOffset; bBobbling[n] = 0; for( y = 0; y < NUM_REELS; y++ ) { last[y][0] = GetPositionIndex( TRUE, n ); last[y][1] = last[y][0] + 1; last[y][2] = last[y][1] + 1; last[y][3] = last[y][2] + 1; last[y][4] = last[y][3] + 1; } //this doesn't work yet....or does it? { IMAGE_RECTANGLE rect; rect.x = 0;//REEL_OFSX + REEL_STEPX * n; rect.y = 0;//REEL_OFSY; rect.width = REEL_WIDTH; rect.height = REEL_HEIGHT; //FixImagePosition( g.subsurface[n] ); //SetImageBound( g.subsurface[n], &rect ); } bInit[n] = FALSE; count[n] = 0; iteration[n] = (rand()%NUM_ITERATIONS) + ITERATIONS_OFFSET; } { INDEX idx; int x; for( x = uiSmartYOffset; x < ( NUM_PICS_IN_WINDOW + uiSmartYOffset) ; x++) { idx = last[n][x]; DrawPosition( n, idx, x, 0); } //--- This is just quality assurance.-------- // for( x = 0; x < NUM_PICS; x++ ) // { // idx = last[n][x]; // BlotImageSizedTo( g.testsurface[n] // , g.images[idx] // , 0, ( 96 * x ) // , 0, 0, REEL_WIDTH, ( 96 * NUM_PICS ) // ); // } //--- This is just quality assurance.-------- } if( idxBobbleCount[n] == uiSmartYOffset ) { // xlprintf(LOG_NOISE)("Well, %d is shifting" // , n // ); last[n][4] = last[n][3]; last[n][3] = last[n][2]; last[n][2] = last[n][1]; last[n][1] = last[n][0]; last[n][0] = GetPositionIndex( FALSE, n ); count[n]++; } if(count[n] == (iteration[n] + 2 ) ) { uint32_t x; for( x = uiSmartYOffset; x < ( NUM_PICS_IN_WINDOW + uiSmartYOffset) ; x++) { DrawPosition( n, last[n][x], x, iBobble[idxBobbleCount[n]]); } if( idxBobbleCount[n] >= ( NUM_PICS_IN_WINDOW + uiSmartYOffset) ) { xlprintf(LOG_NOISE)("Bobbling"); g.uiSpeedStep[n] = DO_NOT_SPIN; //g.bReelSpinning[n] = 0; bBobbling[n] = 1; g.uiSpeedCounter[n] = 0; g.ofs = -7; //might figure out if this is even necessary to maintain later. { int m; for( m = 0; m < NUM_REELS; m++ ) // if( g.bReelSpinning[m] ) if( !bBobbling[m] ) { // xlprintf(LOG_NOISE)(" %d is * still * spinning." // , m // ); break; } else { idxBobbleCount[m] = uiSmartYOffset + 1; } if( m == NUM_REELS ) { g.flags.bSpinning = 0; { //reset the bobbleness. int z; for( z = 0; z < NUM_REELS; z++) { g.bReelSpinning[z] = 0; idxBobbleCount[z] = uiSmartYOffset; } } if( bPlaying ) { BlotScaledImageSizedTo( g.statussurface , g.playagain , 0 , 0 //490, 10 , 140, 68 ); UpdateDisplay(g.render); bPlaying = FALSE; } } } } else { idxBobbleCount[n]++; } } else if( count[n] > iteration[n] ) { g.uiSpeedCounter[n] = count[n] - iteration[n] ; } } else g.uiSpeedCounter[n]--; } } } } } UpdateDisplayPortion( g.render, REEL_OFSX, REEL_OFSY, REEL_STEPX*(g.nReels-1) + REEL_WIDTH, REEL_HEIGHT ); }