Now showing svn revision in title bar and on title screen
This commit is contained in:
parent
9fccd26f15
commit
9d89611be0
4
Makefile
4
Makefile
|
@ -1,10 +1,10 @@
|
|||
all: rc edit
|
||||
|
||||
rc: rc.c shared.c rc.h shared.h globals.h defs.h
|
||||
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
|
||||
gcc -Wall -DREV=`./getsvnrev.sh` -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
|
||||
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 -DREV=`./getsvnrev.sh` -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
|
||||
|
||||
app: rc
|
||||
./makeapp.sh
|
||||
|
|
3
defs.h
3
defs.h
|
@ -39,6 +39,7 @@
|
|||
|
||||
// text sizes
|
||||
#define TEXTSIZE_POINTS 10
|
||||
#define TEXTSIZE_VER 13
|
||||
#define TEXTSIZE_SCORE 14
|
||||
#define TEXTSIZE_BONUS 20
|
||||
#define TEXTSIZE_HELP 20
|
||||
|
@ -805,6 +806,7 @@ typedef struct imageset_s {
|
|||
imageset_t imageset[MAXPTYPES];
|
||||
|
||||
/* external globals */
|
||||
extern char progname[];
|
||||
extern SDL_Color black;
|
||||
extern SDL_Surface *screen, *temps, *levelbg, *head, *head5, *icecube;
|
||||
extern SDL_Surface *healthbar[];
|
||||
|
@ -840,6 +842,7 @@ extern char *deathtext[];
|
|||
extern char *bifftext[];
|
||||
extern spriteinfo_t spriteinfo[];
|
||||
|
||||
|
||||
extern int gotcard;
|
||||
extern int curcard;
|
||||
extern int deck[];
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
svn info | grep Revision | cut -d " " -f 2
|
|
@ -13,6 +13,8 @@ int gamemode; // easy or hard?
|
|||
|
||||
spriteinfo_t spriteinfo[MAXPTYPES];
|
||||
|
||||
char progname[MIDBUFLEN];
|
||||
|
||||
char *datadir;
|
||||
|
||||
int gotcard; // got a card yet this level?
|
||||
|
|
35
rc.c
35
rc.c
|
@ -153,6 +153,8 @@ SDL_Color grey2 = {90, 90, 90, 0};
|
|||
SDL_Color green = {0, 255, 0, 0};
|
||||
SDL_Color green2 = {0, 150, 0, 0};
|
||||
SDL_Color yellow = {255, 255, 0, 0};
|
||||
SDL_Color greenish = {82, 125, 74, 0};
|
||||
|
||||
|
||||
int vidargs = 0;
|
||||
|
||||
|
@ -245,6 +247,9 @@ int main (int argc, char **argv) {
|
|||
datadir = strdup("data");
|
||||
}
|
||||
|
||||
// set program name (including version string)
|
||||
sprintf(progname, "Rat Catcher v0.%d", REV);
|
||||
|
||||
initsdl();
|
||||
if (TTF_Init()) {
|
||||
printf("TTF_Init: %s\n", TTF_GetError());
|
||||
|
@ -6390,15 +6395,19 @@ void togglefullscreen(void) {
|
|||
//SDL_Quit();
|
||||
|
||||
// set fullscreen variable
|
||||
/*
|
||||
if (fullscreen) {
|
||||
fullscreen = B_FALSE;
|
||||
} else {
|
||||
fullscreen = B_TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
screen=SDL_SetVideoMode(screen->w,screen->h,screen->format->BitsPerPixel,SDL_SWSURFACE|(screen->flags&SDL_FULLSCREEN?0:SDL_FULLSCREEN));
|
||||
|
||||
// set title bar if required
|
||||
if (!fullscreen) {
|
||||
SDL_WM_SetCaption(progname, progname);
|
||||
}
|
||||
|
||||
// redraw background
|
||||
SDL_BlitSurface(temps, NULL, screen, NULL);
|
||||
/* redo framerate manager */
|
||||
|
@ -6430,6 +6439,8 @@ void initsdl(void) {
|
|||
screen = SDL_SetVideoMode(640,480,16,SDL_SWSURFACE|vidargs);
|
||||
#endif
|
||||
|
||||
// set title bar
|
||||
SDL_WM_SetCaption(progname, progname);
|
||||
|
||||
if (!screen) {
|
||||
printf("Failed to open window: %s\n", SDL_GetError());
|
||||
|
@ -7794,8 +7805,9 @@ void docannoneffect(void) {
|
|||
|
||||
void dotitlescreen(void) {
|
||||
char tempst[BUFLEN];
|
||||
char svnver[MIDBUFLEN];
|
||||
SDL_Surface *titlebg;
|
||||
SDL_Surface *cointext, *text, *text2, *easy, *norm;
|
||||
SDL_Surface *cointext, *text, *text2, *easy, *norm, *ver;
|
||||
SDL_Event event;
|
||||
SDL_Rect area;
|
||||
int timer = 0;
|
||||
|
@ -7822,6 +7834,10 @@ void dotitlescreen(void) {
|
|||
easy = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Easy Mode", red2);
|
||||
norm = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Normal Mode", red2);
|
||||
|
||||
sprintf(svnver, "v0.%d",REV);
|
||||
ver = TTF_RenderText_Solid(font[TEXTSIZE_VER], svnver, greenish);
|
||||
|
||||
|
||||
if (credits > 0) {
|
||||
titlemode = TS_WAIT1UP;
|
||||
} else {
|
||||
|
@ -7876,6 +7892,19 @@ void dotitlescreen(void) {
|
|||
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
|
||||
}
|
||||
|
||||
if (titlemode != TS_HISCORES) {
|
||||
// version number
|
||||
area.x = 640 - (ver->w) - 10;
|
||||
area.y = 150;
|
||||
SDL_SetColors(ver, &black, 1, 1);
|
||||
SDL_BlitSurface(ver, NULL, screen, &area);
|
||||
|
||||
area.x -= 2;
|
||||
area.y -= 2;
|
||||
SDL_SetColors(ver, &greenish, 1, 1);
|
||||
SDL_BlitSurface(ver, NULL, screen, &area);
|
||||
}
|
||||
|
||||
// mode-specific text
|
||||
if ((titlemode == TS_INSERTCOIN) || (titlemode == TS_HISCORES)) {
|
||||
if (texton) {
|
||||
|
|
Loading…
Reference in New Issue