mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-01-05 07:01:18 +00:00
Expose Paintings to Lua (#279)
* Expose paintings to Lua * Make some "dangerous" fields immutable I just thought being able to edit paintings IDs from Lua was a little bit too much.
This commit is contained in:
parent
98834d5670
commit
4e293712fd
10 changed files with 274 additions and 0 deletions
|
@ -24,6 +24,7 @@ in_files = [
|
|||
'src/game/hardcoded.h',
|
||||
'src/pc/mods/mod.h',
|
||||
'src/pc/lua/utils/smlua_audio_utils.h',
|
||||
'src/game/paintings.h'
|
||||
]
|
||||
|
||||
out_filename_c = 'src/pc/lua/smlua_cobject_autogen.c'
|
||||
|
@ -89,6 +90,7 @@ override_field_immutable = {
|
|||
"Mod": [ "*" ],
|
||||
"ModFile": [ "*" ],
|
||||
"BassAudio": [ "*" ],
|
||||
"Painting": [ "id", "imageCount", "textureType", "textureWidth", "textureHeight" ]
|
||||
}
|
||||
|
||||
override_allowed_structs = {
|
||||
|
|
|
@ -46,6 +46,9 @@ gPalettePresets = {}
|
|||
--- @type LakituState
|
||||
gLakituState = {}
|
||||
|
||||
--- @type PaintingValues
|
||||
gPaintingValues = {}
|
||||
|
||||
-----------
|
||||
-- hooks --
|
||||
-----------
|
||||
|
|
|
@ -1601,6 +1601,63 @@
|
|||
--- @field public offset integer
|
||||
--- @field public size integer
|
||||
|
||||
--- @class Painting
|
||||
--- @field public alpha integer
|
||||
--- @field public currFloor integer
|
||||
--- @field public currRippleMag number
|
||||
--- @field public currRippleRate number
|
||||
--- @field public dispersionFactor number
|
||||
--- @field public entryDispersionFactor number
|
||||
--- @field public entryRippleDecay number
|
||||
--- @field public entryRippleMag number
|
||||
--- @field public entryRippleRate number
|
||||
--- @field public floorEntered integer
|
||||
--- @field public id integer
|
||||
--- @field public imageCount integer
|
||||
--- @field public lastFloor integer
|
||||
--- @field public marioIsUnder integer
|
||||
--- @field public marioWasUnder integer
|
||||
--- @field public marioWentUnder integer
|
||||
--- @field public passiveDispersionFactor number
|
||||
--- @field public passiveRippleDecay number
|
||||
--- @field public passiveRippleMag number
|
||||
--- @field public passiveRippleRate number
|
||||
--- @field public pitch number
|
||||
--- @field public posX number
|
||||
--- @field public posY number
|
||||
--- @field public posZ number
|
||||
--- @field public rippleDecay number
|
||||
--- @field public rippleTimer number
|
||||
--- @field public rippleTrigger integer
|
||||
--- @field public rippleX number
|
||||
--- @field public rippleY number
|
||||
--- @field public size number
|
||||
--- @field public state integer
|
||||
--- @field public textureHeight integer
|
||||
--- @field public textureType integer
|
||||
--- @field public textureWidth integer
|
||||
--- @field public yaw number
|
||||
|
||||
--- @class PaintingMeshVertex
|
||||
|
||||
--- @class PaintingValues
|
||||
--- @field public bob_painting Painting
|
||||
--- @field public ccm_painting Painting
|
||||
--- @field public cotmc_painting Painting
|
||||
--- @field public ddd_painting Painting
|
||||
--- @field public hmc_painting Painting
|
||||
--- @field public jrb_painting Painting
|
||||
--- @field public lll_painting Painting
|
||||
--- @field public sl_painting Painting
|
||||
--- @field public ssl_painting Painting
|
||||
--- @field public thi_huge_painting Painting
|
||||
--- @field public thi_tiny_painting Painting
|
||||
--- @field public ttc_painting Painting
|
||||
--- @field public ttm_painting Painting
|
||||
--- @field public ttm_slide_painting Painting
|
||||
--- @field public wdw_painting Painting
|
||||
--- @field public wf_painting Painting
|
||||
|
||||
--- @class ParallelTrackingPoint
|
||||
--- @field public distThresh number
|
||||
--- @field public pos Vec3f
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
- [ObjectNode](#ObjectNode)
|
||||
- [ObjectWarpNode](#ObjectWarpNode)
|
||||
- [OffsetSizePair](#OffsetSizePair)
|
||||
- [Painting](#Painting)
|
||||
- [PaintingMeshVertex](#PaintingMeshVertex)
|
||||
- [PaintingValues](#PaintingValues)
|
||||
- [ParallelTrackingPoint](#ParallelTrackingPoint)
|
||||
- [PlayerCameraState](#PlayerCameraState)
|
||||
- [PlayerGeometry](#PlayerGeometry)
|
||||
|
@ -1999,6 +2002,84 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [Painting](#Painting)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| alpha | `integer` | |
|
||||
| currFloor | `integer` | |
|
||||
| currRippleMag | `number` | |
|
||||
| currRippleRate | `number` | |
|
||||
| dispersionFactor | `number` | |
|
||||
| entryDispersionFactor | `number` | |
|
||||
| entryRippleDecay | `number` | |
|
||||
| entryRippleMag | `number` | |
|
||||
| entryRippleRate | `number` | |
|
||||
| floorEntered | `integer` | |
|
||||
| id | `integer` | read-only |
|
||||
| imageCount | `integer` | read-only |
|
||||
| lastFloor | `integer` | |
|
||||
| marioIsUnder | `integer` | |
|
||||
| marioWasUnder | `integer` | |
|
||||
| marioWentUnder | `integer` | |
|
||||
| passiveDispersionFactor | `number` | |
|
||||
| passiveRippleDecay | `number` | |
|
||||
| passiveRippleMag | `number` | |
|
||||
| passiveRippleRate | `number` | |
|
||||
| pitch | `number` | |
|
||||
| posX | `number` | |
|
||||
| posY | `number` | |
|
||||
| posZ | `number` | |
|
||||
| rippleDecay | `number` | |
|
||||
| rippleTimer | `number` | |
|
||||
| rippleTrigger | `integer` | |
|
||||
| rippleX | `number` | |
|
||||
| rippleY | `number` | |
|
||||
| size | `number` | |
|
||||
| state | `integer` | |
|
||||
| textureHeight | `integer` | read-only |
|
||||
| textureType | `integer` | read-only |
|
||||
| textureWidth | `integer` | read-only |
|
||||
| yaw | `number` | |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [PaintingMeshVertex](#PaintingMeshVertex)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [PaintingValues](#PaintingValues)
|
||||
|
||||
| Field | Type | Access |
|
||||
| ----- | ---- | ------ |
|
||||
| bob_painting | [Painting](structs.md#Painting) | |
|
||||
| ccm_painting | [Painting](structs.md#Painting) | |
|
||||
| cotmc_painting | [Painting](structs.md#Painting) | |
|
||||
| ddd_painting | [Painting](structs.md#Painting) | |
|
||||
| hmc_painting | [Painting](structs.md#Painting) | |
|
||||
| jrb_painting | [Painting](structs.md#Painting) | |
|
||||
| lll_painting | [Painting](structs.md#Painting) | |
|
||||
| sl_painting | [Painting](structs.md#Painting) | |
|
||||
| ssl_painting | [Painting](structs.md#Painting) | |
|
||||
| thi_huge_painting | [Painting](structs.md#Painting) | |
|
||||
| thi_tiny_painting | [Painting](structs.md#Painting) | |
|
||||
| ttc_painting | [Painting](structs.md#Painting) | |
|
||||
| ttm_painting | [Painting](structs.md#Painting) | |
|
||||
| ttm_slide_painting | [Painting](structs.md#Painting) | |
|
||||
| wdw_painting | [Painting](structs.md#Painting) | |
|
||||
| wf_painting | [Painting](structs.md#Painting) | |
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [ParallelTrackingPoint](#ParallelTrackingPoint)
|
||||
|
||||
| Field | Type | Access |
|
||||
|
|
|
@ -255,6 +255,29 @@ struct BehaviorValues gDefaultBehaviorValues = {
|
|||
|
||||
struct BehaviorValues gBehaviorValues = { 0 };
|
||||
|
||||
struct PaintingValues gDefaultPaintingValues = {
|
||||
.cotmc_painting = &cotmc_painting,
|
||||
|
||||
.bob_painting = &bob_painting,
|
||||
.ccm_painting = &ccm_painting,
|
||||
.wf_painting = &wf_painting,
|
||||
.jrb_painting = &jrb_painting,
|
||||
.lll_painting = &lll_painting,
|
||||
.ssl_painting = &ssl_painting,
|
||||
.hmc_painting = &hmc_painting,
|
||||
.ddd_painting = &ddd_painting,
|
||||
.wdw_painting = &wdw_painting,
|
||||
.thi_tiny_painting = &thi_tiny_painting,
|
||||
.ttm_painting = &ttm_painting,
|
||||
.ttc_painting = &ttc_painting,
|
||||
.sl_painting = &sl_painting,
|
||||
.thi_huge_painting = &thi_huge_painting,
|
||||
|
||||
.ttm_slide_painting = &ttm_slide_painting,
|
||||
};
|
||||
|
||||
struct PaintingValues gPaintingValues = { 0 };
|
||||
|
||||
///////////////
|
||||
// functions //
|
||||
///////////////
|
||||
|
@ -263,4 +286,5 @@ __attribute__((constructor))
|
|||
void hardcoded_reset_default_values(void) {
|
||||
gLevelValues = gDefaultLevelValues;
|
||||
gBehaviorValues = gDefaultBehaviorValues;
|
||||
gPaintingValues = gDefaultPaintingValues;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "level_table.h"
|
||||
#include "dialog_ids.h"
|
||||
#include "seq_ids.h"
|
||||
#include "paintings.h"
|
||||
|
||||
////////////
|
||||
// Levels //
|
||||
|
@ -234,6 +235,29 @@ struct BehaviorValues {
|
|||
|
||||
extern struct BehaviorValues gBehaviorValues;
|
||||
|
||||
struct PaintingValues {
|
||||
struct Painting* cotmc_painting;
|
||||
|
||||
struct Painting* bob_painting;
|
||||
struct Painting* ccm_painting;
|
||||
struct Painting* wf_painting;
|
||||
struct Painting* jrb_painting;
|
||||
struct Painting* lll_painting;
|
||||
struct Painting* ssl_painting;
|
||||
struct Painting* hmc_painting;
|
||||
struct Painting* ddd_painting;
|
||||
struct Painting* wdw_painting;
|
||||
struct Painting* thi_tiny_painting;
|
||||
struct Painting* ttm_painting;
|
||||
struct Painting* ttc_painting;
|
||||
struct Painting* sl_painting;
|
||||
struct Painting* thi_huge_painting;
|
||||
|
||||
struct Painting* ttm_slide_painting;
|
||||
};
|
||||
|
||||
extern struct PaintingValues gPaintingValues;
|
||||
|
||||
void hardcoded_reset_default_values(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "level_update.h"
|
||||
#include "src/pc/network/network_player.h"
|
||||
#include "print.h"
|
||||
#include "hardcoded.h"
|
||||
|
||||
/**
|
||||
* @file paintings.c
|
||||
|
|
|
@ -633,6 +633,11 @@ void smlua_cobject_init_globals(void) {
|
|||
smlua_push_object(L, LOT_BEHAVIORVALUES, &gBehaviorValues);
|
||||
lua_setglobal(L, "gBehaviorValues");
|
||||
}
|
||||
|
||||
{
|
||||
smlua_push_object(L, LOT_PAINTINGVALUES, &gPaintingValues);
|
||||
lua_setglobal(L, "gPaintingValues");
|
||||
}
|
||||
}
|
||||
|
||||
void smlua_cobject_init_per_file_globals(char* path) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "src/game/hardcoded.h"
|
||||
#include "src/pc/mods/mod.h"
|
||||
#include "src/pc/lua/utils/smlua_audio_utils.h"
|
||||
#include "src/game/paintings.h"
|
||||
|
||||
#include "include/object_fields.h"
|
||||
|
||||
|
@ -1749,6 +1750,76 @@ static struct LuaObjectField sOffsetSizePairFields[LUA_OFFSET_SIZE_PAIR_FIELD_CO
|
|||
{ "size", LVT_U32, offsetof(struct OffsetSizePair, size), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_PAINTING_FIELD_COUNT 35
|
||||
static struct LuaObjectField sPaintingFields[LUA_PAINTING_FIELD_COUNT] = {
|
||||
{ "alpha", LVT_U8, offsetof(struct Painting, alpha), false, LOT_NONE },
|
||||
{ "currFloor", LVT_S8, offsetof(struct Painting, currFloor), false, LOT_NONE },
|
||||
{ "currRippleMag", LVT_F32, offsetof(struct Painting, currRippleMag), false, LOT_NONE },
|
||||
{ "currRippleRate", LVT_F32, offsetof(struct Painting, currRippleRate), false, LOT_NONE },
|
||||
{ "dispersionFactor", LVT_F32, offsetof(struct Painting, dispersionFactor), false, LOT_NONE },
|
||||
{ "entryDispersionFactor", LVT_F32, offsetof(struct Painting, entryDispersionFactor), false, LOT_NONE },
|
||||
{ "entryRippleDecay", LVT_F32, offsetof(struct Painting, entryRippleDecay), false, LOT_NONE },
|
||||
{ "entryRippleMag", LVT_F32, offsetof(struct Painting, entryRippleMag), false, LOT_NONE },
|
||||
{ "entryRippleRate", LVT_F32, offsetof(struct Painting, entryRippleRate), false, LOT_NONE },
|
||||
{ "floorEntered", LVT_S8, offsetof(struct Painting, floorEntered), false, LOT_NONE },
|
||||
{ "id", LVT_S16, offsetof(struct Painting, id), true, LOT_NONE },
|
||||
{ "imageCount", LVT_S8, offsetof(struct Painting, imageCount), true, LOT_NONE },
|
||||
{ "lastFloor", LVT_S8, offsetof(struct Painting, lastFloor), false, LOT_NONE },
|
||||
{ "marioIsUnder", LVT_S8, offsetof(struct Painting, marioIsUnder), false, LOT_NONE },
|
||||
{ "marioWasUnder", LVT_S8, offsetof(struct Painting, marioWasUnder), false, LOT_NONE },
|
||||
{ "marioWentUnder", LVT_S8, offsetof(struct Painting, marioWentUnder), false, LOT_NONE },
|
||||
// { "normalDisplayList", LVT_???, offsetof(struct Painting, normalDisplayList), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "passiveDispersionFactor", LVT_F32, offsetof(struct Painting, passiveDispersionFactor), false, LOT_NONE },
|
||||
{ "passiveRippleDecay", LVT_F32, offsetof(struct Painting, passiveRippleDecay), false, LOT_NONE },
|
||||
{ "passiveRippleMag", LVT_F32, offsetof(struct Painting, passiveRippleMag), false, LOT_NONE },
|
||||
{ "passiveRippleRate", LVT_F32, offsetof(struct Painting, passiveRippleRate), false, LOT_NONE },
|
||||
{ "pitch", LVT_F32, offsetof(struct Painting, pitch), false, LOT_NONE },
|
||||
{ "posX", LVT_F32, offsetof(struct Painting, posX), false, LOT_NONE },
|
||||
{ "posY", LVT_F32, offsetof(struct Painting, posY), false, LOT_NONE },
|
||||
{ "posZ", LVT_F32, offsetof(struct Painting, posZ), false, LOT_NONE },
|
||||
{ "rippleDecay", LVT_F32, offsetof(struct Painting, rippleDecay), false, LOT_NONE },
|
||||
// { "rippleDisplayList", LVT_???, offsetof(struct Painting, rippleDisplayList), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "rippleTimer", LVT_F32, offsetof(struct Painting, rippleTimer), false, LOT_NONE },
|
||||
{ "rippleTrigger", LVT_S8, offsetof(struct Painting, rippleTrigger), false, LOT_NONE },
|
||||
{ "rippleX", LVT_F32, offsetof(struct Painting, rippleX), false, LOT_NONE },
|
||||
{ "rippleY", LVT_F32, offsetof(struct Painting, rippleY), false, LOT_NONE },
|
||||
// { "ripples", LOT_???, offsetof(struct Painting, ripples), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "size", LVT_F32, offsetof(struct Painting, size), false, LOT_NONE },
|
||||
{ "state", LVT_S8, offsetof(struct Painting, state), false, LOT_NONE },
|
||||
// { "textureArray", LVT_???, offsetof(struct Painting, textureArray), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "textureHeight", LVT_S16, offsetof(struct Painting, textureHeight), true, LOT_NONE },
|
||||
// { "textureMaps", LVT_???, offsetof(struct Painting, textureMaps), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||
{ "textureType", LVT_S8, offsetof(struct Painting, textureType), true, LOT_NONE },
|
||||
{ "textureWidth", LVT_S16, offsetof(struct Painting, textureWidth), true, LOT_NONE },
|
||||
{ "yaw", LVT_F32, offsetof(struct Painting, yaw), false, LOT_NONE },
|
||||
};
|
||||
|
||||
#define LUA_PAINTING_MESH_VERTEX_FIELD_COUNT 0
|
||||
static struct LuaObjectField sPaintingMeshVertexFields[LUA_PAINTING_MESH_VERTEX_FIELD_COUNT] = {
|
||||
// { "norm", LOT_???, offsetof(struct PaintingMeshVertex, norm), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
// { "pos", LOT_???, offsetof(struct PaintingMeshVertex, pos), false, LOT_??? }, <--- UNIMPLEMENTED
|
||||
};
|
||||
|
||||
#define LUA_PAINTING_VALUES_FIELD_COUNT 16
|
||||
static struct LuaObjectField sPaintingValuesFields[LUA_PAINTING_VALUES_FIELD_COUNT] = {
|
||||
{ "bob_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, bob_painting), false, LOT_PAINTING },
|
||||
{ "ccm_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ccm_painting), false, LOT_PAINTING },
|
||||
{ "cotmc_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, cotmc_painting), false, LOT_PAINTING },
|
||||
{ "ddd_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ddd_painting), false, LOT_PAINTING },
|
||||
{ "hmc_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, hmc_painting), false, LOT_PAINTING },
|
||||
{ "jrb_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, jrb_painting), false, LOT_PAINTING },
|
||||
{ "lll_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, lll_painting), false, LOT_PAINTING },
|
||||
{ "sl_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, sl_painting), false, LOT_PAINTING },
|
||||
{ "ssl_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ssl_painting), false, LOT_PAINTING },
|
||||
{ "thi_huge_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, thi_huge_painting), false, LOT_PAINTING },
|
||||
{ "thi_tiny_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, thi_tiny_painting), false, LOT_PAINTING },
|
||||
{ "ttc_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ttc_painting), false, LOT_PAINTING },
|
||||
{ "ttm_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ttm_painting), false, LOT_PAINTING },
|
||||
{ "ttm_slide_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, ttm_slide_painting), false, LOT_PAINTING },
|
||||
{ "wdw_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, wdw_painting), false, LOT_PAINTING },
|
||||
{ "wf_painting", LVT_COBJECT_P, offsetof(struct PaintingValues, wf_painting), false, LOT_PAINTING },
|
||||
};
|
||||
|
||||
#define LUA_PARALLEL_TRACKING_POINT_FIELD_COUNT 4
|
||||
static struct LuaObjectField sParallelTrackingPointFields[LUA_PARALLEL_TRACKING_POINT_FIELD_COUNT] = {
|
||||
{ "distThresh", LVT_F32, offsetof(struct ParallelTrackingPoint, distThresh), false, LOT_NONE },
|
||||
|
@ -2051,6 +2122,9 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN]
|
|||
{ LOT_OBJECTNODE, sObjectNodeFields, LUA_OBJECT_NODE_FIELD_COUNT },
|
||||
{ LOT_OBJECTWARPNODE, sObjectWarpNodeFields, LUA_OBJECT_WARP_NODE_FIELD_COUNT },
|
||||
{ LOT_OFFSETSIZEPAIR, sOffsetSizePairFields, LUA_OFFSET_SIZE_PAIR_FIELD_COUNT },
|
||||
{ LOT_PAINTING, sPaintingFields, LUA_PAINTING_FIELD_COUNT },
|
||||
{ LOT_PAINTINGMESHVERTEX, sPaintingMeshVertexFields, LUA_PAINTING_MESH_VERTEX_FIELD_COUNT },
|
||||
{ LOT_PAINTINGVALUES, sPaintingValuesFields, LUA_PAINTING_VALUES_FIELD_COUNT },
|
||||
{ LOT_PARALLELTRACKINGPOINT, sParallelTrackingPointFields, LUA_PARALLEL_TRACKING_POINT_FIELD_COUNT },
|
||||
{ LOT_PLAYERCAMERASTATE, sPlayerCameraStateFields, LUA_PLAYER_CAMERA_STATE_FIELD_COUNT },
|
||||
{ LOT_PLAYERGEOMETRY, sPlayerGeometryFields, LUA_PLAYER_GEOMETRY_FIELD_COUNT },
|
||||
|
|
|
@ -48,6 +48,9 @@ enum LuaObjectAutogenType {
|
|||
LOT_OBJECTNODE,
|
||||
LOT_OBJECTWARPNODE,
|
||||
LOT_OFFSETSIZEPAIR,
|
||||
LOT_PAINTING,
|
||||
LOT_PAINTINGMESHVERTEX,
|
||||
LOT_PAINTINGVALUES,
|
||||
LOT_PARALLELTRACKINGPOINT,
|
||||
LOT_PLAYERCAMERASTATE,
|
||||
LOT_PLAYERGEOMETRY,
|
||||
|
|
Loading…
Reference in a new issue