Use CONTROL_NEXT_FIGHTER / CONTROL_PREV_FIGHTER to select fighters during epic missions.
This commit is contained in:
parent
d33bcf9414
commit
06f7867013
|
@ -362,27 +362,27 @@ void initPlayerSelect(void)
|
||||||
|
|
||||||
void doPlayerSelect(void)
|
void doPlayerSelect(void)
|
||||||
{
|
{
|
||||||
if (app.keyboard[SDL_SCANCODE_A] || app.mouse.button[SDL_BUTTON_X1])
|
if (isControl(CONTROL_PREV_FIGHTER))
|
||||||
{
|
{
|
||||||
selectNewPlayer(-1);
|
selectNewPlayer(-1);
|
||||||
|
|
||||||
app.mouse.button[SDL_BUTTON_X1] = app.keyboard[SDL_SCANCODE_A] = 0;
|
clearControl(CONTROL_PREV_FIGHTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_D] || app.mouse.button[SDL_BUTTON_X2])
|
if (isControl(CONTROL_NEXT_FIGHTER))
|
||||||
{
|
{
|
||||||
selectNewPlayer(1);
|
selectNewPlayer(1);
|
||||||
|
|
||||||
app.mouse.button[SDL_BUTTON_X2] = app.keyboard[SDL_SCANCODE_D] = 0;
|
clearControl(CONTROL_NEXT_FIGHTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->health > 0 && app.mouse.button[SDL_BUTTON_LEFT])
|
if (player->health > 0 && isAcceptControl())
|
||||||
{
|
{
|
||||||
battle.playerSelect = 0;
|
battle.playerSelect = 0;
|
||||||
|
|
||||||
initPlayer();
|
initPlayer();
|
||||||
|
|
||||||
app.mouse.button[SDL_BUTTON_LEFT] = 0;
|
resetAcceptControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ extern int isControl(int type);
|
||||||
extern void clearControl(int type);
|
extern void clearControl(int type);
|
||||||
extern long lookup(char *name);
|
extern long lookup(char *name);
|
||||||
extern Entity *spawnFighter(char *name, int x, int y, int side);
|
extern Entity *spawnFighter(char *name, int x, int y, int side);
|
||||||
|
extern int isAcceptControl(void);
|
||||||
|
extern void resetAcceptControls(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -80,6 +80,11 @@ int isControl(int type)
|
||||||
return ((key != -1 && app.keyboard[key]) || (btn != -1 && app.mouse.button[btn]));
|
return ((key != -1 && app.keyboard[key]) || (btn != -1 && app.mouse.button[btn]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isAcceptControl(void)
|
||||||
|
{
|
||||||
|
return (app.keyboard[SDL_SCANCODE_SPACE] ||app.keyboard[SDL_SCANCODE_RETURN] || isControl(CONTROL_FIRE));
|
||||||
|
}
|
||||||
|
|
||||||
void clearControl(int type)
|
void clearControl(int type)
|
||||||
{
|
{
|
||||||
int key = app.keyControls[type];
|
int key = app.keyControls[type];
|
||||||
|
@ -96,6 +101,13 @@ void clearControl(int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetAcceptControls(void)
|
||||||
|
{
|
||||||
|
app.keyboard[SDL_SCANCODE_SPACE] = app.keyboard[SDL_SCANCODE_RETURN] = 0;
|
||||||
|
|
||||||
|
clearControl(CONTROL_FIRE);
|
||||||
|
}
|
||||||
|
|
||||||
void updateControlKey(char *name)
|
void updateControlKey(char *name)
|
||||||
{
|
{
|
||||||
app.keyControls[lookup(name)] = app.lastKeyPressed;
|
app.keyControls[lookup(name)] = app.lastKeyPressed;
|
||||||
|
|
Loading…
Reference in New Issue