Skip to content

Commit

Permalink
Add #30: Shunt signals
Browse files Browse the repository at this point in the history
This is an initial application for shunt singals and related to #31. Closes #30
  • Loading branch information
telk5093 committed Jun 8, 2024
1 parent 2c7be93 commit 22293a4
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 12 deletions.
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
1.2.2
1.3.0
-----
* 추가: [JGRPP] 입환 신호기 [#30]
* 수정: [JGRPP] 복합, 출구 신호기 주의 표시 매개변수가 JGRPP 한정으로 적용되지 않던 현상
* 수정: [JGRPP] 프로그램 신호기가 기본 그래픽으로 보이는 현상 [#28]

Expand Down
52 changes: 41 additions & 11 deletions ko_signal_set.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ if (!extended_feature_test("action3_signals_custom_signal_sprites")) {
// Electric signals
#include "./src/electric.pnml"

// Shunt
#include "./src/shunt.pnml"

param[10] = reserve_sprites(1);
replace (param[10]) {
// No recolouring
Expand All @@ -168,8 +171,15 @@ replace (param[10]) {

// General signal switches
switch (FEAT_SIGNALS, SELF, sw_signal_types, [
// Recolouring by parameter
STORE_TEMP(param[10] + (hasbit(extra_callback_info2, 24) ? 1 : 0), 0x100),
((extra_callback_info2 & 0x00FFFF00) | signal_style)

// Assign signal type
(
(extra_callback_info2 & 0x0000FF00) // 00: electric, 01: semaphore
| (extra_callback_info2 & 0x00FF0000) // from 00, block, entry, exit, combo, path, oneway path, programmable, no-entry signals
| signal_style
)
]) {
// Signals
0x00000: sw_signal_block; // Block
Expand All @@ -180,17 +190,16 @@ switch (FEAT_SIGNALS, SELF, sw_signal_types, [
0x50000: sw_signal_oneway_path; // Oneway path
0x60000: sw_signal_programmable; // Programmable
0x70000: sw_signal_noentry; // No-entry
/*

// (Reserved) Shunt
0x00001: sw_shunt_block; // Block
0x10001: sw_shunt_entry; // Entry
0x20001: sw_shunt_exit; // Exit
0x30001: sw_shunt_combo; // Combo
0x40001: sw_shunt_path; // Path
0x50001: sw_shunt_oneway_path; // Oneway path
0x60001: sw_shunt_programmable; // Programmable
0x70001: sw_shunt_noentry; // No-entry
*/
0x40001: sw_shunt_single; // Path
0x70001: sw_shunt_single; // No-entry
0x40101: sw_shunt_multiple; // Path, semaphore
0x70101: sw_shunt_multiple; // No-entry, semaphore

0x40102: sw_shunt_position; // Path, semaphore
0x70102: sw_shunt_position; // No-entry, semaphore

CB_FAILED;
}

Expand All @@ -208,3 +217,24 @@ item (FEAT_SIGNALS, ko_signal_set, 0) {
sw_signal_types;
}
}

// Additional signals
item (FEAT_SIGNALS, custom_signals, 0) {
property {
define_style: 1;
style_name: string(STR_STYLE_SHUNT_COLOUR);
style_electric_enabled: bitmask(SIGNAL_TYPE_PBS, SIGNAL_TYPE_NO_ENTRY);
style_semaphore_enabled: bitmask(SIGNAL_TYPE_PBS, SIGNAL_TYPE_NO_ENTRY);
style_no_aspect_increase: 1;
style_always_reserve_through: 1;
style_lookahead_single_signal_only: 1;

define_style: 2;
style_name: string(STR_STYLE_SHUNT_POSITION);
style_electric_enabled: 0;
style_semaphore_enabled: bitmask(SIGNAL_TYPE_PBS, SIGNAL_TYPE_NO_ENTRY);
style_no_aspect_increase: 1;
style_always_reserve_through: 1;
style_lookahead_single_signal_only: 1;
}
}
6 changes: 6 additions & 0 deletions lang/english.lng
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ STR_PARAM_USE_BLUE_AS_OPEN_ONEWAY_PATH_DESC :If enabled, use blue signal fo
STR_PARAM_USE_BLUE_AS_OPEN_PROGRAMMABLE_NAME :Use blue signal for programmable signal
STR_PARAM_USE_BLUE_AS_OPEN_PROGRAMMABLE_DESC :If enabled, use blue signal for programmable signal instead of green.{}{ORANGE}It only affects in JGRPP{BLACK} (default: disabled)


# Shunt
STR_STYLE_SHUNT_COLOUR :Shunt (Colour)
STR_STYLE_SHUNT_POSITION :Shunt (Position light)


# Errors
STR_UNSUPPORTED_VERSION :This NewGRF requires OpenTTD JGRPP 0.43.0 or higher to experience full features like multi-aspect signals.
6 changes: 6 additions & 0 deletions lang/korean.lng
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ STR_PARAM_USE_BLUE_AS_OPEN_ONEWAY_PATH_DESC :이 설정을 켜면, 단방
STR_PARAM_USE_BLUE_AS_OPEN_PROGRAMMABLE_NAME :프로그램 신호기에 청색 신호 사용
STR_PARAM_USE_BLUE_AS_OPEN_PROGRAMMABLE_DESC :이 설정을 켜면, 단방향 경로 신호기에 녹색 신호 대신 청색 신호를 사용합니다.{}{ORANGE}JGRPP에서만 적용됩니다{BLACK} (기본값: 끔)


# Shunt
STR_STYLE_SHUNT_COLOUR :입환 (색등식)
STR_STYLE_SHUNT_POSITION :입환 (등열식)


# Errors
STR_UNSUPPORTED_VERSION :이 NewGRF의 모든 기능(eg. 다현시 신호)을 사용하려면 OpenTTD JGRPP 0.43.0 또는 그 이상의 버전이 필요합니다.
36 changes: 36 additions & 0 deletions src/shunt.pnml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*------------------------------------------------------------------------------
* 한국 신호기 세트(Korean Signal Set)
* https://github.com/KoreanGRF/KoreanSignalSet
------------------------------------------------------------------------------*/

// Templates for shunt signal
template shunt_signal(file, x, y) {
[x+0, y+0, 6, 9, -3, -7, file]
[x+15, y+0, 6, 9, -1, -7, file]
[x+30, y+0, 6, 9, -3, -7, file]
[x+45, y+0, 6, 9, -1, -6, file]
[x+60, y+0, 7, 9, -1, -7, file]
[x+75, y+0, 7, 9, -4, -7, file]
[x+90, y+0, 4, 9, -1, -7, file]
[x+105, y+0, 4, 9, -1, -7, file]
}

spriteset(set_shunt_multiple_off) { shunt_signal("./src/shunt/shunt.colour_multiple.png", 0, 0) }
spriteset(set_shunt_multiple_on) { shunt_signal("./src/shunt/shunt.colour_multiple.png", 0, 15) }
spriteset(set_shunt_single_off) { shunt_signal("./src/shunt/shunt.colour_single.png", 0, 0) }
spriteset(set_shunt_single_on) { shunt_signal("./src/shunt/shunt.colour_single.png", 0, 15) }
spriteset(set_shunt_position_off) { shunt_signal("./src/shunt/shunt.position.png", 0, 0) }
spriteset(set_shunt_position_on) { shunt_signal("./src/shunt/shunt.position.png", 0, 15) }

switch(FEAT_SIGNALS, SELF, sw_shunt_multiple, extra_callback_info2 & 0x000000FF) {
0: set_shunt_multiple_off;
set_shunt_multiple_on;
}
switch(FEAT_SIGNALS, SELF, sw_shunt_single, extra_callback_info2 & 0x000000FF) {
0: set_shunt_single_off;
set_shunt_single_on;
}
switch(FEAT_SIGNALS, SELF, sw_shunt_position, extra_callback_info2 & 0x000000FF) {
0: set_shunt_position_off;
set_shunt_position_on;
}
Binary file added src/shunt/shunt.colour_multiple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shunt/shunt.colour_single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/shunt/shunt.position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 22293a4

Please sign in to comment.