# HG changeset patch # User Matti Hamalainen # Date 1349146398 -10800 # Node ID 3b3908d28a4b3dd36b6f317c74887f1764fcbde4 # Parent c6cdaa675801fa647175977df6957ca3c9884895 PPL now looks a bit saner, but does not do anything interesting yet. diff -r c6cdaa675801 -r 3b3908d28a4b ppl.c --- a/ppl.c Tue Oct 02 05:52:35 2012 +0300 +++ b/ppl.c Tue Oct 02 05:53:18 2012 +0300 @@ -158,6 +158,11 @@ } +Uint32 dmCol(float r, float g, float b) +{ + return dmMapRGB(engine.screen, 255.0f * r, 255.0f * g, 255.0f * b); +} + BOOL dmInitializeVideo() { engine.screen = SDL_SetVideoMode( @@ -170,12 +175,12 @@ return FALSE; } - col.inboxBg = dmMapRGB(engine.screen, 0, 0, 0); - col.boxBg = dmMapRGB(engine.screen, 200, 100, 30); - col.box1 = dmMapRGB(engine.screen, 250, 250, 200); - col.box2 = dmMapRGB(engine.screen, 100, 50, 0); - col.viewDiv = dmMapRGB(engine.screen, 0,0,0); - col.activeRow = dmMapRGB(engine.screen, 150,80,0); + col.inboxBg = dmCol(0.7, 0.55, 0.1); + col.boxBg = dmCol(0.8, 0.65, 0.15); + col.box1 = dmCol(0.95, 0.95, 0.8); + col.box2 = dmCol(0.3, 0.3, 0.15); + col.viewDiv = dmCol(0,0,0); + col.activeRow = dmCol(150,80,0); return TRUE; } @@ -201,13 +206,13 @@ switch (n->note) { case jsetNotSet: - sprintf(ptr, "...§"); + sprintf(ptr, "..._"); break; case jsetNoteOff: - sprintf(ptr, "===§"); + sprintf(ptr, "===_"); break; default: - sprintf(ptr, "%s%i§", + sprintf(ptr, "%s%i_", patNoteTable[n->note % 12], n->note / 12); break; @@ -216,17 +221,17 @@ ptr += 4; if (n->instrument != jsetNotSet) - sprintf(ptr, "%.2x§", n->instrument + 1); + sprintf(ptr, "%.2x_", n->instrument + 1); else - sprintf(ptr, "..§"); + sprintf(ptr, ".._"); ptr += 3; if (n->volume == jsetNotSet) - sprintf(ptr, "..§"); + sprintf(ptr, ".._"); else if (n->volume >= 0x00 && n->volume <= 0x40) - sprintf(ptr, "%.2x§", n->volume); + sprintf(ptr, "%.2x_", n->volume); else { char c; @@ -244,7 +249,7 @@ case 0xe0: c = 'M'; break; default: c = '?'; break; } - sprintf(ptr, "%c%x§", c, (n->volume & 0x0f)); + sprintf(ptr, "%c%x_", c, (n->volume & 0x0f)); } ptr += 3; @@ -270,7 +275,7 @@ void dmDisplayPattern(SDL_Surface *screen, int x0, int y0, int x1, int y1, JSSPattern *pat, int row, int choffs) { - int cwidth = (font->width * 10 + 3 * font->width + 5), + int cwidth = (font->width * 10 + 3 * 4 + 5), lwidth = 6 + font->width * 3, qwidth = ((x1 - x0 - lwidth) / cwidth), qheight = ((y1 - y0 - 4) / (font->height + 1)), @@ -278,7 +283,7 @@ midrow = qheight / 2; dmDrawBox3D(screen, x0 + lwidth, y0, x1, y1, - col.boxBg, col.box2, col.box1); + col.inboxBg, col.box2, col.box1); for (nchannel = 1; nchannel < qwidth; nchannel++) { @@ -351,17 +356,10 @@ return 1; } - if ((file = dmf_create_stdio(optFilename)) == NULL) + if ((file = dmf_create_stdio(optFilename, "rb")) == NULL) { - dmError("Error opening input file '%s'. (%s)\n", - optFilename, strerror(errno)); - return 1; - } - - if ((file = dmf_create_stdio(optFilename)) == NULL) - { - dmError("Error opening input file '%s'. (%s)\n", - optFilename, strerror(errno)); + dmError("Error opening file '%s', %d (%s)\n", + optFilename, errno, strerror(errno)); return 1; } @@ -409,7 +407,7 @@ goto error_exit; } - if ((file = dmf_create_stdio(optFontFilename)) == NULL) + if ((file = dmf_create_stdio(optFontFilename, "rb")) == NULL) { dmError("Error opening input file '%s'. (%s)\n", optFontFilename, strerror(errno));