Removed bug

This commit is contained in:
Rob Pearce 2008-12-21 00:16:37 +00:00
parent 70794f79eb
commit 3cb6888b5b
3 changed files with 0 additions and 23 deletions

4
defs.h
View File

@ -965,10 +965,6 @@ typedef struct sprite_s {
// both player and monster // both player and monster
struct sprite_s *onplatform;// are we on platform? struct sprite_s *onplatform;// are we on platform?
// for optimisation
double lastx,lasty;
int lastonground;
int antigrav; // don't fall int antigrav; // don't fall
int lives; // only for player and bosses int lives; // only for player and bosses
int swimming; // are we in the water? int swimming; // are we in the water?

15
rc.c
View File

@ -6486,39 +6486,27 @@ int isroofnabove(sprite_t *s, int howfar) {
int isonground(sprite_t *s) { int isonground(sprite_t *s) {
// attempt to optimise...
if ((s->x == s->lastx) && (s->y == s->lasty)) {
return s->lastonground;
} else {
s->lastx = s->x;
s->lasty = s->y;
}
// are we on a platform? // are we on a platform?
if (s->onplatform) { if (s->onplatform) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
// antigrav? // antigrav?
if (s->antigrav ) { if (s->antigrav ) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
/* get tile below sprite's feet */ /* get tile below sprite's feet */
if (isongroundpoint(s, s->x, s->y)) { if (isongroundpoint(s, s->x, s->y)) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
if ((s->dead) || (!s->falling && !s->dropping)) { if ((s->dead) || (!s->falling && !s->dropping)) {
if (!s->swimming) { if (!s->swimming) {
if (isongroundpoint(s, s->x + s->img->w/2, s->y)) { if (isongroundpoint(s, s->x + s->img->w/2, s->y)) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
if (isongroundpoint(s, s->x - s->img->w/2, s->y)) { if (isongroundpoint(s, s->x - s->img->w/2, s->y)) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
} }
@ -6527,16 +6515,13 @@ int isonground(sprite_t *s) {
//if (s->falling && s->id == P_KINGRAT) { //if (s->falling && s->id == P_KINGRAT) {
if (s->id == P_KINGRAT) { if (s->id == P_KINGRAT) {
if (isongroundpoint(s, s->x + s->img->w/2, s->y)) { if (isongroundpoint(s, s->x + s->img->w/2, s->y)) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
if (isongroundpoint(s, s->x - s->img->w/2, s->y)) { if (isongroundpoint(s, s->x - s->img->w/2, s->y)) {
s->lastonground = B_TRUE;
return B_TRUE; return B_TRUE;
} }
} }
s->lastonground = B_FALSE;
return B_FALSE; return B_FALSE;
} }

View File

@ -715,10 +715,6 @@ void setdefaults(sprite_t *s) {
s->netmax = 1; s->netmax = 1;
} }
s->lastx = -99;
s->lasty = -99;
s->lastonground = B_FALSE;
s->doublejumpready = B_FALSE; s->doublejumpready = B_FALSE;