WIP : improved HUD & sliding in curves
This commit is contained in:
parent
8b64a2db55
commit
a421c6186f
148
CppOutRun.layout
148
CppOutRun.layout
|
@ -2,24 +2,34 @@
|
|||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="370" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1019" topLine="8" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="655" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/clock.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/parameters.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/cars.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="412" topLine="1" />
|
||||
<Cursor1 position="35" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/circuit.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -49,26 +59,14 @@
|
|||
<Collapse line="1175" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/include/cars.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="306" topLine="0" />
|
||||
<Cursor1 position="412" topLine="1" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/menus.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/include/saves.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="46095" topLine="898" />
|
||||
</Cursor>
|
||||
<Folding>
|
||||
<Collapse line="116" />
|
||||
<Collapse line="551" />
|
||||
<Collapse line="666" />
|
||||
<Collapse line="709" />
|
||||
<Collapse line="872" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="35" topLine="0" />
|
||||
<Cursor1 position="319" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/clock.cc" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -76,9 +74,39 @@
|
|||
<Cursor1 position="975" topLine="73" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/fixed.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/include/menus.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="5" topLine="0" />
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="203" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="306" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="783" topLine="3" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/parameters.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/utils.cc" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="2658" topLine="70" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/segment.cc" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="410" topLine="29" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -94,6 +122,11 @@
|
|||
<Collapse line="131" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/src/saves.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="294" topLine="2" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/main.cc" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="43460" topLine="93" />
|
||||
|
@ -102,55 +135,17 @@
|
|||
<Collapse line="194" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/include/menus.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/src/menus.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="203" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/utils.cc" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="2658" topLine="57" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/saves.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="294" topLine="2" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="655" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="783" topLine="3" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="370" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="251" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/saves.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="319" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
<Cursor1 position="46095" topLine="898" />
|
||||
</Cursor>
|
||||
<Folding>
|
||||
<Collapse line="116" />
|
||||
<Collapse line="551" />
|
||||
<Collapse line="666" />
|
||||
<Collapse line="709" />
|
||||
<Collapse line="872" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="CMakeLists.txt" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
|
@ -162,9 +157,14 @@
|
|||
<Cursor1 position="1093" topLine="47" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/segment.cc" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
|
||||
<File name="src/fixed.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="410" topLine="29" />
|
||||
<Cursor1 position="5" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="251" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/utils.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
|
44
src/main.cc
44
src/main.cc
|
@ -200,6 +200,7 @@ void initEverything( void )
|
|||
|
||||
|
||||
float timepressed = 0.0f;
|
||||
float timeunpressed = 0.0f;
|
||||
int directionPressed = 0;
|
||||
bool CarIsSliding = false;
|
||||
uint16_t framesmoke = 0;
|
||||
|
@ -247,6 +248,8 @@ static void get_inputs( float dt, int index )
|
|||
if (directionPressed!=-1) directionPressed=-1, timepressed = 0.0f;
|
||||
else if (directionPressed==-1 && CC<0) timepressed += dt;
|
||||
|
||||
timeunpressed = 0.0f;
|
||||
|
||||
viewside=-1;
|
||||
if (CC<0) viewside=-2; // We are in a curve and turning
|
||||
if (CC>0) viewside=0;
|
||||
|
@ -259,6 +262,8 @@ static void get_inputs( float dt, int index )
|
|||
if (directionPressed!=1) directionPressed=1, timepressed = 0.0f;
|
||||
else if (directionPressed==1 && CC>0) timepressed += dt;
|
||||
|
||||
timeunpressed = 0.0f;
|
||||
|
||||
viewside=1;
|
||||
if (CC>0) viewside=+2;
|
||||
if (CC<0) viewside=0;
|
||||
|
@ -266,6 +271,7 @@ static void get_inputs( float dt, int index )
|
|||
else if (!keydown(KEY_RIGHT) && !keydown(KEY_F6) && !keydown(KEY_LEFT) && !keydown(KEY_F5))
|
||||
{
|
||||
directionPressed=0, timepressed = 0.0f;
|
||||
timeunpressed += dt;
|
||||
}
|
||||
|
||||
if(keydown(KEY_SHIFT) || keydown(KEY_XOT) || keydown(KEY_F1)) // Accelerates
|
||||
|
@ -357,20 +363,39 @@ static void get_inputs( float dt, int index )
|
|||
if (timepressed>=300.0f) // was 500.0f
|
||||
{
|
||||
CarIsSliding = true;
|
||||
cam->decX( CC*dt*speed/50 );
|
||||
cam->decX( CC*dt*speed/30.0f ); // was 50.0f
|
||||
speed = speed * 0.975;
|
||||
framesmoke++;
|
||||
}
|
||||
else
|
||||
else if (timeunpressed>=200.0f)
|
||||
{
|
||||
CarIsSliding = false;
|
||||
framesmoke=0;
|
||||
framesmoke = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void get_minimum_inputs( void )
|
||||
static void get_inputs_start( void )
|
||||
{
|
||||
key_event_t ev;
|
||||
while((ev = pollevent()).type != KEYEV_NONE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(keydown(KEY_EXIT)) drawPauseQuit();
|
||||
|
||||
if(keydown(KEY_OPTN)) drawOptions();
|
||||
|
||||
#if IS_FXLIB==1
|
||||
if(keydown(KEY_7)) screenshot = true;
|
||||
if(keydown(KEY_8)) record = !record;
|
||||
#endif // IS_FXLIB
|
||||
}
|
||||
|
||||
|
||||
static void get_inputs_finish_fail( void )
|
||||
{
|
||||
key_event_t ev;
|
||||
while((ev = pollevent()).type != KEYEV_NONE)
|
||||
|
@ -389,7 +414,6 @@ static void get_minimum_inputs( void )
|
|||
}
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
__printf_enable_fp();
|
||||
|
@ -693,7 +717,9 @@ int main(void)
|
|||
prof_enter(perf_update);
|
||||
|
||||
if (!initiateStart && !finishSequence && !failSequence) get_inputs( dt, indexstart ); // The racer is not started : no need to get inputs and we are not in fail or finish sequence
|
||||
else get_minimum_inputs(); // the we can just have minimum inputs
|
||||
else if (initiateStart) get_inputs_start(); // If we are in the start sequence, not need to check for restart we can just have minimum inputs
|
||||
else if (finishSequence || failSequence) get_inputs_finish_fail();
|
||||
|
||||
|
||||
//former position
|
||||
|
||||
|
@ -1077,11 +1103,11 @@ int main(void)
|
|||
dprint_opt(390,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score );
|
||||
dprint_opt(388,1, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score ); // the ';' char corresponds to "s"
|
||||
|
||||
dprint_opt(390,23, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage );
|
||||
dprint_opt(388,21, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage ); // the ';' char corresponds to "s"
|
||||
dprint_opt(390,23, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D/%d", stage, jalons.size() );
|
||||
dprint_opt(388,21, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D/%d", stage, jalons.size() ); // the ';' char corresponds to "s"
|
||||
|
||||
|
||||
if (multilap)
|
||||
//if (multilap)
|
||||
{
|
||||
dsubimage( 135, 25, &speedhud, 28, 143, 27, 13, DIMAGE_NONE); // Lap logo
|
||||
|
||||
|
|
Loading…
Reference in New Issue