//////////Project file From Survivor////////////////////////////
//Code by rishabh Mittal
//For acknex users only # Forget the hard way of writing scores to a txt file, this method is
//easier
////////////////////////////////////////////////////////////////
/*You require 2 bitmaps of screen resolution table, table1 and a custim designed
font*/
var CHECKHIGH;
bmap dis1 =
;//Your background bitmap if player gets a highscore(For high score table)
bmap dis2 = ;//your background bitmap if player sees hall of fame
//////////High score defenitions//////////////////////////////
//I am using 3 high score recorder , u may use more by simply cut pasting////
SKILL SCORE1 = { TYPE GLOBAL; VAL 100; }//high score 1
SKILL SCORE2 = { TYPE GLOBAL; VAL 75; }//high score 2
SKILL SCORE3 = { TYPE GLOBAL; VAL 50; }//high score 3
string high1_str[15]; //For taking the players name using inkey method
string high2_str[15]; // "
string high3_str[15]; // "
TEXT hightxt1 { LAYER 15; FONT menu_font; POS_X = 80; POS_Y = 80;
STRINGS 2;
STRING "Prompt player to type in his name for first high score";
STRING high1_str; }
//////////////////////////////////change font if req///////////////////////
TEXT hightxt2 { LAYER 15; FONT menu_font; POS_X = 80; POS_Y = 80;
STRINGS 2;
STRING "Prompt player to type in his name for second high score";
STRING high2_str; }
/////////////////////////////////////////////
TEXT hightxt3 { LAYER 15; FONT menu_font; POS_X = 80; POS_Y = 80;
STRINGS 2;
STRING "Prompt player to type in his name for third high score";
STRING high3_str; }
//////////////////////////////////
TEXT omega1 { LAYER 15; FONT fame;STRING high1_str;POS_X = 350; POS_Y = 105; }
TEXT omega2 { LAYER 15; FONT fame;STRING high2_str;POS_X = 350; POS_Y = 185; }
TEXT omega3 { LAYER 15; FONT fame;STRING high3_str;POS_X = 350; POS_Y = 265; }
var highno;
///////////////////////////////////////
///////////////
Panel hs1 // display hugh score table when players score is included
{
BMAP dis1;
LAYER 12;
FLAGS REFRESH;
FLAGS D3d;
}
Panel hs2 // display high score when players score is discluded
{
BMAP dis2;
LAYER 12;
FLAGS REFRESH;
FLAGS D3d;
}
///////////////////////////////////////
PANEL sc1 //Displey score1
{
Layer 14;
FLAGS = D3D,refresh,overlay;
DIGITS 150,265,9,standard_font,1,score3;
}
PANEL sc2 //The sequence follows...
{
Layer 14;
FLAGS = D3D,refresh ,overlay;
DIGITS 150,185,9,standard_font,1,score2;
}
PANEL sc3 //score 1
{
LAYER 14;
FLAGS = D3D,refresh, overlay;
DIGITS 150,105,9,standard_font,1,score1;
}
/////////
Function highpane () //This function will turn on the high scores and players who scored it
{
sc1.visible = on;
sc2.visible = on;
sc3.visible = on;
omega1.visible = on;
omega2.visible = on;
omega3.visible = on;
if(highno == 1){hs1.visible = on;}
if(highno == 0){hs2.visible = on;}
//the high score code
WAIT 80;
sc1.visible = off;
sc2.visible = off;
sc3.visible = off;
hs1.visible = off;
hs2.visible = off;
omega1.visible = off;
omega2.visible = off;
omega3.visible = off;
highno = 0;
}
//////// VERY important this function handles checking high scores at end of games and
//entering a new one and passing the last one down
Function anlysescore ()
{
if(checkhigh == 1){ score3 = score2;
str_cpy(high3_str,high2_str);
WAIT 4;
score2 = score1;
str_cpy(high2_str,high1_str);
WAIT 4;
score1 = score;
checkhigh = 0;
/////////For score init//////////
hightxt1.visible = on;
waitt(16);
inkey(high1_str);
if(result == 13)
{
hightxt1.visible = off;
}
//////////////////////////
save_status(); //save players entry
}
if(checkhigh == 2){
score3 = score2;
WAIT 4;
score2 = score;
WAIT 1;
str_cpy(high3_str,high2_str);
checkhigh = 0;
/////////For score init/////second best/////
hightxt2.visible = on;
waitt(16);
inkey(high2_str);
if(result == 13)
{
hightxt2.visible = off;
}
//////////////////////////
save_status();
}
if(checkhigh == 3){ score3 = score;
checkhigh = 0;
/////////last high//////////
hightxt3.visible = on;
waitt(16);
inkey(high3_str);
if(result == 13)
{
hightxt3.visible = off;
}
//////////////////////////
save_status();
}
WAIT 4;
///call score display panel/////////
highpane();
}
/////////Call this function for the high score routine - usually when game overs or player dies
Function scoreit ()
{
if((score >= score1) || (score >= score2) || (score >= score3))
{
highno = 1;
if ((score >= score1) && (score >= score2) && (score >= score3)){checkhigh = 1;}
if ((score >= score2) && (score < score1) && (score > score3)){checkhigh = 2;}
if ((score >= score3) && (score < score2) && (score < score1)){checkhigh = 3;}
WAIT 16;
anlysescore();
}
else{anlysescore();}
}
/////////////////////////////////////////////////////////////
ON_F5 highpane; //assign display high score to F5 key