New setting permenant powerups in setdefaults() based on level, so that

if you join the game after a boss level, you still get the permenant
powerup.
This commit is contained in:
Rob Pearce 2008-11-25 22:28:10 +00:00
parent b0bca28c23
commit a41831a134
4 changed files with 26 additions and 3 deletions

2
defs.h
View File

@ -1043,6 +1043,8 @@ extern int nextforcegoodcard;
extern int globpowerup; extern int globpowerup;
extern int curlevelnum;
extern char *datadir; extern char *datadir;
#endif #endif

View File

@ -7,6 +7,8 @@ int musicplaying;
levelentry_t levelentry[MAXLEVELS]; // level filenames etc levelentry_t levelentry[MAXLEVELS]; // level filenames etc
int numlevels; int numlevels;
int curlevelnum;
int maxlevid; int maxlevid;
int want1up,want2up; int want1up,want2up;

3
rc.c
View File

@ -142,7 +142,6 @@ int gtime = 0;
int fpsticks = 0; int fpsticks = 0;
int fpsstart = 0; int fpsstart = 0;
int curlevelnum;
int skipto = -1; // which level to skip to int skipto = -1; // which level to skip to
level_t *curlevel; level_t *curlevel;
int levelcompletetime; int levelcompletetime;
@ -9920,6 +9919,7 @@ if (cheat) {
double px,py; double px,py;
// lose credit and come back to life // lose credit and come back to life
credits--; credits--;
setdefaults(player);
player->lives = INITPLAYERLIVES; player->lives = INITPLAYERLIVES;
player->score = 0; player->score = 0;
playfx(FX_EXTRALIFE); playfx(FX_EXTRALIFE);
@ -9971,6 +9971,7 @@ if (cheat) {
double px,py; double px,py;
// lose credit and come back to life // lose credit and come back to life
credits--; credits--;
setdefaults(player2);
player2->lives = INITPLAYERLIVES; player2->lives = INITPLAYERLIVES;
player2->score = 0; player2->score = 0;
playfx(FX_EXTRALIFE); playfx(FX_EXTRALIFE);

View File

@ -629,6 +629,24 @@ printf(".\n");
void setdefaults(sprite_t *s) { void setdefaults(sprite_t *s) {
if (isplayer(s)) { if (isplayer(s)) {
// set permenant powerups based on level
if (curlevelnum > 20) {
s->permspeed = B_TRUE;
} else {
s->permspeed = B_FALSE;
}
if (curlevelnum > 40) {
s->permmask = B_TRUE;
} else {
s->permmask = B_FALSE;
}
if (curlevelnum > 60) {
s->permumbrella = B_TRUE;
} else {
s->permumbrella = B_FALSE;
}
// player powerup stats // player powerup stats
if (s->permspeed) { if (s->permspeed) {
s->speed = 2; s->speed = 2;
@ -900,13 +918,13 @@ sprite_t *addsprite(int id, int x, int y, char *name ) {
// don't set these in setdefaults() as setdefaults() is called after each player death // don't set these in setdefaults() as setdefaults() is called after each player death
s->permspeed = B_FALSE; s->permspeed = B_FALSE;
s->permmask = B_FALSE;
s->permumbrella = B_FALSE;
s->permbignet = B_FALSE; s->permbignet = B_FALSE;
s->permnumnets = B_FALSE; s->permnumnets = B_FALSE;
s->permsticky = B_FALSE; s->permsticky = B_FALSE;
s->permdoublejump = B_FALSE; s->permdoublejump = B_FALSE;
s->permarmour = B_FALSE; s->permarmour = B_FALSE;
s->permmask = B_FALSE;
s->permumbrella = B_FALSE;
s->lostlife = B_FALSE; s->lostlife = B_FALSE;