Skip to content

Commit

Permalink
Cleanup: codes
Browse files Browse the repository at this point in the history
  • Loading branch information
telk5093 committed Jun 8, 2024
1 parent e4b2d6a commit cf9c7ef
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 86 deletions.
42 changes: 31 additions & 11 deletions ko_signal_set.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ grf {
def_value: 1;
}

// Use caution signals(Y and YG) together
// Recolouring signals as blue poles if they have a route restriction program
use_routing_restriction {
type: bool;
name: string(STR_PARAM_USE_ROUTING_RESTRICTION_NAME);
Expand Down Expand Up @@ -151,6 +151,14 @@ if (!extended_feature_test("action3_signals_custom_signal_sprites")) {

param[10] = reserve_sprites(1);
replace (param[10]) {
// No recolouring
recolour_sprite {
0x84: 0x84;
0x85: 0x85;
0x86: 0x86;
}

// Recolouring for blue poles
recolour_sprite {
0x84: 0xC8;
0x85: 0xCA;
Expand All @@ -160,17 +168,29 @@ replace (param[10]) {

// General signal switches
switch (FEAT_SIGNALS, SELF, sw_signal_types, [
STORE_TEMP(param[10] + (hasbit(extra_callback_info2, 24) ? 0 : 1), 0x100),
((extra_callback_info2 & 0x00FFFF00) >> 8)
STORE_TEMP(param[10] + (hasbit(extra_callback_info2, 24) ? 1 : 0), 0x100),
((extra_callback_info2 & 0x00FFFF00) | signal_style)
]) {
0x000: sw_signal_block; // Block
0x100: sw_signal_entry; // Entry
0x200: sw_signal_exit; // Exit
0x300: sw_signal_combo; // Combo
0x400: sw_signal_path; // Path
0x500: sw_signal_oneway_path; // Oneway path
0x600: sw_signal_programmable; // Programmable
0x700: sw_signal_noentry; // No-entry
// Signals
0x00000: sw_signal_block; // Block
0x10000: sw_signal_entry; // Entry
0x20000: sw_signal_exit; // Exit
0x30000: sw_signal_combo; // Combo
0x40000: sw_signal_path; // Path
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
*/
CB_FAILED;
}

Expand Down
84 changes: 42 additions & 42 deletions src/electric.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@ template electric_signals_for_stable(file_red, file_green) {
}

// Block
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_block) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_block) {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.real.png", "./src/electric/block/B.real.png") }
} else {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.real.png", "./src/electric/block/G.real.png") }
}
} else {
if(use_blue_block) {
if (use_blue_block) {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.nonreal.png", "./src/electric/block/B.nonreal.png") }
} else {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.nonreal.png", "./src/electric/block/G.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_block) {
if (is_realistic) {
if (use_blue_block) {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.real.png", "./src/electric/block/B.real.png") }
} else {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.real.png", "./src/electric/block/G.real.png") }
}
} else {
if(use_blue_block) {
if (use_blue_block) {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.nonreal.png", "./src/electric/block/B.nonreal.png") }
} else {
replace(1275, "") { electric_signals_for_stable("./src/electric/block/R.nonreal.png", "./src/electric/block/G.nonreal.png") }
Expand All @@ -105,29 +105,29 @@ if(use_caution_signal) {
}

// Entry (offset 0)
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_entry) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_entry) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.real.png", "./src/electric/entry/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.real.png", "./src/electric/entry/G.real.png") }
}
} else {
if(use_blue_entry) {
if (use_blue_entry) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.nonreal.png", "./src/electric/entry/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.nonreal.png", "./src/electric/entry/G.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_entry) {
if (is_realistic) {
if (use_blue_entry) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.real.png", "./src/electric/entry/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.real.png", "./src/electric/entry/G.real.png") }
}
} else {
if(use_blue_entry) {
if (use_blue_entry) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.nonreal.png", "./src/electric/entry/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 0) { electric_signals_for_stable("./src/electric/entry/R.nonreal.png", "./src/electric/entry/G.nonreal.png") }
Expand All @@ -136,29 +136,29 @@ if(use_caution_signal) {
}

// Exit (offset 16)
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_exit) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_exit) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.real.png", "./src/electric/exit/Y.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.real.png", "./src/electric/exit/Y.real.png") }
}
} else {
if(use_blue_exit) {
if (use_blue_exit) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.nonreal.png", "./src/electric/exit/Y.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.nonreal.png", "./src/electric/exit/Y.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_exit) {
if (is_realistic) {
if (use_blue_exit) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.real.png", "./src/electric/exit/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.real.png", "./src/electric/exit/G.real.png") }
}
} else {
if(use_blue_exit) {
if (use_blue_exit) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.nonreal.png", "./src/electric/exit/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 16) { electric_signals_for_stable("./src/electric/exit/R.nonreal.png", "./src/electric/exit/G.nonreal.png") }
Expand All @@ -167,29 +167,29 @@ if(use_caution_signal) {
}

// Combo (offset 32)
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_combo) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_combo) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.real.png", "./src/electric/combo/YB.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.real.png", "./src/electric/combo/YG.real.png") }
}
} else {
if(use_blue_combo) {
if (use_blue_combo) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.nonreal.png", "./src/electric/combo/YB.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.nonreal.png", "./src/electric/combo/YG.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_combo) {
if (is_realistic) {
if (use_blue_combo) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.real.png", "./src/electric/combo/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.real.png", "./src/electric/combo/G.real.png") }
}
} else {
if(use_blue_combo) {
if (use_blue_combo) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.nonreal.png", "./src/electric/combo/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 32) { electric_signals_for_stable("./src/electric/combo/R.nonreal.png", "./src/electric/combo/G.nonreal.png") }
Expand All @@ -198,29 +198,29 @@ if(use_caution_signal) {
}

// Path (offset 112)
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_path) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.real.png", "./src/electric/path/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.real.png", "./src/electric/path/G.real.png") }
}
} else {
if(use_blue_path) {
if (use_blue_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.nonreal.png", "./src/electric/path/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.nonreal.png", "./src/electric/path/G.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_path) {
if (is_realistic) {
if (use_blue_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.real.png", "./src/electric/path/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.real.png", "./src/electric/path/G.real.png") }
}
} else {
if(use_blue_path) {
if (use_blue_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.nonreal.png", "./src/electric/path/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 112) { electric_signals_for_stable("./src/electric/path/R.nonreal.png", "./src/electric/path/G.nonreal.png") }
Expand All @@ -229,29 +229,29 @@ if(use_caution_signal) {
}

// Oneway-path (offset 128)
if(use_caution_signal) {
if(is_realistic) {
if(use_blue_oneway_path) {
if (use_caution_signal) {
if (is_realistic) {
if (use_blue_oneway_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.real.png", "./src/electric/oneway_path/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.real.png", "./src/electric/oneway_path/G.real.png") }
}
} else {
if(use_blue_oneway_path) {
if (use_blue_oneway_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.nonreal.png", "./src/electric/oneway_path/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.nonreal.png", "./src/electric/oneway_path/G.nonreal.png") }
}
}
} else {
if(is_realistic) {
if(use_blue_oneway_path) {
if (is_realistic) {
if (use_blue_oneway_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.real.png", "./src/electric/oneway_path/B.real.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.real.png", "./src/electric/oneway_path/G.real.png") }
}
} else {
if(use_blue_oneway_path) {
if (use_blue_oneway_path) {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.nonreal.png", "./src/electric/oneway_path/B.nonreal.png") }
} else {
replacenew(PRE_SIGNAL_SEMAPHORE_PBS, "", 128) { electric_signals_for_stable("./src/electric/oneway_path/R.nonreal.png", "./src/electric/oneway_path/G.nonreal.png") }
Expand Down
10 changes: 5 additions & 5 deletions src/electric/combo/code.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ spriteset(set_signal_combo_YB_nonreal) { electric_signals("./src/electric/combo/
spriteset(set_signal_combo_YG_real) { electric_signals("./src/electric/combo/YG.real.png") }
spriteset(set_signal_combo_YG_nonreal) { electric_signals("./src/electric/combo/YG.nonreal.png") }

switch(FEAT_SIGNALS, SELF, sw_signal_combo_R, (is_realistic << 1) + (use_blue_combo << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_combo_R, (is_realistic << 1) + (use_blue_combo << 0)) {
1: set_signal_combo_R_nonreal; // non realistic && blue
2: set_signal_combo_R_real; // realistic && green
3: set_signal_combo_R_real; // realistic && blue
set_signal_combo_R_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_combo_G, (is_realistic << 1) + (use_blue_combo << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_combo_G, (is_realistic << 1) + (use_blue_combo << 0)) {
1: set_signal_combo_B_nonreal; // non realistic && blue
2: set_signal_combo_G_real; // realistic && green
3: set_signal_combo_B_real; // realistic && blue
set_signal_combo_G_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_combo_Y, (is_realistic << 1) + (use_blue_combo << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_combo_Y, (is_realistic << 1) + (use_blue_combo << 0)) {
1: set_signal_combo_Y_nonreal; // non realistic && blue
2: set_signal_combo_Y_real; // realistic && green
3: set_signal_combo_Y_real; // realistic && blue
set_signal_combo_Y_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_combo_YG, (is_realistic << 1) + (use_blue_combo << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_combo_YG, (is_realistic << 1) + (use_blue_combo << 0)) {
1: set_signal_combo_YB_nonreal; // non realistic && blue
2: set_signal_combo_YG_real; // realistic && green
3: set_signal_combo_YB_real; // realistic && blue
set_signal_combo_YG_nonreal; // non realistic && green
}

switch(FEAT_SIGNALS, SELF, sw_signal_combo, extra_callback_info2 & 0x000000FF) {
switch (FEAT_SIGNALS, SELF, sw_signal_combo, extra_callback_info2 & 0x000000FF) {
0: sw_signal_combo_R;
1: sw_signal_combo_G;
2: sw_signal_combo_Y;
Expand Down
10 changes: 5 additions & 5 deletions src/electric/entry/code.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ spriteset(set_signal_entry_YB_nonreal) { electric_signals("./src/electric/entry/
spriteset(set_signal_entry_YG_real) { electric_signals("./src/electric/entry/YG.real.png") }
spriteset(set_signal_entry_YG_nonreal) { electric_signals("./src/electric/entry/YG.nonreal.png") }

switch(FEAT_SIGNALS, SELF, sw_signal_entry_R, (is_realistic << 1) + (use_blue_entry << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_entry_R, (is_realistic << 1) + (use_blue_entry << 0)) {
1: set_signal_entry_R_nonreal; // non realistic && blue
2: set_signal_entry_R_real; // realistic && green
3: set_signal_entry_R_real; // realistic && blue
set_signal_entry_R_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_entry_G, (is_realistic << 1) + (use_blue_entry << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_entry_G, (is_realistic << 1) + (use_blue_entry << 0)) {
1: set_signal_entry_B_nonreal; // non realistic && blue
2: set_signal_entry_G_real; // realistic && green
3: set_signal_entry_B_real; // realistic && blue
set_signal_entry_G_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_entry_Y, (is_realistic << 1) + (use_blue_entry << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_entry_Y, (is_realistic << 1) + (use_blue_entry << 0)) {
1: set_signal_entry_Y_nonreal; // non realistic && blue
2: set_signal_entry_Y_real; // realistic && green
3: set_signal_entry_Y_real; // realistic && blue
set_signal_entry_Y_nonreal; // non realistic && green
}
switch(FEAT_SIGNALS, SELF, sw_signal_entry_YG, (is_realistic << 1) + (use_blue_entry << 0)) {
switch (FEAT_SIGNALS, SELF, sw_signal_entry_YG, (is_realistic << 1) + (use_blue_entry << 0)) {
1: set_signal_entry_YB_nonreal; // non realistic && blue
2: set_signal_entry_YG_real; // realistic && green
3: set_signal_entry_YB_real; // realistic && blue
set_signal_entry_YG_nonreal; // non realistic && green
}

switch(FEAT_SIGNALS, SELF, sw_signal_entry, extra_callback_info2 & 0x000000FF) {
switch (FEAT_SIGNALS, SELF, sw_signal_entry, extra_callback_info2 & 0x000000FF) {
0: sw_signal_entry_R;
1: sw_signal_entry_G;
2: sw_signal_entry_Y;
Expand Down
Loading

0 comments on commit cf9c7ef

Please sign in to comment.