Modified behaviour of scuba mask - now makes it easier to move underwater
This commit is contained in:
parent
93ee197f1d
commit
fe240dcdb4
118
rc.c
118
rc.c
|
@ -5072,18 +5072,24 @@ void dogravity(sprite_t *s) {
|
||||||
// do nothing
|
// do nothing
|
||||||
//} else {
|
//} else {
|
||||||
//if (!s->climbing) {
|
//if (!s->climbing) {
|
||||||
if (s->falling == B_FALSE) {
|
if (s->falling == B_FALSE) {
|
||||||
s->fallspeed = 1;
|
s->fallspeed = 1;
|
||||||
}
|
}
|
||||||
s->falling = B_TRUE;
|
s->falling = B_TRUE;
|
||||||
if (isinwater(s) && !s->iced) {
|
if (isinwater(s) && !s->iced) {
|
||||||
s->y += (s->fallspeed/2);
|
if (s->hasmask) {
|
||||||
|
// bob around
|
||||||
|
s->y += (sin(timer/5)/3);
|
||||||
} else {
|
} else {
|
||||||
s->y += s->fallspeed;
|
// sink
|
||||||
}
|
s->y += (s->fallspeed/2);
|
||||||
if ((timer % 10 == 0) && (s->fallspeed < FALLSPEED)) {
|
|
||||||
s->fallspeed++;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
s->y += s->fallspeed;
|
||||||
|
}
|
||||||
|
if ((timer % 10 == 0) && (s->fallspeed < FALLSPEED)) {
|
||||||
|
s->fallspeed++;
|
||||||
|
}
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -7664,6 +7670,7 @@ if (cheat) {
|
||||||
player->netsticky = B_TRUE;
|
player->netsticky = B_TRUE;
|
||||||
player->doublejump = B_TRUE;
|
player->doublejump = B_TRUE;
|
||||||
player->hasbell = B_TRUE;
|
player->hasbell = B_TRUE;
|
||||||
|
player->hasmask = B_TRUE;
|
||||||
sprintf(tempm, "Cheat!");
|
sprintf(tempm, "Cheat!");
|
||||||
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
|
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
|
||||||
toggletimer = 80;
|
toggletimer = 80;
|
||||||
|
@ -7797,7 +7804,11 @@ if (cheat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keydown(SDLK_UP)) {
|
if (keydown(SDLK_UP)) {
|
||||||
if (!player->netting && !player->slamming && !player->jumping) {
|
if ((player->swimming) && (player->hasmask)) {
|
||||||
|
// swimming
|
||||||
|
swimup(player);
|
||||||
|
} else if (!player->netting && !player->slamming && !player->jumping) {
|
||||||
|
// climbing
|
||||||
if (player->climbing) {
|
if (player->climbing) {
|
||||||
int ladderx = isladderabove(player);
|
int ladderx = isladderabove(player);
|
||||||
// if tile above is non-solid, or a ladder
|
// if tile above is non-solid, or a ladder
|
||||||
|
@ -7829,7 +7840,10 @@ if (cheat) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keydown(SDLK_DOWN)) {
|
if (keydown(SDLK_DOWN)) {
|
||||||
if (!player->netting && !player->slamming && !player->jumping) {
|
if ((player->swimming) && (player->hasmask)) {
|
||||||
|
// swimming
|
||||||
|
swimdown(player);
|
||||||
|
} else if (!player->netting && !player->slamming && !player->jumping) {
|
||||||
int ladderx = isonladder(player);
|
int ladderx = isonladder(player);
|
||||||
if (ladderx) {
|
if (ladderx) {
|
||||||
player->y += getspeed(player);
|
player->y += getspeed(player);
|
||||||
|
@ -7874,6 +7888,55 @@ if (cheat) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void swimup(sprite_t *pl) {
|
||||||
|
pl->falling = B_FALSE;
|
||||||
|
if (!isroofabove(pl)) {
|
||||||
|
// is there water above us too?
|
||||||
|
if (isinwaterpoint(pl->x, pl->y-TILEH)) {
|
||||||
|
double swimspeed;
|
||||||
|
|
||||||
|
swimspeed = getspeed(pl);
|
||||||
|
if (pl->hasmask) {
|
||||||
|
swimspeed *= 1.5;
|
||||||
|
} else {
|
||||||
|
swimspeed *= 2;
|
||||||
|
}
|
||||||
|
// if so, swim up
|
||||||
|
pl->y -= swimspeed;
|
||||||
|
} else {
|
||||||
|
int whichway;
|
||||||
|
// if not, jump up
|
||||||
|
pl->climbing = B_FALSE;
|
||||||
|
if (keydown(SDLK_RIGHT)) {
|
||||||
|
whichway = 1;
|
||||||
|
} else if (keydown(SDLK_LEFT)) {
|
||||||
|
whichway = -1;
|
||||||
|
} else {
|
||||||
|
whichway = 0;
|
||||||
|
}
|
||||||
|
playfx(FX_SPLASH);
|
||||||
|
jump(pl, whichway);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void swimdown(sprite_t *pl) {
|
||||||
|
pl->falling = B_FALSE;
|
||||||
|
if (!isonground(pl)) {
|
||||||
|
double swimspeed;
|
||||||
|
// swim down
|
||||||
|
swimspeed = getspeed(pl);
|
||||||
|
if (pl->hasmask) {
|
||||||
|
swimspeed *= 1.5;
|
||||||
|
} else {
|
||||||
|
swimspeed *= 2;
|
||||||
|
}
|
||||||
|
pl->y += swimspeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void trytojump(sprite_t *pl) {
|
void trytojump(sprite_t *pl) {
|
||||||
// can't jump while slamming
|
// can't jump while slamming
|
||||||
if (pl->slamming) return;
|
if (pl->slamming) return;
|
||||||
|
@ -7881,36 +7944,7 @@ void trytojump(sprite_t *pl) {
|
||||||
if (isinwater(pl)) { // in water?
|
if (isinwater(pl)) { // in water?
|
||||||
// swim up
|
// swim up
|
||||||
if (!pl->jumping) {
|
if (!pl->jumping) {
|
||||||
pl->falling = B_FALSE;
|
swimup(pl);
|
||||||
if (!isroofabove(pl)) {
|
|
||||||
// is there water above us too?
|
|
||||||
if (isinwaterpoint(pl->x, pl->y-TILEH)) {
|
|
||||||
double swimspeed;
|
|
||||||
|
|
||||||
swimspeed = getspeed(pl);
|
|
||||||
if (pl->hasmask) {
|
|
||||||
swimspeed *= 1.5;
|
|
||||||
} else {
|
|
||||||
swimspeed *= 2;
|
|
||||||
}
|
|
||||||
// if so, swim up
|
|
||||||
pl->y -= swimspeed;
|
|
||||||
} else {
|
|
||||||
int whichway;
|
|
||||||
// if not, jump up
|
|
||||||
pl->climbing = B_FALSE;
|
|
||||||
if (keydown(SDLK_RIGHT)) {
|
|
||||||
whichway = 1;
|
|
||||||
} else if (keydown(SDLK_LEFT)) {
|
|
||||||
whichway = -1;
|
|
||||||
} else {
|
|
||||||
whichway = 0;
|
|
||||||
}
|
|
||||||
playfx(FX_SPLASH);
|
|
||||||
jump(pl, whichway);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else { // not in water
|
} else { // not in water
|
||||||
// jump
|
// jump
|
||||||
|
|
Loading…
Reference in New Issue