mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Reset Mario animations on server shutdown
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
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
This commit is contained in:
parent
a2b4ac8f08
commit
7405ae7244
10 changed files with 36 additions and 5 deletions
|
|
@ -132,7 +132,7 @@ override_disallowed_functions = {
|
||||||
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture_raw", "djui_hud_render_texture_tile_raw" ],
|
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture_raw", "djui_hud_render_texture_tile_raw" ],
|
||||||
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
||||||
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "get_dialog_text_ascii", "smlua_text_utils_dialog_get_unmodified"],
|
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "get_dialog_text_ascii", "smlua_text_utils_dialog_get_unmodified"],
|
||||||
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_init", "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
||||||
"src/pc/lua/utils/smlua_gfx_utils.h": [ "gfx_allocate_internal", "vtx_allocate_internal", "gfx_get_length_no_sentinel" ],
|
"src/pc/lua/utils/smlua_gfx_utils.h": [ "gfx_allocate_internal", "vtx_allocate_internal", "gfx_get_length_no_sentinel" ],
|
||||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ],
|
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ],
|
||||||
"src/game/first_person_cam.h": [ "first_person_update" ],
|
"src/game/first_person_cam.h": [ "first_person_update" ],
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ override_field_invisible = {
|
||||||
"GraphNodeRoot": ["unk15", "views"],
|
"GraphNodeRoot": ["unk15", "views"],
|
||||||
"FnGraphNode": [ "luaTokenIndex" ],
|
"FnGraphNode": [ "luaTokenIndex" ],
|
||||||
"Object": [ "firstSurface" ],
|
"Object": [ "firstSurface" ],
|
||||||
|
"Animation": [ "unusedBoneCount" ],
|
||||||
"ModAudio": [ "sound", "decoder", "buffer", "bufferSize", "sampleCopiesTail" ],
|
"ModAudio": [ "sound", "decoder", "buffer", "bufferSize", "sampleCopiesTail" ],
|
||||||
"DialogEntry": [ "str" ],
|
"DialogEntry": [ "str" ],
|
||||||
"ModFsFile": [ "data", "capacity" ],
|
"ModFsFile": [ "data", "capacity" ],
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
--- @field public loopEnd integer
|
--- @field public loopEnd integer
|
||||||
--- @field public loopStart integer
|
--- @field public loopStart integer
|
||||||
--- @field public startFrame integer
|
--- @field public startFrame integer
|
||||||
--- @field public unusedBoneCount integer
|
|
||||||
--- @field public values Pointer_integer
|
--- @field public values Pointer_integer
|
||||||
--- @field public valuesLength integer
|
--- @field public valuesLength integer
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,6 @@
|
||||||
| loopEnd | `integer` | |
|
| loopEnd | `integer` | |
|
||||||
| loopStart | `integer` | |
|
| loopStart | `integer` | |
|
||||||
| startFrame | `integer` | |
|
| startFrame | `integer` | |
|
||||||
| unusedBoneCount | `integer` | |
|
|
||||||
| values | `Pointer` <`integer`> | |
|
| values | `Pointer` <`integer`> | |
|
||||||
| valuesLength | `integer` | |
|
| valuesLength | `integer` | |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ extern struct MarioAnimation D_80339D10[MAX_PLAYERS];
|
||||||
extern struct MarioAnimation gDemo;
|
extern struct MarioAnimation gDemo;
|
||||||
|
|
||||||
extern u8 gMarioAnims[];
|
extern u8 gMarioAnims[];
|
||||||
|
extern size_t gMarioAnimsSize;
|
||||||
|
|
||||||
extern u8 gDemoInputs[];
|
extern u8 gDemoInputs[];
|
||||||
|
|
||||||
extern u16 frameBufferIndex;
|
extern u16 frameBufferIndex;
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,7 @@ void smlua_init(void) {
|
||||||
|
|
||||||
smlua_cobject_init_globals();
|
smlua_cobject_init_globals();
|
||||||
smlua_model_util_initialize();
|
smlua_model_util_initialize();
|
||||||
|
smlua_anim_util_init();
|
||||||
|
|
||||||
// load scripts
|
// load scripts
|
||||||
mods_size_enforce(&gActiveMods);
|
mods_size_enforce(&gActiveMods);
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ static struct LuaObjectField sAnimInfoFields[LUA_ANIM_INFO_FIELD_COUNT] = {
|
||||||
{ "prevAnimPtr", LVT_COBJECT_P, offsetof(struct AnimInfo, prevAnimPtr), false, LOT_ANIMATION, 1, sizeof(struct Animation*) },
|
{ "prevAnimPtr", LVT_COBJECT_P, offsetof(struct AnimInfo, prevAnimPtr), false, LOT_ANIMATION, 1, sizeof(struct Animation*) },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LUA_ANIMATION_FIELD_COUNT 11
|
#define LUA_ANIMATION_FIELD_COUNT 10
|
||||||
static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = {
|
static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = {
|
||||||
{ "animYTransDivisor", LVT_S16, offsetof(struct Animation, animYTransDivisor), false, LOT_NONE, 1, sizeof(s16) },
|
{ "animYTransDivisor", LVT_S16, offsetof(struct Animation, animYTransDivisor), false, LOT_NONE, 1, sizeof(s16) },
|
||||||
{ "flags", LVT_S16, offsetof(struct Animation, flags), false, LOT_NONE, 1, sizeof(s16) },
|
{ "flags", LVT_S16, offsetof(struct Animation, flags), false, LOT_NONE, 1, sizeof(s16) },
|
||||||
|
|
@ -188,7 +188,6 @@ static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = {
|
||||||
{ "loopEnd", LVT_S16, offsetof(struct Animation, loopEnd), false, LOT_NONE, 1, sizeof(s16) },
|
{ "loopEnd", LVT_S16, offsetof(struct Animation, loopEnd), false, LOT_NONE, 1, sizeof(s16) },
|
||||||
{ "loopStart", LVT_S16, offsetof(struct Animation, loopStart), false, LOT_NONE, 1, sizeof(s16) },
|
{ "loopStart", LVT_S16, offsetof(struct Animation, loopStart), false, LOT_NONE, 1, sizeof(s16) },
|
||||||
{ "startFrame", LVT_S16, offsetof(struct Animation, startFrame), false, LOT_NONE, 1, sizeof(s16) },
|
{ "startFrame", LVT_S16, offsetof(struct Animation, startFrame), false, LOT_NONE, 1, sizeof(s16) },
|
||||||
{ "unusedBoneCount", LVT_S16, offsetof(struct Animation, unusedBoneCount), false, LOT_NONE, 1, sizeof(s16) },
|
|
||||||
{ "values", LVT_U16_P, offsetof(struct Animation, values), false, LOT_POINTER, 1, sizeof(u16*) },
|
{ "values", LVT_U16_P, offsetof(struct Animation, values), false, LOT_POINTER, 1, sizeof(u16*) },
|
||||||
{ "valuesLength", LVT_U32, offsetof(struct Animation, valuesLength), false, LOT_NONE, 1, sizeof(u32) },
|
{ "valuesLength", LVT_U32, offsetof(struct Animation, valuesLength), false, LOT_NONE, 1, sizeof(u32) },
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,28 @@ struct GlobalObjectAnimations gGlobalObjectAnimations = {
|
||||||
.yoshi_seg5_anims_05024100 = (struct AnimationTable*) &yoshi_seg5_anims_05024100,
|
.yoshi_seg5_anims_05024100 = (struct AnimationTable*) &yoshi_seg5_anims_05024100,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//////////////////////
|
||||||
|
// mario animations //
|
||||||
|
//////////////////////
|
||||||
|
|
||||||
|
static u8 *sMarioAnimsOrig = NULL;
|
||||||
|
|
||||||
|
static void smlua_anim_util_init_mario_animations() {
|
||||||
|
if (!sMarioAnimsOrig) {
|
||||||
|
sMarioAnimsOrig = malloc(gMarioAnimsSize);
|
||||||
|
if (!sMarioAnimsOrig) {
|
||||||
|
sys_fatal("Cannot initialize Mario animations");
|
||||||
|
}
|
||||||
|
memcpy(sMarioAnimsOrig, gMarioAnims, gMarioAnimsSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void smlua_anim_util_reset_mario_animations() {
|
||||||
|
if (sMarioAnimsOrig) {
|
||||||
|
memcpy(gMarioAnims, sMarioAnimsOrig, gMarioAnimsSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct Animation *get_mario_vanilla_animation(u16 index) {
|
struct Animation *get_mario_vanilla_animation(u16 index) {
|
||||||
static struct MarioAnimDmaRelatedThing *marioAnims = (struct MarioAnimDmaRelatedThing *) gMarioAnims;
|
static struct MarioAnimDmaRelatedThing *marioAnims = (struct MarioAnimDmaRelatedThing *) gMarioAnims;
|
||||||
|
|
||||||
|
|
@ -125,7 +147,13 @@ static struct CustomAnimation *get_custom_animation_node(const char *name) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void smlua_anim_util_init(void) {
|
||||||
|
smlua_anim_util_init_mario_animations();
|
||||||
|
}
|
||||||
|
|
||||||
void smlua_anim_util_reset(void) {
|
void smlua_anim_util_reset(void) {
|
||||||
|
smlua_anim_util_reset_mario_animations();
|
||||||
|
|
||||||
for (struct CustomAnimation *node = sCustomAnimationHead; node;) {
|
for (struct CustomAnimation *node = sCustomAnimationHead; node;) {
|
||||||
struct CustomAnimation *next = node->next;
|
struct CustomAnimation *next = node->next;
|
||||||
if (node->name) {
|
if (node->name) {
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ extern struct GlobalObjectAnimations gGlobalObjectAnimations;
|
||||||
/* |description|Gets a vanilla mario Animation with `index`|descriptionEnd| */
|
/* |description|Gets a vanilla mario Animation with `index`|descriptionEnd| */
|
||||||
struct Animation *get_mario_vanilla_animation(u16 index);
|
struct Animation *get_mario_vanilla_animation(u16 index);
|
||||||
|
|
||||||
|
void smlua_anim_util_init();
|
||||||
void smlua_anim_util_reset();
|
void smlua_anim_util_reset();
|
||||||
void smlua_anim_util_register_animation(const char *name, s16 flags, s16 animYTransDivisor, s16 startFrame, s16 loopStart, s16 loopEnd, u16 *values, u32 valuesLength, u16 *index, u32 indexLength);
|
void smlua_anim_util_register_animation(const char *name, s16 flags, s16 animYTransDivisor, s16 startFrame, s16 loopStart, s16 loopEnd, u16 *values, u32 valuesLength, u16 *index, u32 indexLength);
|
||||||
/* |description|Sets the animation of `obj` to the animation `name` corresponds to|descriptionEnd| */
|
/* |description|Sets the animation of `obj` to the animation `name` corresponds to|descriptionEnd| */
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ try:
|
||||||
for s in structobj:
|
for s in structobj:
|
||||||
print(s)
|
print(s)
|
||||||
print("};")
|
print("};")
|
||||||
|
print("size_t gMarioAnimsSize = sizeof(gMarioAnims);")
|
||||||
|
|
||||||
for asset in asset_loads:
|
for asset in asset_loads:
|
||||||
print(asset)
|
print(asset)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue