-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(station) west square objects & bus stops, part IV (#75)
- Loading branch information
Showing
19 changed files
with
318 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from .west_plaza import west_plaza | ||
from .west_plaza_vast import west_plaza_vast | ||
from .west_plaza_default import west_plaza_default | ||
|
||
plaza_demos = [west_plaza] | ||
plaza_demos = [west_plaza, west_plaza_vast, west_plaza_default] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
station/stations/dovemere_2018_lib/demos/plaza/west_plaza_default.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from station.lib import Demo | ||
from station.lib.utils import get_1cc_remap | ||
from agrf.graphics.palette import CompanyColour | ||
from station.stations.dovemere_2018_lib.flexible_stations import semitraversable | ||
from station.stations.dovemere_2018_lib.roadstops import named_layouts as roadstop_layouts | ||
from station.stations.dovemere_2018_lib.objects import named_layouts as object_layouts | ||
from station.stations.dovemere_2018_lib.layouts import globalize_all | ||
from station.stations.misc import slope_2, building_ground_layout | ||
from ..utils import h_merge | ||
|
||
globalize_all(platform_class="concrete", shelter_class="shelter_2") | ||
roadstop_layouts.globalize() | ||
object_layouts.globalize() | ||
|
||
station = h_merge( | ||
[[[cns], [slope_2.lower_tile()]], semitraversable.demo_1(5, 7)[5:], [[cns], [slope_2.lower_tile()]]], [[], []] | ||
) | ||
|
||
# Road Stops | ||
overpass = overpass.lower_tile() | ||
roadstops = [[None] + [overpass] * 5 + [None]] | ||
|
||
# Objects | ||
building_ground_layout = building_ground_layout.lower_tile() | ||
west_square = [[building_ground_layout] * 7, [building_ground_layout] * 7] | ||
|
||
|
||
west_plaza_default = Demo( | ||
station + roadstops + west_square, | ||
"West plaza (vanilla ground)", | ||
remap=get_1cc_remap(CompanyColour.YELLOW), | ||
merge_bbox=True, | ||
) |
45 changes: 45 additions & 0 deletions
45
station/stations/dovemere_2018_lib/demos/plaza/west_plaza_vast.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from station.lib import Demo, AGroundSprite, ALayout | ||
from station.lib.utils import get_1cc_remap | ||
from agrf.graphics.palette import CompanyColour | ||
from agrf.lib.building.image_sprite import image_sprite | ||
from station.stations.dovemere_2018_lib.flexible_stations import semitraversable | ||
from station.stations.dovemere_2018_lib.roadstops import named_layouts as roadstop_layouts | ||
from station.stations.dovemere_2018_lib.objects import named_layouts as object_layouts | ||
from station.stations.dovemere_2018_lib.layouts import globalize_all | ||
from station.stations.misc import slope_2 | ||
from ..utils import h_merge | ||
|
||
globalize_all(platform_class="concrete", shelter_class="shelter_2") | ||
roadstop_layouts.globalize() | ||
object_layouts.globalize() | ||
|
||
station = h_merge( | ||
[[[cns], [slope_2.lower_tile()]], semitraversable.demo_1(5, 7)[5:], [[cns], [slope_2.lower_tile()]]], [[], []] | ||
) | ||
|
||
# Road Stops | ||
overpass = overpass.lower_tile() | ||
roadstops = [[None] + [overpass] * 5 + [None]] | ||
|
||
|
||
# Objects | ||
def vast(x): | ||
return ALayout(AGroundSprite(image_sprite(f"third_party/vast/vast_{x}.png")), [], True) | ||
|
||
|
||
ground = vast(26).lower_tile() | ||
symbol = vast(47).lower_tile() | ||
grassy = vast(70).lower_tile() | ||
west_square = [ | ||
[ground, grassy, ground, ground, ground, grassy, ground], | ||
[grassy, grassy, ground, symbol, ground, grassy, grassy], | ||
[grassy, ground, ground, ground, ground, ground, grassy], | ||
] | ||
|
||
|
||
west_plaza_vast = Demo( | ||
station + roadstops + west_square, | ||
"West plaza (with VAST Objects tiles)", | ||
remap=get_1cc_remap(CompanyColour.MAUVE), | ||
merge_bbox=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
station/stations/dovemere_2018_lib/roadstop_utils/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
from station.lib import ( | ||
BuildingFull, | ||
BuildingSymmetricalX, | ||
BuildingSymmetrical, | ||
AParentSprite, | ||
ALayout, | ||
AChildSprite, | ||
AttrDict, | ||
Registers, | ||
) | ||
from station.lib.parameters import parameter_list | ||
from agrf.graphics.voxel import LazyVoxel | ||
from agrf.magic import Switch | ||
from roadstop.lib import ARoadStop | ||
from agrf.graphics.recolour import NON_RENDERABLE_COLOUR | ||
from ...misc import road_ground | ||
|
||
named_parts = AttrDict(schema=("name", "part")) | ||
named_layouts = AttrDict(schema=("name",)) | ||
|
||
roadstops = [] | ||
|
||
|
||
def register_road_stop(layout, sym, starting_id): | ||
assert 0x8000 <= starting_id < 0xC000 | ||
for i, cur in enumerate(sym.get_all_variants(layout)[::2]): | ||
cur_roadstop = ARoadStop( | ||
id=starting_id + i, | ||
translation_name="WEST_PLAZA_BUS", | ||
graphics=Switch(ranges={4: cur, 5: cur.M}, default=cur, code="view"), | ||
general_flags=0x8, | ||
class_label=b"\xe8\x8a\x9cR", | ||
enable_if=[parameter_list["E88A9CA_ENABLE_ROADSTOP"]], | ||
doc_layout=cur, | ||
) | ||
roadstops.append(cur_roadstop) | ||
cur_roadstop = ARoadStop( | ||
id=0x4000 + starting_id + i, | ||
translation_name="WEST_PLAZA_BUS", | ||
graphics=Switch(ranges={4: cur, 5: cur.M}, default=cur, code="view"), | ||
general_flags=0x8, | ||
class_label=b"\xe8\x8a\x9cR", | ||
enable_if=[parameter_list["E88A9CA_ENABLE_ROADSTOP"]], | ||
doc_layout=cur, | ||
is_waypoint=True, | ||
) | ||
roadstops.append(cur_roadstop) | ||
|
||
|
||
def make_road_stop(name, sym, starting_id, far, overpass, near, extended, floating, joggle=0): | ||
v = LazyVoxel( | ||
name, | ||
prefix=".cache/render/station/dovemere_2018/west_plaza/road_stop", | ||
voxel_getter=lambda path=f"station/voxels/dovemere_2018/west_plaza/road_stop/{name}.vox": path, | ||
load_from="station/files/cns-gorender.json", | ||
) | ||
# For better handling of pillars/bollards | ||
v.config["tiling_mode"] = "reflect" | ||
v.config["joggle"] = joggle | ||
if extended: | ||
v.config["size"]["x"] = 448 | ||
v.config["size"]["y"] = 448 | ||
for sprite in v.config["sprites"]: | ||
sprite["width"] = 112 | ||
v.config["agrf_zdiff"] = -12 | ||
|
||
snow = v.keep_layers(("snow",), "snow") | ||
snow = snow.compose(v, "merge", ignore_mask=True, colour_map=NON_RENDERABLE_COLOUR) | ||
snow.config["agrf_childsprite"] = (0, -3) | ||
|
||
nosnow = v.discard_layers(("snow",), "nosnow") | ||
nosnow.config["agrf_manual_crop"] = (0, 3) | ||
|
||
extended_suffix = "_extended" if extended else "" | ||
|
||
ps = [] | ||
for part, partname in ((far, "far"), (overpass, "overpass"), (near, "near")): | ||
if part is None: | ||
continue | ||
span, offset = part | ||
|
||
def make_part(v): | ||
partv = v.mask_clip_away( | ||
f"station/voxels/dovemere_2018/masks/road_{partname}_mask{extended_suffix}.vox", partname | ||
) | ||
partv.in_place_subset(sym.render_indices()) | ||
partsprite = sym.create_variants( | ||
partv.spritesheet( | ||
xspan=span[1], yspan=span[0], xdiff=offset[1], ydiff=offset[0], zdiff=offset[2] + floating | ||
) | ||
) | ||
return partsprite | ||
|
||
partps = AParentSprite(make_part(nosnow), span, offset) | ||
partsnow = make_part(snow) | ||
partsnow.voxel.render() | ||
snowcs = AChildSprite(partsnow, (0, 0), flags={"dodraw": Registers.SNOW}) | ||
partps = partps + snowcs | ||
named_parts[(name, partname)] = partps | ||
ps.append(partps) | ||
|
||
layout = ALayout(road_ground, ps, True, category=b"\xe8\x8a\x9cR") | ||
named_layouts[(name,)] = layout | ||
|
||
register_road_stop(layout, sym, starting_id) |
Oops, something went wrong.