- Removed usage of debug keys without cheat mode
- Modified display of hiscores on title screen - Code to make joystick work during hiscore entry
This commit is contained in:
parent
14b9b25098
commit
7ed58e0d65
126
rc.c
126
rc.c
|
@ -6765,27 +6765,7 @@ char *getpokermsg2(int effect, char *buf) {
|
|||
|
||||
|
||||
void handleinput(void) {
|
||||
int i;
|
||||
SDL_Event event;
|
||||
|
||||
|
||||
/*
|
||||
if (levelcomplete == LV_HELPFREEZE) {
|
||||
// handle keys differently
|
||||
// we only care about a single keyup event
|
||||
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_KEYUP) {
|
||||
if (event.key.keysym.sym == SDLK_z) {
|
||||
levelcomplete = oldlevelcomplete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
/* check for key releases */
|
||||
SDL_PumpEvents();
|
||||
|
@ -6812,17 +6792,8 @@ void handleinput(void) {
|
|||
// don't accept other input in helpfreeze state
|
||||
if (levelcomplete == LV_HELPFREEZE) return;
|
||||
|
||||
// now handle key preses
|
||||
keys = SDL_GetKeyState(NULL);
|
||||
|
||||
// check for joystick
|
||||
if (havejoysticks) {
|
||||
joyx = SDL_JoystickGetAxis(joy,0);
|
||||
joyy = SDL_JoystickGetAxis(joy,1);
|
||||
for (i = 0; i < joybuttons; i++) {
|
||||
joybut[i] = SDL_JoystickGetButton(joy,i);
|
||||
}
|
||||
}
|
||||
// now handle key preses /joystick
|
||||
getinput();
|
||||
|
||||
|
||||
|
||||
|
@ -6830,39 +6801,7 @@ void handleinput(void) {
|
|||
These keys can always be pressed
|
||||
************************************************************/
|
||||
|
||||
if (keydown(SDLK_d)) {
|
||||
sprite_t *s2,*nexts;
|
||||
// set powerup
|
||||
player->powerup = PW_PHONE;
|
||||
skiplevels = 4;
|
||||
// kill all enemies
|
||||
for (s2 = sprite; s2 ; s2 = nexts) {
|
||||
nexts = s2->next;
|
||||
if (isbullet(s2->id) || ismonster(s2->id)) {
|
||||
s2->dead = D_FINAL;
|
||||
|
||||
if (s2->caughtby) {
|
||||
uncatch(s2);
|
||||
player->netcaught--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (keydown(SDLK_c)) { // cheat
|
||||
if (toggletimer == 0) {
|
||||
// all powerups
|
||||
playfx(FX_POWERUP);
|
||||
player->netmax = 4; // all nets
|
||||
player->netbig = B_TRUE; // big net
|
||||
player->speed = 2; // fast
|
||||
player->netsticky = B_TRUE;
|
||||
player->doublejump = B_TRUE;
|
||||
sprintf(tempm, "Cheat!");
|
||||
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
|
||||
toggletimer = 80;
|
||||
}
|
||||
}
|
||||
// toggle fullscreen
|
||||
if (keydown(SDLK_f)) {
|
||||
if (toggletimer == 0) {
|
||||
|
@ -6913,6 +6852,20 @@ if (cheat) {
|
|||
toggletimer = 30;
|
||||
}
|
||||
}
|
||||
if (keydown(SDLK_c)) { // cheat
|
||||
if (toggletimer == 0) {
|
||||
// all powerups
|
||||
playfx(FX_POWERUP);
|
||||
player->netmax = 4; // all nets
|
||||
player->netbig = B_TRUE; // big net
|
||||
player->speed = 2; // fast
|
||||
player->netsticky = B_TRUE;
|
||||
player->doublejump = B_TRUE;
|
||||
sprintf(tempm, "Cheat!");
|
||||
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
|
||||
toggletimer = 80;
|
||||
}
|
||||
}
|
||||
if (keydown(SDLK_n)) {
|
||||
if (toggletimer == 0) {
|
||||
// nextlevel();
|
||||
|
@ -6951,6 +6904,24 @@ if (cheat) {
|
|||
toggletimer = 50;
|
||||
}
|
||||
}
|
||||
if (keydown(SDLK_d)) {
|
||||
sprite_t *s2,*nexts;
|
||||
// set powerup
|
||||
player->powerup = PW_PHONE;
|
||||
skiplevels = 4;
|
||||
// kill all enemies
|
||||
for (s2 = sprite; s2 ; s2 = nexts) {
|
||||
nexts = s2->next;
|
||||
if (isbullet(s2->id) || ismonster(s2->id)) {
|
||||
s2->dead = D_FINAL;
|
||||
|
||||
if (s2->caughtby) {
|
||||
uncatch(s2);
|
||||
player->netcaught--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -7961,7 +7932,9 @@ void checkhiscores(void){
|
|||
timer = 0;
|
||||
}
|
||||
|
||||
keys = SDL_GetKeyState(NULL);
|
||||
|
||||
getinput();
|
||||
|
||||
if (keytimer == 0) {
|
||||
// check for scrolling
|
||||
if (keydown(SDLK_UP)) { // scroll through letters
|
||||
|
@ -8092,13 +8065,12 @@ void showhiscores(void){
|
|||
|
||||
drawhiscores();
|
||||
|
||||
// wait for a key...
|
||||
// check for a key...
|
||||
if (SDL_PollEvent(&event)) {
|
||||
int key = -1;
|
||||
switch (event.type) {
|
||||
case SDL_KEYUP:
|
||||
key = event.key.keysym.sym;
|
||||
|
||||
break;
|
||||
case SDL_JOYBUTTONUP:
|
||||
key = joybuttontokey(event.jbutton.button);
|
||||
|
@ -8109,7 +8081,8 @@ void showhiscores(void){
|
|||
if (key == SDLK_ESCAPE) {
|
||||
// quit
|
||||
exit(0);
|
||||
} else if ((key == SDLK_1) || (key == SDLK_2) || (key == SDLK_RETURN) || (key == SDLK_z)) {
|
||||
} else if ((key == SDLK_1) || (key == SDLK_2)) {
|
||||
// 1up buttons
|
||||
finished = B_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -8251,3 +8224,22 @@ void drawhiscores(void) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// read keyboard info
|
||||
void getinput(void) {
|
||||
int i;
|
||||
keys = SDL_GetKeyState(NULL);
|
||||
if (havejoysticks) {
|
||||
joyx = SDL_JoystickGetAxis(joy,0);
|
||||
joyy = SDL_JoystickGetAxis(joy,1);
|
||||
for (i = 0; i < joybuttons; i++) {
|
||||
joybut[i] = SDL_JoystickGetButton(joy,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue