From 0011d4bca9867e025c11d75bd097f28b67825b89 Mon Sep 17 00:00:00 2001 From: Jeremy Gao <145064583+WenSimEHRP@users.noreply.github.com> Date: Tue, 14 May 2024 23:54:04 -0700 Subject: [PATCH] Fix: station not recognizing platform from other grfs --- src/defines.pnml | 2 +- src/testing.pnml | 58 ++++++++++++++++++++++++------------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/defines.pnml b/src/defines.pnml index bbd6472..7ecba3b 100644 --- a/src/defines.pnml +++ b/src/defines.pnml @@ -175,7 +175,7 @@ #define STANDARD_PLATFORM_BITS 3 << 14 -#define NPLAT_BIT 0 // 0 only +#define NPLAT_BIT 7 // 0 only #define SPLAT_BIT 1 // 1 only #define SHELTER_BIT 2 // 2 only #define PLATFORM_SPRITESET_BITS 3 // 3 and 4 diff --git a/src/testing.pnml b/src/testing.pnml index cdc739c..abb9fff 100644 --- a/src/testing.pnml +++ b/src/testing.pnml @@ -86,12 +86,12 @@ spriteset (s_test_fence, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP) { }*/ #define GET_NPLAT_FORMATION \ - ((getbits(LOAD_TEMP(TILE_X_SW), NPLAT_BIT, 1) | getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_SW, 1)) << 0|\ - (getbits(LOAD_TEMP(TILE_X_NE), NPLAT_BIT, 1) | getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_NE, 1)) << 1) + ((getbits(LOAD_TEMP(TILE_X_SW), NPLAT_BIT, 1) ^ getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_SW, 1)) << 0|\ + (getbits(LOAD_TEMP(TILE_X_NE), NPLAT_BIT, 1) ^ getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_NE, 1)) << 1) #define GET_SPLAT_FORMATION \ - ((getbits(LOAD_TEMP(TILE_X_SW), SPLAT_BIT, 1) | getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_SW, 1)) << 0|\ - (getbits(LOAD_TEMP(TILE_X_NE), SPLAT_BIT, 1) | getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_NE, 1)) << 1) + ((getbits(LOAD_TEMP(TILE_X_SW), SPLAT_BIT, 1) ^ getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_SW, 1)) << 0|\ + (getbits(LOAD_TEMP(TILE_X_NE), SPLAT_BIT, 1) ^ getbits(LOAD_TEMP(TEMP_NEARBY_TILE_GRF), TILE_X_NE, 1)) << 1) spritelayout sp_test_x(hide_platform_nw, hide_platform_se, hide_shelter) { ground {sprite: GROUNDSPRITE_RAIL_X;} @@ -177,7 +177,7 @@ spritelayout sp_test_y(hide_platform_ne, hide_platform_sw, hide_shelter) { } } /* about registers - * + * */ switch (FEAT_STATIONS, SELF, sw_check_rail_continuation, hasbit(rail_continuation, 1) << TILE_X_NE| @@ -185,34 +185,34 @@ switch (FEAT_STATIONS, SELF, sw_check_rail_continuation, switch (FEAT_STATIONS, SELF, sw_check_nearby_tile_station, - nearby_tile_is_station(-1, 0) << TILE_X_NE| - nearby_tile_is_station( 1, 0) << TILE_X_SW| - nearby_tile_is_station( 0,-1) << TILE_X_NW| - nearby_tile_is_station( 0, 1) << TILE_X_SE| - nearby_tile_is_station(-1,-1) << TILE_X_N| - nearby_tile_is_station( 1, 1) << TILE_X_S| - nearby_tile_is_station( 1,-1) << TILE_X_W| - nearby_tile_is_station(-1, 1) << TILE_X_E) {return;} + (nearby_tile_is_station(-1, 0) == 1) << TILE_X_NE| + (nearby_tile_is_station( 1, 0) == 1) << TILE_X_SW| + (nearby_tile_is_station( 0,-1) == 1) << TILE_X_NW| + (nearby_tile_is_station( 0, 1) == 1) << TILE_X_SE| + (nearby_tile_is_station(-1,-1) == 1) << TILE_X_N| + (nearby_tile_is_station( 1, 1) == 1) << TILE_X_S| + (nearby_tile_is_station( 1,-1) == 1) << TILE_X_W| + (nearby_tile_is_station(-1, 1) == 1) << TILE_X_E) {return;} switch (FEAT_STATIONS, SELF, sw_check_nearby_tile_perpendicular, - nearby_tile_perpendicular(-1, 0) << TILE_X_NE| - nearby_tile_perpendicular( 1, 0) << TILE_X_SW| - nearby_tile_perpendicular( 0,-1) << TILE_X_NW| - nearby_tile_perpendicular( 0, 1) << TILE_X_SE| - nearby_tile_perpendicular(-1,-1) << TILE_X_N| - nearby_tile_perpendicular( 1, 1) << TILE_X_S| - nearby_tile_perpendicular( 1,-1) << TILE_X_W| - nearby_tile_perpendicular(-1, 1) << TILE_X_E) {return;} + (nearby_tile_perpendicular(-1, 0) == 1) << TILE_X_NE| + (nearby_tile_perpendicular( 1, 0) == 1) << TILE_X_SW| + (nearby_tile_perpendicular( 0,-1) == 1) << TILE_X_NW| + (nearby_tile_perpendicular( 0, 1) == 1) << TILE_X_SE| + (nearby_tile_perpendicular(-1,-1) == 1) << TILE_X_N| + (nearby_tile_perpendicular( 1, 1) == 1) << TILE_X_S| + (nearby_tile_perpendicular( 1,-1) == 1) << TILE_X_W| + (nearby_tile_perpendicular(-1, 1) == 1) << TILE_X_E) {return;} switch (FEAT_STATIONS, SELF, sw_check_nearby_tile_grf, - nearby_tile_same_grf(-1, 0) << TILE_X_NE| - nearby_tile_same_grf( 1, 0) << TILE_X_SW| - nearby_tile_same_grf( 0,-1) << TILE_X_NW| - nearby_tile_same_grf( 0, 1) << TILE_X_SE| - nearby_tile_same_grf(-1,-1) << TILE_X_N| - nearby_tile_same_grf( 1, 1) << TILE_X_S| - nearby_tile_same_grf( 1,-1) << TILE_X_W| - nearby_tile_same_grf(-1, 1) << TILE_X_E) {return;} + (nearby_tile_same_grf(-1, 0) == 1) << TILE_X_NE| + (nearby_tile_same_grf( 1, 0) == 1) << TILE_X_SW| + (nearby_tile_same_grf( 0,-1) == 1) << TILE_X_NW| + (nearby_tile_same_grf( 0, 1) == 1) << TILE_X_SE| + (nearby_tile_same_grf(-1,-1) == 1) << TILE_X_N| + (nearby_tile_same_grf( 1, 1) == 1) << TILE_X_S| + (nearby_tile_same_grf( 1,-1) == 1) << TILE_X_W| + (nearby_tile_same_grf(-1, 1) == 1) << TILE_X_E) {return;} switch (FEAT_STATIONS, SELF, sw_test, [ STORE_TEMP(sw_check_rail_continuation(), TEMP_RAIL_CONTINUATION),