Files
firestorm/Gameleap/code/mw4/Code/MW4/@save_criomain.cpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

172 lines
4.0 KiB
C++

/*
LONG g_JoystickXStart = INT_MAX;
LONG g_JoystickXEnd = INT_MIN;
LONG g_JoystickYStart = INT_MAX;
LONG g_JoystickYEnd = INT_MIN;
*/
//g_JoystickXStart = INT_MIN;
//g_JoystickXEnd = INT_MAX;
//g_JoystickYStart = INT_MAX;
//g_JoystickYEnd = INT_MIN;
void CRIOMAIN::UpdateJoystickX (DIJOYSTATE &js)
{
#define RANGE_JOYSTICK 1000L
#define DEADZONE_JOYSTICK 30L
LONG lJ;
LONG JoystickX_Center = 0L;
if ((g_JoystickX < -RANGE_JOYSTICK) || (g_JoystickX > RANGE_JOYSTICK))
{
// error
}
else
{
// Set StartPosition
if (g_JoystickXStart > g_JoystickX)
g_JoystickXStart = g_JoystickX;
// Set EndPosition
if (g_JoystickXEnd < g_JoystickX)
g_JoystickXEnd = g_JoystickX;
if ((g_JoystickXStart + g_JoystickXEnd) != 0) {
JoystickX_Center = (g_JoystickXStart + g_JoystickXEnd) / 2;
} else {
JoystickX_Center = 0L;
}
lJ = JoystickX_Center - g_JoystickX;
if (lJ > 0) {
lJ -= DEADZONE_JOYSTICK;
} else if (lJ < 0) {
lJ += DEADZONE_JOYSTICK;
}
if ((g_JoystickX < JoystickX_Center + DEADZONE_JOYSTICK) && (g_JoystickX > JoystickX_Center - DEADZONE_JOYSTICK)) {
g_JoystickXLast = 0;
} else {
g_JoystickXLast = lJ * 15.0L;
if (g_JoystickXLast < -1000L) {
g_JoystickXLast = -1000L;
} else if (g_JoystickXLast > 1000L) {
g_JoystickXLast = 1000L;
}
}
}
if (g_lpJoystickXMode)
{
*g_lpJoystickXMode = g_JoystickXLast;
}
#if defined(_DEBUG) && 0 // watcom
static char s_szStr[256];
sprintf (s_szStr, "@JOY_X@ RIO (%ld), CENTER (%ld),START (%ld), END (%ld), LAST (%ld) \n",
g_JoystickX, JoystickX_Center, g_JoystickXStart, g_JoystickXEnd, g_JoystickXLast);
::OutputDebugString(s_szStr);
#endif // watcom
}
void CRIOMAIN::UpdateJoystickY (DIJOYSTATE &js)
{
#define RANGE_JOYSTICK 1000L
#define DEADZONE_JOYSTICK 30L
LONG lJ;
LONG JoystickY_Center = 0L;
if ((g_JoystickY < -RANGE_JOYSTICK) || (g_JoystickY > RANGE_JOYSTICK))
{
// error
}
else
{
// Set StartPosition
if (g_JoystickYStart > g_JoystickY)
g_JoystickYStart = g_JoystickY;
// Set EndPosition
if (g_JoystickYEnd < g_JoystickY)
g_JoystickYEnd = g_JoystickY;
// Set CenterPosition
if ((g_JoystickYStart + g_JoystickYEnd) != 0) {
JoystickY_Center = (g_JoystickYStart + g_JoystickYEnd) / 2;
} else {
JoystickY_Center = 0L;
}
lJ = JoystickY_Center - g_JoystickY;
// 고감도
// Dead Zone 에서 벗어난 시점을 0으로 계산한다
if (lJ > 0) {
lJ -= DEADZONE_JOYSTICK;
} else if (lJ < 0) {
lJ += DEADZONE_JOYSTICK;
}
if ((g_JoystickY < JoystickY_Center + DEADZONE_JOYSTICK) && (g_JoystickY > JoystickY_Center - DEADZONE_JOYSTICK)) {
g_JoystickYLast = 0;
} else {
g_JoystickYLast = lJ * -15.0L;
if (g_JoystickYLast < -1000L) {
g_JoystickYLast = -1000L;
} else if (g_JoystickYLast > 1000L) {
g_JoystickYLast = 1000L;
}
}
}
js.lY = g_JoystickYLast;
#if defined(_DEBUG) && 0 // watcom
static char s_szStr[256];
sprintf (s_szStr, "@JOY_Y@ RIO (%ld), CENTER (%ld),START (%ld), END (%ld), LAST (%ld) \n",
g_JoystickY, JoystickY_Center, g_JoystickYStart, g_JoystickYEnd, g_JoystickYLast);
::OutputDebugString(s_szStr);
#endif // watcom
}
/*
void CRIOMAIN::UpdateJoystick (DIJOYSTATE &js)
{
#define DEADZONE_JOYSTICK 20L
//*
// == JOYSTICK ==
// LEFT (+) - RIGHT (-)
// UP (-) - DOWN (+)
//
if (g_lpJoystickXMode)
{
if (g_JoystickX > DEADZONE_JOYSTICK || g_JoystickX < -DEADZONE_JOYSTICK) {
*g_lpJoystickXMode = g_JoystickX * -10;
} else {
*g_lpJoystickXMode = 0;
}
}
if (g_JoystickY > DEADZONE_JOYSTICK || g_JoystickY < -DEADZONE_JOYSTICK) {
js.lY = g_JoystickY * 10;
} else {
js.lY = 0;
}
#if defined(_DEBUG) && 0 // watcom
static char s_szStr[256];
sprintf (s_szStr, "x:[%ld], y:[%ld], z:[%ld]\n",
g_JoystickX, g_JoystickY, js.lRz);
::OutputDebugString(s_szStr);
#endif // watcom
}
*/