Skip to content

Commit

Permalink
updated to version 1.1
Browse files Browse the repository at this point in the history
- Added the "double_fonts" option (see init.txt) to set double-sized
fonts, mostly for very high-resolution displays. It is now much easier
to add different-sized fonts and have UI elements scale to the font
size.
- Updated the misleading help text for the interface object.
- Other minor changes and fixes.
  • Loading branch information
linleyh committed Mar 19, 2017
1 parent a4afa4c commit 1533b53
Show file tree
Hide file tree
Showing 20 changed files with 159 additions and 117 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# liberation-circuit
# liberation-circuit

version: 1.0
version: 1.1

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

Expand Down Expand Up @@ -82,7 +82,7 @@ $ libcirc
```

Text is pretty small on a Retina screen. But it looks and plays perfectly on a 11" or 13" MacBook Air (which are all non-retina).
If you are using a Retina screen, you may want to set the double_fonts option to make the text larger (edit init.txt to do this).


---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bin/Manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<div style="text-align: left;"><big style="font-weight: bold;"><big><big>Liberation Circuit</big></big></big><br>
</div>
<br>Copyright 2017 Linley Henzell<br><br>
Version: 1.0<br>
Version: 1.1<br>
<br>
<h1><a class="mozTocH1" name="mozTocId524339"></a><span class="chapter"> 1. Introduction</span></h1>
<br>Liberation Circuit is a game of fighting for control of a&nbsp;computer system
Expand Down
Binary file modified bin/data/images/fwt_font.bmp
Binary file not shown.
Binary file modified bin/data/images/fwt_font_L.bmp
Binary file not shown.
Binary file added bin/data/images/large_font_L.bmp
Binary file not shown.
58 changes: 38 additions & 20 deletions bin/readme.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
# liberation-circuit

Liberation Circuit
Copyright 2017 Linley Henzell

version: 1.0
version: 1.1

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

To play the prebuilt binaries on Windows, [download the latest release](https://github.com/linleyh/liberation-circuit/releases) and run `LibCirc.exe`.


To play the prebuilt binaries, run LibCirc.exe.
It should compile on any OS supported by Allegro 5 - to build, compile the c files in the source directory and link with Allegro 5. More detailed instructions are below. More detail about the source file structure is at the start of m_main.c.

- Manual.html has extensive detail about the game, including documentation for the in-game API.
The executable should go in the "bin" subdirectory (the same directory as the "init.txt" file). The game requires write access to this directory to save mission progress. If this isn't okay, you can specify a path in the fopen calls at about lines 2808 and 2860 of h_story.c.

- Edit init.txt to set screen resolution and other options (fullscreen, sound volume, key rebinding, colourblind mode etc).
Don't try to compile the .c files in the /proc or /story subdirectories! They are code used by the game itself.

- Manual.html has extensive detail about the game, including documentation for the in-game API.

--------------------------------------------------
- Edit init.txt to set screen resolution and other options (fullscreen, sound volume, key rebinding, colourblind mode etc).

It looks like this (this is github markdown):

To build the game yourself:
![a screenshot](http://i.imgur.com/pPIJ03I.png)

The game should compile on any OS supported by Allegro 5 - to build, compile the c files in the source directory and link with Allegro 5.
![another screenshot](http://i.imgur.com/QKWzkqA.png)

You will need the data files from the most recent release (on github). The executable needs to be in the main directory (the same one as the init.txt file).

Don't try to compile the .c files in the /proc or /story subdirectories! They are code used by the game itself.

The game requires write access to its home directory to save mission completion data (the msn.dat file). If this isn't okay, you can specify a path in the fopen calls at about lines 2808 and 2860 of h_story.c.


--------------------------------------------------


To build using do/redo (using the .do scripts by Nils Dagsson Moskopp):

To build Liberation Circuit on
any Unix-like OS like GNU/Linux, execute the “do” script.
Note that “do” always compiles all source files; if you want
to rebuild targets only when relevant source files have changed, you
should use “redo” instead. A version of “redo” can be obtained from
<http://news.dieweltistgarnichtso.net/bin/redo-sh.html> (written in
Bourne shell) or <http://jdebp.eu./Softwares/redo/> (written in C++).
To build Liberation Circuit on any Unix-like OS like GNU/Linux,
execute the “do” script. Note that “do” always compiles all source
files; if you want to rebuild targets only when relevant source files
have changed, you should use “redo” instead. A version of “redo” can
be obtained from <http://news.dieweltistgarnichtso.net/bin/redo-sh.html>
(written in Bourne shell) or <http://jdebp.eu./Softwares/redo/> (written
in C++).

Packages needed for Liberation Circuit on Debian GNU/Linux or Ubuntu:
- liballegro-acodec5-dev
Expand Down Expand Up @@ -70,6 +68,26 @@ To build using cmake (using the cmake scripts by Kyle Findlay; The following ins

---------------------------------------------------

To build on OSX (Sierra (10.12) with latest Homebrew and Xcode)

```
$ git clone https://github.com/linleyh/liberation-circuit.git
$ cd liberation-circuit
$ brew install allegro
$ ./do

$ cd bin

$ libcirc

```

If you are using a Retina screen, you may want to set the double_fonts option to make the text larger (edit init.txt to do this).


---------------------------------------------------



Thanks to:

Expand Down
2 changes: 1 addition & 1 deletion src/c_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ EXPOINT_TYPE_LOOP, // break jumps to false point; continue jumps to true point
EXPOINT_TYPE_SWITCH // break jumps to false point; can't be used with continue
};

#define EXPOINTS 300
#define EXPOINTS 600

struct expointstruct
{
Expand Down
18 changes: 9 additions & 9 deletions src/d_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ void draw_design_data(void)
#define LOWER_HELP_LINE lower_help_line

// float lower_help_line = panel[PANEL_DESIGN].y1 + panel[PANEL_DESIGN].subpanel[FSP_DESIGN_TOOLS_MAIN].y2 - 42;
float lower_help_line = panel[PANEL_LOG].y1 - 28;
float lower_help_line = panel[PANEL_LOG].y1 - scaleUI_y(FONT_SQUARE,14);

switch(dwindow.tools_open)
{
Expand All @@ -1191,7 +1191,7 @@ void draw_design_data(void)
// al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x + 150, base_y+3, ALLEGRO_ALIGN_LEFT, "Component data cost %i", dwindow.templ->member[dwindow.selected_member].data_cost);
// }
if (dwindow.templ->locked)
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE+14, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
/* else
{
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "Click and drag the core while holding shift to rotate it.");
Expand All @@ -1207,7 +1207,7 @@ void draw_design_data(void)
// al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x + 150, base_y+3, ALLEGRO_ALIGN_LEFT, "Component data cost %i", dwindow.templ->member[dwindow.selected_member].data_cost);
// }
if (dwindow.templ->locked)
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE+14, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
/* else
{
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "Click and drag the component while holding shift to rotate it.");
Expand All @@ -1219,7 +1219,7 @@ void draw_design_data(void)
case FSP_DESIGN_TOOLS_ACTIVE_LINK:
al_draw_textf(font[FONT_SQUARE].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, base_y+2, ALLEGRO_ALIGN_LEFT, "Object selected");
if (dwindow.templ->locked)
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE+14, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
/* else
{
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "Click and drag the object while holding shift to rotate it (some objects can't be rotated).");
Expand All @@ -1231,7 +1231,7 @@ void draw_design_data(void)
case FSP_DESIGN_TOOLS_AUTOCODE:
al_draw_textf(font[FONT_SQUARE].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, base_y+2, ALLEGRO_ALIGN_LEFT, "Choose process attack routine");
if (dwindow.templ->locked)
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE+14, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
al_draw_textf(font[FONT_BASIC].fnt, colours.base [COL_BLUE] [SHADE_MAX], base_x - 10, LOWER_HELP_LINE, ALLEGRO_ALIGN_LEFT, "This template is locked and can't be modified.");
break;
}

Expand Down Expand Up @@ -1304,9 +1304,9 @@ const char* object_description [OBJECT_TYPES] [3] =
{"Allows the process to build other processes.",
"Multiple build objects speed recovery time after building.",
""}, // OBJECT_TYPE_BUILD,
{"Generates an interface to protect this component.",
"Requires at least one interface_depth object.",
"Can't be placed on the core, or the same component as a move object."}, // OBJECT_TYPE_INTERFACE,
{"Generates an interface to protect the process.",
"However, the interface does not protect any component",
"with either an interface object or a move object."}, // OBJECT_TYPE_INTERFACE,
// {"Provides an interface buffer for use by interface objects.",
// "Multiple depth objects increase the size and recovery", // OBJECT_TYPE_INTERFACE_DEPTH,
//"speed of the buffer."}, // OBJECT_TYPE_INTERFACE_DEPTH,
Expand All @@ -1327,7 +1327,7 @@ const char* object_description [OBJECT_TYPES] [3] =
{"Fires a powerful stream of malicious data. Does",
"double damage against components not protected by",
"an interface. Can rotate to track its target."}, // OBJECT_TYPE_STREAM_DIR,
{"Long-range attacking object. Does maximum damage only near",
{"Long-range attacking object. Does full damage only near",
"maximum range.",
""}, // OBJECT_TYPE_SPIKE,
{"Repairs damage to components of this process, and restores",
Expand Down
2 changes: 2 additions & 0 deletions src/e_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ void write_number_to_log(int num) //, int source, int source_line)
start_log_line(source, source_line);
}*/

//fpr("\n num %i", num);

int current_length = strlen(mlog.log_line[mlog.lpos].text);

int space_left = mlog.w_letters - current_length;
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].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], x1 + 9, 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].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], x1 + 9, 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].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], x1 + 10, 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].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], x2 - 8, 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
20 changes: 11 additions & 9 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "e_slider.h"
#include "e_header.h"
#include "i_display.h"
#include "i_header.h"
#include "i_input.h"
#include "i_console.h"
#include "i_view.h"
Expand Down Expand Up @@ -47,6 +48,7 @@ extern struct world_init_struct w_init; // this is the world_init generated by w
extern struct template_struct templ [PLAYERS] [TEMPLATES_PER_PLAYER];
struct game_struct game;
extern struct command_struct command;
extern struct fontstruct font [FONTS];

void run_game(void);
void init_main_loop(void);
Expand Down Expand Up @@ -469,10 +471,10 @@ static void run_pregame(void)
// if (game.phase == GAME_PHASE_PREGAME)
// run_pregame();
if (control.mouse_panel == PANEL_MAIN
&& control.mouse_x_screen_pixels > view.window_x_unzoomed / 2 - 180
&& control.mouse_x_screen_pixels < view.window_x_unzoomed / 2 + 180
&& control.mouse_y_screen_pixels > view.window_y_unzoomed / 2 - 60
&& control.mouse_y_screen_pixels < view.window_y_unzoomed / 2 + 30
&& control.mouse_x_screen_pixels > view.window_x_unzoomed / 2 - scaleUI_x(FONT_SQUARE_LARGE, 180)
&& control.mouse_x_screen_pixels < view.window_x_unzoomed / 2 + scaleUI_x(FONT_SQUARE_LARGE, 180)
&& control.mouse_y_screen_pixels > view.window_y_unzoomed / 2 - scaleUI_y(FONT_SQUARE_LARGE, 60)
&& control.mouse_y_screen_pixels < view.window_y_unzoomed / 2 + scaleUI_y(FONT_SQUARE_LARGE, 30)
// for button dimensions, see also code in i_
&& control.mbutton_press [0] == BUTTON_JUST_PRESSED)
{
Expand Down Expand Up @@ -686,7 +688,7 @@ static int run_mission(void)
To begin, select the blue base process near the centre of the display (by left-clicking on it).");

write_mission_text(PRINT_COL_LBLUE,
"\n\n(For information about controls, open the system panel at any time by clicking on the Sy button in the top right of the display).");
"\n\n(For information about controls, or to quit, open the system panel at any time by clicking on the Sy button in the top right of the display).");

mission_state.phase = MPHASE1_SELECT;
break;
Expand Down Expand Up @@ -1164,10 +1166,10 @@ static int run_game_over(void)

if (game.game_over_time > 60
&& control.mouse_panel == PANEL_MAIN
&& control.mouse_x_screen_pixels > view.window_x_unzoomed / 2 - 180
&& control.mouse_x_screen_pixels < view.window_x_unzoomed / 2 + 180
&& control.mouse_y_screen_pixels > view.window_y_unzoomed / 2 - 60
&& control.mouse_y_screen_pixels < view.window_y_unzoomed / 2 + 30
&& control.mouse_x_screen_pixels > view.window_x_unzoomed / 2 - scaleUI_x(FONT_SQUARE_LARGE, 180)
&& control.mouse_x_screen_pixels < view.window_x_unzoomed / 2 + scaleUI_x(FONT_SQUARE_LARGE, 180)
&& control.mouse_y_screen_pixels > view.window_y_unzoomed / 2 - scaleUI_y(FONT_SQUARE_LARGE, 60)
&& control.mouse_y_screen_pixels < view.window_y_unzoomed / 2 + scaleUI_y(FONT_SQUARE_LARGE, 30)
// for button dimensions, see also code in i_
&& control.mbutton_press [0] == BUTTON_JUST_PRESSED)
{
Expand Down
10 changes: 10 additions & 0 deletions src/h_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ draws map etc and receives input.

#include "x_sound.h"

extern struct template_struct templ [PLAYERS] [TEMPLATES_PER_PLAYER];


enum
{
STORY_REGION_COL_BLUE,
Expand Down Expand Up @@ -439,6 +442,13 @@ void story_input(void)
run_game_from_menu();

reset_log();

for (i = 0; i < TEMPLATES_PER_PLAYER; i ++)
{
templ[0][i].locked = 0;
}


open_template(0, 0); // prevents a situation where the user has a player 1 template open then goes back to the story select screen

game.phase = GAME_PHASE_MENU;
Expand Down
Loading

0 comments on commit 1533b53

Please sign in to comment.