td6

package
v0.0.0-...-5650bb0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Dealing with entrances/exits from a ride

Parses TD6 files

Index

Constants

View Source
const (
	IDX_RIDE_TYPE    = 0x0
	IDX_VEHICLE_TYPE = 0x1

	IDX_COST             = 0x2
	IDX_OPERATING_MODE   = 0x06
	IDX_COLOR_SCHEME     = 0x07
	IDX_CONTROL_FLAG     = 0x4b
	IDX_NUM_TRAINS       = 0x4c
	IDX_CARS_PER_TRAIN   = 0x4d
	IDX_MIN_WAIT_TIME    = 0x4e
	IDX_MAX_WAIT_TIME    = 0x4f
	IDX_MAX_SPEED        = 0x51
	IDX_AVERAGE_SPEED    = 0x52
	IDX_POSITIVE_G_FORCE = 0x55
	IDX_NEGATIVE_G_FORCE = 0x56
	IDX_LATERAL_G_FORCE  = 0x57
	IDX_NUM_INVERSIONS   = 0x58
	IDX_NUM_DROPS        = 0x59
	IDX_HIGHEST_DROP     = 0x5a

	IDX_EXCITEMENT = 0x5b
	IDX_INTENSITY  = 0x5c
	IDX_NAUSEA     = 0x5d

	IDX_VEHICLE_TYPE_STRING = 0x74

	IDX_TRACK_DATA = 0xa3
	IDX_X_SPACE    = 0x80
	IDX_Y_SPACE    = 0x81
)

Where to find various pieces of information in the decoded ride.

View Source
const (
	SCHEME_SAME_COLOR             = 0
	SCHEME_TRAINS_DIFFERENT_COLOR = 1
	SCHEME_CARS_DIFFERENT_COLOR   = 2
)
View Source
const (
	RIDE_SPIRAL     RideType = 0x00
	RIDE_STAND_UP            = 0x01
	RIDE_SUSPENDED           = 0x02
	RIDE_INVERTED            = 0x03
	RIDE_STEEL_MINI          = 0x04
	RIDE_MINE_TRAIN          = 0x11
	RIDE_WOODEN              = 0x34
)

http://freerct.github.io/RCTTechDepot-Archive/rideCodes.html

View Source
const (
	RIDE_LOAD_QUARTER        = 0
	RIDE_LOAD_HALF           = 1
	RIDE_LOAD_THREE_QUARTERS = 2
	RIDE_LOAD_FULL           = 3
	RIDE_LOAD_ANY            = 4
)

see http://freerct.github.io/RCTTechDepot-Archive/controlFlags.html

View Source
const (
	OPERATING_MODE_NORMAL             = 0
	OPERATING_MODE_CONTINUOUS_CIRCUIT = 1
)
View Source
const (
	VEHICLE_SPIRAL                  VehicleType = "SPDRCR  "
	VEHICLE_STAND_UP                            = "TOGST   "
	VEHICLE_WOODEN_ARTICULATED                  = "MFT     "
	VEHICLE_WOODEN_4SEATER                      = "PTCT1   "
	VEHICLE_WOODEN_6SEATER                      = "PTCT2   "
	VEHICLE_WOODEN_6SEATER_REVERSED             = "PTCT2R  "
	VEHICLE_MINE_TRAIN                          = "AMT1    "
)
View Source
const (
	LENGTH_VEHICLE_TYPE = 8

	BIT_LIFT_CHAIN        = 3
	BIT_STEEP_LIFT_CHAIN  = 4
	BIT_CURVED_LIFT_CHAIN = 5
	BIT_BANKING           = 6
	BIT_VERTICAL_LOOP     = 7

	BIT_STEEP_SLOPE         = 1
	BIT_FLAT_TO_STEEP       = 2
	BIT_SLOPED_CURVES       = 3
	BIT_STEEP_TWIST         = 4
	BIT_S_BENDS             = 5
	BIT_SMALL_RADIUS_CURVES = 6
	BIT_SMALL_RADIUS_BANKED = 7
)
View Source
const DEBUG = false
View Source
const DEBUG_LENGTH = 20
View Source
const RCT2_TD6_LENGTH = 24735

Variables

This section is empty.

Functions

func Marshal

func Marshal(r *Ride) ([]byte, error)

Deserialize the ride to a string of bytes.

This is a little bit tricky, and requires implementing the format described in the tycoon technical depot, available here: https://github.com/UnknownShadow200/RCTTechDepot-Archive/blob/master/td4.html

func Pad

func Pad(bits []byte) []byte

func Unmarshal

func Unmarshal(buf []byte, r *Ride) error

Take a compressed byte stream representing a ride and turn it into a Ride struct. Returns an error if the byte array is too short.

Types

type ControlFlags

type ControlFlags struct {
	UseMaximumTime             bool
	UseMinimumTime             bool
	SyncWithAdjacentStation    bool
	LeaveIfAnotherTrainArrives bool
	WaitForLoad                bool
	Load                       LoadType
}

type Egress

type Egress struct {
	Exit      bool
	Direction int
	XOffset   int16
	YOffset   int16
}

type LoadType

type LoadType int

type OperatingMode

type OperatingMode int

Operating modes described here: http://freerct.github.io/RCTTechDepot-Archive/operatingModes.html

type Ride

type Ride struct {
	RideType RideType

	VehicleColorScheme VehicleColorScheme

	XSpaceRequired int
	YSpaceRequired int

	OperatingMode OperatingMode
	ControlFlags  *ControlFlags
	NumTrains     uint8
	CarsPerTrain  uint8
	MinWaitTime   uint8
	MaxWaitTime   uint8
	TrackData     tracks.Data

	// set in bit 0 of the ride features list
	HasLoop         bool
	SteepLiftChain  bool
	CurvedLiftChain bool
	Banking         bool

	// set in bit 1
	SteepSlope        bool
	FlatToSteep       bool
	SlopedCurves      bool
	SteepTwist        bool
	SBends            bool
	SmallRadiusCurves bool
	SmallRadiusBanked bool

	NumInversions uint8
	MaxSpeed      uint8
	AverageSpeed  uint8

	VehicleType VehicleType

	// This is a little bit of a copout
	DatData []byte

	Egresses []*Egress

	Excitement int16
	Intensity  int16
	Nausea     int16
}

Technically this is track data that gets serialized to disk. A RCT2 Ride structure in memory has a different format.

func CreateMineTrainRide

func CreateMineTrainRide(elems []tracks.Element, complete bool) *Ride

CreateMineTrainRide takes a track and builds all the rest of the ride structure around it

complete: Whether to return a completed track or a partial one. Note RCT2 will crash unless you return a complete track

func NewCoaster

func NewCoaster() *Ride

Initialize a coaster with smarter defaults than the regular

func ReadRide

func ReadRide(filename string) *Ride

type RideType

type RideType int

type VehicleType

type VehicleType string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL