Modified behaviour of help text - it now stays on the screen until you press Z

to clear it.
This commit is contained in:
Rob Pearce 2008-10-17 11:15:27 +00:00
parent 79ac13691a
commit 5f260a9ae9
5 changed files with 201 additions and 121 deletions

View File

@ -1,7 +1,7 @@
all: rc edit all: rc edit
rc: rc.c shared.c rc.h shared.h globals.h defs.h rc: rc.c shared.c rc.h shared.h globals.h defs.h
gcc -Wall -o rc -g rc.c shared.c -L/Users/rob/c/rc/libs `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_Mixer gcc -Wall -o rc -g rc.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_Mixer
edit: edit.c shared.c edit.h shared.h globals.h defs.h edit: edit.c shared.c edit.h shared.h globals.h defs.h
gcc -D__EDITOR -Wall -o edit -g edit.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf gcc -D__EDITOR -Wall -o edit -g edit.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf

View File

@ -2,6 +2,7 @@ bgfile forest.png
bg 0 bg 0
hurryup 30 hurryup 30
help help
Press Z to clear help messages
Use X to jump, Z to catch the rat. Use X to jump, Z to catch the rat.
Then use Down+Z to slam and kill a monster! Then use Down+Z to slam and kill a monster!
endhelp endhelp
@ -26,6 +27,7 @@ monsters
15 34 19 15 34 19
16 35 19 16 35 19
17 36 19 17 36 19
14 17 19
endmonsters endmonsters
exitdir 1 exitdir 1
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,

8
defs.h
View File

@ -55,6 +55,12 @@
#define TEXTSIZE_PAUSED 50 #define TEXTSIZE_PAUSED 50
#define TEXTSIZE_GAMEOVER 50 #define TEXTSIZE_GAMEOVER 50
// text tuypes
#define TT_NORM 0
#define TT_HELP 1
#define TT_HELPSHADOW 2
// text delays // text delays
#define TEXTSPEED 2 // how fast text zooms in #define TEXTSPEED 2 // how fast text zooms in
@ -461,6 +467,7 @@
#define LV_NEXTLEV 7 // cloud done , nextlevel() in 5 seconds #define LV_NEXTLEV 7 // cloud done , nextlevel() in 5 seconds
#define LV_GAMEOVER 8 // No lives left. #define LV_GAMEOVER 8 // No lives left.
#define LV_DOPOKER 9 // Got a full set of cards! #define LV_DOPOKER 9 // Got a full set of cards!
#define LV_HELPFREEZE 10 // Freeze after help text
// movement types // movement types
#define MV_NONE 0 // didn't move #define MV_NONE 0 // didn't move
@ -562,6 +569,7 @@ typedef struct text_s {
int size; int size;
int maxsize; int maxsize;
int state; int state;
int type;
int delay; // how long to stay on screen int delay; // how long to stay on screen
char txt[BUFLEN]; char txt[BUFLEN];
SDL_Rect bgarea; SDL_Rect bgarea;

306
rc.c
View File

@ -286,7 +286,7 @@ int main (int argc, char **argv) {
* check for end of level * check for end of level
*/ */
if (levelcomplete == LV_CLEAR) { if (levelcomplete == LV_CLEAR) {
addoutlinetext(320,240,TEXTSIZE_LEVEL,"Level Complete!",&green,&black,LEVELWINDELAY); addoutlinetext(320,240,TEXTSIZE_LEVEL,"Level Complete!",&green,&black,LEVELWINDELAY, TT_NORM);
levelcomplete = LV_WAIT; levelcomplete = LV_WAIT;
playfx(FX_WINLEVEL); playfx(FX_WINLEVEL);
// turn off clock and water powerups // turn off clock and water powerups
@ -377,14 +377,18 @@ int main (int argc, char **argv) {
} }
} }
} else { // all other states... } else { // all other states...
// move sprites if (levelcomplete != LV_HELPFREEZE) {
moveallsprites(); // move sprites
moveallsprites();
}
} }
/********************************************** /**********************************************
* Move onscreen text * Move onscreen text
*/ */
movetext(); if (levelcomplete != LV_HELPFREEZE) {
movetext();
}
/********************************************** /**********************************************
@ -422,6 +426,7 @@ int main (int argc, char **argv) {
} }
break; break;
case LV_DOPOKER: // do nothing case LV_DOPOKER: // do nothing
case LV_HELPFREEZE: // do nothing
break; break;
} }
} }
@ -459,7 +464,7 @@ int main (int argc, char **argv) {
/********************************************** /**********************************************
* Collision detection * Collision detection
*/ */
if (levelcomplete != LV_DOPOKER) { if ((levelcomplete != LV_DOPOKER) && (levelcomplete != LV_HELPFREEZE)) {
checkcollideall(); checkcollideall();
} }
} }
@ -471,18 +476,18 @@ int main (int argc, char **argv) {
*/ */
// player netting // player netting
if (levelcomplete != LV_DOPOKER) { if ((levelcomplete != LV_DOPOKER) && (levelcomplete != LV_HELPFREEZE)) {
drawnetting(player); drawnetting(player);
} }
// cannon firing // cannon firing
if ((levelcomplete != LV_DOPOKER) && (player->powerup == PW_CANNONFIRE)) { // cannon firing if ((levelcomplete != LV_DOPOKER) && (levelcomplete != LV_HELPFREEZE) && (player->powerup == PW_CANNONFIRE)) { // cannon firing
docannoneffect(); docannoneffect();
} }
// draw sprites // draw sprites
if (levelcomplete != LV_DOPOKER) { if ((levelcomplete != LV_DOPOKER) && (levelcomplete != LV_HELPFREEZE)) {
drawallsprites(); drawallsprites();
} }
@ -507,6 +512,15 @@ int main (int argc, char **argv) {
drawsprite(this); drawsprite(this);
} }
} }
} else if (levelcomplete == LV_HELPFREEZE) {
SDL_Rect area;
area.x = 0;
area.y = 0;
area.w = 640;
area.h = 480;
// clear screen
SDL_FillRect(screen, &area, SDL_MapRGB(screen->format,black.r,black.g,black.b));
} }
// draw text // draw text
@ -639,6 +653,7 @@ void tick(void) {
SDL_framerateDelay(&manager); SDL_framerateDelay(&manager);
if (paused) return; if (paused) return;
if (levelcomplete == LV_HELPFREEZE) return;
fpsticks = SDL_GetTicks(); fpsticks = SDL_GetTicks();
if (fpsstart == 0) { if (fpsstart == 0) {
@ -655,7 +670,7 @@ void tick(void) {
// text // text
if (clocktime > 0) { if (clocktime > 0) {
sprintf(tempm, "%d",clocktime); sprintf(tempm, "%d",clocktime);
addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &yellow,&black,15); addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &yellow,&black,15, TT_NORM);
// sound effect // sound effect
playfx(FX_CLOCK); playfx(FX_CLOCK);
} }
@ -676,7 +691,7 @@ void tick(void) {
// text // text
if (watertime > 0) { if (watertime > 0) {
sprintf(tempm, "%d",watertime); sprintf(tempm, "%d",watertime);
addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &cyan,&black,15); addoutlinetext(320,120,TEXTSIZE_LEVEL, tempm, &cyan,&black,15, TT_NORM);
} }
// never reach hurryup time // never reach hurryup time
nexthurryup++; nexthurryup++;
@ -710,7 +725,7 @@ void tick(void) {
} }
addoutlinetext(320,240,TEXTSIZE_HURRY, "Hurry up!", &yellow,&black,HURRYDELAY); addoutlinetext(320,240,TEXTSIZE_HURRY, "Hurry up!", &yellow,&black,HURRYDELAY, TT_NORM);
stopmusic(); stopmusic();
Mix_PlayChannel(CH_HURRYUP, sfx[FX_HURRYUP], 0); Mix_PlayChannel(CH_HURRYUP, sfx[FX_HURRYUP], 0);
@ -718,7 +733,7 @@ void tick(void) {
} else if (gtime == nexthurryup + 15) { // 15 secs after hurryup } else if (gtime == nexthurryup + 15) { // 15 secs after hurryup
if (!levelcomplete) { if (!levelcomplete) {
addsprite(P_BLACKCLOUD, 320,240,"cloud"); addsprite(P_BLACKCLOUD, 320,240,"cloud");
addoutlinetext(320,240,TEXTSIZE_HURRY, "Too slow!", &red,&black,HURRYDELAY); addoutlinetext(320,240,TEXTSIZE_HURRY, "Too slow!", &red,&black,HURRYDELAY, TT_NORM);
playfx(FX_TOOSLOW); playfx(FX_TOOSLOW);
} }
} }
@ -863,11 +878,11 @@ void nextlevel(void) {
level->icey = -1; level->icey = -1;
sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel()); sprintf(msg, "Level %d-%d",getcurworld(), getcurlevel());
addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY); addoutlinetext(320,240-18,TEXTSIZE_LEVEL,msg,&white,&black,LEVELDELAY, TT_NORM);
sprintf(msg, "\"%s\"", curlevel->name); sprintf(msg, "\"%s\"", curlevel->name);
addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY); addoutlinetext(320,240+18,TEXTSIZE_LEVEL2,msg,&cyan,&black,LEVELDELAY, TT_NORM);
/* reset player stats */ /* reset player stats */
player->netting = B_FALSE; player->netting = B_FALSE;
@ -1031,7 +1046,7 @@ void die(sprite_t *s) {
// draw text // draw text
tnum = rand() % MAXDEATHTEXT; tnum = rand() % MAXDEATHTEXT;
addoutlinetext(player->x,player->y,TEXTSIZE_DEATH,deathtext[tnum],&red,&black,DIEDELAY); addoutlinetext(player->x,player->y,TEXTSIZE_DEATH,deathtext[tnum],&red,&black,DIEDELAY, TT_NORM);
} }
} }
@ -1247,7 +1262,7 @@ void checkcollide(sprite_t *s) {
playfx(FX_KILL); playfx(FX_KILL);
sprintf(tempm, bifftext[rand() % MAXBIFFTEXT]); sprintf(tempm, bifftext[rand() % MAXBIFFTEXT]);
addoutlinetext(s2->x,s2->y - s->img->h/2, TEXTSIZE_BIFF, tempm,&red,&yellow,POINTSDELAY); addoutlinetext(s2->x,s2->y - s->img->h/2, TEXTSIZE_BIFF, tempm,&red,&yellow,POINTSDELAY, TT_NORM);
keepchecking = B_FALSE; keepchecking = B_FALSE;
} else if (s2->iced) { } else if (s2->iced) {
@ -1680,7 +1695,7 @@ if (s->id == P_PUFF) printf("PUFF WITH DOOMCOUNT!\n");
(ydiff <= player->img->h/2 + newsp->img->h/2)) { (ydiff <= player->img->h/2 + newsp->img->h/2)) {
// bonus! // bonus!
getfruit(player, newsp, 4); getfruit(player, newsp, 4);
addoutlinetext(player->x,player->y - (player->img->h*1.5), TEXTSIZE_MULTI, "Nice catch!", &green,&black,MULTIDELAY); addoutlinetext(player->x,player->y - (player->img->h*1.5), TEXTSIZE_MULTI, "Nice catch!", &green,&black,MULTIDELAY, TT_NORM);
} }
} }
@ -3330,7 +3345,7 @@ double getspeed(sprite_t *s ) {
} }
int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay) { int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay, int ttype) {
text_t *t; text_t *t;
if (text == NULL) { if (text == NULL) {
@ -3351,6 +3366,7 @@ int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay) {
screen->format->Gmask,screen->format->Bmask, screen->format->Gmask,screen->format->Bmask,
screen->format->Amask); screen->format->Amask);
t->type = ttype;
t->c = c; t->c = c;
t->x = x; t->x = x;
t->y = y; t->y = y;
@ -3383,12 +3399,22 @@ void fruit(void) {
void movetext(void) { void movetext(void) {
text_t *t,*nextt; text_t *t,*nextt;
int newhelpfreeze = B_FALSE;
for (t = text ; t ; t = nextt) { for (t = text ; t ; t = nextt) {
nextt = t->next; nextt = t->next;
if (t->state == 0) { if (t->state == 0) {
t->size += TEXTSPEED; t->size += TEXTSPEED;
if (t->size >= t->maxsize) { if (t->size >= t->maxsize) {
t->state = 1; if (t->type == TT_HELP) {
// freeze
oldlevelcomplete = levelcomplete;
levelcomplete = LV_HELPFREEZE;
t->state = t->delay;
newhelpfreeze = B_TRUE;
} else {
t->state = 1;
}
} }
} else if (t->state == t->delay) { } else if (t->state == t->delay) {
t->size -= TEXTSPEED; t->size -= TEXTSPEED;
@ -3400,6 +3426,15 @@ void movetext(void) {
t->state++; t->state++;
} }
} }
if (newhelpfreeze) {
// expire delay on all help text
for (t = text ; t ; t = t->next) {
if (t->type == TT_HELPSHADOW) {
t->state = t->delay;
}
}
}
} }
void drawbosshealth(void) { void drawbosshealth(void) {
@ -3511,42 +3546,44 @@ void drawtext(void) {
SDL_Rect area; SDL_Rect area;
for (t = text ; t ; t = t->next) { for (t = text ; t ; t = t->next) {
if ((levelcomplete != LV_HELPFREEZE) || (t->type == TT_HELP)) {
/* create text */ /* create text */
if (t->img) { if (t->img) {
SDL_FreeSurface(t->img); SDL_FreeSurface(t->img);
t->img = NULL; t->img = NULL;
} }
t->img = TTF_RenderText_Solid(font[t->size], t->txt, *t->c); t->img = TTF_RenderText_Solid(font[t->size], t->txt, *t->c);
// make sure it's on the screen (leave space for border) // make sure it's on the screen (leave space for border)
if (t->x - (t->img->w / 2) < 2) { // left if (t->x - (t->img->w / 2) < 2) { // left
t->x = 2 + (t->img->w/2); t->x = 2 + (t->img->w/2);
} }
if (t->x + (t->img->w / 2) > 640-2) { // right if (t->x + (t->img->w / 2) > 640-2) { // right
t->x = 640-2 - (t->img->w/2); t->x = 640-2 - (t->img->w/2);
} }
if (t->y - (t->img->h / 2) < 2) { // top if (t->y - (t->img->h / 2) < 2) { // top
t->y = 2 + (t->img->h/2); t->y = 2 + (t->img->h/2);
} }
if (t->y + (t->img->h / 2) > 480-2) { // bottom if (t->y + (t->img->h / 2) > 480-2) { // bottom
t->y = 480-2 - (t->img->h/2); t->y = 480-2 - (t->img->h/2);
} }
/* get bg */ /* get bg */
t->bgarea.x = t->x - t->img->w/2; t->bgarea.x = t->x - t->img->w/2;
t->bgarea.y = t->y - t->img->h/2; t->bgarea.y = t->y - t->img->h/2;
t->bgarea.w = t->img->w; t->bgarea.w = t->img->w;
t->bgarea.h = t->img->h; t->bgarea.h = t->img->h;
SDL_BlitSurface(screen, &t->bgarea, t->bg, NULL); SDL_BlitSurface(screen, &t->bgarea, t->bg, NULL);
/* draw text */ /* draw text */
area.x = t->x - t->img->w/2; area.x = t->x - t->img->w/2;
area.y = t->y - t->img->h/2; area.y = t->y - t->img->h/2;
area.w = t->img->w; area.w = t->img->w;
area.h = t->img->h; area.h = t->img->h;
SDL_BlitSurface(t->img,NULL, screen, &area); SDL_BlitSurface(t->img,NULL, screen, &area);
}
} }
@ -4129,18 +4166,22 @@ 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 > -NETSPEED) s->netspeed--; if (s->netspeed == 0) {
else { printf("maxlen %d\n",s->netlen);
if (s->netlen <= 0) { }
s->netting = 0; if (s->netspeed > -NETSPEED) {
adjustx(s, F_WALK1); s->netspeed--;
for (s2 = sprite ; s2 ; s2 = s2->next) { } else {
if ((s2->caughtby == s) && (s2->caughtstate == C_NETTING)) { if (s->netlen <= 0) {
s2->caughtstate = C_NETTED; s->netting = 0;
} adjustx(s, F_WALK1);
for (s2 = sprite ; s2 ; s2 = s2->next) {
if ((s2->caughtby == s) && (s2->caughtstate == C_NETTING)) {
s2->caughtstate = C_NETTED;
} }
} }
} }
}
} }
} else if (s->slamming) { } else if (s->slamming) {
int netx,nety; int netx,nety;
@ -4434,7 +4475,7 @@ void dogravity(sprite_t *s) {
} }
if (pointsinc > 250) { if (pointsinc > 250) {
sprintf(tempm, "%d",pointsinc); sprintf(tempm, "%d",pointsinc);
addoutlinetext(xnet,ynet-TILEH, psize, tempm, &white,&black,POINTSDELAY); addoutlinetext(xnet,ynet-TILEH, psize, tempm, &white,&black,POINTSDELAY, TT_NORM);
/* give points to player */ /* give points to player */
//s->score += pointsinc; //s->score += pointsinc;
addscore(s, pointsinc); addscore(s, pointsinc);
@ -4567,13 +4608,13 @@ int dofruiteffect(sprite_t *s) {
if (s->id == P_SPEED) { if (s->id == P_SPEED) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->speed = PLAYERFAST; player->speed = PLAYERFAST;
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, "Speed up!", &white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, "Speed up!", &white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_BIGSPEED) { } else if (s->id == P_BIGSPEED) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->permspeed = B_TRUE; player->permspeed = B_TRUE;
player->speed = PLAYERFAST; player->speed = PLAYERFAST;
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_LIFE, "SUPER SPEED UP!", &cyan,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_LIFE, "SUPER SPEED UP!", &cyan,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_NUMNETS) { } else if (s->id == P_NUMNETS) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
@ -4581,13 +4622,13 @@ int dofruiteffect(sprite_t *s) {
player->netmax++; player->netmax++;
} }
sprintf(tempm, "%d nets!",player->netmax); sprintf(tempm, "%d nets!",player->netmax);
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_BIGNET) { } else if (s->id == P_BIGNET) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->netbig = B_TRUE; player->netbig = B_TRUE;
sprintf(tempm, "Big net!"); sprintf(tempm, "Big net!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_TROPHY) { } else if (s->id == P_TROPHY) {
// all powerups // all powerups
@ -4596,46 +4637,46 @@ int dofruiteffect(sprite_t *s) {
player->netbig = B_TRUE; // big net player->netbig = B_TRUE; // big net
player->speed = 2; // fast player->speed = 2; // fast
sprintf(tempm, "Full power!"); sprintf(tempm, "Full power!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_MASKPOWERUP) { } else if (s->id == P_MASKPOWERUP) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->hasmask = B_TRUE; player->hasmask = B_TRUE;
sprintf(tempm, "Scuba Mask!"); sprintf(tempm, "Scuba Mask!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_BELL) { } else if (s->id == P_BELL) {
// all powerups // all powerups
playfx(FX_BELL); // different sound effect playfx(FX_BELL); // different sound effect
player->hasbell = B_TRUE; player->hasbell = B_TRUE;
sprintf(tempm, "Powerup Detector!"); sprintf(tempm, "Powerup Detector!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_RINGGOLD) { } else if (s->id == P_RINGGOLD) {
// points for walking // points for walking
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->powerup = PW_RINGWALK; player->powerup = PW_RINGWALK;
sprintf(tempm, "Walk Ring!"); sprintf(tempm, "Walk Ring!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_RINGSILVER) { } else if (s->id == P_RINGSILVER) {
// points for walking // points for walking
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->powerup = PW_RINGJUMP; player->powerup = PW_RINGJUMP;
sprintf(tempm, "Jump Ring!"); sprintf(tempm, "Jump Ring!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_MACEPOWERUP) { } else if (s->id == P_MACEPOWERUP) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->powerup = PW_MACE; player->powerup = PW_MACE;
sprintf(tempm, "Mace Slam!"); sprintf(tempm, "Mace Slam!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_BOXING) { } else if (s->id == P_BOXING) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->powerup = PW_BOXING; player->powerup = PW_BOXING;
sprintf(tempm, "Boxing Glove!"); sprintf(tempm, "Boxing Glove!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_HELMET) { } else if (s->id == P_HELMET) {
int xx,yy; int xx,yy;
@ -4643,7 +4684,7 @@ int dofruiteffect(sprite_t *s) {
player->id = P_ARMOUR; // change how the player looks player->id = P_ARMOUR; // change how the player looks
player->armour = B_TRUE; player->armour = B_TRUE;
sprintf(tempm, "Armour!"); sprintf(tempm, "Armour!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
// add puffs // add puffs
for (xx = s->x - TILEW; xx <= s->x + TILEW; xx += TILEW) { for (xx = s->x - TILEW; xx <= s->x + TILEW; xx += TILEW) {
for (yy = s->y - TILEW*2; yy <= s->y; yy += TILEH) { for (yy = s->y - TILEW*2; yy <= s->y; yy += TILEH) {
@ -4659,14 +4700,14 @@ int dofruiteffect(sprite_t *s) {
player->gemboost = 3; player->gemboost = 3;
} }
sprintf(tempm, "Bonus x%d!",player->gemboost); sprintf(tempm, "Bonus x%d!",player->gemboost);
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_FTODIAMOND) { } else if (s->id == P_FTODIAMOND) {
sprite_t *s2, *nexts; sprite_t *s2, *nexts;
// convert all flowers to diamonds // convert all flowers to diamonds
playfx(FX_MORPH); playfx(FX_MORPH);
sprintf(tempm, "Make diamonds!"); sprintf(tempm, "Make diamonds!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
for (s2 = sprite; s2 ; s2 = nexts) { for (s2 = sprite; s2 ; s2 = nexts) {
nexts = s2->next; nexts = s2->next;
if (isflower(s2->id)) { if (isflower(s2->id)) {
@ -4690,7 +4731,7 @@ int dofruiteffect(sprite_t *s) {
// convert all flowers to gems // convert all flowers to gems
playfx(FX_MORPH); playfx(FX_MORPH);
sprintf(tempm, "Make gems!"); sprintf(tempm, "Make gems!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
for (s2 = sprite; s2 ; s2 = nexts) { for (s2 = sprite; s2 ; s2 = nexts) {
nexts = s2->next; nexts = s2->next;
if (isflower(s2->id)) { if (isflower(s2->id)) {
@ -4746,7 +4787,7 @@ int dofruiteffect(sprite_t *s) {
player->powerup = PW_CLOCK; player->powerup = PW_CLOCK;
clocktime = CLOCKTIME; clocktime = CLOCKTIME;
sprintf(tempm, "Freeze time!"); sprintf(tempm, "Freeze time!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
// pause music // pause music
Mix_PauseMusic(); Mix_PauseMusic();
return B_TRUE; return B_TRUE;
@ -4754,7 +4795,7 @@ int dofruiteffect(sprite_t *s) {
// flood level // flood level
playfx(FX_FLOOD); playfx(FX_FLOOD);
sprintf(tempm, "Flood!"); sprintf(tempm, "Flood!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&blue,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&blue,&black,POINTSDELAY, TT_NORM);
if (!curlevel->iced) { if (!curlevel->iced) {
curlevel->iced = WATER_INPROGRESS; curlevel->iced = WATER_INPROGRESS;
curlevel->icey = LEVELH-1; curlevel->icey = LEVELH-1;
@ -4766,7 +4807,7 @@ int dofruiteffect(sprite_t *s) {
// ice // ice
playfx(FX_FREEZE); playfx(FX_FREEZE);
sprintf(tempm, "Blizzard!"); sprintf(tempm, "Blizzard!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&cyan,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&cyan,&black,POINTSDELAY, TT_NORM);
if (!curlevel->iced) { if (!curlevel->iced) {
curlevel->iced = ICE_INPROGRESS; curlevel->iced = ICE_INPROGRESS;
curlevel->icey = 0; curlevel->icey = 0;
@ -4776,7 +4817,7 @@ int dofruiteffect(sprite_t *s) {
// flyspray // flyspray
playfx(FX_SPRAY); playfx(FX_SPRAY);
sprintf(tempm, "Fly Spray!"); sprintf(tempm, "Fly Spray!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
player->powerup = PW_SPRAYUP; player->powerup = PW_SPRAYUP;
sprayalpha = 0; sprayalpha = 0;
return B_TRUE; return B_TRUE;
@ -4784,7 +4825,7 @@ int dofruiteffect(sprite_t *s) {
// flyspray // flyspray
playfx(FX_POWERUP); playfx(FX_POWERUP);
sprintf(tempm, "Fusion Cannon"); sprintf(tempm, "Fusion Cannon");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
player->powerup = PW_CANNON; player->powerup = PW_CANNON;
puffin(P_CANNON, player->x, player->y,"cannon", 0); puffin(P_CANNON, player->x, player->y,"cannon", 0);
return B_TRUE; return B_TRUE;
@ -4792,7 +4833,7 @@ int dofruiteffect(sprite_t *s) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
player->netsticky = B_TRUE; player->netsticky = B_TRUE;
sprintf(tempm, "Sticky net!"); sprintf(tempm, "Sticky net!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_LIFE) { } else if (s->id == P_LIFE) {
extralife(player); extralife(player);
@ -4804,11 +4845,11 @@ int dofruiteffect(sprite_t *s) {
if (isbosslevel(curlevelnum + 1)) { if (isbosslevel(curlevelnum + 1)) {
playfx(FX_ENGAGED); playfx(FX_ENGAGED);
sprintf(tempm, "Engaged"); sprintf(tempm, "Engaged");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
} else { } else {
playfx(FX_PHONE); playfx(FX_PHONE);
sprintf(tempm, "Telephone!"); sprintf(tempm, "Telephone!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
// set powerup // set powerup
player->powerup = PW_PHONE; player->powerup = PW_PHONE;
skiplevels = 1; skiplevels = 1;
@ -4835,7 +4876,7 @@ int dofruiteffect(sprite_t *s) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
sprintf(tempm, "Meteor Shower!"); sprintf(tempm, "Meteor Shower!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
wid = imageset[P_METEOR].img[0]->w; wid = imageset[P_METEOR].img[0]->w;
hei = imageset[P_METEOR].img[0]->h; hei = imageset[P_METEOR].img[0]->h;
for (n = 0; n < 7; n++) { for (n = 0; n < 7; n++) {
@ -4875,7 +4916,7 @@ int dofruiteffect(sprite_t *s) {
} }
playfx(FX_STAR); playfx(FX_STAR);
sprintf(tempm, "Shuriken!"); sprintf(tempm, "Shuriken!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
return B_TRUE; return B_TRUE;
} else if (s->id == P_BOMB) { } else if (s->id == P_BOMB) {
@ -4888,7 +4929,7 @@ int dofruiteffect(sprite_t *s) {
// kill all monsters // kill all monsters
playfx(FX_BOOM); playfx(FX_BOOM);
sprintf(tempm, "KABOOM!!"); sprintf(tempm, "KABOOM!!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_BOMB, tempm,&red,&yellow,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_BOMB, tempm,&red,&yellow,POINTSDELAY, TT_NORM);
for (s2 = sprite; s2 ; s2 = nexts) { for (s2 = sprite; s2 ; s2 = nexts) {
nexts = s2->next; nexts = s2->next;
if (isbullet(s2->id)) { if (isbullet(s2->id)) {
@ -4908,7 +4949,7 @@ int dofruiteffect(sprite_t *s) {
} else if (s->id == P_SHIELD) { } else if (s->id == P_SHIELD) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
sprintf(tempm, "Shield!"); sprintf(tempm, "Shield!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM);
// temp invincibility // temp invincibility
player->invuln = SHIELDTIME; player->invuln = SHIELDTIME;
@ -4917,7 +4958,7 @@ int dofruiteffect(sprite_t *s) {
} else if (s->id == P_HELP) { } else if (s->id == P_HELP) {
playfx(FX_POWERUP); playfx(FX_POWERUP);
// TODO: move other HELP text around if need be! // TODO: move other HELP text around if need be!
addoutlinetext(320,240,TEXTSIZE_HELP, s->name, &white,&black,HELPDELAY); addoutlinetext(320,240,TEXTSIZE_HELP, s->name, &white,&black,HELPDELAY,TT_HELP);
return B_TRUE; return B_TRUE;
} else if (iscard(s->id)) { } else if (iscard(s->id)) {
if (player->numcards < MAXCARDS) { if (player->numcards < MAXCARDS) {
@ -4928,7 +4969,7 @@ int dofruiteffect(sprite_t *s) {
// show text // show text
sprintf(tempm, getcardname(s->id)); sprintf(tempm, getcardname(s->id));
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
// add a "card" effect. it will move slowly towards the corner. // add a "card" effect. it will move slowly towards the corner.
newc = addsprite(P_MOVINGCARD,s->x, s->y, "moving_card"); newc = addsprite(P_MOVINGCARD,s->x, s->y, "moving_card");
@ -4946,7 +4987,7 @@ int dofruiteffect(sprite_t *s) {
newc->img = imageset[s->timer1].img[F_WALK1]; newc->img = imageset[s->timer1].img[F_WALK1];
} else { } else {
// is this possible?! // is this possible?!
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, "Full cards!",&red,&black,POINTSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, "Full cards!",&red,&black,POINTSDELAY,TT_NORM);
} }
return B_TRUE; return B_TRUE;
} else if (isflower(s->id)) { } else if (isflower(s->id)) {
@ -4992,7 +5033,7 @@ int dofruiteffect(sprite_t *s) {
} }
playfx(FX_BONUS); playfx(FX_BONUS);
sprintf(tempm, "BONUS!"); sprintf(tempm, "BONUS!");
addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_BONUS, tempm,&white,&black,BONUSDELAY); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_BONUS, tempm,&white,&black,BONUSDELAY,TT_NORM);
return B_TRUE; return B_TRUE;
} }
} }
@ -5240,16 +5281,22 @@ void dumpsprites(void) {
printf("\n\n"); printf("\n\n");
} }
void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol, int delay) { void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol, int delay, int ttype) {
addtext(x-1,y,size,msg,bgcol,delay); // outline int shadowtype;
addtext(x-1,y-1,size,msg,bgcol,delay); // outline if (ttype == TT_HELP) {
addtext(x,y-1,size,msg,bgcol,delay); // outline shadowtype = TT_HELPSHADOW;
addtext(x+1,y-1,size,msg,bgcol,delay); // outline } else {
addtext(x+1,y,size,msg,bgcol,delay); // outline shadowtype = TT_NORM;
addtext(x+1,y+1,size,msg,bgcol,delay); // outline }
addtext(x,y+1,size,msg,bgcol,delay); // outline addtext(x-1,y,size,msg,bgcol,delay,shadowtype); // outline
addtext(x-1,y+1,size,msg,bgcol,delay); // outline addtext(x-1,y-1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x,y,size,msg,col,delay); // main text addtext(x,y-1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x+1,y-1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x+1,y,size,msg,bgcol,delay,shadowtype); // outline
addtext(x+1,y+1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x,y+1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x-1,y+1,size,msg,bgcol,delay,shadowtype); // outline
addtext(x,y,size,msg,col,delay,ttype); // main text
} }
char *addcommas(char *buffer, int num) { char *addcommas(char *buffer, int num) {
@ -5301,7 +5348,7 @@ void addscore(sprite_t *s, int amt) {
void extralife(sprite_t *which) { void extralife(sprite_t *which) {
playfx(FX_LIFE); playfx(FX_LIFE);
which->lives += 1; which->lives += 1;
addoutlinetext(which->x,which->y - which->img->h/2, TEXTSIZE_LIFE, "Extra life!",&green,&black,LIFEDELAY); addoutlinetext(which->x,which->y - which->img->h/2, TEXTSIZE_LIFE, "Extra life!",&green,&black,LIFEDELAY,TT_NORM);
} }
// slowly change level to ice // slowly change level to ice
@ -5436,7 +5483,7 @@ void checksprites(void) {
// then show hiscores // then show hiscores
// then back to title screen // then back to title screen
} else { } else {
addoutlinetext(320,240,TEXTSIZE_GAMEOVER,"Game Over",&red,&black,GAMEOVERDELAY); addoutlinetext(320,240,TEXTSIZE_GAMEOVER,"Game Over",&red,&black,GAMEOVERDELAY,TT_NORM);
levelcomplete = LV_GAMEOVER; levelcomplete = LV_GAMEOVER;
stopmusic(); stopmusic();
playfx(FX_GAMEOVER); playfx(FX_GAMEOVER);
@ -5637,10 +5684,10 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
playfx(FX_FRUIT); playfx(FX_FRUIT);
if (multiplier <= 1) { if (multiplier <= 1) {
sprintf(tempm, "%d", gotscore); sprintf(tempm, "%d", gotscore);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, &white,&black,POINTSDELAY); addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, &white,&black,POINTSDELAY,TT_NORM);
} else { } else {
sprintf(tempm, "%d x %d" , gotscore,multiplier); sprintf(tempm, "%d x %d" , gotscore,multiplier);
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, &white,&black,POINTSDELAY); addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, &white,&black,POINTSDELAY,TT_NORM);
} }
} }
} }
@ -5833,8 +5880,8 @@ void gaincard(sprite_t *s, int cardid) {
getpokermsg2(pokereffect, msg); getpokermsg2(pokereffect, msg);
// display BIG message // display BIG message
addoutlinetext(320,180,TEXTSIZE_POKER,getpokermsg(pokereffect),&green, &black, POKERDELAY); addoutlinetext(320,180,TEXTSIZE_POKER,getpokermsg(pokereffect),&green, &black, POKERDELAY,TT_NORM);
addoutlinetext(320,290,TEXTSIZE_POKER,msg,&green, &black, POKERDELAY); addoutlinetext(320,290,TEXTSIZE_POKER,msg,&green, &black, POKERDELAY,TT_NORM);
// pause music // pause music
Mix_PauseMusic(); Mix_PauseMusic();
@ -6199,12 +6246,12 @@ void dopokereffect(sprite_t *pl, int effect) {
// points // points
addscore(pl, pokerpoints); addscore(pl, pokerpoints);
sprintf(tempmsg, "%d",pokerpoints); sprintf(tempmsg, "%d",pokerpoints);
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
break; break;
case PE_TRIPLE: case PE_TRIPLE:
// skip 3 levels // skip 3 levels
sprintf(tempmsg, "Skip 3 levels!"); sprintf(tempmsg, "Skip 3 levels!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
// set powerup // set powerup
player->powerup = PW_PHONE; player->powerup = PW_PHONE;
skiplevels = 2; skiplevels = 2;
@ -6228,12 +6275,12 @@ void dopokereffect(sprite_t *pl, int effect) {
pl->permsticky = B_TRUE; pl->permsticky = B_TRUE;
pl->netsticky = B_TRUE; pl->netsticky = B_TRUE;
sprintf(tempmsg, "Permenant sticky net!"); sprintf(tempmsg, "Permenant sticky net!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
break; break;
case PE_FLUSH: case PE_FLUSH:
// skip 5 levels // skip 5 levels
sprintf(tempmsg, "Skip 5 levels!"); sprintf(tempmsg, "Skip 5 levels!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
// set powerup // set powerup
player->powerup = PW_PHONE; player->powerup = PW_PHONE;
skiplevels = 4; skiplevels = 4;
@ -6257,19 +6304,19 @@ void dopokereffect(sprite_t *pl, int effect) {
pl->permbignet = B_TRUE; pl->permbignet = B_TRUE;
pl->netbig = B_TRUE; pl->netbig = B_TRUE;
sprintf(tempmsg, "Permenant Big Nets!"); sprintf(tempmsg, "Permenant Big Nets!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
break; break;
case PE_FOUR: case PE_FOUR:
// permenant max nets // permenant max nets
pl->permnumnets = B_TRUE; pl->permnumnets = B_TRUE;
pl->netmax = 4; pl->netmax = 4;
sprintf(tempmsg, "Permenant Max Nets!"); sprintf(tempmsg, "Permenant Max Nets!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
break; break;
case PE_STRAIGHTFLUSH: case PE_STRAIGHTFLUSH:
// skip 7 levels // skip 7 levels
sprintf(tempmsg, "Skip 7 levels!"); sprintf(tempmsg, "Skip 7 levels!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
// set powerup // set powerup
player->powerup = PW_PHONE; player->powerup = PW_PHONE;
skiplevels = 6; skiplevels = 6;
@ -6297,7 +6344,7 @@ void dopokereffect(sprite_t *pl, int effect) {
pl->netbig = B_TRUE; pl->netbig = B_TRUE;
pl->netmax = 4; pl->netmax = 4;
sprintf(tempmsg, "Permenant full power!"); sprintf(tempmsg, "Permenant full power!");
addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY); addoutlinetext(pl->x,pl->y - pl->img->h/2, TEXTSIZE_BONUS, tempmsg,&cyan,&black,POKERMSGDELAY,TT_NORM);
break; break;
} }
} }
@ -6401,9 +6448,29 @@ int getcardvalue(int cardid) {
void handleinput(void) { void handleinput(void) {
int i; int i;
SDL_Event event;
if (levelcomplete == LV_HELPFREEZE) {
// handle keys differently
// we only care about a single keyup event
SDL_PumpEvents();
while (SDL_PollEvent(&event)) {
if (event.type == SDL_KEYUP) {
if (event.key.keysym.sym == SDLK_z) {
levelcomplete = oldlevelcomplete;
}
}
}
// TODO: handle joystick buttonpress!!
return;
}
/* check for keys */ /* check for keys */
SDL_PumpEvents(); SDL_PumpEvents();
keys = SDL_GetKeyState(NULL); keys = SDL_GetKeyState(NULL);
// check for joystick // check for joystick
@ -6435,7 +6502,7 @@ void handleinput(void) {
player->speed = 2; // fast player->speed = 2; // fast
player->netsticky = B_TRUE; player->netsticky = B_TRUE;
sprintf(tempm, "Cheat!"); sprintf(tempm, "Cheat!");
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY); addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
toggletimer = 80; toggletimer = 80;
} }
} }
@ -6496,7 +6563,7 @@ void handleinput(void) {
// kill all monsters // kill all monsters
playfx(FX_BOOM); playfx(FX_BOOM);
sprintf(tempm, "KABOOM!!"); sprintf(tempm, "KABOOM!!");
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_BOMB, tempm,&red,&yellow,POINTSDELAY); addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_BOMB, tempm,&red,&yellow,POINTSDELAY,TT_NORM);
for (s2 = sprite; s2 ; s2 = nexts) { for (s2 = sprite; s2 ; s2 = nexts) {
nexts = s2->next; nexts = s2->next;
if (isbullet(s2->id)) { if (isbullet(s2->id)) {
@ -6585,6 +6652,9 @@ void handleinput(void) {
} }
} }
} }
// ignore other events
while (SDL_PollEvent(&event)) {
}
} }

4
rc.h
View File

@ -1,6 +1,6 @@
void cleanup(void); void cleanup(void);
int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay); int addtext(int x, int y, int size, char *string, SDL_Color *c, int delay, int ttype);
void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol, int delay); void addoutlinetext(int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol, int delay, int ttype);
void drawscore(void); void drawscore(void);
void drawbosshealth(void); void drawbosshealth(void);
void drawtext(void); void drawtext(void);