SealEngine: Implement MagSpeed functions

mag_speed is a per-plugin integer (default 1) set by SetMagSpeed on
all existing plugins. use_mag_speed is a per-instance flag (default
true) set by SetInstanceUseMagSpeed. When use_mag_speed is true,
motion delta_frame is multiplied by mag_speed.
This commit is contained in:
kichikuou
2026-04-26 11:26:20 +09:00
parent 511f6a4bfa
commit bf455de35d
3 changed files with 30 additions and 4 deletions
+4
View File
@@ -149,6 +149,9 @@ struct RE_plugin {
// TapirEngine
bool suspended;
// SealEngine
int mag_speed;
};
struct RE_instance {
@@ -171,6 +174,7 @@ struct RE_instance {
float shadow_volume_bone_radius;
bool draw_bump;
float fps;
bool use_mag_speed;
bool motion_blend;
float motion_blend_rate;
vec3 ambient;
+4
View File
@@ -49,6 +49,7 @@ static struct RE_instance *create_instance(struct RE_plugin *plugin)
instance->shadow_volume_bone_radius = 0.1f;
instance->draw_bump = true;
instance->fps = 30.0f;
instance->use_mag_speed = true;
instance->column_height = 1.0f;
instance->column_radius = 1.0f;
glm_mat4_identity(instance->local_transform);
@@ -240,6 +241,7 @@ struct RE_plugin *RE_plugin_new(enum RE_plugin_version version)
plugin->pae_cache = ht_create(32);
for (int i = 0; i < RE_NR_BACK_CGS; i++)
RE_back_cg_init(&plugin->back_cg[i]);
plugin->mag_speed = 1;
plugin->fog_type = RE_FOG_NONE;
plugin->fog_near = 1.0;
plugin->fog_far = 10.0;
@@ -326,6 +328,8 @@ bool RE_build_model(struct RE_plugin *plugin, int elapsed_ms)
continue;
float delta_frame = inst->fps * elapsed_ms / 1000.0;
if (inst->use_mag_speed)
delta_frame *= plugin->mag_speed;
update_motion(inst->motion, delta_frame);
update_motion(inst->next_motion, delta_frame);
+22 -4
View File
@@ -2334,7 +2334,13 @@ HLL_LIBRARY(ReignEngine, REIGN_EXPORTS,
HLL_LIBRARY(TapirEngine, REIGN_EXPORTS, TAPIR_EXPORTS);
HLL_QUIET_UNIMPLEMENTED(, void, SealEngine, SetMagSpeed, int MagSpeed);
static void SealEngine_SetMagSpeed(int mag_speed)
{
for (int i = 0; i < RE_MAX_PLUGINS; i++) {
if (plugins[i])
plugins[i]->mag_speed = mag_speed;
}
}
//bool SealEngine_SaveInstance(int PluginNumber, int InstanceNumber, struct string *FileName);
static bool SealEngine_IsExistInstanceData(int plugin, int instance, struct string *filename)
@@ -2437,8 +2443,20 @@ HLL_WARN_UNIMPLEMENTED(false, bool, SealEngine, SetInstanceCircleShadowRadius, i
//float SealEngine_GetInstanceCircleShadowRadius(int PluginNumber, int InstanceNumber);
//bool SealEngine_LoadInstanceLightParam(int PluginNumber, int InstanceNumber);
HLL_WARN_UNIMPLEMENTED(false, bool, SealEngine, StoreInstanceLightParam, int PluginNumber, int InstanceNumber);
HLL_WARN_UNIMPLEMENTED(false, bool, SealEngine, SetInstanceUseMagSpeed, int PluginNumber, int InstanceNumber, bool UseMagSpeed);
//bool SealEngine_IsInstanceUseMagSpeed(int PluginNumber, int InstanceNumber);
static bool SealEngine_SetInstanceUseMagSpeed(int plugin, int instance, bool use_mag_speed)
{
struct RE_instance *ri = get_instance(plugin, instance);
if (!ri)
return false;
ri->use_mag_speed = use_mag_speed;
return true;
}
static bool SealEngine_IsInstanceUseMagSpeed(int plugin, int instance)
{
struct RE_instance *ri = get_instance(plugin, instance);
return ri ? ri->use_mag_speed : false;
}
//bool SealEngine_CreateInstanceDebugBoneList(int PluginNumber, int InstanceNumber, int BoneInstanceNumber, int OnCursorIndex, int SelectedIndex);
//bool SealEngine_CreateInstanceDebugBoneCollision(int PluginNumber, int InstanceNumber, int BoneInstanceNumber, int OnCursorIndex, int SelectedIndex);
//bool SealEngine_GetCameraPos(int PluginNumber, float *X, float *Y, float *Z);
@@ -2559,7 +2577,7 @@ HLL_QUIET_UNIMPLEMENTED(false, bool, SealEngine, IsThreadLoadingMode, int Plugin
HLL_TODO_EXPORT(LoadInstanceLightParam, SealEngine_LoadInstanceLightParam), \
HLL_EXPORT(StoreInstanceLightParam, SealEngine_StoreInstanceLightParam), \
HLL_EXPORT(SetInstanceUseMagSpeed, SealEngine_SetInstanceUseMagSpeed), \
HLL_TODO_EXPORT(IsInstanceUseMagSpeed, SealEngine_IsInstanceUseMagSpeed), \
HLL_EXPORT(IsInstanceUseMagSpeed, SealEngine_IsInstanceUseMagSpeed), \
HLL_TODO_EXPORT(CreateInstanceDebugBoneList, SealEngine_CreateInstanceDebugBoneList), \
HLL_TODO_EXPORT(CreateInstanceDebugBoneCollision, SealEngine_CreateInstanceDebugBoneCollision), \
HLL_TODO_EXPORT(GetCameraPos, SealEngine_GetCameraPos), \