- More tweaks to ladder behaviour wrt getting on/off

- Appended 'fps' to score/fps display when pressing f2
This commit is contained in:
Rob Pearce 2008-10-29 02:59:15 +00:00
parent 6d42aa287a
commit c5890190ea
1 changed files with 42 additions and 16 deletions

58
rc.c
View File

@ -1725,24 +1725,29 @@ if (s->id == P_PUFF) printf("PUFF WITH DOOMCOUNT!\n");
bouncesprite(s);
if ((s->ys >= 0) && (s->y >= TILEH)) {
if (s->quickdie || isonground(s)) {
int x,y,ty;
s->dead = D_FINAL;
/* change into a fruit */
x = s->x;
gettileat(s->x,s->y-1,NULL,&ty);
//y = ty*TILEH + TILEH - 2;
y = ty*TILEH - 2;
int x,y,ty;
// get position for puff/fruit
x = s->x;
gettileat(s->x,s->y-1,NULL,&ty);
//y = ty*TILEH + TILEH - 2;
y = ty*TILEH - 2;
/* make sure it's within the screen */
if (x > (640-TILEW)) x = 640-TILEW;
if (x < (TILEW)) x = TILEW;
/* make sure it's within the screen */
if (x > (640-TILEW)) x = 640-TILEW;
if (x < (TILEW)) x = TILEW;
if (s->quickdie || (isonground(s) && !isongroundpoint(s, s->x, s->y-TILEH))) {
/* change into a fruit */
s->dead = D_FINAL;
//addsprite(s->willbecome, x, y, "Fruit", B_FALSE);
puffin(s->willbecome, x, y, "fruit", 0);
//ss = addsprite(P_PUFF, x, y, "Fruit", B_FALSE);
//ss->timer3 = s->willbecome;
} else if (s->bounces >= 6) {
// just die
s->dead = D_FINAL;
puffin(-1, x, y, "nothing_sprd", 0);
}
}
}
@ -3764,11 +3769,12 @@ void drawscore(void) {
if (wantframerate) {
scoreval = fps;
sprintf(tempm, "%d fps",scoreval);
} else {
scoreval = player->score;
addcommas(tempm, scoreval);
}
addcommas(tempm, scoreval);
/* shadow */
score = TTF_RenderText_Solid(font[TEXTSIZE_SCORE], tempm, black);
@ -4212,6 +4218,7 @@ int isladder(int tid) {
}
// return the x position of the middle of the ladder if so
int isonladder(sprite_t *s) {
int tx;
@ -5563,7 +5570,6 @@ void usage(void) {
int canmove(sprite_t *pl) {
if (!pl->jumping && !pl->slamming ) {
if (!pl->netting) {
//if (!isonladder(pl) || pl->falling || isonground(pl)) {
if ( pl->climbing || pl->falling || isonground(pl)) {
return B_TRUE;
}
@ -7212,7 +7218,21 @@ if (cheat) {
************************************************************/
if ((!paused) && (!levelcomplete != LV_DOPOKER) && (levelcomplete != LV_CLOUDLOOP)) {
if ((!player->dead) && (!player->teleporting)) {
if (!player->climbing) {
int moveok = B_FALSE;
if (player->climbing) {
tiletype_t *tt;
// can only move left/right if we're at the bottom of a ladder
tt = gettileat(player->x,player->y, NULL,NULL);
if (tt->solid) {
moveok = B_TRUE;
}
tt = gettileat(player->x,player->y+TILEH, NULL,NULL);
if (tt->solid ) {
moveok = B_TRUE;
}
} else moveok = B_TRUE;
if (moveok) {
if (keydown(SDLK_RIGHT)) {
if (canmove(player)) {
movex(player, getspeed(player));
@ -7229,11 +7249,17 @@ if (cheat) {
}
}
}
if (keydown(SDLK_UP)) {
if (!player->netting && !player->slamming && !player->jumping) {
if (player->climbing) {
int ladderx = isladderabove(player);
// if tile above is non-solid, or a ladder
if (isladderabove(player) || !isroofabove(player)) {
if (ladderx || !isroofabove(player)) {
// lock to ladder
if (ladderx) {
player->x = ladderx; // lock to ladder
}
// continue climbing
player->y -= getspeed(player);
player->jumping = 0;