Added multicoloured score text
This commit is contained in:
parent
cc8f692bc3
commit
9449332a9d
49
rc.c
49
rc.c
|
@ -156,6 +156,8 @@ SDL_Color orange = {255, 167, 88, 1};
|
||||||
SDL_Color black = {0, 0, 0, 0};
|
SDL_Color black = {0, 0, 0, 0};
|
||||||
SDL_Color blue = {0, 0, 255, 0};
|
SDL_Color blue = {0, 0, 255, 0};
|
||||||
SDL_Color cyan = {0, 255, 255, 0};
|
SDL_Color cyan = {0, 255, 255, 0};
|
||||||
|
SDL_Color purple = {200, 0, 200, 0};
|
||||||
|
SDL_Color brown = {166, 97, 7, 0};
|
||||||
SDL_Color white = {255, 255, 255, 0};
|
SDL_Color white = {255, 255, 255, 0};
|
||||||
SDL_Color grey = {210, 210, 210, 0};
|
SDL_Color grey = {210, 210, 210, 0};
|
||||||
SDL_Color grey2 = {90, 90, 90, 0};
|
SDL_Color grey2 = {90, 90, 90, 0};
|
||||||
|
@ -8027,6 +8029,7 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
|
||||||
int gotscore = fruit->score;
|
int gotscore = fruit->score;
|
||||||
int modscore = gotscore; // default
|
int modscore = gotscore; // default
|
||||||
int i;
|
int i;
|
||||||
|
SDL_Color *col, *bgcol;
|
||||||
|
|
||||||
/* kill the fruit */
|
/* kill the fruit */
|
||||||
fruit->dead = D_FINAL;
|
fruit->dead = D_FINAL;
|
||||||
|
@ -8043,12 +8046,14 @@ void getfruit(sprite_t *giveto, sprite_t *fruit, int multiplier) {
|
||||||
/* handle fruit effects */
|
/* handle fruit effects */
|
||||||
if (!dofruiteffect(giveto, fruit)) {
|
if (!dofruiteffect(giveto, fruit)) {
|
||||||
playfx(FX_FRUIT);
|
playfx(FX_FRUIT);
|
||||||
|
col = getcolour(fruit->id);
|
||||||
|
bgcol = getbgcolour(fruit->id);
|
||||||
if (multiplier <= 1) {
|
if (multiplier <= 1) {
|
||||||
sprintf(tempm, "%d", modscore);
|
sprintf(tempm, "%d", modscore);
|
||||||
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, &white,&black,POINTSDELAY,TT_NORM);
|
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS, tempm, col,bgcol,POINTSDELAY,TT_NORM);
|
||||||
} else {
|
} else {
|
||||||
sprintf(tempm, "%d x %d" , modscore,multiplier);
|
sprintf(tempm, "%d x %d" , modscore,multiplier);
|
||||||
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, &white,&black,POINTSDELAY,TT_NORM);
|
addoutlinetext(fruit->x,fruit->y - fruit->img->h/2, TEXTSIZE_POINTS + 2*multiplier, tempm, col,bgcol,POINTSDELAY,TT_NORM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10924,3 +10929,43 @@ sprite_t *isplayerright(sprite_t *s) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SDL_Color *getcolour(int id) {
|
||||||
|
switch (id) {
|
||||||
|
case P_FLOWERYELLOW:
|
||||||
|
case P_GEMYELLOW:
|
||||||
|
case P_CHEESE:
|
||||||
|
case P_PIZZA:
|
||||||
|
return &yellow;
|
||||||
|
case P_FLOWERRED:
|
||||||
|
case P_GEMRED:
|
||||||
|
case P_CHIPS:
|
||||||
|
return &red;
|
||||||
|
case P_FLOWERPURPLE:
|
||||||
|
case P_GEMPURPLE:
|
||||||
|
return &purple;
|
||||||
|
case P_BURGER:
|
||||||
|
case P_SUNDAE:
|
||||||
|
case P_CHOCOLATE:
|
||||||
|
return &brown;
|
||||||
|
case P_DIAMOND:
|
||||||
|
return &cyan;
|
||||||
|
case P_CAKE:
|
||||||
|
return &blue;
|
||||||
|
case P_ICECREAM:
|
||||||
|
return &white;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &white;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Color *getbgcolour (int id) {
|
||||||
|
switch (id) {
|
||||||
|
case P_PIZZA:
|
||||||
|
return &red2;
|
||||||
|
case P_CHIPS:
|
||||||
|
return &brown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &black;
|
||||||
|
}
|
||||||
|
|
2
rc.h
2
rc.h
|
@ -118,3 +118,5 @@ int playersalive(void);
|
||||||
sprite_t *isplayerbelow(sprite_t *s);
|
sprite_t *isplayerbelow(sprite_t *s);
|
||||||
sprite_t *isplayerabove(sprite_t *s);
|
sprite_t *isplayerabove(sprite_t *s);
|
||||||
sprite_t *isplayerright(sprite_t *s);
|
sprite_t *isplayerright(sprite_t *s);
|
||||||
|
SDL_Color *getcolour(int id);
|
||||||
|
SDL_Color *getbgcolour(int id);
|
||||||
|
|
Loading…
Reference in New Issue