Skip to content

Commit 1ace782

Browse files
committedMay 13, 2024
Scintilla crash fix
1 parent 8c361f8 commit 1ace782

File tree

2 files changed

+51
-45
lines changed

2 files changed

+51
-45
lines changed
 

‎fighters/edge/src/flash/acmd.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ unsafe extern "C" fn game_attack(agent: &mut L2CAgentBase) {
8484
let boma = agent.boma();
8585
if is_excute(agent) {
8686
let owner = &mut *sv_battle_object::module_accessor((WorkModule::get_int(boma, *WEAPON_INSTANCE_WORK_ID_INT_LINK_OWNER)) as u32);
87-
ArticleModule::remove(owner, *FIGHTER_EDGE_GENERATE_ARTICLE_FLASH, ArticleOperationTarget(*ARTICLE_OPE_TARGET_ALL));
87+
if owner.kind() == *FIGHTER_KIND_EDGE {
88+
ArticleModule::remove(owner, *FIGHTER_EDGE_GENERATE_ARTICLE_FLASH, ArticleOperationTarget(*ARTICLE_OPE_TARGET_ALL));
89+
}
8890
ATTACK(agent, 0, 0, Hash40::new("top"), 2.0, 366, 65, 60, 40, 12.0, 0.0, 1.5, 0.0, None, None, None, 0.8, 0.5, *ATTACK_SETOFF_KIND_OFF, *ATTACK_LR_CHECK_POS, true, -1, 0.0, 5, true, true, false, false, false, *COLLISION_SITUATION_MASK_GA, *COLLISION_CATEGORY_MASK_ALL, *COLLISION_PART_MASK_ALL, false, Hash40::new("collision_attr_sting_flash"), *ATTACK_SOUND_LEVEL_M, *COLLISION_SOUND_ATTR_CUTUP, *ATTACK_REGION_MAGIC);
8991
}
9092
frame(lua_state, 15.0);

‎fighters/edge/src/flash/status.rs

+48-44
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ unsafe extern "C" fn wait_main(weapon: &mut L2CWeaponCommon) -> L2CValue {
55
MotionModule::change_motion(weapon.module_accessor, Hash40::new("wait"), 0.0, 1.0, false, 0.0, false, false);
66
let owner_id = WorkModule::get_int(weapon.module_accessor, *WEAPON_INSTANCE_WORK_ID_INT_LINK_OWNER) as u32;
77
let edge = utils::util::get_battle_object_from_id(owner_id);
8+
GroundModule::set_collidable(weapon.module_accessor, false);
9+
if (&mut *(*edge).module_accessor).kind() != *FIGHTER_KIND_EDGE {
10+
StatusModule::change_status_force(weapon.module_accessor, statuses::edge_flash::BURST, false);
11+
return 1.into()
12+
}
813
let life = ParamModule::get_int(edge, ParamType::Agent, "param_flash.life");
914
VarModule::set_int(weapon.battle_object, vars::edge_flash::status::LIFE, life);
10-
GroundModule::set_collidable(weapon.module_accessor, false);
11-
if (&mut *(*edge).module_accessor).kind() == *FIGHTER_KIND_EDGE {
12-
if VarModule::is_flag(edge, vars::edge::status::FLASH_HOLD) {
13-
let pos_x = PostureModule::pos_x(weapon.module_accessor);
14-
let pos_y = PostureModule::pos_y(weapon.module_accessor);
15-
let offset_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.hold_offset_x");
16-
PostureModule::set_pos(weapon.module_accessor, &Vector3f::new(pos_x + (offset_x * PostureModule::lr(weapon.module_accessor)), pos_y, 0.0));
17-
}
15+
if VarModule::is_flag(edge, vars::edge::status::FLASH_HOLD) {
16+
let pos_x = PostureModule::pos_x(weapon.module_accessor);
17+
let pos_y = PostureModule::pos_y(weapon.module_accessor);
18+
let offset_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.hold_offset_x");
19+
PostureModule::set_pos(weapon.module_accessor, &Vector3f::new(pos_x + (offset_x * PostureModule::lr(weapon.module_accessor)), pos_y, 0.0));
1820
}
1921
weapon.fastshift(L2CValue::Ptr(wait_main_loop as *const () as _))
2022
}
@@ -27,46 +29,48 @@ unsafe extern "C" fn wait_main_loop(weapon: &mut L2CWeaponCommon) -> L2CValue {
2729
StatusModule::change_status_force(weapon.module_accessor, statuses::edge_flash::VANISH, false);
2830
return 1.into()
2931
}
30-
// burst
31-
if edge_boma.is_status_one_of(&[*FIGHTER_EDGE_STATUS_KIND_SPECIAL_HI_RUSH, *FIGHTER_EDGE_STATUS_KIND_SPECIAL_HI_CHARGED_RUSH]) {
32-
let pos_x = PostureModule::pos_x(weapon.module_accessor) - PostureModule::pos_x(edge_boma);
33-
let pos_y = PostureModule::pos_y(weapon.module_accessor) - PostureModule::pos_y(edge_boma);
34-
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.burst_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
35-
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.burst_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
36-
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
37-
if PostureModule::lr(edge_boma).signum() != PostureModule::lr(weapon.module_accessor).signum() {
38-
PostureModule::reverse_lr(weapon.module_accessor);
32+
if edge_boma.kind() == *FIGHTER_KIND_EDGE {
33+
// burst
34+
if edge_boma.is_status_one_of(&[*FIGHTER_EDGE_STATUS_KIND_SPECIAL_HI_RUSH, *FIGHTER_EDGE_STATUS_KIND_SPECIAL_HI_CHARGED_RUSH]) {
35+
let pos_x = PostureModule::pos_x(weapon.module_accessor) - PostureModule::pos_x(edge_boma);
36+
let pos_y = PostureModule::pos_y(weapon.module_accessor) - PostureModule::pos_y(edge_boma);
37+
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.burst_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
38+
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.burst_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
39+
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
40+
if PostureModule::lr(edge_boma).signum() != PostureModule::lr(weapon.module_accessor).signum() {
41+
PostureModule::reverse_lr(weapon.module_accessor);
42+
}
43+
SoundModule::play_se(weapon.module_accessor, Hash40::new("se_edge_special_l04"), true, false, false, false, app::enSEType(0));
44+
StatusModule::change_status_force(weapon.module_accessor, statuses::edge_flash::BURST, false);
45+
return 1.into()
3946
}
40-
SoundModule::play_se(weapon.module_accessor, Hash40::new("se_edge_special_l04"), true, false, false, false, app::enSEType(0));
41-
StatusModule::change_status_force(weapon.module_accessor, statuses::edge_flash::BURST, false);
42-
return 1.into()
4347
}
44-
}
45-
// refine flare
46-
if VarModule::get_int(edge, vars::edge::instance::FIRE_ID) != -1 {
47-
let pos_x = VarModule::get_float(edge, vars::edge::instance::FIRE_POS_X) - PostureModule::pos_x(weapon.module_accessor);
48-
let pos_y = VarModule::get_float(edge, vars::edge::instance::FIRE_POS_Y) - PostureModule::pos_y(weapon.module_accessor);
49-
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refine_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
50-
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refine_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
51-
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
52-
if VarModule::get_int(weapon.battle_object, vars::edge_flash::status::REFINE_COOLDOWN) <= 0 {
53-
let cooldown = ParamModule::get_int(edge, ParamType::Agent, "param_flash.refine_cooldown");
54-
VarModule::set_int(weapon.battle_object, vars::edge_flash::status::REFINE_COOLDOWN, cooldown);
55-
VarModule::on_flag(edge, vars::edge::instance::FLASH_REFINE);
48+
// refine flare
49+
if VarModule::get_int(edge, vars::edge::instance::FIRE_ID) != -1 {
50+
let pos_x = VarModule::get_float(edge, vars::edge::instance::FIRE_POS_X) - PostureModule::pos_x(weapon.module_accessor);
51+
let pos_y = VarModule::get_float(edge, vars::edge::instance::FIRE_POS_Y) - PostureModule::pos_y(weapon.module_accessor);
52+
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refine_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
53+
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refine_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
54+
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
55+
if VarModule::get_int(weapon.battle_object, vars::edge_flash::status::REFINE_COOLDOWN) <= 0 {
56+
let cooldown = ParamModule::get_int(edge, ParamType::Agent, "param_flash.refine_cooldown");
57+
VarModule::set_int(weapon.battle_object, vars::edge_flash::status::REFINE_COOLDOWN, cooldown);
58+
VarModule::on_flag(edge, vars::edge::instance::FLASH_REFINE);
59+
}
5660
}
5761
}
58-
}
59-
// refract shadow flare
60-
if VarModule::get_int(edge, vars::edge::instance::FLARE1_ID) != -1 {
61-
let pos_x = VarModule::get_float(edge, vars::edge::instance::FLARE1_POS_X) - PostureModule::pos_x(weapon.module_accessor);
62-
let pos_y = VarModule::get_float(edge, vars::edge::instance::FLARE2_POS_Y) - PostureModule::pos_y(weapon.module_accessor);
63-
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refract_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
64-
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refract_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
65-
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
66-
let cooldown = ParamModule::get_int(edge, ParamType::Agent, "param_flash.refract_cooldown");
67-
VarModule::set_int(weapon.battle_object, vars::edge_flash::status::REFRACT_COOLDOWN, cooldown);
68-
VarModule::on_flag(edge, vars::edge::instance::FLASH_REFRACT);
69-
}
62+
// refract shadow flare
63+
if VarModule::get_int(edge, vars::edge::instance::FLARE1_ID) != -1 {
64+
let pos_x = VarModule::get_float(edge, vars::edge::instance::FLARE1_POS_X) - PostureModule::pos_x(weapon.module_accessor);
65+
let pos_y = VarModule::get_float(edge, vars::edge::instance::FLARE2_POS_Y) - PostureModule::pos_y(weapon.module_accessor);
66+
let dist_mod_x = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refract_dist_mod_x") * PostureModule::scale(weapon.module_accessor);
67+
let dist_mod_y = ParamModule::get_float(edge, ParamType::Agent, "param_flash.refract_dist_mod_y") * PostureModule::scale(weapon.module_accessor);
68+
if pos_x.abs() < dist_mod_x && pos_y.abs() < dist_mod_y {
69+
let cooldown = ParamModule::get_int(edge, ParamType::Agent, "param_flash.refract_cooldown");
70+
VarModule::set_int(weapon.battle_object, vars::edge_flash::status::REFRACT_COOLDOWN, cooldown);
71+
VarModule::on_flag(edge, vars::edge::instance::FLASH_REFRACT);
72+
}
73+
}
7074
}
7175

7276
return 0.into()

0 commit comments

Comments
 (0)