Options
All
  • Public
  • Public/Protected
  • All
Menu

wastelib

Index

Type aliases

WastelandFilename

WastelandFilename: "ALLHTDS1" | "ALLHTDS2" | "ALLPICS1" | "ALLPICS2" | "COLORF.FNT" | "CURS" | "END.CPA" | "GAME1" | "GAME2" | "IC0_9.WLF" | "MASKS.WLF" | "TITLE.PIC"

A type for wasteland filenames to ensure they are all written correctly.

Variables

COLOR_PALETTE

COLOR_PALETTE: Array<number> = [0x000000ff /* 0=Black */ ,0x0000aaff /* 1=Blue */ ,0x00aa00ff /* 2=Green */ ,0x00aaaaff /* 3=Cyan */ ,0xaa0000ff /* 4=Red */ ,0xaa00aaff /* 5=Magenta */ ,0xaa5500ff /* 6=Brown */ ,0xaaaaaaff /* 7=Light Gray */ ,0x555555ff /* 8=Gray */ ,0x5555ffff /* 9=Light Blue */ ,0x55ff55ff /* 10=Light Green */ ,0x55ffffff /* 11=Light Cyan */ ,0xff5555ff /* 12=Light Red */ ,0xff55ffff /* 13=Light Magenta */ ,0xffff55ff /* 14=Yellow */ ,0xffffffff /* 15=White */]

The 16 colors (In RGBA format) used by the game graphics.

TRANSPARENCY

TRANSPARENCY: number = 0

Transparent RGBA color.

Functions

createCanvas

  • createCanvas(width?: undefined | number, height?: undefined | number): HTMLCanvasElement
  • Creates a canvas with the given optional size. In Node.js a node-canvas is created and returned.

    Parameters

    • Optional width: undefined | number

      Optional width in pixels.

    • Optional height: undefined | number

      Optional height in pixels.

    Returns HTMLCanvasElement

    The created canvas.

createImage

  • createImage(): HTMLImageElement
  • Creates and returns a new HTML image element. In Node.js the special image implementation of node-canvas is returned instead.

    Returns HTMLImageElement

    The created HTML image element.

decodeHuffman

  • decodeHuffman(reader: BinaryReader, size: number): Uint8Array
  • Decodes huffman encoded data read from the given reader and returns the decoded data.

    Parameters

    • reader: BinaryReader

      The reader to read the encoded data from. The current position of the reader must point to the beginning of the huffman tree. After decoding the reader position is set to the next full byte after the encoded data.

    • size: number

      The number of bytes to decode. Defines the size of the returned array.

    Returns Uint8Array

    The decoded data.

decodeVxor

  • decodeVxor(data: ArrayLike<number>, width: number, size?: number, offset?: number): Uint8Array
  • Decodes a vertical xor encoded data block.

    Parameters

    • data: ArrayLike<number>

      The array containing the data to decode.

    • width: number

      The line width in bytes (not pixels) for decoding.

    • Default value size: number = data.length

      The number of bytes to decode.

    • Default value offset: number = 0

      Optional start offset in the data array to decode. Defaults to 0.

    Returns Uint8Array

    A new array with the decoded bytes.

decodeVxorInplace

  • decodeVxorInplace(data: Uint8Array, width: number, size?: number, offset?: number): Uint8Array
  • Decodes a vertical xor encoded data block inplace.

    Parameters

    • data: Uint8Array

      The array containing the data to decode.

    • width: number

      The line width in bytes (not pixels) for decoding.

    • Default value size: number = data.length

      The number of bytes to decode.

    • Default value offset: number = 0

      Optional start offset in the data array to decode. Defaults to 0.

    Returns Uint8Array

    Reference to the passed data array now containing the decoded bytes.

Generated using TypeDoc