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:
@@ -12,6 +12,8 @@
|
|||||||
#include "../sdl/CInput.h"
|
#include "../sdl/CInput.h"
|
||||||
#include "../sdl/CTimer.h"
|
#include "../sdl/CTimer.h"
|
||||||
|
|
||||||
|
#include "../include/game.h"
|
||||||
|
|
||||||
#define LETTER_SHOW_SPD 30
|
#define LETTER_SHOW_SPD 30
|
||||||
|
|
||||||
#define HEADFOREARTH_WAIT_TIME 600
|
#define HEADFOREARTH_WAIT_TIME 600
|
||||||
@@ -37,6 +39,11 @@ int endsequence(stCloneKeenPlus *pCKP)
|
|||||||
if (eseq3_AwardBigV(pCKP)) return 0;
|
if (eseq3_AwardBigV(pCKP)) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pCKP->Control.levelcontrol.gameovermode = true;
|
||||||
|
// Remove all the items.
|
||||||
|
|
||||||
|
start_gameover(pCKP);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
101
src/game.cpp
101
src/game.cpp
@@ -183,55 +183,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
if (pCKP->Control.levelcontrol.gameovermode)
|
if (pCKP->Control.levelcontrol.gameovermode)
|
||||||
{
|
{
|
||||||
if (enter)
|
if (enter)
|
||||||
{
|
start_gameover( pCKP );
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fade.mode==FADE_COMPLETE && fade.dir==FADE_OUT)
|
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
|
// gives keycard for door doortile to player p
|
||||||
void give_keycard(int doortile, int p)
|
void give_keycard(int doortile, int p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -271,3 +271,4 @@ void gamedo_enemyai(stLevelControl *p_levelcontrol);
|
|||||||
// Referenzed from cinematics/EndingSequenceEp3.cpp
|
// Referenzed from cinematics/EndingSequenceEp3.cpp
|
||||||
void eseq3_Mortimer();
|
void eseq3_Mortimer();
|
||||||
|
|
||||||
|
void start_gameover(stCloneKeenPlus *pCKP);
|
||||||
|
|||||||
@@ -293,13 +293,13 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
g_pGraphics->drawBitmap(x4, y2, bExtra);
|
g_pGraphics->drawBitmap(x4, y2, bExtra);
|
||||||
|
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
*buf= '_';
|
|
||||||
|
|
||||||
// This cycle will wait for the input of name and hit of enter
|
// This cycle will wait for the input of name and hit of enter
|
||||||
|
bool blink = true;
|
||||||
|
int blinkctr = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Blit all the text and images
|
// Blit all the text and images
|
||||||
|
|
||||||
for(i=KA ; i<KZ ; i++)
|
for(i=KA ; i<KZ ; i++)
|
||||||
{
|
{
|
||||||
if(g_pInput->getPressedKey(i))
|
if(g_pInput->getPressedKey(i))
|
||||||
@@ -308,7 +308,6 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
WrittenName.append(buf);
|
WrittenName.append(buf);
|
||||||
copy(WrittenName.data(),WrittenName.data()+WrittenName.length(),Name[place]);
|
copy(WrittenName.data(),WrittenName.data()+WrittenName.length(),Name[place]);
|
||||||
WrittenName.copy(buf,WrittenName.length(),0);
|
WrittenName.copy(buf,WrittenName.length(),0);
|
||||||
strcat(buf,"_");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(g_pInput->getPressedKey(KBCKSPCE) && (WrittenName.length() > 0))
|
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);
|
WrittenName.copy(buf,WrittenName.length(),0);
|
||||||
memset(Name[place],0,16);
|
memset(Name[place],0,16);
|
||||||
WrittenName.copy(Name[place],WrittenName.length(),0);
|
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.
|
// Here it must be split up in Episodes 1, 2 and 3.
|
||||||
// Print the labels
|
// Print the labels
|
||||||
|
|
||||||
for( i=0 ; i<7 ; i++ )
|
for( i=0 ; i<7 ; i++ )
|
||||||
{
|
{
|
||||||
if(i != place)
|
if(i != place)
|
||||||
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
g_pGraphics->sb_color_font_draw(Name[i],40,64+(i<<4),4,7);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
g_pGraphics->sb_color_font_draw(buf,40,64+(i<<4),4,7);
|
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);
|
g_pGraphics->sb_color_font_draw(Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7);
|
||||||
|
|
||||||
if(pCKP->Control.levelcontrol.episode == 1)
|
if(pCKP->Control.levelcontrol.episode == 1)
|
||||||
@@ -357,6 +360,13 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
|
|
||||||
|
blinkctr++; // The blinking cursor
|
||||||
|
if(blinkctr > 100)
|
||||||
|
{
|
||||||
|
blink = !blink;
|
||||||
|
blinkctr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}while(!g_pInput->getPressedKey(KENTER));
|
}while(!g_pInput->getPressedKey(KENTER));
|
||||||
|
|
||||||
saveHighScoreTable();
|
saveHighScoreTable();
|
||||||
|
|||||||
Reference in New Issue
Block a user