Bring back ChainSegment and PlayerPalette

This commit is contained in:
PeachyPeachSM64 2025-11-05 23:12:14 +01:00
parent c2a6110223
commit c15748d995
11 changed files with 1221 additions and 1153 deletions

View file

@ -26,7 +26,6 @@ exclude_structs = [
'CameraFOVStatus',
'CameraStoredInfo',
'CameraTrigger',
'ChainSegment',
'Cutscene',
'CutsceneSplinePoint',
'CutsceneVariable',
@ -42,7 +41,6 @@ exclude_structs = [
'PaintingMeshVertex',
'ParallelTrackingPoint',
'PlayerGeometry',
'PlayerPalette',
'SPTask',
'SoundState',
'TransitionInfo',

View file

@ -89,9 +89,10 @@ override_field_invisible = {
"Mod": [ "files", "showedScriptWarning" ],
"Camera": [ "paletteEditorCapState" ],
"MarioState": [ "visibleToEnemies" ],
"NetworkPlayer": [ "gag", "moderator", "discordId" ],
"NetworkPlayer": [ "gag", "moderator", "discordId", "rxPacketHash", "rxSeqIds" ],
"GraphNode": [ "_guard1", "_guard2", "padding" ],
"GraphNodeRoot": ["unk15", "views"],
"GraphNodeMasterList": [ "listHeads", "listTails" ],
"FnGraphNode": [ "luaTokenIndex" ],
"Object": [ "firstSurface" ],
"Animation": [ "unusedBoneCount" ],
@ -113,7 +114,7 @@ override_field_immutable = {
"Character": [ "*" ],
"NetworkPlayer": [ "*" ],
"TextureInfo": [ "*" ],
"Object": ["oSyncID", "coopFlags", "oChainChompSegments", "oWigglerSegments", "oHauntedChairUnk100", "oTTCTreadmillBigSurface", "oTTCTreadmillSmallSurface", "bhvStackIndex", "respawnInfoType", "numSurfaces" ],
"Object": ["oSyncID", "coopFlags", "oChainChompSegments", "oWigglerSegments", "oHauntedChairUnk100", "oTTCTreadmillBigSurface", "oTTCTreadmillSmallSurface", "bhvStackIndex", "respawnInfoType", "numSurfaces", "bhvStack" ],
"GlobalObjectAnimations": [ "*"],
"SpawnParticlesInfo": [ "model" ],
"WaterDropletParams": [ "model" ],
@ -506,6 +507,8 @@ def get_struct_field_info(struct, field):
size = int(array_size)
elif array_size.startswith("0x") and all(c in "0123456789abcdef" for c in array_size[2:]):
size = int(array_size, 16)
elif array_size != "":
size = array_size
else:
lvt, lot = 'LVT_???', "LOT_???" # array size not provided, so not supported
@ -698,6 +701,8 @@ def doc_struct_index(structs):
s = '# Supported Structs\n'
for struct in structs:
sid = struct['identifier']
if sid in exclude_structs:
continue
s += '- [%s](#%s)\n' % (sid, sid)
global total_structs
total_structs += 1

View file

@ -9426,6 +9426,11 @@ function cur_obj_follow_path(unusedArg)
-- ...
end
--- @param segment ChainSegment
function chain_segment_init(segment)
-- ...
end
--- @param diameter number
--- @return number
function random_f32_around_zero(diameter)

View file

@ -217,6 +217,14 @@
--- @field public areaCenY number
--- @field public mtx Mat4
--- @class ChainSegment
--- @field public posX number
--- @field public posY number
--- @field public posZ number
--- @field public pitch integer
--- @field public yaw integer
--- @field public roll integer
--- @class Character
--- @field public type CharacterType
--- @field public name string
@ -445,6 +453,7 @@
--- @field public animReturnFromStarDance integer
--- @field public animForwardSpinningFlip integer
--- @field public animTripleJumpFly integer
--- @field public anims integer[]
--- @field public soundFreqScale number
--- @field public soundYahWahHoo integer
--- @field public soundHoohoo integer
@ -490,6 +499,7 @@
--- @field public soundImaTired integer
--- @field public soundLetsAGo integer
--- @field public soundOkeyDokey integer
--- @field public sounds integer[]
--- @class Controller
--- @field public port integer
@ -1074,6 +1084,7 @@
--- @field public headPos Vec3f
--- @field public torsoPos Vec3f
--- @field public heldObjLastPosition Vec3f
--- @field public animPartsPos Vec3f[]
--- @field public currAnimPart integer
--- @field public updateTorsoTime integer
--- @field public updateHeadPosTime integer
@ -1263,6 +1274,7 @@
--- @field public onRxSeqId integer
--- @field public modelIndex integer
--- @field public ping integer
--- @field public palette PlayerPalette
--- @field public name string
--- @field public description string
--- @field public descriptionR integer
@ -1271,6 +1283,7 @@
--- @field public descriptionA integer
--- @field public overrideLocation string
--- @field public overrideModelIndex integer
--- @field public overridePalette PlayerPalette
--- @field public paletteIndex integer
--- @field public overridePaletteIndex integer
--- @field public overridePaletteIndexLp integer
@ -1285,6 +1298,7 @@
--- @field public collisionData Pointer_Collision
--- @field public behavior Pointer_BehaviorScript
--- @field public curBhvCommand Pointer_BehaviorScript
--- @field public bhvStack integer[]
--- @field public bhvStackIndex integer
--- @field public bhvDelayTimer integer
--- @field public activeFlags integer
@ -1525,6 +1539,7 @@
--- @field public oCannonPlayerIndex integer
--- @field public oCapUnkF4 integer
--- @field public oCapUnkF8 integer
--- @field public oChainChompSegments ChainSegment
--- @field public oChainChompMaxDistFromPivotPerChainPart number
--- @field public oChainChompMaxDistBetweenChainParts number
--- @field public oChainChompDistToPivot number
@ -2018,6 +2033,7 @@
--- @field public oStrongWindParticlePenguinObj Object
--- @field public oWhompShakeVal integer
--- @field public oWigglerFallThroughFloorsHeight number
--- @field public oWigglerSegments ChainSegment
--- @field public oWigglerWalkAnimSpeed number
--- @field public oWigglerSquishSpeed number
--- @field public oWigglerTimeUntilRandomTurn integer
@ -2123,6 +2139,9 @@
--- @field public cameraEvent integer
--- @field public usedObj Object
--- @class PlayerPalette
--- @field public parts Color[]
--- @class RayIntersectionInfo
--- @field public surface Surface
--- @field public hitPos Vec3f

View file

@ -3192,6 +3192,26 @@ Transforms the vector at `localTranslateIndex` into the object's local coordinat
<br />
## [chain_segment_init](#chain_segment_init)
### Lua Example
`chain_segment_init(segment)`
### Parameters
| Field | Type |
| ----- | ---- |
| segment | [ChainSegment](structs.md#ChainSegment) |
### Returns
- None
### C Prototype
`void chain_segment_init(struct ChainSegment *segment);`
[:arrow_up_small:](#)
<br />
## [random_f32_around_zero](#random_f32_around_zero)
### Lua Example

View file

@ -1674,6 +1674,7 @@
- [cur_obj_rotate_face_angle_using_vel](functions-6.md#cur_obj_rotate_face_angle_using_vel)
- [cur_obj_set_face_angle_to_move_angle](functions-6.md#cur_obj_set_face_angle_to_move_angle)
- [cur_obj_follow_path](functions-6.md#cur_obj_follow_path)
- [chain_segment_init](functions-6.md#chain_segment_init)
- [random_f32_around_zero](functions-6.md#random_f32_around_zero)
- [obj_scale_random](functions-6.md#obj_scale_random)
- [obj_translate_xyz_random](functions-6.md#obj_translate_xyz_random)

View file

@ -3,24 +3,16 @@
# Supported Structs
- [AnimInfo](#AnimInfo)
- [Animation](#Animation)
- [AnimationTable](#AnimationTable)
- [Area](#Area)
- [BehaviorDialogs](#BehaviorDialogs)
- [BehaviorTrajectories](#BehaviorTrajectories)
- [BehaviorValues](#BehaviorValues)
- [BullyCollisionData](#BullyCollisionData)
- [Camera](#Camera)
- [CameraFOVStatus](#CameraFOVStatus)
- [CameraStoredInfo](#CameraStoredInfo)
- [CameraTrigger](#CameraTrigger)
- [ChainSegment](#ChainSegment)
- [Character](#Character)
- [Color](#Color)
- [Controller](#Controller)
- [CustomLevelInfo](#CustomLevelInfo)
- [Cutscene](#Cutscene)
- [CutsceneSplinePoint](#CutsceneSplinePoint)
- [CutsceneVariable](#CutsceneVariable)
- [DateTime](#DateTime)
- [DialogEntry](#DialogEntry)
- [DisplayListNode](#DisplayListNode)
@ -31,7 +23,6 @@
- [DjuiThreePanelTheme](#DjuiThreePanelTheme)
- [ExclamationBoxContent](#ExclamationBoxContent)
- [FirstPersonCamera](#FirstPersonCamera)
- [FloorGeometry](#FloorGeometry)
- [FnGraphNode](#FnGraphNode)
- [Gfx](#Gfx)
- [GlobalObjectAnimations](#GlobalObjectAnimations)
@ -62,44 +53,31 @@
- [GraphNodeSwitchCase](#GraphNodeSwitchCase)
- [GraphNodeTranslation](#GraphNodeTranslation)
- [GraphNodeTranslationRotation](#GraphNodeTranslationRotation)
- [GraphNode_802A45E4](#GraphNode_802A45E4)
- [HandheldShakePoint](#HandheldShakePoint)
- [HudUtilsRotation](#HudUtilsRotation)
- [InstantWarp](#InstantWarp)
- [LakituState](#LakituState)
- [LevelValues](#LevelValues)
- [LinearTransitionPoint](#LinearTransitionPoint)
- [MarioAnimDmaRelatedThing](#MarioAnimDmaRelatedThing)
- [MarioAnimation](#MarioAnimation)
- [MarioBodyState](#MarioBodyState)
- [MarioState](#MarioState)
- [Mat4](#Mat4)
- [Mod](#Mod)
- [ModAudio](#ModAudio)
- [ModAudioSampleCopies](#ModAudioSampleCopies)
- [ModFile](#ModFile)
- [ModFs](#ModFs)
- [ModFsFile](#ModFsFile)
- [ModeTransitionInfo](#ModeTransitionInfo)
- [NametagsSettings](#NametagsSettings)
- [NetworkPlayer](#NetworkPlayer)
- [Object](#Object)
- [ObjectHitbox](#ObjectHitbox)
- [ObjectNode](#ObjectNode)
- [ObjectWarpNode](#ObjectWarpNode)
- [OffsetSizePair](#OffsetSizePair)
- [Painting](#Painting)
- [PaintingMeshVertex](#PaintingMeshVertex)
- [PaintingValues](#PaintingValues)
- [ParallelTrackingPoint](#ParallelTrackingPoint)
- [PlayerCameraState](#PlayerCameraState)
- [PlayerGeometry](#PlayerGeometry)
- [PlayerPalette](#PlayerPalette)
- [RayIntersectionInfo](#RayIntersectionInfo)
- [RomhackCameraSettings](#RomhackCameraSettings)
- [SPTask](#SPTask)
- [ServerSettings](#ServerSettings)
- [SoundState](#SoundState)
- [SpawnInfo](#SpawnInfo)
- [SpawnParticlesInfo](#SpawnParticlesInfo)
- [StarPositions](#StarPositions)
@ -107,9 +85,6 @@
- [StaticObjectCollision](#StaticObjectCollision)
- [Surface](#Surface)
- [TextureInfo](#TextureInfo)
- [TransitionInfo](#TransitionInfo)
- [UnusedArea28](#UnusedArea28)
- [VblankHandler](#VblankHandler)
- [Vec2f](#Vec2f)
- [Vec2i](#Vec2i)
- [Vec2s](#Vec2s)
@ -120,11 +95,8 @@
- [Vec4i](#Vec4i)
- [Vec4s](#Vec4s)
- [Vtx](#Vtx)
- [Vtx_Interp](#Vtx_Interp)
- [WallCollisionData](#WallCollisionData)
- [WarpNode](#WarpNode)
- [WarpTransition](#WarpTransition)
- [WarpTransitionData](#WarpTransitionData)
- [WaterDropletParams](#WaterDropletParams)
- [Waypoint](#Waypoint)
- [Whirlpool](#Whirlpool)
@ -397,6 +369,21 @@
<br />
## [ChainSegment](#ChainSegment)
| Field | Type | Access |
| ----- | ---- | ------ |
| posX | `number` | |
| posY | `number` | |
| posZ | `number` | |
| pitch | `integer` | |
| yaw | `integer` | |
| roll | `integer` | |
[:arrow_up_small:](#)
<br />
## [Character](#Character)
| Field | Type | Access |
@ -628,6 +615,7 @@
| animReturnFromStarDance | `integer` | read-only |
| animForwardSpinningFlip | `integer` | read-only |
| animTripleJumpFly | `integer` | read-only |
| anims | `Array` <`integer`> | read-only |
| soundFreqScale | `number` | read-only |
| soundYahWahHoo | `integer` | read-only |
| soundHoohoo | `integer` | read-only |
@ -673,6 +661,7 @@
| soundImaTired | `integer` | read-only |
| soundLetsAGo | `integer` | read-only |
| soundOkeyDokey | `integer` | read-only |
| sounds | `Array` <`integer`> | read-only |
[:arrow_up_small:](#)
@ -1605,6 +1594,7 @@
| headPos | [Vec3f](structs.md#Vec3f) | read-only |
| torsoPos | [Vec3f](structs.md#Vec3f) | read-only |
| heldObjLastPosition | [Vec3f](structs.md#Vec3f) | read-only |
| animPartsPos | `Array` <`Vec3f`> | read-only |
| currAnimPart | `integer` | read-only |
| updateTorsoTime | `integer` | read-only |
| updateHeadPosTime | `integer` | read-only |
@ -1878,6 +1868,7 @@
| onRxSeqId | `integer` | read-only |
| modelIndex | `integer` | read-only |
| ping | `integer` | read-only |
| palette | [PlayerPalette](structs.md#PlayerPalette) | read-only |
| name | `string` | read-only |
| description | `string` | read-only |
| descriptionR | `integer` | read-only |
@ -1886,6 +1877,7 @@
| descriptionA | `integer` | read-only |
| overrideLocation | `string` | read-only |
| overrideModelIndex | `integer` | |
| overridePalette | [PlayerPalette](structs.md#PlayerPalette) | |
[:arrow_up_small:](#)
@ -1904,6 +1896,7 @@
| collisionData | `Pointer` <`Collision`> | |
| behavior | `Pointer` <`BehaviorScript`> | read-only |
| curBhvCommand | `Pointer` <`BehaviorScript`> | read-only |
| bhvStack | `Array` <`integer`> | read-only |
| bhvStackIndex | `integer` | read-only |
| bhvDelayTimer | `integer` | |
| activeFlags | `integer` | |
@ -2152,6 +2145,7 @@
| oCannonPlayerIndex | `integer` | |
| oCapUnkF4 | `integer` | |
| oCapUnkF8 | `integer` | |
| oChainChompSegments | [ChainSegment](structs.md#ChainSegment) | read-only |
| oChainChompMaxDistFromPivotPerChainPart | `number` | |
| oChainChompMaxDistBetweenChainParts | `number` | |
| oChainChompDistToPivot | `number` | |
@ -2645,6 +2639,7 @@
| oStrongWindParticlePenguinObj | [Object](structs.md#Object) | |
| oWhompShakeVal | `integer` | |
| oWigglerFallThroughFloorsHeight | `number` | |
| oWigglerSegments | [ChainSegment](structs.md#ChainSegment) | read-only |
| oWigglerWalkAnimSpeed | `number` | |
| oWigglerSquishSpeed | `number` | |
| oWigglerTimeUntilRandomTurn | `integer` | |
@ -2796,6 +2791,16 @@
<br />
## [PlayerPalette](#PlayerPalette)
| Field | Type | Access |
| ----- | ---- | ------ |
| parts | `Array` <`Color`> | read-only |
[:arrow_up_small:](#)
<br />
## [RayIntersectionInfo](#RayIntersectionInfo)
| Field | Type | Access |

View file

@ -13,7 +13,7 @@ enum PlayerPart {
#pragma pack(1)
struct PlayerPalette {
//rgb
u8 parts[PLAYER_PART_MAX][3];
Color parts[PLAYER_PART_MAX];
};
#pragma pack()

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,7 @@ enum LuaObjectAutogenType {
LOT_BEHAVIORTRAJECTORIES,
LOT_BEHAVIORVALUES,
LOT_CAMERA,
LOT_CHAINSEGMENT,
LOT_CHARACTER,
LOT_CONTROLLER,
LOT_CUSTOMLEVELINFO,
@ -93,6 +94,7 @@ enum LuaObjectAutogenType {
LOT_PAINTING,
LOT_PAINTINGVALUES,
LOT_PLAYERCAMERASTATE,
LOT_PLAYERPALETTE,
LOT_RAYINTERSECTIONINFO,
LOT_ROMHACKCAMERASETTINGS,
LOT_SERVERSETTINGS,

View file

@ -28500,7 +28500,6 @@ int smlua_func_cur_obj_follow_path(lua_State* L) {
return 1;
}
/*
int smlua_func_chain_segment_init(lua_State* L) {
if (L == NULL) { return 0; }
@ -28510,7 +28509,7 @@ int smlua_func_chain_segment_init(lua_State* L) {
return 0;
}
// struct ChainSegment* segment = (struct ChainSegment*)smlua_to_cobject(L, 1, LOT_???); <--- UNIMPLEMENTED
struct ChainSegment* segment = (struct ChainSegment*)smlua_to_cobject(L, 1, LOT_CHAINSEGMENT);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "chain_segment_init"); return 0; }
extern void chain_segment_init(struct ChainSegment *segment);
@ -28518,7 +28517,6 @@ int smlua_func_chain_segment_init(lua_State* L) {
return 1;
}
*/
int smlua_func_random_f32_around_zero(lua_State* L) {
if (L == NULL) { return 0; }
@ -38322,7 +38320,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "cur_obj_rotate_face_angle_using_vel", smlua_func_cur_obj_rotate_face_angle_using_vel);
smlua_bind_function(L, "cur_obj_set_face_angle_to_move_angle", smlua_func_cur_obj_set_face_angle_to_move_angle);
smlua_bind_function(L, "cur_obj_follow_path", smlua_func_cur_obj_follow_path);
//smlua_bind_function(L, "chain_segment_init", smlua_func_chain_segment_init); <--- UNIMPLEMENTED
smlua_bind_function(L, "chain_segment_init", smlua_func_chain_segment_init);
smlua_bind_function(L, "random_f32_around_zero", smlua_func_random_f32_around_zero);
smlua_bind_function(L, "obj_scale_random", smlua_func_obj_scale_random);
smlua_bind_function(L, "obj_translate_xyz_random", smlua_func_obj_translate_xyz_random);