From cc14a2194e536e1d9bcca7c6371f3002fb4888ec Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Mon, 25 Jul 2016 19:49:48 +1200 Subject: [PATCH] - Reduce time between mode transitions in title screen. - Add a credits screen during title sequence --- defs.h | 4 ++- rc.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++---------- rc.h | 1 + todo | 20 +++++++-------- 4 files changed, 78 insertions(+), 24 deletions(-) diff --git a/defs.h b/defs.h index 560e0c3..95e868a 100644 --- a/defs.h +++ b/defs.h @@ -90,6 +90,7 @@ #define TEXTSIZE_GAMEOVER 50 #define TEXTSIZE_HISCORE 16 #define TEXTSIZE_ENDING 16 +#define TEXTSIZE_CREDITS 16 // text tuypes @@ -812,8 +813,9 @@ enum SPELL { #define TS_WAIT1UP 1 #define TS_SELECTMODE 2 #define TS_HISCORES 3 +#define TS_CREDITS 4 -#define TTIME 10 // time between state switches in title screen +#define TTIME 5 // time between state switches in title screen #define INITPLAYERLIVES 3 diff --git a/rc.c b/rc.c index 61f95b3..10347c4 100644 --- a/rc.c +++ b/rc.c @@ -128,7 +128,7 @@ int initialswapplayers = B_FALSE; int fps; int fpscount; -int titlemode; +int titlemode = TS_INSERTCOIN; int blinkspeed; int credits = 0; int titledone; @@ -12910,7 +12910,8 @@ void dotitlescreen(void) { helpoff = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Off", green2); helpon = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "On", green2); - sprintf(svnver, "%s", REV); + //sprintf(svnver, "rpearce, 2006-2016 - %s", REV); + sprintf(svnver, "By rpearce, 2006-2016"); ver = TTF_RenderText_Solid(font[TEXTSIZE_VER], svnver, greenish); @@ -12932,7 +12933,6 @@ void dotitlescreen(void) { switch (event.type) { case SDL_JOYAXISMOTION: j = event.jaxis.which; - joyx[j] = SDL_JoystickGetAxis(joy[j],0); joyy[j] = SDL_JoystickGetAxis(joy[j],1); //printf("got joy motion: joy %d, x=%d,y=%d\n",j,joyx[j],joyy[j]); @@ -12967,16 +12967,16 @@ void dotitlescreen(void) { } } - - // draw screen - if (titlemode != TS_HISCORES) { - SDL_BlitSurface(titlebg, NULL, screen, NULL); - } else { + if ((titlemode == TS_HISCORES) || (titlemode == TS_CREDITS)) { + // clear screen to black SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); + } else { + // draw titlescreen background + SDL_BlitSurface(titlebg, NULL, screen, NULL); } - if (titlemode != TS_HISCORES) { + if (titlemode == TS_INSERTCOIN) { // version number //area.x = SCREENW - (ver->w) - 10; area.x = (SCREENW/2) - (ver->w/2) - 10; @@ -12990,8 +12990,8 @@ void dotitlescreen(void) { SDL_BlitSurface(ver, NULL, screen, &area); } - // mode-specific text - if ((titlemode == TS_INSERTCOIN) || (titlemode == TS_HISCORES)) { + // "insert coin" text + if ((titlemode == TS_INSERTCOIN) || (titlemode == TS_HISCORES) || (titlemode == TS_CREDITS)) { if (texton) { area.x = 320 - (cointext->w/2)+2; area.y = 10; @@ -13143,9 +13143,10 @@ void dotitlescreen(void) { SDL_BlitSurface(desc, NULL, screen, &area); SDL_FreeSurface(desc); } - } else if (titlemode == TS_HISCORES) { drawhiscores(); + } else if (titlemode == TS_CREDITS) { + drawgamecredits(); } bouncetimer += 7; @@ -13171,13 +13172,15 @@ void dotitlescreen(void) { if ((htime > 0) && (htime % TTIME == 0)) { if (titlemode == TS_INSERTCOIN) { // INSERTCOIN -> NORMAL HISCORES - if (wanthiscores) gethiscores(easymode()); titlemode = TS_HISCORES; + if (wanthiscores) gethiscores(easymode()); } else if (titlemode == TS_HISCORES) { // next time, get other hiscores if (gamemode == GM_EASY) gamemode = GM_NORM; else gamemode = GM_EASY; // NORMAL HISCORES -> INSERTCOIN + titlemode = TS_CREDITS; + } else if (titlemode == TS_CREDITS) { titlemode = TS_INSERTCOIN; } } @@ -13536,6 +13539,54 @@ int submithiscore(int score,int level, char *name) { return submithiscore_local(score, level, name); } +void drawgamecredits(void) { + int x,y,sx,sy; + int indent = 200; + + // draw credits for game + sx = 110; + sy = 50; + x = sx; + y = sy; + + // headings + drawoutlinecentretext(screen, y, TEXTSIZE_CREDITS, "Credits", &cyan, &blue); + y += (TEXTSIZE_CREDITS*2); + + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Code:", &white, &grey2); + x += indent; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2); + x = sx; + y += TEXTSIZE_CREDITS; + y += (TEXTSIZE_CREDITS/2); + + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Graphics:", &white, &grey2); + x += indent; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Rob Pearce", &red, &red2); + x = sx; + y += TEXTSIZE_CREDITS; + y += (TEXTSIZE_CREDITS/2); + + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Music:", &white, &grey2); + x += indent; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Deelite", &red, &red2); + y += TEXTSIZE_CREDITS; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Teo / Fatal Rage", &red, &red2); + y += TEXTSIZE_CREDITS; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Jess", &red, &red2); + y += TEXTSIZE_CREDITS; + y += (TEXTSIZE_CREDITS/2); + x = sx; + + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Giant Cookie:", &white, &grey2); + x += indent; + drawoutlinetext(screen, x, y, TEXTSIZE_CREDITS, "Karen", &red, &red2); + x = sx; + y += TEXTSIZE_CREDITS; + y += (TEXTSIZE_CREDITS/2); +} + + int submithiscore_inet(int score,int level, char *name) { struct sockaddr_in serveraddress; struct hostent *server; diff --git a/rc.h b/rc.h index 36ee9bf..b922cc9 100644 --- a/rc.h +++ b/rc.h @@ -109,6 +109,7 @@ void setjoymappings(void); int joybuttondown(int whichplayer, int key); int joybuttontokey(int buttonnum); void drawcredits(void); +void drawgamecredits(void); int drawoutlinetext(SDL_Surface *where,int x, int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol); void drawoutlinetextcentre(SDL_Surface *where,int y, int size, char *msg, SDL_Color *col, SDL_Color *bgcol); int socket_readline(int sock, char *out); diff --git a/todo b/todo index 131cc6a..5aa720d 100644 --- a/todo +++ b/todo @@ -1,7 +1,14 @@ -*level 80 - should beb able to drop through icebridgethick floors -*give 10 more seconds on "snailsandslugs" +- Half time between switching views in title screen -animate players hanging from umbrellas +- Credits + - giant cookie = karen + - code = rob + - graphics = rob + - music = ??? + + + +- animate players hanging from umbrellas ? - sometimes when falling on to a trampoline at an angle, I teleport up to the top of the screen. @@ -27,8 +34,6 @@ animate players hanging from umbrellas - top left tile is always blank?? -make base walk speed _slightly_ faster? - - New powerups: - until end of level - [ ] treasure map- chest falls at end of level and shoots @@ -104,11 +109,6 @@ make base walk speed _slightly_ faster? - boss - hiscore -- Credits - - giant cookie = karen - - code = rob - - graphics = rob - - music = ??? - New features - pipes