Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Fixed a few more issues with double-sized fonts
The compiler now recognises >>
The compiler now deals correctly with hexadecimal numbers
  • Loading branch information
linleyh committed Mar 19, 2017
1 parent 1533b53 commit 5ab063a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
16 changes: 9 additions & 7 deletions src/c_lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ int get_ctoken_one_or_two_char(struct ctokenstruct* ctoken, char read_char)
{
case '=': ctoken->type = CTOKEN_TYPE_OPERATOR_COMPARISON;
ctoken->subtype = CTOKEN_SUBTYPE_GREQ; return 1;
case '<': ctoken->subtype = CTOKEN_SUBTYPE_BITSHIFT_R; return 1;
case '>': ctoken->subtype = CTOKEN_SUBTYPE_BITSHIFT_R; return 1;
}
ctoken->type = CTOKEN_TYPE_OPERATOR_COMPARISON;
ctoken->subtype = CTOKEN_SUBTYPE_GR;
Expand Down Expand Up @@ -626,15 +626,17 @@ int get_ctoken_number_zero(struct ctokenstruct* ctoken)
}

// need to convert unsigned hex number to s16b:
if (ctoken_value > 0x7FFF)
ctoken_value *= -1; // will this work? I hope so!
// if (ctoken_value > 0x7FFF)
// ctoken_value *= -1; // will this work? I hope so!

if (ctoken_value > BCODE_VALUE_MAXIMUM
|| ctoken_value < BCODE_VALUE_MINIMUM)
return comp_error(CERR_PARSER_NUMBER_TOO_LARGE, ctoken);
s16b ctoken_value_16b = ctoken_value;

// if (ctoken_value > BCODE_VALUE_MAXIMUM
// || ctoken_value < BCODE_VALUE_MINIMUM)
// return comp_error(CERR_PARSER_NUMBER_TOO_LARGE, ctoken);

ctoken->type = CTOKEN_TYPE_NUMBER;
ctoken->number_value = ctoken_value;
ctoken->number_value = ctoken_value_16b;//ctoken_value;

return 1;
} // end hex
Expand Down
4 changes: 2 additions & 2 deletions src/e_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,8 @@ void open_overwindow(int ow_type)
//#ifdef USING_OVERWINDOW

editor.overwindow_type = ow_type;
editor.overwindow_w = 200;
editor.overwindow_h = 100;
editor.overwindow_w = scaleUI_x(FONT_BASIC,200);
editor.overwindow_h = scaleUI_y(FONT_BASIC,100);
editor.overwindow_x = (panel[PANEL_EDITOR].w / 2) - (editor.overwindow_w / 2);
editor.overwindow_y = (panel[PANEL_EDITOR].h / 2) - (editor.overwindow_h / 2);

Expand Down
4 changes: 2 additions & 2 deletions src/e_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ OVERWINDOW_TYPE_FIND,
OVERWINDOW_TYPES
};
#define OVERWINDOW_BUTTONS 3
#define OVERWINDOW_BUTTON_W 60
#define OVERWINDOW_BUTTON_H 20
#define OVERWINDOW_BUTTON_W scaleUI_x(FONT_BASIC,60)
#define OVERWINDOW_BUTTON_H scaleUI_y(FONT_BASIC,20)
enum
{
OVERWINDOW_BUTTON_TYPE_CLOSE_TAB, // closes tab without saving
Expand Down
4 changes: 2 additions & 2 deletions src/e_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ void update_editor_display(void)
case OVERWINDOW_TYPE_FIND:
al_draw_textf(font[FONT_BASIC].fnt, edit_col [EDIT_COL_OVERWINDOW_TEXT], editor_panel_x + editor.overwindow_x + (editor.overwindow_w / 2), editor.overwindow_y + 20, ALLEGRO_ALIGN_CENTRE, "Find");
#define SEARCH_BOX_X 10
#define SEARCH_BOX_W 120
#define SEARCH_BOX_W scaleUI_x(FONT_BASIC,120)
#define SEARCH_BOX_Y 35
#define SEARCH_BOX_H 15
#define SEARCH_BOX_H scaleUI_y(FONT_BASIC,15)
al_draw_filled_rectangle(editor_panel_x + editor.overwindow_x + SEARCH_BOX_X, editor.overwindow_y + SEARCH_BOX_Y, editor_panel_x + editor.overwindow_x + editor.overwindow_w - SEARCH_BOX_X, editor.overwindow_y + SEARCH_BOX_Y + SEARCH_BOX_H, edit_col [EDIT_COL_SEARCH_BOX]);
// al_draw_rectangle(editor_panel_x + editor.overwindow_x + SEARCH_BOX_X, editor.overwindow_y + SEARCH_BOX_Y, editor_panel_x + editor.overwindow_x + editor.overwindow_w - SEARCH_BOX_X, editor.overwindow_y + SEARCH_BOX_Y + SEARCH_BOX_H, edit_col [EDIT_COL_OVERWINDOW_BORDER], 1);
al_draw_textf(font[FONT_BASIC].fnt, edit_col [EDIT_COL_OVERWINDOW_TEXT], editor_panel_x + editor.overwindow_x + SEARCH_BOX_X + 3, editor.overwindow_y + SEARCH_BOX_Y + 3, ALLEGRO_ALIGN_LEFT, "%s", editor.search_string);
Expand Down
24 changes: 13 additions & 11 deletions src/i_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ c = CONSOLE_SYSTEM; // system console gets special minimalist treatment:
if (command.build_mode != BUILD_MODE_NONE
&& command.build_template_index == i)
{
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_BLUE] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x2 + 6, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_LEFT, "Place static process >>");
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_BLUE] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x2 + 6, button_y + (i * BUILD_BUTTON_H) + scaleUI_y(FONT_SQUARE,7), ALLEGRO_ALIGN_LEFT, "Place static process >>");
button_shade = SHADE_HIGH;
}

Expand All @@ -301,25 +301,27 @@ c = CONSOLE_SYSTEM; // system console gets special minimalist treatment:

draw_vbuf();

al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 3, button_y - BUILD_BUTTON_H + 10, ALLEGRO_ALIGN_LEFT, "Build");
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 3, button_y - BUILD_BUTTON_H + scaleUI_y(FONT_SQUARE,7), ALLEGRO_ALIGN_LEFT, "Build");


template_index = 0;

for (i = 0; i < TEMPLATES_PER_PLAYER; i ++)
{
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_MED], view.build_buttons_x1 + 6, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_LEFT, "%i", template_index);
float text_y = button_y + (i * BUILD_BUTTON_H) + scaleUI_y(FONT_SQUARE,7);

al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_MED], view.build_buttons_x1 + 6, text_y, ALLEGRO_ALIGN_LEFT, "%i", template_index);
if (templ[game.user_player_index][template_index].active)
{
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 22, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_LEFT, "%s", templ[game.user_player_index][template_index].name);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x2 - 8, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_RIGHT, "%i", templ[game.user_player_index][template_index].data_cost);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + scaleUI_x(FONT_SQUARE,22), text_y, ALLEGRO_ALIGN_LEFT, "%s", templ[game.user_player_index][template_index].name);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x2 - 8, text_y, ALLEGRO_ALIGN_RIGHT, "%i", templ[game.user_player_index][template_index].data_cost);
// al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x2 - 8, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_RIGHT, "%i", templ[game.user_player_index][template_index].data_cost);

// core->build_cooldown_time = w.world_time + ((templ[core->player_index][build_template].build_cooldown_time / core->number_of_build_objects + 1) * EXECUTION_COUNT); // number_of_build_objects has been confirmed to be non-zero above

}
else
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_MED], view.build_buttons_x1 + 22, button_y + (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_LEFT, "empty");
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_MED], view.build_buttons_x1 + 22, text_y, ALLEGRO_ALIGN_LEFT, "empty");
template_index++;
// template_index %= TEMPLATES_PER_PLAYER;
}
Expand Down Expand Up @@ -582,7 +584,7 @@ c = CONSOLE_SYSTEM; // system console gets special minimalist treatment:
al_draw_textf(font[FONT_BASIC].fnt,
colours.base_trans [COL_YELLOW] [SHADE_MAX] [TRANS_MED],
view.build_buttons_x2 - 26,
button_y - (queue_button_highlight_mouseover * BUILD_BUTTON_H) + 11,
button_y - (queue_button_highlight_mouseover * BUILD_BUTTON_H) + scaleUI_y(FONT_BASIC,8),
ALLEGRO_ALIGN_CENTRE,
"X");

Expand All @@ -593,10 +595,10 @@ c = CONSOLE_SYSTEM; // system console gets special minimalist treatment:

template_index = w.player[game.user_player_index].build_queue[i].template_index;
sancheck(template_index, 0, TEMPLATES_PER_PLAYER, "console template_index");
al_draw_textf(font[FONT_BASIC].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 10, button_y - (i * BUILD_BUTTON_H) + 12, ALLEGRO_ALIGN_LEFT, "%i", w.player[game.user_player_index].build_queue[i].core_index);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 32, button_y - (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_LEFT, "%s", templ[game.user_player_index][template_index].name);
al_draw_textf(font[FONT_BASIC].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 10, button_y - (i * BUILD_BUTTON_H) + scaleUI_y(FONT_BASIC,9), ALLEGRO_ALIGN_LEFT, "%i", w.player[game.user_player_index].build_queue[i].core_index);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 32, button_y - (i * BUILD_BUTTON_H) + scaleUI_y(FONT_SQUARE,7), ALLEGRO_ALIGN_LEFT, "%s", templ[game.user_player_index][template_index].name);
if (w.player[game.user_player_index].build_queue[i].repeat)
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_TURQUOISE] [SHADE_MAX] [TRANS_THICK], view.build_buttons_x2 - 8, button_y - (i * BUILD_BUTTON_H) + 10, ALLEGRO_ALIGN_RIGHT, "+");
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_TURQUOISE] [SHADE_MAX] [TRANS_THICK], view.build_buttons_x2 - 8, button_y - (i * BUILD_BUTTON_H) + scaleUI_y(FONT_SQUARE,7), ALLEGRO_ALIGN_RIGHT, "+");

}

Expand All @@ -608,7 +610,7 @@ c = CONSOLE_SYSTEM; // system console gets special minimalist treatment:



al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 5, button_y + BUILD_BUTTON_H + 10, ALLEGRO_ALIGN_LEFT, "%s", queue_header_text);
al_draw_textf(font[FONT_SQUARE].fnt, colours.base_trans [COL_GREY] [SHADE_HIGH] [TRANS_THICK], view.build_buttons_x1 + 5, button_y + BUILD_BUTTON_H + scaleUI_y(FONT_SQUARE,7), ALLEGRO_ALIGN_LEFT, "%s", queue_header_text);
}


Expand Down
2 changes: 1 addition & 1 deletion src/i_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void reset_view_values(int window_w, int window_h)


view.data_box_close_button_x2 = window_w - 10 - scaleUI_x(FONT_SQUARE,3);
view.data_box_close_button_y2 = view.data_box_close_button_y1 + scaleUI_x(FONT_SQUARE,22) - 6;//scaleUI_y(FONT_BASIC,136);
view.data_box_close_button_y2 = view.data_box_close_button_y1 + scaleUI_x(FONT_SQUARE,16) + 6;// - 6;//scaleUI_y(FONT_BASIC,136);

}

0 comments on commit 5ab063a

Please sign in to comment.