Skip to content

Commit 72bcaf3

Browse files
authored
Merge pull request #300 from TruncateGame/main
Production release
2 parents 6c32d8e + d5c82a9 commit 72bcaf3

26 files changed

+1895
-72
lines changed

.backstage/build-tile-data.js

+31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22

33
const fs = require("fs");
44
const path = require("path");
5+
const { Jimp } = require("jimp");
6+
7+
async function processImage() {
8+
const IMAGE_INPUT_PATH = path.join(
9+
__dirname,
10+
"../truncate_client/img/truncate_packed_pre.png",
11+
);
12+
const IMAGE_OUTPUT_PATH = path.join(
13+
__dirname,
14+
"../truncate_client/img/truncate_packed.png",
15+
);
16+
17+
const image = await Jimp.read(IMAGE_INPUT_PATH);
18+
19+
image.scan((x, y, idx) => {
20+
const red = image.bitmap.data[idx + 0];
21+
const green = image.bitmap.data[idx + 1];
22+
const blue = image.bitmap.data[idx + 2];
23+
24+
// Find pure magenta and make it transparent
25+
if (red === 255 && green === 0 && blue === 255) {
26+
image.bitmap.data[idx + 3] = 0;
27+
}
28+
});
29+
30+
await image.write(IMAGE_OUTPUT_PATH);
31+
}
32+
33+
processImage().catch((err) => {
34+
console.error("Error processing image:", err);
35+
});
536

637
const INPUT_FILE = path.join(__dirname, "../truncate_client/img/tile_order");
738
const OUTPUT_RUST = path.join(

.backstage/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"devDependencies": {
3+
"jimp": "^1.6.0"
4+
}
5+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ kaikki*
66
node_modules
77
word_definitions/package-lock.json
88
truncate_client/img/package-lock.json
9+
truncate_client/img/truncate_packed_pre.png
910
_site
1011
# ungzipped word definition db
1112
defs.db
@@ -18,3 +19,4 @@ dict_builder/support_data/generated_scowl_wordlists
1819
dict_builder/support_data/en_word_freqs.txt
1920
dict_builder/support_data/objectionable.json
2021
dict_builder/support_data/wordnik_wordlist.txt
22+
.backstage/package-lock.json

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ cd truncate_dueller && cargo run --release
9191
- **Trim Cels**: unchecked
9292
- **Extrude**: CHECKED!
9393
- **Output**:
94-
- **Output File**: `truncate_packed.png`
94+
- **Output File**: `truncate_packed_pre.png`
9595
- **JSON Data** unchecked
9696

97-
If you modified the tile order at all:
97+
Then:
9898
- Edit `truncate_client/img/tile_order` to match the new ordering of tiles
9999
- If you added something 32x32, and thus taking up four tiles, suffix their tile names with `_NW`, `_NE`, `_SW`, and `_SE`
100100
- From the root of the repo, run `.backstage/build-tile-data.js` to rerun the codegen for using tiles
101-
101+
- This also generates the final truncate_packed.png that slightly modified the export (e.g. removes magenta mask)

truncate_client/img/tile_order

+208
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,211 @@ TERRAIN_BUTTON_NW
194194
TERRAIN_BUTTON_NE
195195
TERRAIN_BUTTON_SW
196196
TERRAIN_BUTTON_SE
197+
LETTER_SOUTH_A_NW
198+
LETTER_SOUTH_A_NE
199+
LETTER_SOUTH_A_SW
200+
LETTER_SOUTH_A_SE
201+
LETTER_SOUTH_B_NW
202+
LETTER_SOUTH_B_NE
203+
LETTER_SOUTH_B_SW
204+
LETTER_SOUTH_B_SE
205+
LETTER_SOUTH_C_NW
206+
LETTER_SOUTH_C_NE
207+
LETTER_SOUTH_C_SW
208+
LETTER_SOUTH_C_SE
209+
LETTER_SOUTH_D_NW
210+
LETTER_SOUTH_D_NE
211+
LETTER_SOUTH_D_SW
212+
LETTER_SOUTH_D_SE
213+
LETTER_SOUTH_E_NW
214+
LETTER_SOUTH_E_NE
215+
LETTER_SOUTH_E_SW
216+
LETTER_SOUTH_E_SE
217+
LETTER_SOUTH_F_NW
218+
LETTER_SOUTH_F_NE
219+
LETTER_SOUTH_F_SW
220+
LETTER_SOUTH_F_SE
221+
LETTER_SOUTH_G_NW
222+
LETTER_SOUTH_G_NE
223+
LETTER_SOUTH_G_SW
224+
LETTER_SOUTH_G_SE
225+
LETTER_SOUTH_H_NW
226+
LETTER_SOUTH_H_NE
227+
LETTER_SOUTH_H_SW
228+
LETTER_SOUTH_H_SE
229+
LETTER_SOUTH_I_NW
230+
LETTER_SOUTH_I_NE
231+
LETTER_SOUTH_I_SW
232+
LETTER_SOUTH_I_SE
233+
LETTER_SOUTH_J_NW
234+
LETTER_SOUTH_J_NE
235+
LETTER_SOUTH_J_SW
236+
LETTER_SOUTH_J_SE
237+
LETTER_SOUTH_K_NW
238+
LETTER_SOUTH_K_NE
239+
LETTER_SOUTH_K_SW
240+
LETTER_SOUTH_K_SE
241+
LETTER_SOUTH_L_NW
242+
LETTER_SOUTH_L_NE
243+
LETTER_SOUTH_L_SW
244+
LETTER_SOUTH_L_SE
245+
LETTER_SOUTH_M_NW
246+
LETTER_SOUTH_M_NE
247+
LETTER_SOUTH_M_SW
248+
LETTER_SOUTH_M_SE
249+
LETTER_SOUTH_N_NW
250+
LETTER_SOUTH_N_NE
251+
LETTER_SOUTH_N_SW
252+
LETTER_SOUTH_N_SE
253+
LETTER_SOUTH_O_NW
254+
LETTER_SOUTH_O_NE
255+
LETTER_SOUTH_O_SW
256+
LETTER_SOUTH_O_SE
257+
LETTER_SOUTH_P_NW
258+
LETTER_SOUTH_P_NE
259+
LETTER_SOUTH_P_SW
260+
LETTER_SOUTH_P_SE
261+
LETTER_SOUTH_Q_NW
262+
LETTER_SOUTH_Q_NE
263+
LETTER_SOUTH_Q_SW
264+
LETTER_SOUTH_Q_SE
265+
LETTER_SOUTH_R_NW
266+
LETTER_SOUTH_R_NE
267+
LETTER_SOUTH_R_SW
268+
LETTER_SOUTH_R_SE
269+
LETTER_SOUTH_S_NW
270+
LETTER_SOUTH_S_NE
271+
LETTER_SOUTH_S_SW
272+
LETTER_SOUTH_S_SE
273+
LETTER_SOUTH_T_NW
274+
LETTER_SOUTH_T_NE
275+
LETTER_SOUTH_T_SW
276+
LETTER_SOUTH_T_SE
277+
LETTER_SOUTH_U_NW
278+
LETTER_SOUTH_U_NE
279+
LETTER_SOUTH_U_SW
280+
LETTER_SOUTH_U_SE
281+
LETTER_SOUTH_V_NW
282+
LETTER_SOUTH_V_NE
283+
LETTER_SOUTH_V_SW
284+
LETTER_SOUTH_V_SE
285+
LETTER_SOUTH_W_NW
286+
LETTER_SOUTH_W_NE
287+
LETTER_SOUTH_W_SW
288+
LETTER_SOUTH_W_SE
289+
LETTER_SOUTH_X_NW
290+
LETTER_SOUTH_X_NE
291+
LETTER_SOUTH_X_SW
292+
LETTER_SOUTH_X_SE
293+
LETTER_SOUTH_Y_NW
294+
LETTER_SOUTH_Y_NE
295+
LETTER_SOUTH_Y_SW
296+
LETTER_SOUTH_Y_SE
297+
LETTER_SOUTH_Z_NW
298+
LETTER_SOUTH_Z_NE
299+
LETTER_SOUTH_Z_SW
300+
LETTER_SOUTH_Z_SE
301+
LETTER_NORTH_A_NW
302+
LETTER_NORTH_A_NE
303+
LETTER_NORTH_A_SW
304+
LETTER_NORTH_A_SE
305+
LETTER_NORTH_B_NW
306+
LETTER_NORTH_B_NE
307+
LETTER_NORTH_B_SW
308+
LETTER_NORTH_B_SE
309+
LETTER_NORTH_C_NW
310+
LETTER_NORTH_C_NE
311+
LETTER_NORTH_C_SW
312+
LETTER_NORTH_C_SE
313+
LETTER_NORTH_D_NW
314+
LETTER_NORTH_D_NE
315+
LETTER_NORTH_D_SW
316+
LETTER_NORTH_D_SE
317+
LETTER_NORTH_E_NW
318+
LETTER_NORTH_E_NE
319+
LETTER_NORTH_E_SW
320+
LETTER_NORTH_E_SE
321+
LETTER_NORTH_F_NW
322+
LETTER_NORTH_F_NE
323+
LETTER_NORTH_F_SW
324+
LETTER_NORTH_F_SE
325+
LETTER_NORTH_G_NW
326+
LETTER_NORTH_G_NE
327+
LETTER_NORTH_G_SW
328+
LETTER_NORTH_G_SE
329+
LETTER_NORTH_H_NW
330+
LETTER_NORTH_H_NE
331+
LETTER_NORTH_H_SW
332+
LETTER_NORTH_H_SE
333+
LETTER_NORTH_I_NW
334+
LETTER_NORTH_I_NE
335+
LETTER_NORTH_I_SW
336+
LETTER_NORTH_I_SE
337+
LETTER_NORTH_J_NW
338+
LETTER_NORTH_J_NE
339+
LETTER_NORTH_J_SW
340+
LETTER_NORTH_J_SE
341+
LETTER_NORTH_K_NW
342+
LETTER_NORTH_K_NE
343+
LETTER_NORTH_K_SW
344+
LETTER_NORTH_K_SE
345+
LETTER_NORTH_L_NW
346+
LETTER_NORTH_L_NE
347+
LETTER_NORTH_L_SW
348+
LETTER_NORTH_L_SE
349+
LETTER_NORTH_M_NW
350+
LETTER_NORTH_M_NE
351+
LETTER_NORTH_M_SW
352+
LETTER_NORTH_M_SE
353+
LETTER_NORTH_N_NW
354+
LETTER_NORTH_N_NE
355+
LETTER_NORTH_N_SW
356+
LETTER_NORTH_N_SE
357+
LETTER_NORTH_O_NW
358+
LETTER_NORTH_O_NE
359+
LETTER_NORTH_O_SW
360+
LETTER_NORTH_O_SE
361+
LETTER_NORTH_P_NW
362+
LETTER_NORTH_P_NE
363+
LETTER_NORTH_P_SW
364+
LETTER_NORTH_P_SE
365+
LETTER_NORTH_Q_NW
366+
LETTER_NORTH_Q_NE
367+
LETTER_NORTH_Q_SW
368+
LETTER_NORTH_Q_SE
369+
LETTER_NORTH_R_NW
370+
LETTER_NORTH_R_NE
371+
LETTER_NORTH_R_SW
372+
LETTER_NORTH_R_SE
373+
LETTER_NORTH_S_NW
374+
LETTER_NORTH_S_NE
375+
LETTER_NORTH_S_SW
376+
LETTER_NORTH_S_SE
377+
LETTER_NORTH_T_NW
378+
LETTER_NORTH_T_NE
379+
LETTER_NORTH_T_SW
380+
LETTER_NORTH_T_SE
381+
LETTER_NORTH_U_NW
382+
LETTER_NORTH_U_NE
383+
LETTER_NORTH_U_SW
384+
LETTER_NORTH_U_SE
385+
LETTER_NORTH_V_NW
386+
LETTER_NORTH_V_NE
387+
LETTER_NORTH_V_SW
388+
LETTER_NORTH_V_SE
389+
LETTER_NORTH_W_NW
390+
LETTER_NORTH_W_NE
391+
LETTER_NORTH_W_SW
392+
LETTER_NORTH_W_SE
393+
LETTER_NORTH_X_NW
394+
LETTER_NORTH_X_NE
395+
LETTER_NORTH_X_SW
396+
LETTER_NORTH_X_SE
397+
LETTER_NORTH_Y_NW
398+
LETTER_NORTH_Y_NE
399+
LETTER_NORTH_Y_SW
400+
LETTER_NORTH_Y_SE
401+
LETTER_NORTH_Z_NW
402+
LETTER_NORTH_Z_NE
403+
LETTER_NORTH_Z_SW
404+
LETTER_NORTH_Z_SE

truncate_client/img/truncate.aseprite

6.65 KB
Binary file not shown.
19.2 KB
Loading

truncate_client/src/app_inner.rs

+11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::{
1717
lobby::Lobby,
1818
native_menu::render_native_menu_if_required,
1919
replayer::ReplayerState,
20+
rules::{RuleCardAction, RulesState},
2021
single_player::SinglePlayerState,
2122
tutorial::TutorialState,
2223
},
@@ -33,6 +34,7 @@ pub enum GameStatus {
3334
None(RoomCode, Option<TruncateToken>),
3435
Generator(GeneratorState),
3536
Tutorial(TutorialState),
37+
Rules(RulesState),
3638
PendingSinglePlayer(Lobby),
3739
SinglePlayer(SinglePlayerState),
3840
PendingDaily,
@@ -409,6 +411,15 @@ pub fn render(outer: &mut OuterApplication, ui: &mut egui::Ui, current_time: Dur
409411
GameStatus::Replay(replay) => {
410412
replay.render(ui, &outer.theme, current_time, &outer.backchannel);
411413
}
414+
GameStatus::Rules(rules) => match rules.render(ui, &outer.theme, current_time) {
415+
Some(RuleCardAction::DailyPuzzle) => {
416+
outer.launched_code = Some("DAILY_PUZZLE".to_string())
417+
}
418+
Some(RuleCardAction::Tutorial) => {
419+
outer.launched_code = Some("TUTORIAL_RULES".to_string())
420+
}
421+
None => {}
422+
},
412423
GameStatus::HardError(msg) => {
413424
let splash = SplashUI::new(msg.clone()).with_button(
414425
"reload",

truncate_client/src/handle_launch_code.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ use truncate_core::{
1111
use crate::{
1212
app_inner::GameStatus,
1313
regions::{
14-
active_game::HeaderType, lobby::Lobby, single_player::SinglePlayerState,
14+
active_game::HeaderType, lobby::Lobby, rules::RulesState, single_player::SinglePlayerState,
1515
tutorial::TutorialState,
1616
},
17-
utils::{self, daily::get_puzzle_day, macros::current_time},
17+
utils::{self, daily::get_puzzle_day, includes::rule_card, macros::current_time},
1818
};
1919

2020
use super::OuterApplication;
@@ -40,13 +40,22 @@ pub fn handle_launch_code(
4040
"TUTORIAL_RULES" => {
4141
return Some(GameStatus::Tutorial(TutorialState::new(
4242
"rules".to_string(),
43-
utils::includes::rules(outer.launched_at_day),
43+
utils::includes::tutorial(outer.launched_at_day),
4444
ui.ctx(),
4545
outer.map_texture.clone(),
4646
&outer.theme,
4747
outer.event_dispatcher.clone(),
4848
)));
4949
}
50+
"RULE_CARD" => {
51+
return Some(GameStatus::Rules(RulesState::new(
52+
ui.ctx(),
53+
outer.map_texture.clone(),
54+
outer.theme.clone(),
55+
rule_card(),
56+
outer.event_dispatcher.clone(),
57+
)));
58+
}
5059
"SINGLE_PLAYER" => {
5160
outer.event_dispatcher.event("single_player_lobby");
5261
let mut board = Board::new(9, 9);

truncate_client/src/lil_bits/board.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ impl<'a> BoardUI<'a> {
312312
orientation: if *square_player
313313
== gameplay.player_number as usize
314314
{
315-
Direction::North
316-
} else {
317315
Direction::South
316+
} else {
317+
Direction::North
318318
},
319319
}],
320320
aesthetics,

truncate_client/src/lil_bits/changes_splash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl ChangelogSplashUI {
9999
return;
100100
}
101101
let block_time = (current_time - self.animate_from).as_secs_f32();
102-
let animated_text = block.get_partial_slice(block_time, ui);
102+
let animated_text = block.get_partial_word_slice(block_time, ui);
103103

104104
match animated_text {
105105
Some(animated_block) => {

truncate_client/src/lil_bits/hand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a> HandUI<'a> {
8585
} else {
8686
None
8787
},
88-
orientation: truncate_core::board::Direction::North,
88+
orientation: truncate_core::board::Direction::South,
8989
}
9090
})
9191
.collect(),

truncate_client/src/regions/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ pub mod generator;
33
pub mod lobby;
44
pub mod native_menu;
55
pub mod replayer;
6+
pub mod rules;
67
pub mod single_player;
78
pub mod tutorial;

truncate_client/src/regions/native_menu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn render_native_menu_if_required(
3838
if ui.button("Tutorial: Rules").clicked() {
3939
return Some(GameStatus::Tutorial(TutorialState::new(
4040
"rules".to_string(),
41-
utils::includes::rules(outer.launched_at_day),
41+
utils::includes::tutorial(outer.launched_at_day),
4242
ui.ctx(),
4343
outer.map_texture.clone(),
4444
&outer.theme,

0 commit comments

Comments
 (0)