72 TCHAR g_szOutput[256];
73 TCHAR szCodeString[256];
79 nprintf((
"Sandeep",
"No FF On Joystick, not using FF\n"));
81 wsprintf(g_szOutput,
"Make sure JOYSTICKID1 has Force Feedback\n"
82 "Code = %lx: %s\n", hr, szCodeString);
84 nprintf((
"Sandeep", g_szOutput));
89 nprintf((
"Sandeep",
"There is FF on this joystick! (The peasants cheer)\n"));
114 TCHAR szCodeString[256];
118 nprintf((
"Joystick",
"FF: Error for %s: %s\n", eff_name, szCodeString));
120 nprintf((
"Joystick",
"FF: Error: %s\n", szCodeString));
128 joy_ff_handle_error(
SWFF_CreatePeriodicEffect(
pDiDevice, eff, type, dur, per, ang, mag, 0, att, 0, fade, 0, -1));
139 nprintf((
"Joystick",
"FF: Starting effect %s\n", name));
162 nprintf((
"Joystick",
"FF: Hit effect 1 loaded\n"));
164 nprintf((
"Joystick",
"FF: Hit effect 1 failed to load\n"));
179 nprintf((
"Joystick",
"FF: Hit effect 2 loaded\n"));
181 nprintf((
"Joystick",
"FF: Hit effect 2 failed to load\n"));
195 0, -1),
"ShootEffect");
198 nprintf((
"Joystick",
"FF: Fire primary effect loaded\n"));
200 nprintf((
"Joystick",
"FF: Fire primary effect failed to load\n"));
212 -1),
"SecShootEffect");
215 nprintf((
"Joystick",
"FF: Fire Secondary effect loaded\n"));
217 nprintf((
"Joystick",
"FF: Fire Secondary effect failed to load\n"));
232 nprintf((
"Joystick",
"FF: Spring effect loaded\n"));
236 nprintf((
"Joystick",
"FF: Spring effect failed to load\n"));
248 nprintf((
"Joystick",
"FF: Afterburner effect 1 loaded\n"));
250 nprintf((
"Joystick",
"FF: Afterburner effect 1 failed to load\n"));
262 nprintf((
"Joystick",
"FF: Afterburner effect 2 loaded\n"));
264 nprintf((
"Joystick",
"FF: Afterburner effect 2 failed to load\n"));
276 nprintf((
"Joystick",
"FF: Dock effect loaded\n"));
278 nprintf((
"Joystick",
"FF: Dock effect failed to load\n"));
292 nprintf((
"Joystick",
"FF: Explosion effect loaded\n"));
294 nprintf((
"Joystick",
"FF: Explosion effect failed to load\n"));
308 nprintf((
"Joystick",
"FF: Deathroll effect 1 loaded\n"));
310 nprintf((
"Joystick",
"FF: Deathroll effect 1 failed to load\n"));
324 nprintf((
"Joystick",
"FF: Deathroll effect 2 loaded\n"));
326 nprintf((
"Joystick",
"FF: Deathroll effect 2 failed to load\n"));
368 nprintf((
"Joystick",
"FF: New handling force = %d\n", v));
385 nprintf((
"Joystick",
"FF: Gain reset to %d\n", gain));
391 nprintf((
"Joystick",
"FF: Duration reset to %d\n", dur));
397 nprintf((
"Joystick",
"FF: Doing full reload of effect\n"));
406 nprintf((
"Joystick",
"FF: Swapping in a new effect\n"));
414 nprintf((
"Joystick",
"FF: Swap effect requested, but nothing changed\n"));
421 eff->GetEffectStatus(&flags);
467 nprintf((
"Joystick",
"FF: Afterburn started\n"));
485 nprintf((
"Joystick",
"FF: Afterburn stopped\n"));
522 gain = mag * 120 + 4000;
544 nprintf((
"Joystick",
"FF: Reacquiring\n"));
565 nprintf((
"Joystick",
"FF: HitEffect already playing. Skipping\n"));
572 else if (x < -8000.0
f)
577 else if (y < -8000.0
f)
584 degs = (
float)atan2(x, y);
585 idegs = (
int) (degs * 18000.0
f /
PI) + 90;
589 while (idegs >= 36000)
617 nprintf((
"Joystick",
"FF: vec = { %f, %f, %f } s = %f\n", v->
xyz.x, v->
xyz.y, v->
xyz.z, scaler));
622 if (vf.
xyz.y + vf.
xyz.z < 0)
630 static int secondary_ff_level = 0;
640 gain = gain * 100 + 2500;
644 if (gain != secondary_ff_level) {
655 secondary_ff_level = gain;
656 nprintf((
"Joystick",
"FF: Secondary force = %d\n", gain));
663 static int primary_ff_level = 0;
676 if (gain != primary_ff_level) {
682 primary_ff_level = gain;
693 GUID guid = GUID_Square;
711 guid = GUID_Triangle;
714 guid = GUID_Triangle;
718 guid = GUID_SawtoothUp;
721 guid = GUID_SawtoothDown;
int joy_ff_handling_scaler
di_periodic_effect_struct Struct_deathroll2
int Joy_ff_directional_hit_effect_enabled
void joy_ff_adjust_handling(int speed)
void joy_ff_play_reload_effect()
uint os_config_read_uint(const char *section, const char *name, uint default_value)
HRESULT SWFF_DestroyAllEffects(IN LPDIRECTINPUTDEVICE2 pDIDevice)
float vm_vec_mag(const vec3d *v)
HRESULT SWFF_OpenDefaultFFJoystick(IN HWND hWnd, OUT LPDIRECTINPUT *ppDI, OUT LPDIRECTINPUTDEVICE2 *ppDIDevice2)
HRESULT SWFF_SetGain(IN LPDIRECTINPUTEFFECT pDIEffect, IN DWORD dwGain)
HRESULT joy_ff_handle_error(HRESULT hr, char *eff_name=NULL)
DWORD cbTypeSpecificParams
void SWFF_ErrorCodeToString(IN HRESULT hResult, OUT TCHAR *pszCodeString)
void joy_ff_play_dir_effect(float x, float y)
LPDIRECTINPUTEFFECT pHitEffect2
HRESULT SWFF_CreateConstantForceEffect(IN LPDIRECTINPUTDEVICE2 pDIDevice, IN OUT LPDIRECTINPUTEFFECT *ppDIEffect, IN DWORD dwDuration, IN DWORD dwDirection, IN LONG lMagnitude, IN DWORD dwAttackTime, IN DWORD dwAttackLevel, IN DWORD dwFadeTime, IN DWORD dwFadeLevel, IN LONG lButton)
struct vec3d::@225::@227 xyz
LPDIRECTINPUTEFFECT pDeathroll1
LPDIRECTINPUTDEVICE2 pDiDevice
LPDIRECTINPUTEFFECT pDock
LPDIRECTINPUTEFFECT pSpring
LPDIRECTINPUTEFFECT pExplode
LPDIRECTINPUTEFFECT pDeathroll2
void joy_ff_change_effect(di_periodic_effect_struct *s, LPDIRECTINPUTEFFECT eff, int gain=-1, int dur=0, int flags=-1)
HRESULT SWFF_CreatePeriodicEffect(IN LPDIRECTINPUTDEVICE2 pDIDevice, IN OUT LPDIRECTINPUTEFFECT *ppDIEffect, IN DWORD dwType, IN DWORD dwDuration, IN DWORD dwPeriod, IN DWORD dwDirection, IN DWORD dwMagnitude, IN LONG lOffset, IN DWORD dwAttackTime, IN DWORD dwAttackLevel, IN DWORD dwFadeTime, IN DWORD dwFadeLevel, IN LONG lButton)
void joy_ff_afterburn_off()
void joy_ff_fly_by(int mag)
LONG lPositiveCoefficient
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int joy_ff_effect_playing(LPDIRECTINPUTEFFECT eff)
LPDIRECTINPUTEFFECT pAfterburn2
DICONDITION DIConditionStruct[2]
HRESULT SWFF_SetDuration(IN LPDIRECTINPUTEFFECT pDIEffect, IN DWORD dwDuration)
DIPERIODIC periodic_struct
int joy_ff_create_std_periodic(LPDIRECTINPUTEFFECT *eff, int type, int dur, int per, int ang=0, int mag=10000, int att=0, int fade=0)
LPVOID lpvTypeSpecificParams
void init_periodic_effect_struct(di_periodic_effect_struct *effect, int type, int dur, int per, int ang=0, int mag=10000, int att=0, int fade=0)
HRESULT SWFF_SetDirectionGain(IN LPDIRECTINPUTEFFECT pDIEffect, IN DWORD dwAngle, IN DWORD dwMag)
void joy_ff_start_effect(LPDIRECTINPUTEFFECT eff, char *name)
GLint GLint GLint GLint GLint x
LPDIRECTINPUTEFFECT pHitEffect1
HRESULT SWFF_CreateConditionEffectStruct(di_condition_effect_struct *ptr, IN LPDIRECTINPUTDEVICE2 pDIDevice, IN OUT LPDIRECTINPUTEFFECT *ppDIEffect, IN DWORD dwType, IN DWORD dwDuration, IN LONG lXCoefficient, IN LONG lXOffset, IN LONG lYCoefficient, IN LONG lYOffset, IN LONG lButton)
di_condition_effect_struct Spring_cond_effect
di_periodic_effect_struct Struct_afterburn1
int joy_ff_create_effects()
void vm_vec_copy_scale(vec3d *dest, const vec3d *src, float s)
di_periodic_effect_struct Struct_afterburn2
void joy_ff_play_vector_effect(vec3d *v, float scaler)
LONG lNegativeCoefficient
GLuint const GLchar * name
void joy_ff_play_secondary_shoot(int gain)
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
di_periodic_effect_struct Struct_explode
LPDIRECTINPUTEFFECT pSecShootEffect
void joy_ff_afterburn_on()
DWORD dwTriggerRepeatInterval
LPDIRECTINPUTEFFECT pShootEffect
di_periodic_effect_struct Struct_deathroll1
void joy_ff_mission_init(vec3d v)
di_periodic_effect_struct Struct_dock
void joy_ff_stop_effects()
DIENVELOPE envelope_struct
LPDIRECTINPUTEFFECT pAfterburn1
void joy_ff_play_primary_shoot(int gain)