Highscore cursor when typing blinks now

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@222 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-08-11 04:47:12 +00:00
parent e935abb56d
commit b236865cb0
4 changed files with 75 additions and 54 deletions

View File

@@ -12,6 +12,8 @@
#include "../sdl/CInput.h"
#include "../sdl/CTimer.h"
#include "../include/game.h"
#define LETTER_SHOW_SPD 30
#define HEADFOREARTH_WAIT_TIME 600
@@ -37,6 +39,11 @@ int endsequence(stCloneKeenPlus *pCKP)
if (eseq3_AwardBigV(pCKP)) return 0;
}
pCKP->Control.levelcontrol.gameovermode = true;
// Remove all the items.
start_gameover(pCKP);
return 0;
}

View File

@@ -183,55 +183,7 @@ void gameloop(stCloneKeenPlus *pCKP)
if (pCKP->Control.levelcontrol.gameovermode)
{
if (enter)
{
int cities=0;
CHighScores *HighScoreTable;
if (pCKP->Control.levelcontrol.levels_completed[4]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[6]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[7]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[13]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[11]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[9]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[15]) cities++;
if (pCKP->Control.levelcontrol.levels_completed[16]) cities++;
HighScoreTable = new CHighScores(pCKP);
bool extras[4] = {false,false,false,false};
// check inventory or saved cities
if(pCKP->Control.levelcontrol.episode == 1)
{
if(player[0].inventory.HasJoystick)
extras[0] = true;
if(player[0].inventory.HasBattery)
extras[1] = true;
if(player[0].inventory.HasVacuum)
extras[2] = true;
if(player[0].inventory.HasWiskey)
extras[3] = true;
}
HighScoreTable->writeHighScore((int)player[0].inventory.score,extras,cities);
HighScoreTable->showHighScore();
delete HighScoreTable;
if (fade.mode!=FADE_GO && fade.dir!=FADE_OUT)
{
fade.dir = FADE_OUT;
fade.curamt = PAL_FADE_SHADES;
fade.fadetimer = 0;
fade.rate = FADE_NORM;
fade.mode = FADE_GO;
}
pCKP->Control.levelcontrol.command = LVLC_GAME_OVER;
}
start_gameover( pCKP );
if (fade.mode==FADE_COMPLETE && fade.dir==FADE_OUT)
{
@@ -271,6 +223,57 @@ void gameloop(stCloneKeenPlus *pCKP)
}
void start_gameover(stCloneKeenPlus *pCKP)
{
int cities=0;
CHighScores *HighScoreTable = new CHighScores(pCKP);
bool extras[4] = {false,false,false,false};
stLevelControl *p_levelcontrol = &(pCKP->Control.levelcontrol);
// check inventory or saved cities
if(p_levelcontrol->episode == 1)
{
if(player[0].inventory.HasJoystick)
extras[0] = true;
if(player[0].inventory.HasBattery)
extras[1] = true;
if(player[0].inventory.HasVacuum)
extras[2] = true;
if(player[0].inventory.HasWiskey)
extras[3] = true;
}
else if(p_levelcontrol->episode == 2)
{
if (p_levelcontrol->levels_completed[4]) cities++;
if (p_levelcontrol->levels_completed[6]) cities++;
if (p_levelcontrol->levels_completed[7]) cities++;
if (p_levelcontrol->levels_completed[13]) cities++;
if (p_levelcontrol->levels_completed[11]) cities++;
if (p_levelcontrol->levels_completed[9]) cities++;
if (p_levelcontrol->levels_completed[15]) cities++;
if (p_levelcontrol->levels_completed[16]) cities++;
}
HighScoreTable->writeHighScore((int)player[0].inventory.score,extras,cities);
HighScoreTable->showHighScore();
delete HighScoreTable;
if (fade.mode!=FADE_GO && fade.dir!=FADE_OUT)
{
fade.dir = FADE_OUT;
fade.curamt = PAL_FADE_SHADES;
fade.fadetimer = 0;
fade.rate = FADE_NORM;
fade.mode = FADE_GO;
}
p_levelcontrol->command = LVLC_GAME_OVER;
}
// gives keycard for door doortile to player p
void give_keycard(int doortile, int p)
{

View File

@@ -271,3 +271,4 @@ void gamedo_enemyai(stLevelControl *p_levelcontrol);
// Referenzed from cinematics/EndingSequenceEp3.cpp
void eseq3_Mortimer();
void start_gameover(stCloneKeenPlus *pCKP);

View File

@@ -293,13 +293,13 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
g_pGraphics->drawBitmap(x4, y2, bExtra);
memset(buf,0,256);
*buf= '_';
// This cycle will wait for the input of name and hit of enter
bool blink = true;
int blinkctr = 0;
do
{
// Blit all the text and images
for(i=KA ; i<KZ ; i++)
{
if(g_pInput->getPressedKey(i))
@@ -308,7 +308,6 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
WrittenName.append(buf);
copy(WrittenName.data(),WrittenName.data()+WrittenName.length(),Name[place]);
WrittenName.copy(buf,WrittenName.length(),0);
strcat(buf,"_");
}
}
if(g_pInput->getPressedKey(KBCKSPCE) && (WrittenName.length() > 0))
@@ -319,7 +318,6 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
WrittenName.copy(buf,WrittenName.length(),0);
memset(Name[place],0,16);
WrittenName.copy(Name[place],WrittenName.length(),0);
strcat(buf,"_");
}
@@ -328,13 +326,18 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
// Here it must be split up in Episodes 1, 2 and 3.
// Print the labels
for( i=0 ; i<7 ; i++ )
{
if(i != place)
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
else
{
g_pGraphics->sb_color_font_draw(buf,40,64+(i<<4),4,7);
if(blink)
g_pGraphics->sb_color_font_draw("_",40+(strlen(buf)<<3),64+(i<<4),4,7);
else
g_pGraphics->sb_color_font_draw(" ",40+(strlen(buf)<<3),64+(i<<4),4,7);
}
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
if(pCKP->Control.levelcontrol.episode == 1)
@@ -357,6 +360,13 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
blinkctr++; // The blinking cursor
if(blinkctr > 100)
{
blink = !blink;
blinkctr = 0;
}
}while(!g_pInput->getPressedKey(KENTER));
saveHighScoreTable();