void TaskPointWidget::Prepare(ContainerWindow &parent, const PixelRect &rc) { const Layout layout(rc, look); WindowStyle panel_style; panel_style.Hide(); panel_style.Border(); panel_style.ControlParent(); ButtonWindowStyle button_style; button_style.TabStop(); CheckBoxStyle check_box_style; check_box_style.TabStop(); WindowStyle dock_style; dock_style.ControlParent(); waypoint_panel.Create(parent, look, layout.waypoint_panel, panel_style); waypoint_name.Create(waypoint_panel, layout.waypoint_name); waypoint_details.Create(waypoint_panel, look.button, _("Details"), layout.waypoint_details, button_style, *this, DETAILS); waypoint_remove.Create(waypoint_panel, look.button, _("Remove"), layout.waypoint_remove, button_style, *this, REMOVE); waypoint_relocate.Create(waypoint_panel, look.button, _("Relocate"), layout.waypoint_relocate, button_style, *this, RELOCATE); tp_panel.Create(parent, look, layout.tp_panel, panel_style); type_label.Create(tp_panel, layout.type_label); change_type.Create(tp_panel, look.button, _("Change Type"), layout.change_type, button_style, *this, CHANGE_TYPE); map.Create(tp_panel, layout.map, WindowStyle(), [this](Canvas &canvas, const PixelRect &rc){ PaintMap(canvas, rc); }); properties_dock.Create(tp_panel, layout.properties, dock_style); optional_starts.Create(tp_panel, look.button, _("Enable Alternate Starts"), layout.optional_starts, button_style, *this, OPTIONAL_STARTS); score_exit.Create(tp_panel, look, _("Score exit"), layout.score_exit, check_box_style, *this, SCORE_EXIT); RefreshView(); }
void CTranscendenceWnd::Animate (bool bTopMost) // Animate // // Called on each frame { bool bFailed = false; CG16bitImage &TheScreen = g_pHI->GetScreen(); try { SetProgramState(psAnimating); // Do the appropriate thing switch (m_State) { case gsIntro: AnimateIntro(bTopMost); break; case gsProlog: AnimateProlog(bTopMost); break; case gsInGame: case gsDestroyed: { DWORD dwStartTimer; if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) dwStartTimer = ::GetTickCount(); // Figure out some stats bool bBlind = false; bool bSRSEnhanced = false; bool bShowMapHUD = false; CShip *pShip = NULL; if (GetPlayer()) { pShip = GetPlayer()->GetShip(); bBlind = pShip->IsBlind(); bSRSEnhanced = pShip->IsSRSEnhanced(); bShowMapHUD = GetPlayer()->IsMapHUDActive(); } // Update some displays if ((m_iTick % 7) == 0) { SetProgramState(psUpdatingReactorDisplay); m_ReactorDisplay.Update(); SetProgramState(psAnimating); } // If we're showing damage flash, fill the screen if (m_iDamageFlash > 0 && (m_iDamageFlash % 2) == 0) { TheScreen.Fill(0, 0, g_cxScreen, g_cyScreen, CG16bitImage::RGBValue(128,0,0)); if (pShip && pShip->GetSystem()) { if (m_bShowingMap) g_pUniverse->PaintObjectMap(TheScreen, m_rcMainScreen, pShip); else g_pUniverse->PaintObject(TheScreen, m_rcMainScreen, pShip); } } // Otherwise, if we're in map mode, paint the map else if (m_bShowingMap) { SetProgramState(psPaintingMap); PaintMap(); SetProgramState(psAnimating); } // Otherwise, if we're blind, paint scramble else if (bBlind && (m_iTick % (20 + (((m_iTick / 100) * pShip->GetDestiny()) % 100))) > 15) PaintSRSSnow(); // Otherwise, paint the normal SRS screen else { SetProgramState(psPaintingSRS); g_pUniverse->PaintPOV(TheScreen, m_rcMainScreen, bSRSEnhanced); SetProgramState(psAnimating); PaintMainScreenBorder(); } if (m_iDamageFlash > 0) m_iDamageFlash--; // Paint various displays SetProgramState(psPaintingLRS); PaintLRS(); if (!m_bShowingMap || bShowMapHUD) { SetProgramState(psPaintingArmorDisplay); m_ArmorDisplay.Paint(TheScreen); SetProgramState(psPaintingReactorDisplay); m_ReactorDisplay.Paint(TheScreen); SetProgramState(psPaintingTargetDisplay); m_TargetDisplay.Paint(TheScreen); SetProgramState(psPaintingDeviceDisplay); m_DeviceDisplay.Paint(TheScreen); } if (m_CurrentPicker == pickNone) { SetProgramState(psPaintingMessageDisplay); m_MessageDisplay.Paint(TheScreen); } SetProgramState(psAnimating); if (m_CurrentMenu != menuNone) m_MenuDisplay.Paint(TheScreen); if (m_CurrentPicker != pickNone) m_PickerDisplay.Paint(TheScreen); if (m_bDebugConsole) m_DebugConsole.Paint(TheScreen); #ifdef DEBUG_LINE_OF_FIRE if (GetPlayer()) { if (!GetPlayer()->GetShip()->IsLineOfFireClear(GetPlayer()->GetShip()->GetPos(), NULL, GetPlayer()->GetShip()->GetRotation())) g_pUniverse->DebugOutput("line of fire blocked"); } #endif #ifdef DEBUG PaintDebugLines(); #endif // Figure out how long it took to paint if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) { DWORD dwNow = ::GetTickCount(); m_iPaintTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } // Some debug information if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) PaintFrameRate(); // Update the screen if (bTopMost) g_pHI->GetScreenMgr().Blt(); // Figure out how long it took to blt if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) { DWORD dwNow = ::GetTickCount(); m_iBltTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } // Update the universe if (!m_bPaused || m_bPausedStep) { SetProgramState(psUpdating); g_pUniverse->Update(g_SecondsPerUpdate); if (m_bAutopilot) { g_pUniverse->Update(g_SecondsPerUpdate); g_pUniverse->Update(g_SecondsPerUpdate); g_pUniverse->Update(g_SecondsPerUpdate); g_pUniverse->Update(g_SecondsPerUpdate); } SetProgramState(psAnimating); if (GetPlayer()) GetPlayer()->Update(m_iTick); if (GetPlayer() && GetPlayer()->GetSelectedTarget()) m_TargetDisplay.Invalidate(); m_iTick++; m_bPausedStep = false; } m_MessageDisplay.Update(); // Figure out how long it took to update if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) { DWORD dwNow = ::GetTickCount(); m_iUpdateTime[m_iFrameCount % FRAME_RATE_COUNT] = dwNow - dwStartTimer; dwStartTimer = dwNow; } // Destroyed? if (m_State == gsDestroyed) { if (!m_bPaused || m_bPausedStep) { if (--m_iCountdown == 0) g_pHI->HICommand(CONSTLIT("gameEndDestroyed")); m_bPausedStep = false; } } break; } case gsDocked: { // Paint the screen m_pCurrentScreen->Paint(TheScreen); m_pCurrentScreen->Update(); PaintMainScreenBorder(); m_ArmorDisplay.Paint(TheScreen); m_TargetDisplay.Paint(TheScreen); // Debug console if (m_bDebugConsole) m_DebugConsole.Paint(TheScreen); // We don't paint the LRS because the player doesn't need it and // because it overwrites the credits/cargo space display //PaintLRS(); // Update the screen if (bTopMost) g_pHI->GetScreenMgr().Blt(); // Update the universe (at 1/4 rate) if ((m_iTick % 4) == 0) g_pUniverse->Update(g_SecondsPerUpdate); m_MessageDisplay.Update(); m_CurrentDock.Update(m_iTick); m_iTick++; // Invalidate areas of the screen that are overlapped by // the displays. Note that we need to convert to main screen // coordinates. if (m_pCurrentScreen) { RECT rcRect = m_ArmorDisplay.GetRect(); ::OffsetRect(&rcRect, -m_rcMainScreen.left, -m_rcMainScreen.top); m_pCurrentScreen->Invalidate(rcRect); rcRect = m_TargetDisplay.GetRect(); ::OffsetRect(&rcRect, -m_rcMainScreen.left, -m_rcMainScreen.top); m_pCurrentScreen->Invalidate(rcRect); rcRect = m_rcLRS; ::OffsetRect(&rcRect, -m_rcMainScreen.left, -m_rcMainScreen.top); m_pCurrentScreen->Invalidate(rcRect); if (m_bDebugConsole) { rcRect = m_DebugConsole.GetRect(); ::OffsetRect(&rcRect, -m_rcMainScreen.left, -m_rcMainScreen.top); m_pCurrentScreen->Invalidate(rcRect); } } break; } case gsEnteringStargate: { // Update some displays if ((m_iTick % 10) == 0) m_ReactorDisplay.Update(); // Tell the universe to paint g_pUniverse->PaintPOV(TheScreen, m_rcMainScreen, false); PaintMainScreenBorder(); PaintLRS(); m_ArmorDisplay.Paint(TheScreen); m_MessageDisplay.Paint(TheScreen); m_ReactorDisplay.Paint(TheScreen); m_TargetDisplay.Paint(TheScreen); m_DeviceDisplay.Paint(TheScreen); // Debug information if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) PaintFrameRate(); #ifdef DEBUG PaintDebugLines(); #endif // Update the screen if (bTopMost) g_pHI->GetScreenMgr().Blt(); // Update the universe g_pUniverse->Update(g_SecondsPerUpdate); m_MessageDisplay.Update(); m_iTick++; if (--m_iCountdown == 0) EnterStargate(); break; } case gsLeavingStargate: { // Update some displays if ((m_iTick % 10) == 0) m_ReactorDisplay.Update(); // Tell the universe to paint g_pUniverse->PaintPOV(TheScreen, m_rcMainScreen, false); PaintMainScreenBorder(); PaintLRS(); m_ArmorDisplay.Paint(TheScreen); m_MessageDisplay.Paint(TheScreen); m_ReactorDisplay.Paint(TheScreen); m_TargetDisplay.Paint(TheScreen); m_DeviceDisplay.Paint(TheScreen); // Debug information if (m_pTC->GetOptionBoolean(CGameSettings::debugVideo)) PaintFrameRate(); #ifdef DEBUG PaintDebugLines(); #endif // Update the screen if (bTopMost) g_pHI->GetScreenMgr().Blt(); // Update the universe g_pUniverse->Update(g_SecondsPerUpdate); m_MessageDisplay.Update(); m_iTick++; if (--m_iCountdown == 0) LeaveStargate(); break; } } // Flip if (bTopMost) g_pHI->GetScreenMgr().Flip(); SetProgramState(psUnknown); } catch (...) { bFailed = true; } // Deal with errors/crashes if (bFailed) { g_pHI->GetScreenMgr().StopDX(); ReportCrash(); } }
int main(void) { MINEGAME GAME; int i=0,ACT,x,y,WIN; long long int StartTime; char *bye="GAME OVER \n Bye~ \nSee you next time \n\\(^o^)/\\(^o^)/"; do { scanf(" %d %d %d",&GAME.Mwx,&GAME.Mly,&GAME.BOMBS); }while( MapX <= 0 || MapY <= 0 || BOMBS > MapX*MapY ); //////////BUILD MAP////////////// if (( GAME.MineMap = memset(malloc( GAME.MwX*GAME.Mly),0,GAME.MwX*GAME.Mly)) == NULL) perror(""),exit(1); if (( GAME.WorldMap = memset(malloc( GAME.MwX*GAME.Mly),'*',GAME.MwX*GAME.Mly )) == NULL) perror(""),exit(1); ///////////////////////////////////// /////////////Distrubute BOMBS/////////////////// while(BOMBS) { if ( clock() ^ clock() )/*水~~*/ { RealMap[i]=1; --BOMBS; } if (++i==MapX*MapY) i=0; } //////////////////////////////////////////////// system("cls"); PaintMap(UserSee,MapX,MapY); printf("\n"); scanf(" %d %d %d",&ACT,&x,&y); StartTime=time(NULL); while((i=getchar())!= '\n' && i!=EOF ); if ( ACT==1 ) { if ( WAhAHA(UserSee,RealMap,MapX,MapY,x,y,1) == 881 ) { puts("\n"); i=0; while( *(bye+i) ) { putchar(*(bye+i++)); Sleep(60); } while(1) for(li=0; li<2*PI; li+=PI/PREC) { printf("%*.*s\n",12+PREC+(int)(PREC*sin(li)),12,"\\(^o^)/"); } return 0; } } else if (!ACT) JustMark(UserSee,MapX,MapY,x,y); do { system("cls"); PaintMap(UserSee,MapX,MapY); printf("\n"); scanf(" %d %d %d",&ACT,&x,&y); while((i=getchar())!= '\n' && i!=EOF ); if (ACT>2||ACT<0||x>MapX||y>MapY||x<=0||y<=0) continue; if ( ACT==1 ) { if ( WAhAHA(UserSee,RealMap,MapX,MapY,x,y,1) == 881 ) { puts("\n"); i=0; while( *(bye+i) ) { putchar(*(bye+i++)); Sleep(60); } while(1) for(li=0; li<2*PI; li+=PI/PREC) { printf("%*.*s\n",12+PREC+(int)(PREC*sin(li)),12,"\\(^o^)/"); } break; } } else if (!ACT) JustMark(UserSee,MapX,MapY,x,y); } while( !(WIN=CheckWin(UserSee,RealMap,MapX*MapY-1) ) ); if( WIN == 1 ) printf("你總共花了 %d 秒",time(NULL)-StartTime); return 0; }