Modified ice inertia to be more realistic
This commit is contained in:
parent
51d8c97b9e
commit
67c4d16d92
|
@ -6,7 +6,7 @@ endhelp
|
||||||
monsters
|
monsters
|
||||||
0 5 23
|
0 5 23
|
||||||
134 37 24
|
134 37 24
|
||||||
50 11 23
|
6 20 10
|
||||||
endmonsters
|
endmonsters
|
||||||
exitdir 1
|
exitdir 1
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
@ -17,6 +17,11 @@ exitdir 1
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
4,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
||||||
|
4,0,0,0,0,0,0,0,0,0,0,0,0,1,0,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,0,4,
|
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,4,
|
|
||||||
4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
|
||||||
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
|
|
||||||
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,
|
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,
|
||||||
layer2
|
layer2
|
||||||
|
|
5
defs.h
5
defs.h
|
@ -203,6 +203,11 @@
|
||||||
#define BELLTIME 20 // how long the bell flash lasts
|
#define BELLTIME 20 // how long the bell flash lasts
|
||||||
#define CLOCKTIME 10 // how many seconds a clock lasts
|
#define CLOCKTIME 10 // how many seconds a clock lasts
|
||||||
|
|
||||||
|
|
||||||
|
// ice
|
||||||
|
#define ICEACCEL 0.1
|
||||||
|
#define ICEDECCEL 0
|
||||||
|
|
||||||
// blackcloud
|
// blackcloud
|
||||||
#define CLOUDGROWSPEED 25 // lower is faster
|
#define CLOUDGROWSPEED 25 // lower is faster
|
||||||
#define CLOUDGROWAMT 0.01 // lower is faster
|
#define CLOUDGROWAMT 0.01 // lower is faster
|
||||||
|
|
181
rc.c
181
rc.c
|
@ -1396,7 +1396,6 @@ void jump(sprite_t *s, int dir) {
|
||||||
s->jumping = 1;
|
s->jumping = 1;
|
||||||
s->dir = -s->jumpdir; // face backwards
|
s->dir = -s->jumpdir; // face backwards
|
||||||
} else {
|
} else {
|
||||||
// TODO: check this (the * getspeed bit)!
|
|
||||||
//s->jumpdir = s->dir * getspeed(s);
|
//s->jumpdir = s->dir * getspeed(s);
|
||||||
s->jumpdir = dir;
|
s->jumpdir = dir;
|
||||||
if (s->jumpdir != 0) {
|
if (s->jumpdir != 0) {
|
||||||
|
@ -1449,13 +1448,17 @@ void jump(sprite_t *s, int dir) {
|
||||||
if (!haspowerup(s, P_SPEED) == 1) s->jumpdir--; // go fast even if player is slow
|
if (!haspowerup(s, P_SPEED) == 1) s->jumpdir--; // go fast even if player is slow
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
tt= gettileat(s->x, s->y, NULL, NULL);
|
||||||
// if on rollers, they add to your inertia
|
// if on rollers, they add to your inertia
|
||||||
// if you are facing their direction
|
// if you are facing their direction
|
||||||
tt= gettileat(s->x, s->y, NULL, NULL);
|
|
||||||
if ((tt->id == T_RIGHT) && (s->jumpdir > 0)) {
|
if ((tt->id == T_RIGHT) && (s->jumpdir > 0)) {
|
||||||
s->jumpdir++;
|
s->jumpdir++;
|
||||||
} else if ((tt->id == T_LEFT) && (s->jumpdir < 0)) {
|
} else if ((tt->id == T_LEFT) && (s->jumpdir < 0)) {
|
||||||
s->jumpdir--;
|
s->jumpdir--;
|
||||||
|
} else if (isice(tt->id)) {
|
||||||
|
s->jumpdir = s->xs / getspeed(s);
|
||||||
|
//if (s->jumpdir > getspeed(s)) s->jumpdir -= getspeed(s);
|
||||||
|
//if (s->jumpdir < -getspeed(s)) s->jumpdir += getspeed(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2478,7 +2481,7 @@ int movesprite(sprite_t *s) {
|
||||||
}
|
}
|
||||||
} else if (s->jumping) {
|
} else if (s->jumping) {
|
||||||
if (s->id != P_KINGRAT) {
|
if (s->id != P_KINGRAT) {
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2964,7 +2967,7 @@ int movesprite(sprite_t *s) {
|
||||||
xpoint = (curlevel->powerupx * TILEW) + (TILEW/2);
|
xpoint = (curlevel->powerupx * TILEW) + (TILEW/2);
|
||||||
if (s->x <= xpoint) {
|
if (s->x <= xpoint) {
|
||||||
int rv = B_FALSE;
|
int rv = B_FALSE;
|
||||||
rv = movex(s, s->speed);
|
rv = movex(s, s->speed, B_TRUE);
|
||||||
}
|
}
|
||||||
} else { // not in intro sequence
|
} else { // not in intro sequence
|
||||||
if (!s->falling) {
|
if (!s->falling) {
|
||||||
|
@ -3016,7 +3019,7 @@ int movesprite(sprite_t *s) {
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3064,9 +3067,9 @@ int movesprite(sprite_t *s) {
|
||||||
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
||||||
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
||||||
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
||||||
movex(s, s->dir*getspeed(s));
|
movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
} else if (s->jumpdir) {
|
} else if (s->jumpdir) {
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end if inintro
|
} // end if inintro
|
||||||
|
@ -3103,7 +3106,7 @@ int movesprite(sprite_t *s) {
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3149,9 +3152,9 @@ int movesprite(sprite_t *s) {
|
||||||
} else { // falling
|
} else { // falling
|
||||||
if (s->recoiling) {
|
if (s->recoiling) {
|
||||||
// fall backwards
|
// fall backwards
|
||||||
rv = movex(s, -s->dir*getspeed(s));
|
rv = movex(s, -s->dir*getspeed(s), B_TRUE);
|
||||||
} else if (s->jumpdir) {
|
} else if (s->jumpdir) {
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s->id == P_SLUG) {
|
} else if (s->id == P_SLUG) {
|
||||||
|
@ -3199,7 +3202,7 @@ int movesprite(sprite_t *s) {
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3250,7 +3253,7 @@ int movesprite(sprite_t *s) {
|
||||||
} else { // falling
|
} else { // falling
|
||||||
int rv;
|
int rv;
|
||||||
// move forwards
|
// move forwards
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
} else if (s->id == P_PLANT) {
|
} else if (s->id == P_PLANT) {
|
||||||
// don't move!
|
// don't move!
|
||||||
|
@ -3267,7 +3270,7 @@ int movesprite(sprite_t *s) {
|
||||||
int canseeplayer = B_TRUE;
|
int canseeplayer = B_TRUE;
|
||||||
int ydis;
|
int ydis;
|
||||||
// move
|
// move
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3341,7 +3344,7 @@ int movesprite(sprite_t *s) {
|
||||||
} else if (s->timer1 == KRS_CHARGE) {
|
} else if (s->timer1 == KRS_CHARGE) {
|
||||||
int rv;
|
int rv;
|
||||||
// move fast forwards
|
// move fast forwards
|
||||||
rv = movex(s, s->dir*KR_CHARGESPEED);
|
rv = movex(s, s->dir*KR_CHARGESPEED, B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
// hit a wall - get stunned
|
// hit a wall - get stunned
|
||||||
s->timer1 = KRS_STUN;
|
s->timer1 = KRS_STUN;
|
||||||
|
@ -3417,7 +3420,7 @@ int movesprite(sprite_t *s) {
|
||||||
*/
|
*/
|
||||||
if ((s->timer1 == KSS_WALK1) || (s->timer1 == KSS_WALK2)) {
|
if ((s->timer1 == KSS_WALK1) || (s->timer1 == KSS_WALK2)) {
|
||||||
// walk back and forth
|
// walk back and forth
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3871,7 +3874,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
|
|
||||||
for (ii = 0; ii < amt; ii++) {
|
for (ii = 0; ii < amt; ii++) {
|
||||||
//s2->x += dir;
|
//s2->x += dir;
|
||||||
if (movex(s2, dir)) break;
|
if (movex(s2, dir, B_TRUE)) break;
|
||||||
}
|
}
|
||||||
s2->moved = oldmoved; // so that we don't animate
|
s2->moved = oldmoved; // so that we don't animate
|
||||||
s2->y += ydiff;
|
s2->y += ydiff;
|
||||||
|
@ -3931,7 +3934,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -3968,7 +3971,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // falling
|
} else { // falling
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
} else if (s->id == P_SNAKE) {
|
} else if (s->id == P_SNAKE) {
|
||||||
/* timer1 loopsfrom 0 - 19
|
/* timer1 loopsfrom 0 - 19
|
||||||
|
@ -4070,7 +4073,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -4112,7 +4115,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // falling
|
} else { // falling
|
||||||
movex(s, s->jumpdir*getspeed(s));
|
movex(s, s->jumpdir*getspeed(s), B_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (s->id == P_BEE) {
|
} else if (s->id == P_BEE) {
|
||||||
|
@ -4343,7 +4346,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*myspeed);
|
rv = movex(s, s->dir*myspeed, B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -4394,7 +4397,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
tunder = gettileat(s->x ,s->y,NULL,NULL);
|
||||||
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
t2under = gettileat(s->x ,s->y+s->img->h,NULL,NULL);
|
||||||
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
if ((tunder->solid == S_SLOPE) || (t2under->solid == S_SLOPE)) {
|
||||||
movex(s, s->dir*myspeed);
|
movex(s, s->dir*myspeed, B_TRUE);
|
||||||
// reset walk timer
|
// reset walk timer
|
||||||
s->timer1 = 0;
|
s->timer1 = 0;
|
||||||
}
|
}
|
||||||
|
@ -4522,7 +4525,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
|
|
||||||
/* either move or turn around */
|
/* either move or turn around */
|
||||||
if (move) {
|
if (move) {
|
||||||
rv = movex(s, s->dir*getspeed(s));
|
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
/* if we couldn't move (hit a wall), turn */
|
/* if we couldn't move (hit a wall), turn */
|
||||||
s->dir = -s->dir;
|
s->dir = -s->dir;
|
||||||
|
@ -4534,7 +4537,7 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s->id == P_SPIT) {
|
} else if (s->id == P_SPIT) {
|
||||||
if (movex(s, s->xs)) {
|
if (movex(s, s->xs, B_TRUE)) {
|
||||||
s->dead = D_FINAL;
|
s->dead = D_FINAL;
|
||||||
}
|
}
|
||||||
} else if (s->id == P_PINKCLOUD) {
|
} else if (s->id == P_PINKCLOUD) {
|
||||||
|
@ -4818,9 +4821,9 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
spd = 7 - spd;
|
spd = 7 - spd;
|
||||||
if (spd > 7) spd = 7;
|
if (spd > 7) spd = 7;
|
||||||
if (who->x > s->x) {
|
if (who->x > s->x) {
|
||||||
movex(s, spd);
|
movex(s, spd, B_FALSE);
|
||||||
} else if (who->x < s->x) {
|
} else if (who->x < s->x) {
|
||||||
movex(s, -spd);
|
movex(s, -spd, B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4838,9 +4841,9 @@ printf("setting target to y = %d\n",ss->timer2);
|
||||||
spd = 7 - spd;
|
spd = 7 - spd;
|
||||||
if (spd > 7) spd = 7;
|
if (spd > 7) spd = 7;
|
||||||
if (who->x > s->x) {
|
if (who->x > s->x) {
|
||||||
movex(s, -spd);
|
movex(s, -spd, B_TRUE);
|
||||||
} else if (who->x < s->x) {
|
} else if (who->x < s->x) {
|
||||||
movex(s, spd);
|
movex(s, spd, B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4894,16 +4897,16 @@ void dotileeffects(sprite_t *s) {
|
||||||
switch (tt->id) {
|
switch (tt->id) {
|
||||||
case T_WATERRIGHT:
|
case T_WATERRIGHT:
|
||||||
if (!ismonster(s->id) && !isfruit(s->id)) {
|
if (!ismonster(s->id) && !isfruit(s->id)) {
|
||||||
movex(s, 1.5);
|
movex(s, 1.5, B_TRUE);
|
||||||
} else if (s->id == P_PLANT) {
|
} else if (s->id == P_PLANT) {
|
||||||
movex(s, 1.5);
|
movex(s, 1.5, B_TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_WATERLEFT:
|
case T_WATERLEFT:
|
||||||
if (!ismonster(s->id) && !isfruit(s->id)) {
|
if (!ismonster(s->id) && !isfruit(s->id)) {
|
||||||
movex(s, -1.5);
|
movex(s, -1.5, B_TRUE);
|
||||||
} else if (s->id == P_PLANT) {
|
} else if (s->id == P_PLANT) {
|
||||||
movex(s, -1.5);
|
movex(s, -1.5, B_TRUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_WATERDOWN:
|
case T_WATERDOWN:
|
||||||
|
@ -4924,27 +4927,38 @@ void dotileeffects(sprite_t *s) {
|
||||||
if (tt->id == T_RIGHT) {
|
if (tt->id == T_RIGHT) {
|
||||||
if (globpowerup != PW_CLOCK) {
|
if (globpowerup != PW_CLOCK) {
|
||||||
if (!ismonster(s->id) && !isfruit(s->id)) {
|
if (!ismonster(s->id) && !isfruit(s->id)) {
|
||||||
movex(s, 1.5);
|
movex(s, 1.5, B_FALSE);
|
||||||
} else if (s->id == P_PLANT) {
|
} else if (s->id == P_PLANT) {
|
||||||
movex(s, 1.5);
|
movex(s, 1.5, B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finished = B_TRUE;
|
finished = B_TRUE;
|
||||||
} else if (tt->id == T_LEFT) {
|
} else if (tt->id == T_LEFT) {
|
||||||
if (globpowerup != PW_CLOCK) {
|
if (globpowerup != PW_CLOCK) {
|
||||||
if (!ismonster(s->id) && !isfruit(s->id)) {
|
if (!ismonster(s->id) && !isfruit(s->id)) {
|
||||||
movex(s, -1.5);
|
movex(s, -1.5, B_FALSE);
|
||||||
} else if (s->id == P_PLANT) {
|
} else if (s->id == P_PLANT) {
|
||||||
movex(s, -1.5);
|
movex(s, -1.5, B_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finished = B_TRUE;
|
finished = B_TRUE;
|
||||||
} else if ((tt->id == T_ICE) || (tt->id == T_ICETOP)) {
|
} else if (isice(tt->id)) {
|
||||||
if (isplayer(s)) {
|
if (isplayer(s)) {
|
||||||
if (globpowerup != PW_CLOCK) {
|
if (globpowerup != PW_CLOCK) {
|
||||||
if (!s->moved) {
|
if (!s->moved) {
|
||||||
movex(s, s->dir*s->speed);
|
if (s->xs != 0) {
|
||||||
s->moved = MV_ICE;
|
// slide along the ground
|
||||||
|
movex(s, s->xs, B_FALSE);
|
||||||
|
|
||||||
|
// slow down
|
||||||
|
if (s->xs > 0) {
|
||||||
|
s->xs -= ICEDECCEL;
|
||||||
|
if (s->xs < 0) s->xs = 0;
|
||||||
|
} else if (s->xs < 0) {
|
||||||
|
s->xs += ICEDECCEL;
|
||||||
|
if (s->xs > 0) s->xs = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6818,6 +6832,13 @@ void dogravity(sprite_t *s) {
|
||||||
}
|
}
|
||||||
s->falling = B_TRUE;
|
s->falling = B_TRUE;
|
||||||
|
|
||||||
|
if (isplayer(s)) {
|
||||||
|
// stop ice inertia
|
||||||
|
if (!s->moved) {
|
||||||
|
s->xs = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (s->id == P_FLY) {
|
if (s->id == P_FLY) {
|
||||||
// constant speed - we are flying down, not falling
|
// constant speed - we are flying down, not falling
|
||||||
s->y += getspeed(s);
|
s->y += getspeed(s);
|
||||||
|
@ -7231,13 +7252,14 @@ void dogravity(sprite_t *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int movex(sprite_t *s,double amt) {
|
int movex(sprite_t *s,double amt,int onpurpose) {
|
||||||
double newx,newy;
|
double newx,newy;
|
||||||
double curx,cury;
|
double curx,cury;
|
||||||
int tilex,tiley;
|
int tilex,tiley;
|
||||||
tiletype_t *tt,*tt2;
|
tiletype_t *tt,*tt2;
|
||||||
int newxoff,newgroundy;
|
int newxoff,newgroundy;
|
||||||
int newtilex,newtiley;
|
int newtilex,newtiley;
|
||||||
|
int domove = B_FALSE;
|
||||||
|
|
||||||
double amtdir;
|
double amtdir;
|
||||||
|
|
||||||
|
@ -7260,9 +7282,11 @@ int movex(sprite_t *s,double amt) {
|
||||||
newy = cury-TILEH;
|
newy = cury-TILEH;
|
||||||
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
||||||
if (tt2->solid == S_SOLID) {
|
if (tt2->solid == S_SOLID) {
|
||||||
|
s->xs = 0;
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
|
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
|
||||||
|
s->xs = 0;
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7273,32 +7297,78 @@ int movex(sprite_t *s,double amt) {
|
||||||
newy = cury;
|
newy = cury;
|
||||||
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
||||||
if (tt2->solid == S_SOLID) {
|
if (tt2->solid == S_SOLID) {
|
||||||
|
s->xs = 0;
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
|
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
|
||||||
|
s->xs = 0;
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get new position */
|
/* get new position */
|
||||||
newx = curx + amt;
|
|
||||||
|
if (isplayer(s) && isice(tt->id) && onpurpose) {
|
||||||
|
double newxs;
|
||||||
|
// change speed
|
||||||
|
newxs = s->xs + (s->dir*ICEACCEL);
|
||||||
|
s->xs += (s->dir*ICEACCEL);
|
||||||
|
// don't get too fast!
|
||||||
|
if (newxs > getspeed(s)) newxs = getspeed(s);
|
||||||
|
if (newxs < -getspeed(s)) newxs = -getspeed(s);
|
||||||
|
|
||||||
|
newx = curx + newxs;
|
||||||
|
amt = newx - curx;
|
||||||
|
} else {
|
||||||
|
newx = curx + amt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
newy = cury-2;
|
newy = cury-2;
|
||||||
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
|
||||||
newxoff = newx - (newtilex*TILEW);
|
newxoff = newx - (newtilex*TILEW);
|
||||||
newgroundy = newtiley*TILEH + tt2->lowness[newxoff];
|
newgroundy = newtiley*TILEH + tt2->lowness[newxoff];
|
||||||
|
|
||||||
/* new block is at least partially solid */
|
/* new block is at least partially solid */
|
||||||
|
domove = B_FALSE;
|
||||||
if (tt2->solid == S_SOLID) {
|
if (tt2->solid == S_SOLID) {
|
||||||
|
s->xs = 0;
|
||||||
return B_TRUE;
|
return B_TRUE;
|
||||||
} else if ((tt2->solid == S_SLOPE) && candoslopes(s->id)) {
|
} else if ((tt2->solid == S_SLOPE) && candoslopes(s->id)) {
|
||||||
/* we can move, but need to adjust our height */
|
/* we can move, but need to adjust our height */
|
||||||
s->x += amt;
|
domove = B_TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* new block is empty */
|
/* new block is empty */
|
||||||
s->x += amt;
|
domove = B_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->moved = MV_WALK;
|
if (domove) {
|
||||||
|
if (isplayer(s) && isice(tt->id) && onpurpose) {
|
||||||
|
// change speed
|
||||||
|
s->xs += (s->dir*ICEACCEL);
|
||||||
|
// don't get too fast!
|
||||||
|
if (s->xs > getspeed(s)) s->xs = getspeed(s);
|
||||||
|
if (s->xs < -getspeed(s)) s->xs = -getspeed(s);
|
||||||
|
|
||||||
|
s->x += s->xs;
|
||||||
|
s->moved = MV_WALK;
|
||||||
|
} else {
|
||||||
|
s->x += amt;
|
||||||
|
s->xs = amt;
|
||||||
|
if (!onpurpose) {
|
||||||
|
if (isice(tt->id)) {
|
||||||
|
s->moved = MV_ICE;
|
||||||
|
} else {
|
||||||
|
s->moved = MV_WALK;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s->moved = MV_WALK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s->xs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// rings
|
// rings
|
||||||
if (isplayer(s)) {
|
if (isplayer(s)) {
|
||||||
|
@ -11842,14 +11912,14 @@ void doplayermovement(sprite_t *pl) {
|
||||||
if (moveok) {
|
if (moveok) {
|
||||||
if (keydown(pnum,KEY_RIGHT)) {
|
if (keydown(pnum,KEY_RIGHT)) {
|
||||||
if (canmove(pl)) {
|
if (canmove(pl)) {
|
||||||
movex(pl, getspeed(pl));
|
movex(pl, getspeed(pl), B_TRUE);
|
||||||
}
|
}
|
||||||
if (canturn(pl)) {
|
if (canturn(pl)) {
|
||||||
pl->dir = D_RIGHT;
|
pl->dir = D_RIGHT;
|
||||||
}
|
}
|
||||||
} else if (keydown(pnum,KEY_LEFT)) {
|
} else if (keydown(pnum,KEY_LEFT)) {
|
||||||
if (canmove(pl)) {
|
if (canmove(pl)) {
|
||||||
movex(pl, -getspeed(pl));
|
movex(pl, -getspeed(pl), B_TRUE);
|
||||||
}
|
}
|
||||||
if (canturn(pl)) {
|
if (canturn(pl)) {
|
||||||
pl->dir = D_LEFT;
|
pl->dir = D_LEFT;
|
||||||
|
@ -12106,7 +12176,7 @@ void dointroseq(void) {
|
||||||
jump(player, D_RIGHT);
|
jump(player, D_RIGHT);
|
||||||
player->jumpspeed = 7;
|
player->jumpspeed = 7;
|
||||||
} else if (player->falling) {
|
} else if (player->falling) {
|
||||||
movex(player, getspeed(player)/2);
|
movex(player, getspeed(player)/2, B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (player2) {
|
if (player2) {
|
||||||
|
@ -12117,7 +12187,7 @@ void dointroseq(void) {
|
||||||
jump(player2, D_LEFT);
|
jump(player2, D_LEFT);
|
||||||
player2->jumpspeed = 7;
|
player2->jumpspeed = 7;
|
||||||
} else if (player2->falling) {
|
} else if (player2->falling) {
|
||||||
movex(player2, -getspeed(player2)/2);
|
movex(player2, -getspeed(player2)/2, B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -12125,7 +12195,7 @@ void dointroseq(void) {
|
||||||
jump(player2, D_LEFT);
|
jump(player2, D_LEFT);
|
||||||
player2->jumpspeed = 7;
|
player2->jumpspeed = 7;
|
||||||
} else if (player2->falling) {
|
} else if (player2->falling) {
|
||||||
movex(player2, -getspeed(player2)/2);
|
movex(player2, -getspeed(player2)/2, B_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12148,7 +12218,7 @@ void dointroseq(void) {
|
||||||
// keep moving until we hit the ground
|
// keep moving until we hit the ground
|
||||||
if (player) {
|
if (player) {
|
||||||
if (player->falling) {
|
if (player->falling) {
|
||||||
movex(player, getspeed(player));
|
movex(player, getspeed(player), B_TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (introstate == IS_RATS2) {
|
if (introstate == IS_RATS2) {
|
||||||
|
@ -12160,7 +12230,7 @@ void dointroseq(void) {
|
||||||
}
|
}
|
||||||
if (player2) {
|
if (player2) {
|
||||||
if (player2->falling) {
|
if (player2->falling) {
|
||||||
movex(player2, -getspeed(player2));
|
movex(player2, -getspeed(player2), B_TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (introstate == IS_RATS2) {
|
if (introstate == IS_RATS2) {
|
||||||
|
@ -12285,3 +12355,12 @@ int countbabies(sprite_t *s, int babytype) {
|
||||||
}
|
}
|
||||||
return numbabies;
|
return numbabies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isice(int id) {
|
||||||
|
switch (id) {
|
||||||
|
case T_ICE:
|
||||||
|
case T_ICETOP:
|
||||||
|
return B_TRUE;
|
||||||
|
}
|
||||||
|
return B_FALSE;
|
||||||
|
}
|
||||||
|
|
3
rc.h
3
rc.h
|
@ -12,7 +12,7 @@ void removenetting(sprite_t *s);
|
||||||
void drawnetting(sprite_t *s);
|
void drawnetting(sprite_t *s);
|
||||||
void dogravity(sprite_t *s);
|
void dogravity(sprite_t *s);
|
||||||
void dotileeffects(sprite_t *s);
|
void dotileeffects(sprite_t *s);
|
||||||
int movex(sprite_t *s,double amt);
|
int movex(sprite_t *s,double amt,int onpurpose);
|
||||||
void bouncesprite(sprite_t *s);
|
void bouncesprite(sprite_t *s);
|
||||||
int movesprite(sprite_t *s);
|
int movesprite(sprite_t *s);
|
||||||
int isinwater(sprite_t *s);
|
int isinwater(sprite_t *s);
|
||||||
|
@ -126,3 +126,4 @@ int addcredit(void);
|
||||||
int getpnum(sprite_t *s);
|
int getpnum(sprite_t *s);
|
||||||
int isonplatform(double x, double y);
|
int isonplatform(double x, double y);
|
||||||
int countbabies(sprite_t *s, int babytype);
|
int countbabies(sprite_t *s, int babytype);
|
||||||
|
int isice(int id);
|
||||||
|
|
Loading…
Reference in New Issue