MainMenu::MainMenu(Graphics &g) : _waitTime(680) { _font = Font(g, "media/fonts/journal.ttf", 48); _arrow = Splash(g, "media/menuarrow.png", 255); _scroll = Splash(g, "media/scroll2.png", 255); _splash = Splash(g, "media/Splash.png", 255); _mountain1 = Splash(g, "media/mountain1.png", 255); _mountain1.scrolling = true; _mountain2 = Splash(g, "media/mountain2.png", 255); _mountain2.scrolling = true; _mountain3 = Splash(g, "media/mountain3.png", 255); _mountain3.scrolling = true; _sky = Splash(g, "media/sky.png", 255); _fog = Splash(g, "media/fog.png", 215); _fog.scrolling = true; _mountain1.setVelocity(-0.85f, 0); _mountain2.setVelocity(-0.43f, 0); _mountain3.setVelocity(-0.11f, 0); _fog.setVelocity(-0.41f, 0); _logo = Splash(g, "media/Splashu.png", 255); _subMenus.push_back(new PrimaryMenu(g, 0, 0, &_font, _fontColor)); _subMenus.push_back(new Options(g, 0, 0, &_font, _fontColor)); _textSplash = MenuButton(g, _font, "THE ENDLESS EMPIRES", _fontColor, g.w / 2, 30); _music = Mix_LoadWAV("media/music/mystery.wav"); Mix_PlayChannel(1, _music, -1); if (_music == NULL) g.showMsgBox("Failed to load music!"); }
/// main entry point BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){ switch ( ul_reason_for_call ){ case DLL_PROCESS_ATTACH: { Splash Splash(NULL); if (Splash.Show(NULL, 300) == TRUE) { Sleep(1000); } if (Hook(hModule) != 1) { MessageBox( 0, L"Failed to initialize Insanity successfully.\n\nPlease restart the Patcher and try again.\nIf this happen more than once, please inform the Admins.\nThank you.", L"Insanity - Client Protection", MB_OK | MB_ICONHAND ); exit(1); return FALSE; } } break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: UnHook(); break; } log(L"DllMain: returning true!\n"); return TRUE; }
void CLcd::Init() { _nextdrawtime = Splash() + millis(); _splash = true; DrawRequest(CLcd::DrawForceAll); //first draw doesnt return fast! call at init time }
void Start() { OpenFileSystem(); OpenGraphics(); OpenMotors(); OpenIR(); //Register images OpenImageRegister(); logoImage = RegisterImage(_binary_Images_bigtrakr_bmp_start,_binary_Images_bigtrakr_bmp_end - _binary_Images_bigtrakr_bmp_start); signatureImage = RegisterImage(_binary_Images_rorschach_bmp_start,_binary_Images_rorschach_bmp_end - _binary_Images_rorschach_bmp_start); upImage = RegisterImage(_binary_Images_up_bmp_start,_binary_Images_up_bmp_end - _binary_Images_up_bmp_start); downImage = RegisterImage(_binary_Images_down_bmp_start,_binary_Images_down_bmp_end - _binary_Images_down_bmp_start); markerImage = RegisterImage(_binary_Images_marker_bmp_start,_binary_Images_marker_bmp_end - _binary_Images_marker_bmp_start); CloseImageRegister(); steps=0; menuItem=1; menuNum = 1; mode=1; //menu IRState=false; rotateSleep = ROTATESLEEP; LoadCalibration(); white=RGBColor(255,255,255,0); green=RGBColor(0,255,0,0); red=RGBColor(255,0,0,0); blue=RGBColor(0,0,255,0); black=RGBColor(0,0,0,0); grey=RGBColor(128,128,128,0); //Splash Splash(); Sleep( 2000 ); ClearScreen(); Show(); }
//Setup void Start() { OpenFileSystem(); OpenGraphics(); SetLineWidth(1); //needed otherwise we draw huge thick points! //Register bitmaps OpenImageRegister(); logoImage = RegisterImage(_binary_Images_battle_bmp_start,_binary_Images_battle_bmp_end - _binary_Images_battle_bmp_start); signatureImage = RegisterImage(_binary_Images_rorschach_bmp_start,_binary_Images_rorschach_bmp_end - _binary_Images_rorschach_bmp_start); tankImage = RegisterImage(_binary_Images_tank_bmp_start,_binary_Images_tank_bmp_end - _binary_Images_tank_bmp_start); CloseImageRegister(); sweepStepCount=0; ResetTimer(); arrowRefAngle=0; sweepAngle = 2 * PI / SWEEPSTEPS; arrowX=20; arrowY=20; radarX=140; radarY=20; sweepArm.x=140; sweepArm.y=20; oldKeystate=0; refreshCount=0; //Load calibration data, if any exists rotateSleep = ROTATESLEEP; LoadCalibration(); Splash(); }
void LoseLife(char *reason) { //Draw cracked screen - but draw all the rest of the world & hud first CloseGraphics(); OpenGraphics(); DrawWorld(&world, cameraPos, cameraAngle); DrawHUD(); DrawArrow(cameraAngle.y); DrawRadarDots(true); DrawRadarArm(sweepAngle * sweepStepCount++); DrawRadarDots(false); //finally! DrawCrackedScreen(); SetTextColor(RED); DrawText(25,40,reason); if (--lives<=0) { SetTextColor(GREEN); DrawText(30,55,"GAME OVER!"); } Show(); PlaySound(SOUND_EXPLOSION); //dead? if (lives<=0) { Sleep(2000); //Reset back to splash screen ResetTimer(); mode=0; Splash(); } else { // Hit but still going InitialiseWorld(); } }
/******************************************************************************* Main function - This function starts the program showing the splash and check for nessesory setting and copies to local / global variables.. *******************************************************************************/ int main() { i = Rand(); // salt[0].display(); //getchar(); /** start from here**/ /* ras: cout << Rand(); getch(); goto ras;*/ clrscr(); Splash(); header(); //AddReagent(); // this is to check addreagents inventory char ch,opt[10]; int j = 1,num; ch = getch(); cout << ch; getchar(); return 0; }
//---------------------------------------------------------// //---------------------------------------------------------// void Initial(void) { N11_Init(); N11_Contrast(10); N11_Backlight(ON); N11_CLS(); //---------------------- N11_FontSelect(ef5x7); Splash(); } //Initial
int main(int argc, char **argv) { CUpdateService svc; struct sigaction handler; int fd; Splash(); if (!ParseParameters(argc, argv)) { return 0; } if ((argc - optind) < 2) { Usage(argv[0]); return 0; } // Set Interrrupt Signal Handler memset(&handler, 0, sizeof(struct sigaction)); handler.sa_handler = SignalCatcher; sigfillset(&handler.sa_mask); sigaction(SIGINT, &handler, 0); sigaction(SIGTERM, &handler, 0); fd = open("lock.monet", O_CREAT, 0644); if (flock(fd, LOCK_EX | LOCK_NB) != 0) { printf("이미 다른 사람이 사용 중 입니다.\r\n"); printf("\r\n"); exit(0); } svc.Updator(argv[optind+0], argv[optind+1]); flock(fd, LOCK_UN); close(fd); return 0; }
bool MyApp::OnInit() { // create the main application window // MyFrame1 *frame = new MyFrame1(NULL, 0, _T("AccessTest wxWidgets App"), // wxPoint(50, 50), wxSize(450, 340), 0); // frame->Show(true); //fixme not show the splash. Splash(); TestDialog * mainWindow = new TestDialog(NULL); mainWindow->ShowModal(); //mainWindow->Destory(); // success: wxApp::OnRun() will be called which will enter the main message // loop and the application will run. If we returned false here, the // application would exit immediately. //wxMessageBox( _T("This sample has to be compiled with wxUSE_ACCESSIBILITY"), _T("Building error"), wxOK); return true; }
int main(int argc, char** argv) { try { int ExitCode = 0; INIT_OPENFLUID_APPLICATION_WITH_GUI(argc,argv); do { openfluid::ui::common::OpenFLUIDSplashScreen Splash( openfluid::ui::common::getImage("openfluid_splash_builder","builder") ); Splash.show(); Splash.setMessage("i18n"); // translations management QString Lang = openfluid::base::PreferencesManager::instance()->getLang(); QTranslator QtTranslator; QTranslator OpenFLUIDTranslator; if (Lang != "default") { // load provided default translations QtTranslator.load("qt_"+Lang.left(2)+".qm", QLibraryInfo::location(QLibraryInfo::TranslationsPath)); // load provided OpenFLUID translations OpenFLUIDTranslator.load(QString(openfluid::config::TRANSLATIONS_FILEROOT.c_str()) + "-" + Lang + ".qm", QString(openfluid::base::Environment::getTranslationsDir().c_str())); } OPENFLUID_APPLICATION.installTranslator(&QtTranslator); OPENFLUID_APPLICATION.installTranslator(&OpenFLUIDTranslator); OPENFLUID_APPLICATION.setStyleSheet(QString("QToolTip { color: #FFFFFF; background-color: %1; " "border: 1px solid %2; }") .arg(openfluid::ui::config::TOOLTIP_BGCOLOR, openfluid::ui::config::TOOLTIP_BORDERCOLOR)); // Application launching BuilderApp App(&Splash); App.initialize(); App.run(); Splash.finish(App.mainWindow()); ExitCode = CLOSE_OPENFLUID_APPLICATION_WITH_GUI; OPENFLUID_APPLICATION.flush(); } while (ExitCode == openfluid::ui::config::EXIT_CODE_FOR_RESTART); return ExitCode; } catch (std::bad_alloc & E) { std::cerr << "bad_alloc ERROR: " << E.what() << ". Possibly not enough memory available" << std::endl; } catch (std::bad_exception & E) { std::cerr << "bad_exception ERROR: " << E.what() << std::endl; } catch (std::bad_cast & E) { std::cerr << "bad_cast ERROR: " << E.what() << std::endl; } catch (std::exception & E) { std::cerr << "std ERROR: " << E.what() << std::endl; } catch (...) { std::cerr << "ERROR: " << "Unknown Error" << std::endl; } }
Md::Result sysInit(){ QObject::connect(¶maData,SIGNAL(changed()),&hmiData,SLOT(onParamChanged())); QObject::connect(&patternData,SIGNAL(patternChanged(QString,QString)), &hmiData,SLOT(on_patternChange(QString,QString))); int commResult; QMdSplashScreen Splash(QPixmap("resource/image/matlab.png")); QMdSplashScreen *splash = &Splash; splash->show(); hmiData.loadParam("./sysconfig.conf"); INFORMLOG(QObject::tr("开机,系统初始化开始")); sysLog.setFile(hmiData.sysLogFilePath); QPattern::Result r; r = patternData.setFile(hmiData.patternPath); if(QPattern::Ok!=r){ if(r==QPattern::NoCntFile){ splash->showMessage(QObject::tr("载入花型:------------缺少CNT文件"),Qt::AlignBottom); }else if(r==QPattern::NoPatFile){ splash->showMessage(QObject::tr("载入花型:------------缺少PAT文件"),Qt::AlignBottom); }else{ splash->showMessage(QObject::tr("载入花型:------------花型文件错误"),Qt::AlignBottom); } sleep(3); return Md::NotPatCntSaz; } if(!paramaData.setFile(hmiData.spaFilePath)) splash->showMessage(QObject::tr("参数载入:------------参数载入错误"),Qt::AlignBottom); ////start communication////////////// qComm.start(); /////poll valible rom//////////////// if(!hmiData.mainboardRomAvailable()){ splash->showMessage(QObject::tr("检查主板固件:----------主控板无固件"),Qt::AlignBottom); sleep(3); return Md::MainBoardNoRom; } /////test comm if(!qComm.isAvailable()){ splash->showMessage(QObject::tr("测试通信:------------通信异常"),Qt::AlignBottom); sleep(3); return Md::CommError; } //////togle system///////////////// commResult = qComm.TogSysStat(QHMIData::SysInParam); if(commResult == Md::CommError){ splash->showMessage(QObject::tr("通讯错误,花型未成功下载"),Qt::AlignBottom); sleep(3); return Md::CommError; } if(patternData.isPatternAvailable()){ ////download wrk spa splash->showMessage(QObject::tr("正在下载参数"),Qt::AlignBottom); commResult = paramaData.sendParama(); if(commResult == Md::CommError){ splash->showMessage(QObject::tr("通讯错误,参数未成功下载"),Qt::AlignBottom); return Md::CommError; } ///download szkb/////////////////////////////////// commResult = patternData.sendShazuiKb(); if(commResult == Md::CommError){ splash->showMessage(QObject::tr("下载SAZ文件,通讯错误"),Qt::AlignBottom); sleep(3); return Md::CommError; } ///////下载cnt文件/////////////////////////////////// QObject::connect(&patternData,SIGNAL(patternSendPercent(int)),splash,SLOT(showPatternSendMessage(int)),Qt::QueuedConnection); commResult = patternData.sendPattern(); if(commResult == Md::CommError){ splash->showMessage(QObject::tr("下载CNT文件,通讯错误"),Qt::AlignBottom); sleep(3); return Md::CommError; } QObject::disconnect(&patternData,SIGNAL(patternSendPercent(int)),splash,SLOT(showPatternSendMessage(int))); //等待下位机响应///////////////////////////////// int i=0; for(i=0;i<3;i++) { commResult = qComm.TogSysStat(QHMIData::SysInParam); if(commResult==Md::Ok) break; } if(3==i){ splash->showMessage(QObject::tr("下载花型后主机未成功响应"),Qt::AlignBottom); sleep(3); return Md::CommError; } }
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { Splash Splash( NULL ); Splash.Show( NULL, 1000 ); Sleep ( 1000 ); }
void DrawMenu() { ClearScreen(); switch(mode) { case 1: { //Step Programming menu //Status SetTextColor(green); DrawText(6, 5, "BigTrakr! Steps: %d", steps); //Menu options SetTextColor(white); DrawText(15, 22, "Forward"); DrawText(15, 37, "Back"); DrawText(15, 52, "Right"); DrawText(15, 67, "Left"); DrawText(15, 82, "Fire"); //Menu pointer DrawImage(markerImage,5,10+15*menuItem,white); //Number (lengths, degrees, lasers) SetTextColor(white); if(menuItem<3 || menuItem==5) { DrawText(90, 7 + 15*menuItem,"%d",menuNum); } else if (menuItem < 5) { DrawText(90, 7 + 15*menuItem,"%d",menuNum * 15); } //Number arrows prompting right stick adjustments SetTextColor(red); //DrawText(90, 13 + 15*(menuItem-1),"^"); //DrawText(90, 2 + 15*(menuItem+1),"v"); DrawImage(upImage, 92, 17+15*(menuItem-1), white); DrawImage(downImage, 92, 8 + 15*(menuItem+1), white); //Button identifiers SetTextColor(blue); DrawText(6, 100, "Clear"); DrawText(100,100, "Select"); } break; case 2: { //Additional menu //Status SetTextColor(green); DrawText(5, 5, "BigTrakr! Steps: %d", steps); //Menu options SetTextColor(white); DrawText(15, 22, "Free Roam"); DrawText(15, 37, "Load Route"); DrawText(15, 52, "Save Route"); DrawText(15, 67, "Recalibrate"); DrawText(15, 82, "About"); //Menu pointer DrawImage(markerImage,5,10+15*menuItem,white); //Button identifiers SetTextColor(blue); DrawText(6, 100, "Back"); DrawText(100,100, "Select"); } break; case 3: { //Recalibration mode switch(menuNum) { case 1: { //Ready SetTextColor(white); DrawText(6, 7, "To recalibrate"); DrawText(6, 22, "rotation, press"); DrawText(6, 37, "Button B to start"); DrawText(6, 52, "then press again"); DrawText(6, 67, "to stop when the"); DrawText(6, 82, "Trakr spins fully"); SetTextColor(blue); DrawText(6, 100, "Cancel"); DrawText(100,100, "Start"); } break; case 2: { SetTextColor(white); DrawText(6, 22, "Started..."); DrawText(6, 37, "Let the Trakr"); DrawText(6, 52, "spin 360 degrees"); DrawText(6, 67, "then press again"); SetTextColor(blue); DrawText(6, 100, "Cancel"); DrawText(100,100, "Stop"); } break; } } break; case 4: { //Free roam SetTextColor(white); DrawText(5, 5, "Free Roam"); SetTextColor(blue); if (IRState) DrawText(6, 100, "Light off"); else DrawText(6, 100, "Light on"); DrawText(100,100, "Close"); } break; case 5: { //About Splash(); SetTextColor(blue); if (IRState) DrawText(6, 100, "Light off"); else DrawText(6, 100, "Light on"); DrawText(100,100, "Close"); } } Show(); }
//Main program loop - Run gets called until it returns false bool Run() { //Main loop - get keypresses and interpret them keystate=GetRemoteKeys(); if(keystate & KEY_HOME) { return false; } switch(mode) { case 0: { //Splash screen if (keystate & KEY_INPUT2) { //Button B //Start game InitialiseGame(); PlaySound(SOUND_BEEP); } if (keystate & KEY_INPUT1) { //Button A //show help ShowHelp(); PlaySound(SOUND_BEEP); } } break; case 2: { //Help - wait for 'OK' press if (keystate & KEY_INPUT2) { //Button B //Reset back to splash screen ResetTimer(); mode=0; Splash(); PlaySound(SOUND_BEEP); } } break; case 1: { //Game if (keystate & KEY_INPUT1) { //Button A //Reset back to splash screen ResetTimer(); mode=0; Splash(); } if (keystate & KEY_RUN) { //Go button //Fire! PlaySound(SOUND_SHOOT); refreshCount = 0; int hit; hit = LineHitsObject(cameraPos, cameraAngle); if (hit == tankObjectIndex) { //we hit the tank! score += 100; CloseGraphics(); OpenGraphics(); DrawWorld(&world, cameraPos, cameraAngle); DrawHUD(); DrawExplosion(); DrawArrow(cameraAngle.y); DrawRadarDots(true); DrawRadarArm(sweepAngle * sweepStepCount++); DrawRadarDots(false); SetTextColor(CYAN); DrawText(6,100,"Quit"); Show(); PlaySound(SOUND_EXPLOSION); PlaceTank(cameraPos, cameraAngle); } } //Have the movement sticks changed? This bit doesn't care about buttons if((keystate & (KEY_RIGHT_BACK+KEY_RIGHT_FORWARD+KEY_LEFT_BACK+KEY_LEFT_FORWARD)) != (oldKeystate & (KEY_RIGHT_BACK+KEY_RIGHT_FORWARD+KEY_LEFT_BACK+KEY_LEFT_FORWARD))) { MoveCamera(&cameraPos, &cameraAngle, baselinePos, arrowRefAngle, ReadTimer(), oldKeystate); arrowRefAngle=cameraAngle.y; baselinePos=cameraPos; ResetTimer(); oldKeystate = keystate; if (keystate==0) //we've just stopped moving refreshCount=0; } if (mode==1) { if (sweepStepCount == SWEEPSTEPS) sweepStepCount=0; if (--behaviourCount<0) ChooseBehaviour(); MoveTank(); MoveCamera(&cameraPos, &cameraAngle, baselinePos, arrowRefAngle, ReadTimer(), oldKeystate); //is it time to reset the tank model? Otherwise it gradually gets distorted if (--resetCount<0) { //Refresh the tank model which is prone to getting distorted //due to cumulative inaccuracies of sin/cos approximations Point3d angle=world.objects[tankObjectIndex].heading; Point3d tankPos=world.objects[tankObjectIndex].centre; world.objects[tankObjectIndex]=tank; MoveObject(&(world.objects[tankObjectIndex]), tankPos); RotateObjectYAxis(&(world.objects[tankObjectIndex]), angle.y); resetCount=50; } //Is it time to redraw the world? if (--refreshCount<0) { //Seems a bit brutal to have to close graphics but it's //the only way to clear the screen that'll let us draw //on it properly again - ClearScreen or ClearRectangle mess up CloseGraphics(); OpenGraphics(); DrawWorld(&world, cameraPos, cameraAngle); DrawHUD(); refreshCount=2; } DrawArrow(cameraAngle.y); DrawRadarDots(true); DrawRadarArm(sweepAngle * sweepStepCount++); DrawRadarDots(false); SetTextColor(CYAN); DrawText(6,100,"Quit"); Show(); //just in case we changed mode... if (mode==0) Splash(); } } } Sleep(50); return true; }
void cSplashPotionEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) { a_EntityHit.TakeDamage(dtRangedAttack, this, 0, 1); Splash(a_HitPos); m_DestroyTimer = 5; }
int main(int argc, char** argv) { try { INIT_OPENFLUID_APPLICATION_WITH_GUI(argc, argv); openfluid::ui::common::OpenFLUIDSplashScreen Splash(QPixmap(":/images/openfluid_splash_devstudio.png")); Splash.show(); Splash.setMessage("i18n"); // translations management QString Lang = openfluid::base::PreferencesManager::instance()->getLang(); QTranslator QtTranslator; QTranslator OpenFLUIDTranslator; if (Lang != "default") { // load provided default translations QtTranslator.load("qt_" + Lang.left(2) + ".qm", QLibraryInfo::location(QLibraryInfo::TranslationsPath)); // load provided OpenFLUID translations OpenFLUIDTranslator.load(QString(openfluid::config::TRANSLATIONS_FILEROOT.c_str()) + "-" + Lang + ".qm", QString(openfluid::base::Environment::getTranslationsDir().c_str())); } OPENFLUID_APPLICATION.installTranslator(&QtTranslator); OPENFLUID_APPLICATION.installTranslator(&OpenFLUIDTranslator); // OPENFLUID_APPLICATION.setStyleSheet(QString("QToolTip { color: #FFFFFF; background-color: %1; " // "border: 1px solid %2; }") // .arg(BUILDER_TOOLTIP_BGCOLOR,BUILDER_TOOLTIP_BORDERCOLOR)); // TODO remove the #if linux when icons problem on win32 will be solved #if linux Q_INIT_RESOURCE(openfluiduicommon); #endif // OPENFLUID_APPLICATION.setAttribute(Qt::AA_DontShowIconsInMenus); MainWindow m_MainWindow(&Splash); m_MainWindow.show(); Splash.finish(&m_MainWindow); return CLOSE_OPENFLUID_APPLICATION_WITH_GUI; } catch (std::bad_alloc & E) { std::cerr << "bad_alloc ERROR: " << E.what() << ". Possibly not enough memory available" << std::endl; } catch (std::bad_exception & E) { std::cerr << "bad_exception ERROR: " << E.what() << std::endl; } catch (std::bad_cast & E) { std::cerr << "bad_cast ERROR: " << E.what() << std::endl; } catch (std::exception & E) { std::cerr << "std ERROR: " << E.what() << std::endl; } catch (...) { std::cerr << "ERROR: " << "Unknown Error" << std::endl; } }
void cSplashPotionEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace) { Splash(a_HitPos); m_DestroyTimer = 2; }
void C4Object::DoMovement() { int32_t iContact=0; bool fAnyContact=false; int iContacts = 0; BYTE fTurned=0,fRedirectYR=0,fNoAttach=0; // Restrictions if (Def->NoHorizontalMove) xdir=0; // Dig free target area C4PropList* pActionDef = GetAction(); if (pActionDef) if (pActionDef->GetPropertyInt(P_DigFree)) { int ctcox, ctcoy; // Shape size square if (pActionDef->GetPropertyInt(P_DigFree)==1) { ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir); ::Landscape.DigFreeRect(ctcox+Shape.GetX(),ctcoy+Shape.GetY(),Shape.Wdt,Shape.Hgt,this); } // Free size round (variable size) else { ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir); int32_t rad = pActionDef->GetPropertyInt(P_DigFree); if (Con<FullCon) rad = rad*6*Con/5/FullCon; ::Landscape.DigFree(ctcox,ctcoy-1,rad,this); } } // store previous movement and ocf C4Real oldxdir(xdir), oldydir(ydir); uint32_t old_ocf = OCF; bool fMoved = false; C4Real new_x = fix_x + xdir; C4Real new_y = fix_y + ydir; SideBounds(new_x); if (!Action.t_attach) // Unattached movement = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = { // Horizontal movement - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Move to target while (fixtoi(new_x) != fixtoi(fix_x)) { // Next step int step = Sign(new_x - fix_x); uint32_t border_hack_contacts = 0; iContact=ContactCheck(GetX() + step, GetY(), &border_hack_contacts); if (iContact || border_hack_contacts) { fAnyContact=true; iContacts |= t_contact | border_hack_contacts; } if (iContact) { // Abort horizontal movement new_x = fix_x; // Vertical redirection (always) RedirectForce(xdir,ydir,-1); ApplyFriction(ydir,ContactVtxFriction(this)); } else // Free horizontal movement { DoMotion(step, 0); fMoved = true; } } // Vertical movement - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Movement target new_y = fix_y + ydir; // Movement bounds (vertical) VerticalBounds(new_y); // Move to target while (fixtoi(new_y) != fixtoi(fix_y)) { // Next step int step = Sign(new_y - fix_y); if ((iContact=ContactCheck(GetX(), GetY() + step, nullptr, ydir > 0))) { fAnyContact=true; iContacts |= t_contact; new_y = fix_y; // Vertical contact horizontal friction ApplyFriction(xdir,ContactVtxFriction(this)); // Redirection slide or rotate if (!ContactVtxCNAT(this,CNAT_Left)) RedirectForce(ydir,xdir,-1); else if (!ContactVtxCNAT(this,CNAT_Right)) RedirectForce(ydir,xdir,+1); else { // living things are always capable of keeping their rotation if (OCF & OCF_Rotate) if (iContact==1) if (!Alive) { RedirectForce(ydir,rdir,-ContactVtxWeight(this)); fRedirectYR=1; } ydir=0; } } else // Free vertical movement { DoMotion(0,step); fMoved = true; } } } if (Action.t_attach) // Attached movement = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = { VerticalBounds(new_y); // Move to target do { // Set next step target int step_x = 0, step_y = 0; if (fixtoi(new_x) != GetX()) step_x = Sign(fixtoi(new_x) - GetX()); else if (fixtoi(new_y) != GetY()) step_y = Sign(fixtoi(new_y) - GetY()); int32_t ctx = GetX() + step_x; int32_t cty = GetY() + step_y; // Attachment check if (!Shape.Attach(ctx,cty,Action.t_attach)) fNoAttach=1; else { // Attachment change to ctx/cty overrides target if (ctx != GetX() + step_x) { xdir = Fix0; new_x = itofix(ctx); } if (cty != GetY() + step_y) { ydir = Fix0; new_y = itofix(cty); } } // Contact check & evaluation uint32_t border_hack_contacts = 0; iContact=ContactCheck(ctx,cty,&border_hack_contacts); if (iContact || border_hack_contacts) { fAnyContact=true; iContacts |= border_hack_contacts | t_contact; } if (iContact) { // Abort movement if (ctx != GetX()) { ctx = GetX(); new_x = fix_x; } if (cty != GetY()) { cty = GetY(); new_y = fix_y; } } DoMotion(ctx - GetX(), cty - GetY()); fMoved = true; } while (fixtoi(new_x) != GetX() || fixtoi(new_y) != GetY()); } if(fix_x != new_x || fix_y != new_y) { fMoved = true; if (pSolidMaskData) pSolidMaskData->Remove(true); fix_x = new_x; fix_y = new_y; } // Rotation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (OCF & OCF_Rotate && !!rdir) { C4Real target_r = fix_r + rdir * 5; // Rotation limit if (Def->Rotateable>1) { if (target_r > itofix(Def->Rotateable)) { target_r = itofix(Def->Rotateable); rdir=0; } if (target_r < itofix(-Def->Rotateable)) { target_r = itofix(-Def->Rotateable); rdir=0; } } int32_t ctx=GetX(); int32_t cty=GetY(); // Move to target while (fixtoi(fix_r) != fixtoi(target_r)) { // Save step undos C4Real lcobjr = fix_r; C4Shape lshape=Shape; // Try next step fix_r += Sign(target_r - fix_r); UpdateShape(); // attached rotation: rotate around attachment pos if (Action.t_attach && !fNoAttach) { // more accurately, attachment should be evaluated by a rotation around the attachment vertex // however, as long as this code is only used for some surfaces adjustment for large vehicles, // it's enough to assume rotation around the center ctx=GetX(); cty=GetY(); // evaluate attachment, but do not bother about attachment loss // that will then be done in next execution cycle Shape.Attach(ctx,cty,Action.t_attach); } // check for contact if ((iContact=ContactCheck(ctx,cty))) // Contact { fAnyContact=true; iContacts |= t_contact; // Undo step and abort movement Shape=lshape; target_r = fix_r = lcobjr; // last UpdateShape-call might have changed sector lists! UpdatePos(); // Redirect to GetY() if (iContact==1) if (!fRedirectYR) RedirectForce(rdir,ydir,-1); // Stop rotation rdir=0; } else { fTurned=1; if (ctx != GetX() || cty != GetY()) { fix_x = itofix(ctx); fix_y = itofix(cty); } } } // Circle bounds if (target_r < -FixHalfCircle) { target_r += FixFullCircle; } if (target_r > +FixHalfCircle) { target_r -= FixFullCircle; } fix_r = target_r; } // Reput solid mask if moved by motion if (fMoved || fTurned) UpdateSolidMask(true); // Misc checks =========================================================================================== // InLiquid check // this equals C4Object::UpdateLiquid, but the "fNoAttach=false;"-line if (IsInLiquidCheck()) // In Liquid { if (!InLiquid) // Enter liquid { if (OCF & OCF_HitSpeed2) if (Mass>3) Splash(GetX(),GetY()+1,std::min(Shape.Wdt*Shape.Hgt/10,20),this); fNoAttach=false; InLiquid=1; } } else // Out of liquid { if (InLiquid) // Leave liquid InLiquid=0; } // Contact Action if (fAnyContact) { t_contact = iContacts; ContactAction(); } // Attachment Loss Action if (fNoAttach) NoAttachAction(); // Movement Script Execution if (fAnyContact) { C4AulParSet pars(C4VInt(fixtoi(oldxdir, 100)), C4VInt(fixtoi(oldydir, 100))); if (old_ocf & OCF_HitSpeed1) Call(PSF_Hit, &pars); if (old_ocf & OCF_HitSpeed2) Call(PSF_Hit2, &pars); if (old_ocf & OCF_HitSpeed3) Call(PSF_Hit3, &pars); } // Rotation gfx if (fTurned) UpdateFace(true); else // pos changed? if (fMoved) UpdatePos(); }
//**************************************************************************** // MAINMENU_FUN START HERE //**************************************************************************** void MAINMENU(int s) { int index = s; //'s' is USED for identifying parameter for MENU_INDEX char ch; //'ch' id USED for TEMP_VAR while reading command Window(1,2,80,22,1); //CREAT BLUE SCREEN Splash(); //SPLASH SCREEN Window(1,1,80,1,LIGHTGRAY);//CREAT LIGHT GRAY SCREEN textcolor(BLACK); //MAKE TEXT_COLOR BLACK menu(list_Cap,list,size,index-1); //CALL FUN_MENU With (Index-1) do{ _setcursortype(_NOCURSOR); ch = getch(); //READ A CHARACTER FROM KEYBOARD if(ch == char(0)) ch = getch(); switch(ch) //MENU SELECTING ROUTING { case char(16) : _setcursortype(_NORMALCURSOR);//ctrl_p PROJECT MENU HOT_KEY active_status_bar(5,1); //PROJECT A_S //menu(5); //SELECT PROJECT MENU menu(list_Cap,list,size,PROJECT); Project_Pull_Menu(); //MAKE PROJECT PULLDOWN MENU MAINMENU(6); //CALL MAIN MENU FUN: break; //MAKE A BREAK FOR switch_STATEMENT case char(6) : _setcursortype(_NORMALCURSOR);//ctrl_f FILE MENU HOT_KEY active_status_bar(1,1); //FILE A_S menu(list_Cap,list,size,FILE_); //menu(1); //SELETE FILE MENU File_Pull_Menu(); //MAKE FILE PULLDOWN MENU MAINMENU(6); //CALL MAIN MENU FUN: break; //MAKE A BREAK FOR switch_STATEMENT case char(8) : _setcursortype(_NORMALCURSOR);//ctrl_h HACKER MENU HOT_KEY active_status_bar(2,1); //HACKER A_S menu(list_Cap,list,size,PROGRAMMER); //menu(2); //SELECT HACKER MENU PROGRAMMER_Pull_Menu(); //MAKE HACKER PULLDOWN MENU MAINMENU(2); //CALL MAIN MENU FUN: break; //MAKE A BREAK FOR switch_STATEMENT case char(19) : Popup_Menu(); break; //ctrl-s CALL SECRET ROUTING! case char(27) : Msgbox(); //to exit (Esc) CREATE MESSAGE BOX TO COMFIRM QUITING //==================================== //IF L_ARROW :IF CURRENT SELETION IS <EXIT>FIRST THEN SELECT <HELP>SIZE // IF NOT THEN SELECT CURRENT (SELETION-1) POSITION case char(75) : index = (index == 1) ? size : index-1;break;//<-- L_ARROW //IF R_ARROW :IF CURRENT SELETION IS <HELP>LAST THEN SELECT <EXIT>FIRST // IF NOT THEN SELECT CURRENT (SELETION+1) POSITION case char(77) : index = (index == size) ? 1 : index+1;break;//--> R_ARROW //IF ENTER :DO FUN: ACCORDING TO THE CURRENT SELECTED <INDEX>FUN: case char(13) : switch(index){ //<--|ENTER //IF EXIT case 1 : _setcursortype(_NORMALCURSOR);//INDEX<1>CHOOSE TO EXIT Msgbox(); //COMFIRM EXIT exit(0); //EXIT THE PROGRAM break; //IF FILE case 2 : _setcursortype(_NORMALCURSOR); active_status_bar(index-2,2); //FILE A_S File_Pull_Menu(); //FILE PULL DOWN MENU CREATED menu(list_Cap,list,size,FILE_); //menu(1); //FILE HIGHLIGHT break; //IF HACKER case 8 : _setcursortype(_NORMALCURSOR); active_status_bar(index-3,3); // PROGRAMMER_Pull_Menu(); //PROGRAMMER PULL DOWN menu(list_Cap,list,size,PROGRAMMER); //menu(2); break; //IF SYSTEM case 4 : _setcursortype(_NORMALCURSOR); Dosshell(); MAINMENU(4); break; //IF PROJECT case 5 : MAINMENU(5); break; //IF SUPERVISOR case 6 : _setcursortype(_NORMALCURSOR); //PROJECT MENU ***LEFT *** active_status_bar(index-6,6); // Project_Pull_Menu(); MAINMENU(6); break; //IF HELP case 7: _setcursortype(_NORMALCURSOR); //Help MENU ***LEFT *** HELP(); MAINMENU(7); break; } //IF SECRECT CODE PRESS(CTRL+S) case char(80) : switch(index){ case 1 : _setcursortype(_NORMALCURSOR); Msgbox(); exit(0); break; case 2 : _setcursortype(_NORMALCURSOR); active_status_bar(index-2,2); //FILE File_Pull_Menu(); //FILE PULL DOWN menu(list_Cap,list,size,FILE_); //menu(1); //FILE HIGHLIGHT break; case 3 : _setcursortype(_NORMALCURSOR); active_status_bar(index-3,3); // PROGRAMMER_Pull_Menu(); //PROGRAMMER PULL DOWN menu(list_Cap,list,size,PROGRAMMER); //menu(2); break; case 4 : _setcursortype(_NORMALCURSOR); Dosshell(); active_status_bar(1,1); // MAINMENU(3); break; case 5 : MAINMENU(5); break; case 6 : _setcursortype(_NORMALCURSOR); //PROJECT MENU ***LEFT *** active_status_bar(index-6,6); // Project_Pull_Menu(); MAINMENU(6); break; case 7: _setcursortype(_NORMALCURSOR); //Help MENU ***LEFT *** HELP(); MAINMENU(7); break; } //inner switch end } // outter switch end active_status_bar(index-1,1); // menu(list_Cap,list,size,index-1); } while ( ch != 13 || ch != 27 || ch != 6 || ch != 3 || ch != 27 ); }