Replaced some math functions with analogs from AFT

This commit is contained in:
korenkonder
2023-11-29 01:44:18 +03:00
parent c5ac09235d
commit d89b34a0d3
21 changed files with 181 additions and 194 deletions
+2 -2
View File
@@ -210,7 +210,7 @@ namespace Glitter {
count = 1;
for (F2ParticleInst*& i : particles)
i->Emit(GPM_VAL, GLT_VAL, (int32_t)roundf(particles_per_emission), count, emission);
i->Emit(GPM_VAL, GLT_VAL, (int32_t)prj::roundf(particles_per_emission), count, emission);
}
void F2EmitterInst::Free(GPM, GLT, float_t emission, bool free) {
@@ -710,7 +710,7 @@ namespace Glitter {
for (XParticleInst*& i : particles)
if (i)
i->Emit((int32_t)roundf(particles_per_emission), count, emission);
i->Emit((int32_t)prj::roundf(particles_per_emission), count, emission);
}
void XEmitterInst::Free(float_t emission, bool free) {
+8 -8
View File
@@ -905,10 +905,10 @@ namespace Glitter {
if (big_endian) {
store_reverse_endianness_uint64_t((uint64_t*)d, ptcl->data.tex_hash);
*(uint8_t*)(d + 8) = (uint8_t)roundf(clamp_def(ptcl->data.color.x, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 9) = (uint8_t)roundf(clamp_def(ptcl->data.color.y, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 10) = (uint8_t)roundf(clamp_def(ptcl->data.color.z, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 11) = (uint8_t)roundf(clamp_def(ptcl->data.color.w, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 8) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.x, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 9) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.y, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 10) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.z, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 11) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.w, 0.0f, 1.0f) * 255.0f);
store_reverse_endianness_int32_t((int32_t*)(d + 12), ptcl->data.blend_mode);
store_reverse_endianness_int32_t((int32_t*)(d + 16), ptcl->data.unk0);
store_reverse_endianness_int32_t((int32_t*)(d + 20), ptcl->data.split_u);
@@ -921,10 +921,10 @@ namespace Glitter {
}
else {
*(uint64_t*)d = ptcl->data.tex_hash;
*(uint8_t*)(d + 8) = (uint8_t)roundf(clamp_def(ptcl->data.color.x, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 9) = (uint8_t)roundf(clamp_def(ptcl->data.color.y, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 10) = (uint8_t)roundf(clamp_def(ptcl->data.color.z, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 11) = (uint8_t)roundf(clamp_def(ptcl->data.color.w, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 8) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.x, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 9) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.y, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 10) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.z, 0.0f, 1.0f) * 255.0f);
*(uint8_t*)(d + 11) = (uint8_t)prj::roundf(clamp_def(ptcl->data.color.w, 0.0f, 1.0f) * 255.0f);
*(int32_t*)(d + 12) = ptcl->data.blend_mode;
*(int32_t*)(d + 16) = ptcl->data.unk0;
*(int32_t*)(d + 20) = ptcl->data.split_u;
+6 -6
View File
@@ -1142,24 +1142,24 @@ void AetObj::CalcMat(mat4& mat, const aet_layer* layer, float_t frame) {
}
else {
const aet_layer_video* video = layer->video;
pos_x = roundf(video->pos_x.interpolate(frame));
pos_y = roundf(video->pos_y.interpolate(frame));
pos_x = prj::roundf(video->pos_x.interpolate(frame));
pos_y = prj::roundf(video->pos_y.interpolate(frame));
rot_z = video->rot_z.interpolate(frame) * DEG_TO_RAD_FLOAT;
scale_x = video->scale_x.interpolate(frame);
scale_y = video->scale_y.interpolate(frame);
anchor_x = roundf(video->anchor_x.interpolate(frame));
anchor_y = roundf(video->anchor_y.interpolate(frame));
anchor_x = prj::roundf(video->anchor_x.interpolate(frame));
anchor_y = prj::roundf(video->anchor_y.interpolate(frame));
const aet_layer_video_3d* _3d = video->_3d;
if (_3d) {
pos_z = roundf(_3d->pos_z.interpolate(frame));
pos_z = prj::roundf(_3d->pos_z.interpolate(frame));
dir_x = _3d->dir_x.interpolate(frame) * DEG_TO_RAD_FLOAT;
dir_y = _3d->dir_y.interpolate(frame) * DEG_TO_RAD_FLOAT;
dir_z = _3d->dir_z.interpolate(frame) * DEG_TO_RAD_FLOAT;
rot_x = _3d->rot_x.interpolate(frame) * DEG_TO_RAD_FLOAT;
rot_y = _3d->rot_y.interpolate(frame) * DEG_TO_RAD_FLOAT;
scale_z = _3d->scale_z.interpolate(frame);
anchor_z = roundf(_3d->anchor_z.interpolate(frame));
anchor_z = prj::roundf(_3d->anchor_z.interpolate(frame));
}
}
+7 -18
View File
@@ -1317,7 +1317,7 @@ float_t auth_3d_key::interpolate(float_t frame) {
frame = last_frame - fmodf(delta_frame, frame_delta);
break;
case A3DA_EP_CYCLE_OFFSET:
offset = -(float_t)((int32_t)(delta_frame / frame_delta) + 1) * value_delta;
offset = (prj::truncf(delta_frame / frame_delta) + 1.0f) * value_delta;
frame = last_frame - fmodf(delta_frame, frame_delta);
break;
}
@@ -1338,7 +1338,7 @@ float_t auth_3d_key::interpolate(float_t frame) {
frame = first_frame + fmodf(delta_frame, frame_delta);
break;
case A3DA_EP_CYCLE_OFFSET:
offset = (float_t)((int32_t)(delta_frame / frame_delta) + 1) * value_delta;
offset = (prj::truncf(delta_frame / frame_delta) + 1.0f) * value_delta;
frame = first_frame + fmodf(delta_frame, frame_delta);
break;
}
@@ -4146,13 +4146,13 @@ static float_t auth_3d_camera_root_calc_frame(auth_3d_camera_root* cr, float_t f
|| auth_3d_key_detect_fast_change(&cr->interest.translation.x, frame, 0.3f)
|| auth_3d_key_detect_fast_change(&cr->interest.translation.y, frame, 0.3f)
|| auth_3d_key_detect_fast_change(&cr->interest.translation.z, frame, 0.3f)) {
frame = (float_t)(int32_t)frame;
frame = prj::floorf(frame);
rctx->camera->set_fast_change(true);
}
else {
float_t frame_prev = frame - get_delta_frame();
if (frame_prev > 0.0f && (int32_t)frame - (int32_t)frame_prev == 2) {
frame_prev = (float_t)((int32_t)frame_prev + 1);
frame_prev = prj::ceilf(frame_prev);
if (auth_3d_key_detect_fast_change(&cr->view_point.model_transform.translation.x, frame_prev, 0.3f)
|| auth_3d_key_detect_fast_change(&cr->view_point.model_transform.translation.y, frame_prev, 0.3f)
|| auth_3d_key_detect_fast_change(&cr->view_point.model_transform.translation.z, frame_prev, 0.3f)
@@ -6364,14 +6364,8 @@ static void auth_3d_object_disp(auth_3d_object* o, auth_3d* auth, render_context
else if (tex_pat_count >= TEXTURE_PATTERN_COUNT)
break;
float_t pat = i.pattern.value;
if (pat > 0.0f)
pat = (float_t)(int32_t)(pat + 0.5f);
else if (pat < 0.0f)
pat = (float_t)(int32_t)(pat - 0.5f);
sprintf_s(buf, sizeof(buf), "%.*s%03d",
(int32_t)(i.name.size() - 3), i.name.c_str(), (int32_t)pat);
(int32_t)(i.name.size() - 3), i.name.c_str(), (int32_t)prj::roundf(i.pattern.value));
tex_pat[tex_pat_count].src = texture_id(0, i.texture_id);
tex_pat[tex_pat_count].dst = texture_id(0, tex_db->get_texture_id(buf));
@@ -6429,13 +6423,8 @@ static void auth_3d_object_disp(auth_3d_object* o, auth_3d* auth, render_context
}
}
else if (o->pattern.curve) {
float_t pat = o->pattern.value;
if (pat > 0.0f)
pat = (float_t)(int32_t)(pat + 0.5f);
else if (pat < 0.0f)
pat = (float_t)(int32_t)(pat - 0.5f);
sprintf_s(buf, sizeof(buf), "%.*s%03d", uid_name_length - 3, uid_name, (int32_t)pat);
sprintf_s(buf, sizeof(buf), "%.*s%03d",
uid_name_length - 3, uid_name, (int32_t)prj::roundf(o->pattern.value));
object_info obj_info = obj_db->get_object_info(buf);
disp_manager.entry_obj_by_object_info(&mat, obj_info);
}
+13 -17
View File
@@ -926,7 +926,7 @@ void RobCloth::ResetData() {
}
void RobCloth::AddMotionResetData(uint32_t motion_id, float_t frame) {
int32_t frame_int = (int32_t)roundf(frame * 1000.0f);
int32_t frame_int = (int32_t)prj::roundf(frame * 1000.0f);
auto elem = motion_reset_data.find({ motion_id, frame_int });
if (elem != motion_reset_data.end())
@@ -1180,7 +1180,7 @@ void RobCloth::SetForceAirRes(float_t force, float_t force_gain, float_t air_res
void RobCloth::SetMotionResetData(uint32_t motion_id, float_t frame) {
osage_reset = true;
auto elem = motion_reset_data.find({ motion_id, (int32_t)roundf(frame * 1000.0f) });
auto elem = motion_reset_data.find({ motion_id, (int32_t)prj::roundf(frame * 1000.0f) });
if (elem != motion_reset_data.end() && elem->second.size() + root_count == nodes.size()) {
this->reset_data_list = &elem->second;
@@ -1204,16 +1204,14 @@ void RobCloth::SetOsagePlayData(std::vector<opd_blend_data>& opd_blend_data) {
if (frame >= i->frame_count)
frame = 0.0f;
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame_int = (frame < 0.0f ? frame_int - 1 : frame_int);
frame = prj::floorf(frame);
int32_t curr_key = frame_int;
int32_t next_key = frame_int + 1;
int32_t curr_key = (int32_t)(int64_t)frame;
int32_t next_key = curr_key + 1;
if ((float_t)next_key >= i->frame_count)
next_key = 0;
float_t blend = frame - (float_t)frame_int;
float_t blend = frame - (float_t)(int64_t)frame;
float_t inv_blend = 1.0f - blend;
for (size_t j = 0; j < root_count; j++) {
@@ -1608,7 +1606,7 @@ RobOsage::~RobOsage() {
}
void RobOsage::AddMotionResetData(uint32_t motion_id, float_t frame) {
int32_t frame_int = (int32_t)roundf(frame * 1000.0f);
int32_t frame_int = (int32_t)prj::roundf(frame * 1000.0f);
auto elem = motion_reset_data.find({ motion_id, frame_int });
if (elem != motion_reset_data.end())
@@ -1854,7 +1852,7 @@ void RobOsage::SetInitRot(float_t init_rot_y, float_t init_rot_z) {
void RobOsage::SetMotionResetData(uint32_t motion_id, float_t frame) {
osage_reset = true;
auto v6 = motion_reset_data.find({ motion_id, (int32_t)roundf(frame * 1000.0f) });
auto v6 = motion_reset_data.find({ motion_id, (int32_t)prj::roundf(frame * 1000.0f) });
if (v6 != motion_reset_data.end() && v6->second.size() + 1 == nodes.size())
reset_data_list = &v6->second;
}
@@ -1924,16 +1922,14 @@ void RobOsage::SetOsagePlayData(const mat4* root_matrix,
if (frame >= i->frame_count)
frame = 0.0f;
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame_int = (frame < 0.0f ? frame_int - 1 : frame_int);
frame = prj::floorf(frame);
int32_t curr_key = frame_int;
int32_t next_key = frame_int + 1;
int32_t curr_key = (int32_t)(int64_t)frame;
int32_t next_key = curr_key + 1;
if ((float_t)next_key >= i->frame_count)
next_key = 0;
float_t blend = frame - (float_t)frame_int;
float_t blend = frame - (float_t)(int64_t)frame;
float_t inv_blend = 1.0f - blend;
RobOsageNode* j_begin = nodes.data() + 1;
RobOsageNode* j_end = nodes.data() + nodes.size();
@@ -2910,7 +2906,7 @@ static float_t exp_rand_0_1(float_t v1) {
}
static float_t exp_round(float_t v1) {
return roundf(v1);
return prj::roundf(v1);
}
static float_t exp_sin(float_t v1) {
+5 -17
View File
@@ -2922,12 +2922,7 @@ static void sub_140555B00(rob_chara* rob_chr, bool a2) {
float_t v13 = v12 - v9;
if (v3 && v6 && (v13 < v11 || v13 <= v8)) {
float_t v14 = rob_chr->data.field_1588.field_0.frame;
v14 = (v12 - v8) * 0.5f;
int32_t v15 = (int32_t)v14;
if (v14 != -0.0f && (float_t)v15 != v14)
v14 = (float_t)(v14 < 0.0f ? v15 - 1 : v15);
float_t v16 = v14 + v8;
float_t v16 = prj::floorf((v12 - v8) * 0.5f) + v8;
if (v11 > v16) {
float_t v17;
if (v13 < v16) {
@@ -4382,7 +4377,7 @@ void rob_chara::set_motion_reset_data(uint32_t motion_id, float_t frame) {
}
void rob_chara::set_motion_skin_param(uint32_t motion_id, float_t frame) {
item_equip->set_motion_skin_param(chara_id, motion_id, (int32_t)roundf(frame));
item_equip->set_motion_skin_param(chara_id, motion_id, (int32_t)prj::roundf(frame));
}
void rob_chara::set_motion_step(float_t value) {
@@ -5644,11 +5639,8 @@ static void mot_blend_set_frame(mot_blend* a1, float_t frame) {
static void mot_key_frame_interpolate(mot* a1, float_t frame, float_t* value,
mot_key_set* a4, uint32_t key_set_count, struc_369* a6) {
if (a6->field_0 == 4) {
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame = (float_t)(frame < 0.0f ? frame_int - 1 : frame_int);
}
if (a6->field_0 == 4)
frame = prj::floorf(frame);
if (!key_set_count)
return;
@@ -18349,11 +18341,7 @@ void PvOsageManager::sub_1404F83A0(::osage_set_motion* a2) {
sub_14053D360(&v42);
float_t frame_1 = frame;
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame = (float_t)(frame < 0.0f ? frame_int - 1 : frame_int);
frame += 1.0f;
frame = prj::floorf(frame) + 1.0f;
if (iterations <= 1) {
if (frame_1 == i) {
+1 -1
View File
@@ -43,7 +43,7 @@ const mat3 sv_ypbpr_to_rgb = {
};
void sv_anisotropy_set(int32_t value) {
sv_anisotropy = 1 << (int32_t)roundf(log2f((float_t)clamp_def(value, 1, sv_max_texture_max_anisotropy)));
sv_anisotropy = 1 << (int32_t)prj::roundf(log2f((float_t)clamp_def(value, 1, sv_max_texture_max_anisotropy)));
if (sv_anisotropy != sv_old_anisotropy)
sv_anisotropy_changed = true;
sv_old_anisotropy = sv_anisotropy;
+4 -6
View File
@@ -1380,16 +1380,14 @@ void rob_osage_set_osage_play_data(rob_osage* rob_osg, mat4* parent_mat,
if (frame >= i->frame_count)
frame = 0.0f;
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame_int = (frame < 0.0f ? frame_int - 1 : frame_int);
frame = prj::floorf(frame);
int32_t curr_key = frame_int;
int32_t next_key = frame_int + 1;
int32_t curr_key = (int32_t)(int64_t)frame;
int32_t next_key = curr_key + 1;
if ((float_t)next_key >= i->frame_count)
next_key = 0;
float_t blend = frame - (float_t)frame_int;
float_t blend = frame - (float_t)(int64_t)frame;
float_t inv_blend = 1.0f - blend;
for (rob_osage_node* j = rob_osg->nodes.begin + 1; j != rob_osg->nodes.end; j++) {
opd_vec3_data* opd = &j->opd_data.begin[v17];
+2 -2
View File
@@ -2926,7 +2926,7 @@ static void a3dc_write_a3da_key_f16(stream& s, a3da_key& value, a3da_compress_f1
case A3DA_COMPRESS_I16F16F32F32:
for (uint32_t i = 0; i < len; i++) {
kft3* k = &keys[i];
s.write_int16_t((int16_t)roundf(k->frame));
s.write_int16_t((int16_t)prj::roundf(k->frame));
s.write_half_t(float_to_half(k->value));
s.write_float_t(k->tangent1);
s.write_float_t(k->tangent2);
@@ -2935,7 +2935,7 @@ static void a3dc_write_a3da_key_f16(stream& s, a3da_key& value, a3da_compress_f1
case A3DA_COMPRESS_I16F16F16F16:
for (uint32_t i = 0; i < len; i++) {
kft3* k = &keys[i];
s.write_int16_t((int16_t)roundf(k->frame));
s.write_int16_t((int16_t)prj::roundf(k->frame));
s.write_half_t(float_to_half(k->value));
s.write_half_t(float_to_half(k->tangent1));
s.write_half_t(float_to_half(k->tangent2));
+1
View File
@@ -8,6 +8,7 @@
#define NOMINMAX
#define _USE_MATH_DEFINES
#include "types.hpp"
#include "prj/math.hpp"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+7 -7
View File
@@ -7778,16 +7778,16 @@ static void obj_modern_write_vertex(obj_mesh* mesh, stream& s, int64_t* vertex,
s.write_float_t_reverse_endianness(position.z);
vec3 normal = vec3::mult_min_max(vtx[i].normal, -32768.0f, 32767.0f);
s.write_int16_t_reverse_endianness((int16_t)roundf(normal.x));
s.write_int16_t_reverse_endianness((int16_t)roundf(normal.y));
s.write_int16_t_reverse_endianness((int16_t)roundf(normal.z));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(normal.x));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(normal.y));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(normal.z));
s.write(0x02);
vec4 tangent = vec4::mult_min_max(vtx[i].tangent, -32768.0f, 32767.0f);
s.write_int16_t_reverse_endianness((int16_t)roundf(tangent.x));
s.write_int16_t_reverse_endianness((int16_t)roundf(tangent.y));
s.write_int16_t_reverse_endianness((int16_t)roundf(tangent.z));
s.write_int16_t_reverse_endianness((int16_t)roundf(tangent.w));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(tangent.x));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(tangent.y));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(tangent.z));
s.write_int16_t_reverse_endianness((int16_t)prj::roundf(tangent.w));
vec2h texcoord0;
vec2_to_vec2h(vtx[i].texcoord0, texcoord0);
+45
View File
@@ -0,0 +1,45 @@
/*
by korenkonder
GitHub/GitLab: korenkonder
Taken from MSVC's VC/include/memory
*/
#pragma once
#include "../default.hpp"
#include <xmmintrin.h>
namespace prj {
inline int32_t extract_sign(float_t x) {
return _mm_movemask_ps(_mm_set_ss(x)) & 0x01;
}
inline float_t ceilf(float_t x) {
int32_t x_int = (int32_t)x;
if (x_int != 0x80000000 && (float_t)x_int != x)
x = (float_t)(x_int + !extract_sign(x));
return x;
}
inline float_t floorf(float_t x) {
int32_t x_int = (int32_t)x;
if (x_int != 0x80000000 && (float_t)x_int != x)
x = (float_t)(x_int - extract_sign(x));
return x;
}
inline float_t roundf(float_t x) {
if (x >= 0.0f)
return floorf(x + 0.5f);
else
return ceilf(x - 0.5f);
}
inline float_t truncf(float_t x) {
if (x >= 0.0f)
return floorf(x);
else
return ceilf(x);
}
}
+1 -1
View File
@@ -113,7 +113,7 @@ void graphics_post_process_imgui(class_data* data) {
float_t exposure = tone_map->get_exposure();
ImGui::ColumnSliderFloatButton("Exposure", &exposure, 0.02f, 0.0f, 4.0f, 0.1f, "%.2f", 0);
exposure = roundf(exposure / 0.02f) * 0.02f;
exposure = prj::roundf(exposure / 0.02f) * 0.02f;
tone_map->set_exposure(exposure);
bool auto_exposure = tone_map->get_auto_exposure();
+3 -3
View File
@@ -1091,7 +1091,7 @@ bool DtmMot::Ctrl() {
}
for (pv_data_set_motion& i : set_motion)
vec.push_back({ rob_chr, pv->id, i.motion_id, "", (int32_t)roundf(i.frame_stage_index.first) });
vec.push_back({ rob_chr, pv->id, i.motion_id, "", (int32_t)prj::roundf(i.frame_stage_index.first) });
}
skin_param_manager_add_task(chara_id, vec);
@@ -1243,7 +1243,7 @@ bool DtmMot::Ctrl() {
continue;
}
float_t frame = (float_t)(int32_t)roundf(set_motion.data()[set_motion_index].frame_stage_index.first);
float_t frame = (float_t)(int32_t)prj::roundf(set_motion.data()[set_motion_index].frame_stage_index.first);
if (frame > this->frame)
break;
@@ -2360,7 +2360,7 @@ void DataTestMotDw::Draw() {
start_frame_slider_proc.button->SetValue(ab_loop);
char buf[0x20];
sprintf_s(buf, sizeof(buf), " %5d:%5d", (int32_t)roundf(a_frame), (int32_t)roundf(b_frame));
sprintf_s(buf, sizeof(buf), " %5d:%5d", (int32_t)prj::roundf(a_frame), (int32_t)prj::roundf(b_frame));
this->ab_loop->SetText(buf);
dw::Shell::Draw();
+4 -4
View File
@@ -1456,7 +1456,7 @@ namespace dw {
rectangle rect = GetRectangle();
float_t half_glyph_height = (float_t)(int32_t)(font.GetFontGlyphHeight() * 0.5f);
float_t half_glyph_height = prj::floorf(font.GetFontGlyphHeight() * 0.5f);
rect.pos.y += half_glyph_height;
rect.size.y -= half_glyph_height;
@@ -1752,7 +1752,7 @@ namespace dw {
float_t pos_y = 0.0f;
if (v_bar)
pos_y = (float_t)(int32_t)v_bar->value;
pos_y = prj::floorf(v_bar->value);
print->SetFont(&font);
rectangle v21 = GetScrollableRectangle();
@@ -2107,7 +2107,7 @@ namespace dw {
float_t v4 = 0.0f;
if (v_bar)
v4 = (float_t)(int32_t)(v_bar->value / glyph_height);
v4 = prj::floorf(v_bar->value / glyph_height);
int64_t v6 = 0;
if (v4 >= (float_t)INT64_MAX) {
@@ -2529,7 +2529,7 @@ namespace dw {
void ScrollBar::SetValue(float_t value) {
value = clamp_def(value, min, max);
if (round)
this->value = roundf(value / step) * step;
this->value = prj::roundf(value / step) * step;
else
this->value = value;
}
+5 -5
View File
@@ -5989,7 +5989,7 @@ static void glitter_editor_curve_editor_selector(GlitterEditor* glt_edt) {
&zoom_time, 1.0f, 5.0f, 500.0f, 10.0f, "%.1f%%", 0);
crv_edt->zoom_time = zoom_time * 0.01f;
int32_t zoom_value = (int32_t)roundf(crv_edt->zoom_value * 100.0f);
int32_t zoom_value = (int32_t)prj::roundf(crv_edt->zoom_value * 100.0f);
ImGui::ColumnSliderIntButton("Zoom Value", &zoom_value, 10, 1000, "%d%%", 0);
crv_edt->zoom_value = (float_t)zoom_value * 0.01f;
@@ -6734,7 +6734,7 @@ static void glitter_editor_curve_editor_window(GlitterEditor* glt_edt) {
if (i->frame >= start_time && i->frame <= end_time) {
int32_t start = i - i_begin > 0 ? (i - 1)->frame + 1 : start_time;
int32_t end = i_end - i > 1 ? (i + 1)->frame - 1 : end_time;
crv_edt->frame = (int32_t)roundf((io.MousePos.x - canvas_pos.x) / frame_width);
crv_edt->frame = (int32_t)prj::roundf((io.MousePos.x - canvas_pos.x) / frame_width);
crv_edt->frame = clamp_def(crv_edt->frame + start_time, start, end);
if (i->frame != crv_edt->frame) {
i->frame = crv_edt->frame;
@@ -6847,7 +6847,7 @@ static void glitter_editor_curve_editor_window(GlitterEditor* glt_edt) {
}
if (!crv_edt->key_edit && can_drag && ImGui::IsMouseDown(ImGuiMouseButton_Left) && (!holding_tan || dragged)) {
int32_t frame = (int32_t)roundf((io.MousePos.x - canvas_pos.x) / frame_width);
int32_t frame = (int32_t)prj::roundf((io.MousePos.x - canvas_pos.x) / frame_width);
crv_edt->frame = clamp_def(frame + start_time, start_time, end_time);
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) {
crv_edt->key = glitter_editor_curve_editor_get_closest_key(glt_edt, curve);
@@ -7196,7 +7196,7 @@ static void glitter_editor_curve_editor_window_draw(GlitterEditor* glt_edt, cons
const vec3 n_value_vec = { n_value + n_random_range, n_value, n_value - n_random_range };
const vec3 c_tangent2_vec = c_tangent2;
const vec3 n_tangent1_vec = n_tangent1;
const int32_t frame_width_int = (int32_t)roundf(frame_width);
const int32_t frame_width_int = (int32_t)prj::roundf(frame_width);
for (int32_t j = c->frame; j < n->frame; j++) {
if (j < start_time)
continue;
@@ -7392,7 +7392,7 @@ static void glitter_editor_curve_editor_window_draw(GlitterEditor* glt_edt, cons
if (!points.size() || points.back().x < x || points.back().y != y)
points.push_back({ x, y });
const int32_t frame_width_int = (int32_t)roundf(frame_width);
const int32_t frame_width_int = (int32_t)prj::roundf(frame_width);
for (int32_t j = c->frame; j < n->frame; j++) {
if (j < start_time)
continue;
+38 -38
View File
@@ -865,7 +865,7 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / step) * step;
v[0] = prj::roundf(v[0] / step) * step;
v[0] = clamp_def(v[0], min, max);
if (v[0] == *val)
@@ -887,8 +887,8 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / step) * step;
v[1] = roundf(v[1] / step) * step;
v[0] = prj::roundf(v[0] / step) * step;
v[1] = prj::roundf(v[1] / step) * step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -911,9 +911,9 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / step) * step;
v[1] = roundf(v[1] / step) * step;
v[2] = roundf(v[2] / step) * step;
v[0] = prj::roundf(v[0] / step) * step;
v[1] = prj::roundf(v[1] / step) * step;
v[2] = prj::roundf(v[2] / step) * step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -937,10 +937,10 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / step) * step;
v[1] = roundf(v[1] / step) * step;
v[2] = roundf(v[2] / step) * step;
v[3] = roundf(v[3] / step) * step;
v[0] = prj::roundf(v[0] / step) * step;
v[1] = prj::roundf(v[1] / step) * step;
v[2] = prj::roundf(v[2] / step) * step;
v[3] = prj::roundf(v[3] / step) * step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -1051,7 +1051,7 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / button_step) * button_step;
v[0] = prj::roundf(v[0] / button_step) * button_step;
v[0] = clamp_def(v[0], min, max);
if (v[0] == *val)
@@ -1081,8 +1081,8 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / button_step) * button_step;
v[1] = roundf(v[1] / button_step) * button_step;
v[0] = prj::roundf(v[0] / button_step) * button_step;
v[1] = prj::roundf(v[1] / button_step) * button_step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -1116,9 +1116,9 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / button_step) * button_step;
v[1] = roundf(v[1] / button_step) * button_step;
v[2] = roundf(v[2] / button_step) * button_step;
v[0] = prj::roundf(v[0] / button_step) * button_step;
v[1] = prj::roundf(v[1] / button_step) * button_step;
v[2] = prj::roundf(v[2] / button_step) * button_step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -1156,10 +1156,10 @@ namespace ImGui {
if (!res)
return false;
v[0] = roundf(v[0] / button_step) * button_step;
v[1] = roundf(v[1] / button_step) * button_step;
v[2] = roundf(v[2] / button_step) * button_step;
v[3] = roundf(v[3] / button_step) * button_step;
v[0] = prj::roundf(v[0] / button_step) * button_step;
v[1] = prj::roundf(v[1] / button_step) * button_step;
v[2] = prj::roundf(v[2] / button_step) * button_step;
v[3] = prj::roundf(v[3] / button_step) * button_step;
v[0] = clamp_def(v[0], min, max);
v[1] = clamp_def(v[1], min, max);
@@ -1301,14 +1301,14 @@ namespace ImGui {
max = min;
flags |= ImGuiSliderFlags_NoInput;
v[0] = (int32_t)roundf(log2f((float_t)*val));
v[0] = (int32_t)prj::roundf(log2f((float_t)*val));
StartPropertyColumn(label);
bool res = false;
ImGuiStyle& style = GetStyle();
BeginGroup();
PushMultiItemsWidths(1, CalcItemWidth());
min = (int32_t)roundf(log2f((float_t)min));
max = (int32_t)roundf(log2f((float_t)max));
min = (int32_t)prj::roundf(log2f((float_t)min));
max = (int32_t)prj::roundf(log2f((float_t)max));
sprintf_s(buf, sizeof(buf), format, 1 << v[0]);
res |= SliderIntDisable("##X", &v[0], min, max, buf, flags, true);
EndGroup();
@@ -1334,15 +1334,15 @@ namespace ImGui {
max = min;
flags |= ImGuiSliderFlags_NoInput;
v[0] = (int32_t)roundf(log2f((float_t)val->x));
v[1] = (int32_t)roundf(log2f((float_t)val->y));
v[0] = (int32_t)prj::roundf(log2f((float_t)val->x));
v[1] = (int32_t)prj::roundf(log2f((float_t)val->y));
StartPropertyColumn(label);
bool res = false;
ImGuiStyle& style = GetStyle();
BeginGroup();
PushMultiItemsWidths(2, CalcItemWidth());
min = (int32_t)roundf(log2f((float_t)min));
max = (int32_t)roundf(log2f((float_t)max));
min = (int32_t)prj::roundf(log2f((float_t)min));
max = (int32_t)prj::roundf(log2f((float_t)max));
sprintf_s(buf, sizeof(buf), format, 1 << v[0]);
res |= SliderIntDisable("##X", &v[0], min, max, buf, flags, true);
SameLine(0.0f, style.ItemInnerSpacing.x);
@@ -1372,16 +1372,16 @@ namespace ImGui {
max = min;
flags |= ImGuiSliderFlags_NoInput;
v[0] = (int32_t)roundf(log2f((float_t)val->x));
v[1] = (int32_t)roundf(log2f((float_t)val->y));
v[2] = (int32_t)roundf(log2f((float_t)val->z));
v[0] = (int32_t)prj::roundf(log2f((float_t)val->x));
v[1] = (int32_t)prj::roundf(log2f((float_t)val->y));
v[2] = (int32_t)prj::roundf(log2f((float_t)val->z));
StartPropertyColumn(label);
bool res = false;
ImGuiStyle& style = GetStyle();
BeginGroup();
PushMultiItemsWidths(3, CalcItemWidth());
min = (int32_t)roundf(log2f((float_t)min));
max = (int32_t)roundf(log2f((float_t)max));
min = (int32_t)prj::roundf(log2f((float_t)min));
max = (int32_t)prj::roundf(log2f((float_t)max));
sprintf_s(buf, sizeof(buf), format, 1 << v[0]);
res |= SliderIntDisable("##X", &v[0], min, max, buf, flags, true);
SameLine(0.0f, style.ItemInnerSpacing.x);
@@ -1415,17 +1415,17 @@ namespace ImGui {
max = min;
flags |= ImGuiSliderFlags_NoInput;
v[0] = (int32_t)roundf(log2f((float_t)val->x));
v[1] = (int32_t)roundf(log2f((float_t)val->y));
v[2] = (int32_t)roundf(log2f((float_t)val->z));
v[3] = (int32_t)roundf(log2f((float_t)val->w));
v[0] = (int32_t)prj::roundf(log2f((float_t)val->x));
v[1] = (int32_t)prj::roundf(log2f((float_t)val->y));
v[2] = (int32_t)prj::roundf(log2f((float_t)val->z));
v[3] = (int32_t)prj::roundf(log2f((float_t)val->w));
StartPropertyColumn(label);
bool res = false;
ImGuiStyle& style = GetStyle();
BeginGroup();
PushMultiItemsWidths(4, CalcItemWidth());
min = (int32_t)roundf(log2f((float_t)min));
max = (int32_t)roundf(log2f((float_t)max));
min = (int32_t)prj::roundf(log2f((float_t)min));
max = (int32_t)prj::roundf(log2f((float_t)max));
sprintf_s(buf, sizeof(buf), format, 1 << v[0]);
res |= SliderIntDisable("##X", &v[0], min, max, buf, flags, true);
SameLine(0.0f, style.ItemInnerSpacing.x);
+8 -14
View File
@@ -1893,7 +1893,7 @@ float_t pv_game::get_aet_frame_max_frame(int32_t aet_frame, int32_t aet_index, s
int64_t aet_time = get_aet_time(aet_index, aet_name_id);
if (aet_time >= 0) {
frame = dsc_time_to_frame(curr_time - aet_time);
float_t dsc_frame = roundf(dsc_time_to_frame(dsc_time - aet_time));
float_t dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - aet_time));
frame = max_def(frame, dsc_frame);
}
@@ -1945,7 +1945,7 @@ float_t pv_game::get_aet_frame_max_frame_change_field(int32_t aet_index,
? data.pv_data.change_field_branch_fail
: data.pv_data.change_field_branch_success;
if (time == 10000LL * change_field.back().first)
return roundf(dsc_time_to_frame(data.max_time - get_aet_time(aet_index, aet_name_id))) - 1.0f;
return prj::roundf(dsc_time_to_frame(data.max_time - get_aet_time(aet_index, aet_name_id))) - 1.0f;
return -1.0f;
}
@@ -1983,7 +1983,7 @@ float_t pv_game::get_auth_3d_frame_max_frame(int32_t auth_3d_frame, int32_t auth
int64_t auth_3d_time = get_auth_3d_time(auth_3d_uid, type);
if (auth_3d_time >= 0) {
frame = dsc_time_to_frame(curr_time - auth_3d_time);
float_t dsc_frame = roundf(dsc_time_to_frame(dsc_time - auth_3d_time));
float_t dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - auth_3d_time));
frame = max_def(frame, dsc_frame);
}
@@ -2007,7 +2007,7 @@ float_t pv_game::get_auth_3d_frame_max_frame_change_field(uint32_t auth_3d_uid,
? data.pv_data.change_field_branch_fail
: data.pv_data.change_field_branch_success;
if (time == 10000LL * change_field.back().first)
return roundf(dsc_time_to_frame(data.max_time - get_auth_3d_time(auth_3d_uid, type))) - 1.0f;
return prj::roundf(dsc_time_to_frame(data.max_time - get_auth_3d_time(auth_3d_uid, type))) - 1.0f;
return -1.0f;
}
@@ -2179,7 +2179,7 @@ float_t pv_game::get_next_aet_max_time_max_frame_change_field(int32_t aet_index,
if (time > dsc_time && i.second >= 0 && i.second < data.field_data.size()
&& ((get_field_aet_frame_by_name_id(data.field_data[i.second], aet_index, aet_name_id) + 5) & ~5u) == 0) {
*max_time = time;
return roundf(dsc_time_to_frame(time - get_aet_time(aet_index, aet_name_id))) - 1.0f;
return prj::roundf(dsc_time_to_frame(time - get_aet_time(aet_index, aet_name_id))) - 1.0f;
}
}
return -1.0f;
@@ -2223,7 +2223,7 @@ float_t pv_game::get_next_auth_3d_max_time_max_frame_change_field(uint32_t auth_
if (time > dsc_time && i.second >= 0 && i.second < data.field_data.size()
&& ((get_field_auth_3d_frame(data.field_data[i.second], auth_3d_uid, type) + 5) & -6) == 0) {
*max_time = time;
return roundf(dsc_time_to_frame(time - get_auth_3d_time(auth_3d_uid, type))) - 1.0f;
return prj::roundf(dsc_time_to_frame(time - get_auth_3d_time(auth_3d_uid, type))) - 1.0f;
}
}
return -1.0f;
@@ -4319,17 +4319,11 @@ void pv_game::set_osage_init(const pv_game_chara& chr) {
const std::vector<pv_data_set_motion>* set_motion = data.pv_data.get_set_motion(chr.chara_id);
if (set_motion)
for (const pv_data_set_motion& i : *set_motion) {
float_t frame = i.frame_stage_index.first;
if (frame > 0.0f)
frame = (float_t)(int32_t)(frame + 0.5f);
else if (frame < 0.0f)
frame = (float_t)(int32_t)(frame - 0.5f);
osage_init_data osage_init;
osage_init.rob_chr = chr.rob_chr;
osage_init.pv_id = pv->id;
osage_init.motion_id = i.motion_id;
osage_init.frame = (int32_t)frame;
osage_init.frame = (int32_t)prj::roundf(i.frame_stage_index.first);
vec.push_back(osage_init);
}
@@ -5765,7 +5759,7 @@ float_t bar_time_set_to_target_flying_time(int32_t bpm, int32_t time_signature,
}
float_t dsc_time_to_frame(int64_t time) {
return roundf((float_t)time / (float_t)1000000000 * 60.0f);
return prj::roundf((float_t)time / (float_t)1000000000 * 60.0f);
}
bool pv_game_init() {
+10 -24
View File
@@ -573,7 +573,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
if (motion && motion->enable && (!motion->motion_index || motion_index == motion->motion_index)) {
if (dsc_time != motion->time) {
frame = dsc_time_to_frame(curr_time - motion->time);
dsc_frame = roundf(dsc_time_to_frame(dsc_time - motion->time));
dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - motion->time));
if (frame < dsc_frame)
frame = dsc_frame;
blend = curr_time > motion->time;
@@ -691,7 +691,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
curr_time = this->data_camera[0].time;
float_t frame = dsc_time_to_frame(curr_time - data_camera[0].time);
float_t dsc_frame = roundf(dsc_time_to_frame(dsc_time - data_camera[0].time));
float_t dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - data_camera[0].time));
if (frame < dsc_frame)
frame = dsc_frame;
@@ -710,7 +710,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
curr_time = data_camera[1].time;
float_t frame = dsc_time_to_frame(curr_time - data_camera[1].time);
float_t dsc_frame = roundf(dsc_time_to_frame(dsc_time - data_camera[1].time));
float_t dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - data_camera[1].time));
if (frame < dsc_frame)
frame = dsc_frame;
@@ -1254,7 +1254,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
} break;
case DSC_FT_EDIT_MOVE: {
float_t v9 = 1.0f / field_2C54C;
float_t duration = (float_t)(int32_t)(data[0]) * v9;
float_t duration = (float_t)data[0] * v9;
vec3 start_pos;
start_pos.x = (float_t)data[1] * v9;
start_pos.y = 0.0f;
@@ -1279,7 +1279,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
} break;
case DSC_FT_EDIT_MOVE_XYZ: {
float_t v9 = 1.0f / field_2C54C;
float_t duration = (float_t)(int32_t)(data[0]) * v9;
float_t duration = (float_t)data[0] * v9;
vec3 start_pos;
start_pos.x = (float_t)data[1] * v9;
start_pos.y = (float_t)data[2] * v9;
@@ -1638,7 +1638,7 @@ bool pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
int64_t time = pv_game->get_data_itmpv_time(chara_id, index);
if (time >= 0 && time <= dsc_time && time <= curr_time) {
float_t frame = dsc_time_to_frame(curr_time - time);
float_t dsc_frame = roundf(dsc_time_to_frame(dsc_time - time));
float_t dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - time));
if (frame < dsc_frame)
frame = dsc_frame;
pv_game->set_data_itmpv_req_frame(chara_id, index, frame);
@@ -2331,16 +2331,7 @@ void pv_game_pv_data::find_set_motion(const pv_db_pv_difficulty* diff) {
if (time < 0)
time = j.time;
float_t frame = dsc_time_to_frame(((int64_t)j.time - time) * 10000);
if (frame >= 0.0f)
frame += 0.5f;
else
frame -= 0.5f;
int32_t frame_int = (int32_t)frame;
if (frame != -0.0f && (float_t)frame_int != frame)
frame = (float_t)(frame < 0.0f ? frame_int - 1 : frame_int);
float_t frame = prj::roundf(dsc_time_to_frame(((int64_t)j.time - time) * 10000));
uint32_t motion_id = diff->get_motion_or_default(i, j.index).id;
if (pv_game_get() && pv_game_get()->data.pv) {
@@ -2578,12 +2569,7 @@ void pv_game_pv_data::set_camera_max_frame(int64_t time) {
if (10000LL * i <= dsc_time)
continue;
float_t max_frame = dsc_time_to_frame(10000LL * i - time);
if (max_frame > 0.0f)
max_frame = (float_t)(int32_t)(max_frame + 0.5f);
else if (max_frame < 0.0f)
max_frame = (float_t)(int32_t)(max_frame - 0.5f);
float_t max_frame = prj::roundf(dsc_time_to_frame(10000LL * i - time));
if (pv_game->data.camera_auth_3d_uid != -1) {
auth_3d_id id = pv_game->get_auth_3d_id(pv_game->data.camera_auth_3d_uid);
if (id.check_not_empty())
@@ -2599,7 +2585,7 @@ void pv_game_pv_data::set_item_anim_max_frame(int32_t chara_id, int32_t index, i
for (auto& i : playdata[chara_id].motion_data.item_anim)
if (10000LL * i.time > dsc_time && i.index == index && (!branch_mode || branch_mode == i.pv_branch_mode)) {
pv_game->set_data_itmpv_max_frame(chara_id, index, roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
pv_game->set_data_itmpv_max_frame(chara_id, index, prj::roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
break;
}
}
@@ -2615,7 +2601,7 @@ void pv_game_pv_data::set_motion_max_frame(int32_t chara_id, int32_t motion_inde
if (10000LL * i.time > dsc_time && i.index == motion_index
&& (!branch_mode || branch_mode == i.pv_branch_mode)) {
playdata.rob_chr->bone_data->set_motion_max_frame(
roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
prj::roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
break;
}
}
+4 -4
View File
@@ -1418,14 +1418,14 @@ static void render_resize_fb(render_context* rctx, bool change_fb) {
#if BAKE_PNG || BAKE_VIDEO
vec2i internal_res = { (int32_t)res_width * BAKE_RES_SCALE, (int32_t)res_height * BAKE_RES_SCALE };
internal_2d_res = vec2i::clamp(internal_res, 1, sv_max_texture_size);
internal_3d_res.x = (int32_t)roundf((float_t)internal_res.x);
internal_3d_res.y = (int32_t)roundf((float_t)internal_res.y);
internal_3d_res.x = (int32_t)prj::roundf((float_t)internal_res.x);
internal_3d_res.y = (int32_t)prj::roundf((float_t)internal_res.y);
internal_3d_res = vec2i::clamp(internal_3d_res, 1, sv_max_texture_size);
#else
vec2i internal_res = { (int32_t)res_width, (int32_t)res_height };
internal_2d_res = vec2i::clamp(internal_res, 1, sv_max_texture_size);
internal_3d_res.x = (int32_t)roundf((float_t)(internal_res.x * render_scale_table[scale_index]));
internal_3d_res.y = (int32_t)roundf((float_t)(internal_res.y * render_scale_table[scale_index]));
internal_3d_res.x = (int32_t)prj::roundf((float_t)(internal_res.x * render_scale_table[scale_index]));
internal_3d_res.y = (int32_t)prj::roundf((float_t)(internal_res.y * render_scale_table[scale_index]));
internal_3d_res = vec2i::clamp(internal_3d_res, 1, sv_max_texture_size);
#endif
+7 -17
View File
@@ -2240,7 +2240,7 @@ bool x_pv_game_pv_data::dsc_ctrl(float_t delta_time, int64_t curr_time,
if (motion && motion->enable && (motion_index == motion->motion_index || !motion->motion_index)) {
if (dsc_time != motion->time) {
frame = dsc_time_to_frame(curr_time - motion->time);
dsc_frame = roundf(dsc_time_to_frame(dsc_time - motion->time));
dsc_frame = prj::roundf(dsc_time_to_frame(dsc_time - motion->time));
if (frame < dsc_frame)
frame = dsc_frame;
blend = curr_time > motion->time;
@@ -3480,17 +3480,7 @@ void x_pv_game_pv_data::find_set_motion() {
if (time < 0)
time = j.time;
float_t frame = dsc_time_to_frame(((int64_t)j.time - time) * 10000);
float_t v61 = frame;
if (frame >= 0.0f)
v61 = frame + 0.5f;
else
v61 = frame - 0.5f;
int32_t frame_int = (int32_t)v61;
if (v61 != -0.0f && (float_t)frame_int != v61)
v61 = (float_t)(v61 < 0.0f ? frame_int - 1 : frame_int);
float_t frame = prj::roundf(dsc_time_to_frame(((int64_t)j.time - time) * 10000));
uint32_t motion_id = -1;
if (i >= 0 && i < play_param->chara.size()) {
@@ -3502,7 +3492,7 @@ void x_pv_game_pv_data::find_set_motion() {
}
if (motion_id != -1)
set_motion.push_back({ motion_id, { v61, -1 } });
set_motion.push_back({ motion_id, { frame, -1 } });
}
}
@@ -3627,7 +3617,7 @@ void x_pv_game_pv_data::set_motion_max_frame(int32_t chara_id, int32_t motion_in
if (10000LL * i.time > dsc_time && i.index == motion_index
&& (!branch_mode || branch_mode == i.pv_branch_mode)) {
playdata.rob_chr->bone_data->set_motion_max_frame(
roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
prj::roundf(dsc_time_to_frame(10000LL * i.time - time)) - 1.0f);
break;
}
}
@@ -5191,7 +5181,7 @@ void x_pv_game_stage::set_stage_effect_auth_3d_frame(int32_t stage_effect, float
int32_t frame_offset = (int32_t)id.get_frame_offset();
int32_t _frame = frame_offset + (int32_t)(frame - (float_t)frame_offset) % (int32_t)last_frame;
frame = (float_t)_frame + (frame - (float_t)(int32_t)frame);
frame = (float_t)_frame + (frame - prj::floorf(frame);
}
id.set_req_frame(frame);
id.set_max_frame(-1.0f);
@@ -5974,7 +5964,7 @@ bool x_pv_game::Ctrl() {
&& i.disp_time == time && i.set_motion_time != time)
state_vec.push_back(i);
time = data[0];
frame = (int32_t)roundf((float_t)time * (float_t)(60.0 / 100000.0));
frame = (int32_t)prj::roundf((float_t)time * (float_t)(60.0 / 100000.0));
} break;
case DSC_X_MIKU_DISP: {
int32_t chara_id = data[0];
@@ -7821,7 +7811,7 @@ static vec4 bright_scale_get(int32_t index, float_t value) {
}
static float_t dsc_time_to_frame(int64_t time) {
return roundf((float_t)time / 1000000000.0f * 60.0f);
return prj::roundf((float_t)time / 1000000000.0f * 60.0f);
}
static void x_pv_game_item_alpha_callback(void* data, int32_t chara_id, int32_t type, float_t alpha) {