Commit graph

4795 commits

Author SHA1 Message Date
ThePlayerRolo
f20d238167 Updates according to review 2025-07-12 21:07:37 -04:00
ThePlayerRolo
0983fee916 quick fix 2025-07-10 14:19:26 -04:00
ThePlayerRolo
a5dad2204c Edit Naming To Be Consistent 2025-07-10 14:13:44 -04:00
ThePlayerRolo
ca6a3d1148 Allocate Sequence 2025-07-10 12:36:21 -04:00
PeachyPeachSM64
9c28364d81 Fix warnings and some bugs
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
thanks maniscat
2025-07-02 18:49:44 +02:00
djoslin0
81af37eef6
Regenerate DynOS assets when source files are modified (#873)
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
Previously to recompile DynOS assets you had to remove the
bin/lvl/bhv/tex/col/etc files. Now the game will compare the
last-modified-timestamps of the generated/compiled assets vs
the other files that are within those directories. If the presumed-
source files have a later modified timestamp DynOS will regenerate
those assets.

While this results in scanning the attributes of files more, it
also prevents parsing files unnecessarily. Previously actors
would always parse their source files and build up GfxData
unnecessarily.

---------

Co-authored-by: MysterD <myster@d>
2025-07-02 23:24:35 +10:00
Agent X
6a5af9d23a Lighting engine full documentation and more improvements
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-07-01 13:41:28 -04:00
PeachyPeach
4c3ee14f55
Mod file system (#850)
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
* modfs; optional function parameters in autogen

* errors and stuff

* script to turn a directory into a modfs file and vice versa

* bug fixes

* read: raise error on eof

* properly check eof on read_string

* fill; reload; check pointer validity; skip private files when loading non-active modfs

* added bytestrings

* move ByteString to smlua_utils.h
2025-07-01 01:53:47 +02:00
djoslin0
cf43b5d465
Fix warping from one custom level to another (#878)
* Fix warping from one custom level to another

* Remove cached level warps

* More comments, use LEVEL_UNKNOWN_X

* more readability

* clear custom level slots on unload

---------

Co-authored-by: MysterD <myster@d>
2025-07-01 01:52:17 +02:00
Isaac0-dev
066481b59e
type checking for dynos gfx symbol parsing (#849)
* type checking for dynos gfx symbol parsing

* peachy review

* better parameter counting

* using peachy's changes

* Update dynos_bin_gfx.cpp

seems like fast64 write 0 instead of NULL for null pointer, which is technically valid

---------

Co-authored-by: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-07-01 01:51:15 +02:00
djoslin0
bf3127b3df
Add bytestring packets for mods to use (#866)
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
Adds network_send_bytestring(), network_send_bytestring_to(), and
HOOK_ON_PACKET_BYTESTRING_RECEIVE

This is as close to raw bytes as you can get in lua. It allows you
to efficiently pack as much data as possible into each packet.

The existing network_send() was built for ease of use, but is quite
inefficient when you want to send a lot of data. Each number or int
field in the table amounts to 9 bytes for the key and 9 bytes for the
value. (amounting to 18 bytes per value). Whereas with the new method
you can pack that information into 1, 2, 4, or 8 bytes depending on
your type's size.

---------

Co-authored-by: MysterD <myster@d>
2025-06-30 11:24:39 +10:00
Agent X
7009e7da86 Lighting Engine: Awesome Edition
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
Just making a brief commit and thats all to add onto dj's lighting engine improvements because I heard about the PR, in mine I
* allowed all Vtx objects to be manipulated/retrieved
* updated lighting engine demo to be an SM64 night mode with a flashlight
* Fixed longterm bug where lighting bugs out unless you spawn a light
* Added new default LE mode LE_MODE_AFFECT_ALL_SHADED_AND_COLORED which also affects vertex colored surfaces
2025-06-29 12:08:04 -04:00
djoslin0
82ca45eeb6
Lighting engine improvements (#870)
* Lighting engine improvements

Now objects will be affected by the lighting engine. This is
accomplished by passing the renderer the object's model matrix
(uncombined with the view or projection). You can now setup the
lighting engine mode to affect all shaded surfaces, lighting can
be affected by surface normals, and you can control what type of
tone mapping is applied.

added le_set_mode(mode)
    By default we retain the previous behavior.

    When set to LE_MODE_AFFECT_ALL_SHADED the lighting engine will
    affect every shaded material.

    This way we don't have to recompile every object and level that
    we want shaded with special coop-specific commands

added le_get_mode()

added le_set_tone_mapping(toneMapping)
    Tone mapping is what happens when a color value exceeds its 0-255
    range.

    By default we retain the current tone mapping (called
    LE_TONE_MAPPING_TOTAL_WEIGHTED).

    LE_TONE_MAPPING_WEIGHTED is now accessible, it was the tone
    mapping that was previously left out of the compile through ifdefs.

    LE_TONE_MAPPING_CLAMP is just simple additive with a clamp at a
    color value of 255.

    LE_TONE_MAPPING_REINHARD is reinhard tone mapping
    (vout = (vin + 1) / vin).

added le_set_light_use_surface_normals(id, useSurfaceNormals)
    By default lights retain their previous behavior (of ignoring
    surface normals).

    When enabled lights cast on one side of the object will not
    appear on the other side of the object.

    It is kind of like backface culling, but for lights.

added le_calculate_lighting_color_with_normal(pos, normal, outColor, lightIntensityScalar)
    It's just like le_calculate_lighting_color(), but you can pass
    in normals now.

* Removed normal calculation from vertex colored surfaces - they don't have normals

* Use packed normals correctly

* made LE_MODE_AFFECT_ALL_SHADED the default

* made useSurfaceNormals the default for lights

* Set ambient color, performed le_is_enabled() checks

The ambient color was black, which is why everything was dark by default.
If we set ambient to white then people will never see the effects of their
lights unless they set ambient to a lower value. So I added checks for
if a light has ever been added. The alternative would be to have something
like le_set_enabled()

* Rewrite how we obtain the model matrix - invert the camera

* run autogen

* Change default tonemapper to weighted, make setting ambient enable LE, fix null deref

* Address Peachy's comments

---------

Co-authored-by: MysterD <myster@d>
2025-06-29 17:46:35 +02:00
djoslin0
afb1c7f0e8
Adjust alpha color combiners to use the correct values (#876)
Co-authored-by: MysterD <myster@d>
2025-06-29 15:25:56 +02:00
Isaac0-dev
873bbd3c1d thought i fixed this ages ago
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-06-28 22:47:48 +10:00
Beckowl
7fdded5a8e
Add smlua_text_utils_dialog_get_text and some other dialog functions (#860)
* Add new dialog functions

* Add missing symbols to charmap

* Fix the crashing

* Add braces to if statement

* Implement Isaac's suggestion

* Add override return type to autogen

* Update comment

* Add text field to `DialogEntry`

* wtf??

* Peachy requests
2025-06-28 14:28:28 +02:00
PeachyPeach
075e76b71a
fix custom course and act names (#869)
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-06-27 19:00:58 +02:00
mingokrb
2ae95808ee
Update Portuguese.ini (#871)
* Update Portuguese.ini

* oops forgot some

there goes another commit
2025-06-27 19:00:41 +02:00
Isaac0-dev
3af22e641f fix mod file loading order for mod dev mode
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
2025-06-25 15:03:59 +10:00
Rory Coughlan
61d0435311 Fix dpad logic in menus (#825)
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
* Patches work when using git submodules (where .git is a file instead of a folder)

* Patches: Use git's build in error throwing to detect if the git repository is valid

* Fix dpad cursor logic in menus

Without this change, there is no way to get the cursor onto the ">" button in the public lobbies pagination without using a mouse, because the dpad/arrowkey logic skips over it strangely. Another alternative solution could be that the rules button and the back/reset buttons swap places.

* fixed brain fail in the djui cursor code

I forgot how ternaries worked whoops
2025-06-25 09:37:48 +10:00
Sunk
90af8dfb64
Fix interactions (#868)
* Fix interactions again

* Peachy's suggestion
2025-06-24 22:16:35 +02:00
Sunk
9acb632b8e
Fix HOOK_ALLOW_HAZARD_SURFACE and expose SURFACE_IS_* macros (#865)
* Fix HOOK_ALLOW_HAZARD_SURFACE

* Peachy's suggestions

* Exposed `surface_is_*` macros
2025-06-24 22:15:27 +02:00
xLuigiGamerx
1ad874a1c5
Added math.tween along with common easing functions (#833)
* Added `xOffset` and `yOffset` to the `DjuiFont` struct to align the custom hud fonts

* Replaced `VL-Tones and CJes` CS pack with `The Originals` CS pack

* Removed the shading from the emblems and sideburns for `[CS] The Originals`

* Updated Djoslin0 Toad to give him recolorable hair and updated CJes and VL-Tones Luigi hud icons.

* Updated `[CS] The Originals` models to add missing reverts

* Wrong outdated Djoslin Toad model fix

* Added `math.tween` and along with common easing functions

* Fixed wrong implementation of `IN_OUT_ELASTIC`

* Added `OUT_IN` easing variants

* Fixed Incorrect `OUT_IN_SINE` function

* Fixed wrong `OUT_IN_ELASTIC` implementation
2025-06-24 22:09:17 +02:00
djoslin0
06e9c8aa2f
Fix substring bug in require() (#867)
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 substring bug in require()

When require() was searching for a matching module, it would only
consider the end of the filename. So foobar.lua and bar.lua could both
match a require('bar').

This commit fixes that.

* remove debug logs

---------

Co-authored-by: MysterD <myster@d>
2025-06-22 12:48:42 +02:00
djoslin0
c68ee859ea
Add mod development mode (#851)
With mod development mode on you can press the L bind while paused to
reload the active mods. This reload will rescan the directories for
the active modes and thus refresh their file caches.

Mod development mode also enables live lua module reloading. Any time
a lua module is updated, coop will live reload the functions that changed
and do its best to maintain the previous variable states.

---------

Co-authored-by: MysterD <myster@d>
2025-06-22 19:07:15 +10:00
djoslin0
01fd935807
Fix bug in fixCollisionBugsRoundedCorners, add floorNormalMinY, ceilNormalMaxY (#856)
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
There was a bug in resolving wall collisions with fixCollisionBugsRoundedCorners enabled.
Due to the way a check was written, it would often ignore walls when it shouldn't have.

I've also added gLevelValues.floorNormalMinY and gLevelValues.ceilNormalMaxY
These will values will be used to determine which surfaces will become a wall, floor, or ceiling

Co-authored-by: MysterD <myster@d>
2025-06-19 17:15:31 +10:00
Isaac0-dev
6bb8bd95ee fix HOOK_ON_PACKET_RECEIVE 2025-06-19 17:14:15 +10:00
Isaac0-dev
9f5ec527d8 properly check if a model is permanent
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-06-18 17:18:27 +10:00
Isaac0-dev
d4ca501a5c fix graph node reset memory corruption
by only resetting permanent models (which is all that needs to be reset anyway).
2025-06-18 17:10:01 +10:00
Isaac0-dev
b9db3d5416 fix stack checking for coroutines 2025-06-18 15:09:41 +10:00
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
2f573d17f9
Change get_game_tick_counter() to use gGlobalTimer (#853)
The old version was incrementing at the start of the code iteration, but it makes
more sense to increment after the frame is built. That way every event within one
visible game tick will get the same tick identifier

Co-authored-by: MysterD <myster@d>
2025-06-15 20:15:23 +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
djoslin0
24b92ecc2a
Add a safer version of Lua's require() (#847)
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
I didn't add standard Lua require() because I've always been
afraid of it. I'm not sure we can guarantee which files it
will read (or not read).

Instead, here is a custom implementation. It should work more
or less the same and allow for more modular code.

For backwards compatibility reasons, all of the lua files in
the base mod folder will be loaded as in the past. Aka one at
a time and alphabetically.

However, now coop will look for Lua files in subdirectories
and will load them in when another Lua file calls require().

The file search order is more reasonable than normal Lua
require(). It will first look for files relative to the
currently running script. If there is no matching relative
file, it will pick from any Lua file that is in any of the
mod's subdirectories.

---------

Co-authored-by: MysterD <myster@d>
2025-06-14 19:49:07 +10:00
Isaac0-dev
8f1830b079 cleanup old gfx symbol management code 2025-06-14 14:58:55 +10:00
Isaac0-dev
aea1ab9b86 change the djui auto scale math
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
unfortunately the completely dynamic method causes scaling issues with text
2025-06-14 14:35:09 +10:00
Isaac0-dev
c13352d6a2 fixed mario anim part position getters 2025-06-14 10:10:13 +10:00
Isaac0-dev
7b1dabfb43 more copy paste errors
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-06-13 22:18:51 +10:00
King
86d5069a7e
replace "auto" djui scale functionality with 4x native resolution (#846)
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-06-13 11:16:21 +10:00
Isaac0-dev
99548b5b42 found another one 2025-06-13 11:13:56 +10:00
Isaac0-dev
c8902d9c20 fix a copy paste error 2025-06-13 11:06:58 +10:00
Sunk
0ecaaf767a
Add type conversion functions (#839)
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
2025-06-09 18:35:57 +02:00
Isaac0-dev
4d942eadad optimised matrix interpolation 2025-06-09 23:22:10 +10:00
Isaac0-dev
68b700ccfb cleanup perspective parameters 2025-06-09 21:33:09 +10:00
Isaac0-dev
01eb5c34c0 fixed the update false alarm bug with garbage data (linux) 2025-06-09 21:07:09 +10:00
Sunk
235533b1a5
Fix low damage jump kicks (#844)
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-06-09 20:05:16 +10:00
Isaac0-dev
27b7c3d823
mario object get optimizations (#840) 2025-06-09 20:04:24 +10:00
Isaac0-dev
bee2b924bd disable lua vertex colors for G_PACKED_NORMALS_EXT
by maniscat2

Co-Authored-By: ManIsCat2 <137772623+ManIsCat2@users.noreply.github.com>
2025-06-09 19:03:22 +10:00
Isaac0-dev
b7edf71499 replace get_texture_average_color with texture_to_lua_table 2025-06-09 14:39:07 +10:00
PeachyPeach
17c311ae7d
smlua event hooks refactor (#826)
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-06-09 07:40:48 +10:00