Added powerup: camera
This commit is contained in:
parent
0729cf09ba
commit
645522bff6
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 994 B |
11
defs.h
11
defs.h
|
@ -297,7 +297,7 @@
|
|||
/* enums */
|
||||
|
||||
/* sounds */
|
||||
#define MAXFX 58
|
||||
#define MAXFX 59
|
||||
#define FX_SHOOT 0
|
||||
#define FX_SLAM 1
|
||||
#define FX_KILL 2
|
||||
|
@ -356,6 +356,7 @@
|
|||
#define FX_EXTRALIFE 55
|
||||
#define FX_WARP 56
|
||||
#define FX_JETPACK 57
|
||||
#define FX_CAMERA 58
|
||||
|
||||
// card suits
|
||||
#define CS_HEART 1
|
||||
|
@ -381,7 +382,7 @@
|
|||
#define S_SLOPE 2
|
||||
|
||||
// Sprite types
|
||||
#define MAXPTYPES 149
|
||||
#define MAXPTYPES 150
|
||||
#define P_PLAYER 0
|
||||
#define P_RAT 1
|
||||
#define P_CHEESE 2
|
||||
|
@ -536,6 +537,7 @@
|
|||
#define P_MAGNET 146
|
||||
#define P_BADMAGNET 147
|
||||
#define P_JETPACK 148
|
||||
#define P_CAMERA 149
|
||||
|
||||
|
||||
#define FLY_FLYTIME 150
|
||||
|
@ -599,9 +601,10 @@
|
|||
#define PW_MAGNET 17 // magnet
|
||||
#define PW_BADMAGNET 18 // badmagnet
|
||||
#define PW_JETPACK 19 // kangaroo
|
||||
#define PW_CAMERA 20 // camera
|
||||
// "virtual" powerup for bosses
|
||||
#define PW_RATSHAKE 20 // shake screen horizontally
|
||||
#define PW_SNAILSHAKE 21 // shake screen vertically
|
||||
#define PW_RATSHAKE 50 // shake screen horizontally
|
||||
#define PW_SNAILSHAKE 51 // shake screen vertically
|
||||
|
||||
#define GUNNERSPEED 2.5 // speed crosshair moves in gunner mode
|
||||
#define GUNNERDELAY 10 // how fast gunner powerup shoots
|
||||
|
|
406
rc.c
406
rc.c
|
@ -71,6 +71,8 @@ double gunorigy[2];
|
|||
int gundelay[2];
|
||||
int guntime;
|
||||
|
||||
int cameraalpha;
|
||||
|
||||
int playedbell;
|
||||
int clocktime;
|
||||
|
||||
|
@ -632,6 +634,28 @@ int main (int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// camera flash
|
||||
if ((globpowerup == PW_CAMERA) && (cameraalpha)) {
|
||||
|
||||
SDL_Surface *whitebox;
|
||||
|
||||
whitebox = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
screen->w,
|
||||
screen->h,
|
||||
screen->format->BitsPerPixel, screen->format->Rmask,
|
||||
screen->format->Gmask,screen->format->Bmask, 0);
|
||||
SDL_FillRect(whitebox, NULL, SDL_MapRGB(screen->format,255,255,255));
|
||||
SDL_SetAlpha(whitebox, SDL_SRCALPHA, cameraalpha);
|
||||
|
||||
// clear screen
|
||||
SDL_BlitSurface(whitebox,NULL,screen,NULL);
|
||||
SDL_FreeSurface(whitebox);
|
||||
if (timer % 10 == 0) {
|
||||
cameraalpha -= 35;
|
||||
if (cameraalpha < 0) cameraalpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************
|
||||
* Collision detection
|
||||
|
@ -2922,41 +2946,45 @@ int movesprite(sprite_t *s) {
|
|||
tiletype_t *tunder;
|
||||
|
||||
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
// tile in front and below
|
||||
tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL);
|
||||
// tile below
|
||||
tunder = gettileat(s->x ,s->y + 1,NULL,NULL);
|
||||
/* if there's a hole in front of us and below*/
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
// we're on a slope
|
||||
if (tunder->solid == S_SLOPE) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
if (s->angry || boss) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
// tile in front and below
|
||||
tt = gettileat(s->x + s->dir*getspeed(s) + (s->dir * (s->img->w/2)),s->y + (TILEH/2),NULL,NULL);
|
||||
// tile below
|
||||
tunder = gettileat(s->x ,s->y + 1,NULL,NULL);
|
||||
/* if there's a hole in front of us and below*/
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
// we're on a slope
|
||||
if (tunder->solid == S_SLOPE) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
if (s->angry || boss) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -3020,28 +3048,32 @@ int movesprite(sprite_t *s) {
|
|||
int move = B_FALSE;
|
||||
int xdiff, absxdiff;
|
||||
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
tt = gettileat(s->x + s->dir+getspeed(s) + (s->dir * (s->img->w/2)),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if (s->angry || boss) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
tt = gettileat(s->x + s->dir+getspeed(s) + (s->dir * (s->img->w/2)),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if (s->angry || boss) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* either move or turn around */
|
||||
if (move) {
|
||||
rv = movex(s, s->dir*getspeed(s));
|
||||
|
@ -3101,33 +3133,37 @@ int movesprite(sprite_t *s) {
|
|||
int xdiff, absxdiff;
|
||||
|
||||
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to closest player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below and nearby, fall off */
|
||||
if (xdiff <= (TILEW*16)) {
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below and nearby, fall off */
|
||||
if (xdiff <= (TILEW*16)) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
/* if player is at same level and close, try to jump over the gap */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*9))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*9))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
/* if player is at same level and close, try to jump over the gap */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*9))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*9))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* either move or turn around */
|
||||
if (move) {
|
||||
rv = movex(s, s->dir*getspeed(s));
|
||||
|
@ -3141,39 +3177,41 @@ int movesprite(sprite_t *s) {
|
|||
|
||||
|
||||
|
||||
/* moves like an angry rat all the time */
|
||||
if ((!s->jumping) && (!s->jumptimer)) {
|
||||
/* if player is above us or at same level...*/
|
||||
if ( (player && (!player->dead) && (player->y <= s->y)) ||
|
||||
(player2 && (!player2->dead) && (player2->y <= s->y))) {
|
||||
int ydiff;
|
||||
if (globpowerup != PW_CAMERA) {
|
||||
/* moves like an angry rat all the time */
|
||||
if ((!s->jumping) && (!s->jumptimer)) {
|
||||
/* if player is above us or at same level...*/
|
||||
if ( (player && (!player->dead) && (player->y <= s->y)) ||
|
||||
(player2 && (!player2->dead) && (player2->y <= s->y))) {
|
||||
int ydiff;
|
||||
|
||||
if ( (player && (!player->dead) && (player->y <= s->y))) {
|
||||
ydiff = s->y - player->y;
|
||||
} else if (player2) {
|
||||
ydiff = s->y - player2->y;
|
||||
} else {
|
||||
ydiff = 999;
|
||||
}
|
||||
if ( (player && (!player->dead) && (player->y <= s->y))) {
|
||||
ydiff = s->y - player->y;
|
||||
} else if (player2) {
|
||||
ydiff = s->y - player2->y;
|
||||
} else {
|
||||
ydiff = 999;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isplayerabove(s) && (ydiff >= (TILEH*4)) && (ydiff <= (TILEH*8))) { // player between 4 and 8 tiles above
|
||||
|
||||
if (xdiff <= (TILEW*8)) { // if closeish horizontally
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
}
|
||||
} else if ((xdiff >= (TILEW*1)) && (xdiff <= (TILEW*10))) { // if 1-9 tiles right
|
||||
if (s->dir == D_RIGHT) {
|
||||
/* jump right */
|
||||
jump(s, D_RIGHT);
|
||||
}
|
||||
} else if ((xdiff <= -(TILEW*1)) && (xdiff >= -(TILEW*10))) { // if 1-9 tiles left
|
||||
if (s->dir == D_LEFT) {
|
||||
/* jump left */
|
||||
jump(s, D_LEFT);
|
||||
}
|
||||
}
|
||||
if (isplayerabove(s) && (ydiff >= (TILEH*4)) && (ydiff <= (TILEH*8))) { // player between 4 and 8 tiles above
|
||||
|
||||
if (xdiff <= (TILEW*8)) { // if closeish horizontally
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
}
|
||||
} else if ((xdiff >= (TILEW*1)) && (xdiff <= (TILEW*10))) { // if 1-9 tiles right
|
||||
if (s->dir == D_RIGHT) {
|
||||
/* jump right */
|
||||
jump(s, D_RIGHT);
|
||||
}
|
||||
} else if ((xdiff <= -(TILEW*1)) && (xdiff >= -(TILEW*10))) { // if 1-9 tiles left
|
||||
if (s->dir == D_LEFT) {
|
||||
/* jump left */
|
||||
jump(s, D_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // falling
|
||||
|
@ -3562,32 +3600,36 @@ int movesprite(sprite_t *s) {
|
|||
int xdiff, absxdiff;
|
||||
|
||||
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
double ycutoff = s->y + (TILEH/2);
|
||||
if ((player && (player->y >= ycutoff)) || (player2 && (player2->y >= ycutoff ))) {
|
||||
/* if player is below and nearby, fall off */
|
||||
if (xdiff <= (TILEW*16)) {
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
double ycutoff = s->y + (TILEH/2);
|
||||
if ((player && (player->y >= ycutoff)) || (player2 && (player2->y >= ycutoff ))) {
|
||||
/* if player is below and nearby, fall off */
|
||||
if (xdiff <= (TILEW*16)) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && (player2->y == s->y ))) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && (player2->y == s->y ))) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* either move or turn around */
|
||||
|
@ -3604,24 +3646,26 @@ int movesprite(sprite_t *s) {
|
|||
|
||||
|
||||
/* moves like an angry rat all the time */
|
||||
if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) {
|
||||
sprite_t *abovep;
|
||||
/* if player is above us...*/
|
||||
abovep = isplayerabove(s);
|
||||
if (abovep) {
|
||||
if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right
|
||||
/* jump right */
|
||||
jump(s, D_RIGHT);
|
||||
} else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { // if 2-3 tiles left
|
||||
/* jump left */
|
||||
jump(s, D_LEFT);
|
||||
} else if (s->y - abovep->y <= (TILEH*6)) { // player less than 6 tiles above
|
||||
if ((xdiff >= 0) && (xdiff < (TILEW*4))) { // ... and within 4 tiles
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
} else if ((xdiff <= 0) && (xdiff > -(TILEW*4))) { // ... and within 4 tiles
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
if (globpowerup != PW_CAMERA) {
|
||||
if ((playersalive()) && (!s->jumping) && (!s->jumptimer)) {
|
||||
sprite_t *abovep;
|
||||
/* if player is above us...*/
|
||||
abovep = isplayerabove(s);
|
||||
if (abovep) {
|
||||
if ((xdiff >= (TILEW*2)) && (xdiff <= (TILEW*3))) { // if 2-3 tiles right
|
||||
/* jump right */
|
||||
jump(s, D_RIGHT);
|
||||
} else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { // if 2-3 tiles left
|
||||
/* jump left */
|
||||
jump(s, D_LEFT);
|
||||
} else if (s->y - abovep->y <= (TILEH*6)) { // player less than 6 tiles above
|
||||
if ((xdiff >= 0) && (xdiff < (TILEW*4))) { // ... and within 4 tiles
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
} else if ((xdiff <= 0) && (xdiff > -(TILEW*4))) { // ... and within 4 tiles
|
||||
/* jump up */
|
||||
jump(s, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3647,35 +3691,39 @@ int movesprite(sprite_t *s) {
|
|||
int xdiff, absxdiff,ydiff;
|
||||
|
||||
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
if (globpowerup == PW_CAMERA) {
|
||||
move = B_TRUE;
|
||||
} else {
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, NULL);
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if (s->angry) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
tt = gettileat(s->x + s->dir+getspeed(s),s->y,NULL,NULL);
|
||||
/* if there's a hole in front of us */
|
||||
if (tt->solid == S_NOTSOLID) {
|
||||
if (s->angry) {
|
||||
if ((player && (player->y > s->y)) || (player2 && (player2->y > s->y))) {
|
||||
/* if player is below, fall off */
|
||||
if (xdiff <= (TILEW*8)) {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
if (s->angry) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else if ((player && (player->y == s->y)) || (player2 && player2->y == s->y)) {
|
||||
if (s->angry) {
|
||||
/* if player is at same level and close, jump */
|
||||
if ((s->dir == D_RIGHT) && (xdiff > 0) && (xdiff <= (TILEW*7))) {
|
||||
jump(s,D_RIGHT);
|
||||
} else if ((s->dir == D_LEFT) && (xdiff < 0) && (xdiff >= -(TILEW*7))) {
|
||||
jump(s,D_LEFT);
|
||||
}
|
||||
}
|
||||
} else if (level->bottomopen && (s->y >= (480 - 100)) && isplayerabove(s)) {
|
||||
// if near bottom of the screen and can fall through...
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
} else {
|
||||
move = B_TRUE;
|
||||
}
|
||||
|
||||
/* shoot */
|
||||
|
@ -3704,6 +3752,7 @@ int movesprite(sprite_t *s) {
|
|||
shoot = B_TRUE;
|
||||
}
|
||||
}
|
||||
if (globpowerup == PW_CAMERA) shoot = B_FALSE;
|
||||
if (shoot) {
|
||||
// if our shooting timer is okay
|
||||
if (s->timer1 == 0) {
|
||||
|
@ -3734,7 +3783,7 @@ int movesprite(sprite_t *s) {
|
|||
}
|
||||
|
||||
|
||||
if (s->angry) {
|
||||
if (s->angry && (globpowerup != PW_CAMERA)) {
|
||||
if (playersalive() && (!s->jumping) && (!s->jumptimer)) {
|
||||
/* if player is above us, jump */
|
||||
if ( (player && (!player->dead) && (player->y < s->y)) ||
|
||||
|
@ -3929,11 +3978,13 @@ int movesprite(sprite_t *s) {
|
|||
playerdist = playerdist2;
|
||||
}
|
||||
|
||||
if (playerdist <= (TILEW*10)) {
|
||||
s->timer1 = 0;
|
||||
s->flies = F_FLYHORZ;
|
||||
s->xs = -99;
|
||||
s->ys = -99;
|
||||
if (globpowerup != PW_CAMERA) {
|
||||
if (playerdist <= (TILEW*10)) {
|
||||
s->timer1 = 0;
|
||||
s->flies = F_FLYHORZ;
|
||||
s->xs = -99;
|
||||
s->ys = -99;
|
||||
}
|
||||
}
|
||||
|
||||
// ...and take off eventually anyway
|
||||
|
@ -7378,6 +7429,13 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) {
|
|||
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
|
||||
globpowerup = PW_ANCHOR;
|
||||
return B_TRUE;
|
||||
} else if (s->id == P_CAMERA) {
|
||||
playfx(FX_CAMERA);
|
||||
sprintf(tempm, "Blind enemies!");
|
||||
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
|
||||
globpowerup = PW_CAMERA;
|
||||
cameraalpha = 255;
|
||||
return B_TRUE;
|
||||
} else if (s->id == P_WAND) {
|
||||
sprite_t *s2;
|
||||
|
||||
|
@ -7651,6 +7709,7 @@ int initsound(void) {
|
|||
loadfx(FX_EXTRALIFE, "extralife.wav");
|
||||
loadfx(FX_WARP, "warp.wav");
|
||||
loadfx(FX_JETPACK, "jetpack.wav");
|
||||
loadfx(FX_CAMERA, "camera.wav");
|
||||
|
||||
// load sound effects
|
||||
for (i = 0; i < MAXFX; i++) {
|
||||
|
@ -9266,8 +9325,8 @@ void handleinput(void) {
|
|||
}
|
||||
if (cheat) {
|
||||
if (keydown(0, SDLK_q)) {
|
||||
//gtime = nexthurryup-1;
|
||||
gtime = nexthurryup+14;
|
||||
gtime = nexthurryup-1;
|
||||
//gtime = nexthurryup+14;
|
||||
}
|
||||
if (keydown(0, SDLK_b)) {
|
||||
//gtime = nexthurryup-1;
|
||||
|
@ -11414,6 +11473,8 @@ void doplayermovement(sprite_t *pl) {
|
|||
|
||||
double getxdisttoplayer(sprite_t *s, sprite_t **pl) {
|
||||
double xdiff1,xdiff2,xdiff;
|
||||
if (globpowerup == PW_CAMERA) return 9999;
|
||||
|
||||
/* distance to closest player */
|
||||
if (player) {
|
||||
xdiff1 = abs(player->x - s->x);
|
||||
|
@ -11442,6 +11503,8 @@ double getxdisttoplayer(sprite_t *s, sprite_t **pl) {
|
|||
double getydisttoplayer(sprite_t *s) {
|
||||
double ydiff1,ydiff2,ydiff;
|
||||
/* distance to closest player */
|
||||
if (globpowerup == PW_CAMERA) return 9999;
|
||||
|
||||
if (player) {
|
||||
ydiff1 = player->y - s->y;
|
||||
} else {
|
||||
|
@ -11465,6 +11528,8 @@ double getydisttoplayer(sprite_t *s) {
|
|||
|
||||
|
||||
sprite_t *isplayerbelow(sprite_t *s) {
|
||||
if (globpowerup == PW_CAMERA) return NULL;
|
||||
|
||||
if (player && !player->dead && player->y > s->y) return player;
|
||||
if (player2 && !player2->dead && player2->y > s->y) return player2;
|
||||
|
||||
|
@ -11472,12 +11537,17 @@ sprite_t *isplayerbelow(sprite_t *s) {
|
|||
}
|
||||
|
||||
sprite_t *isplayerabove(sprite_t *s) {
|
||||
if (globpowerup == PW_CAMERA) return NULL;
|
||||
|
||||
if (player && !player->dead && player->y < s->y) return player;
|
||||
if (player2 && !player2->dead && player2->y < s->y) return player2;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
sprite_t *isplayerright(sprite_t *s) {
|
||||
|
||||
if (globpowerup == PW_CAMERA) return NULL;
|
||||
|
||||
if (player && !player->dead && player->x > s->x) return player;
|
||||
if (player2 && !player2->dead && player2->x > s->x) return player2;
|
||||
|
||||
|
|
9
shared.c
9
shared.c
|
@ -1563,6 +1563,9 @@ int loadimagesets(void) {
|
|||
loadspriteimage(P_JETPACK,F_WALK1, "sprites/jetpack.png");
|
||||
imageset[P_JETPACK].numimages = 1;
|
||||
|
||||
loadspriteimage(P_CAMERA,F_WALK1, "sprites/camera.png");
|
||||
imageset[P_CAMERA].numimages = 1;
|
||||
|
||||
loadspriteimage(P_ZAPPOWERUP,F_WALK1, "sprites/zapper.png");
|
||||
imageset[P_ZAPPOWERUP].numimages = 1;
|
||||
|
||||
|
@ -2459,6 +2462,7 @@ int isfruit(int id) {
|
|||
case P_MAGNET:
|
||||
case P_BADMAGNET:
|
||||
case P_JETPACK:
|
||||
case P_CAMERA:
|
||||
return FT_TEMP;
|
||||
/* flowers */
|
||||
case P_FLOWERYELLOW:
|
||||
|
@ -3102,7 +3106,7 @@ int loadlevellist(void) {
|
|||
|
||||
int randompowerup(void) {
|
||||
int num;
|
||||
num = rand() % 42;
|
||||
num = rand() % 43;
|
||||
|
||||
switch (num) {
|
||||
case 0:
|
||||
|
@ -3195,6 +3199,8 @@ int randompowerup(void) {
|
|||
return P_BADMAGNET;
|
||||
case 41:
|
||||
return P_JETPACK;
|
||||
case 42:
|
||||
return P_CAMERA;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3346,6 +3352,7 @@ void setfruitinfo(void) {
|
|||
setinfo(P_MAGNET, "Magnet", "Collecting this powerup will align the magnetic forces of the earth in your favour, attracting all nearby fruits towards you.", "magnet.png");
|
||||
setinfo(P_BADMAGNET, "Red Skull", "This skull curses you and will repel fruits away from you, denying you access to them!", "badmagnet.png");
|
||||
setinfo(P_JETPACK, "Jetpack", "For the remainder of the current level, the jetpack's thrust will add to your jumping ability!", "jetpack.png");
|
||||
setinfo(P_CAMERA, "Camera", "Creates a bright flash of light, blinding all enemies.", "camera.png");
|
||||
setinfo(P_ZAPPOWERUP, "Bug Zapper", "Zaps nearby enemies with miniature bolts of lightning", "zapper.png");
|
||||
setinfo(P_SKULL, "Green Skull", "Avoid these at all costs! The green skull will cause you to lose all net powerups.", "skull.png");
|
||||
setinfo(P_CLOVER, "4-Leaf Clover", "Increases your luck...", "clover.png");
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -81,8 +81,9 @@
|
|||
<td align=center><img src="img/magnet.png"><br>Magnet</td><td>Collecting this powerup will align the magnetic forces of the earth in your favour, attracting all nearby fruits towards you.</td>
|
||||
</tr><tr><td align=center><img src="img/badmagnet.png"><br>Red Skull</td><td>This skull curses you and will repel fruits away from you, denying you access to them!</td>
|
||||
<td align=center><img src="img/jetpack.png"><br>Jetpack</td><td>For the remainder of the current level, the jetpack's thrust will add to your jumping ability!</td>
|
||||
</tr><tr><td align=center><font color="ff00ff"><b><big>?</big></b></font><br>Random</td><td>Gives you a random effect...</td>
|
||||
<td colspan=2> </td></tr><tr bgcolor="#ffff00"><th colspan=4>Super Powerups</th></tr>
|
||||
</tr><tr><td align=center><img src="img/camera.png"><br>Camera</td><td>Creates a bright flash of light, blinding all enemies.</td>
|
||||
<td align=center><font color="ff00ff"><b><big>?</big></b></font><br>Random</td><td>Gives you a random effect...</td>
|
||||
</tr><tr bgcolor="#ffff00"><th colspan=4>Super Powerups</th></tr>
|
||||
<tr><td align=center><img src="img/bigspeed.png"><br>Big Speed Up</td><td>Makes you walk faster, permenantly!</td>
|
||||
<td align=center><img src="img/bigscuba.png"><br>Big Scuba Mask</td><td>Permenantly gives you fast underwater movement.</td>
|
||||
</tr></table>
|
||||
|
|
Loading…
Reference in New Issue