Commit graph

730 commits

Author SHA1 Message Date
PeachyPeachSM64
bdf30bc88e Remove unused and filler fields from Lua
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
2026-06-14 19:42:05 +02:00
PeachyPeach
06ce5a2d3f
Custom object fields enhancements (#1230)
* Define global custom object fields

* _global_custom_object_fields

* improve custom object fields

* fix cobject pairs + add custom object fields; remove unused stuff

* mucher better

* paramater

* review 1

* review 2

* Fix 'obj_get_*_with_*_field_*' functions with custom fields
2026-06-14 16:28:52 +02:00
PeachyPeachSM64
a8cc9dbdf7 SOC index is not deprecated
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
2026-06-04 18:42:52 +02:00
PeachyPeach
b8fde28886
Fix Mario clones stealing bodystate from player Marios (#1286)
When spawning fake Marios, these objects would steal the bodystate from valid Marios, resulting in nametags rendering in the wrong place and PvP attacks using these fake as origin.
2026-06-01 10:29:18 +10:00
Agent X
2ed8b3252f
Achieve 100% function documentation (1972/1972 smlua functions) (#1289)
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
* Achieve 100% function documentation

Jeez man

* Fix borked character

* Fix an error I must have made a while ago
2026-05-31 16:15:18 -04:00
Agent X
46859be47d
Expose DJUI gfx scale function (#1292) 2026-05-31 15:05:41 -05:00
Agent X
db2195249f
Add function to center free camera (#1288)
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
2026-05-31 15:11:13 +10:00
PeachyPeachSM64
b6a20eeee6 reran autogen
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
2026-05-30 20:10:52 +02:00
Emily♥
15af400a01
Add djui_console_is_open (#1278)
* Add djui_console_is_open

Adds a lua function that returns if the djui console is open or not. Useful with the existing function djui_console_toggle() for disabling the djui console (mainly to prevent reading chat messages, as opposed to the only other solution which is to fill the console with spam). It doesn't affect the console used with the --console launch parameter in case debugging is necessary.

* Fix function description

please I need this

* Fix function description on docs

Silly me forgot to actually change the description where it matters
2026-05-30 12:01:52 -04:00
EmeraldLockdown
55a7590e89 fix incorrect label on playerIndex in HOOK_ON_NAMETAGS_RENDER
I INCORRECTLY assumed that a number was an `s32` and a integer was an `u64`. This is some next level blunders. A `number` is a `f64` and a `integer` is a `s64`. This is, in fact, a integer.
2026-05-29 18:58:35 -05:00
EmeraldLockdown
7980c3b25b
Fix playerIndex type for HOOK_ON_NAMETAGS_RENDER in hooks.md
Before it was a `string` when it should be a `number`. See `smlua_hook_events.inl`

`SMLUA_EVENT_HOOK(HOOK_ON_NAMETAGS_RENDER, _, s32 playerIndex, Vec3f pos, OUTPUT const char **playerNameOverride) // Manually defined hook`

The type `number` is used as an `s32` is equivalent to a `number`. An `integer` is equivalent to a `u64`
2026-05-29 16:45:12 -05:00
PeachyPeach
358a60d74d
Add default values for mod_storage_load functions (#1276) 2026-05-28 08:44:35 +10:00
PeachyPeachSM64
b46f1a26cf Fix inconsistencies with tabs and remove trailing whitespaces
Some checks are pending
Build coop / build-macos-intel (push) Waiting to run
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
2026-05-26 23:51:58 +02:00
Agent X
943bbd29e2
Add get_current_play_mode() and get_delayed_warp_op() (#1270) 2026-05-25 19:31:02 -04:00
Agent X
7de436bcb6
Add function to enable a fullbright mode (set_shading_fullbright_enabled) (#1261)
* Add function to enable a fullbright mode

* Requests

* Breaklines
2026-05-23 14:37:58 -04:00
Agent X
eb3de50d07 Default object light ID to -1
Some checks are pending
Build coop / build-macos-intel (push) Waiting to run
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run
2026-05-23 11:47:05 -04:00
PeachyPeachSM64
2d6848a768 Fix object functions incorrectly using current object instead of the provided object 2026-05-23 12:31:27 +02:00
PeachyPeachSM64
541874fdca make visibleToObjects a boolean 2026-05-21 20:20:23 +02:00
Baconator2558
8f105ea53d
Rename and expose visibleToObjects field (#1251)
* override_mario_visibility_to_objects

* Remove override_mario_visibility_to_objects in favor of exposing visibleToObjects

* Fix comment referencing the field's original name

* Reset visibility each frame

* Minor fix
2026-05-21 14:10:10 -04:00
PeachyPeach
834512a5c5
Fix Lua/custom behaviors bugs and flaws (#1229)
* improve custom behaviors logic

* clarify description of get behavior functions; get name returns last name instead of first; create generic name only when needed

* review

* fix potential buffer overflow
2026-05-19 10:56:08 +10:00
PeachyPeachSM64
925325c5eb copy paste gone wrong
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
2026-05-18 14:10:39 +02:00
Sunk
e2035853b9
Change romhack camera options (#1247)
Some checks are pending
Build coop / build-linux (push) Waiting to run
Build coop / build-steamos (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
* Change camera options

* Resolve suggestions
2026-05-16 22:07:51 -04:00
Isaac0-dev
967d120505
much further draw distance option (#1240)
The existing draw distance options don't actually increase the draw distance. It only impacts whether or not distant objects are rendered. 

This PR:
- Adds another option to the draw distance setting in the display menu, called "Infinite". It is not truly infinite, but it is significantly larger than what current options allow. Due to it not being truly infinite, we could use the name "Max" instead to be more accurate.
- Exposes a new function to the Lua API `draw_distance_scalar_is_infinite` which returns whether or not the infinite setting is enabled.
- `draw_distance_scalar_is_infinite` is now used in several places in this repo to bypass distance checks for objects if infinite mode is enabled.
- Fixes a bug where you couldn't bypass the distance check in `obj_is_in_view`, meaning you could never disable all object distance culling.
- The infinite setting now forces the far plane to be at least a minimum of `1,000,000`.
2026-05-16 11:13:02 +10:00
Cooliokid956
e87d118063
Multiline descriptions (#1235)
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (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
2026-05-13 16:06:19 -04:00
Agent X
19a429dbe5
Add built-in preset screen shader effects configurable through Lua (#1217)
* C++ lighting engine

Runs better using my new system for storing and iterating through lights.

I removed the lighting ctx profiler because after I've realized its very inaccurate and was probably programmed incorrectly from the start. Although I remember it working fine before and not constantly showing 20 ms or higher when I'm in an extremely simple level with extremely simple lights and the FPS is way too high for it to be taking 20 ms.

* Whoops

* Make some optimizations

* Fix small bug with LE inside graphics vertex function

I also brought back the lighting profiler because it's better than nothing.

* Some optimizations

* Cache active lights and 4 lights per vertex limit

Less branching and less iterating with the limit

* Screen shader effects for Lua [OpenGL]

Hue, saturation, brightness, contrast, exposure, dithering, posterization

Global = usually an object in the world
Non global = usually a screen element

Also:
* Changed skyboxes to use environment color instead of vertex color, visually identical
* Changed hud head texture to be non global
* changed power meter to be non global
* changed sparkles to be global
* changed some BBH vertex types to global

OpenGL renderer supported only for now.

* Add default values and better function names

Also fixed sizes in reset function

* Add scanlines effect

* Add global enabled function

* Fix some default values

* Hopefully fix white sparkles

* Whoops

* Address review

* Update function names

* Fix shader crash

* Address reviews
2026-05-11 15:59:48 -04:00
PeachyPeach
07c229afdc
Fix rendering issues with held objects (#1221)
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
Add a way to save and load a gfx state in display lists.
Its primary purpose is to save the gfx state before rendering a held object, then restore it later.
It fixes the issue where Mario had opaque legs with the vanish and metal caps when holding an object.
2026-05-06 07:10:59 +10:00
EmeraldLockdown
82a3afcc0f
Add HOOK_ON_PLAY_MODE_UPDATE and HOOK_BEFORE_PLAY_MODE_UPDATE (#1160)
* Add playmode hooks

* Add hook to docs, fix some crashes semi-related

* Rename that func
2026-05-04 21:01:01 -04:00
DorfDork
f688416483
Scale bone anim support (#1215)
* Scale bone anim support

Code changes provided by ExcellentGamer. Supports model anims which modify scale.

* Peachy code changes by ExcellentGamer

* Autogen constants

* changed vc3f_set to vec3f_copy
2026-05-05 00:15:00 +02:00
jayden
5dabcaa313
Add audio_stream_get/set_volume_channel (#1205)
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
Allows modders to play audio streams on channels other than level background music.
4 constants have been added for this purpose:
- `MOD_AUDIO_CHANNEL_MASTER` - sound is only affected by master volume
- `MOD_AUDIO_CHANNEL_MUSIC` - sound is affected by music volume, same as previous behaviour
- `MOD_AUDIO_CHANNEL_SFX` - sound is affected by sfx volume, same as sample behaviour
- `MOD_AUDIO_CHANNEL_ENV` - sound is affected by env volume 
This was done instead of using the existing `SEQ_PLAYER_*` constants to avoid confusion and because there isn't a `NONE`/`MASTER` option.

Additionally, sets the default to `MOD_AUDIO_CHANNEL_MUSIC` as to not break compatibility.

```lua
audio_stream_set_volume_channel(stream, MOD_AUDIO_CHANNEL_SFX) -- wow its just like a sample
audio_stream_get_volume_channel(stream) -- returns MOD_AUDIO_CHANNEL_SFX (its actually 2)
```
2026-05-03 17:59:11 +10:00
djoslin0
e88bd178fc
Refactor collision surface systems and add the ability to add/remove/move surfaces (#1143)
- Add `smlua_collision_add_surface`, `_move_surface`, `_delete_surface` Lua APIs
- Add `remove_static_object_collision` to fully free a SOC and its surfaces
- Split surface pools into separate static, SOC, and dynamic pools
- Replace index-based SOC tracking with unique ID counter (`sSOCIdCounter`)
- Invalidate Lua CObjects for recycled surfaces on pool clear
- Expose `SURFACE_POOL_STATIC/DYNAMIC/SOC` constants to Lua
- Add `growing_array_swap_and_pop` and `growing_array_swap_and_pop_index` to memory utils

Co-authored-by: MysterD <myster@d>
2026-05-02 14:58:46 -04:00
EmeraldLockdown
37f4b2e550
Expose gHudDisplay (#1158)
* Expose `gHudDisplay`

* Fix that
2026-05-01 22:25:06 -04:00
Cooliokid956
1d9de02af1
CObject Properties (#1068)
* CObject Properties

- Added property members to CObjects via `PROPERTY` macro
`PROPERTY(name, get, set)`
  - `name`: property name
  - `get`: `fun(self): value`
  - `set`: `fun(self, value)`
- Prettified `LuaObjectField` struct with unions for function/property value types
- Added properties to `struct ModAudio`
  - `position`
  - `looping`
  - `frequency`
  - `volume`
    - NOTE: only work with streams- the audio reform will come later

* Define array size only when necessary

- new `__pairs` metamethod for `CObject`s, cycles through all of an object's fields, in alphabetical order
- stray semicolon!
2026-05-01 22:12:51 -04:00
Squishy
0d95dfde11
Add independent X and Y scaling to text rendering functions (#1182)
* djui scale cool awesome

* fix autogen

* stop unnecessary yellow underlines

* Fix accidental bind removal
2026-05-01 21:17:44 -04:00
Emeraldsniper
0e2ba340fc
Control the Lighting Engine with le_set_enabled in real time (#1193)
* Control the Lighting Engine with le_disable and le_enable in real time

(FORK REDO FOR PR)

* I hate it when I typo

* Control the Lighting Engine in real time with le_set_active (new change)

* Changed to le_set_enabled to be better in line with functions
2026-05-01 21:15:09 -04:00
Blockyyy
793196d581
add stayInLevelAfterStar constants (#1210)
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
2026-04-30 12:24:57 +10:00
EmeraldLockdown
6510f3928c
Fix cutscenes, syncing issues, and more (Yoshi!) (#1109)
* Fixes

* Lots more changes

* Yoshi :D

* Remove some unecessary changes

* Oops

* Remove temp code

* Revert changes made to king bobomb, will be handled in #1196

* copied from main not dev, oops

* Address review and do a minor improvement

* Nuke that
2026-04-21 23:37:30 -04:00
EmeraldLockdown
7e10a3bb13
Add in C documentation (#1176)
* Add in C documentation

* update readme

* Remove unecessary spacing
2026-04-21 21:35:01 -04:00
jayden
45bc3062be
Fix get_texture_info and add HOOK_ON_DYNOS_PACKS_TOGGLED (#1181)
* respect overridden textures

* add HOOK_ON_DYNOS_CHANGED

* document HOOK_ON_DYNOS_CHANGED

* HOOK_ON_DYNOS_CHANGED -> HOOK_ON_DYNOS_PACK_TOGGLED

* Apply suggestions from code review

Co-authored-by: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com>

* Update data/dynos_mgr_tex.cpp

Co-authored-by: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com>

* add missing include

* add pack name and enabled

---------

Co-authored-by: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com>
2026-04-21 21:22:18 -04:00
jayden
21dd1ce81d
Add mod_fs_file_set_compression (#1187)
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
* add compression level to modfs files

* document modfs compression

* correction in modfs guide

* undo text mode write check

* compression level use s32 instead of int

* fix missing s32
2026-04-10 23:25:58 +02:00
PeachyPeach
24c5a226ed
Fix mod storage load/save number (#1169)
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
- Fix `mod_storage_load/save_number` incorrect behavior. These functions should now be used only with numbers, not integers (see next point). The `mod_storage_load_number` can still load integer values from existing mod storage files.
- Add `mod_storage_load/save_integer` for integer values.
- Expand the range of savable values to `double` (64-bit float) and `long long` (64-bit integer) for respectively `number` and `integer` mod storage functions.
- Fix an obscure bug with `smlua_to_integer` that truncated very high integer values due to an implicit cast to double, causing floating-point imprecision issues. Thanks @yoshiweegee for the explanation.
2026-04-05 10:56:53 +10:00
PeachyPeach
de25c5437b
Make djui_hud_measure_text compute text height (#1177)
- Change `djui_hud_measure_text` to return both text width and height
  - New syntax is: `local width, height = djui_hud_measure_text(text)`
  - Old syntax still works, but only returns `width`
- Fix incorrect char height for some fonts
- Fix nametags interpolation using the wrong scale
2026-04-05 10:00:03 +10:00
PeachyPeach
8afe062be1
Fix nametags color and rendering order (#1150)
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 nametags color and rendering order

* make growing_array_init reuse array and buffer if they were already allocated

* use prim color for text color

* isaac review

* update text color descriptions

* small optimization
2026-04-04 09:37:16 +10:00
ThePlayerRolo
7ec6c77e1c
Implement smlua_audio_utils_allocate_sequence() (#891)
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
2026-03-20 08:14:24 +10:00
EmeraldLockdown
8735cf96ad
Add get_mod_files (#1091)
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
* Add `get_mod_files`

* Dont allocate memory, use the stack

* Implement peachy's suggestion

* Actually allow optional to wrok
2026-03-15 21:49:01 +01:00
djoslin0
2c367b556d
Add surface collision Lua hooks (#1139)
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
* Add surface collision Lua hooks

- Add 6 new hooks:
    HOOK_ON_FIND_WALL_COLLISION,
    HOOK_ON_FIND_CEIL,
    HOOK_ON_FIND_FLOOR,
    HOOK_ON_FIND_WATER_LEVEL,
    HOOK_ON_FIND_POISON_GAS_LEVEL,
    HOOK_ON_FIND_SURFACE_ON_RAY

- Hooks expose current result values and allow overriding collision outputs from Lua

* Remove unnecessary branches

---------

Co-authored-by: MysterD <myster@d>
2026-03-15 14:04:36 +01:00
PeachyPeach
3b53952767
DJUI Text improvements and bug fixes (#1131)
- Drastically improve and optimize display list usage for text
- Add text alignment with and without interpolation, and color codes, new lines and tabs are now handled properly
- Restored alpha color code (`#RGBA` or `#RRGGBBAA`) for `djui_print_text` functions (regular DJUI text allows alpha color codes, but ignores the alpha component)
- Add constants for common text alignment and rotation pivot values
- Fix interpolation issues with all `djui_hud` elements
- A few autogen fixes (missing `number` type for constants, missing return values for some functions)
- Fix recolorable hud font offsets on `e`, `i` and `o` letters
2026-03-11 08:38:24 +10:00
Blockyyy
f6f5434dda
set_sound_bank_override (#1046)
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
2026-02-20 10:34:25 +10:00
PeachyPeachSM64
692c61f361 autogen
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
2026-02-19 18:45:42 +01:00
Agent X
0ce4163519
Lighting Engine refactor (up to 10x perf increase) (#1098)
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
* C++ lighting engine

Runs better using my new system for storing and iterating through lights.

I removed the lighting ctx profiler because after I've realized its very inaccurate and was probably programmed incorrectly from the start. Although I remember it working fine before and not constantly showing 20 ms or higher when I'm in an extremely simple level with extremely simple lights and the FPS is way too high for it to be taking 20 ms.

* Whoops

* Make some optimizations

* Fix small bug with LE inside graphics vertex function

I also brought back the lighting profiler because it's better than nothing.

* Some optimizations

* Cache active lights and 4 lights per vertex limit

Less branching and less iterating with the limit

* Peachy changes
2026-02-18 01:43:44 -05:00
Cooliokid956
00cb6461f9
Add various interpolation skipping functions + get_time_stop_flags() (#1064)
## `void geo_skip_interpolation(struct GraphNode *node, struct GraphNodeObject *obj)`
Skips graph node interpolation for a frame
feed it a graph node and its corresponding object

## `void obj_skip_interpolation(struct Object *o)`
Skips object interpolation for a frame
takes care of only the object transform, otherwise you need to use

## `void obj_anim_skip_interpolation(struct Object *o)`
Skips animation interpolation for a frame
useful for choppy animation

------------
## `u32 get_time_stop_flags(void)`
Gets the current time stop state
2026-02-18 07:47:49 +10:00