Mercurial > hg > dmlib
diff tools/ppl.c @ 1238:e8c99da451cd
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Mar 2015 18:14:03 +0200 |
parents | a79edf59d5d8 |
children | 13c274d22a29 |
line wrap: on
line diff
--- a/tools/ppl.c Fri Mar 06 16:37:15 2015 +0200 +++ b/tools/ppl.c Fri Mar 06 18:14:03 2015 +0200 @@ -93,7 +93,7 @@ case 1: dmVerbosity++; break; - + case 2: engine.optVFlags |= SDL_FULLSCREEN; break; @@ -111,7 +111,7 @@ engine.optScrWidth = w; engine.optScrHeight = h; } - else + else { dmErrorMsg("Invalid size argument '%s'.\n", optArg); return FALSE; @@ -156,7 +156,7 @@ dmErrorMsg("Unknown option '%s'.\n", currArg); return FALSE; } - + return TRUE; } @@ -170,7 +170,7 @@ dmErrorMsg("Too many filename arguments '%s'\n", currArg); return FALSE; } - + return TRUE; } @@ -190,12 +190,12 @@ xc += 4; continue; } - + if (ch >= 0 && ch < font->nglyphs && (glyph = font->glyphs[ch]) != NULL) { if (blit == NULL) blit = dmGetUnscaledBlitFunc(glyph->format, screen->format, mode); - + blit(glyph, xc, yc, screen); xc += font->width; } @@ -216,7 +216,7 @@ void dmDrawBMTextQ(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...) { va_list ap; - + va_start(ap, fmt); dmDrawBMTextVAQ(screen, font, mode, xc, yc, fmt, ap); va_end(ap); @@ -310,10 +310,10 @@ qheight = y1 - y0, nwidth = jsetNChannels, nheight = 1; - + if (qheight < 40) return; - + while (qwidth / nwidth <= 60 && qheight / nheight >= 40) { nheight++; @@ -321,7 +321,7 @@ } // fprintf(stderr, "%d x %d\n", nwidth, nheight); - + if (qheight / nheight <= 40) { nwidth = qwidth / 60; @@ -330,7 +330,7 @@ qwidth /= nwidth; qheight /= nheight; - + for (nchannel = qy = 0; qy < nheight && nchannel < jsetNChannels; qy++) { for (qx = 0; qx < nwidth && nchannel < jsetNChannels; qx++) @@ -371,7 +371,7 @@ { char text[32]; char *ptr = text; - + switch (n->note) { case jsetNotSet: @@ -434,7 +434,7 @@ *ptr++ = dmHexVal(n->volume); } *ptr++ = '_'; - + if (n->effect >= 0 && n->effect < jmpNMODEffectTable) *ptr++ = jmpMODEffectTable[n->effect]; else @@ -480,7 +480,7 @@ for (nchannel = 0; nchannel < qwidth; nchannel++) { - int bx0 = x0 + lwidth + 1 + nchannel * cwidth, + int bx0 = x0 + lwidth + 1 + nchannel * cwidth, bx1 = bx0 + cwidth; dmFillRect(screen, bx0+1, qy0+1, bx1-1, qy1-1, @@ -492,7 +492,7 @@ for (nchannel = 0; nchannel < qwidth; nchannel++) { - int bx0 = x0 + lwidth + 1 + nchannel * cwidth, + int bx0 = x0 + lwidth + 1 + nchannel * cwidth, bx1 = bx0 + cwidth; dmDrawVLine(screen, qy0 + 1, qy1 - 1, bx1, col.viewDiv); @@ -502,17 +502,17 @@ dmDrawBMTextConstQ(screen, font, DMD_TRANSPARENT, bx0 + (cwidth - font->width * 5) / 2, qy1 + 3, "MUTED"); } - + dmDrawBMTextQ(screen, font, DMD_TRANSPARENT, bx0 + (cwidth - font->width * 3) / 2, y0 + 1, "%3d", nchannel + choffs); } - + for (nrow = 0; nrow < qheight; nrow++) { int crow = nrow - midrow + row; yc = qy0 + 2 + (font->height + 1) * nrow; - + if (crow >= 0 && crow < pat->nrows) { dmDrawBMTextQ(screen, font, DMD_TRANSPARENT, x0, yc, "%03d", crow); @@ -574,7 +574,7 @@ dmErrorMsg("No filename specified.\n"); return 1; } - + if ((result = dmf_create_stdio(optFilename, "rb", &file)) != DMERR_OK) { dmErrorMsg("Error opening file '%s', %d: (%s)\n", @@ -659,7 +659,7 @@ dmErrorMsg("jvmInit() returned NULL\n"); goto error_exit; } - + switch (optOutFormat) { case JSS_AUDIO_S16: engine.afmt.format = AUDIO_S16SYS; break; @@ -686,14 +686,14 @@ goto error_exit; } audioInit = TRUE; - + // Initialize player if ((engine.plr = jmpInit(engine.dev)) == NULL) { dmErrorMsg("jmpInit() returned NULL\n"); goto error_exit; } - + jvmSetCallback(engine.dev, jmpExec, engine.plr); jmpSetModule(engine.plr, engine.mod); jmpPlayOrder(engine.plr, optStartOrder); @@ -721,7 +721,7 @@ SDL_UnlockAudio(); int currTick, prevTick = 0, prevRow = -1; - + while (!engine.exitFlag) { currTick = SDL_GetTicks(); @@ -736,7 +736,7 @@ case SDLK_ESCAPE: engine.exitFlag = TRUE; break; - + case SDLK_SPACE: engine.pauseFlag = !engine.pauseFlag; SDL_PauseAudio(engine.pauseFlag); @@ -832,13 +832,13 @@ if (!engine.plr->isPlaying) engine.exitFlag = TRUE; JSS_UNLOCK(engine.plr); - + if (currRow != prevRow || force) { prevRow = currRow; force = TRUE; } - + // Draw frame if (SDL_MUSTLOCK(engine.screen) != 0 && SDL_LockSurface(engine.screen) != 0) { @@ -849,7 +849,7 @@ if (force) { dmClearSurface(engine.screen, col.boxBg); - + dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5, "%s v%s by ccr/TNSP - (c) Copyright 2012-2015 TNSP", dmProgDesc, dmProgVersion); dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12 + 11, @@ -859,7 +859,7 @@ dmDisplayPattern(engine.screen, 5, 40, engine.screen->w - 6, engine.screen->h * 0.8, currPattern, currRow); - + JSS_LOCK(engine.plr); dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12, "Tempo: %3d | Speed: %3d | Row: %3d/%-3d | Order: %3d/%-3d | Pattern: %3d/%-3d",