Skip to content

Releases: citymania-org/grf-py

0.3.0

13 Sep 16:05
Compare
Choose a tag to compare
  • 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 to Action.
    • Rename IntermediateSprite to FakeAction.
    • Rename RealSprite to ResourceAction.
    • Add new base class Resource that resources now inherit instead of RealSprite.
    • Make ResourceAction and AlternativeSprites containers for the Resource objects.
    • Rename SoundSprite to Sound.
    • Rename GraphicsSprite to Sprite.
    • Rename EmptyGraphicsSprite to EmptySprite.
    • Remove LazyAciton and Action.get_data_size as no longer necessary.
  • 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 to PIL_PALETTE, add PALETTE 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 to Mask 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 and station_class_name Action 0 properties for stations.

  • Add TTDString and TTDIndustry constants.

  • Add TownGrowthEffect constants.

  • Add Eval as a version of Switch without ranges.

  • Add subroutines argument to Switch and allow name() call syntax.

  • Add debug_zoom_levels argument to BaseNewGRF.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 to build command of main 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 and description.

  • 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 to NewGRF constructor, possible values NewGRF.BLITTER_BPP_8 and NewGRF.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 PIL Image.

  • Add init_id_map command line command to initialize id_map.json.

  • Add Date type to represent dates that don't fit into datetime.date.

  • Add example of a simple eyecandy station.

  • Start auto-assiged IDs from 0 for INDUSTRY_TILE feature.

  • Rename AlternativeSprites.get_zoom to get_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, use make_callback_manager function instead.
    • Support splitting callbacks for default and purchase branch with DualCallback.
    • Use graphics.purchase instead of purchase_graphics attribute.
  • lib: Add Ship.Flags and RoadVehicle.Flags for unified access to flags.

  • lib: Add EngineOverride sprite generator.

  • lib: Add reverse_build_probability vehicle callback.

  • lib: Allow omitting ids in DisableDefault to disable all items.

  • lib: Support HOUSE, INDUSTRY and CARGO features in DisableDefault.

  • lib: Add chunk_size parameter to combine_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

19 Jul 10:50
Compare
Choose a tag to compare
  • 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 in Switch code not accepting param value without parentheses.

  • Fix default purchase sprite for auto-articulated trains.

  • Rename speed Action 0 property for ships to max_speed for consinstency with other vehile types.

  • Rename Action 0 ship properties to match nml:

    • cargo_type to default_cargo_type
    • sound to sound_effect
    • ocean_speed to ocean_speed_fraction
    • canal_speed to canal_speed_fraction
    • flags to misc_flags
    • refit_classes to refittable_cargo_classes
    • non_refit_classes to non_refittable_cargo_classes
  • Add id_map_file parameter to BaseNewGRF constructor and reserve_ids and resolve_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 and TrainRunningCost enums.

  • Add Flags, AIFlags, RuningCost enums for Trains.

  • Add Palette enum.

  • Add Train.hp and Train.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 expose bound_newgrf property.

  • Change Switch parameter order from to code, ranges, default.

  • Rename is_dual_headed Action 0 Train property to dual_headed to match nml.

  • Add NewGRF.grfid_value property.

  • Pass grf as an argument to Vehicle._set_callbacks.

  • Allow visual_effect_and_powered for Train 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 to kmhish in Train and RoadVehicle.

  • 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 in SetPurchaseOrder.

  • lib: Add length property to a Train constructor, auto-articulate if > 8 (up to 24).

  • lib: Add length property to RoadVehicle constructor (1..8).

  • lib: Add purchase_sprite property to Train and RoadVehicle.

  • 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 to VISUAL_EFFECT_AND_POWERED.

  • lib: Allow to use StringRef as a livery name.

  • lib: Add _set_articulated_part_callbacks method to Train.

  • lib: Use assigned id for the first part when auto-articulating.

  • lib: Add SetGlobalTrainDepotYOffset sprite generator.

  • lib: Add GlobalTrainMiscFlag enum and SetGlobalTrainMiscFlag sprite generator.

  • vox: Fix vox house example.

  • vox: Experimental .vox renderer for trains.