From d00a6b10c68015984354fc951af6c91bd73111e4 Mon Sep 17 00:00:00 2001 From: zappatic Date: Mon, 20 Sep 2021 12:25:23 +0200 Subject: [PATCH] implement online lobby stuff (#148) --- docs/game_data/spel2.lua | 13 + docs/generate.py | 4 +- docs/script-api.md | 136 +++-- src/game_api/game_manager.hpp | 20 +- src/game_api/online.cpp | 19 + src/game_api/online.hpp | 79 +++ src/game_api/screen.cpp | 25 + src/game_api/screen.hpp | 121 ++++- src/game_api/script/lua_vm.cpp | 5 + .../script/usertypes/screen_arena_lua.cpp | 381 ++++++++++++++ .../script/usertypes/screen_arena_lua.hpp | 8 + src/game_api/script/usertypes/screen_lua.cpp | 477 ++++-------------- src/game_api/script/usertypes/state_lua.cpp | 31 ++ 13 files changed, 915 insertions(+), 404 deletions(-) create mode 100644 src/game_api/online.cpp create mode 100644 src/game_api/online.hpp create mode 100644 src/game_api/script/usertypes/screen_arena_lua.cpp create mode 100644 src/game_api/script/usertypes/screen_arena_lua.hpp diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index 262daaa05..7feee1566 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -1533,6 +1533,9 @@ GHOST_BEHAVIOR = { GameManager = { __name = "sol.GameManager.user" } +GameProps = { + __name = "sol.GameProps.user" +} Generator = { __index = "function", __name = "sol.Generator.user", @@ -2062,6 +2065,15 @@ Olmite = { __name = "sol.Olmite.user", __newindex = "function" } +Online = { + __name = "sol.Online.user" +} +OnlineLobby = { + __name = "sol.OnlineLobby.user" +} +OnlinePlayer = { + __name = "sol.OnlinePlayer.user" +} Orb = { __index = "function", __name = "sol.Orb.user", @@ -4923,6 +4935,7 @@ messpect = function(...) end modify_sparktraps = function(...) end mouse_position = function(...) end move_entity = function(...) end +online = {} options = {} os = { clock = "function", diff --git a/docs/generate.py b/docs/generate.py index d137fce0a..0a4f0c93b 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -34,6 +34,7 @@ "../src/game_api/items.hpp", "../src/game_api/screen.hpp", "../src/game_api/screen_arena.hpp", + "../src/game_api/online.hpp", "../src/game_api/script/usertypes/level_lua.hpp", "../src/game_api/script/usertypes/gui_lua.hpp", "../src/game_api/script/usertypes/vanilla_render_lua.hpp", @@ -73,6 +74,7 @@ "../src/game_api/script/usertypes/char_state_lua.cpp", "../src/game_api/script/usertypes/hitbox_lua.cpp", "../src/game_api/script/usertypes/screen_lua.cpp", + "../src/game_api/script/usertypes/screen_arena_lua.cpp", ] rpc = [] classes = [] @@ -107,7 +109,7 @@ "variadic_args va": "int, int...", } comment = [] -not_functions = ["players", "state", "savegame", "options", "meta", "prng"] +not_functions = ["players", "state", "game_manager", "online", "savegame", "options", "meta", "prng"] skip = False diff --git a/docs/script-api.md b/docs/script-api.md index 3260d6d77..c2af9e46a 100644 --- a/docs/script-api.md +++ b/docs/script-api.md @@ -91,6 +91,10 @@ if state.time_level > 300 and state.theme == THEME.DWELLING then toast("Congratulations for lasting 5 seconds in Dwelling") end ``` +### [`game_manager`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=game_manager) +The GameManager gives access to a couple of Screens as well as the pause and journal UI elements +### [`online`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=online) +The Online object has information about the online lobby and its players ### [`players`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=players) An array of [Player](#player) of the current players. Pro tip: You need `players[1].uid` in most entity functions. ### [`savegame`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=savegame) @@ -105,9 +109,6 @@ If you don't care what part of the game you affect just use `prng.random`. The global prng state, calling any function on it will advance the prng state, thus desynchronizing clients if it does not happen on both clients. ## Functions Note: The game functions like `spawn` use [level coordinates](#get_position). Draw functions use normalized [screen coordinates](#screen_position) from `-1.0 .. 1.0` where `0.0, 0.0` is the center of the screen. -### [`game_manager`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=game_manager) -`nil game_manager()`
-The GameManager gives access to a couple of Screens as well as the pause and journal UI elements ### [`lua_print`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lua_print) `nil lua_print()`
Standard lua print function, prints directly to the console but not to the game @@ -1004,6 +1005,7 @@ end Returns animation_frame of the correct ushabti - [`nil set_correct_ushabti(int animation_frame)`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_correct_ushabti) &StateMemory::set_correct_ushabti ### `GameManager` +- [`GameProps game_props`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=game_props) &GameManager::game_props - [`ScreenLogo screen_logo`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=screen_logo) &GameManager::screen_logo - [`ScreenIntro screen_intro`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=screen_intro) &GameManager::screen_intro - [`ScreenPrologue screen_prologue`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=screen_prologue) &GameManager::screen_prologue @@ -1022,6 +1024,9 @@ Returns animation_frame of the correct ushabti - [`ScreenOnlineLobby screen_online_lobby`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=screen_online_lobby) &GameManager::screen_online_lobby - [`PauseUI pause_ui`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pause_ui) &GameManager::pause_ui - [`JournalUI journal_ui`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=journal_ui) &GameManager::journal_ui +### `GameProps` +- [`int buttons`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=buttons) &GameProps::buttons +- [`bool game_has_focus`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=game_has_focus) &GameProps::game_has_focus ### `LightParams` - [`float red`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=red) &LightParams::red - [`float green`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=green) &LightParams::green @@ -1068,6 +1073,19 @@ see [flags.hpp](../src/game_api/flags.hpp) illumination_flags - [`bool uniform_shake`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=uniform_shake) &Camera::uniform_shake - [`int focused_entity_uid`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=focused_entity_uid) &Camera::focused_entity_uid - [`float inertia`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=inertia) &Camera::inertia +### `Online` +- [`array online_players`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=online_players) &Online::online_players +- [`OnlinePlayer local_player`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=local_player) &Online::local_player +- [`OnlineLobby lobby`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lobby) &Online::lobby +### `OnlinePlayer` +- [`int ready_state`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ready_state) &OnlinePlayer::ready_state +- [`int character`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=character) &OnlinePlayer::character +- [`player_name`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_name) &OnlinePlayer::player_name +### `OnlineLobby` +- [`int code`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=code) &OnlineLobby::code +- [`string get_code()`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_code) &OnlineLobby::get_code +\ +Gets the string equivalent of the code ### `PRNG` PRNG (short for Pseudo-Random-Number-Generator) holds 10 128bit wide buffers of memory that are mutated on every generation of a random number. The game uses specific buffers for specific scenarios, for example the third buffer is used every time particles are spawned to determine a random velocity. @@ -3393,6 +3411,89 @@ Derived from [`Screen`](#screen) - [`float constellation_text_opacity`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=constellation_text_opacity) &ScreenConstellation::constellation_text_opacity ### `ScreenRecap` Derived from [`Screen`](#screen) +### `ScreenOnlineLoading` +Derived from [`Screen`](#screen) +- [`TextureRenderingInfo ouroboros`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ouroboros) &ScreenOnlineLoading::ouroboros +- [`float ouroboros_angle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ouroboros_angle) &ScreenOnlineLoading::ouroboros_angle +### `ScreenOnlineLobby` +Derived from [`Screen`](#screen) +- [`float woodpanels_slidein_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanels_slidein_timer) &ScreenOnlineLobby::woodpanels_slidein_timer +- [`float scroll_unfurl_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=scroll_unfurl_timer) &ScreenOnlineLobby::scroll_unfurl_timer +- [`TextureRenderingInfo woodpanel_bottom`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_bottom) &ScreenOnlineLobby::woodpanel_bottom +- [`TextureRenderingInfo woodpanel_top`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_top) &ScreenOnlineLobby::woodpanel_top +- [`TextureRenderingInfo left_scroll_handle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=left_scroll_handle) &ScreenOnlineLobby::left_scroll_handle +- [`TextureRenderingInfo right_scroll_handle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=right_scroll_handle) &ScreenOnlineLobby::right_scroll_handle +- [`int scroll_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=scroll_text_id) &ScreenOnlineLobby::scroll_text_id +- [`int btn_left_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=btn_left_text_id) &ScreenOnlineLobby::btn_left_text_id +- [`int btn_right_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=btn_right_text_id) &ScreenOnlineLobby::btn_right_text_id +- [`int btn_center_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=btn_center_text_id) &ScreenOnlineLobby::btn_center_text_id +- [`bool woodpanel_top_visible`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_top_visible) &ScreenOnlineLobby::woodpanel_top_visible +- [`bool woodpanel_bottom_visible`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_bottom_visible) &ScreenOnlineLobby::woodpanel_bottom_visible +- [`bool toggle_panels_slidein`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=toggle_panels_slidein) &ScreenOnlineLobby::toggle_panels_slidein +- [`array players`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=players) &ScreenOnlineLobby::players +- [`TextureRenderingInfo background_image`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=background_image) &ScreenOnlineLobby::background_image +- [`TextureRenderingInfo topleft_woodpanel_esc`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=topleft_woodpanel_esc) &ScreenOnlineLobby::topleft_woodpanel_esc +- [`float topleft_woodpanel_esc_slidein_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=topleft_woodpanel_esc_slidein_timer) &ScreenOnlineLobby::topleft_woodpanel_esc_slidein_timer +- [`float character_walk_offset`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=character_walk_offset) &ScreenOnlineLobby::character_walk_offset +- [`bool character_facing_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=character_facing_left) &ScreenOnlineLobby::character_facing_left +- [`int move_direction`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=move_direction) &ScreenOnlineLobby::move_direction +- [`TextureRenderingInfo character`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=character) &ScreenOnlineLobby::character +- [`TextureRenderingInfo player_ready_icon`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_ready_icon) &ScreenOnlineLobby::player_ready_icon +- [`TextureRenderingInfo arrow_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_left) &ScreenOnlineLobby::arrow_left +- [`TextureRenderingInfo arrow_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_right) &ScreenOnlineLobby::arrow_right +- [`float arrow_left_hor_offset`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_left_hor_offset) &ScreenOnlineLobby::arrow_left_hor_offset +- [`float arrow_right_hor_offset`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_right_hor_offset) &ScreenOnlineLobby::arrow_right_hor_offset +- [`TextureRenderingInfo platform_icon`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=platform_icon) &ScreenOnlineLobby::platform_icon +- [`int player_count`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_count) &ScreenOnlineLobby::player_count +- [`bool searching_for_players`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=searching_for_players) &ScreenOnlineLobby::searching_for_players +- [`bool show_code_panel`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=show_code_panel) &ScreenOnlineLobby::show_code_panel +- [`float enter_code_woodpanel_bottom_slidein_pos`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_woodpanel_bottom_slidein_pos) &ScreenOnlineLobby::enter_code_woodpanel_bottom_slidein_pos +- [`TextureRenderingInfo enter_code_woodpanel_bottom`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_woodpanel_bottom) &ScreenOnlineLobby::enter_code_woodpanel_bottom +- [`int enter_code_btn_right_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_btn_right_text_id) &ScreenOnlineLobby::enter_code_btn_right_text_id +- [`bool enter_code_woodpanel_top_visible`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_woodpanel_top_visible) &ScreenOnlineLobby::enter_code_woodpanel_top_visible +- [`bool enter_code_woodpanel_bottom_visible`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_woodpanel_bottom_visible) &ScreenOnlineLobby::enter_code_woodpanel_bottom_visible +- [`bool enter_code_toggle_panels_slidein`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_toggle_panels_slidein) &ScreenOnlineLobby::enter_code_toggle_panels_slidein +- [`int selected_character`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=selected_character) &ScreenOnlineLobby::selected_character +- [`int characters_entered_count`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=characters_entered_count) &ScreenOnlineLobby::characters_entered_count +- [`float enter_code_topleft_woodpanel_esc_slidein_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_topleft_woodpanel_esc_slidein_timer) &ScreenOnlineLobby::enter_code_topleft_woodpanel_esc_slidein_timer +- [`int enter_code_banner_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_banner_text_id) &ScreenOnlineLobby::enter_code_banner_text_id +- [`int enter_code_OK_text_id`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_OK_text_id) &ScreenOnlineLobby::enter_code_OK_text_id +- [`TextureRenderingInfo enter_code_main_woodpanel_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_main_woodpanel_left) &ScreenOnlineLobby::enter_code_main_woodpanel_left +- [`TextureRenderingInfo enter_code_main_woodpanel_center`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_main_woodpanel_center) &ScreenOnlineLobby::enter_code_main_woodpanel_center +- [`TextureRenderingInfo enter_code_main_woodpanel_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_main_woodpanel_right) &ScreenOnlineLobby::enter_code_main_woodpanel_right +- [`TextureRenderingInfo enter_code_banner`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_banner) &ScreenOnlineLobby::enter_code_banner +- [`TextureRenderingInfo enter_code_char_cutouts`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_char_cutouts) &ScreenOnlineLobby::enter_code_char_cutouts +- [`TextureRenderingInfo enter_code_pointing_hand`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_pointing_hand) &ScreenOnlineLobby::enter_code_pointing_hand +- [`TextureRenderingInfo enter_code_buttons`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_buttons) &ScreenOnlineLobby::enter_code_buttons +- [`TextureRenderingInfo enter_code_OK_panel`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_OK_panel) &ScreenOnlineLobby::enter_code_OK_panel +- [`float enter_code_OK_panel_slidein_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_OK_panel_slidein_timer) &ScreenOnlineLobby::enter_code_OK_panel_slidein_timer +- [`TextureRenderingInfo enter_code_your_code_scroll`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_your_code_scroll) &ScreenOnlineLobby::enter_code_your_code_scroll +- [`TextureRenderingInfo enter_code_your_code_scroll_left_handle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_your_code_scroll_left_handle) &ScreenOnlineLobby::enter_code_your_code_scroll_left_handle +- [`TextureRenderingInfo enter_code_your_code_scroll_right_handle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=enter_code_your_code_scroll_right_handle) &ScreenOnlineLobby::enter_code_your_code_scroll_right_handle +- [`nil set_code(const string& code)`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_code) &ScreenOnlineLobby::set_code +### `PauseUI` +- [`float menu_slidein_progress`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=menu_slidein_progress) &PauseUI::menu_slidein_progress +- [`TextureRenderingInfo blurred_background`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=blurred_background) &PauseUI::blurred_background +- [`TextureRenderingInfo woodpanel_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_left) &PauseUI::woodpanel_left +- [`TextureRenderingInfo woodpanel_middle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_middle) &PauseUI::woodpanel_middle +- [`TextureRenderingInfo woodpanel_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_right) &PauseUI::woodpanel_right +- [`TextureRenderingInfo woodpanel_top`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_top) &PauseUI::woodpanel_top +- [`TextureRenderingInfo scroll`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=scroll) &PauseUI::scroll +- [`TextureRenderingInfo confirmation_panel`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=confirmation_panel) &PauseUI::confirmation_panel +- [`int previously_selected_menu_index`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=previously_selected_menu_index) &PauseUI::previously_selected_menu_index +- [`int visibility`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=visibility) &PauseUI::visibility +### `JournalUI` +- [`int state`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=state) &JournalUI::state +- [`int page_shown`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_shown) &JournalUI::page_shown +- [`int current_page`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=current_page) &JournalUI::current_page +- [`int flipping_to_page`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flipping_to_page) &JournalUI::flipping_to_page +- [`int max_page_count`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=max_page_count) &JournalUI::max_page_count +- [`TextureRenderingInfo book_background`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=book_background) &JournalUI::book_background +- [`TextureRenderingInfo arrow_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_left) &JournalUI::arrow_left +- [`TextureRenderingInfo arrow_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_right) &JournalUI::arrow_right +- [`TextureRenderingInfo unknown23`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=unknown23) &JournalUI::unknown23 +- [`TextureRenderingInfo entire_book`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=entire_book) &JournalUI::entire_book +- [`int page_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_timer) &JournalUI::page_timer ### `ScreenArenaMenu` Derived from [`Screen`](#screen) - [`ScreenZoomAnimation brick_background_animation`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=brick_background_animation) &ScreenArenaMenu::brick_background_animation @@ -3574,35 +3675,6 @@ Derived from [`Screen`](#screen) - [`array player_crushing_pillar_height`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_crushing_pillar_height) &ScreenArenaScore::player_crushing_pillar_height - [`array player_create_giblets`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_create_giblets) &ScreenArenaScore::player_create_giblets - [`float next_sidepanel_slidein_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=next_sidepanel_slidein_timer) &ScreenArenaScore::next_sidepanel_slidein_timer -### `ScreenOnlineLoading` -Derived from [`Screen`](#screen) -- [`TextureRenderingInfo ouroboros`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ouroboros) &ScreenOnlineLoading::ouroboros -- [`float ouroboros_angle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ouroboros_angle) &ScreenOnlineLoading::ouroboros_angle -### `ScreenOnlineLobby` -Derived from [`Screen`](#screen) -### `PauseUI` -- [`float menu_slidein_progress`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=menu_slidein_progress) &PauseUI::menu_slidein_progress -- [`TextureRenderingInfo blurred_background`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=blurred_background) &PauseUI::blurred_background -- [`TextureRenderingInfo woodpanel_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_left) &PauseUI::woodpanel_left -- [`TextureRenderingInfo woodpanel_middle`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_middle) &PauseUI::woodpanel_middle -- [`TextureRenderingInfo woodpanel_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_right) &PauseUI::woodpanel_right -- [`TextureRenderingInfo woodpanel_top`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=woodpanel_top) &PauseUI::woodpanel_top -- [`TextureRenderingInfo scroll`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=scroll) &PauseUI::scroll -- [`TextureRenderingInfo confirmation_panel`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=confirmation_panel) &PauseUI::confirmation_panel -- [`int previously_selected_menu_index`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=previously_selected_menu_index) &PauseUI::previously_selected_menu_index -- [`int visibility`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=visibility) &PauseUI::visibility -### `JournalUI` -- [`int state`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=state) &JournalUI::state -- [`int page_shown`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_shown) &JournalUI::page_shown -- [`int current_page`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=current_page) &JournalUI::current_page -- [`int flipping_to_page`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flipping_to_page) &JournalUI::flipping_to_page -- [`int max_page_count`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=max_page_count) &JournalUI::max_page_count -- [`TextureRenderingInfo book_background`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=book_background) &JournalUI::book_background -- [`TextureRenderingInfo arrow_left`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_left) &JournalUI::arrow_left -- [`TextureRenderingInfo arrow_right`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=arrow_right) &JournalUI::arrow_right -- [`TextureRenderingInfo unknown23`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=unknown23) &JournalUI::unknown23 -- [`TextureRenderingInfo entire_book`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=entire_book) &JournalUI::entire_book -- [`int page_timer`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_timer) &JournalUI::page_timer ## Automatic casting of entities When using `get_entity()` the returned entity will automatically be of the correct type. It is not necessary to use the `as_` functions. diff --git a/src/game_api/game_manager.hpp b/src/game_api/game_manager.hpp index 810c71c7a..5a587f0da 100644 --- a/src/game_api/game_manager.hpp +++ b/src/game_api/game_manager.hpp @@ -9,13 +9,31 @@ struct TmpStruct OnHeapPointer savedata; }; +struct GameProps +{ + uint32_t buttons; + uint32_t unknown1; + uint32_t unknown2; + uint32_t unknown3; + uint32_t buttons_dupe; + uint32_t unknown4; + uint32_t unknown5; + uint32_t unknown6; + uint32_t buttons_dupe_but_different; + int8_t unknown8; + bool game_has_focus; + bool unknown9; + bool unknown10; + // there's more stuff here +}; + struct GameManager { void* backgroundmusic; TmpStruct* tmp; uint8_t buttons_controls[MAX_PLAYERS]; uint8_t buttons_movement[MAX_PLAYERS]; - size_t more_button_states; + GameProps* game_props; // screen pointers below are most likely in an array and indexed through the screen ID, hence the nullptrs for // screens that are available in State diff --git a/src/game_api/online.cpp b/src/game_api/online.cpp new file mode 100644 index 000000000..08436cf13 --- /dev/null +++ b/src/game_api/online.cpp @@ -0,0 +1,19 @@ +#include "online.hpp" +#include "memory.hpp" +#include "search.hpp" + +Online* get_online() +{ + ONCE(Online*) + { + auto mem = Memory::get(); + auto tmp = find_inst(mem.exe(), "\xF3\x0F\x11\x4C\x24\x10\x56\x57"s, mem.after_bundle); + tmp = mem.at_exe(decode_pc(mem.exe(), tmp + 24)); + return res = *(Online**)tmp; + } +} + +std::string OnlineLobby::get_code() +{ + return fmt::format("{:X}", code); +} diff --git a/src/game_api/online.hpp b/src/game_api/online.hpp new file mode 100644 index 000000000..c41b104da --- /dev/null +++ b/src/game_api/online.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include +#include + +struct OnlinePlayer +{ + uint32_t unknown1; + uint32_t unknown2; + uint32_t unknown3; + uint32_t unknown4; + uint8_t unknown5; + uint8_t ready_state; + uint8_t character; + char player_name[37]; +}; + +struct OnlineLobby +{ + uint32_t code; + uint32_t unknown1; + uint32_t keys_pressed; + uint32_t keys_pressed_sync; + uint8_t unknown2; + uint8_t unknown3; + int8_t unknown4; + int8_t unknown5; + uint32_t unknown6; + int8_t unknown7; + int8_t unknown8; + uint8_t unknown9; + uint8_t unknown10; + int32_t unknown11; + int32_t unknown12; + int8_t unknown13; + int8_t unknown14; + uint8_t unknown15; + uint8_t unknown16; + uint32_t unknown17; + uint8_t unknown18; + uint8_t unknown19; + int8_t unknown20; + int8_t unknown21; + int8_t unknown22; + uint8_t unknown23; + uint8_t unknown24; + uint8_t unknown25; + uint32_t unknown26; + + /// Gets the string equivalent of the code + std::string get_code(); +}; + +class Online +{ + public: + uint32_t unknown1; + uint32_t unknown2; + uint64_t unknown3; + uint64_t unknown4; + uint64_t unknown5; + uint32_t unknown6; + uint32_t unknown7; + uint32_t unknown8; + uint32_t unknown9; + uint32_t unknown10; + uint32_t unknown11; + uint32_t unknown12; + uint32_t unknown13; + std::array online_players; + OnlinePlayer local_player; + OnlineLobby lobby; + OnlineLobby lobby_dupe; + // some more stuff + + virtual ~Online() = 0; +}; + +Online* get_online(); diff --git a/src/game_api/screen.cpp b/src/game_api/screen.cpp index b42e25b36..42e17b74d 100644 --- a/src/game_api/screen.cpp +++ b/src/game_api/screen.cpp @@ -103,3 +103,28 @@ void Screen::unhook(std::uint32_t id) { return hook.id == id; }); } } + +void ScreenOnlineLobby::set_code(const std::string& code) +{ + if (code.length() != 8) + { + characters_entered_count = 0; + return; + } + std::string code_upper = code; + std::transform(code_upper.begin(), code_upper.end(), code_upper.begin(), [](unsigned char c) + { return (unsigned char)std::toupper(c); }); + + for (size_t x = 0; x < 8; ++x) + { + const unsigned char c = code.at(x); + auto valid = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'); + if (!valid) + { + characters_entered_count = 0; + return; + } + code_chars[x] = c; + } + characters_entered_count = 8; +} diff --git a/src/game_api/screen.hpp b/src/game_api/screen.hpp index d48516a38..502025e92 100644 --- a/src/game_api/screen.hpp +++ b/src/game_api/screen.hpp @@ -658,9 +658,128 @@ class ScreenOnlineLoading : public Screen // ID: 28 float ouroboros_angle; }; +struct OnlineLobbyScreenPlayer +{ + uint8_t unknown1; + uint8_t character; + bool ready; + uint8_t unknown2; +}; + class ScreenOnlineLobby : public Screen // ID: 29 { - public: // not reverse engineered + public: + uint8_t unknown2; + uint8_t unknown3; + uint8_t unknown4; + uint8_t unknown5; + float woodpanels_slidein_timer; + float scroll_unfurl_timer; + uint32_t unknown8; + uint32_t unknown9; + TextureRenderingInfo woodpanel_bottom; + TextureRenderingInfo woodpanel_top; + TextureRenderingInfo unknown13; + TextureRenderingInfo left_scroll_handle; + TextureRenderingInfo right_scroll_handle; + uint32_t scroll_text_id; + uint32_t btn_left_text_id; + uint32_t btn_right_text_id; + uint32_t btn_center_text_id; + bool woodpanel_top_visible; + bool woodpanel_bottom_visible; + bool toggle_panels_slidein; + bool unknown21; + std::array players; + TextureRenderingInfo background_image; + size_t unknown22; + size_t unknown23; + size_t unknown24; + size_t unknown25; + size_t unknown26; + size_t unknown27; + size_t unknown28; + size_t unknown29; + size_t unknown30; + TextureRenderingInfo unknown36; + TextureRenderingInfo unknown37; + float unknown38; + TextureRenderingInfo topleft_woodpanel_esc; + float topleft_woodpanel_esc_slidein_timer; + float character_walk_offset; + bool character_facing_left; + int8_t move_direction; + uint8_t unknown41; + uint8_t unknown42; + TextureRenderingInfo character; + TextureRenderingInfo player_ready_icon; + float render_timer_dupe; + TextureRenderingInfo arrow_left; + TextureRenderingInfo arrow_right; + float another_timer; + float arrow_left_hor_offset; + float arrow_right_hor_offset; + TextureRenderingInfo platform_icon; + uint8_t player_count; + bool searching_for_players; + uint8_t unknown47; + uint8_t unknown48; + float another_timer_2; + bool show_code_panel; + uint8_t unknown49; + uint8_t unknown50; + uint8_t unknown51; + uint32_t unknown53; + + // The following is actually class ScreenEnterOnlineCode but it has no direct pointer in GameManager + // or State. In assembly this pointer is accessed by &ScreenOnlineLobby + sizeof(ScreenOnlineLobby) + size_t enter_code_screen_vftable; + float enter_code_render_timer; + uint32_t unknown54; + float unknown56; + float enter_code_woodpanel_bottom_slidein_pos; + float unknown58; + float unknown59; + float unknown60; + TextureRenderingInfo enter_code_woodpanel_bottom; + TextureRenderingInfo unknown61; + TextureRenderingInfo unknown62; + TextureRenderingInfo unknown63; + TextureRenderingInfo unknown64; + uint32_t text_id_1; + uint32_t text_id_2; + uint32_t enter_code_btn_right_text_id; + uint32_t text_id_4; + bool enter_code_woodpanel_top_visible; + bool enter_code_woodpanel_bottom_visible; + bool enter_code_toggle_panels_slidein; + bool unknown68; + uint32_t unknown69; + uint32_t selected_character; + bool unknown71a; + uint8_t unknown71b; + uint16_t code_chars[8]; + uint16_t code_char_terminator; + uint32_t characters_entered_count; + float enter_code_topleft_woodpanel_esc_slidein_timer; + uint32_t enter_code_banner_text_id; + uint32_t enter_code_OK_text_id; + TextureRenderingInfo enter_code_main_woodpanel_left; + TextureRenderingInfo enter_code_main_woodpanel_center; + TextureRenderingInfo enter_code_main_woodpanel_right; + TextureRenderingInfo enter_code_banner; + TextureRenderingInfo enter_code_char_cutouts; + TextureRenderingInfo enter_code_pointing_hand; + TextureRenderingInfo enter_code_buttons; + TextureRenderingInfo unknown85; + TextureRenderingInfo enter_code_OK_panel; + float enter_code_OK_panel_slidein_timer; + int32_t unknown87; + TextureRenderingInfo enter_code_your_code_scroll; + TextureRenderingInfo enter_code_your_code_scroll_left_handle; + TextureRenderingInfo enter_code_your_code_scroll_right_handle; + + void set_code(const std::string& code); }; struct PauseUI diff --git a/src/game_api/script/lua_vm.cpp b/src/game_api/script/lua_vm.cpp index cfe7d4702..30b648271 100644 --- a/src/game_api/script/lua_vm.cpp +++ b/src/game_api/script/lua_vm.cpp @@ -5,6 +5,7 @@ #include "entities_items.hpp" #include "entity.hpp" #include "game_manager.hpp" +#include "online.hpp" #include "rpc.hpp" #include "spawn_api.hpp" #include "state.hpp" @@ -34,6 +35,7 @@ #include "usertypes/player_lua.hpp" #include "usertypes/prng_lua.hpp" #include "usertypes/save_context.hpp" +#include "usertypes/screen_arena_lua.hpp" #include "usertypes/screen_lua.hpp" #include "usertypes/sound_lua.hpp" #include "usertypes/state_lua.hpp" @@ -112,6 +114,7 @@ end NState::register_usertypes(lua); NPRNG::register_usertypes(lua); NScreen::register_usertypes(lua); + NScreenArena::register_usertypes(lua); NPlayer::register_usertypes(lua); NDrops::register_usertypes(lua); NCharacterState::register_usertypes(lua); @@ -128,6 +131,8 @@ end lua["state"] = get_state_ptr(); /// The GameManager gives access to a couple of Screens as well as the pause and journal UI elements lua["game_manager"] = get_game_manager(); + /// The Online object has information about the online lobby and its players + lua["online"] = get_online(); /// An array of [Player](#player) of the current players. Pro tip: You need `players[1].uid` in most entity functions. lua["players"] = std::vector(get_players()); /// Provides a read-only access to the save data, updated as soon as something changes (i.e. before it's written to savegame.sav.) diff --git a/src/game_api/script/usertypes/screen_arena_lua.cpp b/src/game_api/script/usertypes/screen_arena_lua.cpp new file mode 100644 index 000000000..38e6e4bfb --- /dev/null +++ b/src/game_api/script/usertypes/screen_arena_lua.cpp @@ -0,0 +1,381 @@ +#include "screen_arena_lua.hpp" + +#include "screen.hpp" +#include "screen_arena.hpp" + +#include + +namespace NScreenArena +{ +void register_usertypes(sol::state& lua) +{ + lua.new_usertype( + "ScreenArenaMenu", + "brick_background_animation", + &ScreenArenaMenu::brick_background_animation, + "blurry_border_animation", + &ScreenArenaMenu::blurry_border_animation, + "top_woodpanel_slidein_timer", + &ScreenArenaMenu::top_woodpanel_slidein_timer, + "top_scroll_unfurl_timer", + &ScreenArenaMenu::top_scroll_unfurl_timer, + "unknown13", + &ScreenArenaMenu::unknown13, + "woodpanel_top", + &ScreenArenaMenu::woodpanel_top, + "unknown15", + &ScreenArenaMenu::unknown15, + "left_scroll_handle", + &ScreenArenaMenu::left_scroll_handle, + "right_scroll_handle", + &ScreenArenaMenu::right_scroll_handle, + "scroll_text_id", + &ScreenArenaMenu::scroll_text_id, + "unknown17_text_id", + &ScreenArenaMenu::unknown17_text_id, + "unknown18_text_id", + &ScreenArenaMenu::unknown18_text_id, + "unknown19_text_id", + &ScreenArenaMenu::unknown19_text_id, + "top_woodpanel_visible", + &ScreenArenaMenu::top_woodpanel_visible, + "bottom_woodpanel_visible", + &ScreenArenaMenu::bottom_woodpanel_visible, + "woodpanels_toggle", + &ScreenArenaMenu::woodpanels_toggle, + "brick_background", + &ScreenArenaMenu::brick_background, + "blurry_border", + &ScreenArenaMenu::blurry_border, + "blurry_border2", + &ScreenArenaMenu::blurry_border2, + "characters_drawing", + &ScreenArenaMenu::characters_drawing, + "info_black_background", + &ScreenArenaMenu::info_black_background, + "main_panel_top_left_corner", + &ScreenArenaMenu::main_panel_top_left_corner, + "main_panel_top", + &ScreenArenaMenu::main_panel_top, + "main_panel_top_right_corner", + &ScreenArenaMenu::main_panel_top_right_corner, + "main_panel_left", + &ScreenArenaMenu::main_panel_left, + "main_panel_center", + &ScreenArenaMenu::main_panel_center, + "main_panel_right", + &ScreenArenaMenu::main_panel_right, + "main_panel_bottom_left_corner", + &ScreenArenaMenu::main_panel_bottom_left_corner, + "main_panel_bottom", + &ScreenArenaMenu::main_panel_bottom, + "main_panel_bottom_right_corner", + &ScreenArenaMenu::main_panel_bottom_right_corner, + "rules_scroll", + &ScreenArenaMenu::rules_scroll, + "black_option_boxes_left", + &ScreenArenaMenu::black_option_boxes_left, + "black_option_boxes_center", + &ScreenArenaMenu::black_option_boxes_center, + "black_option_boxes_right", + &ScreenArenaMenu::black_option_boxes_right, + "gold_option_outline", + &ScreenArenaMenu::gold_option_outline, + "option_icons", + &ScreenArenaMenu::option_icons, + "option_left_arrow", + &ScreenArenaMenu::option_left_arrow, + "option_right_arrow", + &ScreenArenaMenu::option_right_arrow, + "bottom_left_bricks", + &ScreenArenaMenu::bottom_left_bricks, + "top_left_esc_panel", + &ScreenArenaMenu::top_left_esc_panel, + "next_panel", + &ScreenArenaMenu::next_panel, + "center_panels_hor_slide_position", + &ScreenArenaMenu::center_panels_hor_slide_position, + "esc_next_panels_slide_timer", + &ScreenArenaMenu::esc_next_panels_slide_timer, + "main_panel_vertical_scroll_position", + &ScreenArenaMenu::main_panel_vertical_scroll_position, + "selected_option_index", + &ScreenArenaMenu::selected_option_index, + sol::base_classes, + sol::bases()); + + lua.new_usertype( + "ScreenZoomAnimation", + "zoom_target", + &ScreenZoomAnimation::zoom_target); + + lua.new_usertype( + "ScreenArenaStagesSelect", + "woodenpanel_top_slidein_timer", + &ScreenArenaStagesSelect::woodenpanel_top_slidein_timer, + "woodenpanel_top_scroll_unfurl_timer", + &ScreenArenaStagesSelect::woodenpanel_top_scroll_unfurl_timer, + "woodenpanel_top", + &ScreenArenaStagesSelect::woodenpanel_top, + "woodenpanel_top_left_scroll", + &ScreenArenaStagesSelect::woodenpanel_top_left_scroll, + "woodenpanel_top_right_scroll", + &ScreenArenaStagesSelect::woodenpanel_top_right_scroll, + "text_id_1", + &ScreenArenaStagesSelect::text_id_1, + "text_id_2", + &ScreenArenaStagesSelect::text_id_2, + "text_id_3", + &ScreenArenaStagesSelect::text_id_3, + "text_id_4", + &ScreenArenaStagesSelect::text_id_4, + "woodenpanel_top_visible", + &ScreenArenaStagesSelect::woodenpanel_top_visible, + "woodenpanel_bottom_visible", + &ScreenArenaStagesSelect::woodenpanel_bottom_visible, + "woodenpanels_toggle", + &ScreenArenaStagesSelect::woodenpanels_toggle, + "buttons", + &ScreenArenaStagesSelect::buttons, + "brick_background", + &ScreenArenaStagesSelect::brick_background, + "info_black_background", + &ScreenArenaStagesSelect::info_black_background, + "woodenpanel_center", + &ScreenArenaStagesSelect::woodenpanel_center, + "blocky_level_representation", + &ScreenArenaStagesSelect::blocky_level_representation, + "theme_indicator", + &ScreenArenaStagesSelect::theme_indicator, + "bricks_bottom_left", + &ScreenArenaStagesSelect::bricks_bottom_left, + "grid_background_row_0", + &ScreenArenaStagesSelect::grid_background_row_0, + "grid_background_row_1", + &ScreenArenaStagesSelect::grid_background_row_1, + "grid_background_row_2", + &ScreenArenaStagesSelect::grid_background_row_2, + "grid_background_row_3", + &ScreenArenaStagesSelect::grid_background_row_3, + "grid_background_row_4", + &ScreenArenaStagesSelect::grid_background_row_4, + "grid_background_row_5", + &ScreenArenaStagesSelect::grid_background_row_5, + "grid_background_row_6", + &ScreenArenaStagesSelect::grid_background_row_6, + "grid_background_row_7", + &ScreenArenaStagesSelect::grid_background_row_7, + "grid_background_disabled_cross", + &ScreenArenaStagesSelect::grid_background_disabled_cross, + "grid_background_manipulators", + &ScreenArenaStagesSelect::grid_background_manipulators, + "unknown21", + &ScreenArenaStagesSelect::unknown21, + "grid_disabled_cross", + &ScreenArenaStagesSelect::grid_disabled_cross, + "grid_yellow_highlighter", + &ScreenArenaStagesSelect::grid_yellow_highlighter, + "woodpanel_esc", + &ScreenArenaStagesSelect::woodpanel_esc, + "woodpanel_fight", + &ScreenArenaStagesSelect::woodpanel_fight, + "big_player_drawing", + &ScreenArenaStagesSelect::big_player_drawing, + "players_turn_scroll", + &ScreenArenaStagesSelect::players_turn_scroll, + "players_turn_scroll_handle", + &ScreenArenaStagesSelect::players_turn_scroll_handle, + "grid_player_icon", + &ScreenArenaStagesSelect::grid_player_icon, + sol::base_classes, + sol::bases()); + + lua.new_usertype( + "ScreenArenaItems", + "woodpanel_top_slidein_timer", + &ScreenArenaItems::woodpanel_top_slidein_timer, + "woodpanel_top_scroll_unfurl_timer", + &ScreenArenaItems::woodpanel_top_scroll_unfurl_timer, + "unknown9", + &ScreenArenaItems::unknown9, + "woodpanel_top", + &ScreenArenaItems::woodpanel_top, + "unknown11", + &ScreenArenaItems::unknown11, + "top_scroll_left_handle", + &ScreenArenaItems::top_scroll_left_handle, + "top_scroll_right_handle", + &ScreenArenaItems::top_scroll_right_handle, + "scroll_text_id", + &ScreenArenaItems::scroll_text_id, + "text_id_2", + &ScreenArenaItems::text_id_2, + "text_id_3", + &ScreenArenaItems::text_id_3, + "text_id_4", + &ScreenArenaItems::text_id_4, + "woodpanel_top_visible", + &ScreenArenaItems::woodpanel_top_visible, + "woodpanel_bottom_visible", + &ScreenArenaItems::woodpanel_bottom_visible, + "woodpanels_toggle", + &ScreenArenaItems::woodpanels_toggle, + "brick_background", + &ScreenArenaItems::brick_background, + "black_background_bottom_right", + &ScreenArenaItems::black_background_bottom_right, + "woodpanel_bottom", + &ScreenArenaItems::woodpanel_bottom, + "scroll_bottom", + &ScreenArenaItems::scroll_bottom, + "scroll_right_handle_bottom", + &ScreenArenaItems::scroll_right_handle_bottom, + "held_item_crate_on_scroll", + &ScreenArenaItems::held_item_crate_on_scroll, + "held_item_on_scroll", + &ScreenArenaItems::held_item_on_scroll, + "item_background", + &ScreenArenaItems::item_background, + "toggles_background", + &ScreenArenaItems::toggles_background, + "item_selection_gold_outline", + &ScreenArenaItems::item_selection_gold_outline, + "item_icons", + &ScreenArenaItems::item_icons, + "item_held_badge", + &ScreenArenaItems::item_held_badge, + "item_equipped_badge", + &ScreenArenaItems::item_equipped_badge, + "item_off_gray_overlay", + &ScreenArenaItems::item_off_gray_overlay, + "esc_woodpanel", + &ScreenArenaItems::esc_woodpanel, + "center_panels_horizontal_slide_position", + &ScreenArenaItems::center_panels_horizontal_slide_position, + "esc_panel_slide_timer", + &ScreenArenaItems::esc_panel_slide_timer, + "selected_item_index", + &ScreenArenaItems::selected_item_index, + sol::base_classes, + sol::bases()); + + lua.new_usertype( + "ScreenArenaIntro", + "players", + &ScreenArenaIntro::players, + "background_colors", + &ScreenArenaIntro::background_colors, + "vertical_lines", + &ScreenArenaIntro::vertical_lines, + "vertical_line_electricity_effect", + &ScreenArenaIntro::vertical_line_electricity_effect, + "unknown_all_forced", + &ScreenArenaIntro::unknown_all_forced, + "left_scroll", + &ScreenArenaIntro::left_scroll, + "right_scroll", + &ScreenArenaIntro::right_scroll, + "scroll_unfurl_timer", + &ScreenArenaIntro::scroll_unfurl_timer, + "waiting", + &ScreenArenaIntro::waiting, + "names_opacity", + &ScreenArenaIntro::names_opacity, + "line_electricity_effect_timer", + &ScreenArenaIntro::line_electricity_effect_timer, + "state", + &ScreenArenaIntro::state, + "countdown", + &ScreenArenaIntro::countdown, + sol::base_classes, + sol::bases()); + + lua.new_usertype( + "ScreenArenaLevel", + "get_ready", + &ScreenArenaLevel::get_ready, + "get_ready_gray_background", + &ScreenArenaLevel::get_ready_gray_background, + "get_ready_outline", + &ScreenArenaLevel::get_ready_outline, + sol::base_classes, + sol::bases()); + + lua.new_usertype( + "ScreenArenaScore", + "woodpanel_slide_timer", + &ScreenArenaScore::woodpanel_slide_timer, + "scroll_unfurl_timer", + &ScreenArenaScore::scroll_unfurl_timer, + "unknown10", + &ScreenArenaScore::unknown10, + "woodpanel", + &ScreenArenaScore::woodpanel, + "unknown_all_forced", + &ScreenArenaScore::unknown_all_forced, + "woodpanel_left_scroll", + &ScreenArenaScore::woodpanel_left_scroll, + "woodpanel_right_scroll", + &ScreenArenaScore::woodpanel_right_scroll, + "text_id_1", + &ScreenArenaScore::text_id_1, + "text_id_2", + &ScreenArenaScore::text_id_2, + "woodpanel_visible", + &ScreenArenaScore::woodpanel_visible, + "woodpanel_slide_toggle", + &ScreenArenaScore::woodpanel_slide_toggle, + "animation_sequence", + &ScreenArenaScore::animation_sequence, + "background", + &ScreenArenaScore::background, + "ok_panel", + &ScreenArenaScore::ok_panel, + "ready_panel", + &ScreenArenaScore::ready_panel, + "ready_speechbubble_indicator", + &ScreenArenaScore::ready_speechbubble_indicator, + "pillars", + &ScreenArenaScore::pillars, + "bottom_lava", + &ScreenArenaScore::bottom_lava, + "players", + &ScreenArenaScore::players, + "player_shadows", + &ScreenArenaScore::player_shadows, + "unknown24", + &ScreenArenaScore::unknown24, + "unknown25", + &ScreenArenaScore::unknown25, + "score_counter", + &ScreenArenaScore::score_counter, + "unknown27", + &ScreenArenaScore::unknown27, + "lava_bubbles", + &ScreenArenaScore::lava_bubbles, + "player_won", + &ScreenArenaScore::player_won, + "victory_jump_y_pos", + &ScreenArenaScore::victory_jump_y_pos, + "victory_jump_velocity", + &ScreenArenaScore::victory_jump_velocity, + "animation_frame", + &ScreenArenaScore::animation_frame, + "squash_and_celebrate", + &ScreenArenaScore::squash_and_celebrate, + "player_ready", + &ScreenArenaScore::player_ready, + "next_transition_timer", + &ScreenArenaScore::next_transition_timer, + "player_bottom_pillar_offset", + &ScreenArenaScore::player_bottom_pillar_offset, + "player_crushing_pillar_height", + &ScreenArenaScore::player_crushing_pillar_height, + "player_create_giblets", + &ScreenArenaScore::player_create_giblets, + "next_sidepanel_slidein_timer", + &ScreenArenaScore::next_sidepanel_slidein_timer, + sol::base_classes, + sol::bases()); +} +} // namespace NScreenArena diff --git a/src/game_api/script/usertypes/screen_arena_lua.hpp b/src/game_api/script/usertypes/screen_arena_lua.hpp new file mode 100644 index 000000000..f546795ac --- /dev/null +++ b/src/game_api/script/usertypes/screen_arena_lua.hpp @@ -0,0 +1,8 @@ +#pragma once + +#include + +namespace NScreenArena +{ +void register_usertypes(sol::state& lua); +}; diff --git a/src/game_api/script/usertypes/screen_lua.cpp b/src/game_api/script/usertypes/screen_lua.cpp index fdc16d0d8..9f5152b64 100644 --- a/src/game_api/script/usertypes/screen_lua.cpp +++ b/src/game_api/script/usertypes/screen_lua.cpp @@ -629,375 +629,6 @@ void register_usertypes(sol::state& lua) sol::base_classes, sol::bases()); - lua.new_usertype( - "ScreenArenaMenu", - "brick_background_animation", - &ScreenArenaMenu::brick_background_animation, - "blurry_border_animation", - &ScreenArenaMenu::blurry_border_animation, - "top_woodpanel_slidein_timer", - &ScreenArenaMenu::top_woodpanel_slidein_timer, - "top_scroll_unfurl_timer", - &ScreenArenaMenu::top_scroll_unfurl_timer, - "unknown13", - &ScreenArenaMenu::unknown13, - "woodpanel_top", - &ScreenArenaMenu::woodpanel_top, - "unknown15", - &ScreenArenaMenu::unknown15, - "left_scroll_handle", - &ScreenArenaMenu::left_scroll_handle, - "right_scroll_handle", - &ScreenArenaMenu::right_scroll_handle, - "scroll_text_id", - &ScreenArenaMenu::scroll_text_id, - "unknown17_text_id", - &ScreenArenaMenu::unknown17_text_id, - "unknown18_text_id", - &ScreenArenaMenu::unknown18_text_id, - "unknown19_text_id", - &ScreenArenaMenu::unknown19_text_id, - "top_woodpanel_visible", - &ScreenArenaMenu::top_woodpanel_visible, - "bottom_woodpanel_visible", - &ScreenArenaMenu::bottom_woodpanel_visible, - "woodpanels_toggle", - &ScreenArenaMenu::woodpanels_toggle, - "brick_background", - &ScreenArenaMenu::brick_background, - "blurry_border", - &ScreenArenaMenu::blurry_border, - "blurry_border2", - &ScreenArenaMenu::blurry_border2, - "characters_drawing", - &ScreenArenaMenu::characters_drawing, - "info_black_background", - &ScreenArenaMenu::info_black_background, - "main_panel_top_left_corner", - &ScreenArenaMenu::main_panel_top_left_corner, - "main_panel_top", - &ScreenArenaMenu::main_panel_top, - "main_panel_top_right_corner", - &ScreenArenaMenu::main_panel_top_right_corner, - "main_panel_left", - &ScreenArenaMenu::main_panel_left, - "main_panel_center", - &ScreenArenaMenu::main_panel_center, - "main_panel_right", - &ScreenArenaMenu::main_panel_right, - "main_panel_bottom_left_corner", - &ScreenArenaMenu::main_panel_bottom_left_corner, - "main_panel_bottom", - &ScreenArenaMenu::main_panel_bottom, - "main_panel_bottom_right_corner", - &ScreenArenaMenu::main_panel_bottom_right_corner, - "rules_scroll", - &ScreenArenaMenu::rules_scroll, - "black_option_boxes_left", - &ScreenArenaMenu::black_option_boxes_left, - "black_option_boxes_center", - &ScreenArenaMenu::black_option_boxes_center, - "black_option_boxes_right", - &ScreenArenaMenu::black_option_boxes_right, - "gold_option_outline", - &ScreenArenaMenu::gold_option_outline, - "option_icons", - &ScreenArenaMenu::option_icons, - "option_left_arrow", - &ScreenArenaMenu::option_left_arrow, - "option_right_arrow", - &ScreenArenaMenu::option_right_arrow, - "bottom_left_bricks", - &ScreenArenaMenu::bottom_left_bricks, - "top_left_esc_panel", - &ScreenArenaMenu::top_left_esc_panel, - "next_panel", - &ScreenArenaMenu::next_panel, - "center_panels_hor_slide_position", - &ScreenArenaMenu::center_panels_hor_slide_position, - "esc_next_panels_slide_timer", - &ScreenArenaMenu::esc_next_panels_slide_timer, - "main_panel_vertical_scroll_position", - &ScreenArenaMenu::main_panel_vertical_scroll_position, - "selected_option_index", - &ScreenArenaMenu::selected_option_index, - sol::base_classes, - sol::bases()); - - lua.new_usertype( - "ScreenZoomAnimation", - "zoom_target", - &ScreenZoomAnimation::zoom_target); - - lua.new_usertype( - "ScreenArenaStagesSelect", - "woodenpanel_top_slidein_timer", - &ScreenArenaStagesSelect::woodenpanel_top_slidein_timer, - "woodenpanel_top_scroll_unfurl_timer", - &ScreenArenaStagesSelect::woodenpanel_top_scroll_unfurl_timer, - "woodenpanel_top", - &ScreenArenaStagesSelect::woodenpanel_top, - "woodenpanel_top_left_scroll", - &ScreenArenaStagesSelect::woodenpanel_top_left_scroll, - "woodenpanel_top_right_scroll", - &ScreenArenaStagesSelect::woodenpanel_top_right_scroll, - "text_id_1", - &ScreenArenaStagesSelect::text_id_1, - "text_id_2", - &ScreenArenaStagesSelect::text_id_2, - "text_id_3", - &ScreenArenaStagesSelect::text_id_3, - "text_id_4", - &ScreenArenaStagesSelect::text_id_4, - "woodenpanel_top_visible", - &ScreenArenaStagesSelect::woodenpanel_top_visible, - "woodenpanel_bottom_visible", - &ScreenArenaStagesSelect::woodenpanel_bottom_visible, - "woodenpanels_toggle", - &ScreenArenaStagesSelect::woodenpanels_toggle, - "buttons", - &ScreenArenaStagesSelect::buttons, - "brick_background", - &ScreenArenaStagesSelect::brick_background, - "info_black_background", - &ScreenArenaStagesSelect::info_black_background, - "woodenpanel_center", - &ScreenArenaStagesSelect::woodenpanel_center, - "blocky_level_representation", - &ScreenArenaStagesSelect::blocky_level_representation, - "theme_indicator", - &ScreenArenaStagesSelect::theme_indicator, - "bricks_bottom_left", - &ScreenArenaStagesSelect::bricks_bottom_left, - "grid_background_row_0", - &ScreenArenaStagesSelect::grid_background_row_0, - "grid_background_row_1", - &ScreenArenaStagesSelect::grid_background_row_1, - "grid_background_row_2", - &ScreenArenaStagesSelect::grid_background_row_2, - "grid_background_row_3", - &ScreenArenaStagesSelect::grid_background_row_3, - "grid_background_row_4", - &ScreenArenaStagesSelect::grid_background_row_4, - "grid_background_row_5", - &ScreenArenaStagesSelect::grid_background_row_5, - "grid_background_row_6", - &ScreenArenaStagesSelect::grid_background_row_6, - "grid_background_row_7", - &ScreenArenaStagesSelect::grid_background_row_7, - "grid_background_disabled_cross", - &ScreenArenaStagesSelect::grid_background_disabled_cross, - "grid_background_manipulators", - &ScreenArenaStagesSelect::grid_background_manipulators, - "unknown21", - &ScreenArenaStagesSelect::unknown21, - "grid_disabled_cross", - &ScreenArenaStagesSelect::grid_disabled_cross, - "grid_yellow_highlighter", - &ScreenArenaStagesSelect::grid_yellow_highlighter, - "woodpanel_esc", - &ScreenArenaStagesSelect::woodpanel_esc, - "woodpanel_fight", - &ScreenArenaStagesSelect::woodpanel_fight, - "big_player_drawing", - &ScreenArenaStagesSelect::big_player_drawing, - "players_turn_scroll", - &ScreenArenaStagesSelect::players_turn_scroll, - "players_turn_scroll_handle", - &ScreenArenaStagesSelect::players_turn_scroll_handle, - "grid_player_icon", - &ScreenArenaStagesSelect::grid_player_icon, - sol::base_classes, - sol::bases()); - - lua.new_usertype( - "ScreenArenaItems", - "woodpanel_top_slidein_timer", - &ScreenArenaItems::woodpanel_top_slidein_timer, - "woodpanel_top_scroll_unfurl_timer", - &ScreenArenaItems::woodpanel_top_scroll_unfurl_timer, - "unknown9", - &ScreenArenaItems::unknown9, - "woodpanel_top", - &ScreenArenaItems::woodpanel_top, - "unknown11", - &ScreenArenaItems::unknown11, - "top_scroll_left_handle", - &ScreenArenaItems::top_scroll_left_handle, - "top_scroll_right_handle", - &ScreenArenaItems::top_scroll_right_handle, - "scroll_text_id", - &ScreenArenaItems::scroll_text_id, - "text_id_2", - &ScreenArenaItems::text_id_2, - "text_id_3", - &ScreenArenaItems::text_id_3, - "text_id_4", - &ScreenArenaItems::text_id_4, - "woodpanel_top_visible", - &ScreenArenaItems::woodpanel_top_visible, - "woodpanel_bottom_visible", - &ScreenArenaItems::woodpanel_bottom_visible, - "woodpanels_toggle", - &ScreenArenaItems::woodpanels_toggle, - "brick_background", - &ScreenArenaItems::brick_background, - "black_background_bottom_right", - &ScreenArenaItems::black_background_bottom_right, - "woodpanel_bottom", - &ScreenArenaItems::woodpanel_bottom, - "scroll_bottom", - &ScreenArenaItems::scroll_bottom, - "scroll_right_handle_bottom", - &ScreenArenaItems::scroll_right_handle_bottom, - "held_item_crate_on_scroll", - &ScreenArenaItems::held_item_crate_on_scroll, - "held_item_on_scroll", - &ScreenArenaItems::held_item_on_scroll, - "item_background", - &ScreenArenaItems::item_background, - "toggles_background", - &ScreenArenaItems::toggles_background, - "item_selection_gold_outline", - &ScreenArenaItems::item_selection_gold_outline, - "item_icons", - &ScreenArenaItems::item_icons, - "item_held_badge", - &ScreenArenaItems::item_held_badge, - "item_equipped_badge", - &ScreenArenaItems::item_equipped_badge, - "item_off_gray_overlay", - &ScreenArenaItems::item_off_gray_overlay, - "esc_woodpanel", - &ScreenArenaItems::esc_woodpanel, - "center_panels_horizontal_slide_position", - &ScreenArenaItems::center_panels_horizontal_slide_position, - "esc_panel_slide_timer", - &ScreenArenaItems::esc_panel_slide_timer, - "selected_item_index", - &ScreenArenaItems::selected_item_index, - sol::base_classes, - sol::bases()); - - lua.new_usertype( - "ScreenArenaIntro", - "players", - &ScreenArenaIntro::players, - "background_colors", - &ScreenArenaIntro::background_colors, - "vertical_lines", - &ScreenArenaIntro::vertical_lines, - "vertical_line_electricity_effect", - &ScreenArenaIntro::vertical_line_electricity_effect, - "unknown_all_forced", - &ScreenArenaIntro::unknown_all_forced, - "left_scroll", - &ScreenArenaIntro::left_scroll, - "right_scroll", - &ScreenArenaIntro::right_scroll, - "scroll_unfurl_timer", - &ScreenArenaIntro::scroll_unfurl_timer, - "waiting", - &ScreenArenaIntro::waiting, - "names_opacity", - &ScreenArenaIntro::names_opacity, - "line_electricity_effect_timer", - &ScreenArenaIntro::line_electricity_effect_timer, - "state", - &ScreenArenaIntro::state, - "countdown", - &ScreenArenaIntro::countdown, - sol::base_classes, - sol::bases()); - - lua.new_usertype( - "ScreenArenaLevel", - "get_ready", - &ScreenArenaLevel::get_ready, - "get_ready_gray_background", - &ScreenArenaLevel::get_ready_gray_background, - "get_ready_outline", - &ScreenArenaLevel::get_ready_outline, - sol::base_classes, - sol::bases()); - - lua.new_usertype( - "ScreenArenaScore", - "woodpanel_slide_timer", - &ScreenArenaScore::woodpanel_slide_timer, - "scroll_unfurl_timer", - &ScreenArenaScore::scroll_unfurl_timer, - "unknown10", - &ScreenArenaScore::unknown10, - "woodpanel", - &ScreenArenaScore::woodpanel, - "unknown_all_forced", - &ScreenArenaScore::unknown_all_forced, - "woodpanel_left_scroll", - &ScreenArenaScore::woodpanel_left_scroll, - "woodpanel_right_scroll", - &ScreenArenaScore::woodpanel_right_scroll, - "text_id_1", - &ScreenArenaScore::text_id_1, - "text_id_2", - &ScreenArenaScore::text_id_2, - "woodpanel_visible", - &ScreenArenaScore::woodpanel_visible, - "woodpanel_slide_toggle", - &ScreenArenaScore::woodpanel_slide_toggle, - "animation_sequence", - &ScreenArenaScore::animation_sequence, - "background", - &ScreenArenaScore::background, - "ok_panel", - &ScreenArenaScore::ok_panel, - "ready_panel", - &ScreenArenaScore::ready_panel, - "ready_speechbubble_indicator", - &ScreenArenaScore::ready_speechbubble_indicator, - "pillars", - &ScreenArenaScore::pillars, - "bottom_lava", - &ScreenArenaScore::bottom_lava, - "players", - &ScreenArenaScore::players, - "player_shadows", - &ScreenArenaScore::player_shadows, - "unknown24", - &ScreenArenaScore::unknown24, - "unknown25", - &ScreenArenaScore::unknown25, - "score_counter", - &ScreenArenaScore::score_counter, - "unknown27", - &ScreenArenaScore::unknown27, - "lava_bubbles", - &ScreenArenaScore::lava_bubbles, - "player_won", - &ScreenArenaScore::player_won, - "victory_jump_y_pos", - &ScreenArenaScore::victory_jump_y_pos, - "victory_jump_velocity", - &ScreenArenaScore::victory_jump_velocity, - "animation_frame", - &ScreenArenaScore::animation_frame, - "squash_and_celebrate", - &ScreenArenaScore::squash_and_celebrate, - "player_ready", - &ScreenArenaScore::player_ready, - "next_transition_timer", - &ScreenArenaScore::next_transition_timer, - "player_bottom_pillar_offset", - &ScreenArenaScore::player_bottom_pillar_offset, - "player_crushing_pillar_height", - &ScreenArenaScore::player_crushing_pillar_height, - "player_create_giblets", - &ScreenArenaScore::player_create_giblets, - "next_sidepanel_slidein_timer", - &ScreenArenaScore::next_sidepanel_slidein_timer, - sol::base_classes, - sol::bases()); - lua.new_usertype( "ScreenOnlineLoading", "ouroboros", @@ -1009,6 +640,114 @@ void register_usertypes(sol::state& lua) lua.new_usertype( "ScreenOnlineLobby", + "woodpanels_slidein_timer", + &ScreenOnlineLobby::woodpanels_slidein_timer, + "scroll_unfurl_timer", + &ScreenOnlineLobby::scroll_unfurl_timer, + "woodpanel_bottom", + &ScreenOnlineLobby::woodpanel_bottom, + "woodpanel_top", + &ScreenOnlineLobby::woodpanel_top, + "left_scroll_handle", + &ScreenOnlineLobby::left_scroll_handle, + "right_scroll_handle", + &ScreenOnlineLobby::right_scroll_handle, + "scroll_text_id", + &ScreenOnlineLobby::scroll_text_id, + "btn_left_text_id", + &ScreenOnlineLobby::btn_left_text_id, + "btn_right_text_id", + &ScreenOnlineLobby::btn_right_text_id, + "btn_center_text_id", + &ScreenOnlineLobby::btn_center_text_id, + "woodpanel_top_visible", + &ScreenOnlineLobby::woodpanel_top_visible, + "woodpanel_bottom_visible", + &ScreenOnlineLobby::woodpanel_bottom_visible, + "toggle_panels_slidein", + &ScreenOnlineLobby::toggle_panels_slidein, + "players", + &ScreenOnlineLobby::players, + "background_image", + &ScreenOnlineLobby::background_image, + "topleft_woodpanel_esc", + &ScreenOnlineLobby::topleft_woodpanel_esc, + "topleft_woodpanel_esc_slidein_timer", + &ScreenOnlineLobby::topleft_woodpanel_esc_slidein_timer, + "character_walk_offset", + &ScreenOnlineLobby::character_walk_offset, + "character_facing_left", + &ScreenOnlineLobby::character_facing_left, + "move_direction", + &ScreenOnlineLobby::move_direction, + "character", + &ScreenOnlineLobby::character, + "player_ready_icon", + &ScreenOnlineLobby::player_ready_icon, + "arrow_left", + &ScreenOnlineLobby::arrow_left, + "arrow_right", + &ScreenOnlineLobby::arrow_right, + "arrow_left_hor_offset", + &ScreenOnlineLobby::arrow_left_hor_offset, + "arrow_right_hor_offset", + &ScreenOnlineLobby::arrow_right_hor_offset, + "platform_icon", + &ScreenOnlineLobby::platform_icon, + "player_count", + &ScreenOnlineLobby::player_count, + "searching_for_players", + &ScreenOnlineLobby::searching_for_players, + "show_code_panel", + &ScreenOnlineLobby::show_code_panel, + "enter_code_woodpanel_bottom_slidein_pos", + &ScreenOnlineLobby::enter_code_woodpanel_bottom_slidein_pos, + "enter_code_woodpanel_bottom", + &ScreenOnlineLobby::enter_code_woodpanel_bottom, + "enter_code_btn_right_text_id", + &ScreenOnlineLobby::enter_code_btn_right_text_id, + "enter_code_woodpanel_top_visible", + &ScreenOnlineLobby::enter_code_woodpanel_top_visible, + "enter_code_woodpanel_bottom_visible", + &ScreenOnlineLobby::enter_code_woodpanel_bottom_visible, + "enter_code_toggle_panels_slidein", + &ScreenOnlineLobby::enter_code_toggle_panels_slidein, + "selected_character", + &ScreenOnlineLobby::selected_character, + "characters_entered_count", + &ScreenOnlineLobby::characters_entered_count, + "enter_code_topleft_woodpanel_esc_slidein_timer", + &ScreenOnlineLobby::enter_code_topleft_woodpanel_esc_slidein_timer, + "enter_code_banner_text_id", + &ScreenOnlineLobby::enter_code_banner_text_id, + "enter_code_OK_text_id", + &ScreenOnlineLobby::enter_code_OK_text_id, + "enter_code_main_woodpanel_left", + &ScreenOnlineLobby::enter_code_main_woodpanel_left, + "enter_code_main_woodpanel_center", + &ScreenOnlineLobby::enter_code_main_woodpanel_center, + "enter_code_main_woodpanel_right", + &ScreenOnlineLobby::enter_code_main_woodpanel_right, + "enter_code_banner", + &ScreenOnlineLobby::enter_code_banner, + "enter_code_char_cutouts", + &ScreenOnlineLobby::enter_code_char_cutouts, + "enter_code_pointing_hand", + &ScreenOnlineLobby::enter_code_pointing_hand, + "enter_code_buttons", + &ScreenOnlineLobby::enter_code_buttons, + "enter_code_OK_panel", + &ScreenOnlineLobby::enter_code_OK_panel, + "enter_code_OK_panel_slidein_timer", + &ScreenOnlineLobby::enter_code_OK_panel_slidein_timer, + "enter_code_your_code_scroll", + &ScreenOnlineLobby::enter_code_your_code_scroll, + "enter_code_your_code_scroll_left_handle", + &ScreenOnlineLobby::enter_code_your_code_scroll_left_handle, + "enter_code_your_code_scroll_right_handle", + &ScreenOnlineLobby::enter_code_your_code_scroll_right_handle, + "set_code", + &ScreenOnlineLobby::set_code, sol::base_classes, sol::bases()); diff --git a/src/game_api/script/usertypes/state_lua.cpp b/src/game_api/script/usertypes/state_lua.cpp index 6deb29961..6eb7c53b2 100644 --- a/src/game_api/script/usertypes/state_lua.cpp +++ b/src/game_api/script/usertypes/state_lua.cpp @@ -2,6 +2,7 @@ #include "game_manager.hpp" #include "level_api.hpp" +#include "online.hpp" #include "state.hpp" #include @@ -173,6 +174,8 @@ void register_usertypes(sol::state& lua) &StateMemory::set_correct_ushabti); lua.new_usertype( "GameManager", + "game_props", + &GameManager::game_props, "screen_logo", &GameManager::screen_logo, "screen_intro", @@ -209,6 +212,12 @@ void register_usertypes(sol::state& lua) &GameManager::pause_ui, "journal_ui", &GameManager::journal_ui); + lua.new_usertype( + "GameProps", + "buttons", + &GameProps::buttons, + "game_has_focus", + &GameProps::game_has_focus); lua.new_usertype( "LightParams", "red", @@ -289,6 +298,28 @@ void register_usertypes(sol::state& lua) &Camera::focused_entity_uid, "inertia", &Camera::inertia); + lua.new_usertype( + "Online", + "online_players", + &Online::online_players, + "local_player", + &Online::local_player, + "lobby", + &Online::lobby); + lua.new_usertype( + "OnlinePlayer", + "ready_state", + sol::readonly(&OnlinePlayer::ready_state), + "character", + &OnlinePlayer::character, + "player_name", + sol::readonly(&OnlinePlayer::player_name)); + lua.new_usertype( + "OnlineLobby", + "code", + &OnlineLobby::code, + "get_code", + &OnlineLobby::get_code); lua.create_named_table("CAUSE_OF_DEATH", "DEATH", 0, "ENTITY", 1, "LONG_FALL", 2, "STILL_FALLING", 3, "MISSED", 4, "POISONED", 5);