Skip to content

Commit ad5b237

Browse files
authored
A couple of particle-related fixes (#6754)
1 parent 546d0af commit ad5b237

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

code/math/curve.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int curve_parse(const char *err_msg) {
5959
}
6060
else {
6161
SCP_string curve_name;
62-
stuff_string(curve_name, F_NAME);
62+
stuff_string(curve_name, F_NAME, "()");
6363
int curve_id = curve_get_by_name(curve_name);
6464
if (curve_id < 0) {
6565
error_display(0, "Curve %s not found!%s", curve_name.c_str(), err_msg);
@@ -80,6 +80,10 @@ void parse_curve_table(const char* filename) {
8080
SCP_string name;
8181
stuff_string(name, F_NAME);
8282

83+
if (name.find('(') != SCP_string::npos || name.find(')') != SCP_string::npos) {
84+
error_display(0, "Curve name %s contains parentheses, which are not permitted.", name.c_str());
85+
}
86+
8387
int index = curve_get_by_name(name);
8488

8589
if (index < 0) {

code/particle/ParticleEffect.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,9 @@ matrix ParticleEffect::getNewDirection(const matrix& hostOrientation, const std:
130130
// Compute reflect vector as R = V - 2*(V dot N)*N where N
131131
// is the normal and V is the incoming direction
132132

133-
return vm_matrix_new(1.f - 2.f * normal->xyz.x * normal->xyz.x, -2.f * normal->xyz.x * normal->xyz.y, -2.f * normal->xyz.x * normal->xyz.z,
133+
return hostOrientation * vm_matrix_new(1.f - 2.f * normal->xyz.x * normal->xyz.x, -2.f * normal->xyz.x * normal->xyz.y, -2.f * normal->xyz.x * normal->xyz.z,
134134
-2.f * normal->xyz.x * normal->xyz.y, 1.f - 2.f * normal->xyz.y * normal->xyz.y, -2.f * normal->xyz.y * normal->xyz.z,
135-
-2.f * normal->xyz.x * normal->xyz.z, -2.f * normal->xyz.y * normal->xyz.z, 1.f - 2.f * normal->xyz.z * normal->xyz.z)
136-
* hostOrientation;
135+
-2.f * normal->xyz.x * normal->xyz.z, -2.f * normal->xyz.y * normal->xyz.z, 1.f - 2.f * normal->xyz.z * normal->xyz.z);
137136
}
138137
case ShapeDirection::REVERSE: {
139138
return vm_matrix_new(hostOrientation.vec.rvec * -1.f, hostOrientation.vec.uvec * -1.f, hostOrientation.vec.fvec * -1.f);

0 commit comments

Comments
 (0)