mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
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`
This commit is contained in:
parent
f8230fe484
commit
efcfff210d
20 changed files with 4533 additions and 5879 deletions
|
|
@ -305,4 +305,6 @@ def translate_to_def(ptype):
|
|||
return 'nil'
|
||||
if 'Lua Function' in ptype:
|
||||
return 'function'
|
||||
if ptype.startswith('`Array` <'):
|
||||
ptype = ptype.replace('`Array` <', '') + "[]"
|
||||
return ptype.replace('enum ', '').replace('const ', '').replace(' ', '').replace('`', '').replace('<', '_').replace('>', '')
|
||||
|
|
@ -392,13 +392,21 @@ def def_constant(processed_constant):
|
|||
|
||||
is_enum = 'identifier' in processed_constant
|
||||
if is_enum:
|
||||
s += '\n--- @class %s\n' % translate_to_def(processed_constant['identifier'])
|
||||
constants = processed_constant['constants']
|
||||
if len(constants) == 0:
|
||||
return ''
|
||||
id = translate_to_def(processed_constant['identifier'])
|
||||
klen = 0
|
||||
vlen = 0
|
||||
s += '\n'
|
||||
for c in constants:
|
||||
s += '\n--- @type %s\n' % translate_to_def(processed_constant['identifier'])
|
||||
s += '%s = %s\n' % (c[0], c[1])
|
||||
klen = max(klen, len(c[0]))
|
||||
vlen = max(vlen, len(c[1]))
|
||||
for c in constants:
|
||||
s += c[0].ljust(klen) + ' = ' + c[1].rjust(vlen) + ' --- @type %s\n' % id
|
||||
s += '\n--- @alias %s\n' % id
|
||||
for c in constants:
|
||||
s += '--- | `%s`\n' % c[0]
|
||||
return s
|
||||
|
||||
for c in [processed_constant]:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -8897,6 +8897,14 @@ function audio_stream_set_frequency(audio, freq)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param audio ModAudio
|
||||
--- @param loopStart integer
|
||||
--- @param loopEnd integer
|
||||
--- Sets an `audio` stream's loop points (samples)
|
||||
function audio_stream_set_loop_points(audio, loopStart, loopEnd)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param audio ModAudio
|
||||
--- @param looping boolean
|
||||
--- Sets if an `audio` stream is looping or not
|
||||
|
|
@ -9777,6 +9785,18 @@ function djui_set_popup_disabled_override(value)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @return Mod
|
||||
--- Gets the mod currently being processed
|
||||
function get_active_mod()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return integer
|
||||
--- Gets the area update counter incremented when objects are updated
|
||||
function get_area_update_counter()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param localIndex integer
|
||||
--- @return string
|
||||
--- Gets the CoopNet ID of a player with `localIndex` if CoopNet is being used and the player is connected, otherwise "-1" is returned
|
||||
|
|
@ -10162,6 +10182,36 @@ function smlua_model_util_get_id(name)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @return Object
|
||||
--- When used in a geo function, retrieve the current processed object
|
||||
function geo_get_current_object()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return Object
|
||||
--- Gets the object currently being processed
|
||||
function get_current_object()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return Object
|
||||
--- Gets the cutscene focus object
|
||||
function get_cutscene_focus()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return Object
|
||||
--- Gets the NPC object Mario is talking to
|
||||
function get_dialog_object()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return Object
|
||||
--- Gets the secondary camera focus object
|
||||
function get_secondary_camera_focus()
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @return ObjectHitbox
|
||||
--- Returns a temporary object hitbox pointer
|
||||
function get_temp_object_hitbox()
|
||||
|
|
@ -10467,6 +10517,20 @@ function obj_set_vel(o, vx, vy, vz)
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param o Object
|
||||
--- @return void*
|
||||
--- Sets the cutscene focus object
|
||||
function set_cutscene_focus(o)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param o Object
|
||||
--- @return void*
|
||||
--- Sets the secondary camera focus object
|
||||
function set_secondary_camera_focus(o)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param x number
|
||||
--- @param y number
|
||||
--- @param z number
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
--- @class Area
|
||||
--- @field public camera Camera
|
||||
--- @field public dialog Array_integer
|
||||
--- @field public dialog integer[]
|
||||
--- @field public flags integer
|
||||
--- @field public index integer
|
||||
--- @field public instantWarps InstantWarp
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
--- @field public terrainData Pointer_integer
|
||||
--- @field public terrainType integer
|
||||
--- @field public warpNodes ObjectWarpNode
|
||||
--- @field public whirlpools Array_Whirlpool
|
||||
--- @field public whirlpools Whirlpool[]
|
||||
|
||||
--- @class BehaviorDialogs
|
||||
--- @field public BobombBuddyBob1Dialog DialogId
|
||||
|
|
@ -218,8 +218,8 @@
|
|||
--- @field public cutscene integer
|
||||
--- @field public defMode integer
|
||||
--- @field public doorStatus integer
|
||||
--- @field public filler31 Array_integer
|
||||
--- @field public filler3C Array_integer
|
||||
--- @field public filler31 integer[]
|
||||
--- @field public filler3C integer[]
|
||||
--- @field public focus Vec3f
|
||||
--- @field public mode integer
|
||||
--- @field public mtx Mat4
|
||||
|
|
@ -649,7 +649,7 @@
|
|||
--- @field public normalY number
|
||||
--- @field public normalZ number
|
||||
--- @field public originOffset number
|
||||
--- @field public unused Array_number
|
||||
--- @field public unused number[]
|
||||
|
||||
--- @class FnGraphNode
|
||||
--- @field public node GraphNode
|
||||
|
|
@ -878,7 +878,7 @@
|
|||
--- @class GraphNodeCullingRadius
|
||||
--- @field public cullingRadius integer
|
||||
--- @field public node GraphNode
|
||||
--- @field public pad1E Array_integer
|
||||
--- @field public pad1E integer[]
|
||||
|
||||
--- @class GraphNodeDisplayList
|
||||
--- @field public displayList Pointer_Gfx
|
||||
|
|
@ -981,7 +981,7 @@
|
|||
--- @class GraphNodeTranslation
|
||||
--- @field public displayList Pointer_Gfx
|
||||
--- @field public node GraphNode
|
||||
--- @field public pad1E Array_integer
|
||||
--- @field public pad1E integer[]
|
||||
--- @field public translation Vec3s
|
||||
|
||||
--- @class GraphNodeTranslationRotation
|
||||
|
|
@ -1020,9 +1020,9 @@
|
|||
--- @field public curFocus Vec3f
|
||||
--- @field public curPos Vec3f
|
||||
--- @field public defMode integer
|
||||
--- @field public filler30 Array_integer
|
||||
--- @field public filler3E Array_integer
|
||||
--- @field public filler72 Array_integer
|
||||
--- @field public filler30 integer[]
|
||||
--- @field public filler3E integer[]
|
||||
--- @field public filler72 integer[]
|
||||
--- @field public focHSpeed number
|
||||
--- @field public focVSpeed number
|
||||
--- @field public focus Vec3f
|
||||
|
|
@ -1118,7 +1118,7 @@
|
|||
|
||||
--- @class MarioAnimation
|
||||
--- @field public currentAnimAddr Pointer_integer
|
||||
--- @field public padding Array_integer
|
||||
--- @field public padding integer[]
|
||||
--- @field public targetAnim Animation
|
||||
|
||||
--- @class MarioBodyState
|
||||
|
|
@ -1127,7 +1127,7 @@
|
|||
--- @field public capState integer
|
||||
--- @field public eyeState integer
|
||||
--- @field public grabPos integer
|
||||
--- @field public handFootPos Array_Vec3f
|
||||
--- @field public handFootPos Vec3f[]
|
||||
--- @field public handState integer
|
||||
--- @field public headAngle Vec3s
|
||||
--- @field public headPos Vec3f
|
||||
|
|
@ -1263,7 +1263,7 @@
|
|||
|
||||
--- @class ModFile
|
||||
--- @field public cachedPath string
|
||||
--- @field public dataHash Array_integer
|
||||
--- @field public dataHash integer[]
|
||||
--- @field public relativePath string
|
||||
--- @field public wroteBytes integer
|
||||
|
||||
|
|
@ -1323,7 +1323,7 @@
|
|||
--- @field public bhvDelayTimer integer
|
||||
--- @field public bhvStackIndex integer
|
||||
--- @field public collidedObjInteractTypes integer
|
||||
--- @field public collidedObjs Array_Object
|
||||
--- @field public collidedObjs Object[]
|
||||
--- @field public collisionData Pointer_Collision
|
||||
--- @field public coopFlags integer
|
||||
--- @field public ctx integer
|
||||
|
|
@ -2140,8 +2140,8 @@
|
|||
--- @field public yaw number
|
||||
|
||||
--- @class PaintingMeshVertex
|
||||
--- @field public norm Array_integer
|
||||
--- @field public pos Array_integer
|
||||
--- @field public norm integer[]
|
||||
--- @field public pos integer[]
|
||||
|
||||
--- @class PaintingValues
|
||||
--- @field public bob_painting Painting
|
||||
|
|
@ -2331,14 +2331,14 @@
|
|||
--- @field public posYaw integer
|
||||
|
||||
--- @class Vtx
|
||||
--- @field public cn Array_integer
|
||||
--- @field public cn integer[]
|
||||
--- @field public flag integer
|
||||
--- @field public ob Array_number
|
||||
--- @field public tc Array_integer
|
||||
--- @field public ob number[]
|
||||
--- @field public tc integer[]
|
||||
|
||||
--- @class Vtx_Interp
|
||||
--- @field public n string
|
||||
--- @field public ob Array_number
|
||||
--- @field public ob number[]
|
||||
|
||||
--- @class WallCollisionData
|
||||
--- @field public normalAddition Vec3f
|
||||
|
|
@ -2347,7 +2347,7 @@
|
|||
--- @field public offsetY number
|
||||
--- @field public radius number
|
||||
--- @field public unused integer
|
||||
--- @field public walls Array_Surface
|
||||
--- @field public walls Surface[]
|
||||
--- @field public x number
|
||||
--- @field public y number
|
||||
--- @field public z number
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
- [behavior_table.h](#behavior_tableh)
|
||||
- [enum BehaviorId](#enum-BehaviorId)
|
||||
- [camera.h](#camerah)
|
||||
- [enum RomhackCameraEnable](#enum-RomhackCameraEnable)
|
||||
- [enum RomhackCameraOverride](#enum-RomhackCameraOverride)
|
||||
- [characters.h](#charactersh)
|
||||
- [enum CharacterSound](#enum-CharacterSound)
|
||||
|
|
@ -837,6 +838,13 @@
|
|||
- SHAKE_SHOCK
|
||||
- SHAKE_SMALL_DAMAGE
|
||||
|
||||
### [enum RomhackCameraEnable](#RomhackCameraEnable)
|
||||
| Identifier | Value |
|
||||
| :--------- | :---- |
|
||||
| RCE_AUTOMATIC | 0 |
|
||||
| RCE_ON | 1 |
|
||||
| RCE_OFF | 2 |
|
||||
|
||||
### [enum RomhackCameraOverride](#RomhackCameraOverride)
|
||||
| Identifier | Value |
|
||||
| :--------- | :---- |
|
||||
|
|
|
|||
|
|
@ -6650,6 +6650,31 @@ Sets the frequency of an `audio` stream
|
|||
|
||||
<br />
|
||||
|
||||
## [audio_stream_set_loop_points](#audio_stream_set_loop_points)
|
||||
|
||||
### Description
|
||||
Sets an `audio` stream's loop points (samples)
|
||||
|
||||
### Lua Example
|
||||
`audio_stream_set_loop_points(audio, loopStart, loopEnd)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| audio | [ModAudio](structs.md#ModAudio) |
|
||||
| loopStart | `integer` |
|
||||
| loopEnd | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void audio_stream_set_loop_points(struct ModAudio* audio, s64 loopStart, s64 loopEnd);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [audio_stream_set_looping](#audio_stream_set_looping)
|
||||
|
||||
### Description
|
||||
|
|
|
|||
|
|
@ -1393,6 +1393,48 @@ Sets if popups are disabled
|
|||
|
||||
<br />
|
||||
|
||||
## [get_active_mod](#get_active_mod)
|
||||
|
||||
### Description
|
||||
Gets the mod currently being processed
|
||||
|
||||
### Lua Example
|
||||
`local ModValue = get_active_mod()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Mod](structs.md#Mod)
|
||||
|
||||
### C Prototype
|
||||
`struct Mod* get_active_mod(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_area_update_counter](#get_area_update_counter)
|
||||
|
||||
### Description
|
||||
Gets the area update counter incremented when objects are updated
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = get_area_update_counter()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
- `integer`
|
||||
|
||||
### C Prototype
|
||||
`u16 get_area_update_counter(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_coopnet_id](#get_coopnet_id)
|
||||
|
||||
### Description
|
||||
|
|
@ -2727,6 +2769,111 @@ Gets the extended model ID for the `name` of a `GeoLayout`
|
|||
<br />
|
||||
|
||||
|
||||
## [geo_get_current_object](#geo_get_current_object)
|
||||
|
||||
### Description
|
||||
When used in a geo function, retrieve the current processed object
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = geo_get_current_object()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object *geo_get_current_object(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_current_object](#get_current_object)
|
||||
|
||||
### Description
|
||||
Gets the object currently being processed
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = get_current_object()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object *get_current_object(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_cutscene_focus](#get_cutscene_focus)
|
||||
|
||||
### Description
|
||||
Gets the cutscene focus object
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = get_cutscene_focus()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object *get_cutscene_focus(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_dialog_object](#get_dialog_object)
|
||||
|
||||
### Description
|
||||
Gets the NPC object Mario is talking to
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = get_dialog_object()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object *get_dialog_object(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_secondary_camera_focus](#get_secondary_camera_focus)
|
||||
|
||||
### Description
|
||||
Gets the secondary camera focus object
|
||||
|
||||
### Lua Example
|
||||
`local ObjectValue = get_secondary_camera_focus()`
|
||||
|
||||
### Parameters
|
||||
- None
|
||||
|
||||
### Returns
|
||||
[Object](structs.md#Object)
|
||||
|
||||
### C Prototype
|
||||
`struct Object *get_secondary_camera_focus(void);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_temp_object_hitbox](#get_temp_object_hitbox)
|
||||
|
||||
### Description
|
||||
|
|
@ -3662,6 +3809,52 @@ Sets an object's velocity to `vx`, `vy`, and `vz`
|
|||
|
||||
<br />
|
||||
|
||||
## [set_cutscene_focus](#set_cutscene_focus)
|
||||
|
||||
### Description
|
||||
Sets the cutscene focus object
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = set_cutscene_focus(o)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| o | [Object](structs.md#Object) |
|
||||
|
||||
### Returns
|
||||
- `void *`
|
||||
|
||||
### C Prototype
|
||||
`void *set_cutscene_focus(struct Object *o);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_secondary_camera_focus](#set_secondary_camera_focus)
|
||||
|
||||
### Description
|
||||
Sets the secondary camera focus object
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = set_secondary_camera_focus(o)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| o | [Object](structs.md#Object) |
|
||||
|
||||
### Returns
|
||||
- `void *`
|
||||
|
||||
### C Prototype
|
||||
`void *set_secondary_camera_focus(struct Object *o);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [set_whirlpools](#set_whirlpools)
|
||||
|
||||
### Description
|
||||
|
|
|
|||
|
|
@ -1646,6 +1646,7 @@
|
|||
- [audio_stream_pause](functions-5.md#audio_stream_pause)
|
||||
- [audio_stream_play](functions-5.md#audio_stream_play)
|
||||
- [audio_stream_set_frequency](functions-5.md#audio_stream_set_frequency)
|
||||
- [audio_stream_set_loop_points](functions-5.md#audio_stream_set_loop_points)
|
||||
- [audio_stream_set_looping](functions-5.md#audio_stream_set_looping)
|
||||
- [audio_stream_set_position](functions-5.md#audio_stream_set_position)
|
||||
- [audio_stream_set_volume](functions-5.md#audio_stream_set_volume)
|
||||
|
|
@ -1798,6 +1799,8 @@
|
|||
- [djui_popup_create_global](functions-6.md#djui_popup_create_global)
|
||||
- [djui_reset_popup_disabled_override](functions-6.md#djui_reset_popup_disabled_override)
|
||||
- [djui_set_popup_disabled_override](functions-6.md#djui_set_popup_disabled_override)
|
||||
- [get_active_mod](functions-6.md#get_active_mod)
|
||||
- [get_area_update_counter](functions-6.md#get_area_update_counter)
|
||||
- [get_coopnet_id](functions-6.md#get_coopnet_id)
|
||||
- [get_current_save_file_num](functions-6.md#get_current_save_file_num)
|
||||
- [get_date_and_time](functions-6.md#get_date_and_time)
|
||||
|
|
@ -1865,6 +1868,11 @@
|
|||
<br />
|
||||
|
||||
- smlua_obj_utils.h
|
||||
- [geo_get_current_object](functions-6.md#geo_get_current_object)
|
||||
- [get_current_object](functions-6.md#get_current_object)
|
||||
- [get_cutscene_focus](functions-6.md#get_cutscene_focus)
|
||||
- [get_dialog_object](functions-6.md#get_dialog_object)
|
||||
- [get_secondary_camera_focus](functions-6.md#get_secondary_camera_focus)
|
||||
- [get_temp_object_hitbox](functions-6.md#get_temp_object_hitbox)
|
||||
- [get_trajectory](functions-6.md#get_trajectory)
|
||||
- [obj_check_hitbox_overlap](functions-6.md#obj_check_hitbox_overlap)
|
||||
|
|
@ -1904,6 +1912,8 @@
|
|||
- [obj_set_field_u32](functions-6.md#obj_set_field_u32)
|
||||
- [obj_set_model_extended](functions-6.md#obj_set_model_extended)
|
||||
- [obj_set_vel](functions-6.md#obj_set_vel)
|
||||
- [set_cutscene_focus](functions-6.md#set_cutscene_focus)
|
||||
- [set_secondary_camera_focus](functions-6.md#set_secondary_camera_focus)
|
||||
- [set_whirlpools](functions-6.md#set_whirlpools)
|
||||
- [spawn_non_sync_object](functions-6.md#spawn_non_sync_object)
|
||||
- [spawn_sync_object](functions-6.md#spawn_sync_object)
|
||||
|
|
|
|||
|
|
@ -3003,6 +3003,7 @@ const char *sLuaLotNames[] = {
|
|||
[LOT_PLAYERGEOMETRY] = "PlayerGeometry",
|
||||
[LOT_PLAYERPALETTE] = "PlayerPalette",
|
||||
[LOT_RAYINTERSECTIONINFO] = "RayIntersectionInfo",
|
||||
[LOT_ROMHACKCAMERASETTINGS] = "RomhackCameraSettings",
|
||||
[LOT_SERVERSETTINGS] = "ServerSettings",
|
||||
[LOT_SOUNDSTATE] = "SoundState",
|
||||
[LOT_SPAWNINFO] = "SpawnInfo",
|
||||
|
|
|
|||
|
|
@ -840,6 +840,9 @@ char gSmluaConstants[] = ""
|
|||
"RCO_ALL_INCLUDING_VANILLA=3\n"
|
||||
"RCO_ALL_VANILLA_EXCEPT_BOWSER=4\n"
|
||||
"RCO_DISABLE=5\n"
|
||||
"RCE_AUTOMATIC=0\n"
|
||||
"RCE_ON=1\n"
|
||||
"RCE_OFF=2\n"
|
||||
"CAM_MODE_MARIO_ACTIVE=0x01\n"
|
||||
"CAM_MODE_LAKITU_WAS_ZOOMED_OUT=0x02\n"
|
||||
"CAM_MODE_MARIO_SELECTED=0x04\n"
|
||||
|
|
|
|||
|
|
@ -27504,6 +27504,27 @@ int smlua_func_audio_stream_set_frequency(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_audio_stream_set_loop_points(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 3) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "audio_stream_set_loop_points", 3, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ModAudio* audio = (struct ModAudio*)smlua_to_cobject(L, 1, LOT_MODAUDIO);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "audio_stream_set_loop_points"); return 0; }
|
||||
s64 loopStart = smlua_to_integer(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "audio_stream_set_loop_points"); return 0; }
|
||||
s64 loopEnd = smlua_to_integer(L, 3);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "audio_stream_set_loop_points"); return 0; }
|
||||
|
||||
audio_stream_set_loop_points(audio, loopStart, loopEnd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_audio_stream_set_looping(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -29808,6 +29829,36 @@ int smlua_func_djui_set_popup_disabled_override(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_active_mod(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_active_mod", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_MOD, get_active_mod(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_area_update_counter(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_area_update_counter", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
lua_pushinteger(L, get_area_update_counter());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_coopnet_id(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -30813,6 +30864,81 @@ int smlua_func_smlua_model_util_get_id(lua_State* L) {
|
|||
// smlua_obj_utils.h //
|
||||
///////////////////////
|
||||
|
||||
int smlua_func_geo_get_current_object(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "geo_get_current_object", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, geo_get_current_object(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_current_object(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_current_object", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, get_current_object(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_cutscene_focus(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_cutscene_focus", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, get_cutscene_focus(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_dialog_object(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_dialog_object", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, get_dialog_object(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_secondary_camera_focus(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 0) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_secondary_camera_focus", 0, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
smlua_push_object(L, LOT_OBJECT, get_secondary_camera_focus(), NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -31554,6 +31680,40 @@ int smlua_func_obj_set_vel(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_cutscene_focus(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_cutscene_focus", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_cutscene_focus"); return 0; }
|
||||
|
||||
set_cutscene_focus(o);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_secondary_camera_focus(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_secondary_camera_focus", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct Object* o = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_secondary_camera_focus"); return 0; }
|
||||
|
||||
set_secondary_camera_focus(o);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_set_whirlpools(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
|
@ -34219,6 +34379,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "audio_stream_pause", smlua_func_audio_stream_pause);
|
||||
smlua_bind_function(L, "audio_stream_play", smlua_func_audio_stream_play);
|
||||
smlua_bind_function(L, "audio_stream_set_frequency", smlua_func_audio_stream_set_frequency);
|
||||
smlua_bind_function(L, "audio_stream_set_loop_points", smlua_func_audio_stream_set_loop_points);
|
||||
smlua_bind_function(L, "audio_stream_set_looping", smlua_func_audio_stream_set_looping);
|
||||
smlua_bind_function(L, "audio_stream_set_position", smlua_func_audio_stream_set_position);
|
||||
smlua_bind_function(L, "audio_stream_set_volume", smlua_func_audio_stream_set_volume);
|
||||
|
|
@ -34363,6 +34524,8 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "djui_popup_create_global", smlua_func_djui_popup_create_global);
|
||||
smlua_bind_function(L, "djui_reset_popup_disabled_override", smlua_func_djui_reset_popup_disabled_override);
|
||||
smlua_bind_function(L, "djui_set_popup_disabled_override", smlua_func_djui_set_popup_disabled_override);
|
||||
smlua_bind_function(L, "get_active_mod", smlua_func_get_active_mod);
|
||||
smlua_bind_function(L, "get_area_update_counter", smlua_func_get_area_update_counter);
|
||||
smlua_bind_function(L, "get_coopnet_id", smlua_func_get_coopnet_id);
|
||||
smlua_bind_function(L, "get_current_save_file_num", smlua_func_get_current_save_file_num);
|
||||
smlua_bind_function(L, "get_date_and_time", smlua_func_get_date_and_time);
|
||||
|
|
@ -34426,6 +34589,11 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "smlua_model_util_get_id", smlua_func_smlua_model_util_get_id);
|
||||
|
||||
// smlua_obj_utils.h
|
||||
smlua_bind_function(L, "geo_get_current_object", smlua_func_geo_get_current_object);
|
||||
smlua_bind_function(L, "get_current_object", smlua_func_get_current_object);
|
||||
smlua_bind_function(L, "get_cutscene_focus", smlua_func_get_cutscene_focus);
|
||||
smlua_bind_function(L, "get_dialog_object", smlua_func_get_dialog_object);
|
||||
smlua_bind_function(L, "get_secondary_camera_focus", smlua_func_get_secondary_camera_focus);
|
||||
smlua_bind_function(L, "get_temp_object_hitbox", smlua_func_get_temp_object_hitbox);
|
||||
smlua_bind_function(L, "get_trajectory", smlua_func_get_trajectory);
|
||||
smlua_bind_function(L, "obj_check_hitbox_overlap", smlua_func_obj_check_hitbox_overlap);
|
||||
|
|
@ -34465,6 +34633,8 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "obj_set_field_u32", smlua_func_obj_set_field_u32);
|
||||
smlua_bind_function(L, "obj_set_model_extended", smlua_func_obj_set_model_extended);
|
||||
smlua_bind_function(L, "obj_set_vel", smlua_func_obj_set_vel);
|
||||
smlua_bind_function(L, "set_cutscene_focus", smlua_func_set_cutscene_focus);
|
||||
smlua_bind_function(L, "set_secondary_camera_focus", smlua_func_set_secondary_camera_focus);
|
||||
smlua_bind_function(L, "set_whirlpools", smlua_func_set_whirlpools);
|
||||
smlua_bind_function(L, "spawn_non_sync_object", smlua_func_spawn_non_sync_object);
|
||||
smlua_bind_function(L, "spawn_sync_object", smlua_func_spawn_sync_object);
|
||||
|
|
|
|||
|
|
@ -748,7 +748,7 @@ void smlua_logline(void) {
|
|||
int slashCount = 0;
|
||||
const char* folderStart = NULL;
|
||||
for (const char* p = src + strlen(src); p > src; --p) {
|
||||
if (*p == '/') {
|
||||
if (*p == '/' || *p == '\\') {
|
||||
if (++slashCount == 2) {
|
||||
folderStart = p + 1;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ struct ModAudio* audio_load_internal(const char* filename, bool isStream) {
|
|||
bool foundModFile = false;
|
||||
struct ModFile* modFile = NULL;
|
||||
u16 fileCount = gLuaActiveMod->fileCount;
|
||||
for(u16 i = 0; i < fileCount; i++) {
|
||||
for (u16 i = 0; i < fileCount; i++) {
|
||||
struct ModFile* file = &gLuaActiveMod->files[i];
|
||||
if(str_ends_with(file->relativePath, (char*)filename)) {
|
||||
foundModFile = true;
|
||||
|
|
@ -233,7 +233,7 @@ struct ModAudio* audio_load_internal(const char* filename, bool isStream) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(!foundModFile) {
|
||||
if (!foundModFile) {
|
||||
LOG_LUA_LINE("Could not find audio file: '%s'", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -324,18 +324,15 @@ struct ModAudio* audio_stream_load(const char* filename) {
|
|||
}
|
||||
|
||||
void audio_stream_destroy(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "destroy stream")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "destroy")) { return; }
|
||||
|
||||
ma_sound_uninit(&audio->sound);
|
||||
audio->loaded = false;
|
||||
}
|
||||
|
||||
void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume) {
|
||||
if (!audio_sanity_check(audio, true, "play stream")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "play")) { return; }
|
||||
|
||||
if (configMuteFocusLoss && !WAPI.has_focus()) {
|
||||
ma_sound_set_volume(&audio->sound, 0);
|
||||
} else {
|
||||
|
|
@ -349,88 +346,87 @@ void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume) {
|
|||
}
|
||||
|
||||
void audio_stream_pause(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "pause stream")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "pause")) { return; }
|
||||
|
||||
ma_sound_stop(&audio->sound);
|
||||
}
|
||||
|
||||
void audio_stream_stop(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "stop stream")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "stop")) { return; }
|
||||
|
||||
ma_sound_stop(&audio->sound);
|
||||
ma_sound_seek_to_pcm_frame(&audio->sound, 0);
|
||||
}
|
||||
|
||||
f32 audio_stream_get_position(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "get stream position")) {
|
||||
return 0;
|
||||
}
|
||||
// ! This gets the time that the audio has been playing for, but is not reset when the stream loops
|
||||
return (f32)ma_sound_get_time_in_milliseconds(&audio->sound) / 1000;
|
||||
if (!audio_sanity_check(audio, true, "get stream position from")) { return 0; }
|
||||
|
||||
u64 cursor; ma_data_source_get_cursor_in_pcm_frames(&audio->decoder, &cursor);
|
||||
return (f32)cursor / ma_engine_get_sample_rate(&sModAudioEngine);
|
||||
}
|
||||
|
||||
void audio_stream_set_position(struct ModAudio* audio, f32 pos) {
|
||||
if (!audio_sanity_check(audio, true, "set stream position")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "set stream position for")) { return; }
|
||||
|
||||
ma_sound_seek_to_pcm_frame(&audio->sound, pos * ma_engine_get_sample_rate(&sModAudioEngine));
|
||||
}
|
||||
|
||||
bool audio_stream_get_looping(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "get stream looping")) {
|
||||
return false;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "get stream looping from")) { return false; }
|
||||
|
||||
return ma_sound_is_looping(&audio->sound);
|
||||
}
|
||||
|
||||
void audio_stream_set_looping(struct ModAudio* audio, bool looping) {
|
||||
if (!audio_sanity_check(audio, true, "set stream looping")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "set stream looping for")) { return; }
|
||||
|
||||
ma_sound_set_looping(&audio->sound, looping);
|
||||
}
|
||||
|
||||
void audio_stream_set_loop_points(struct ModAudio* audio, s64 loopStart, s64 loopEnd) {
|
||||
if (!audio_sanity_check(audio, true, "set stream loop points for")) { return; }
|
||||
|
||||
u64 length; ma_data_source_get_length_in_pcm_frames(&audio->decoder, &length);
|
||||
if (loopStart < 0) loopStart += length;
|
||||
if (loopEnd <= 0) loopEnd += length;
|
||||
|
||||
ma_data_source_set_loop_point_in_pcm_frames(&audio->decoder, loopStart, loopEnd);
|
||||
}
|
||||
|
||||
f32 audio_stream_get_frequency(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "get stream frequency")) {
|
||||
return 0;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "get stream frequency from")) { return 0; }
|
||||
|
||||
return ma_sound_get_pitch(&audio->sound);
|
||||
}
|
||||
|
||||
void audio_stream_set_frequency(struct ModAudio* audio, f32 freq) {
|
||||
if (!audio_sanity_check(audio, true, "set stream frequency")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "set stream frequency for")) { return; }
|
||||
|
||||
ma_sound_set_pitch(&audio->sound, freq);
|
||||
}
|
||||
|
||||
// f32 audio_stream_get_tempo(struct ModAudio* audio) {
|
||||
// if (!audio_sanity_check(audio, true, "get stream tempo")) {
|
||||
// return 0;
|
||||
// }
|
||||
// if (!audio_sanity_check(audio, true, "get stream tempo from")) { return 0; }
|
||||
//
|
||||
// return bassh_get_tempo(audio->handle);
|
||||
// }
|
||||
|
||||
// ? Possibly implement as a tempo node? https://source.chromium.org/chromium/chromium/src/+/main:media/base/audio_shifter.cc
|
||||
// void audio_stream_set_tempo(struct ModAudio* audio, f32 tempo) {
|
||||
// if (!audio_sanity_check(audio, true, "set stream tempo")) {
|
||||
// return;
|
||||
// }
|
||||
// if (!audio_sanity_check(audio, true, "set stream tempo for")) { return; }
|
||||
//
|
||||
// bassh_set_tempo(audio->handle, tempo);
|
||||
// }
|
||||
|
||||
f32 audio_stream_get_volume(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, true, "get stream volume")) {
|
||||
return 0;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "get stream volume from")) { return 0; }
|
||||
|
||||
return audio->baseVolume;
|
||||
}
|
||||
|
||||
void audio_stream_set_volume(struct ModAudio* audio, f32 volume) {
|
||||
if (!audio_sanity_check(audio, true, "set stream volume")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, true, "set stream volume for")) { return; }
|
||||
|
||||
if (configMuteFocusLoss && !WAPI.has_focus()) {
|
||||
ma_sound_set_volume(&audio->sound, 0);
|
||||
} else {
|
||||
|
|
@ -442,9 +438,8 @@ void audio_stream_set_volume(struct ModAudio* audio, f32 volume) {
|
|||
}
|
||||
|
||||
// void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, bool pitch) {
|
||||
// if (!audio_sanity_check(audio, true, "set stream speed")) {
|
||||
// return;
|
||||
// }
|
||||
// if (!audio_sanity_check(audio, true, "set stream speed for")) { return; }
|
||||
//
|
||||
// bassh_set_speed(audio->handle, initial_freq, speed, pitch);
|
||||
// }
|
||||
|
||||
|
|
@ -513,10 +508,8 @@ struct ModAudio* audio_sample_load(const char* filename) {
|
|||
}
|
||||
|
||||
void audio_sample_destroy(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, false, "destroy sample")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!audio_sanity_check(audio, false, "destroy")) { return; }
|
||||
|
||||
if (audio->sampleCopiesTail) {
|
||||
audio_sample_destroy_copies(audio);
|
||||
}
|
||||
|
|
@ -526,9 +519,8 @@ void audio_sample_destroy(struct ModAudio* audio) {
|
|||
}
|
||||
|
||||
void audio_sample_stop(struct ModAudio* audio) {
|
||||
if (!audio_sanity_check(audio, false, "stop sample")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, false, "stop")) { return; }
|
||||
|
||||
if (audio->sampleCopiesTail) {
|
||||
audio_sample_destroy_copies(audio);
|
||||
}
|
||||
|
|
@ -537,9 +529,7 @@ void audio_sample_stop(struct ModAudio* audio) {
|
|||
}
|
||||
|
||||
void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume) {
|
||||
if (!audio_sanity_check(audio, false, "play sample")) {
|
||||
return;
|
||||
}
|
||||
if (!audio_sanity_check(audio, false, "play")) { return; }
|
||||
|
||||
ma_sound *sound = &audio->sound;
|
||||
if (ma_sound_is_playing(sound)) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ void audio_stream_set_position(struct ModAudio* audio, f32 pos);
|
|||
bool audio_stream_get_looping(struct ModAudio* audio);
|
||||
/* |description|Sets if an `audio` stream is looping or not|descriptionEnd| */
|
||||
void audio_stream_set_looping(struct ModAudio* audio, bool looping);
|
||||
/* |description|Sets an `audio` stream's loop points (samples)|descriptionEnd| */
|
||||
void audio_stream_set_loop_points(struct ModAudio* audio, s64 loopStart, s64 loopEnd);
|
||||
/* |description|Gets the frequency of an `audio` stream|descriptionEnd| */
|
||||
f32 audio_stream_get_frequency(struct ModAudio* audio);
|
||||
/* |description|Sets the frequency of an `audio` stream|descriptionEnd| */
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ u32 get_network_area_timer(void) {
|
|||
return gNetworkAreaTimer;
|
||||
}
|
||||
|
||||
u16 get_area_update_counter(void) {
|
||||
return gAreaUpdateCounter;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
void djui_popup_create_global(const char* message, int lines) {
|
||||
|
|
@ -505,6 +509,10 @@ bool mod_file_exists(const char* filename) {
|
|||
return false;
|
||||
}
|
||||
|
||||
struct Mod* get_active_mod(void) {
|
||||
return gLuaActiveMod;
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
void set_window_title(const char* title) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ struct DateTime {
|
|||
|
||||
/* |description|Gets the current area's networked timer|descriptionEnd| */
|
||||
u32 get_network_area_timer(void);
|
||||
/* |description|Gets the area update counter incremented when objects are updated|descriptionEnd| */
|
||||
u16 get_area_update_counter(void);
|
||||
|
||||
/* |description|Creates a DJUI popup that is broadcasted to every client|descriptionEnd| */
|
||||
void djui_popup_create_global(const char* message, int lines);
|
||||
|
|
@ -195,6 +197,8 @@ void set_environment_region(u8 index, s32 value);
|
|||
|
||||
/* |description|Checks if a file exists inside of a mod|descriptionEnd| */
|
||||
bool mod_file_exists(const char* filename);
|
||||
/* |description|Gets the mod currently being processed|descriptionEnd| */
|
||||
struct Mod* get_active_mod(void);
|
||||
|
||||
/* |description|Sets the window title to a custom title|descriptionEnd| */
|
||||
void set_window_title(const char* title);
|
||||
|
|
|
|||
|
|
@ -111,6 +111,19 @@ Trajectory* get_trajectory(const char* name) {
|
|||
return dynos_level_get_trajectory(name);
|
||||
}
|
||||
|
||||
//
|
||||
// Expose various object pointers
|
||||
//
|
||||
|
||||
extern struct GraphNodeObject *gCurGraphNodeObject;
|
||||
struct Object *geo_get_current_object(void) { return (struct Object*) gCurGraphNodeObject; }
|
||||
struct Object *get_current_object(void) { return gCurrentObject; }
|
||||
struct Object *get_dialog_object(void) { return gContinueDialogFunctionObject; }
|
||||
struct Object *get_cutscene_focus(void) { return gCutsceneFocus; }
|
||||
struct Object *get_secondary_camera_focus(void) { return gSecondCameraFocus; }
|
||||
void *set_cutscene_focus(struct Object *o) { gCutsceneFocus = o; }
|
||||
void *set_secondary_camera_focus(struct Object *o) { gSecondCameraFocus = o; }
|
||||
|
||||
//
|
||||
// Helpers to iterate through the object table
|
||||
//
|
||||
|
|
|
|||
|
|
@ -28,6 +28,25 @@ void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);
|
|||
/* |description|Gets a trajectory by `name`|descriptionEnd| */
|
||||
Trajectory* get_trajectory(const char* name);
|
||||
|
||||
//
|
||||
// Expose various object pointers
|
||||
//
|
||||
|
||||
/* |description|When used in a geo function, retrieve the current processed object|descriptionEnd| */
|
||||
struct Object *geo_get_current_object(void);
|
||||
/* |description|Gets the object currently being processed|descriptionEnd| */
|
||||
struct Object *get_current_object(void);
|
||||
/* |description|Gets the NPC object Mario is talking to|descriptionEnd| */
|
||||
struct Object *get_dialog_object(void);
|
||||
/* |description|Gets the cutscene focus object|descriptionEnd| */
|
||||
struct Object *get_cutscene_focus(void);
|
||||
/* |description|Gets the secondary camera focus object|descriptionEnd| */
|
||||
struct Object *get_secondary_camera_focus(void);
|
||||
/* |description|Sets the cutscene focus object|descriptionEnd| */
|
||||
void *set_cutscene_focus(struct Object *o);
|
||||
/* |description|Sets the secondary camera focus object|descriptionEnd| */
|
||||
void *set_secondary_camera_focus(struct Object *o);
|
||||
|
||||
//
|
||||
// Helpers to iterate through the object table
|
||||
//
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ static void strdelete(char* string, const char* substr) {
|
|||
string[i] = '\0';
|
||||
}
|
||||
|
||||
bool char_valid(const char* buffer) {
|
||||
bool char_valid(const char* buffer, bool isKey) {
|
||||
if (buffer[0] == '\0') { return false; }
|
||||
|
||||
while (*buffer != '\0') {
|
||||
if ((*buffer >= 'a' && *buffer <= 'z') || (*buffer >= 'A' && *buffer <= 'Z') || (*buffer >= '0' && *buffer <= '9') || *buffer == '_' || *buffer == '.' || *buffer == '-') {
|
||||
if (*buffer >= ' ' && !(isKey && (*buffer == '[' || *buffer == ']' || *buffer == '='))) {
|
||||
buffer++;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ void mod_storage_get_filename(char* dest) {
|
|||
C_FIELD bool mod_storage_save(const char* key, const char* value) {
|
||||
if (gLuaActiveMod == NULL) { return false; }
|
||||
if (strlen(key) > MAX_KEY_VALUE_LENGTH || strlen(value) > MAX_KEY_VALUE_LENGTH) { return false; }
|
||||
if (!char_valid(key) || !char_valid(value)) { return false; }
|
||||
if (!char_valid(key, true) || !char_valid(value, false)) { return false; }
|
||||
|
||||
char filename[SYS_MAX_PATH] = { 0 };
|
||||
mod_storage_get_filename(filename);
|
||||
|
|
@ -111,7 +111,7 @@ C_FIELD bool mod_storage_save_bool(const char* key, bool value) {
|
|||
C_FIELD const char* mod_storage_load(const char* key) {
|
||||
if (gLuaActiveMod == NULL) { return NULL; }
|
||||
if (strlen(key) > MAX_KEY_VALUE_LENGTH) { return NULL; }
|
||||
if (!char_valid(key)) { return NULL; }
|
||||
if (!char_valid(key, true)) { return NULL; }
|
||||
|
||||
char filename[SYS_MAX_PATH] = { 0 };
|
||||
mod_storage_get_filename(filename);
|
||||
|
|
@ -148,7 +148,7 @@ C_FIELD bool mod_storage_load_bool(const char* key) {
|
|||
C_FIELD bool mod_storage_exists(const char* key) {
|
||||
if (gLuaActiveMod == NULL) { return false; }
|
||||
if (strlen(key) > MAX_KEY_VALUE_LENGTH) { return false; }
|
||||
if (!char_valid((char *)key)) { return false; }
|
||||
if (!char_valid(key, true)) { return false; }
|
||||
|
||||
char filename[SYS_MAX_PATH] = { 0 };
|
||||
mod_storage_get_filename(filename);
|
||||
|
|
@ -164,7 +164,7 @@ C_FIELD bool mod_storage_exists(const char* key) {
|
|||
C_FIELD bool mod_storage_remove(const char* key) {
|
||||
if (gLuaActiveMod == NULL) { return false; }
|
||||
if (strlen(key) > MAX_KEY_VALUE_LENGTH) { return false; }
|
||||
if (!char_valid((char *)key)) { return false; }
|
||||
if (!char_valid(key, true)) { return false; }
|
||||
|
||||
char filename[SYS_MAX_PATH] = { 0 };
|
||||
mod_storage_get_filename(filename);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue