#include <acknex.h>
//#include "..\\..\\..\\data\\scripts\\game_api.c"
////////////////////////////////////////////////////////////////////////////////////////////////////
BMAP * SpeedRun_Shapes[10];
////////////////////////////////////////////////////////////////////////////////////////////////////
int SpeedRun_Score;
int SpeedRun_Time;
int SpeedRun_Running;
void SetTimer (int * p,int time,void * func)
{
void * temp_func();
while(*p > 0)
{
wait((time * -1));
}
if(func) { temp_func = func; temp_func(); }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
TEXT * SpeedRun_Text = {layer = 11; font = "Arial#20b"; pos_x = 50; pos_y = 200; alpha = 0; flags = TRANSLUCENT; string = "Remember each new symbol that appears.\nCompare the new symbol with the previous symbol that appeared.\nHit \"Right Arrow\" if they match else the \"Left Arrow\"\nBe Careful Right answers in a row give you more score\nBe Quick You need to score as much as possible in a time given. "; }
PANEL * SpeedRun_GameBackground =
{
bmap = "background.tga";
alpha = 0;
layer = 10;
flags = TRANSLUCENT | OVERLAY;
}
PANEL * SpeedRun_Controls =
{
alpha = 0;
layer = 10;
digits(50,50,"Speed Run","Arial#70b",1,0);
digits(50,130,"Hit the right key at the right time","Arial#30b",1,0);
digits(1000,1000,"Time Remaining:%2.f","Arial#30b",1,SpeedRun_Time);
digits(3000,100,"Score:%2.f","Arial#30b",1,SpeedRun_Score);
window(2000,150,200,200,"shape1.tga",200,200);
digits(230,420,"Play","Arial#50b",1,0);
button(120,400,"button1.tga","button2.tga","button1.tga",SpeedRun_StartPlay,NULL,NULL);
flags = TRANSLUCENT | OVERLAY;
}
void SpeedRun_StartPlay ()
{
int Previous = 0;
var Time;// = sys_malloc(sizeof(int));
var Score; //= sys_malloc(sizeof(int));
BMAP * Temp;
int Row;
int Correct;
int Wrong;
int TechPoints;
int Current;
//pan_setdigits(SpeedRun_Controls,1,20,20,"Speed Run - Speed","Arial#25b",1,sys_seconds);//sys_seconds for DUMMY - For the sake of a pointer var
//pan_setstring(SpeedRun_Controls,1,100,100,"Arial#25",str_create("Speed Run"));
//pan_setbutton(SpeedRun_ControlsPlaying,1,0,-100,-100,bmap_create("button1.tga"),bmap_create("button1.tga"),bmap_create("button1.tga"),NULL,NULL,NULL,NULL);
if(SpeedRun_Running)
{
Time = 45;
Current = integer(random(6));
//Previous = Current;
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
pan_setdigits(SpeedRun_Controls,3,50,70,"Time Remaining:%d",font_create("Arial#30b"),1,Time);
pan_setdigits(SpeedRun_Controls,4,320,70,"Score:%d",font_create("Arial#30b"),1,Score);
pan_setdigits(SpeedRun_Controls,5,2000,20,"%f",font_create("Arial#40"),1,sys_seconds);
pan_setbutton(SpeedRun_Controls,1,0,2000,0,Temp,Temp,Temp,NULL,NULL,NULL,NULL);
while(Time != 0)
{
Row = 1;
Score = 0;
if(key_cur) //SAME
{
if(Current == Previous)
{
//Correct
//AddUserXP(2);
Score += 5 * Row;
Row++;
Correct++;
TechPoints++;
Previous = Current;
Current = integer(random(6));
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
while(key_any) { wait(1); }
}
else
{
//Wrong
//AddUserXP(1);
Row = 1;
Score += 5 * Row;
Wrong++;
TechPoints--;
Previous = Current;
Current = integer(random(6));
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
while(key_any) { wait(1); }
}
}
else if(key_cul) //NOT SAME
{
if(Current == Previous)
{
//Wrong
//AddUserXP(1);
Row = 1;
Score += 5 * Row;
Wrong++;
TechPoints--;
Previous = Current;
Current = integer(random(6));
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
while(key_any) { wait(1); }
}
else
{
//Correct
//AddUserXP(2);
Score += 5 * Row;
Row++;
Correct++;
TechPoints++;
Previous = Current;
Current = integer(random(6));
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
while(key_any) { wait(1); }
}
}
wait(1);
}
}
else
{
while(SpeedRun_Controls.alpha > 0)
{
SpeedRun_Controls.alpha -= 5;
SpeedRun_Text.alpha -= 5;
wait(0.01);
}
Current = integer(random(6));
Previous = Current;
reset(SpeedRun_Text,SHOW);
pan_setdigits(SpeedRun_Controls,1,20,20,"Speed Run - Speed",font_create("Arial#40"),1,sys_seconds);
pan_setdigits(SpeedRun_Controls,2,150,130,"Remember the new shape",font_create("Arial#30b"),1,sys_seconds);
Temp = SpeedRun_Shapes[Current];
pan_setwindow(SpeedRun_Controls,1,200,150,200,200,Temp,200,200);
while(SpeedRun_Controls.alpha < 100)
{
SpeedRun_Controls.alpha += 5;
wait(0.01);
}
SpeedRun_Running = 1;
}
}
void SpeedRun_GoGoGo ()
{
BMAP * TEMP;
int Current = integer(random(6));
int Previous = 0;
int Rows;
int Wrongs;
int Correct;
bmap_purge(TEMP);
}
int main ()
{
mouse_mode = 4;
set(SpeedRun_GameBackground,SHOW);
set(SpeedRun_Controls,SHOW);
set(SpeedRun_Text,SHOW);
SpeedRun_Shapes[0] = bmap_create("shape1.tga");
SpeedRun_Shapes[1] = bmap_create("shape2.tga");
SpeedRun_Shapes[2] = bmap_create("shape3.tga");
SpeedRun_Shapes[3] = bmap_create("shape4.tga");
SpeedRun_Shapes[4] = bmap_create("shape5.tga");
SpeedRun_Shapes[5] = bmap_create("shape6.tga");
while(SpeedRun_GameBackground.alpha != 100)
{
SpeedRun_GameBackground.alpha += 5;
SpeedRun_Controls.alpha +=5;
SpeedRun_Text.alpha +=5;
wait(0.01);
}
}