masterfeizz / ctrQuake

Port of quake for the Nintendo 3DS
99 stars 18 forks source link

Double tap "jump" missing #34

Open Kyor-ob12 opened 2 years ago

Kyor-ob12 commented 2 years ago

In order to use ctrQuake in older 3Ds, it would be nice to recover the double tap jump.

In this commit you deleted Touch_TouchpadTap function, and in further commits all this code was reworked and reorganised for a better understanding. But this had the side effect of deleting the double tap function.

My suggestion is to apply these changes:

{
  if(!keyboardToggled && touch.px > 268 && touch.py > 14 && touch.py < 226)
    Touch_SideBarTap();
  else if (keyboardToggled && touch.py > 62 && touch.py < 188 && touch.px > 12 && touch.px < 308)
    Touch_KeyboardTap();
  else if (touch.py > 214 && touch.px > 142 && touch.px < 178)
    Touch_KeyboardToggle();
  // Analised last to recover double tap jump and to avoid conflicts with other functionalities
  else if (!keyboardToggled)
    Touch_DoubleTapJump();
}

void Touch_DoubleTapJump()
{
  u64 thisTap = Sys_FloatTime();
  if ((thisTap - lastTap) < 0.5){
    Key_Event(K_SPACE, true);
    lastKey = K_SPACE;
  }
  lastTap = thisTap;
}

Maybe there's a better way to do this, if I have time i could test it by myself. Great job, anyway!! :D