Module impostor.original
Return initial data for Config
| Print.text (text, x, y, color[, fixed[, scale]]) |
Prints text with shadow. |
| Print.text_center (text, x, y, color[, fixed[, scale]]) |
Prints centered text with shadow. |
| UI.draw_top_bar (title) |
Draws the top bar. |
| UI.draw_menu (items, selected_item, x, y[, centered]) |
Draws a menu. |
| UI.update_menu (items, selected_item) |
Updates menu selection. |
| UI.draw_textbox (text, box_x, box_y, box_w, box_h, scroll_y[, color[, bg_color[, border_color[, center_text]]]]) |
Draws a bordered textbox with scrolling text. |
| UI.word_wrap (text, max_chars_per_line) |
Wraps text. |
| Sprite.register (sprite_data) |
Registers a sprite definition. |
| Sprite.generate_table (width, height, starting_s, x_base, y_base, x_step, y_step) |
Generates a sprites table for a rectangular composite sprite. |
| Sprite.show (id, x, y[, colorkey[, scale[, flip_x[, flip_y[, rot]]]]]) |
Schedules a sprite for drawing. |
| Sprite.hide (id) |
Hides a displayed sprite. |
| Sprite.draw_at (id, x, y[, colorkey[, scale[, flip_x[, flip_y[, rot]]]]]) |
Draws a sprite immediately without scheduling it. |
| Sprite.draw () |
Draws all scheduled sprites. |
| TIC () |
Main game loop (TIC-80 callback). |
-
Config.reset ()
-
Restores default configuration settings.
-
Config.save ()
-
Saves the current configuration.
-
Config.load ()
-
Loads saved configuration.
-
AsciiArt.draw (text, options)
-
Draws ASCII art text using rectangles.
Parameters:
- text
string The ASCII art text to draw.
- options
table Configuration options (char_w, char_h, line_gap, word_gap, color, x, y).
-
RLE.draw (runs, values)
-
Draws an RLE-encoded image.
Parameters:
- runs
table Array of run lengths.
- values
table Array of pixel values (colors).
-
Audio.music_play (track)
-
Plays track, doesn't restart if already playing.
Parameters:
-
MysteriousManScreen.start ([options])
-
Starts the mysterious man screen.
Parameters:
- options
table Optional configuration.
Fields:
* text (string) Override for the scrolling text.
* day_text (string) Override for the centered day label.
* on_text_complete (function) Callback fired once when the text phase ends.
* skip_text (boolean) If true, skip the text phase and go straight to day display.
(optional)
-
MysteriousManScreen.set_text (new_text)
-
Sets the scrolling text content.
Parameters:
- new_text
string The text to display.
-
MinigameDDRWindow.draw_background ()
-
Background drawing for DDR minigame.
-
Ascension.get_initial ()
-
Gets initial ascension state.
Returns:
result table Initial ascension state.
Fields:
* level (number) Current ascension level (0-9).
-
Ascension.get_level ()
-
Gets the current ascension level.
Returns:
number The current ascension level (0-9).
-
Ascension.get_max_level ()
-
Gets the maximum ascension level.
Returns:
number The maximum ascension level.
-
Ascension.increase ()
-
Increases the ascension level by 1, clamped to the max.
-
Ascension.did_increase ()
-
Returns true if ascension was incremented since the last consume call.
Returns:
boolean Whether ascension increased this cycle.
-
Ascension.consume_increase ()
-
Consumes the increase flag, returning its value and resetting it.
Returns:
boolean Whether ascension had increased this cycle.
-
Ascension.is_complete ()
-
Returns true when the ascension meter is fully complete (level 10).
Returns:
boolean Whether the cycle can be broken.
-
Ascension.draw (x, y, options)
-
Draws the ascension meter as individual letters of "ASCENSION".
Each letter lights up per level. Drawn beneath existing meter bars.
Parameters:
- x
number Left x position.
- y
number Top y position.
- options
table Optional overrides: lit_color, dim_color, spacing.
-
Ascension.get_fade_color ()
-
Returns the current fade-in color based on progress through the palette.
Returns:
number The palette color index for the current fade step.
-
Ascension.start_fade ()
-
Starts the fade-in effect for the most recently gained letter.
-
Ascension.start_flash ()
-
Starts the ascension flash effect.
-
Ascension.draw_flash ()
-
Updates and draws the ascension flash overlay.
Call once per frame from the main loop.
-
Ascension.update_fade ()
-
Updates the fade-in timer. Call once per frame from the main loop.
-
Ascension.is_flashing ()
-
Returns whether a flash effect is currently active.
Returns:
boolean Whether the flash is playing.
-
Context.initial_data ()
-
Gets initial data for Context.
Returns:
result table Initial context data or nil.
Fields:
* current_menu_item (number) Index of the currently selected menu item.
* popup (table) Popup window state. Contains: `show` (boolean) whether popup is visible, `content` (table) array of strings to display.
* game_in_progress (boolean) Whether a game is currently active.
* minigame_ddr (table) DDR minigame state (see Minigame.get_default_ddr).
* minigame_button_mash (table) Button mash minigame state (see Minigame.get_default_button_mash).
* minigame_rhythm (table) Rhythm minigame state (see Minigame.get_default_rhythm).
* meters (table) Meter values (see Meter.get_initial).
* ascension (table) Ascension meter state (see Ascension.get_initial).
* triggers (table) Active trigger runtime state, keyed by trigger ID.
* stat_screen_active (boolean) Whether the stat screen overlay is currently shown.
* have_met_sumphore (boolean) Whether the player has talked to the homeless guy.
* have_been_to_office (boolean) Whether the player has been to the office.
* have_done_work_today (boolean) Whether the player has done work today.
* game (table) Current game progress state. Contains: `current_screen` (string) active screen ID, `current_situation` (string|nil) active situation ID.
-
Context.reset ()
-
Resets game context to initial state.
-
Context.new_game ()
-
Starts a new game.
-
Context.save_game ()
-
Saves the current game state.
-
Context.load_game ()
-
Loads a saved game state.
-
Util.safeindex (array, index)
-
Safely wraps an index for an array.
Parameters:
- array
table The array to index.
- index
number The desired index (can be out of bounds).
Returns:
number index The wrapped index within the array's bounds.
-
Util.go_to_screen_by_id (screen_id)
-
Navigates to a screen by its ID.
Parameters:
- screen_id
string The ID of the screen to go to.
-
Util.contains (t, value)
-
Checks if a table contains a specific value.
Parameters:
- t
table The table to check.
- value
any The value to look for.
Returns:
boolean true if the value is found, false otherwise.
-
Util.deepcopy (orig, seen)
-
Deep copies tables
Parameters:
- orig
any The value to deep copy.
- seen
any Used for recursive calls to handle loops
Returns:
any any The copied object
-
Print.text (text, x, y, color[, fixed[, scale]])
-
Prints text with shadow.
Parameters:
- text
string The text to print.
- x
number The x-coordinate.
- y
number The y-coordinate.
- color
number The color of the text.
- fixed
boolean If true, uses fixed-width font.
(optional)
- scale
number The scaling factor.
(optional)
-
Print.text_center (text, x, y, color[, fixed[, scale]])
-
Prints centered text with shadow.
Parameters:
- text
string The text to print.
- x
number The x-coordinate for centering.
- y
number The y-coordinate.
- color
number The color of the text.
- fixed
boolean If true, uses fixed-width font.
(optional)
- scale
number The scaling factor.
(optional)
-
Input.up ()
-
Checks if Up is pressed.
-
Input.down ()
-
Checks if Down is pressed.
-
Input.left ()
-
Checks if Left is pressed.
-
Input.right ()
-
Checks if Right is pressed.
-
Input.space ()
-
Checks if Space is pressed.
-
Input.select ()
-
Checks if Select is pressed.
-
Input.menu_confirm ()
-
Checks if Menu Confirm is pressed.
-
Input.player_interact ()
-
Checks if Player Interact is pressed.
-
Input.menu_back ()
-
Checks if Menu Back is pressed.
-
Input.toggle_popup ()
-
Checks if Toggle Popup is pressed.
-
Meter.get_initial ()
-
Gets initial meter values.
Returns:
result table Initial meter values.
Fields:
* ism (number) Initial ISM meter value.
* wpm (number) Initial WPM meter value.
* bm (number) Initial BM meter value.
* combo (number) Current combo count.
* combo_timer (number) Frames since last combo action.
* hidden (boolean) Whether meters are hidden.
-
Meter.hide ()
-
Hides meters.
-
Meter.show ()
-
Shows meters.
-
Meter.get_max ()
-
Gets max meter value.
Returns:
number The maximum meter value.
-
Meter.set_decay (amount)
-
Sets the decay amount applied to all meters per day.
Parameters:
- amount
number Amount to subtract from each meter.
-
Meter.get_decay_percentage ()
-
Gets the meter decay as a percentage of the max meter value.
Returns:
number The decay percentage per day.
-
Meter.get_combo_multiplier ()
-
Gets combo multiplier.
Returns:
number The current combo multiplier.
-
Meter.update ()
-
Updates all meters.
-
Meter.add (key, amount)
-
Adds amount to a meter.
Parameters:
- key
string The meter key (e.g., "wpm", "ism", "bm").
- amount
number The amount to add.
-
Meter.on_minigame_complete ()
-
Called on minigame completion.
-
Meter.draw ()
-
Draws meters.
-
Focus.start (cx, cy[, params])
-
Starts a focus overlay that reveals content through an expanding circle.
Parameters:
- cx
number The x-coordinate of the circle center.
- cy
number The y-coordinate of the circle center.
- params
table Optional parameters: `speed` (number) expansion rate in pixels/frame, `initial_radius` (number) starting radius in pixels (default 0), `on_complete` (function) callback when overlay disperses.
(optional)
-
Focus.close (cx, cy[, params])
-
Starts a closing focus overlay that hides content by shrinking the visible circle.
Parameters:
- cx
number The x-coordinate of the circle center.
- cy
number The y-coordinate of the circle center.
- params
table Optional parameters: `speed` (number) shrink rate in pixels/frame, `on_complete` (function) callback when screen is fully covered.
(optional)
-
Focus.start_driven (cx, cy[, params])
-
Starts a driven focus overlay whose radius is controlled externally via Focus.set_percentage().
The radius maps linearly from initial_radius (at 0%) to the screen corner distance (at 100%).
Parameters:
- cx
number The x-coordinate of the circle center.
- cy
number The y-coordinate of the circle center.
- params
table Optional parameters: `initial_radius` (number) radius at 0% (default 0).
(optional)
-
Focus.set_percentage (pct)
-
Sets the visible radius as a percentage of the full screen extent.
Only has effect when the overlay is in driven mode (started via Focus.start_driven).
Parameters:
- pct
number A value from 0 to 1 (0 = initial_radius, 1 = full screen).
-
Focus.is_active ()
-
Checks whether the focus overlay is currently active.
Returns:
boolean Whether the focus overlay is active.
-
Focus.stop ()
-
Stops the focus overlay immediately.
-
Focus.update ()
-
Updates the focus overlay animation. No-op in driven mode.
-
Focus.draw ()
-
Draws the focus overlay (black screen with circular cutout).
Must be called after all other drawing to appear on top of every visual layer.
-
Day.increase ()
-
Increases the day count and triggers registered handlers.
-
Day.register_handler (handler)
-
Registers a handler to be called when the day increases.
Parameters:
- handler
function The function to call when the day increases.
-
Timer.get_initial ()
-
Gets initial timer values.
Returns:
result table Initial timer values.
Fields:
* progress (number) Clock timer revolution progress (0 to 1).
-
Timer.set_duration (frames)
-
Sets the number of frames for one full timer revolution.
Parameters:
- frames
number Frames per revolution.
-
Timer.update ()
-
Updates the timer and handles revolution events.
-
Timer.draw ()
-
Draws the clock timer indicator as a circular progress bar.
-
Trigger.register (trigger)
-
Parameters:
- trigger table The trigger data table.
- id
string Unique trigger identifier.
- duration
number Duration in frames before the trigger fires.
- on_start
function Called when the trigger starts. Defaults to noop.
(optional)
- on_stop
function Called when the trigger fires or is manually stopped. Defaults to noop.
(optional)
- repeating
boolean If true, trigger restarts after firing. Defaults to false.
(optional)
-
Trigger.get_by_id (id)
-
Parameters:
- id
string The trigger ID.
Returns:
table|nil result The trigger definition or nil.
-
Trigger.get_all ()
-
Returns:
table result All trigger definitions keyed by ID.
-
Trigger.is_active (id)
-
Parameters:
- id
string The trigger ID.
Returns:
boolean active True if the trigger is running.
-
Trigger.start (id)
-
If already active, restarts from 0.
Parameters:
- id
string The trigger ID.
-
Trigger.stop (id)
-
Parameters:
- id
string The trigger ID.
-
Trigger.reset (id)
-
Resets elapsed time to 0 without calling handlers. No-op if inactive.
Parameters:
- id
string The trigger ID.
-
Trigger.update ()
-
Pauses during minigames.
-
Minigame.draw_win_overlay (win_text)
-
Draws a unified win message overlay.
Parameters:
-
Glitch.show ()
-
Shows the glitch effect.
-
Glitch.hide ()
-
Hides the glitch effect.
-
Glitch.draw ()
-
Draws the glitch effect if active.
-
Discussion.register (discussion)
-
Registers a discussion definition.
Parameters:
- discussion table The discussion data table.
- id
string Unique discussion identifier.
- steps
table Array of step tables, each with `question` (string) and `answers` (array of {label, next_step} tables).
- on_end
function Called when the discussion ends. Defaults to noop.
(optional)
-
Discussion.get_by_id (id)
-
Gets a discussion by ID.
Parameters:
- id
string The discussion ID.
Returns:
table|nil result The discussion table or nil.
-
Discussion.start (id, return_window[, start_step])
-
Starts a discussion, switching to the discussion window.
Parameters:
- id
string The discussion ID to start.
- return_window
string The window ID to return to after the discussion.
- start_step
number The step index to start from (defaults to 1).
(optional)
-
Discussion.get_current_step ()
-
Gets the current step data for the active discussion.
Returns:
table|nil result The current step table or nil.
-
Discussion.go_to_step (next_step)
-
Advances to a specific step or ends the discussion.
Parameters:
- next_step
number|nil The step index to go to, or nil to end.
-
Discussion.finish ()
-
Ends the active discussion and returns to the previous window.
-
UI.draw_top_bar (title)
-
Draws the top bar.
Parameters:
- title
string The title text to display.
-
UI.draw_menu (items, selected_item, x, y[, centered])
-
Draws a menu.
Parameters:
- items
table A table of menu items.
- selected_item
number The index of the currently selected item.
- x
number The x-coordinate for the menu (ignored if centered is true).
- y
number The y-coordinate for the menu.
- centered
boolean Whether to center the menu block horizontally. Defaults to false.
(optional)
-
UI.update_menu (items, selected_item)
-
Updates menu selection.
Parameters:
- items
table A table of menu items.
- selected_item
number The current index of the selected item.
Returns:
number selected_item The updated index of the selected item.
-
UI.draw_textbox (text, box_x, box_y, box_w, box_h, scroll_y[, color[, bg_color[, border_color[, center_text]]]])
-
Draws a bordered textbox with scrolling text.
Parameters:
- text
string The text to display (multi-line supported).
- box_x
number The x-coordinate of the box.
- box_y
number The y-coordinate of the box.
- box_w
number The width of the box.
- box_h
number The height of the box.
- scroll_y
number The vertical scroll offset for the text (0 = top, increases to scroll up).
- color
number The text color (default: Config.colors.white).
(optional)
- bg_color
number The background fill color (default: Config.colors.dark_grey).
(optional)
- border_color
number The border color (default: Config.colors.white).
(optional)
- center_text
boolean Whether to center each line inside the box. Defaults to false.
(optional)
-
UI.word_wrap (text, max_chars_per_line)
-
Wraps text.
Parameters:
- text
string The text to wrap.
- max_chars_per_line
number The maximum characters per line.
Returns:
result table A table of wrapped lines.
-
Audio.music_stop ()
-
Stops current music.
-
Audio.music_play_mainmenu ()
-
Plays main menu music.
-
Audio.music_play_mystery ()
-
Plays mystery man music.
-
Audio.music_play_wakingup ()
-
Plays waking up music.
-
Audio.music_play_room_morning ()
-
Plays room morning music.
-
Audio.music_play_room_street_1 ()
-
Plays room street 1 music.
-
Audio.music_play_room_street_2 ()
-
Plays room street 2 music.
-
Audio.music_play_room_ ()
-
Plays room music.
-
Audio.music_play_room_work ()
-
Plays room work music.
-
Audio.music_play_activity_work ()
-
Plays activity work music.
-
Audio.sfx_select ()
-
Plays select sound effect.
-
Audio.sfx_deselect ()
-
Plays deselect sound effect.
-
Audio.sfx_beep ()
-
Plays beep sound effect.
-
Audio.sfx_success ()
-
Plays success sound effect.
-
Audio.sfx_bloop ()
-
Plays bloop sound effect.
-
Audio.sfx_alarm ()
-
Plays alarm sound effect
-
Audio.sfx_drum_low ()
-
Plays drum sound effect.
-
Audio.sfx_drum_high ()
-
Plays drum sound effect.
-
Audio.sfx_arrowhit (note)
-
Plays sound effect for arrow hit
Parameters:
- note
string The note for the sound to play
-
frame_from_beat (beat, bpm[, fps])
-
Converts beats to frames.
Parameters:
- beat
number The beat number.
- bpm
number Beats per minute.
- fps
number Frames per second (default: 60).
(optional)
Returns:
number The corresponding frame number.
-
beats_to_pattern (beats, bpm, fps)
-
Converts beat notation to frame pattern.
Parameters:
- beats table A table of beat data, e.g., {{1, "left"}, {2, "down"}}.
- 1
number The beat number.
- 2
string Arrow direction ("left", "down", "up", or "right").
- bpm
number Beats per minute.
- fps
number Frames per second (default: 60).
(optional)
Returns:
result table The generated pattern or nil.
Fields:
* frame (number) The frame number when the arrow should spawn.
* dir (string) Arrow direction ("left", "down", "up", or "right").
-
Sprite.register (sprite_data)
-
Registers a sprite definition.
Parameters:
- sprite_data table A table containing the sprite definition.
- id
string Unique sprite identifier.
- s
number Sprite index for single-sprite mode.
(optional)
- colorkey
number Default color index for transparency.
(optional)
- scale
number Default scaling factor.
(optional)
- flip_x
number Set to 1 to flip horizontally by default.
(optional)
- flip_y
number Set to 1 to flip vertically by default.
(optional)
- rot
number Default rotation in degrees.
(optional)
- sprites
table Array of sub-sprite tables for composite sprites. Each entry has: `s` (number) sprite index, `x_offset` (number) horizontal offset, `y_offset` (number) vertical offset, and optional `colorkey`, `scale`, `flip_x`, `flip_y`, `rot` overrides.
(optional)
-
Sprite.generate_table (width, height, starting_s, x_base, y_base, x_step, y_step)
-
Generates a sprites table for a rectangular composite sprite.
Parameters:
- width
number The number of sprites wide.
- height
number The number of sprites tall.
- starting_s
number The sprite index of the top-left tile.
- x_base
number The base x-offset for the leftmost column.
- y_base
number The base y-offset for the topmost row.
- x_step
number The x-offset increment per column.
- y_step
number The y-offset increment per row.
Returns:
table The sprites table array.
-
Sprite.show (id, x, y[, colorkey[, scale[, flip_x[, flip_y[, rot]]]]])
-
Schedules a sprite for drawing.
Parameters:
- id
string The unique identifier of the sprite.
- x
number The x-coordinate.
- y
number The y-coordinate.
- colorkey
number The color index for transparency.
(optional)
- scale
number The scaling factor.
(optional)
- flip_x
number Set to 1 to flip horizontally.
(optional)
- flip_y
number Set to 1 to flip vertically.
(optional)
- rot
number The rotation in degrees.
(optional)
-
Sprite.hide (id)
-
Hides a displayed sprite.
Parameters:
- id
string The unique identifier of the sprite.
-
Sprite.draw_at (id, x, y[, colorkey[, scale[, flip_x[, flip_y[, rot]]]]])
-
Draws a sprite immediately without scheduling it.
Parameters:
- id
string The unique identifier of the sprite.
- x
number The x-coordinate.
- y
number The y-coordinate.
- colorkey
number The color index for transparency.
(optional)
- scale
number The scaling factor.
(optional)
- flip_x
number Set to 1 to flip horizontally.
(optional)
- flip_y
number Set to 1 to flip vertically.
(optional)
- rot
number The rotation in degrees.
(optional)
-
Sprite.draw ()
-
Draws all scheduled sprites.
-
Situation.register (situation)
-
Registers a situation definition.
Parameters:
- situation table The situation data table.
- id
string Unique situation identifier.
- screen_id
string ID of the screen this situation belongs to.
(optional)
- handle
function Called when the situation is applied. Defaults to noop.
(optional)
- update
function Called each frame while situation is active. Defaults to noop.
(optional)
-
Situation.get_by_id (id)
-
Gets a situation by ID.
Parameters:
- id
string The situation ID.
Returns:
result table The situation table or nil.
Fields:
* id (string) Unique situation identifier.
* screen_id (string) ID of the screen this situation belongs to.
* handle (function) Called when the situation is applied.
* update (function) Called each frame while situation is active.
-
Situation.get_all (screen_id)
-
Gets all registered situations, optionally filtered by screen ID.
Parameters:
- screen_id
string Optional. If provided, returns situations associated with this screen ID.
Returns:
result table A table containing all registered situation data, indexed by their IDs, or an array filtered by screen_id.
Fields:
* id (string) Unique situation identifier.
* screen_id (string) ID of the screen this situation belongs to.
* handle (function) Called when the situation is applied.
* update (function) Called each frame while situation is active.
-
Situation.apply (id, current_screen_id)
-
Applies a situation, checking screen compatibility and returning the new situation ID if successful.
Parameters:
- id
string The situation ID to apply.
- current_screen_id
string The ID of the currently active screen.
Returns:
string|nil The ID of the applied situation if successful, otherwise nil.
-
Decision.register (decision)
-
Registers a decision definition.
Parameters:
- decision table The decision data table.
- id
string Unique decision identifier.
- label
string|function Display text for the decision, or a function returning it.
- condition
function Returns true if decision is available. Defaults to always true.
(optional)
- handle
function Called when the decision is selected. Defaults to noop.
(optional)
-
Decision.get_label (decision)
-
Gets the display label for a decision.
Parameters:
- decision
table The decision data table.
Returns:
string result The resolved decision label.
-
Decision.get_by_id (id)
-
Gets a decision by ID.
Parameters:
- id
string The ID of the decision.
Returns:
table|nil result The decision table or nil.
Fields:
* id (string) Unique decision identifier.
* label (string) Display text for the decision.
* condition (function) Returns true if decision is available.
* handle (function) Called when the decision is selected.
-
Decision.get_all ()
-
Gets all registered decisions.
Returns:
result table A table of all registered decisions, indexed by their IDs.
Fields:
* id (string) Unique decision identifier.
* label (string) Display text for the decision.
* condition (function) Returns true if decision is available.
* handle (function) Called when the decision is selected.
-
Decision.get_for_screen (screen_data)
-
Gets decision objects based on a screen's data.
Parameters:
- screen_data table The data for the screen.
- decisions
table Array of decision ID strings.
Returns:
result table An array of decision objects relevant to the screen or nil.
Fields:
* id (string) Unique decision identifier.
* label (string) Display text for the decision.
* condition (function) Returns true if decision is available.
* handle (function) Called when the decision is selected.
-
Decision.filter_available (decisions_list)
-
Filters a list of decision objects based on their condition function.
Parameters:
- decisions_list
table A table of decision objects.
Returns:
result table An array of decisions for which condition() is true or nil.
Fields:
* id (string) Unique decision identifier.
* label (string) Display text for the decision.
* condition (function) Returns true if decision is available.
* handle (function) Called when the decision is selected.
-
Decision.draw (decisions, selected_decision_index)
-
Draws decision selector.
Parameters:
- decisions
table A table of decision items.
- selected_decision_index
number The index of the selected decision.
-
Decision.update (decisions, selected_decision_index)
-
Updates decision selector.
Parameters:
- decisions
table A table of decision items.
- selected_decision_index
number The current index of the selected decision.
Returns:
number selected_decision_index The updated index of the selected decision.
-
Map.get_maps_array ()
-
Gets all registered maps as an array.
Returns:
result table An array of registered map data.
Fields:
* id (string) Unique map identifier.
* from_x (number) Source tile X coordinate in the map sheet.
* from_y (number) Source tile Y coordinate in the map sheet.
* width (number) Width in tiles.
* height (number) Height in tiles.
* to_x (number) Destination X coordinate on screen.
* to_y (number) Destination Y coordinate on screen.
-
Map.register (map_data)
-
Registers a map definition.
Parameters:
- map_data table The map data table.
- id
string Unique map identifier.
- from_x
number Source tile X coordinate in the map sheet.
- from_y
number Source tile Y coordinate in the map sheet.
- width
number Width in tiles.
- height
number Height in tiles.
- to_x
number Destination X coordinate on screen.
- to_y
number Destination Y coordinate on screen.
-
Map.get_by_id (map_id)
-
Gets a map by ID.
Parameters:
- map_id
string The ID of the map.
Returns:
result table The map data table or nil.
Fields:
* id (string) Unique map identifier.
* from_x (number) Source tile X coordinate in the map sheet.
* from_y (number) Source tile Y coordinate in the map sheet.
* width (number) Width in tiles.
* height (number) Height in tiles.
* to_x (number) Destination X coordinate on screen.
* to_y (number) Destination Y coordinate on screen.
-
Map.draw (map_id)
-
Draws a map.
Parameters:
- map_id
string The ID of the map to draw.
-
Screen.register (screen_data)
-
Registers a screen definition.
Parameters:
- screen_data table The screen data table.
- id
string Unique screen identifier.
- name
string Display name of the screen.
- decisions
table Array of decision ID strings available on this screen.
- background
string Map ID used as background.
- situations
table Array of situation ID strings. Defaults to {}.
(optional)
- init
function Called when the screen is entered. Defaults to noop.
(optional)
- update
function Called each frame while screen is active. Defaults to noop.
(optional)
- draw
function Called after the focus overlay to draw screen-specific overlays. Defaults to noop.
(optional)
-
Screen.get_by_id (screen_id)
-
Gets a screen by ID.
Parameters:
- screen_id
string The ID of the screen.
Returns:
table|nil screen The screen table or nil.
Fields:
* id (string) Unique screen identifier.
* name (string) Display name.
* decisions (table) Array of decision ID strings.
* background (string) Map ID used as background.
* situations (table) Array of situation ID strings.
* init (function) Called when the screen is entered.
* update (function) Called each frame while screen is active.
-
Screen.get_all ()
-
Gets all registered screens.
Returns:
result table A table containing all registered screen data, indexed by their IDs or nil.
Fields:
* id (string) Unique screen identifier.
* name (string) Display name of the screen.
* decisions (table) Array of decision ID strings available on this screen.
* background (string) Map ID used as background.
* situations (table) Array of situation ID strings.
* init (function) Called when the screen is entered.
* update (function) Called each frame while screen is active.
-
Window.register (id, window_table)
-
Registers a window table.
Parameters:
- id
string The ID of the window (e.g., "splash", "menu").
- window_table
table The actual window module table (e.g., GameWindow).
-
Window.get (id)
-
Retrieves a registered window table by its ID.
Parameters:
- id
string The ID of the window.
Returns:
result table The window module table or nil.
Fields:
* update (function) Called each frame to update window logic.
* draw (function) Called each frame to draw the window.
-
Window.set_current (id)
-
Sets the currently active window.
Parameters:
- id
string The ID of the window to activate.
-
Window.get_current_id ()
-
Gets the ID of the currently active window.
This function is used by the main game loop to update and draw the active window.
Returns:
string The ID of the active window.
-
Window.get_current_handler ()
-
Gets the handler function for the currently active window.
This function is used by the main game loop to update and draw the active window.
Returns:
function A function that updates and draws the current window.
-
EndWindow.draw ()
-
Draws the end screen window.
-
EndWindow.update ()
-
Updates the end screen logic.
-
TitleIntroWindow.draw ()
-
Draws the title intro window.
-
TitleIntroWindow.update ()
-
Updates the title intro window logic.
-
TTGIntroWindow.draw ()
-
Draws the TTG intro window.
-
TTGIntroWindow.update ()
-
Updates the TTG intro window logic.
-
BriefIntroWindow.draw ()
-
Draws the brief intro window.
-
BriefIntroWindow.update ()
-
Updates the brief intro window logic.
-
MenuWindow.draw ()
-
Draws the menu window.
-
MenuWindow.update ()
-
Updates the menu window logic.
-
MenuWindow.new_game ()
-
Starts a new game from the menu.
-
MenuWindow.load_game ()
-
Loads a game from the menu.
-
MenuWindow.save_game ()
-
Saves the current game from the menu.
-
MenuWindow.resume_game ()
-
Resumes the game from the menu.
-
MenuWindow.exit ()
-
Exits the game.
-
MenuWindow.configuration ()
-
Opens the configuration menu.
-
MenuWindow.audio_test ()
-
Opens the audio test menu.
-
MenuWindow.continued ()
-
Opens the continued screen.
-
MenuWindow.ddr_test ()
-
Opens the minigame ddr test menu.
-
MenuWindow.refresh_menu_items ()
-
Refreshes menu items.
-
ConfigurationWindow.init ()
-
Initializes configuration window.
-
ConfigurationWindow.draw ()
-
Draws configuration window.
-
ConfigurationWindow.update ()
-
Updates configuration window logic.
-
AudioTestWindow.generate_menuitems (list_func, index_func)
-
Generates menu items for audio test.
Parameters:
- list_func
table List of audio functions.
- index_func
number Current index of selected function.
Returns:
result table Generated menu items, an array of menu item tables or nil.
Fields:
* label (string) Display text for the menu item.
* decision (function) Called when the menu item is selected.
-
AudioTestWindow.generate_listfunc ()
-
Generates list of audio functions.
Returns:
result table A sorted list of audio function names.
-
AudioTestWindow.back ()
-
Navigates back from audio test window.
-
AudioTestWindow.init ()
-
Initializes audio test window.
-
AudioTestWindow.draw ()
-
Draws audio test window.
-
AudioTestWindow.update ()
-
Updates audio test window logic.
-
PopupWindow.show (content_strings)
-
Displays a popup window.
Parameters:
- content_strings
table A table of strings to display in the popup.
-
PopupWindow.hide ()
-
Hides the popup window.
-
PopupWindow.update ()
-
Updates popup window logic.
-
PopupWindow.draw ()
-
Draws the popup window.
-
MinigameButtonMashWindow.init_context ()
-
Gets initial button mash minigame configuration.
Returns:
result table The default button mash minigame configuration.
-
MinigameButtonMashWindow.init (params)
-
Initializes button mash minigame state.
Parameters:
- params
table Optional parameters for configuration.
-
MinigameButtonMashWindow.start (return_window[, params])
-
Starts the button mash minigame.
Parameters:
- return_window
string The window ID to return to after the minigame.
- params
table Optional parameters for minigame configuration.
(optional)
-
MinigameButtonMashWindow.update ()
-
Updates button mash minigame logic.
-
MinigameButtonMashWindow.draw ()
-
Draws button mash minigame.
-
MinigameRhythmWindow.init_context ()
-
Gets initial rhythm minigame configuration.
Returns:
result table The default rhythm minigame configuration.
-
MinigameRhythmWindow.init (params)
-
Initializes rhythm minigame state.
Parameters:
- params
table Optional parameters for configuration.
-
MinigameRhythmWindow.start (return_window[, params])
-
Starts the rhythm minigame.
Parameters:
- return_window
string The window ID to return to after the minigame.
- params
table Optional parameters for minigame configuration.
(optional)
-
MinigameRhythmWindow.update ()
-
Updates rhythm minigame logic.
-
MinigameRhythmWindow.draw ()
-
Draws rhythm minigame.
-
MinigameDDRWindow.init_context ()
-
Gets initial DDR minigame configuration.
Returns:
result table The default DDR minigame configuration.
-
MinigameDDRWindow.init (params)
-
Initializes DDR minigame state.
Parameters:
- params
table Optional parameters for configuration.
-
MinigameDDRWindow.start (return_window[, song_key[, params]])
-
Starts the DDR minigame.
Parameters:
- return_window
string The window ID to return to after the minigame.
- song_key
string The key of the song to play.
(optional)
- params
table Optional parameters for minigame configuration.
(optional)
-
MinigameDDRWindow.update ()
-
Updates DDR minigame logic.
-
MinigameDDRWindow.draw ()
-
Draws DDR minigame.
-
DiscussionWindow.draw ()
-
Draws the discussion window.
-
DiscussionWindow.update ()
-
Updates the discussion window logic.
-
ContinuedWindow.draw ()
-
Draws the continued window.
-
ContinuedWindow.update ()
-
Updates the continued window logic.
-
GameWindow.draw ()
-
Draws the game window.
-
GameWindow.draw_with_underlay (underlay_draw)
-
Draws the game window with a custom underlay.
Parameters:
- underlay_draw
function A draw callback rendered after the background but before overlays.
-
GameWindow.update ()
-
Updates the game window logic.
-
GameWindow.set_state (new_state)
-
Sets the active window.
Parameters:
- new_state
string The ID of the new active window.
-
TIC ()
-
Main game loop (TIC-80 callback).