Skip to content

Commit

Permalink
Merge pull request #37 from linleyh/Version-1.3
Browse files Browse the repository at this point in the history
Version 1.3 - bytecode watch (debugger) added
  • Loading branch information
linleyh authored Apr 15, 2017
2 parents 04d1aee + 4c21f97 commit 412fa4f
Show file tree
Hide file tree
Showing 47 changed files with 4,195 additions and 278 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# liberation-circuit

version: 1.1
version: 1.3

This the release version of Liberation Circuit, an RTS/programming game.

Expand Down
44 changes: 40 additions & 4 deletions bin/Manual.html

Large diffs are not rendered by default.

Binary file modified bin/data/images/fwss_font.bmp
Binary file not shown.
Binary file modified bin/data/images/fwss_font_M.bmp
Binary file not shown.
Binary file added bin/data/manual/bcode_panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bin/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# liberation-circuit

version: 1.2
version: 1.3

This is Liberation Circuit, an RTS/programming game.

Expand Down
5 changes: 4 additions & 1 deletion src/c_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "t_template.h"

#include "v_interp.h"
#include "v_init_panel.h"

extern struct call_type_struct call_type [CALL_TYPES];
extern struct cmethod_call_type_struct cmethod_call_type [CMETHOD_CALL_TYPES];
Expand Down Expand Up @@ -100,7 +101,7 @@ struct instruction_set_struct instruction_set [INSTRUCTIONS] =

{"return_sub", 0}, // OP_return_sub,

{"switchA", 3, {OPERAND_TYPE_NUMBER, OPERAND_TYPE_NUMBER, OPERAND_TYPE_NUMBER}}, // OP_switchA,
{"switchA", 3, {OPERAND_TYPE_BCODE_ADDRESS, OPERAND_TYPE_NUMBER, OPERAND_TYPE_NUMBER}}, // OP_switchA,

// process comparisons: (not sure these are used)
{"pcomp_eq", 0}, // OP_pcomp_eq
Expand Down Expand Up @@ -272,6 +273,7 @@ int compile(struct template_struct* templ, struct source_edit_struct* source_edi
if (check_template_objects(templ, 1)) // returns 1 on error
completed = 0;
calculate_template_cost_and_power(templ);
prepare_template_debug(templ->player_index, templ->template_index, 1); // ,1 means that the debug template will include identifier information
break;
case COMPILE_MODE_LOCK:
copy_template(templ, &compiled_template, (templ->locked == 0));
Expand All @@ -288,6 +290,7 @@ int compile(struct template_struct* templ, struct source_edit_struct* source_edi
if (check_template_objects(templ, 1)) // returns 1 on error
success = 0;
calculate_template_cost_and_power(templ);
prepare_template_debug(templ->player_index, templ->template_index, 1); // ,1 means that the debug template will include identifier information
break;
}

Expand Down
6 changes: 6 additions & 0 deletions src/c_generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ int intercode_to_bcode(void)
}
else
write_bcode(cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].false_point_bcode); // address known
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].false_point_used = 1;
break;
case IC_IFTRUE_JUMP_TO_EXIT_POINT:
write_bcode(OP_iftrue_jump);
Expand All @@ -147,6 +148,7 @@ int intercode_to_bcode(void)
}
else
write_bcode(cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_bcode); // address known
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_used = 1;
break;
case IC_JUMP_EXIT_POINT_TRUE:
write_bcode(OP_jump_num);
Expand All @@ -158,6 +160,7 @@ int intercode_to_bcode(void)
}
else
write_bcode(cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_bcode); // address known
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_used = 1;
break;
case IC_JUMP_EXIT_POINT_FALSE:
write_bcode(OP_jump_num);
Expand All @@ -169,6 +172,7 @@ int intercode_to_bcode(void)
}
else
write_bcode(cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].false_point_bcode); // address known
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].false_point_used = 1;
break;
case IC_NUMBER:
write_bcode(cstate.intercode[cstate.ic_pos].value [0]);
Expand All @@ -179,6 +183,7 @@ int intercode_to_bcode(void)
return 0;
write_bcode(cstate.intercode[cstate.ic_pos].value [1]);
write_bcode(cstate.intercode[cstate.ic_pos].value [2]);
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_used = 1;
break;
case IC_JUMP_TABLE:
// this just writes a number (to be used by switch code), no instruction.
Expand All @@ -192,6 +197,7 @@ int intercode_to_bcode(void)
}
else
write_bcode(cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_bcode); // address known
cstate.expoint[cstate.intercode[cstate.ic_pos].value [0]].true_point_used = 1;
break;

default:
Expand Down
1 change: 1 addition & 0 deletions src/c_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int init_compiler(struct template_struct* templ, int compiler_mode)

for (i = USER_IDENTIFIERS; i < IDENTIFIERS; i ++)
{
identifier[i].type = CTOKEN_TYPE_NONE;
identifier[i].address = -1;
identifier[i].value = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/e_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ struct submenustruct submenu [SUBMENUS] =
{
SUBMENU_COMPILE_END,
{
{"Test Compile", "Shift-F9"},
{"Compile", "F9"},
{"Test Compile", "Shift-F10"},
{"Compile", "F10"},
{"Compile+lock", ""},
// {"Build asm", "", HELP_SUBMENU_BUILD_ASM},
// {"Crunched asm", "", HELP_SUBMENU_CRUNCH_ASM},
Expand Down Expand Up @@ -2779,7 +2779,7 @@ static void cursor_etc_key(int key_press)
// case SPECIAL_KEY_F8:
// submenu_operation(SUBMENU_COMPILE, SUBMENU_COMPILE_TEST);
// break;
case SPECIAL_KEY_F9:
case SPECIAL_KEY_F10:
if (ex_control.special_key_press [SPECIAL_KEY_SHIFT])
submenu_operation(SUBMENU_COMPILE, SUBMENU_COMPILE_TEST);
else
Expand Down
2 changes: 1 addition & 1 deletion src/e_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ SCHAR_ERROR
#define EDIT_LINE_OFFSET 2
#define LOG_WINDOW_H scaleUI_y(FONT_BASIC,120)

#define LOG_LINE_LENGTH 80
#define LOG_LINE_LENGTH 120
#define LOG_LINES 40

#define LOG_LINE_HEIGHT (font[FONT_BASIC].height + 3)
Expand Down
17 changes: 12 additions & 5 deletions src/e_help.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ void print_keyword_help(int keyword_index)

#endif

print_help_string(keyword_help [keyword_index]);

}


void print_help_string(const char* help_str)
{

// Need to go through and break down the help_string strings into printable bits:

Expand All @@ -543,8 +550,8 @@ void print_keyword_help(int keyword_index)
while(TRUE)
{

print_word [k] = keyword_help [keyword_index] [i];
if (keyword_help [keyword_index] [i] == ' ')
print_word [k] = help_str [i];
if (help_str [i] == ' ')
{
if (k + j >= PRINT_STR_LENGTH - 1)
{
Expand All @@ -563,8 +570,8 @@ void print_keyword_help(int keyword_index)
}
}

if (keyword_help [keyword_index] [i] == '\n'
|| keyword_help [keyword_index] [i] == '\0')
if (help_str [i] == '\n'
|| help_str [i] == '\0')
{
if (k + j >= PRINT_STR_LENGTH - 1)
{
Expand All @@ -587,7 +594,7 @@ void print_keyword_help(int keyword_index)
k = -1;
}
}
if (keyword_help [keyword_index] [i] == '\0')
if (help_str [i] == '\0')
{
if (strlen(print_str) != 0)
write_line_to_log(print_str, MLOG_COL_HELP);
Expand Down
1 change: 1 addition & 0 deletions src/e_help.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,6 @@ HELP_STRINGS // must be last
*/
//void print_help(int help_type);
void editor_help_click(struct source_edit_struct* se, int source_line, int source_pos);
void print_help_string(const char* help_str);

#endif
3 changes: 2 additions & 1 deletion src/e_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void init_log(void) // int w_pixels, int h_pixels)
mlog_col [MLOG_COL_FILE] = al_map_rgb(100, 200, 150);
mlog_col [MLOG_COL_ERROR] = al_map_rgb(200, 120, 120);
mlog_col [MLOG_COL_WARNING] = al_map_rgb(180, 130, 130);
mlog_col [MLOG_COL_HELP] = al_map_rgb(170, 185, 200);
mlog_col [MLOG_COL_HELP] = al_map_rgb(100, 135, 180);
// mlog_col [MLOG_COL_HELP] = al_map_rgb(170, 185, 200);



Expand Down
8 changes: 4 additions & 4 deletions src/e_slider.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,13 @@ void draw_scrollbar(int s)
if (highlight == POINTER_BUTTON_LESS)
al_draw_filled_rectangle(x1 + 1, y1 + 1, x2 - 1, y1 + SLIDER_BUTTON_SIZE, colours.base [sl->colour] [SHADE_LOW]);
al_draw_rectangle(x1 + 1, y1 + 1, x2 - 1, y1 + SLIDER_BUTTON_SIZE, colours.base [sl->colour] [SHADE_MED], 1);
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], x1 + 9, y1 + 8, ALLEGRO_ALIGN_CENTRE, "^");
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], (int) x1 + 9, (int) y1 + 8, ALLEGRO_ALIGN_CENTRE, "^");
// al_draw_line(x1 + 9, y1 + 7, x1 + 6, y1 + 12, colours.base [sl->colour] [SHADE_MED], 1);
// al_draw_line(x1 + 9, y1 + 7, x1 + 12, y1 + 12, colours.base [sl->colour] [SHADE_MED], 1);
// al_draw_triangle(x1 + 5, y1 + SLIDER_BUTTON_SIZE - 6, x1 + (SLIDER_BUTTON_SIZE/2) - 1, y1 + 5, x2 - 7, y1 + SLIDER_BUTTON_SIZE - 6, colours.base [sl->colour] [SHADE_MED], 1);
if (highlight == POINTER_BUTTON_MORE)
al_draw_filled_rectangle(x1 + 1, y2 - SLIDER_BUTTON_SIZE, x2 - 1, y2 - 1, colours.base [sl->colour] [SHADE_LOW]);
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], x1 + 9, y2 - SLIDER_BUTTON_SIZE + 2, ALLEGRO_ALIGN_CENTRE, "%s", down_arrow);
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], (int) x1 + 9, (int) y2 - SLIDER_BUTTON_SIZE + 2, ALLEGRO_ALIGN_CENTRE, "%s", down_arrow);
al_draw_rectangle(x1 + 1, y2 - SLIDER_BUTTON_SIZE, x2 - 1, y2 - 1, colours.base [sl->colour] [SHADE_MED], 1);

// draw slider:
Expand All @@ -301,12 +301,12 @@ void draw_scrollbar(int s)
// draw a button at each end:
if (highlight == POINTER_BUTTON_LESS)
al_draw_filled_rectangle(x1 + 1, y1 + 1, x1 + SLIDER_BUTTON_SIZE, y2 - 1, colours.base [sl->colour] [SHADE_LOW]);
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], x1 + 10, y1 + 5, ALLEGRO_ALIGN_CENTRE, "<");
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], (int) x1 + 10, (int) y1 + 5, ALLEGRO_ALIGN_CENTRE, "<");
al_draw_rectangle(x1 + 1, y1 + 1, x1 + SLIDER_BUTTON_SIZE, y2 - 1, colours.base [sl->colour] [SHADE_MED], 1);

if (highlight == POINTER_BUTTON_MORE)
al_draw_filled_rectangle(x2 - SLIDER_BUTTON_SIZE, y1 + 1, x2 - 1, y2 - 1, colours.base [sl->colour] [SHADE_LOW]);
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], x2 - 8, y1 + 5, ALLEGRO_ALIGN_CENTRE, ">");
al_draw_textf(font[FONT_BASIC_UNSCALED].fnt, colours.base [sl->colour] [SHADE_MED], (int) x2 - 8, (int) y1 + 5, ALLEGRO_ALIGN_CENTRE, ">");
al_draw_rectangle(x2 - SLIDER_BUTTON_SIZE, y1 + 1, x2 - 1, y2 - 1, colours.base [sl->colour] [SHADE_MED], 1);

// al_draw_rectangle(x1 + 1, y1 + 1, x1 + SLIDER_BUTTON_SIZE, y2 - 1, colours.base [sl->colour] [SHADE_MED], 1);
Expand Down
5 changes: 4 additions & 1 deletion src/e_slider.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ SLIDER_DESIGN_SCROLLBAR_V,
SLIDER_DESIGN_SCROLLBAR_H,
SLIDER_EDITOR_SCROLLBAR_V,
SLIDER_EDITOR_SCROLLBAR_H,

SLIDER_BCODE_BCODE_SCROLLBAR_V,
SLIDER_BCODE_MEMORY_SCROLLBAR_V,
SLIDER_BCODE_TARGET_SCROLLBAR_V,
SLIDER_BCODE_STACK_SCROLLBAR_V,
SLIDERS
};

Expand Down
48 changes: 34 additions & 14 deletions src/g_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,27 @@ void run_commands(void)
}
else
{


if (!shift_pressed
&& !check_clicked_on_data_well(mouse_x_fixed, mouse_y_fixed)) // won't treat click as a data well click if pressing shift
&& !check_clicked_on_data_well(mouse_x_fixed, mouse_y_fixed) // won't treat click as a data well click if pressing shift
&& inter.mode_button_highlight_time < inter.running_time) // don't deselect if user clicked a mode button
// && (control.mouse_x_screen_pixels < inter.mode_buttons_x1 - (MODE_BUTTON_SIZE + MODE_BUTTON_SPACING) * MODE_BUTTONS
// || control.mouse_y_screen_pixels > inter.mode_buttons_y1 + (MODE_BUTTON_SIZE + 3)
// || control.mouse_y_screen_pixels < inter.mode_buttons_y1 - 5
// || control.mouse_x_screen_pixels > inter.mode_buttons_x1))
clear_selection();



//if (control.mouse_y_screen_pixels < inter.mode_buttons_y1 + (MODE_BUTTON_SIZE + 3)
//&& control.mouse_y_screen_pixels > inter.mode_buttons_y1 - 5
//&& control.mouse_x_screen_pixels >= inter.mode_buttons_x1 - (MODE_BUTTON_SIZE + MODE_BUTTON_SPACING) * MODE_BUTTONS) //inter.display_w - ((MODE_BUTTON_SIZE + MODE_BUTTON_SPACING) * MODE_BUTTONS))
// {
// mode_button_input();
// }


}
command.select_box = 1;
command.mouse_drag_world_x = mouse_x_fixed;
Expand Down Expand Up @@ -732,6 +750,17 @@ void run_commands(void)

} // end if mouse on main panel

} // end else (mouse on map)
} // end if (mouse on game display)
else
{
command.select_box = 0;
// command.
// anything to cancel here if mouse not on display?
}

skip_main_mouse_input: // this is the target of some gotos above that skip most mouse input because the mouse is on the map or console etc

if (view.following
&& (command.select_mode == SELECT_MODE_SINGLE_CORE
|| command.select_mode == SELECT_MODE_MULTI_CORE))
Expand All @@ -745,7 +774,8 @@ void run_commands(void)
}

if (view.screen_shake_time > w.world_time
&& game.pause_soft == 0)
&& !game.pause_soft
&& game.watching != WATCH_PAUSED_TO_WATCH)
{
int screen_shake_amount = view.screen_shake_time - w.world_time;
view.camera_x += al_itofix(grand(screen_shake_amount) - grand(screen_shake_amount));
Expand All @@ -763,17 +793,6 @@ void run_commands(void)
view.camera_y = view.camera_y_max;


} // end else (mouse on map)
} // end if (mouse on game display)
else
{
command.select_box = 0;
// command.
// anything to cancel here if mouse not on display?
}

skip_main_mouse_input: // this is the target of some gotos above that skip most mouse input because the mouse is on the map or console etc


// make sure anything selected is still visible:
if (command.select_mode != SELECT_MODE_SINGLE_CORE
Expand Down Expand Up @@ -806,7 +825,8 @@ void run_commands(void)

// if a single core is selected, maintain the stress/power record:
if (command.select_mode == SELECT_MODE_SINGLE_CORE
&& game.pause_soft == 0
&& !game.pause_soft
&& game.watching != WATCH_PAUSED_TO_WATCH
&& w.core[command.selected_core [0]].last_execution_timestamp == w.world_time - 15)
{
sancheck(command.selected_core [0], 0, w.max_cores, "command.selected_core [0]");
Expand Down
Loading

0 comments on commit 412fa4f

Please sign in to comment.