Formatting

This commit is contained in:
korenkonder
2023-06-18 16:28:24 +03:00
parent f782842d7a
commit 64091ff80d
11 changed files with 79 additions and 62 deletions
+1 -1
View File
@@ -754,7 +754,7 @@ static void draw_object_material_set_default(render_context* rctx, const mdl::Ob
uniform_value[uni_type] = 1;
}
if (tex_index == 0 || tex_index == 1)
if (tex_index >= 0 && tex_index <= 1)
uniform_value[U_TEXTURE_BLEND] = texdata->attrib.get_blend();
}
+1 -1
View File
@@ -3719,7 +3719,7 @@ void render_context::light_param_data_ibl_set(
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
if (i == 0) {
if (!i) {
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, 1);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
+1 -1
View File
@@ -218,7 +218,7 @@ static int32_t render_texture_framebuffer_set_texture(render_texture* rt,
}
gl_state_get_error();
if (level == 0) {
if (!level) {
if (stencil) {
if (depth_texture)
glFramebufferTexture(GL_FRAMEBUFFER,
+8 -5
View File
@@ -2274,16 +2274,19 @@ void ExConstraintBlock::Field_18(int32_t stage, bool disable_external_force) {
if (field_59)
return;
if (stage == 0) {
switch (stage) {
case 0:
if (field_58)
Field_20();
}
else if (stage == 2) {
break;
case 2:
if (has_children_node)
DataSet();
}
else if (stage == 5)
break;
case 5:
Field_20();
break;
}
}
void ExConstraintBlock::Field_20() {
+46 -33
View File
@@ -2690,12 +2690,14 @@ void rob_chara::adjust_ctrl() {
}
static motion_bone_index rob_motion_c_kata_bone_get(int32_t index) {
if (index == 0)
switch (index) {
case 0:
return MOTION_BONE_C_KATA_L;
else if (index == 1)
case 1:
return MOTION_BONE_C_KATA_R;
else
default:
return MOTION_BONE_NONE;
}
}
static void rob_chara_bone_data_set_motion_arm_length(rob_chara_bone_data* rob_bone_data,
@@ -3058,7 +3060,7 @@ static void mothead_apply2_inner(struc_380* a1, int32_t type, const mothead_data
break;
do {
if (a3->type == 0) {
if (!a3->type) {
void* v10 = a3->data;
if (!v10)
break;
@@ -5914,7 +5916,7 @@ static void mothead_func_13(mothead_func_data* func_data,
v9 = v5->field_8.field_150;
HIBYTE(v12) = v9;
if ((v6 & 2) != 0)
HIBYTE(v12) = v9 == 0;
HIBYTE(v12) = !v9;
v14 = ((int32_t*)data)[2];
v13 = (v6 & 4) != 0;
sub_1401FCE40((int64_t)&v10);*/
@@ -9182,20 +9184,18 @@ static bool sub_14053B580(rob_chara* rob_chr, int32_t a2) {
bool v2 = false;
int32_t v8 = v0.field_0;
float_t v9 = rob_chr->data.motion.frame_data.frame;
if (v8 == 0) {
if (v9
< v0.frame)
switch (v8) {
case 0:
if (v9 < v0.frame)
return false;
}
else if (v8 == 1) {
if (v9
< v0.frame
|| v9
>= v0.field_8)
break;
case 1:
if (v9 < v0.frame || v9 >= v0.field_8)
return false;
}
else
break;
default:
return false;
}
mat4 mat;
sub_140419290(rob_chr->bone_data, rob_ik_hand_leg_bones[a2], &mat);
@@ -9268,10 +9268,14 @@ static bool sub_14053B580(rob_chara* rob_chr, int32_t a2) {
int32_t v33 = v0.field_0;
vec3 v48 = 0.0f;
if (v33 == 0)
switch (v0.field_0) {
case 0:
v48 = vec3::lerp(v45, v13, v31);
else if (v33 == 1)
break;
case 1:
v48 = vec3::lerp(v13, v45, v31);
break;
}
switch (v0.field_E) {
case 1:
@@ -13483,7 +13487,7 @@ void rob_chara_item_equip::disp(int32_t chara_id, render_context* rctx) {
else {
for (int32_t i = ITEM_ATAMA; i < ITEM_MAX; i++) {
mdl::ObjFlags v18 = (mdl::ObjFlags)0;
if (field_18[i] == 0) {
if (!field_18[i]) {
if (rctx->chara_reflect)
enum_or(v18, mdl::OBJ_CHARA_REFLECT);
if (rctx->chara_refract)
@@ -13692,13 +13696,18 @@ void rob_chara_item_equip::set_osage_step(float_t value) {
}
void rob_chara_item_equip::set_osage_move_cancel(uint8_t id, float_t value) {
if (id == 0)
switch (id) {
case 0:
for (int32_t i = first_item_equip_object; i < max_item_equip_object; i++)
item_equip_object[i].set_osage_move_cancel(value);
else if (id == 1)
break;
case 1:
item_equip_object[ITEM_KAMI].set_osage_move_cancel(value);
else if (id == 2)
break;
case 2:
item_equip_object[ITEM_OUTER].set_osage_move_cancel(value);
break;
}
}
void rob_chara_item_equip::set_osage_play_data_init(item_id id, float_t* opdi_data) {
@@ -13707,7 +13716,7 @@ void rob_chara_item_equip::set_osage_play_data_init(item_id id, float_t* opdi_da
}
void rob_chara_item_equip::set_shadow_type(int32_t chara_id) {
if (chara_id == 0)
if (!chara_id)
shadow_type = SHADOW_CHARA;
else
shadow_type = SHADOW_STAGE;
@@ -14004,7 +14013,7 @@ static void sub_14052C560(rob_chara_item_cos_data* item_sub_data,
}
else {
item_id id = sub_140512EF0(rob_itm_equip, ITEM_ITEM09);
if (id != ITEM_NONE && ((item->attr & 0x10) == 0 || &i - item->data.obj.data())) {
if (id != ITEM_NONE && (!(item->attr & 0x10) || &i - item->data.obj.data())) {
bool v8 = false;
if (item->attr & 0x10 && &i - item->data.obj.data() == 1) {
sub_140513B90(rob_itm_equip, id, item->data.obj[1].obj_info,
@@ -14086,7 +14095,7 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data,
id = v13;
}
}
else if (item->type == 0) {
else if (!item->type) {
id = sub_140512EF0(rob_itm_equip, ITEM_ITEM09);
if (id != ITEM_NONE) {
rob_itm_equip->load_body_parts_object_info(id, i.obj_info, bone_data, data, obj_db);
@@ -14097,7 +14106,7 @@ static void sub_14052C8C0(rob_chara_item_cos_data* item_cos_data,
else
continue;
if (item->attr & 0xC)
if (item->attr & 0x0C)
item_cos_data->set_texture_pattern(rob_itm_equip, item_no, id, false);
}
}
@@ -18500,7 +18509,7 @@ void RobThreadParent::sub_14054E0D0() {
{
std::unique_lock<std::mutex> u_lock(threads_mtx);
threads.pop_front();
threads_null = threads.size() == 0;
threads_null = !threads.size();
}
if (threads_null) {
@@ -19356,7 +19365,8 @@ bool TaskRobManager::Ctrl() {
}
bool TaskRobManager::Dest() {
if (dest_state == 0) {
switch (dest_state) {
case 0: {
rob_manager_rob_impl* rob_impls1 = rob_manager_rob_impls1_get(this);
for (; rob_impls1->task; rob_impls1++)
rob_impls1->task->DelTask();
@@ -19371,12 +19381,15 @@ bool TaskRobManager::Dest() {
loaded_chara.clear();
dest_state = 1;
}
else if (dest_state != 1)
return false;
case 1:
if (!task_rob_load_del_task())
return false;
task_rob_load_del_task();
dest_state = 2;
return true;
dest_state = 2;
return true;
default:
return false;
}
}
void TaskRobManager::Disp() {
+7 -4
View File
@@ -690,14 +690,17 @@ bool SkinParamManager::Init() {
}
bool SkinParamManager::Ctrl() {
if (state == 0) {
switch (state) {
case 0:
if (CtrlFiles())
return false;
state = 1;
}
else if (state != 1)
case 1:
return true;
default:
return false;
return true;
}
}
bool SkinParamManager::Dest() {
+1 -1
View File
@@ -3275,7 +3275,7 @@ static void glass_eye_calc(glass_eye_struct* glass_eye) {
glass_eye->field_74 = glass_eye->field_3C * v2;
glass_eye->field_80 = glass_eye->field_48 * v2;
glass_eye->field_8C = glass_eye->field_54 * v2;
if (glass_eye->field_B0 == 0) {
if (!glass_eye->field_B0) {
glass_eye->field_A0 = 0.0f;
return;
}
+5 -5
View File
@@ -2567,11 +2567,11 @@ void dsc::convert(dsc_type dst_type) {
break;
}
bool enable_edit_camera = ((note_convert_src == 0 || note_convert_src == 1)
&& (note_convert_dst == 0 || note_convert_dst == 1)
|| note_convert_src == 2 && note_convert_dst == 2);
bool enable_edit_camera_ac = (note_convert_src == 0 || note_convert_src == 1)
&& (note_convert_dst == 0 || note_convert_dst == 1) && dst_has_perf_id;
bool enable_edit_camera = note_convert_src >= 0 && note_convert_src <= 1
&& note_convert_dst >= 0 && note_convert_dst <= 1
|| note_convert_src == 2 && note_convert_dst == 2;
bool enable_edit_camera_ac = note_convert_src >= 0 && note_convert_src <= 1
&& note_convert_dst >= 0 && note_convert_dst <= 1 && dst_has_perf_id;
dsc_replace dr(type, dst_type, dst_has_perf_id);
+3 -5
View File
@@ -412,11 +412,9 @@ static errno_t farc_get_files(farc* f) {
static void farc_pack_files(farc* f, stream& s, farc_compress_mode mode, bool get_files) {
bool plain = false;
for (farc_file& i : f->files) {
char* ext = str_utils_get_extension(i.name.c_str());
bool is_a3da = str_utils_compare(ext, ".a3da") == 0;
bool is_diva = str_utils_compare(ext, ".diva") == 0;
bool is_vag = str_utils_compare(ext, ".vag") == 0;
free_def(ext);
bool is_a3da = i.name.find(".a3da") == i.name.size() - 5;
bool is_diva = i.name.find(".diva") == i.name.size() - 5;
bool is_vag = i.name.find(".vag" ) == i.name.size() - 4;
if (is_a3da || is_diva || is_vag) {
plain = true;
+2 -2
View File
@@ -393,7 +393,7 @@ static void mot_classic_read_inner(mot_set* ms, prj::shared_ptr<prj::stack_alloc
s.set_position(mh[i].key_set_types_offset, SEEK_SET);
for (int32_t j = 0, b = 0; j < m->key_set_count; j++) {
if (j % 8 == 0)
if (!(j % 8))
b = s.read_uint16_t();
key_set_array[j].type = (mot_key_set_type)((b >> (j % 8 * 2)) & 0x03);
@@ -605,7 +605,7 @@ static void mot_modern_read_inner(mot_set* ms, prj::shared_ptr<prj::stack_alloca
s_motc.set_position(mh.key_set_types_offset, SEEK_SET);
for (uint32_t j = 0, b = 0; j < key_set_count; j++) {
if (j % 8 == 0)
if (!(j % 8))
b = s_motc.read_uint16_t_reverse_endianness();
key_set_array[j].type = (mot_key_set_type)((b >> (j % 8 * 2)) & 0x03);
+4 -4
View File
@@ -245,17 +245,17 @@ struct msgpack {
inline bool check_null() {
if (type == MSGPACK_ARRAY)
return data.arr->size() == 0;
return !data.arr->size();
else if (type == MSGPACK_MAP)
return data.map->size() == 0;
return !data.map->size();
return type == MSGPACK_NONE;
}
inline bool check_not_null() {
if (type == MSGPACK_ARRAY)
return data.arr->size() != 0;
return !!data.arr->size();
else if (type == MSGPACK_MAP)
return data.map->size() != 0;
return !!data.map->size();
return type != MSGPACK_NONE;
}