- Killing 5 monsters simultaneously will force cards appearing on the next

level to be good (ie. match suit, value, or value +/- 1 of current cards)
This commit is contained in:
Rob Pearce 2008-10-17 18:39:22 +00:00
parent 5f260a9ae9
commit c4b48e993d
6 changed files with 73 additions and 38 deletions

2
defs.h
View File

@ -771,6 +771,8 @@ extern spriteinfo_t spriteinfo[];
extern int curcard; extern int curcard;
extern int deck[]; extern int deck[];
extern int forcegoodcard;
extern int nextforcegoodcard;
extern char *datadir; extern char *datadir;

View File

@ -15,6 +15,8 @@ char *datadir;
int curcard; int curcard;
int deck[DECKSIZE]; int deck[DECKSIZE];
int forcegoodcard;
int nextforcegoodcard;
SDL_Surface *levelbg; // level background image SDL_Surface *levelbg; // level background image

52
rc.c
View File

@ -267,6 +267,9 @@ int main (int argc, char **argv) {
player->invuln = INVULNTIME; player->invuln = INVULNTIME;
player->score = 0; player->score = 0;
player->lives = 3; player->lives = 3;
forcegoodcard = B_FALSE;
nextforcegoodcard = B_FALSE;
@ -857,6 +860,11 @@ void nextlevel(void) {
/* reset level stats */ /* reset level stats */
level->gotpowerup = B_FALSE; level->gotpowerup = B_FALSE;
// this is based on the max number of monsters killed
// simulatneously on the previous level...
forcegoodcard = nextforcegoodcard;
nextforcegoodcard = B_FALSE;
if (player->hasbell) { if (player->hasbell) {
playedbell = B_FALSE; playedbell = B_FALSE;
} else { } else {
@ -4166,9 +4174,6 @@ void dogravity(sprite_t *s) {
s->netlen += s->netspeed; s->netlen += s->netspeed;
s->netting++; s->netting++;
if (s->netting % 2 == 0) { if (s->netting % 2 == 0) {
if (s->netspeed == 0) {
printf("maxlen %d\n",s->netlen);
}
if (s->netspeed > -NETSPEED) { if (s->netspeed > -NETSPEED) {
s->netspeed--; s->netspeed--;
} else { } else {
@ -4445,8 +4450,9 @@ void dogravity(sprite_t *s) {
} }
} }
} } // end if gotsomething || PW_MACE
// play sound effect
if (!hitboss) { if (!hitboss) {
if (gotsomething >= 1) { if (gotsomething >= 1) {
playfx(FX_KILL); playfx(FX_KILL);
@ -4456,6 +4462,12 @@ void dogravity(sprite_t *s) {
} }
} }
// killing 5 at a time gives us a bonus on the next level...
if (gotsomething >= 5) {
nextforcegoodcard = B_TRUE;
forcegoodcard = B_TRUE; // and on this level if we get one...
}
gotsomething = B_FALSE; gotsomething = B_FALSE;
@ -6412,38 +6424,6 @@ char *getpokermsg2(int effect, char *buf) {
return buf; return buf;
} }
int getcardsuit(int cardid) {
if ((cardid >= P_FIRSTHEART) && (cardid <= (P_FIRSTHEART + 12))) {
return CS_HEART;
} else if ((cardid >= P_FIRSTDIAMOND) && (cardid <= (P_FIRSTDIAMOND + 12))) {
return CS_DIAMOND;
} else if ((cardid >= P_FIRSTSPADE) && (cardid <= (P_FIRSTSPADE + 12))) {
return CS_SPADE;
} else {
return CS_CLUB;
}
}
int getcardvalue(int cardid) {
int points;
points = cardid;
switch (getcardsuit(cardid)) {
case CS_HEART:
points -= P_FIRSTHEART;
break;
case CS_DIAMOND:
points -= P_FIRSTDIAMOND;
break;
case CS_SPADE:
points -= P_FIRSTSPADE;
break;
case CS_CLUB:
default:
points -= P_FIRSTCLUB;
break;
}
return (points+1);
}
void handleinput(void) { void handleinput(void) {

2
rc.h
View File

@ -74,8 +74,6 @@ int getpokereffect(sprite_t *pl);
void dopokereffect(sprite_t *pl, int effect); void dopokereffect(sprite_t *pl, int effect);
char *getpokermsg(int effect); char *getpokermsg(int effect);
char *getpokermsg2(int effect, char *buf); char *getpokermsg2(int effect, char *buf);
int getcardvalue(int cardid);
int getcardsuit(int cardid);
void handleinput(void); void handleinput(void);
int keydown(int checkfor); int keydown(int checkfor);
void trytojump(sprite_t *pl); void trytojump(sprite_t *pl);

View File

@ -2857,6 +2857,24 @@ int getrandomcard(void) {
} }
} }
} }
// are we forcing it to be good?
if (forcegoodcard) {
int okay = B_FALSE;
int csuit,cval;
for (i = 0; i < player->numcards; i++) {
cval = getcardvalue(player->card[i]);
csuit = getcardsuit(player->card[i]);
if (csuit == getcardsuit(cardid)) okay = B_TRUE;
if (cval == (getcardvalue(cardid))) okay = B_TRUE;
if (cval == (getcardvalue(cardid)+1)) okay = B_TRUE;
if (cval == (getcardvalue(cardid)-1)) okay = B_TRUE;
}
// if not a good card, go to next one
if (!okay) {
gotit = B_TRUE;
}
}
} }
//printf("returning cardid %d\n",cardid); //printf("returning cardid %d\n",cardid);
@ -3013,3 +3031,36 @@ int getlevel(int lev) {
return wnum; return wnum;
} }
int getcardsuit(int cardid) {
if ((cardid >= P_FIRSTHEART) && (cardid <= (P_FIRSTHEART + 12))) {
return CS_HEART;
} else if ((cardid >= P_FIRSTDIAMOND) && (cardid <= (P_FIRSTDIAMOND + 12))) {
return CS_DIAMOND;
} else if ((cardid >= P_FIRSTSPADE) && (cardid <= (P_FIRSTSPADE + 12))) {
return CS_SPADE;
} else {
return CS_CLUB;
}
}
int getcardvalue(int cardid) {
int points;
points = cardid;
switch (getcardsuit(cardid)) {
case CS_HEART:
points -= P_FIRSTHEART;
break;
case CS_DIAMOND:
points -= P_FIRSTDIAMOND;
break;
case CS_SPADE:
points -= P_FIRSTSPADE;
break;
case CS_CLUB:
default:
points -= P_FIRSTCLUB;
break;
}
return (points+1);
}

View File

@ -56,6 +56,8 @@ char *getcardletter(int num);
int getrandomcard(void); int getrandomcard(void);
char *getcardname(int id); char *getcardname(int id);
void shufflecards(void); void shufflecards(void);
int getcardvalue(int cardid);
int getcardsuit(int cardid);
int getworld(int lev); int getworld(int lev);
int getlevel(int lev); int getlevel(int lev);
// for doco // for doco