File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,14 @@ extern "C" {
125125 void R_PlayerFire (player_t *player) {
126126 static auto & box = BoxEmu::get ();
127127 int weapon_fired = player->readyweapon ;
128- int haptic_effect_index = WeaponHapticLookup[weapon_fired];
129- box.play_haptic_effect (haptic_effect_index);
128+ if (weapon_fired >= 0 && weapon_fired < sizeof (WeaponHapticLookup) / sizeof (WeaponHapticLookup[0 ])) {
129+ int haptic_effect_index = WeaponHapticLookup[weapon_fired];
130+ box.play_haptic_effect (haptic_effect_index);
131+ } else {
132+ // Handle invalid weapon index (e.g., log an error or use a default effect)
133+ // For now, we skip playing the haptic effect.
134+ // Example: box.play_haptic_effect(DEFAULT_HAPTIC_EFFECT);
135+ }
130136 }
131137
132138 void R_PlayerHurt (player_t *player, int damage, int saved) {
You can’t perform that action at this time.
0 commit comments