From a839bbcb3c48a7d92fd6aa79c1a2df7204029208 Mon Sep 17 00:00:00 2001 From: Jeremy Gao Date: Mon, 17 Mar 2025 01:32:31 -0700 Subject: [PATCH 1/4] Update: NML dependency to newgrf-badges branch --- .gitmodules | 5 +++-- nml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 67ec896..7a4e418 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "nml"] - path = nml - url = https://github.com/openttd/nml + path = nml + url = https://github.com/petern/nml + branch = newgrf-badges diff --git a/nml b/nml index 166ea00..0ac2c2f 160000 --- a/nml +++ b/nml @@ -1 +1 @@ -Subproject commit 166ea002c1747bb34e204bc77df78b8c373d4198 +Subproject commit 0ac2c2f9606041edb6c8e53b3ec61615ec197626 From fb0b7b76a67167e930bedb92f93cbe48a3598ca9 Mon Sep 17 00:00:00 2001 From: Jeremy Gao Date: Mon, 17 Mar 2025 01:45:18 -0700 Subject: [PATCH 2/4] ..... --- item_template.py | 2 ++ src/yard.pnml | 7 ++++++- wins.pnml | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/item_template.py b/item_template.py index 143e012..422e00c 100644 --- a/item_template.py +++ b/item_template.py @@ -32,6 +32,8 @@ name: string(STR_STAT_${name_label}); tile_flags: [""" + ",\n".join("bitmask(STAT_TILE_NOWIRE)" for i in range(8)) + """ ]; + badges: [ "station/wins/left_yard", + "station/wins/right_yard" ]; } graphics { prepare_layout: sw_item_${name}_prepare(); custom_spritesets: [s_fences_and_underlay]; diff --git a/src/yard.pnml b/src/yard.pnml index eb6d67a..02b7977 100644 --- a/src/yard.pnml +++ b/src/yard.pnml @@ -80,13 +80,18 @@ switch(FEAT_STATIONS, SELF, _sw_yard_type, track_type){ const none_yard = FILLED(2); +switch(FEAT_STATIONS, SELF, _sw_check_yard, [ + STORE_TEMP(2, 0x100), + STORE_TEMP(bitmask(4), 0x101), + var[0x79, 0, 0x1, 0xF0]]){return;} + //TODO: change to test badges instead of station presence // 0: front split, back split // 1: front merge, back split // 2: front split, back merge // 3: none switch(FEAT_STATIONS, SELF, _sw_yard_info_left, - !nearby_tile_is_station(0, -1) || !sw_tile_same_height_left() ? none_yard : + !_sw_check_yard() || !sw_tile_same_height_left() ? none_yard : ( ( !( diff --git a/wins.pnml b/wins.pnml index f182b6f..0e518b6 100644 --- a/wins.pnml +++ b/wins.pnml @@ -2,6 +2,11 @@ #include "src/header.pnml" #include "src/utility.pnml" +badgetable { + "station/wins/left_yard", + "station/wins/right_yard", +} + #include "src/spritesets.pnml" #include "src/fences.pnml" #include "src/yard.pnml" From 126d01ba2c1841b9f5c55815020e5e6628806b6e Mon Sep 17 00:00:00 2001 From: Jeremy Gao Date: Mon, 17 Mar 2025 02:43:44 -0700 Subject: [PATCH 3/4] Change: let yard use badges --- src/yard.pnml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/yard.pnml b/src/yard.pnml index 02b7977..b5431c6 100644 --- a/src/yard.pnml +++ b/src/yard.pnml @@ -80,24 +80,45 @@ switch(FEAT_STATIONS, SELF, _sw_yard_type, track_type){ const none_yard = FILLED(2); -switch(FEAT_STATIONS, SELF, _sw_check_yard, [ - STORE_TEMP(2, 0x100), +switch(FEAT_STATIONS, SELF, _sw_check_yard_p0n1, [ + STORE_TEMP(1, 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0xF0]]){return;} +switch(FEAT_STATIONS, SELF, _sw_check_yard_n1p0, [ + STORE_TEMP(1, 0x100), + STORE_TEMP(bitmask(4), 0x101), + var[0x79, 0, 0x1, 0x0F]]){return;} + +switch(FEAT_STATIONS, SELF, _sw_check_yard_n1n1, [ + STORE_TEMP(1, 0x100), + STORE_TEMP(bitmask(4), 0x101), + var[0x79, 0, 0x1, 0xFF]]){return;} + +switch(FEAT_STATIONS, SELF, _sw_check_yard_p1p0, [ + STORE_TEMP(1, 0x100), + STORE_TEMP(bitmask(4), 0x101), + var[0x79, 0, 0x1, 0x01]]){return;} + +switch(FEAT_STATIONS, SELF, _sw_check_yard_p1n1, [ + STORE_TEMP(1, 0x100), + STORE_TEMP(bitmask(4), 0x101), + var[0x79, 0, 0x1, 0xF1]]){return;} + + //TODO: change to test badges instead of station presence // 0: front split, back split // 1: front merge, back split // 2: front split, back merge // 3: none switch(FEAT_STATIONS, SELF, _sw_yard_info_left, - !_sw_check_yard() || !sw_tile_same_height_left() ? none_yard : + !_sw_check_yard_p0n1() || !sw_tile_same_height_left() ? none_yard : ( ( !( ( - nearby_tile_is_station(-1, 0) && // replace with badge test - nearby_tile_is_station(-1, -1) && // replace with badge test + _sw_check_yard_n1p0() && // replace with badge test + _sw_check_yard_n1n1() && // replace with badge test hasbit(rail_continuation, 1) ) || ( @@ -109,8 +130,8 @@ switch(FEAT_STATIONS, SELF, _sw_yard_info_left, ( !( ( - nearby_tile_is_station( 1, 0) && // replace with badge test - nearby_tile_is_station( 1, -1) && // replace with badge test + _sw_check_yard_p1p0() && // replace with badge test + _sw_check_yard_p1n1() && // replace with badge test hasbit(rail_continuation, 0) ) || ( From 7468c060e6e86b471757dc4d50f8c14c95060513 Mon Sep 17 00:00:00 2001 From: Jeremy Gao Date: Mon, 17 Mar 2025 17:36:14 -0700 Subject: [PATCH 4/4] ....... --- src/yard.pnml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/yard.pnml b/src/yard.pnml index b5431c6..60f2794 100644 --- a/src/yard.pnml +++ b/src/yard.pnml @@ -81,27 +81,27 @@ switch(FEAT_STATIONS, SELF, _sw_yard_type, track_type){ const none_yard = FILLED(2); switch(FEAT_STATIONS, SELF, _sw_check_yard_p0n1, [ - STORE_TEMP(1, 0x100), + STORE_TEMP(badgetype("station/wins/right_yard"), 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0xF0]]){return;} switch(FEAT_STATIONS, SELF, _sw_check_yard_n1p0, [ - STORE_TEMP(1, 0x100), + STORE_TEMP(badgetype("station/wins/right_yard"), 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0x0F]]){return;} switch(FEAT_STATIONS, SELF, _sw_check_yard_n1n1, [ - STORE_TEMP(1, 0x100), + STORE_TEMP(badgetype("station/wins/right_yard"), 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0xFF]]){return;} switch(FEAT_STATIONS, SELF, _sw_check_yard_p1p0, [ - STORE_TEMP(1, 0x100), + STORE_TEMP(badgetype("station/wins/right_yard"), 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0x01]]){return;} switch(FEAT_STATIONS, SELF, _sw_check_yard_p1n1, [ - STORE_TEMP(1, 0x100), + STORE_TEMP(badgetype("station/wins/right_yard"), 0x100), STORE_TEMP(bitmask(4), 0x101), var[0x79, 0, 0x1, 0xF1]]){return;}