Castlevania GBA games

This commit is contained in:
Carl.Kenner 2009-05-27 23:05:14 +00:00
parent da55fc906a
commit e6e6774757
3 changed files with 59 additions and 0 deletions

View File

@ -1751,3 +1751,57 @@ u32 CastlevaniaLegendsInput(unsigned short pad) {
return J;
}
u32 CastlevaniaCircleMoonInput(unsigned short pad) {
// Only Nunchuk and Classic controls available
// Wiimote, Gamecube and Keyboard controls depend on user configuration
u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeKeyboard(pad) | DecodeWiimote(pad) | DecodeClassic(pad);
bool JumpButton=0, AttackButton=0, ShootButton=0, GuardButton=0, PauseButton=0, SelectButton=0, SpeedButton=0, HyperButton=0,
LButton=0, RButton=0;
#ifdef HW_RVL
WPADData * wp = WPAD_Data(pad);
// Nunchuk controls are based on Castlevania Wii
if (wp->exp.type == WPAD_EXP_NUNCHUK) {
ShootButton = wp->btns_h & WPAD_BUTTON_A;
AttackButton = (fabs(wp->gforce.x)> 1.5) || (fabs(wp->gforce.y)> 1.5) || wp->btns_h & WPAD_BUTTON_B;
JumpButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_C;
GuardButton = wp->btns_h & WPAD_NUNCHUK_BUTTON_Z;
PauseButton = wp->btns_h & WPAD_BUTTON_PLUS;
SelectButton = wp->btns_h & WPAD_BUTTON_MINUS;
SpeedButton = (wp->btns_h & WPAD_BUTTON_A) && (wp->btns_h & WPAD_BUTTON_B);
HyperButton = wp->btns_h & WPAD_BUTTON_DOWN;
LButton = wp->btns_h & WPAD_BUTTON_1;
RButton = wp->btns_h & WPAD_BUTTON_2;
// Classic controls are based on ...?
} else if (wp->exp.type == WPAD_EXP_CLASSIC) {
ShootButton = wp->btns_h & WPAD_CLASSIC_BUTTON_Y;
AttackButton = wp->btns_h & WPAD_CLASSIC_BUTTON_B;
JumpButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_FULL_R);
GuardButton = wp->btns_h & (WPAD_CLASSIC_BUTTON_FULL_L);
PauseButton = wp->btns_h & WPAD_CLASSIC_BUTTON_PLUS;
SelectButton = wp->btns_h & WPAD_CLASSIC_BUTTON_MINUS;
SpeedButton = wp->btns_h & WPAD_CLASSIC_BUTTON_A;
HyperButton = wp->btns_h & WPAD_CLASSIC_BUTTON_X;
LButton = wp->btns_h & WPAD_CLASSIC_BUTTON_ZL;
RButton = wp->btns_h & WPAD_CLASSIC_BUTTON_ZR;
}
#endif
if (JumpButton) J |= VBA_BUTTON_A;
if (AttackButton) {
J &= ~VBA_UP;
J |= VBA_BUTTON_B;
}
if (HyperButton) J |= VBA_BUTTON_A | VBA_BUTTON_B;
if (ShootButton) J |= VBA_UP | VBA_BUTTON_B;
if (PauseButton) J |= VBA_BUTTON_START;
if (SelectButton) J |= VBA_BUTTON_SELECT;
if (SpeedButton) J |= VBA_SPEED;
if (GuardButton) {
J &= ~VBA_UP;
J |= VBA_DOWN;
}
if (LButton) J |= VBA_BUTTON_L;
if (RButton) J |= VBA_BUTTON_R;
return J;
}

View File

@ -194,6 +194,7 @@ u32 ReturnOfTheKingInput(unsigned short pad);
u32 CastlevaniaAdventureInput(unsigned short pad);
u32 CastlevaniaBelmontInput(unsigned short pad);
u32 CastlevaniaLegendsInput(unsigned short pad);
u32 CastlevaniaCircleMoonInput(unsigned short pad);
#endif

View File

@ -878,6 +878,10 @@ static u32 DecodeJoy(unsigned short pad)
return CastlevaniaBelmontInput(pad);
case CVLEGENDS:
return CastlevaniaLegendsInput(pad);
case CVCIRCLEMOON:
case CVHARMONY:
case CVARIA:
return CastlevaniaCircleMoonInput(pad);
}
// the function result, J, is a combination of flags for all the VBA buttons that are down