Skip to content

Commit

Permalink
fix some more stuff, generate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 1, 2023
1 parent d39faa8 commit d941d4a
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 45 deletions.
19 changes: 14 additions & 5 deletions docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
"int64_t": "int",
"ImU32": "int",
"in_port_t": "int",
"custom_vector<": "array<",
"vector<": "array<",
"span<": "array<",
"unordered_map<": "map<",
"game_map<": "map<",
"custom_map<": "map<",
", identity_hasher<>": "",
"const char*": "string",
"wstring": "string",
Expand All @@ -40,6 +42,7 @@
"variadic_args va": "int, int...",
"EmittedParticlesInfo": "array<Particle>",
"ImVec2": "Vec2",
"SoundCallbackFunction": "function",
}


Expand Down
1 change: 1 addition & 0 deletions docs/generate_emmylua.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"int32_t": "integer",
"int64_t": "integer",
"size_t": "integer",
"in_port_t": "integer",
"ImU32": "integer",
"vector": "Array",
"array": "Array",
Expand Down
12 changes: 6 additions & 6 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Hook the sendto and recvfrom functions and start dumping network data to termina

> Search script examples for [get_address](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_address)
#### size_t get_address(string_view address_name)
#### size_t get_address(string address_name)

Get the address for a pattern name

Expand All @@ -365,7 +365,7 @@ Get the address for a pattern name

> Search script examples for [get_rva](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_rva)
#### size_t get_rva(string_view address_name)
#### size_t get_rva(string address_name)

Get the rva for a pattern name

Expand Down Expand Up @@ -1991,7 +1991,7 @@ Show a message that looks like a level feeling.

> Search script examples for [make_custom_behavior](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=make_custom_behavior)
#### [CustomMovableBehavior](#CustomMovableBehavior) make_custom_behavior(string_view behavior_name, int state_id, [VanillaMovableBehavior](#VanillaMovableBehavior) base_behavior)
#### [CustomMovableBehavior](#CustomMovableBehavior) make_custom_behavior(string behavior_name, int state_id, [VanillaMovableBehavior](#VanillaMovableBehavior) base_behavior)

Make a `CustomMovableBehavior`, if `base_behavior` is `nil` you will have to set all of the
behavior functions. If a behavior with `behavior_name` already exists for your script it will
Expand All @@ -2005,7 +2005,7 @@ be returned instead.

> Search script examples for [udp_listen](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=udp_listen)
#### UdpServer udp_listen(string host, in_port_t port, function cb)
#### UdpServer udp_listen(string host, int port, function cb)

Start an UDP server on specified address and run callback when data arrives. Return a string from the callback to reply. Requires unsafe mode.
The server will be closed once the handle is released.
Expand All @@ -2015,7 +2015,7 @@ The server will be closed once the handle is released.

> Search script examples for [udp_send](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=udp_send)
#### nil udp_send(string host, in_port_t port, string msg)
#### nil udp_send(string host, int port, string msg)

Send data to specified UDP address. Requires unsafe mode.

Expand Down Expand Up @@ -2476,7 +2476,7 @@ Get the room template given a certain index, returns `nil` if coordinates are ou

> Search script examples for [get_room_template_name](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_room_template_name)
#### string_view get_room_template_name(int room_template)
#### string get_room_template_name(int room_template)

For debugging only, get the name of a room template, returns `'invalid'` if room template is not defined

Expand Down
57 changes: 37 additions & 20 deletions docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ float | [tileh](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=tileh)
bool | [facing_left](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=facing_left) |
bool | [render_inactive](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=render_inactive) |
int | [texture_num](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=texture_num) |
class [Entity](#Entity) | [get_entity()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entity) |
[Entity](#Entity) | [get_entity()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entity) |
bool | [set_normal_map_texture(TEXTURE texture_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_normal_map_texture) | Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps)
optional&lt;[TEXTURE](#TEXTURE)&gt; | [get_second_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_second_texture) |
optional&lt;[TEXTURE](#TEXTURE)&gt; | [get_third_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_third_texture) |
Expand Down Expand Up @@ -835,7 +835,7 @@ Used in [StateMemory](#StateMemory)

Type | Name | Description
---- | ---- | -----------
custom_map&lt;int, [ItemOwnerDetails](#ItemOwnerDetails)&gt; | [owned_items](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_items) | key/index is the uid of an item
map&lt;int, [ItemOwnerDetails](#ItemOwnerDetails)&gt; | [owned_items](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_items) | key/index is the uid of an item
array&lt;[RoomOwnerDetails](#RoomOwnerDetails)&gt; | [owned_rooms](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_rooms) |

### ShortTileCodeDef
Expand All @@ -848,6 +848,14 @@ Type | Name | Description
int | [chance](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=chance) | Chance in percent to pick `tile_code` over `alt_tile_code`, ignored if `chance == 0`. Defaults to 100.
[TILE_CODE](#TILE_CODE) | [alt_tile_code](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=alt_tile_code) | Alternative tile code, ignored if `chance == 100`. Defaults to 0.

### SpearDanglerAnimFrames


Type | Name | Description
---- | ---- | -----------
int | [column](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=column) |
int | [row](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=row) |

### Triangle


Expand Down Expand Up @@ -1189,15 +1197,15 @@ Data relating to level generation, changing anything in here from [ON](#ON).LEVE

Type | Name | Description
---- | ---- | -----------
ShopType | [shop_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=shop_type) |
ShopType | [backlayer_shop_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=backlayer_shop_type) |
[SHOP_TYPE](#SHOP_TYPE) | [shop_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=shop_type) |
[SHOP_TYPE](#SHOP_TYPE) | [backlayer_shop_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=backlayer_shop_type) |
int | [shop_music](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=shop_music) |
int | [backlayer_shop_music](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=backlayer_shop_music) |
float | [spawn_x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_x) |
float | [spawn_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_y) |
int | [spawn_room_x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_room_x) |
int | [spawn_room_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_room_y) |
custom_array&lt;[Vec2](#Vec2)&gt; | [exit_doors](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=exit_doors) |
array&lt;[Vec2](#Vec2)&gt; | [exit_doors](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=exit_doors) |
[ThemeInfo](#ThemeInfo) | [themes[18]](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=themes) |

## Lighting types
Expand Down Expand Up @@ -1326,9 +1334,18 @@ Type | Name | Description
---- | ---- | -----------
[LogicOlmecCutscene](#LogicOlmecCutscene) | [olmec_cutscene](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=olmec_cutscene) |
[LogicTiamatCutscene](#LogicTiamatCutscene) | [tiamat_cutscene](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=tiamat_cutscene) |
LogicMagmamanSpawn | [magmaman_spawn](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_spawn) |
[LogicMagmamanSpawn](#LogicMagmamanSpawn) | [magmaman_spawn](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_spawn) |
[LogicDiceShop](#LogicDiceShop) | [diceshop](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=diceshop) |

### LogicMagmamanSpawn

Derived from [Logic](#Logic)


Type | Name | Description
---- | ---- | -----------
array&lt;[MagmamanSpawnPosition](#MagmamanSpawnPosition)&gt; | [magmaman_positions](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_positions) |

### LogicOlmecCutscene

Used in [LogicList](#LogicList)
Expand All @@ -1355,15 +1372,6 @@ Type | Name | Description
[Entity](#Entity) | [cinematic_anchor](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=cinematic_anchor) |
int | [timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=timer) |

### LogicVolcana

Derived from [Logic](#Logic)


Type | Name | Description
---- | ---- | -----------
custom_array&lt;[MagmamanSpawnPosition](#MagmamanSpawnPosition)&gt; | [magmaman_positions](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_positions) |

## Online types


Expand Down Expand Up @@ -1610,7 +1618,15 @@ int | [max_page_count](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=
int | [page_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_timer) |
int | [fade_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=fade_timer) |
int | [opacity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=opacity) |
custom_array&lt;[JournalPage](#JournalPage)&gt; | [pages](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pages) | Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.<br/>Use `:get_type()` to chcek page type and cast it correctly (see ON.[RENDER_POST_DRAW_DEPTH](#ON-RENDER_PRE_JOURNAL_PAGE))
array&lt;[JournalPage](#JournalPage)&gt; | [pages](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pages) | Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.<br/>Use `:get_type()` to chcek page type and cast it correctly (see ON.[RENDER_POST_DRAW_DEPTH](#ON-RENDER_PRE_JOURNAL_PAGE))

### OnlineLobbyScreenPlayer


Type | Name | Description
---- | ---- | -----------
int | [character](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=character) | 0 - Ana Spelunky, 1 - Margaret Tunnel, 2 - Colin Northward, 3 - Roffy D. Sloth.. and so on. Same order as in [ENT_TYPE](#ENT_TYPE)
bool | [ready](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ready) |

### PauseUI

Expand Down Expand Up @@ -2059,7 +2075,7 @@ int | [selected_menu_index](https://github.com/spelunky-fyi/overlunky/search?l=L
float | [menu_text_opacity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=menu_text_opacity) |
float | [menu_text_opacity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=menu_text_opacity) |
array&lt;float, 6&gt; | [spear_position](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spear_position) |
array&lt;SpearDanglerAnimFrames, 6&gt; | [spear_dangler](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spear_dangler) |
array&lt;[SpearDanglerAnimFrames](#SpearDanglerAnimFrames), 6&gt; | [spear_dangler](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spear_dangler) |
float | [play_scroll_descend_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=play_scroll_descend_timer) |
[STRINGID](#Aliases) | [scroll_text](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=scroll_text) |

Expand Down Expand Up @@ -2093,7 +2109,7 @@ float | [scroll_unfurl_timer](https://github.com/spelunky-fyi/overlunky/search?l
bool | [woodpanel_top_visible](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_top_visible) |
bool | [woodpanel_bottom_visible](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_bottom_visible) |
bool | [toggle_panels_slidein](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=toggle_panels_slidein) |
array&lt;OnlineLobbyScreenPlayer, 4&gt; | [players](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=players) |
array&lt;[OnlineLobbyScreenPlayer](#OnlineLobbyScreenPlayer), 4&gt; | [players](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=players) |
[TextureRenderingInfo](#TextureRenderingInfo) | [background_image](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=background_image) |
[TextureRenderingInfo](#TextureRenderingInfo) | [topleft_woodpanel_esc](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=topleft_woodpanel_esc) |
float | [topleft_woodpanel_esc_slidein_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=topleft_woodpanel_esc_slidein_timer) |
Expand Down Expand Up @@ -2400,7 +2416,7 @@ bool | [set_pitch(float pitch)](https://github.com/spelunky-fyi/overlunky/search
bool | [set_pan(float pan)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pan) |
bool | [set_volume(float volume)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_volume) |
bool | [set_looping(SOUND_LOOP_MODE loop_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_looping) |
bool | [set_callback(SoundCallbackFunction callback)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_callback) |
bool | [set_callback(function callback)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_callback) |
map&lt;[VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM), string&gt; | [get_parameters()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameters) |
optional&lt;float&gt; | [get_parameter(VANILLA_SOUND_PARAM parameter_index)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameter) |
bool | [set_parameter(VANILLA_SOUND_PARAM parameter_index, float value)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_parameter) |
Expand Down Expand Up @@ -2696,12 +2712,13 @@ int | [text_length](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=tex
float | [width](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=width) |
float | [height](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=height) |
int | [special_texture_id](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=special_texture_id) | Used to draw buttons and stuff, default is -1 wich uses the buttons texture
Texture | [font](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=font) |
array&lt;[Letter](#Letter)&gt; | [get_dest()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_dest) | Returns refrence to the letter coordinates relative to the x,y position
array&lt;[Letter](#Letter)&gt; | [get_source()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_source) | Returns refrence to the letter coordinates in the texture
tuple&lt;float, float&gt; | [text_size()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=text_size) | {width, height}, is only updated when you set/change the text. This is equivalent to draw_text_size
nil | [rotate(float angle, optional<float> px, optional<float> py)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=rotate) | Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it
nil | [set_text(const string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_text) | Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters
[TEXTURE](#TEXTURE) | [get_font()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_font) |
nil | [set_font(TEXTURE id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_font) |

### TextureDefinition

Expand Down
3 changes: 3 additions & 0 deletions docs/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"int64_t": "int",
"ImU32": "int",
"in_port_t": "int",
"custom_vector<": "array<",
"vector<": "array<",
"span<": "array<",
"unordered_map<": "map<",
"game_map<": "map<",
"custom_map<": "map<",
", identity_hasher<>": "",
"const char*": "string",
"wstring": "string",
Expand All @@ -33,6 +35,7 @@
"variadic_args va": "int, int...",
"EmittedParticlesInfo": "array<Particle>",
"ImVec2": "Vec2",
"SoundCallbackFunction": "function",
}

def replace_all(text):
Expand Down
Loading

0 comments on commit d941d4a

Please sign in to comment.