- Rings now give more points, but get disabled at HurryUp time

- Fixed up insanely high hurryup times on some levels
- Fixed bug where editor would default to random high hurryup time
- Added "Nice catch!" feature - 4x points for grabbing a fruit just as it lands
This commit is contained in:
Rob Pearce 2008-10-10 01:30:40 +00:00
parent 8f66a5b52e
commit 79a3ea6549
17 changed files with 69 additions and 29 deletions

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

View File

@ -1,6 +1,6 @@
bgfile backgrounds/forest2.png
bg 0
hurryup 136
hurryup 45
help
endhelp
monsters

View File

@ -1,6 +1,6 @@
bgfile backgrounds/forest2.png
bg 0
hurryup 328
hurryup 30
help
Jump onto trampolines to bounce high...
endhelp

View File

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

View File

@ -1,6 +1,6 @@
bgfile
bg 0
hurryup 232
hurryup 30
help
endhelp
monsters

View File

@ -1,6 +1,6 @@
bgfile
bg 0
hurryup 232
hurryup 45
help
endhelp
monsters

View File

@ -1,6 +1,6 @@
bgfile backgrounds/beach1.png
bg 0
hurryup 136
hurryup 30
help
Drop through the bottom of this level
endhelp

View File

@ -1,6 +1,6 @@
bgfile backgrounds/forest2.png
bg 0
hurryup 40
hurryup 30
help
You can walk through spikes safely.
But don't fall on them!

View File

@ -1,6 +1,6 @@
bgfile backgrounds/forest2.png
bg 0
hurryup 120
hurryup 30
help
Drop through bridges with Down+X
endhelp

View File

@ -1,6 +1,6 @@
bgfile
bg 0
hurryup 248
hurryup 30
help
Rolling logs will push you along.
endhelp

View File

@ -1,6 +1,6 @@
bgfile backgrounds/forest2.png
bg 0
hurryup 616
hurryup 30
help
endhelp
monsters

7
defs.h
View File

@ -38,6 +38,7 @@
#define TEXTSIZE_DEATH 20
#define TEXTSIZE_LEVEL2 22
#define TEXTSIZE_BIFF 26
#define TEXTSIZE_MULTI 26
#define TEXTSIZE_LEVEL 32
#define TEXTSIZE_LIFE 36
#define TEXTSIZE_BOMB 36
@ -51,6 +52,7 @@
// how long to keep various text on the screen
#define POINTSDELAY 40
#define BONUSDELAY 50
#define MULTIDELAY 50
#define HURRYDELAY 50
#define LIFEDELAY 50
#define LEVELWINDELAY 80
@ -158,7 +160,8 @@
#define FT_FRUIT 1
#define FT_PERM 2
#define FT_TEMP 3
#define FT_OTHER 4
#define FT_GEM 4
#define FT_OTHER 5
// monster types
#define MT_MONSTER 1
@ -571,7 +574,7 @@ imageset_t imageset[MAXPTYPES];
/* external globals */
extern SDL_Color black;
extern SDL_Surface *screen, *temps, *levelbg, *head, *headsmall, *icecube;
extern SDL_Surface *screen, *temps, *levelbg, *head, *icecube;
extern SDL_Surface *healthbar[];
extern SDL_Surface *greenbox;
extern sprite_t *sprite, *lastsprite, *player, *boss;

4
edit.c
View File

@ -1210,6 +1210,10 @@ void newlevel(void) {
levelentry[curlevelnum].id = maxlevid;
// default
curlevel->hurryuptime = 30;
curlevel->exitdir = D_RIGHT;
sprintf(tempm,"Made new level '%s'\n",levelentry[curlevelnum].filename);
setstatustext(tempm, &green);

View File

@ -17,7 +17,7 @@ char *datadir;
SDL_Surface *levelbg; // level background image
SDL_Surface *temps; // temporary surface
SDL_Surface *screen; // the actual video screen
SDL_Surface *head,*headsmall; // img in corner showing number of lives
SDL_Surface *head; // img in corner showing number of lives
SDL_Surface *icecube; // overlaid on frozen monsters
SDL_Surface *greenbox; // for fly spray effect
SDL_Surface *healthbar[HEALTHFRAMES]; // for boss health

52
rc.c
View File

@ -330,8 +330,8 @@ int main (int argc, char **argv) {
if (!paused) {
if (keys[SDLK_q]) {
//gtime = nexthurryup-1;
gtime = nexthurryup+14;
gtime = nexthurryup-1;
//gtime = nexthurryup+14;
}
if (keys[SDLK_l]) {
if (toggletimer == 0) {
@ -901,12 +901,20 @@ void tick(void) {
if (!isbosslevel(curlevelnum)) {
if (gtime == nexthurryup) {
if (!levelcomplete) {
// all sprites get angry and un-iced
for (s = sprite; s; s = s->next) {
if ((s != player) && (ismonster(s->id))) {
s->angry = B_TRUE;
s->iced = B_FALSE;
}
}
// rings are disabled
if ((player->powerup == PW_RINGWALK) || (player->powerup == PW_RINGJUMP)) {
player->powerup = B_FALSE;
}
addoutlinetext(320,240,TEXTSIZE_HURRY, "Hurry up!", &yellow,&black,HURRYDELAY);
stopmusic();
@ -1360,7 +1368,7 @@ void checkcollide(sprite_t *s) {
// we hit something!
if (s->netsticky && isfruit(s2->id)) {
getfruit(s, s2);
getfruit(s, s2, 1);
} else {
// Otherwise, it must be a monster
@ -1429,7 +1437,7 @@ void checkcollide(sprite_t *s) {
if (s == player) {
//if (isfruit(s2->id) && (s2->teleporting == 0)) {
if (isfruit(s2->id)) {
getfruit(player, s2);
getfruit(player, s2, 1);
} else if (ismonster(s2->id) || isbullet(s2->id)) {
if (s2->iced) {
// monster dies
@ -1769,6 +1777,24 @@ if (s->id == P_PUFF) printf("PUFF WITH DOOMCOUNT!\n");
newsp->watertimer = rand() % BUBBLETIME;
}
// is it a points fruit appearing on top of us?
if (isfruit(newsp->id) == FT_FRUIT) {
int xdiff,ydiff;
/* now check for collision with us */
xdiff = player->x - newsp->x;
if (xdiff < 0) xdiff = -xdiff;
ydiff = (player->y-(player->img->h/2)) - (newsp->y-(newsp->img->h/2));
if (ydiff < 0) ydiff = -ydiff;
// appeared on top of us
if ((xdiff <= player->img->w/2 + newsp->img->w/2) &&
(ydiff <= player->img->h/2 + newsp->img->h/2)) {
// bonus!
getfruit(player, newsp, 4);
addoutlinetext(player->x,player->y - (player->img->h*1.5), TEXTSIZE_MULTI, "Nice catch!", &green,&black,MULTIDELAY);
}
}
}
}
@ -3873,7 +3899,7 @@ void dogravity(sprite_t *s) {
addsprite(P_SPARKLE, xx, yy, "sparkle");
// gain points
addscore(player, 20);
addscore(player, 65);
}
}
}
@ -4331,7 +4357,7 @@ int movex(sprite_t *s,double amt) {
addsprite(P_SPARKLE, xx, yy, "sparkle");
// gain points
addscore(player, 3);
addscore(player, 15);
}
}
}
@ -5265,18 +5291,24 @@ void initsdl(void) {
}
// player collects the given fruit
void getfruit(sprite_t *giveto, sprite_t *fruit) {
void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
char tempm[MIDBUFLEN];
int gotscore = fruit->score;
/* kill the fruit */
fruit->dead = D_FINAL;
/* give points to the player */
addscore(giveto, gotscore);
addscore(giveto, gotscore*multiplier);
/* handle fruit effects */
if (!dofruiteffect(fruit)) {
playfx(FX_FRUIT);
sprintf(tempm, "%d", gotscore);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, &white,&black,POINTSDELAY);
if (multiplier <= 1) {
sprintf(tempm, "%d", gotscore);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, &white,&black,POINTSDELAY);
} else {
sprintf(tempm, "%d x %d" , gotscore,multiplier);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, &white,&black,POINTSDELAY);
}
}
}

2
rc.h
View File

@ -65,4 +65,4 @@ int getjumpdelay(int mid);
void togglepause(void);
void togglefullscreen(void);
void initsdl(void);
void getfruit(sprite_t *giveto, sprite_t *fruit);
void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier);

View File

@ -945,8 +945,6 @@ int loadimagesets(void) {
sprintf(tempfile, "%s/sprites/dwarfhead.png",datadir);
head = IMG_Load(tempfile);
sprintf(tempfile, "%s/sprites/dwarfhead-small.png",datadir);
headsmall = IMG_Load(tempfile);
sprintf(tempfile, "%s/sprites/icecube.png",datadir);
icecube = IMG_Load(tempfile);
@ -1148,7 +1146,7 @@ int loadimagesets(void) {
loadspriteimage(P_BOMB,F_WALK1, "sprites/bomb.png");
imageset[P_BOMB].numimages = 1;
loadspriteimage(P_LIFE,F_WALK1, "sprites/dwarfhead-small.png");
loadspriteimage(P_LIFE,F_WALK1, "sprites/extralife.png");
imageset[P_LIFE].numimages = 1;
loadspriteimage(P_PHONE,F_WALK1, "sprites/phone.png");
@ -1693,7 +1691,7 @@ int isfruit(int id) {
case P_GEMYELLOW:
case P_GEMRED:
case P_GEMPURPLE:
return FT_FRUIT;
return FT_GEM;
/* misc */
case P_POWERUPPOS:
return FT_OTHER;
@ -2326,6 +2324,9 @@ int randompowerup(void) {
int num;
num = rand() % 22;
return P_RINGGOLD;
switch (num) {
case 0:
default:
@ -2527,7 +2528,7 @@ void dumpinfo(void) {
// fruits
printf("<tr><th colspan=2>Fruits</th></tr>\n");
for (i = 0; i < MAXPTYPES; i++) {
if (isfruit(i) == FT_FRUIT) {
if ((isfruit(i) == FT_FRUIT) || (isfruit(i) == FT_GEM)) {
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>Worth %d points.</td></tr>\n",
spriteinfo[i].file, spriteinfo[i].name,getpoints(i));
}