Mercurial > hg > dmlib
comparison tools/ppl.c @ 2477:0ab24caf7fdf
Clean up various error messages.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 Apr 2020 18:33:39 +0300 |
parents | 275374725598 |
children | aacf3bd1cceb |
comparison
equal
deleted
inserted
replaced
2476:90eec3e1f85f | 2477:0ab24caf7fdf |
---|---|
573 return 1; | 573 return 1; |
574 } | 574 } |
575 | 575 |
576 if ((result = dmf_open_stdio(optFilename, "rb", &file)) != DMERR_OK) | 576 if ((result = dmf_open_stdio(optFilename, "rb", &file)) != DMERR_OK) |
577 { | 577 { |
578 dmErrorMsg("Error opening file '%s', %d: (%s)\n", | 578 dmErrorMsg("Error opening file '%s': %s\n", |
579 optFilename, result, dmErrorStr(result)); | 579 optFilename, dmErrorStr(result)); |
580 return 1; | 580 return 1; |
581 } | 581 } |
582 | 582 |
583 // Initialize miniJSS | 583 // Initialize miniJSS |
584 jssInit(); | 584 jssInit(); |
606 #endif | 606 #endif |
607 dmf_close(file); | 607 dmf_close(file); |
608 | 608 |
609 if (result != DMERR_OK) | 609 if (result != DMERR_OK) |
610 { | 610 { |
611 dmErrorMsg("Error loading module file, %d: %s\n", | 611 dmErrorMsg("Error loading module file: %s\n", |
612 result, dmErrorStr(result)); | 612 dmErrorStr(result)); |
613 goto exit; | 613 goto exit; |
614 } | 614 } |
615 | 615 |
616 // Try to convert it | 616 // Try to convert it |
617 if ((result = jssConvertModuleForPlaying(eng.mod)) != DMERR_OK) | 617 if ((result = jssConvertModuleForPlaying(eng.mod)) != DMERR_OK) |
618 { | 618 { |
619 dmErrorMsg("Could not convert module for playing, %d: %s\n", | 619 dmErrorMsg("Could not convert module for playing: %s\n", |
620 result, dmErrorStr(result)); | 620 dmErrorStr(result)); |
621 goto exit; | 621 goto exit; |
622 } | 622 } |
623 | 623 |
624 | 624 |
625 // Initialize SDL components | 625 // Initialize SDL components |
626 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0) | 626 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0) |
627 { | 627 { |
628 dmErrorMsg("Could not initialize SDL: %s\n", SDL_GetError()); | 628 dmErrorMsg("Could not initialize SDL: %s\n", |
629 SDL_GetError()); | |
629 goto exit; | 630 goto exit; |
630 } | 631 } |
631 initSDL = TRUE; | 632 initSDL = TRUE; |
632 | 633 |
633 | 634 |
690 } | 691 } |
691 | 692 |
692 if (optUseGUI) | 693 if (optUseGUI) |
693 { | 694 { |
694 // Get font | 695 // Get font |
695 result = dmf_open_memio(NULL, "pplfont.fnt", engineSetupFont, sizeof(engineSetupFont), &file); | 696 static const char *engineFontName = "pplfont.fnt"; |
697 result = dmf_open_memio(NULL, engineFontName, engineSetupFont, sizeof(engineSetupFont), &file); | |
696 if (result != DMERR_OK) | 698 if (result != DMERR_OK) |
697 { | 699 { |
698 dmErrorMsg("Error opening font file 'pplfont.fnt', #%d: %s\n", | 700 dmErrorMsg("Error opening font file '%s': %s\n", |
699 result, dmErrorStr(result)); | 701 engineFontName, dmErrorStr(result)); |
700 goto exit; | 702 goto exit; |
701 } | 703 } |
702 result = dmLoadBitmapFont(file, &font); | 704 result = dmLoadBitmapFont(file, &font); |
703 dmf_close(file); | 705 dmf_close(file); |
704 if (result != DMERR_OK) | 706 if (result != DMERR_OK) |
705 { | 707 { |
706 dmErrorMsg("Could not load font from file, %d: %s\n", | 708 dmErrorMsg("Could not load font data from '%s': %s\n", |
707 result, dmErrorStr(result)); | 709 engineFontName, dmErrorStr(result)); |
708 goto exit; | 710 goto exit; |
709 } | 711 } |
710 | 712 |
711 SDL_Color pal[DMFONT_NPALETTE]; | 713 SDL_Color pal[DMFONT_NPALETTE]; |
712 for (int n = 0; n < DMFONT_NPALETTE; n++) | 714 for (int n = 0; n < DMFONT_NPALETTE; n++) |