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.
* 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
* 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
* Free mod audio data that wasn't previously being freed
* Fix memory leaks if sound decoding/init fails
* Remove unnecessary checks
* drain pending sample copies
* more audio decoder freeing
* seems to be memory safe now
- audio_custom_shutdown was being called 4 times per game_deinit lol
- freeing stuff properly, be safe against threads by flagging shutdowns
- add an error path to audio_load_internal
- flag currently destroying nodes
etc
* oops, Lua shouldn't have access to this
* apply review changes
---------
Co-authored-by: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com>
* 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
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`.
* 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
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.
* 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
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)
```
- 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>
Applied a compatibility band-aid for `ModAudio.file.relativePath` using unions and properties. The only real thing here is the new hidden `return_self` function I had to make for this to work
unction
* 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!
* Add version info (Windows) + Smart update checker
* patch autogen, remove prints
* Fix special case (min=0,fix=!0)
* Not that obvious!!
* Still too obvious... last one
* the djoslin0 review
* Nuked
* 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
* 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
- 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.
- 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
* 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