Modified behaviour of scuba mask - now makes it easier to move underwater
This commit is contained in:
parent
93ee197f1d
commit
fe240dcdb4
52
rc.c
52
rc.c
|
@ -5077,7 +5077,13 @@ void dogravity(sprite_t *s) {
|
|||
}
|
||||
s->falling = B_TRUE;
|
||||
if (isinwater(s) && !s->iced) {
|
||||
if (s->hasmask) {
|
||||
// bob around
|
||||
s->y += (sin(timer/5)/3);
|
||||
} else {
|
||||
// sink
|
||||
s->y += (s->fallspeed/2);
|
||||
}
|
||||
} else {
|
||||
s->y += s->fallspeed;
|
||||
}
|
||||
|
@ -7664,6 +7670,7 @@ if (cheat) {
|
|||
player->netsticky = B_TRUE;
|
||||
player->doublejump = B_TRUE;
|
||||
player->hasbell = B_TRUE;
|
||||
player->hasmask = B_TRUE;
|
||||
sprintf(tempm, "Cheat!");
|
||||
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
|
||||
toggletimer = 80;
|
||||
|
@ -7797,7 +7804,11 @@ if (cheat) {
|
|||
}
|
||||
|
||||
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) {
|
||||
int ladderx = isladderabove(player);
|
||||
// if tile above is non-solid, or a ladder
|
||||
|
@ -7829,7 +7840,10 @@ if (cheat) {
|
|||
}
|
||||
}
|
||||
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);
|
||||
if (ladderx) {
|
||||
player->y += getspeed(player);
|
||||
|
@ -7874,13 +7888,7 @@ if (cheat) {
|
|||
|
||||
|
||||
|
||||
void trytojump(sprite_t *pl) {
|
||||
// can't jump while slamming
|
||||
if (pl->slamming) return;
|
||||
|
||||
if (isinwater(pl)) { // in water?
|
||||
// swim up
|
||||
if (!pl->jumping) {
|
||||
void swimup(sprite_t *pl) {
|
||||
pl->falling = B_FALSE;
|
||||
if (!isroofabove(pl)) {
|
||||
// is there water above us too?
|
||||
|
@ -7911,6 +7919,32 @@ void trytojump(sprite_t *pl) {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
// can't jump while slamming
|
||||
if (pl->slamming) return;
|
||||
|
||||
if (isinwater(pl)) { // in water?
|
||||
// swim up
|
||||
if (!pl->jumping) {
|
||||
swimup(pl);
|
||||
}
|
||||
} else { // not in water
|
||||
// jump
|
||||
|
|
Loading…
Reference in New Issue