- 2nd attempt at not playing splash sound when on pink cloud

- Reduced hurryup time on "Smile" level
- Fixed bug in uncatch()
- Chocolate is now worth 8,000 points
- Small points values now include commas
- Fixed graphical glitch with magnet and red skull powerups
This commit is contained in:
Rob Pearce 2008-11-23 05:50:02 +00:00
parent 5009b40963
commit ac160edaad
5 changed files with 98 additions and 95 deletions

View File

@ -1,6 +1,6 @@
bgfile forest2.png
bg 0
hurryup 60
hurryup 40
help
endhelp
monsters

17
defs.h
View File

@ -128,6 +128,23 @@
#define LEVELH 30 // level height (in tiles)
// keys
#define KEY_RIGHT SDLK_j
#define KEY_LEFT SDLK_g
#define KEY_UP SDLK_y
#define KEY_DOWN SDLK_h
#define KEY_SHOOT SDLK_z
#define KEY_JUMP SDLK_x
#define KEY_SLAM SDLK_c
#define KEY2_RIGHT SDLK_RIGHT
#define KEY2_LEFT SDLK_LEFT
#define KEY2_UP SDLK_UP
#define KEY2_DOWN SDLK_DOWN
#define KEY2_SHOOT SDLK_m
#define KEY2_JUMP SDLK_COMMA
#define KEY2_SLAM SDLK_PERIOD
// ice effect
#define ICE_NONE 0
#define ICE_INPROGRESS 1

159
rc.c
View File

@ -1549,21 +1549,6 @@ void die(sprite_t *s) {
}
// un-ice everything if player dies
/*
for (s2 = sprite->next ; s2 ; s2 = s2->next) {
if (s2->iced) {
s2->iced = B_FALSE;
}
}
*/
// undo water effect
/*
if (curlevel->iced == WATER_COMPLETE) {
undoflood();
curlevel->iced = B_FALSE;
}
*/
}
} else if (s == boss) { // boss effects
sprite_t *ss;
@ -6119,7 +6104,7 @@ void dogravity(sprite_t *s) {
}
// update water stats
if ((isplayer(s) || ismonster(s->id)) && (levelcomplete != LV_CLOUD) && (levelcomplete != LV_CLOUDLOOP)) {
if ((isplayer(s) || ismonster(s->id)) && !s->oncloud) {
if (isinwater(s)) {
if (!s->swimming) {
// we just entered the water
@ -7214,14 +7199,12 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
s2->dead = D_FINAL;
} else if (ismonster(s2->id)) {
addsprite(P_SMASH, s2->x, s2->y, "gnom_exp");
addsprite(P_SMASH, s2->x, s2->y, "kaboom");
s2->willbecome = P_DIAMOND;
s2->lives = 0; // for snails
if (s2->caughtby) {
uncatch(s2);
}
die(s2);
}
}
@ -7332,11 +7315,13 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
sprintf(tempm, "Attract fruits!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
pp->powerup = PW_MAGNET;
return B_TRUE;
} else if (s->id == P_BADMAGNET) {
playfx(FX_SKULL);
sprintf(tempm, "Repel fruits!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&black,&grey,POINTSDELAY, TT_NORM);
pp->powerup = PW_MAGNET;
return B_TRUE;
} else if (s->id == P_ANCHOR) {
playfx(FX_MORPH);
sprintf(tempm, "Anchor!");
@ -7881,13 +7866,13 @@ void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color
addtext(x,y,size,msg,col,delay,ttype); // main text
}
char *addcommas(char *buffer, int num) {
char *addcommas(char *buffer, long num) {
char tempbuf[MIDBUFLEN];
char *p;
char *p2;
int count;
sprintf(tempbuf, "%d",num);
sprintf(tempbuf, "%ld",num);
p2 = buffer;
p = tempbuf;
@ -7913,7 +7898,7 @@ char *addcommas(char *buffer, int num) {
return buffer;
}
int addscore(sprite_t *s, int amt) {
int addscore(sprite_t *s, long amt) {
int oldscore;
oldscore = s->score;
@ -8352,6 +8337,7 @@ void initsdl(void) {
// player collects the given fruit
void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
char tempm[MIDBUFLEN];
char tempm2[BUFLEN];
int gotscore = fruit->score;
int modscore = gotscore; // default
int i;
@ -8375,11 +8361,14 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
col = getcolour(fruit->id);
bgcol = getbgcolour(fruit->id);
if (multiplier <= 1) {
sprintf(tempm, "%d", modscore);
addcommas(tempm, modscore);
//sprintf(tempm, "%d", modscore);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, col,bgcol,POINTSDELAY,TT_NORM);
} else {
sprintf(tempm, "%d x %d" , modscore,multiplier);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, col,bgcol,POINTSDELAY,TT_NORM);
addcommas(tempm, modscore);
sprintf(tempm2, "%s x %d" , tempm,multiplier);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm2, col,bgcol,POINTSDELAY,TT_NORM);
}
}
}
@ -9159,14 +9148,14 @@ void handleinput(void) {
addcredit();
}
if (levelcomplete == LV_HELPFREEZE) {
if ((event.key.keysym.sym == SDLK_z) || (event.key.keysym.sym == SDLK_c) ||
if ((event.key.keysym.sym == KEY_SHOOT) || (event.key.keysym.sym == KEY_SLAM) ||
(event.key.keysym.sym == SDLK_s) || (event.key.keysym.sym == SDLK_f)) {
levelcomplete = oldlevelcomplete;
}
}
} else if (havejoysticks && (event.type == SDL_JOYBUTTONUP)) {
if (levelcomplete == LV_HELPFREEZE) {
if ((joybuttontokey(event.jbutton.button) == SDLK_z) || (joybuttontokey(event.jbutton.button) == SDLK_c)) {
if ((joybuttontokey(event.jbutton.button) == KEY_SHOOT) || (joybuttontokey(event.jbutton.button) == KEY_SLAM)) {
levelcomplete = oldlevelcomplete;
}
}
@ -9525,9 +9514,9 @@ void swimup(sprite_t *pl) {
int whichway;
// if not, jump up
pl->climbing = B_FALSE;
if (keydown(pnum, SDLK_RIGHT)) {
if (keydown(pnum, KEY_RIGHT)) {
whichway = 1;
} else if (keydown(pnum, SDLK_LEFT)) {
} else if (keydown(pnum, KEY_LEFT)) {
whichway = -1;
} else {
whichway = 0;
@ -9577,7 +9566,7 @@ void trytojump(sprite_t *pl) {
if (!pl->falling || (pl->doublejump && pl->doublejumpready && !pl->useddoublejump)) {
if (isonground(pl) || isonladder(pl) || pl->doublejump ) {
/* dropping through a bridge */
if (keydown(pnum,SDLK_DOWN)) {
if (keydown(pnum,KEY_DOWN)) {
if (isonbridge(pl) && !pl->falling) {
/* drop down */
pl->dropping = B_TRUE;
@ -9586,9 +9575,9 @@ void trytojump(sprite_t *pl) {
}
} else { // jumping
int whichway;
if (keydown(pnum,SDLK_RIGHT)) {
if (keydown(pnum,KEY_RIGHT)) {
whichway = 1;
} else if (keydown(pnum,SDLK_LEFT)) {
} else if (keydown(pnum,KEY_LEFT)) {
whichway = -1;
} else {
whichway = 0;
@ -9711,13 +9700,13 @@ int keydown(int whichplayer, int checkfor) {
// adjust checkkey based on player
if (whichplayer == 1) {
if (checkfor == SDLK_RIGHT) checkkey = SDLK_l;
if (checkfor == SDLK_LEFT) checkkey = SDLK_j;
if (checkfor == SDLK_UP) checkkey = SDLK_i;
if (checkfor == SDLK_DOWN) checkkey = SDLK_k;
if (checkfor == SDLK_z) checkkey = SDLK_s;
if (checkfor == SDLK_x) checkkey = SDLK_d;
if (checkfor == SDLK_c) checkkey = SDLK_f;
if (checkfor == KEY_RIGHT) checkkey = KEY2_RIGHT;
if (checkfor == KEY_LEFT) checkkey = KEY2_LEFT;
if (checkfor == KEY_UP) checkkey = KEY2_UP;
if (checkfor == KEY_DOWN) checkkey = KEY2_DOWN;
if (checkfor == KEY_SHOOT) checkkey = KEY2_SHOOT;
if (checkfor == KEY_JUMP) checkkey = KEY2_JUMP;
if (checkfor == KEY_SLAM) checkkey = KEY2_SLAM;
}
// check for keypress
if (keys[checkkey]) {
@ -9728,10 +9717,10 @@ int keydown(int whichplayer, int checkfor) {
if (havejoysticks) {
//if (joybut[keytojoybutton(checkfor)]) return B_TRUE;
if (joybuttondown(whichplayer, checkfor)) return B_TRUE;
if ((checkfor == SDLK_UP) && (joyy[whichplayer] <= -joythresh[whichplayer])) return B_TRUE;
if ((checkfor == SDLK_DOWN) && (joyy[whichplayer] >= joythresh[whichplayer])) return B_TRUE;
if ((checkfor == SDLK_LEFT) && (joyx[whichplayer] <= -joythresh[whichplayer])) return B_TRUE;
if ((checkfor == SDLK_RIGHT) && (joyx[whichplayer] >= joythresh[whichplayer])) return B_TRUE;
if ((checkfor == KEY_UP) && (joyy[whichplayer] <= -joythresh[whichplayer])) return B_TRUE;
if ((checkfor == KEY_DOWN) && (joyy[whichplayer] >= joythresh[whichplayer])) return B_TRUE;
if ((checkfor == KEY_LEFT) && (joyx[whichplayer] <= -joythresh[whichplayer])) return B_TRUE;
if ((checkfor == KEY_RIGHT) && (joyx[whichplayer] >= joythresh[whichplayer])) return B_TRUE;
}
return B_FALSE;
@ -9911,10 +9900,10 @@ void dotitlescreen(void) {
joyy[j] = SDL_JoystickGetAxis(joy[j],1);
//printf("got joy motion: joy %d, x=%d,y=%d\n",j,joyx[j],joyy[j]);
if (joyy[j] <= -6000) handletitleinput(j, SDLK_UP);
if (joyy[j] >= 6000) handletitleinput(j, SDLK_DOWN);
if (joyx[j] <= -6000) handletitleinput(j, SDLK_LEFT);
if (joyx[j] >= 6000) handletitleinput(j, SDLK_RIGHT);
if (joyy[j] <= -6000) handletitleinput(j, KEY_UP);
if (joyy[j] >= 6000) handletitleinput(j, KEY_DOWN);
if (joyx[j] <= -6000) handletitleinput(j, KEY_LEFT);
if (joyx[j] >= 6000) handletitleinput(j, KEY_RIGHT);
break;
case SDL_KEYUP:
@ -10315,7 +10304,7 @@ void startgame(void) {
void uncatch(sprite_t *s) {
if (s->caughtby) {
s->netcaught--;
s->caughtby->netcaught--;
}
s->caughtby = NULL;
s->caughtstate = B_FALSE;
@ -10333,19 +10322,19 @@ void makeinvuln(sprite_t *s) {
void setjoymappings(void) {
// ps3
joymap[4] = SDLK_UP;
joymap[5] = SDLK_RIGHT;
joymap[6] = SDLK_DOWN;
joymap[7] = SDLK_LEFT;
joymap[14] = SDLK_x; //x == jump
joymap[13] = SDLK_c; //circle = slam
joymap[12] = SDLK_z; // square/triangle = shoot
joymap[15] = SDLK_z;
joymap[4] = KEY_UP;
joymap[5] = KEY_RIGHT;
joymap[6] = KEY_DOWN;
joymap[7] = KEY_LEFT;
joymap[14] = KEY_JUMP; //x == jump
joymap[13] = KEY_SLAM; //circle = slam
joymap[12] = KEY_SHOOT; // square/triangle = shoot
joymap[15] = KEY_SHOOT;
// mame (directions are joystick)
joymap[0] = SDLK_z;
joymap[1] = SDLK_x;
joymap[2] = SDLK_c;
joymap[3] = SDLK_c;
joymap[0] = KEY_SHOOT;
joymap[1] = KEY_JUMP;
joymap[2] = KEY_SLAM;
joymap[3] = KEY_SLAM;
}
int joybuttontokey(int buttonnum) {
@ -10413,15 +10402,15 @@ void handletitleinput(int whichplayer, int key) {
}
} else if (titlemode == TS_SELECTMODE) {
// pick current mode
if (key == SDLK_UP) {
if (key == KEY_UP) {
gamemode = GM_EASY;
} else if (key == SDLK_DOWN) {
} else if (key == KEY_DOWN) {
gamemode = GM_NORM;
} else if (key == SDLK_LEFT) {
} else if (key == KEY_LEFT) {
showhelp = B_TRUE;
} else if (key == SDLK_RIGHT) {
} else if (key == KEY_RIGHT) {
showhelp = B_FALSE;
} else if ((key == SDLK_z) || (key == SDLK_RETURN)) {
} else if ((key == KEY_SHOOT) || (key == SDLK_RETURN)) {
playfx(FX_KEYPRESS);
titledone = B_TRUE;
} else if ((key == SDLK_1) || (key == SDLK_2) || (key == SDLK_RETURN)) {
@ -10792,13 +10781,13 @@ void checkhiscores(sprite_t *who){
if (keytimer == 0) {
// check for scrolling
if (keydown(pnum, SDLK_UP)) { // scroll through letters
if (keydown(pnum, KEY_UP)) { // scroll through letters
if (curlet == 'a') curlet = '*';
else if (curlet == '*') curlet = ' ';
else if (curlet == ' ') curlet = 'z';
else curlet--;
keytimer = 5;
} else if (keydown(pnum, SDLK_DOWN)) { // scroll through letters
} else if (keydown(pnum, KEY_DOWN)) { // scroll through letters
if (curlet == 'z') curlet = ' ';
else if (curlet == ' ') curlet = '*';
else if (curlet == '*') curlet = 'a';
@ -10832,9 +10821,9 @@ void checkhiscores(sprite_t *who){
}
} else {
switch (key) {
case SDLK_z:
case SDLK_x:
case SDLK_c:
case KEY_SHOOT:
case KEY_JUMP:
case KEY_SLAM:
case SDLK_5:
case SDLK_1:
key = -1;
@ -10860,14 +10849,14 @@ void checkhiscores(sprite_t *who){
playfx(FX_KEYPRESS);
finished = B_TRUE;
}
} else if ((key == SDLK_BACKSPACE) || (key == SDLK_x) || (key == SDLK_d)) {
} else if ((key == SDLK_BACKSPACE) || (key == KEY_JUMP) || (key == SDLK_d)) {
thisname[strlen(thisname)-1] = '\0';
if (strlen(thisname) == 0) {
capital = B_TRUE;
} else if (thisname[strlen(thisname)-1] == ' ') {
capital = B_TRUE;
}
} else if ((key == SDLK_z) || (key == SDLK_s)) {
} else if ((key == KEY_SHOOT) || (key == SDLK_s)) {
// add current letter or finish if it is on "end"
if (curlet == '*') {
if (strlen(thisname) > 0) {
@ -11231,27 +11220,27 @@ void doplayermovement(sprite_t *pl) {
if (pl->powerup == PW_GUNNER) {
// move crosshairs
if (keydown(pnum,SDLK_RIGHT)) {
if (keydown(pnum,KEY_RIGHT)) {
if (pl->x < 640-(TILEW/2)) {
pl->x += GUNNERSPEED;
}
}
if (keydown(pnum,SDLK_LEFT)) {
if (keydown(pnum,KEY_LEFT)) {
if (pl->x > (TILEW/2)) {
pl->x -= GUNNERSPEED;
}
}
if (keydown(pnum,SDLK_DOWN)) {
if (keydown(pnum,KEY_DOWN)) {
if (pl->y < 480-(TILEH/2)) {
pl->y += GUNNERSPEED;
}
}
if (keydown(pnum,SDLK_UP)) {
if (keydown(pnum,KEY_UP)) {
if (pl->y > (TILEH/2)) {
pl->y -= GUNNERSPEED;
}
}
if (keydown(pnum,SDLK_z)) {
if (keydown(pnum,KEY_SHOOT)) {
// shoot - add explosion
if (gundelay[pnum] == 0) {
playfx(FX_GUN);
@ -11276,14 +11265,14 @@ void doplayermovement(sprite_t *pl) {
} else moveok = B_TRUE;
if (moveok) {
if (keydown(pnum,SDLK_RIGHT)) {
if (keydown(pnum,KEY_RIGHT)) {
if (canmove(pl)) {
movex(pl, getspeed(pl));
}
if (canturn(pl)) {
pl->dir = D_RIGHT;
}
} else if (keydown(pnum,SDLK_LEFT)) {
} else if (keydown(pnum,KEY_LEFT)) {
if (canmove(pl)) {
movex(pl, -getspeed(pl));
}
@ -11293,7 +11282,7 @@ void doplayermovement(sprite_t *pl) {
}
}
if (keydown(pnum,SDLK_UP)) {
if (keydown(pnum,KEY_UP)) {
if ((pl->swimming) && (pl->hasmask)) {
// swimming
swimup(pl);
@ -11329,7 +11318,7 @@ void doplayermovement(sprite_t *pl) {
}
}
}
if (keydown(pnum,SDLK_DOWN)) {
if (keydown(pnum,KEY_DOWN)) {
if ((pl->swimming) && (pl->hasmask)) {
// swimming
swimdown(pl);
@ -11347,7 +11336,7 @@ void doplayermovement(sprite_t *pl) {
}
}
// Jump
if (keydown(pnum,SDLK_x)) {
if (keydown(pnum,KEY_JUMP)) {
trytojump(pl);
} else if (pl->jumping && pl->doublejump) {
// have to let go of jump button to double jump
@ -11356,8 +11345,8 @@ void doplayermovement(sprite_t *pl) {
}
}
// Shoot
if (keydown(pnum,SDLK_z)) {
if (!havejoysticks && keydown(pnum,SDLK_DOWN)) {
if (keydown(pnum,KEY_SHOOT)) {
if (!havejoysticks && keydown(pnum,KEY_DOWN)) {
trytoslam(pl);
} else {
trytoshoot(pl);
@ -11365,7 +11354,7 @@ void doplayermovement(sprite_t *pl) {
}
// Slam
if (keydown(pnum,SDLK_c)) {
if (keydown(pnum,KEY_SLAM)) {
trytoslam(pl);
}
}

4
rc.h
View File

@ -49,8 +49,8 @@ void dumpsprites(void);
int countmonsters(int montype);
int getpoints(int id);
int isladder(int tid);
char *addcommas(char *buffer, int num);
int addscore(sprite_t *s, int amt);
char *addcommas(char *buffer, long num);
int addscore(sprite_t *s, long amt);
void extralife(sprite_t *s);
void doice(void);
void doflood(void);

View File

@ -2977,8 +2977,8 @@ int getpoints(int id) {
case P_CAKE:
points = 3500;
break;
case P_CHOCOLATE:
points = 4000;
case P_CHOCOLATE: // LOTS
points = 8000;
break;
case P_DIAMOND:
points = 2500;
@ -3682,9 +3682,6 @@ int getrandomcard(void) {
}
}
//printf("returning cardid %d\n",cardid);
return cardid;
}