mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-12 16:14:23 +01:00
BSOD: fix formatting and warnings
This commit is contained in:
parent
18efca478e
commit
e2d9d21f3f
1 changed files with 14 additions and 14 deletions
12
src/utils.c
12
src/utils.c
|
@ -214,7 +214,6 @@ SYMBOL_EXPORT void FatalError(struct Game* game, bool exit, char* format, ...) {
|
||||||
al_flip_display();
|
al_flip_display();
|
||||||
al_rest(0.6);
|
al_rest(0.6);
|
||||||
|
|
||||||
|
|
||||||
const int offsetx = al_get_display_width(game->display) / 2;
|
const int offsetx = al_get_display_width(game->display) / 2;
|
||||||
const int offsety = al_get_display_height(game->display) * 0.30;
|
const int offsety = al_get_display_height(game->display) * 0.30;
|
||||||
const int fonth = al_get_font_line_height(game->_priv.font_bsod);
|
const int fonth = al_get_font_line_height(game->_priv.font_bsod);
|
||||||
|
@ -227,9 +226,9 @@ SYMBOL_EXPORT void FatalError(struct Game* game, bool exit, char* format, ...) {
|
||||||
const char* header = game->name;
|
const char* header = game->name;
|
||||||
const int headw = al_get_text_width(game->_priv.font_bsod, header);
|
const int headw = al_get_text_width(game->_priv.font_bsod, header);
|
||||||
|
|
||||||
al_draw_filled_rectangle(offsetx - headw / 2 - 4, (int)(offsety), 4 + offsetx + headw / 2, (int)(offsety) + fonth, al_map_rgb(170, 170, 170));
|
al_draw_filled_rectangle(offsetx - headw / 2 - 4, offsety, 4 + offsetx + headw / 2, offsety + fonth, al_map_rgb(170, 170, 170));
|
||||||
|
|
||||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(0, 0, 170), offsetx, (int)(offsety), ALLEGRO_ALIGN_CENTRE, header);
|
al_draw_text(game->_priv.font_bsod, al_map_rgb(0, 0, 170), offsetx, offsety, ALLEGRO_ALIGN_CENTRE, header);
|
||||||
|
|
||||||
const char* header2 = "A fatal exception 0xD3RP has occured at 0028:M00F11NZ in GST SD(01) +";
|
const char* header2 = "A fatal exception 0xD3RP has occured at 0028:M00F11NZ in GST SD(01) +";
|
||||||
const int head2w = al_get_text_width(game->_priv.font_bsod, header2);
|
const int head2w = al_get_text_width(game->_priv.font_bsod, header2);
|
||||||
|
@ -237,7 +236,6 @@ SYMBOL_EXPORT void FatalError(struct Game* game, bool exit, char* format, ...) {
|
||||||
al_draw_text(game->_priv.font_bsod, al_map_rgb(255, 255, 255), offsetx, (int)(offsety + 2 * fonth * 1.25), ALLEGRO_ALIGN_CENTRE, header2);
|
al_draw_text(game->_priv.font_bsod, al_map_rgb(255, 255, 255), offsetx, (int)(offsety + 2 * fonth * 1.25), ALLEGRO_ALIGN_CENTRE, header2);
|
||||||
al_draw_textf(game->_priv.font_bsod, al_map_rgb(255, 255, 255), offsetx - head2w / 2, (int)(offsety + 3 * fonth * 1.25), ALLEGRO_ALIGN_LEFT, "%p and system just doesn't know what went wrong.", game);
|
al_draw_textf(game->_priv.font_bsod, al_map_rgb(255, 255, 255), offsetx - head2w / 2, (int)(offsety + 3 * fonth * 1.25), ALLEGRO_ALIGN_LEFT, "%p and system just doesn't know what went wrong.", game);
|
||||||
|
|
||||||
|
|
||||||
const int error_len = strlen(text);
|
const int error_len = strlen(text);
|
||||||
const int error_w = al_get_text_width(game->_priv.font_bsod, text);
|
const int error_w = al_get_text_width(game->_priv.font_bsod, text);
|
||||||
const int lines = ceil(error_w / (al_get_display_width(game->display) * 0.8));
|
const int lines = ceil(error_w / (al_get_display_width(game->display) * 0.8));
|
||||||
|
@ -246,8 +244,10 @@ SYMBOL_EXPORT void FatalError(struct Game* game, bool exit, char* format, ...) {
|
||||||
int row = 5, l = 0;
|
int row = 5, l = 0;
|
||||||
for (; l < lines; ++l) {
|
for (; l < lines; ++l) {
|
||||||
int start = l * letters_per_line;
|
int start = l * letters_per_line;
|
||||||
int end = (l+1) * letters_per_line;
|
unsigned int end = (l + 1) * letters_per_line;
|
||||||
if(end >= sizeof(text)) end = sizeof(text)-1;
|
if (end >= sizeof(text)) {
|
||||||
|
end = sizeof(text) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
const char save_char = text[end];
|
const char save_char = text[end];
|
||||||
text[end] = '\0';
|
text[end] = '\0';
|
||||||
|
|
Loading…
Reference in a new issue