int main(int argc, char *argv[]) { int cpu = 0; uint32_t n; char *endptr; if (argc > 2) { usage(); exit(127); } else if (argc == 2) { cpu = strtoul(argv[1], &endptr, 0); if (*endptr || cpu > 5119) { usage(); exit(127); } } printf ("Leaf Subleaf EAX EBX ECX EDX \n"); for (n = 0; n <= 0xffff; n++) { dump_levels(cpu, n << 16); } return 0; }
/* Dumps (almost) the entire game state on request. Called by * handle_keystroke_event() when the F10 key is pressed. */ void dump_state(nbstate *state) { int i; power *p; sprite *s; /* The letters symbolising each of the powers: */ char powers[NUMPOWERS] = "WSTPNF"; /* The names of the cheats: */ char *cheats[] = { "SolidFloor", "Teleport", "NoBounce", "NoPowerDown", "NoPowerUpTimeout" }; /* Print the title: */ debug_printf ("Printing NanoBreaker Game State\n" "-------------------------------\n"); /* Print the current game state: */ debug_printf ("state = "); printstate(state->state); /* Print the name of the game directory and the game file: */ debug_printf ("gamedir = \"%s\"\ngamefile = \"%s\"\n", fname(state->gamedir), fname(state->gamefile)); /* Print the name of the title screen background image and whether it * should be tiled or not: */ debug_printf ("titlebackground = \"%s\"\n", fname(state->titlebackground)); debug_printf ("titlebackgroundtiled = %s\n", state->titlebackgroundtiled ? "Yes" : "No"); /* Print the file names of the various splash graphics: */ debug_printf ("titlesplash = \"%s\"\n", fname(state->titlesplash)); debug_printf ("gamewonsplash = \"%s\"\n", fname(state->gamewonsplash)); debug_printf ("gamelostsplash = \"%s\"\n", fname(state->gamelostsplash)); /* Print the full list of sprites: */ debug_printf ("sprites = \n"); if(!state->spritelist) debug_printf ("\t<empty>\n"); else for(s = state->spritelist; s; s = s->next) debug_printf ("\t\"%s\" (%d * %d) is in use %d time%s\n", fname(s->fname), s->w, s->h, s->usage, s->usage > 1 ? "s" : ""); /* Print the name and dimensions of the current background image (or * "none" if there isn't one, and whether or not is tiled: */ debug_printf ("background = "); if(!state->background) debug_printf ("none\n"); else debug_printf ("\"%s\" (%d * %d), %stiled\n", fname(state->background->fname), state->background->w, state->background->h, state->backgroundtiled ? "" : "not "); /* Print the points gained in various different circumstances, the * balls given at the start of the game, and the balls given at the * start of each new level: */ debug_printf ("normalpoints = %d\nsmallbonuspoints = %d\nmediumbonuspoints = " "%d\nlargebonuspoints = %d\nhugebonuspoints = %d\n" "poweruppoints = %d\npowerdownpoints = %d\nstartballs = %d\n" "newlevelballs = %d\n", state->normalpoints, state->smallbonuspoints, state->mediumbonuspoints, state->largebonuspoints, state->hugebonuspoints, state->poweruppoints, state->powerdownpoints, state->startballs, state->newlevelballs); /* Print the dimensions of the brick area, the size of the bricks, * the ID of the brick drawing alpha channel, and the global brick * list: */ debug_printf ("width = %d\nheight = %d\nbrickwidth = %d\nbrickheight = %d\n" "brickalpha = %d\n", state->width, state->height, state->brickwidth, state->brickheight, state->brickalpha); debug_printf ("bricks =\n"); dump_bricks(state->bricks); /* Print the bat sizes, the names of all the various bat graphics, the * current bat, and the current bat X position: */ debug_printf ("batheight = %d\nsmall bat width = %d\nnormal bat width = %d\n" "large bat width = %d\n", state->batheight, state->batwidths[SMALLBAT], state->batwidths[NORMALBAT], state->batwidths[LARGEBAT]); debug_printf ("small bat = "); if(!state->bats[SMALLBAT]) debug_printf ("none\n"); else debug_printf ("\"%s\"\n", fname(state->bats[SMALLBAT]->fname)); debug_printf ("normal bat = "); if(!state->bats[NORMALBAT]) debug_printf ("none\n"); else debug_printf ("\"%s\"\n", fname(state->bats[NORMALBAT]->fname)); debug_printf ("large bat = "); if(!state->bats[SMALLBAT]) debug_printf ("none\n"); else debug_printf ("\"%s\"\n", fname(state->bats[LARGEBAT]->fname)); debug_printf ("current bat = "); switch(state->bat) { case NORMALBAT: debug_printf ("NORMALBAT\n"); break; case SMALLBAT: debug_printf ("SMALLBAT\n"); break; case LARGEBAT: debug_printf ("LARGEBAT\n"); break; default: debug_printf ("unknown (%d)\n", state->bat); } debug_printf ("batx = %d\nbatv = %d\n", state->batx, state->batv); /* Print the names of each of the power sprites: */ debug_printf ("Power sprites:\n"); for(i = 0; i < NUMPOWERS; i++) { debug_printf ("\t%c ", powers[i]); if(state->powersprites[i]) debug_printf ("\"%s\"\n", fname(state->powersprites[i]->fname)); else debug_printf ("<empty>\n"); } /* If there is a splash sprite, print its name and dimensions: */ debug_printf ("splash = "); if(!state->splash) debug_printf ("none\n"); else debug_printf ("\"%s\" (%d * %d)\n", fname(state->splash->fname), state->splash->w, state->splash->h); /* Print the times that power-ups and power-downs last for: */ debug_printf ("poweruptime = %d\npowerdowntime = %d\n", state->poweruptime, state->powerdowntime); /* Print the cheat sequences, the cheat status, and the cheat flags: */ debug_printf ("Cheat sequences:\n"); for(i = 0; i < NUMCHEATS; i++) { debug_printf ("\t%s = ", cheats[i]); if(state->cheats[i]) debug_printf ("\"%s\"\n", state->cheats[i]); else debug_printf ("disabled\n"); } debug_printf ("cheatstate = \"%s\"\n", state->cheatstate); debug_printf ("SolidFloor flag is %s\n", state->flags.sf ? "active" : "inactive"); debug_printf ("NoBounce flag is %s\n", state->flags.nb ? "active" : "inactive"); debug_printf ("NoPowerDown flag is %s\n", state->flags.npd ? "active" : "inactive"); debug_printf ("NoPowerUpTimeout flag is %s\n", state->flags.nputo ? "active" : "inactive"); /* Print the other various boolean flags: */ debug_printf ("Paused flag is %s\n", state->flags.paused ? "active" : "inactive"); debug_printf ("Left flag is %s\n", state->flags.left ? "active" : "inactive"); debug_printf ("Right flag is %s\n", state->flags.right ? "active" : "inactive"); /* Print the current level and the total number of levels: */ debug_printf ("level = %d\nnumlevels = %d\n", state->level, state->numlevels); /* Print the Nano-X IDs of the output window, the canvases, and the * one second periodic timer, as well as the absolute X position of * the output window and the dimensions of the canvas area: */ debug_printf ("wid = %d\nwinx = %d\ncanvas = %d\noldcanvas = %d\n" "newcanvas = %d\ntid = %d\ncanvaswidth = %d\n" "canvasheight = %d\n", state->wid, state->winx, state->canvas, state->oldcanvas, state->newcanvas, state->tid, state->canvaswidth, state->canvasheight); /* The current brick area: */ dump_grid(state, state->grid); /* The number of bricks remaining in the current level: */ debug_printf ("numbricks = %d\n", state->numbricks); /* Print the ball related data: */ debug_printf ("ball = "); if(!state->ball.s) debug_printf ("none\n"); else debug_printf ("\"%s\" (%d * %d)\n", fname(state->ball.s->fname), state->ball.s->w, state->ball.s->h); debug_printf ("ball x = %f\nball y = %f\nball d = %f\nball v = %d\n" "lx = %d\nly = %d\nparked = %s\nslow ball velocity = " "%d\nnormal ball velocity = %d\nfast ball velocity = " "%d\n", state->ball.x, state->ball.y, state->ball.d, state->ball.v, state->ball.lx, state->ball.ly, state->ball.parked ? "Yes" : "No", state->ball.sv, state->ball.nv, state->ball.fv); /* Print the current list of powers: */ debug_printf ("current powers:\n"); if(!state->powers) debug_printf ("\t<empty>\n"); else for(p = state->powers; p; p = p->next) debug_printf ("\t%c at (%d, %d)\n", powers[p->type], p->x, p->y); /* Print the score related data: */ debug_printf ("score = %d\nhiscore = %d\n file hiscore = %d\n" "score pixmap = %d\n", state->scores.s, state->scores.hi, state->scores.fhi, state->scores.p); /* Print out the power velocity and the animate period: */ debug_printf ("powerv = %d\nanimateperiod = %d\n", state->powerv, state->animateperiod); /* Print the time of the last animate() call: */ debug_printf ("lastanim = %ldS %lduS\n", state->lastanim.tv_sec, state->lastanim.tv_usec); /* Print the current power-up and power-down timer values: */ debug_printf ("powertimes:\n" "\twidebat = %d\n" "\tslowmotion = %d\n" "\tstickybat = %d\n" "\tpowerball = %d\n" "\tnarrowbat = %d\n" "\tfastmotion = %d\n", state->powertimes.widebat, state->powertimes.slowmotion, state->powertimes.stickybat, state->powertimes.powerball, state->powertimes.narrowbat, state->powertimes.fastmotion); /* Print the fade rate and current fade level: */ debug_printf ("faderate = %d\nfadelevel = %d\n", state->faderate, state->fadelevel); /* Print the next game state: */ debug_printf ("nextstate = "); printstate(state->nextstate); /* Print all of the level data: */ dump_levels(state); }