-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 917bfcf
Showing
19 changed files
with
2,188 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
gfx | ||
*.grf | ||
gopath | ||
*.png | ||
!palette.png | ||
.nmlcache | ||
nmlc |
Large diffs are not rendered by default.
Oops, something went wrong.
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,61 @@ | ||
# dependencies | ||
GORENDER = ./gopath/bin/gorender --palette "vox/ttd_palette.json" -m "vox/manifest.json" -s 4 -overwrite | ||
NMLC = nmlc | ||
GCC = gcc | ||
|
||
|
||
# building paths | ||
BUILD_DIR = build | ||
|
||
# voxel paths | ||
|
||
VOX_DIR = vox | ||
VOX_BUILDINGS = $(wildcard $(VOX_DIR)/buildings/*.vox) | ||
VOX_PLATFORMS = $(wildcard $(VOX_DIR)/platforms/*.vox) | ||
VOX_SHELTERS = $(wildcard $(VOX_DIR)/shelters/*.vox) | ||
VOX_FENCES = $(wildcard $(VOX_DIR)/fences/*.vox) | ||
|
||
VOX_FILES = $(VOX_BUILDINGS) $(VOX_PLATFORMS) $(VOX_SHELTERS) $(VOX_FENCES) | ||
|
||
VOX_8BPP_FILES = $(patsubst %.vox,%_8bpp.png,$(VOX_FILES)) | ||
VOX_32BPP_FILES = $(patsubst %.vox,%_32bpp.png,$(VOX_FILES)) | ||
VOX_MASK_FILES = $(patsubst %.vox,%_mask.png,$(VOX_FILES)) | ||
|
||
|
||
|
||
%_8bpp.png %_32bpp.png %_mask.png: %.vox | ||
$(GORENDER) $< | ||
|
||
# default rule | ||
all: sprites code | ||
|
||
sprites: $(VOX_8BPP_FILES) $(VOX_32BPP_FILES) $(VOX_MASK_FILES) | ||
|
||
NML_FILE = cns.nml | ||
CODE_FILES = $(shell find . -name '*.pnml') $(shell find . -name '*.lng') $(shell find . -name 'custom_tags.txt') indexes.pnml | ||
INDEX_FILE = indexes.pnml | ||
GRF_FILE = cns.grf | ||
|
||
$(GRF_FILE): $(CODE_FILES) | ||
$(GCC) -E -x c -o $(NML_FILE) $(INDEX_FILE) | ||
$(NMLC) $(NML_FILE) | ||
|
||
# Rule to run nmlc when the NML file changes | ||
code: $(GRF_FILE) $(NML_FILE) | ||
|
||
clean: clean_grf clean_png | ||
|
||
clean_grf: | ||
@echo "Cleaning GRF and NML files" | ||
@rm -f *.grf | ||
@rm -f *.nml | ||
|
||
clean_png: | ||
@echo "Cleaning PNG files" | ||
@find $(VOX_DIR) -name '*.png' -type f -delete | ||
|
||
# this is only for debug purpose, you could modify it to copy the GRF to the OpenTTD data directory | ||
# it should be something like /mnt/c/users/<username>/documents/openttd/newgrf on wsl | ||
copy: | ||
@echo "Copying GRF files to OpenTTD data directory" | ||
@cp cns.grf ~/.local/share/openttd/newgrf/cns.grf |
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,21 @@ | ||
# China Set: Stations README | ||
|
||
This repo contains the source code and graphics of CNS China Set: Stations. | ||
|
||
CNS China Set: Stations is licensed under GNU GPL version 2 | ||
|
||
## Building | ||
|
||
You should have a `bash` environment, on Windows this should come with `git`. | ||
|
||
The following subjects are required to build the program: | ||
|
||
- go | ||
- gorender | ||
- make | ||
- nml 0.7.5 or higher | ||
|
||
You can use `install_dependencies.sh` to quickly download and setup `gorender` | ||
|
||
Use the `make` or `make all` command to build the grf; additionally, you could use `make all copy` to quickly copy the grf file to your game directory. | ||
For Windows users, we suggest using `wsl` to build the grf. Note that `gorender` may be slow when using wsl. |
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,93 @@ | ||
# 0 "indexes.pnml" | ||
# 0 "<built-in>" | ||
# 0 "<command-line>" | ||
# 1 "/usr/include/stdc-predef.h" 1 3 4 | ||
# 0 "<command-line>" 2 | ||
# 1 "indexes.pnml" | ||
# 1 "src/header.pnml" 1 | ||
grf { | ||
grfid: "CNSP"; | ||
name: string(STR_GRF_NAME); | ||
desc: string(STR_GRF_DESC); | ||
url: string(STR_GRF_URL); | ||
version: 0; | ||
min_compatible_version: 0; | ||
} | ||
|
||
|
||
|
||
if (ttd_platform != PLATFORM_OPENTTD || openttd_version < version_openttd(12,0)) { | ||
error(FATAL, string(STR_OPENTTD)); | ||
exit; | ||
} | ||
# 2 "indexes.pnml" 2 | ||
# 1 "src/templates.pnml" 1 | ||
# 10 "src/templates.pnml" | ||
template template_standard_0 (a) {[288 * 0, 0, 256, 312, -127, -182, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_1 (a) {[288 * 1, 0, 256, 312, -125, -183, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_2 (a) {[288 * 2, 0, 256, 312, -207, -222, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_3 (a) {[288 * 3, 0, 256, 312, -45, -223, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_4 (a) {[288 * 4, 0, 256, 312, -207, -222, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_5 (a) {[288 * 5, 0, 256, 312, -45, -223, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_6 (a) {[288 * 6, 0, 256, 312, -127, -182, "vox/"+a+"_32bpp.png"]} | ||
template template_standard_7 (a) {[288 * 7, 0, 256, 312, -125, -183, "vox/"+a+"_32bpp.png"]} | ||
|
||
template template_standard_zero (pos, a) {[288 * pos, 0, 256, 312, 0, 0, "vox/"+a+"_32bpp.png"]} | ||
# 3 "indexes.pnml" 2 | ||
# 1 "src/testing.pnml" 1 | ||
spriteset (s_test_platform, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP) { | ||
template_standard_0("platforms/platform_concrete") | ||
template_standard_1("platforms/platform_concrete") | ||
template_standard_2("platforms/platform_concrete") | ||
template_standard_3("platforms/platform_concrete") | ||
} | ||
|
||
spriteset (s_test_shelter, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP) { | ||
template_standard_zero(0, "shelters/shelter1") | ||
template_standard_zero(1, "shelters/shelter1") | ||
template_standard_zero(2, "shelters/shelter1") | ||
template_standard_zero(3, "shelters/shelter1") | ||
} | ||
|
||
spritelayout sp_test() { | ||
ground { | ||
sprite: GROUNDSPRITE_RAIL_X; | ||
} | ||
building { | ||
sprite: CUSTOM(0, 0); | ||
xoffset: 0; | ||
yoffset: 0; | ||
zoffset: 0; | ||
xextent: 16; | ||
yextent: 6; | ||
zextent: 6; | ||
} | ||
childsprite { | ||
sprite: CUSTOM(1, 0); | ||
} | ||
building { | ||
sprite: CUSTOM(0, 2); | ||
xoffset: 0; | ||
yoffset: 10; | ||
zoffset: 0; | ||
xextent: 16; | ||
yextent: 6; | ||
zextent: 6; | ||
} | ||
childsprite { | ||
sprite: CUSTOM(1, 2); | ||
} | ||
} | ||
|
||
item (FEAT_STATIONS, i_test) { | ||
property { | ||
class: "CNS1"; | ||
classname: string(STR_TEST); | ||
name: string(STR_TEST); | ||
} | ||
graphics { | ||
sprite_layouts: [sp_test(), sp_test()]; | ||
custom_spritesets: [s_test_platform, s_test_shelter]; | ||
} | ||
} | ||
# 4 "indexes.pnml" 2 |
Empty file.
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,3 @@ | ||
#include "src/header.pnml" | ||
#include "src/templates.pnml" | ||
#include "src/testing.pnml" |
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,11 @@ | ||
#!/bin/bash | ||
|
||
# here I'm using ahyangyi's fork of gorender | ||
|
||
export GOPATH=$PWD/gopath | ||
go install github.com/ahyangyi/gorender/cmd@daeb83b4 | ||
mv gopath/bin/cmd gopath/bin/gorender | ||
|
||
# if you have grf-py installed you may want to use a venv | ||
|
||
pip3 install nml==0.7.5 |
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,11 @@ | ||
##grflangid 0x01 | ||
# english_uk | ||
|
||
|
||
STR_GRF_NAME :China Set: Stations | ||
STR_GRF_DESC :Set of Chinese themed stations. Made by WenSim and the China Set team. | ||
STR_GRF_URL :http://www.github.com/openttd-china-set | ||
|
||
# utilities | ||
STR_TEST :Test | ||
STR_OPENTTD :OpenTTD |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
grf { | ||
grfid: "CNSP"; | ||
name: string(STR_GRF_NAME); | ||
desc: string(STR_GRF_DESC); | ||
url: string(STR_GRF_URL); | ||
version: 0; | ||
min_compatible_version: 0; | ||
} | ||
|
||
|
||
// version check | ||
if (ttd_platform != PLATFORM_OPENTTD || openttd_version < version_openttd(12,0)) { | ||
error(FATAL, string(STR_OPENTTD)); | ||
exit; | ||
} |
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,19 @@ | ||
#define POSITION_X 288 | ||
#define POSITION_Y 0 | ||
#define SIZE_X 256 | ||
#define SIZE_Y 312 | ||
|
||
#define PATH "vox/"+a+"_32bpp.png" | ||
|
||
// empty templates and sprites will be removed after the release of NML 0.7.5 | ||
// currently for maximum compatibility we need to keep them | ||
template template_standard_0 (a) {[POSITION_X * 0, POSITION_Y, SIZE_X, SIZE_Y, -127, -182, PATH]} | ||
template template_standard_1 (a) {[POSITION_X * 1, POSITION_Y, SIZE_X, SIZE_Y, -125, -183, PATH]} | ||
template template_standard_2 (a) {[POSITION_X * 2, POSITION_Y, SIZE_X, SIZE_Y, -207, -222, PATH]} | ||
template template_standard_3 (a) {[POSITION_X * 3, POSITION_Y, SIZE_X, SIZE_Y, -45, -223, PATH]} | ||
template template_standard_4 (a) {[POSITION_X * 4, POSITION_Y, SIZE_X, SIZE_Y, -207, -222, PATH]} | ||
template template_standard_5 (a) {[POSITION_X * 5, POSITION_Y, SIZE_X, SIZE_Y, -45, -223, PATH]} | ||
template template_standard_6 (a) {[POSITION_X * 6, POSITION_Y, SIZE_X, SIZE_Y, -127, -182, PATH]} | ||
template template_standard_7 (a) {[POSITION_X * 7, POSITION_Y, SIZE_X, SIZE_Y, -125, -183, PATH]} | ||
|
||
template template_standard_zero (pos, a) {[POSITION_X * pos, POSITION_Y, SIZE_X, SIZE_Y, 0, 0, PATH]} |
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,55 @@ | ||
spriteset (s_test_platform, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP) { | ||
template_standard_0("platforms/platform_concrete") | ||
template_standard_1("platforms/platform_concrete") | ||
template_standard_2("platforms/platform_concrete") | ||
template_standard_3("platforms/platform_concrete") | ||
} | ||
|
||
spriteset (s_test_shelter, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP) { | ||
template_standard_zero(0, "shelters/shelter1") | ||
template_standard_zero(1, "shelters/shelter1") | ||
template_standard_zero(2, "shelters/shelter1") | ||
template_standard_zero(3, "shelters/shelter1") | ||
} | ||
|
||
spritelayout sp_test() { | ||
ground { | ||
sprite: GROUNDSPRITE_RAIL_X; | ||
} | ||
building { // station platform | ||
sprite: CUSTOM(0, 0); | ||
xoffset: 0; | ||
yoffset: 0; | ||
zoffset: 0; | ||
xextent: 16; | ||
yextent: 6; | ||
zextent: 6; | ||
} | ||
childsprite { // shelter | ||
sprite: CUSTOM(1, 0); | ||
} | ||
building { | ||
sprite: CUSTOM(0, 2); | ||
xoffset: 0; | ||
yoffset: 10; | ||
zoffset: 0; | ||
xextent: 16; | ||
yextent: 6; | ||
zextent: 6; | ||
} | ||
childsprite { | ||
sprite: CUSTOM(1, 2); | ||
} | ||
} | ||
|
||
item (FEAT_STATIONS, i_test) { | ||
property { | ||
class: "CNS1"; | ||
classname: string(STR_TEST); | ||
name: string(STR_TEST); | ||
} | ||
graphics { | ||
sprite_layouts: [sp_test(), sp_test()]; | ||
custom_spritesets: [s_test_platform, s_test_shelter]; | ||
} | ||
} |
Binary file not shown.
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,72 @@ | ||
{ | ||
"lighting_angle": 45, | ||
"lighting_elevation": 45, | ||
"depth_influence": 0, | ||
"tiled_normals": true, | ||
"solid_base": true, | ||
"soften_edges": 10, | ||
"alpha_edge_threshold": 0.75, | ||
"sampler": "disc", | ||
"accuracy": 10, | ||
"overlap": 0.02, | ||
"brightness": -0.05, | ||
"contrast": 0.1, | ||
"pad_to_full_length": false, | ||
"detail_boost": 10.0, | ||
"falloff_adjustment": 0.5, | ||
"max_colour_push": 2, | ||
"fosterise": false, | ||
"fade_to_black": false, | ||
"size": { | ||
"x": 256, | ||
"y": 256, | ||
"z": 256 | ||
}, | ||
"render_elevation": 30, | ||
"sprites": [ | ||
{ | ||
"angle": 45, | ||
"width": 64, | ||
"height": 0 | ||
}, | ||
{ | ||
"angle": 135, | ||
"width": 64, | ||
"height": 0 | ||
}, | ||
{ | ||
"angle": 225, | ||
"width": 64, | ||
"height": 0 | ||
}, | ||
{ | ||
"angle": 315, | ||
"width": 64, | ||
"height": 0 | ||
}, | ||
{ | ||
"angle": 45, | ||
"width": 64, | ||
"height": 0, | ||
"flip": true | ||
}, | ||
{ | ||
"angle": 135, | ||
"width": 64, | ||
"height": 0, | ||
"flip": true | ||
}, | ||
{ | ||
"angle": 225, | ||
"width": 64, | ||
"height": 0, | ||
"flip": true | ||
}, | ||
{ | ||
"angle": 315, | ||
"width": 64, | ||
"height": 0, | ||
"flip": true | ||
} | ||
] | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.