git-svn-id: https://svn.eduke32.com/eduke32@1018 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-08-24 09:01:17 +00:00
parent 52bb6e84c9
commit 553658aa67
5 changed files with 84 additions and 92 deletions

View file

@ -2128,7 +2128,7 @@ static int parsecommand(void)
labeltype[labelcnt] = LABEL_DEFINE;
labelcode[labelcnt++] = *(scriptptr-1);
if (*(scriptptr-1) >= 0 && *(scriptptr-1) < MAXTILES && dynamicremap)
processnames(label+(labelcnt<<6),*(scriptptr-1));
processnames(label+((labelcnt-1)<<6),*(scriptptr-1));
}
scriptptr -= 2;
return 0;
@ -3619,8 +3619,8 @@ static int parsecommand(void)
case CON_DYNAMICREMAP:
{
scriptptr--;
initprintf("Dynamic tile remapping enabled.\n");
dynamicremap = 1;
if (dynamicremap++) initprintf("%s:%d: warning: duplicate dynamicremap statement\n",compilefile,line_number);
else initprintf("Using dynamic tile remapping\n");
break;
}

View file

@ -258,7 +258,7 @@ void CONTROL_ShutJoy( int32 joy );
void CONTROL_SetFlag( int32 which, boolean active );
void CONTROL_ButtonFunctionState( boolean * state );
boolean CONTROL_KeyboardFunctionPressed( int32 whichfunction );
boolean CONTROL_CheckRange( int32 which );
static inline boolean CONTROL_CheckRange( int32 which );
int32 CONTROL_GetTime( void );
void CONTROL_AxisFunctionState( boolean * state );
void CONTROL_GetJoyMovement( ControlInfo * info );

View file

@ -131,12 +131,12 @@ int32 CONTROL_GetTime(void)
return t;
}
boolean CONTROL_CheckRange(int32 which)
static inline boolean CONTROL_CheckRange(int32 which)
{
if ((uint32)which < (uint32)CONTROL_NUM_FLAGS) return false;
if ((uint32)which >= (uint32)CONTROL_NUM_FLAGS) return true;
//Error("CONTROL_CheckRange: Index %d out of valid range for %d control flags.",
// which, CONTROL_NUM_FLAGS);
return true;
return false;
}
void CONTROL_SetFlag(int32 which, boolean active)
@ -146,9 +146,8 @@ void CONTROL_SetFlag(int32 which, boolean active)
if (CONTROL_Flags[which].toggle == INSTANT_ONOFF)
{
CONTROL_Flags[which].active = active;
return;
}
else
{
if (active)
{
CONTROL_Flags[which].buttonheld = false;
@ -158,7 +157,6 @@ void CONTROL_SetFlag(int32 which, boolean active)
CONTROL_Flags[which].buttonheld = true;
CONTROL_Flags[which].active = (CONTROL_Flags[which].active ? false : true);
}
}
}
boolean CONTROL_KeyboardFunctionPressed(int32 which)
@ -559,34 +557,14 @@ void CONTROL_DigitizeAxis(int32 axis, controldevice device)
if (set[axis].analog > 0)
{
if (set[axis].analog > THRESHOLD) // if very much in one direction,
{
set[axis].digital = 1; // set affirmative
}
else
{
if (set[axis].analog > MINTHRESHOLD) // if hanging in limbo,
{
if (lastset[axis].digital == 1) // set if in same direction as last time
if (set[axis].analog > THRESHOLD || (set[axis].analog > MINTHRESHOLD && lastset[axis].digital == 1))
set[axis].digital = 1;
}
}
}
else
{
if (set[axis].analog < -THRESHOLD)
{
if (set[axis].analog < -THRESHOLD || (set[axis].analog < -MINTHRESHOLD && lastset[axis].digital == -1))
set[axis].digital = -1;
}
else
{
if (set[axis].analog < -MINTHRESHOLD)
{
if (lastset[axis].digital == -1)
set[axis].digital = -1;
}
}
}
}
void CONTROL_ScaleAxis(int32 axis, controldevice device)
@ -646,8 +624,6 @@ void CONTROL_ApplyAxis(int32 axis, ControlInfo *info, controldevice device)
void CONTROL_PollDevices(ControlInfo *info)
{
int32 i;
memcpy(CONTROL_LastMouseAxes, CONTROL_MouseAxes, sizeof(CONTROL_MouseAxes));
memcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
@ -657,9 +633,9 @@ void CONTROL_PollDevices(ControlInfo *info)
if (CONTROL_MouseEnabled)
{
CONTROL_GetMouseDelta();
int32 i = MAXMOUSEAXES-1;
i = MAXMOUSEAXES-1;
CONTROL_GetMouseDelta();
do
{
CONTROL_DigitizeAxis(i, controldevice_mouse);
@ -667,18 +643,19 @@ void CONTROL_PollDevices(ControlInfo *info)
LIMITCONTROL(&CONTROL_MouseAxes[i].analog);
CONTROL_ApplyAxis(i, info, controldevice_mouse);
}
while (--i >= 0);
while (--i);
CONTROL_DigitizeAxis(0, controldevice_mouse);
CONTROL_ScaleAxis(0, controldevice_mouse);
LIMITCONTROL(&CONTROL_MouseAxes[0].analog);
CONTROL_ApplyAxis(0, info, controldevice_mouse);
}
if (CONTROL_JoystickEnabled)
{
int32 i = MAXJOYAXES-1;
CONTROL_GetJoyDelta();
// Why?
//CONTROL_Axes[0].analog /= 2;
//CONTROL_Axes[2].analog /= 2;
i = MAXJOYAXES-1;
do
{
CONTROL_DigitizeAxis(i, controldevice_joystick);
@ -686,7 +663,12 @@ void CONTROL_PollDevices(ControlInfo *info)
LIMITCONTROL(&CONTROL_JoyAxes[i].analog);
CONTROL_ApplyAxis(i, info, controldevice_joystick);
}
while (--i >= 0);
while (--i);
CONTROL_DigitizeAxis(0, controldevice_joystick);
CONTROL_ScaleAxis(0, controldevice_joystick);
LIMITCONTROL(&CONTROL_JoyAxes[0].analog);
CONTROL_ApplyAxis(0, info, controldevice_joystick);
}
CONTROL_GetDeviceButtons();
@ -735,6 +717,8 @@ void CONTROL_AxisFunctionState(int32 *p1)
void CONTROL_ButtonFunctionState(int32 *p1)
{
if (CONTROL_NumMouseButtons)
{
int32 i = CONTROL_NumMouseButtons-1, j;
do
@ -761,8 +745,12 @@ void CONTROL_ButtonFunctionState(int32 *p1)
mousebind[i].laststate = CONTROL_MouseButtonState[i];
}
while (--i >= 0);
}
if (CONTROL_NumJoyButtons)
{
int32 i=CONTROL_NumJoyButtons-1, j;
i=CONTROL_NumJoyButtons-1;
do
{
j = CONTROL_JoyButtonMapping[i].doubleclicked;
@ -774,6 +762,7 @@ void CONTROL_ButtonFunctionState(int32 *p1)
p1[j] |= CONTROL_JoyButtonState[i];
}
while (--i >= 0);
}
}
/*
void CONTROL_GetUserInput( UserInput *info )
@ -871,9 +860,11 @@ void CONTROL_ClearButton(int32 whichbutton)
void CONTROL_ProcessBinds(void)
{
if (!bindsenabled) return;
{
int i=MAXBOUNDKEYS-1;
if (!bindsenabled) return;
do
{
if (boundkeys[i].cmd[0] && KB_KeyPressed(i))
@ -884,6 +875,7 @@ void CONTROL_ProcessBinds(void)
boundkeys[i].laststate = KB_KeyPressed(i);
}
while (--i);
}
if (boundkeys[0].cmd[0] && KB_KeyPressed(0))
{

View file

@ -766,7 +766,7 @@ int RESERVEDSLOT10 = 6141;
int RESERVEDSLOT11 = 6142;
int RESERVEDSLOT12 = 6143;
int dynamictostatic[MAXTILES];
short dynamictostatic[MAXTILES];
void processnames(const char *szLabel, int lValue)
{

View file

@ -1496,4 +1496,4 @@ extern int RESERVEDSLOT11;
#define RESERVEDSLOT11__STATIC 6142
extern int RESERVEDSLOT12;
#define RESERVEDSLOT12__STATIC 6143
extern int dynamictostatic[MAXTILES];
extern short dynamictostatic[MAXTILES];