// reset things to prepare for entry to the next stage bool Game::initlevel() { Carets::DestroyAll(); // delete smoke clouds, ZZzz's etc... ScreenEffects::Stop(); // prevents white flash after island scene when ballos defeated game.frozen = false; game.bossbar.object = NULL; nOnscreenObjects = 0; if (statusbar_init()) return 1; // reset his displayed health value InitPlayer(); initmap(); game.stageboss.SetType(stages[game.curmap].bossNo); game.stageboss.OnMapEntry(); map_scroll_jump(player->CenterX(), player->CenterY()); if (game.switchstage.eventonentry) { // this prevents a glitch otherwise caused by entry script to Last Cave. // i.e. the script immediately <PRI's then fades in while the game is still // frozen, thus the player code never has a chance to set the initial frame. PHandleAttributes(); PSelectFrame(); stat("-- Starting on-entry script %d", game.switchstage.eventonentry); StartScript(game.switchstage.eventonentry); game.switchstage.eventonentry = 0; } return 0; }
int main ( int argc, char *argv[] ) { initmap(); GtkWidget* win; GtkWidget* da; gtk_init(&argc, &argv); win = gtk_window_new(GTK_WINDOW_TOPLEVEL); da = gtk_drawing_area_new(); gtk_container_add(GTK_CONTAINER(win), da); gtk_widget_set_events (da, gtk_widget_get_events (da) | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); g_signal_connect(win, "delete-event", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(da, "button-press-event", G_CALLBACK(scribble_button_press_event), NULL); g_signal_connect (da,"configure-event", G_CALLBACK (scribble_configure_event), NULL); g_signal_connect(da, "expose-event", G_CALLBACK(scribble_expose), NULL); gtk_window_resize(GTK_WINDOW(win), 800, 600); gtk_widget_show_all(win); gtk_main(); return 0; //return EXIT_SUCCESS; } /* ---------- end of function main ---------- */
void initstk(int argc, char *argv[]) { uint32_t size; uint32_t sp, ap, tos; int i; char *p; initmap(); tos = STACKTOP - sizeof(Tos)*2; /* we'll assume twice the host's is big enough */ sp = tos; for (i = 0; i < sizeof(Tos)*2; i++) putmem_b(tos + i, 0); /* * pid is second word from end of tos and needs to be set for nsec(). * we know arm is a 32-bit cpu, so we'll assume knowledge of the Tos * struct for now, and use our pid. */ putmem_w(tos + 4*4 + 2*sizeof(uint32_t) + 3*sizeof(uvlong), getpid()); /* Build exec stack */ size = strlen(file)+1+BY2WD+BY2WD+BY2WD; for(i = 0; i < argc; i++) size += strlen(argv[i])+BY2WD+1; sp -= size; sp &= ~7; reg.r[0] = tos; reg.r[13] = sp; reg.r[1] = STACKTOP-4; /* Plan 9 profiling clock (why & why in R1?) */ /* Push argc */ putmem_w(sp, argc+1); sp += BY2WD; /* Compute sizeof(argv) and push argv[0] */ ap = sp+((argc+1)*BY2WD)+BY2WD; putmem_w(sp, ap); sp += BY2WD; /* Build argv[0] string into stack */ for(p = file; *p; p++) putmem_b(ap++, *p); putmem_b(ap++, '\0'); /* Loop through pushing the arguments */ for(i = 0; i < argc; i++) { putmem_w(sp, ap); sp += BY2WD; for(p = argv[i]; *p; p++) putmem_b(ap++, *p); putmem_b(ap++, '\0'); } /* Null terminate argv */ putmem_w(sp, 0); }
/*void mapwidget::simtour(){ //scene->addLine(558,412,713,267,p); QGraphicsPixmapItem*tourist=scene->addPixmap(QPixmap("/Users/apple/Desktop/map/clientmap/build-MapWidget-Desktop_Qt_5_6_0_clang_64bit-Debug/yu.png")); QGraphicsItemAnimation*anim=new QGraphicsItemAnimation; anim->setItem(tourist); QTimeLine*timeline=new QTimeLine(4000); timeline->setCurveShape(QTimeLine::SineCurve); timeline->setLoopCount(0); anim->setTimeLine(timeline); //anim->setPosAt(0,QPointF(558,412)); for(int i=0;i<212;i++){ anim->setPosAt(i/212.0,QPointF(558+i*0.8,412-i*0.7)); //这个.0很重要!!!!! } timeline->start(); //scene->addItem(tourist); }*/ void mapwidget::clearmap(){ //scene->clear(); // x=this->verticalScrollBar()->value(); //y=this->horizontalScrollBar()->value(); scene=new QGraphicsScene; initmap(); }
int main(int argc, char *argv[]) { io_openlinkeddatafile(datafile); initmap(); loadconfig(); initstuff(); loadmap(); mainloop(); saveconfig(); return 0; }
main( ) { FILE *fp, *fopen( ); unsigned char inputfile[80]; unsigned char str[MAXLINELENGTH], out[MAXLINELENGTH]; int i, count, nn; numword = nn = 0; /* Sort while reading */ readfile( DICTFILE ); initmap( ); for ( i = 0; i<numword; i++ ) { /* Remove duplicate words */ if ( i<numword - 1 ) { if ( strcmp( wordptr[i] + 1, wordptr[i + 1] + 1 ) != 0 ) { add2map( wordptr[i] + 1, wordptr[i][0] ); nn++; } } else { add2map( wordptr[i] + 1, wordptr[i][0] ); nn++; } } count = 0; for ( i = 0; i<maxstate; i++ ) count += state[i]; printf( "Word Count: %d %d\n", nn, count ); printf( "Min Max Code: %d %d\n", mincol, maxcol ); /* check_headchar(); */ rnumword = nn; printf( "maxstate = %d\n", maxstate ); printf( "rnumword = %d\n", rnumword ); prmap( ); return 0; }
//在MAINWINDOW的UI界面中将手动添加的QGRAPHICSVIEW界面(ui->mapw)提升为这个类,可使用这些函数 mapwidget::mapwidget(QWidget *parent): QGraphicsView(parent) { setMouseTracking(true); zoom=0; map.load(":/mapr/ditu.png"); citybutton.load(":/mapr/button1.png"); cursor_pic.load(":/mapr/pin.png"); p.setWidth(10); p.setColor(QColor("blue")); //p.setStyle(Qt::PenStyle); initmap(); //scene->addLine(434,265,351,431,p); //simtour(); //scene->addPath() //ui->mapwidget->resize(map.width()+10, map.height()+10); //mapwidget->show(); }
int main(int argc, char **argv) { int ii, jj; if(argc < 7) { printf("Usage: %s xsize ysize fill (r1 r2 count)+\n", argv[0]); return 1; } size_x = atoi(argv[1]); size_y = atoi(argv[2]); fillprob = atoi(argv[3]); generations = (argc-4)/3; printf("gen: %d, %d\n",argc,generations); params = params_set = (generation_params*)malloc( sizeof(generation_params) * generations ); for(ii=4; ii+2<argc; ii+=3) { params->r1_cutoff = atoi(argv[ii]); params->r2_cutoff = atoi(argv[ii+1]); params->reps = atoi(argv[ii+2]); params++; } srand(time(NULL)); initmap(); for(ii=0; ii<generations; ii++) { params = ¶ms_set[ii]; for(jj=0; jj<params->reps; jj++) generation(); } printfunc(); printmap(); return 0; }
void procinit(int pid) { char *p; Segment *s; int n, m, sg, i; ulong vastart, vaend; char mfile[128], tfile[128], sfile[1024]; sprint(mfile, "/proc/%d/mem", pid); sprint(tfile, "/proc/%d/text", pid); sprint(sfile, "/proc/%d/segment", pid); text = open(tfile, OREAD); if(text < 0) fatal(1, "open text %s", tfile); inithdr(text); sg = open(sfile, OREAD); if(sg < 0) fatal(1, "open text %s", sfile); n = read(sg, sfile, sizeof(sfile)); if(n >= sizeof(sfile)) fatal(0, "segment file buffer too small"); close(sg); m = open(mfile, OREAD); if(m < 0) fatal(1, "open %s", mfile); initmap(); p = strstr(sfile, "Data"); if(p == 0) fatal(0, "no data"); vastart = strtoul(p+9, 0, 16); vaend = strtoul(p+18, 0, 16); s = &memory.seg[Data]; if(s->base != vastart || s->end != vaend) { s->base = vastart; s->end = vaend; free(s->table); s->table = malloc(((s->end-s->base)/BY2PG)*sizeof(uchar*)); } seginit(m, s, 0, vastart, vaend); p = strstr(sfile, "Bss"); if(p == 0) fatal(0, "no bss"); vastart = strtoul(p+9, 0, 16); vaend = strtoul(p+18, 0, 16); s = &memory.seg[Bss]; if(s->base != vastart || s->end != vaend) { s->base = vastart; s->end = vaend; free(s->table); s->table = malloc(((s->end-s->base)/BY2PG)*sizeof(uchar*)); } seginit(m, s, 0, vastart, vaend); reg.pc = greg(m, REGOFF(pc)); reg.r[1] = greg(m, REGOFF(sp)); reg.r[2] = greg(m, REGOFF(r2)); reg.r[30] = greg(m, REGOFF(r30)); reg.r[31] = greg(m, REGOFF(r31)); for(i = 0; i < 32; i++) reg.r[i] = greg(m, roff[i-1]); s = &memory.seg[Stack]; vastart = reg.r[1] & ~(BY2PG-1); seginit(m, s, (vastart-s->base)/BY2PG, vastart, STACKTOP); close(m); Bprint(bioout, "qi\n"); }