Commit graph

307 commits

Author SHA1 Message Date
Isaac0-dev
f587dc38be removed get_game_tick_counter
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
use get_global_timer instead
2025-06-15 21:01:32 +10:00
djoslin0
f42e4ad55b
Add get_game_tick_counter() (#852)
Coop now maintains a counter that increments at the start of each game tick,
And another counter that increments at the start of each frame render.

This is to be able to identify specific frames regardless of mod load, hook,
and execution order.

---------

Co-authored-by: MysterD <myster@d>
2025-06-15 17:26:53 +10:00
Isaac0-dev
b7edf71499 replace get_texture_average_color with texture_to_lua_table 2025-06-09 14:39:07 +10:00
Isaac0-dev
98ff007818 get_texture_average_color
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
pass in a texture, it returns the average color of the texture
2025-06-05 22:33:24 +10:00
Isaac0-dev
378b619fd6 made autogen build djui_hud_render_texture* 2025-06-05 21:03:38 +10:00
PeachyPeach
c79d59d8ec
Fix vec3f bugs (#837) 2025-06-05 19:44:09 +10:00
Isaac0-dev
e1aab9c479 gfx_get_texture
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
returns a pointer to the texture in the gfx command
2025-06-05 17:07:53 +10:00
Agent X
feba35b010 Expose sync_object_get_object
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
2025-05-29 11:31:31 -04:00
PeachyPeach
69e129805e
More math improvements (#820)
* More math improvements

* more math functions

* stack check

* added error message when trying to modify read-only table; fix gSmluaConstants printed to console
2025-05-29 02:52:31 +02:00
Agent X
3795e5afbc Add some sync object functions [build]
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
2025-05-26 14:51:57 -04:00
PeachyPeach
bbabaa3c79
Fix hand/foot pos and get any Mario part position (#816)
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows-opengl (push) Waiting to run
Build coop / build-windows-directx (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
* Fix hand/foot pos and get any Mario part position
2025-05-21 23:52:04 +02:00
PeachyPeach
8db6356754
Improving math functions (#813)
* Improving math functions

* Isaac review
2025-05-21 23:50:49 +02:00
Isaac0-dev
ecac2afd07 fix some issues with smlua
get_temp_s32_pointer and deref_s32_pointer: these are actually safe and mods use them
fixed a nil script error with smlua_to_cpointer
2025-05-21 21:50:13 +10:00
Sunk
047adf35bf
Expose and create some useful functions (#819) 2025-05-21 09:40:30 +10:00
Prince Frizzy
02c9a4146b
More Optimizations (#792)
* Initial work on optimizations.

* Requested Changes Part 1

* Requested Changes Part 2

* Requested Changes Part 3

* Requested Changes Part 4

* Requested Changes Part 5

* Requested Changes Part 6

* Update deprecated.lua

---------

Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-05-16 20:27:49 -04:00
PeachyPeach
0d4fd39a00
Fix interactions again (#795) 2025-05-08 08:51:44 +10:00
Beckowl
7472aa9b0a
Expose useful global graphnodes (#789)
* Add global node getters

* move pointer asterisk thing for consistency

* Run autogen

* Add geo prefix to new functions

* Run regen

* Rename functions

* run autogen

* Make viewport fields mutable

* Address code review comments
2025-05-07 17:09:08 -04:00
Prince Frizzy
15d6f6ae07
Add some sanity checks to prevent bugs and exploits. (#767)
* Add some sanity checks to prevent bugs and exploits.

* Improve sanity check for Koopa Shell Riding.

* Sort and optimize MarioState structure.
2025-04-27 17:02:15 -04:00
Agent X
bf85d9f9d5 Lay some groundwork for more documentation, fix compilation error, put backgrounds into enum 2025-04-26 23:29:21 -04:00
Agent X
5d5147cb0e Document more functions! (83%)
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
2025-04-25 17:03:41 -04:00
PeachyPeach
0f351e11fb
Gfx/Vtx improvements (#756)
Some checks failed
Build coop / build-windows (push) Has been cancelled
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
- Renamed the `new` and `realloc` functions to `create` and `resize`
- Added `delete_all`
- Made Mod Data a class:
  - Allocation is now limited to prevent out-of-memory crashes: 1024 display lists of max size 2048 and 1024 vertex buffers of max size 4096 per mod
  - Added error codes to identify the cause of a failure (name not found, pointer not found, max size exceeded, item pool is full, ...)
2025-04-24 14:03:17 +10:00
PeachyPeach
467b22e939
Gfx set command: v2 + Gfx/Vtx dynamic alloc (#718)
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
* set_gfx_command part 2

* part 3

* get gfx/vtx from name; copy gfx/vtx

* gfx/vtx dynamic allocation lua

* gfx/vtx_new: don't take level/model/vanilla names

* Clean up gbi constants

* update example

* Isaac review; add gfx_get_next_command and vtx_get_next_vertex

* make all commands length 1; missing NULL checks
2025-04-12 18:19:14 -04:00
PeachyPeach
26d64ee79d
fix apply_platform_displacement (#740)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
2025-04-12 23:03:12 +10:00
Cooliokid956
f22855d21e
Platform DIsplacement on demand (#739)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
+ two other functions that pipocalio asked for
2025-04-11 23:37:57 -04:00
Cooliokid956
3bfa75e32b
Miscellaneous Additions: Addendum (#723)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
* More autogen work

- made the `Pointer_` classes into aliases instead so that they're actually associated with their true type
- "Total constants" metric is now accurate

* High Quality Master Volume

* Audio work

it's 12:55am and there are some bright flashes outside (lightning)

- cracked the code (interpreted the "Acc" in `tempoAcc`)
- added several functions that will help greatly in the Streamed Music department (you can now match sequenced music fading (transitions, eepy, etc.))
- introducing `gMasterVolume`! a variable that is only updated when it needs to be, theoretically improving performance (by some amount). this variable is used in many places in place of recalculations of the same number
- made it so that muting the game skips some audio processing (not the main process since that would linger after unmuting (not good))
- fixed an oversight where lua volumes were not taken into account when `audio_stream_set_volume`
- it's its 😁
- removed additional `#include "audio/external.h"`

it is 1:06am
gn

* Add mouse status functions

you can now check if mouse buttons were held, clicked, or released

* Sorting was a bad idea

disabled sorting for constants so that they are represented more closely to their original defines

* Expose playerlist page index

also noticed that sorting still sucks

* Minor (very important) detail

lalette

* Addressing the PeachyPeachSM64 reviews

* Return of the Forced 4:3 Mode

shoutouts to DISPLAY.FORCE_4BY3 for sticking through the toughest of times, waiting for this day to come

* Added scroll support

- Scrolling added to chat box (hold ctrl to scroll fewer lines, shift to scroll faster)
- Scrolling functions added to smlua

* Addressing the Isaac0-dev review + fixes

- mouse scroll is now accumulated
- djui_gfx_get_dimensions
- forced 4:3 won't kick in if the window isn't wide enough
- game now recognizes horizontal resizing when in 4:3 mode

* Run autogen

* gfx_get_dimensions

works just as well
2025-04-05 13:52:14 -04:00
Agent X
0ee8d5f81e Fix/optimize/improve lighting engine 2025-03-28 23:06:48 -04:00
Agent X
3e540790a3
Basic Vertex Point Lighting Engine (#716)
* CONCEPT: Basic vertex lighting engine

Set the geometry mode on your model to G_LIGHTING_ENGINE_EXT, spawn a `bhvAmbientLight`, spawn some `bhvPointLight`s, and then you got yourself a mighty interesting scene.

* Fixes

* How did I miss this

* Make light set home pos
2025-03-27 16:36:02 -04:00
Isaac0-dev
f2b4f4aaad add herobrine
Some checks failed
Build coop / build-ubuntu (push) Has been cancelled
Build coop / build-windows (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
Co-Authored-By: Agent X <44549182+AgentXLP@users.noreply.github.com>
2025-03-26 14:21:02 +10:00
Cooliokid956
efcfff210d
Miscellaneous additions (#711)
- Fixed script file path shortening for Windows in console errors (what I could at least, the one left unfixed is preprocessed and I can't mess with that)
- Adjusted audio sanity check messages to sound more natural
- 9 new functions added:

## `audio_stream_set_loop_points(audio, start, end)`
Sets an audio stream's loop points in samples, no longer requiring a hacky method to loop streams in mods

## `get_active_mod()`
Returns the mod currently being processed, can be used by mods with APIs to determine what they're being used by and react accordingly

## `get_area_update_counter()`
Returns `gAreaUpdateCounter`, can be used to determine various in-game statistics, as well as if the game is being updated

## Exposed several object pointers
`get_current_object()` to retrieve `gCurrentObject`
`get_dialog_object()` to retrieve `gContinueDialogFunctionObject`
`(get|set)_cutscene_focus()` to retrieve/assign `gCutsceneFocus`
`(get|set)_secondary_camera_focus()` to retrieve/assign `gSecondCameraFocus`
2025-03-24 07:31:06 +10:00
Agent X
2479eaabfb This new camera code is NOT up to pollos standards. 2025-03-18 23:06:36 -04:00
Agent X
ab49c33d86 Expose some cool math functions
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
2025-03-14 22:25:56 -04:00
Sunk
edacdcc7e4
More settings to the Camera settings menu (#555)
Some checks are pending
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
Build coop / build-macos-intel (push) Waiting to run
Sherbie's suggestions from #497 and #538, as well as suggestions from others on discord.
Add 2 new camera settings to free camera, being camera collision and dpad usage.
Add an entire new camera submenu for romhack camera, which are now no longer exclusive to romhacks.
2025-03-14 13:01:51 +10:00
ManIsCat2
334aac7cf1 add lua texture image 2025-03-11 00:52:38 +03:30
Isaac0-dev
f98571c458 add documentation to some missing manual functions 2025-03-10 23:22:20 +10:00
Isaac0-dev
d6e243c4a7 add obj_get_model_id_extended, remember regular model ids 2025-03-04 15:09:09 +10:00
Isaac0-dev
f238b3d0f5
allow Lua to manipulate displaylists and vertices (#675)
Co-authored-by: ManIsCat2 <137772623+ManIsCat2@users.noreply.github.com>
2025-02-27 14:27:55 +10:00
Isaac0-dev
2ec4b5e53c set_find_wall_direction 2025-02-22 11:54:07 +10:00
Isaac0-dev
b1b5b93dcc remove some dangerous functions 2025-02-13 22:33:34 +10:00
Isaac0-dev
9a13c298ad added HOOK_ON_INTERACTIONS
this is called after mario's interactions are processed
2025-02-11 17:58:57 +10:00
Isaac0-dev
d53d20c11c HOOK_ON_DIALOG fixes, expose set_dialog_box_state 2025-02-10 18:31:59 +10:00
Agent X
fefb222198 Re-expose function 2025-01-10 19:04:55 -05:00
John S
be0e47a4c2
Documentation of mario.h, mario_actions_airborne.c, mario_actions_automatic.c, mario_actions_cutscene.c, and mario_actions_moving.c (#601)
* WIP mario.h - mario_actions_moving.c

* Fix improper list formatting

bulleted lists are broken due to whitespace stripping, i may fix this later.

* Fix some issues in formatting and missing descriptions

* Accidental struct syntax fix

* Fix repeating descriptions

* Fix repeating descriptions final
2024-12-31 21:00:54 -05:00
Agent X
f880e6c569 Document level_update.h and add new instant warp function (70.1%) 2024-12-31 19:39:36 -05:00
PeachyPeach
96932f5bf1
Custom geo function and switch nodes with Lua callback (#593) 2024-12-31 10:23:13 +10:00
jayden
68b9f2c556
Autogen correctly handle pointers (#584)
* correctly handle pointers in autogen

* autogen with correct pointers

* fix typo in lvt autogen
2024-12-27 17:51:47 -05:00
jayden
2a19745137
Expose types of GraphNode to Lua (#580)
* expose graph_node.h

* cast_graph_node lua function

* document cast_graph_node

* graph node immutables
2024-12-22 19:15:04 -05:00
John S
8da73663aa
Document Interaction.h (68.23%) (#577)
* Document Interaction.h (68.23%)

* Fix caps

* Fix missing bracket

* Make descriptions a little more clear and concise
2024-12-19 22:30:07 -05:00
Agent X
e3c1b20f6b Document rumble_init.h (65.46%) 2024-12-16 20:42:20 -05:00
Agent X
faceaa684a Document sound functions 2024-12-16 20:18:28 -05:00
xLuigiGamerx
66fb28500b
Added djui_menu_get_rainbow_string_color() (#536)
* Removed unintentionally exposed function and disallowed it in autogen

* Exposed djui_language_get to lua

* Added djui_menu_get_rainbow_string_color()
2024-12-16 16:51:27 -05:00