@@ -303,6 +303,7 @@ namespace TFE_DarkForces
303
303
attackMod->meleeRate = FIXED (230 );
304
304
attackMod->attackFlags = ATTFLAG_RANGED | ATTFLAG_LIT_RNG;
305
305
306
+ // Why is this being returned? This function maybe should be a void?
306
307
return attackMod->fireOffset .y ;
307
308
}
308
309
@@ -1029,9 +1030,14 @@ namespace TFE_DarkForces
1029
1030
}
1030
1031
1031
1032
attackMod->anim .state = STATE_ANIMATE1;
1032
- ProjectileLogic* proj = (ProjectileLogic*)createProjectile (attackMod->projType , obj->sector , obj->posWS .x , attackMod->fireOffset .y + obj->posWS .y , obj->posWS .z , obj);
1033
- sound_playCued (attackMod->attackPrimSndSrc , obj->posWS );
1033
+ vec3_fixed fireOffset = {};
1034
+
1035
+ // Calculate the X,Z fire offsets based on where the enemy is facing. It doesn't matter for Y.
1036
+ transformFireOffsets (obj->yaw , &attackMod->fireOffset , &fireOffset);
1034
1037
1038
+ ProjectileLogic* proj = (ProjectileLogic*)createProjectile (attackMod->projType , obj->sector , fireOffset.x + obj->posWS .x , fireOffset.y + obj->posWS .y , fireOffset.z + obj->posWS .z , obj);
1039
+ sound_playCued (attackMod->attackPrimSndSrc , obj->posWS );
1040
+
1035
1041
proj->prevColObj = obj;
1036
1042
proj->prevObj = obj;
1037
1043
proj->excludeObj = obj;
@@ -1048,22 +1054,25 @@ namespace TFE_DarkForces
1048
1054
vec3_fixed target = { s_playerObject->posWS .x , s_eyePos.y + ONE_16, s_playerObject->posWS .z };
1049
1055
proj_aimArcing (proj, target, proj->speed );
1050
1056
1051
- if (attackMod->fireOffset .x | attackMod->fireOffset .z )
1052
- {
1053
- proj->delta .x = attackMod->fireOffset .x ;
1054
- proj->delta .z = attackMod->fireOffset .z ;
1055
- proj_handleMovement (proj);
1056
- }
1057
+ // This code was never hit in original DF because x and z fire offsets were always 0
1058
+ // It causes strange collision effects to happen, so commenting out.
1059
+ // if (fireOffset.x | fireOffset.z)
1060
+ // {
1061
+ // proj->delta.x = fireOffset.x;
1062
+ // proj->delta.z = fireOffset.z;
1063
+ // proj_handleMovement(proj);
1064
+ // }
1057
1065
}
1058
1066
else
1059
1067
{
1060
1068
// Handle x and z fire offset.
1061
- if (attackMod->fireOffset .x | attackMod->fireOffset .z )
1062
- {
1063
- proj->delta .x = attackMod->fireOffset .x ;
1064
- proj->delta .z = attackMod->fireOffset .z ;
1065
- proj_handleMovement (proj);
1066
- }
1069
+ // Commenting out - see note above
1070
+ // if (fireOffset.x | fireOffset.z)
1071
+ // {
1072
+ // proj->delta.x = fireOffset.x;
1073
+ // proj->delta.z = fireOffset.z;
1074
+ // proj_handleMovement(proj);
1075
+ // }
1067
1076
1068
1077
// Aim at the target.
1069
1078
vec3_fixed target = { s_eyePos.x , s_eyePos.y + ONE_16, s_eyePos.z };
@@ -1096,7 +1105,13 @@ namespace TFE_DarkForces
1096
1105
}
1097
1106
1098
1107
attackMod->anim .state = STATE_ANIMATE2;
1099
- ProjectileLogic* proj = (ProjectileLogic*)createProjectile (attackMod->projType , obj->sector , obj->posWS .x , attackMod->fireOffset .y + obj->posWS .y , obj->posWS .z , obj);
1108
+
1109
+ vec3_fixed fireOffset = {};
1110
+
1111
+ // Calculate the fire offsets based on where the enemy is facing. It doesn't matter for Y.
1112
+ transformFireOffsets (obj->yaw , &attackMod->fireOffset , &fireOffset);
1113
+
1114
+ ProjectileLogic* proj = (ProjectileLogic*)createProjectile (attackMod->projType , obj->sector , fireOffset.x + obj->posWS .x , fireOffset.y + obj->posWS .y , fireOffset.z + obj->posWS .z , obj);
1100
1115
sound_playCued (attackMod->attackPrimSndSrc , obj->posWS );
1101
1116
proj->prevColObj = obj;
1102
1117
proj->excludeObj = obj;
@@ -1110,21 +1125,23 @@ namespace TFE_DarkForces
1110
1125
vec3_fixed target = { s_playerObject->posWS .x , s_eyePos.y + ONE_16, s_playerObject->posWS .z };
1111
1126
proj_aimArcing (proj, target, proj->speed );
1112
1127
1113
- if (attackMod->fireOffset .x | attackMod->fireOffset .z )
1114
- {
1115
- proj->delta .x = attackMod->fireOffset .x ;
1116
- proj->delta .z = attackMod->fireOffset .z ;
1117
- proj_handleMovement (proj);
1118
- }
1128
+ // Commenting out - see note above
1129
+ // if (fireOffset.x | fireOffset.z)
1130
+ // {
1131
+ // proj->delta.x = fireOffset.x;
1132
+ // proj->delta.z = fireOffset.z;
1133
+ // proj_handleMovement(proj);
1134
+ // }
1119
1135
}
1120
1136
else
1121
1137
{
1122
- if (attackMod->fireOffset .x | attackMod->fireOffset .z )
1123
- {
1124
- proj->delta .x = attackMod->fireOffset .x ;
1125
- proj->delta .z = attackMod->fireOffset .z ;
1126
- proj_handleMovement (proj);
1127
- }
1138
+ // Commenting out - see note above
1139
+ // if (fireOffset.x | fireOffset.z)
1140
+ // {
1141
+ // proj->delta.x = fireOffset.x;
1142
+ // proj->delta.z = fireOffset.z;
1143
+ // proj_handleMovement(proj);
1144
+ // }
1128
1145
vec3_fixed target = { s_eyePos.x , s_eyePos.y + ONE_16, s_eyePos.z };
1129
1146
proj_aimAtTarget (proj, target);
1130
1147
if (attackMod->fireSpread )
0 commit comments