Releases: citymania-org/grf-py
0.3.0
-
Reorganize base sprite/action hierarchy so it better reflects newgrf structure. Also rename classes to use common terms rather than grf-specific ones (real/pseudo sprite).
- Rename
BaseSprite
toAction
. - Rename
IntermediateSprite
toFakeAction
. - Rename
RealSprite
toResourceAction
. - Add new base class
Resource
that resources now inherit instead ofRealSprite
. - Make
ResourceAction
andAlternativeSprites
containers for theResource
objects. - Rename
SoundSprite
toSound
. - Rename
GraphicsSprite
toSprite
. - Rename
EmptyGraphicsSprite
toEmptySprite
. - Remove
LazyAciton
andAction.get_data_size
as no longer necessary.
- Rename
-
Fix auto-assigned IDs overlapping when adding vehicles.
-
Fix encoding of label lists in Action0 properties.
-
Fix encoding and decoding of Action 5.
-
Fix
min_life
Action0 property size for houses (spec error). -
Fix
Switch
code using wrong feature for related scope. -
Fix
Switch
code grammar issues. -
Fix alpha generation when using colourkey.
-
Fix encoding of
min_bridge_height
Action 0 station property (#33). -
Fix imageSprite conversion for non-P and non-RGBA images (#43).
-
Add sprite cache.
-
Optimize memory usage when writing NewGRF.
-
Optimize grf file size by removing duplicate sprites (by data).
-
Allow defining named temporary variables in
Switch
code. -
Rename zoom constants to use natural/nml order:
ZOOM_4X
->ZOOM_2X
->ZOOM_NORMAL
->ZOOM_OUT_2X
->ZOOM_OUT_4X
->ZOOM_OUT_8X
. -
Rename
PALETTE
toPIL_PALETTE
, addPALETTE
as a list of (r, g, b) tuples. -
Add
OKLAB_PALETTE
,NP_PALETTE
,PALETTE_IDX
constants. -
Add
srgb_to_linear
,linear_to_srgb
,srgb_to_oklab
,oklab_to_srgb
colour conversion functions. -
Add
mode
argument toMask
with option to overdraw sprite. -
Add
ShipFlags
enum. -
Support extended format in Action 1.
-
Support ids > 255 in Action 3 (#42).
-
Add
main
function to handle command line arguments. -
Add support for road stop feature (#44).
-
Add some VarAction2 variables for houses.
-
Add
station_name
andstation_class_name
Action 0 properties for stations. -
Add
TTDString
andTTDIndustry
constants. -
Add
TownGrowthEffect
constants. -
Add
Eval
as a version ofSwitch
without ranges. -
Add
subroutines
argument toSwitch
and allowname()
call syntax. -
Add
debug_zoom_levels
argument toBaseNewGRF.write
to recolour sprites according to their zoom level: 4x - red, 2x - blue, 1x - green, out-2x - cyan, out-4x - yellow, out-8x - magenta. -
Add
--debug-zoom-levels
command line argument tobuild
command ofmain
function. -
Add
WithMask
sprite class to add mask layer to images. -
Add
SpriteWrapper
class to simplify writing sprite modifiers. -
Add
MoveSprite
modifier to change sprite offsets. -
Support using StringRef in Action 0x14 (
SetProperties
). -
Support using StringRef as
NewGRF
name
anddescription
. -
Support encoding of bridge layouts.
-
Support encoding of industry layouts.
-
Support encoding of tile acceptance lists for houses and industry tiles.
-
Support expressions for register value in PERM and TEMP access.
-
Support parameter expressions for vars60+ in
Switch
code (via var7b). -
Support cropping 24bpp sprites.
-
Add
preferred_blitter
argument toNewGRF
constructor, possible valuesNewGRF.BLITTER_BPP_8
andNewGRF.BLITTER_BPP_32
. -
Add
StringManager.get_persistent_id
function to register strings in "persistent" range (0xDCxx). -
Add
Sprite.save_gif
method to generate palette animated images. -
Add
Sprite.make_rgba_image
method to generate static PILImage
. -
Add init_id_map command line command to initialize id_map.json.
-
Add
Date
type to represent dates that don't fit intodatetime.date
. -
Add example of a simple eyecandy station.
-
Start auto-assiged IDs from 0 for INDUSTRY_TILE feature.
-
Rename
AlternativeSprites.get_zoom
toget_sprite
and add bpp argument. -
Rename some of the Action0 properties for
CARGO
to match nml. -
Don't write redundant actions for railtypes without fallbacks in railtype table.
-
Return cargo type ids in
NewGRF.set_cargo_table
. -
Remove all uses of spectra in favour of own colour submodule using OKLAB colour space.
-
Only replace .grf file when build succeeded.
-
lib: Fix
CallbackManager.make_switches
for non-vehicle features. -
lib: Fix incorrect 2cc colors for auto-articulated parts.
-
lib: Fix unicode vehicle names.
-
lib: Don't change callbacks passed to
CallbackMananger
. -
lib: Set correct flags and track_type on auto-articulated parts.
-
lib: Fix auto-articulation for vehicles without liveries.
-
lib: Fix: Make station availability a purchase callback.
-
lib: Add high-level
Industry
class. -
lib:
CallbackManager
rewrite:- Support all features (non-vehicles may still be incomplete).
- Make
CallbackManager
abstract class, usemake_callback_manager
function instead. - Support splitting callbacks for default and purchase branch with
DualCallback
. - Use
graphics.purchase
instead ofpurchase_graphics
attribute.
-
lib: Add
Ship.Flags
andRoadVehicle.Flags
for unified access to flags. -
lib: Add
EngineOverride
sprite generator. -
lib: Add
reverse_build_probability
vehicle callback. -
lib: Allow omitting
ids
inDisableDefault
to disable all items. -
lib: Support
HOUSE
,INDUSTRY
andCARGO
features inDisableDefault
. -
lib: Add
chunk_size
parameter tocombine_ranges
. -
grftopy: Fix missing sprite zoom
-
grftopy: Improve decoding of industry layouts.
-
grftopy: Fix decompilation of ActionB.
-
grftopy: Fix decompilation of action 7/9 with value > 4 bytes.
-
grftopy: Add -p/--palette cli option to set output palette for 8bpp images.
-
grftopy: Decompile
cargo_(dis)allow_refit
properties as a tuple of cargo indexes. -
dev: Add new
dev
submodule for extending newgrf spec support. -
dev: Add
dev.add_feature
function.
0.2.2
-
Change license to GPL v2+ (same as nml) instead of v3 to allow reusing v2 code/resources.
-
Fix graphics sprite composition.
-
Fix Train weight Action 0 properties (low and high bytes).
-
Fix compilation of generic var parameter in Action 2.
-
Fix
var(...)
call inSwitch
code not acceptingparam
value without parentheses. -
Fix default purchase sprite for auto-articulated trains.
-
Rename
speed
Action 0 property for ships tomax_speed
for consinstency with other vehile types. -
Rename Action 0 ship properties to match nml:
cargo_type
todefault_cargo_type
sound
tosound_effect
ocean_speed
toocean_speed_fraction
canal_speed
tocanal_speed_fraction
flags
tomisc_flags
refit_classes
torefittable_cargo_classes
non_refit_classes
tonon_refittable_cargo_classes
-
Add
id_map_file
parameter toBaseNewGRF
constructor andreserve_ids
andresolve_id
methods to manage auto-assigned (string) IDs. -
Use
AlternativeSprites
instead of sprite tuples. -
Add Action0 properties for road types.
-
Add
NewGRF.add_railtype
to add railtypes one-by-one. -
Add
VEHICLE_NEVER_EXPIRES
constant. -
Add
AIFlags
andTrainRunningCost
enums. -
Add
Flags
,AIFlags
,RuningCost
enums for Trains. -
Add
Palette
enum. -
Add
Train.hp
andTrain.ton
methods for converting metric units. -
Add visual effect constants and methods.
-
Make
NewGRF.bind
to make a subclass of the type instead of function and exposebound_newgrf
property. -
Change Switch parameter order from to
code, ranges, default
. -
Rename
is_dual_headed
Action 0 Train property todual_headed
to match nml. -
Add
NewGRF.grfid_value
property. -
Pass grf as an argument to
Vehicle._set_callbacks
. -
Allow
visual_effect_and_powered
forTrain
articulated parts. -
Don't check for sprite type when adding it for now (messes up decompiling).
-
Use setuptools-git-versioning to manage versions.
-
Update documentation.
-
Allow to use objects with id as a variant_group value in Aciton0.
-
Use IDProperty for
sort_purchase_list
in Action 0 for vehicles. -
lib: Add
Ship
sprite generator. -
lib: Rename
kmhishph
method tokmhish
inTrain
andRoadVehicle
. -
lib: Make
_set_callbacks
return list of sprites to allow adding graphics. -
lib: Make auto-articulated parts use auto-assigned(string) IDs.
-
lib: Support road vehicle property callbacks in
CallbackMananger
. -
lib: Fix RoadVehicle name.
-
lib: Fix
CallbackManager
exceptions. -
lib: Fix incorect livery for
Train
wagons. -
lib: Add
VehicleGroup
class to define vehicle groups inSetPurchaseOrder
. -
lib: Add
length
property to aTrain
constructor, auto-articulate if > 8 (up to 24). -
lib: Add
length
property toRoadVehicle
constructor (1..8). -
lib: Add
purchase_sprite
property toTrain
andRoadVehicle
. -
lib: Allow to use length > 8 (but <= 24) for articulated parts.
-
lib: Allow specifying property callbacks individually in
CallbackManager
. -
lib: Add
SetPurchaseOrder
sprite generator. -
lib: Rename
POWERED_WAGONS
callback toVISUAL_EFFECT_AND_POWERED
. -
lib: Allow to use
StringRef
as a livery name. -
lib: Add
_set_articulated_part_callbacks
method toTrain
. -
lib: Use assigned id for the first part when auto-articulating.
-
lib: Add
SetGlobalTrainDepotYOffset
sprite generator. -
lib: Add
GlobalTrainMiscFlag
enum andSetGlobalTrainMiscFlag
sprite generator. -
vox: Fix vox house example.
-
vox: Experimental .vox renderer for trains.