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
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.
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`
* 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
* 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>
* 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!
* 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
- 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
* 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
## `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