Some code tweaks
This commit is contained in:
parent
7fb2459916
commit
1982eabe6e
4 changed files with 177 additions and 193 deletions
|
@ -189,7 +189,7 @@ void UnloadEndingScreen(void)
|
|||
UnloadTexture(texVignette);
|
||||
|
||||
UnloadSound(fxNews);
|
||||
free(missions);
|
||||
free(missions);
|
||||
}
|
||||
|
||||
// Ending Screen should finish?
|
||||
|
|
|
@ -212,9 +212,6 @@ void InitGameplayScreen(void)
|
|||
int wordInitPosX = 0;
|
||||
int wordInitPosY = 0;
|
||||
|
||||
// TODO: messageWords should be reseted every mission
|
||||
//memcpy(messageWords, 0, sizeof(Word)*MAX_MISSION_WORDS);
|
||||
|
||||
for (int i = 0; i < msgLen; i++)
|
||||
{
|
||||
char c = missions[currentMission].msg[i];
|
||||
|
@ -225,7 +222,6 @@ void InitGameplayScreen(void)
|
|||
messageWords[currentWord - 1].rec.width = (int)MeasureTextEx(fontMessage, SubText(missions[currentMission].msg, wordInitPosX, (i - wordInitPosX)), 30, 0).x;
|
||||
messageWords[currentWord - 1].rec.height = fontMessage.baseSize;
|
||||
|
||||
//TODO: Guardar en message
|
||||
strncpy(messageWords[currentWord - 1].text, SubText(missions[currentMission].msg, wordInitPosX, (i - wordInitPosX)), i - wordInitPosX);
|
||||
}
|
||||
|
||||
|
@ -343,25 +339,18 @@ void UpdateGameplayScreen(void)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Move word picked with mouse
|
||||
// Move word picked with mouse
|
||||
if (words[i].picked)
|
||||
{
|
||||
words[i].rec.x = GetMouseX() - words[i].rec.width/2;
|
||||
words[i].rec.y = GetMouseY() - words[i].rec.height/2;
|
||||
|
||||
// TODO: Check if label is placed in some mission word position
|
||||
//if (CheckCollisionRecs(words[i].rec))
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (words[i].id != -1)
|
||||
}
|
||||
}
|
||||
|
||||
canSend = true;
|
||||
for(int j = 0; j < missions[currentMission].wordsCount; j++)
|
||||
for (int j = 0; j < missions[currentMission].wordsCount; j++)
|
||||
{
|
||||
if(messageWords[j].id == -1)
|
||||
if (messageWords[j].id == -1)
|
||||
{
|
||||
canSend = false;
|
||||
break;
|
||||
|
@ -385,7 +374,7 @@ void DrawGameplayScreen(void)
|
|||
{
|
||||
Rectangle recLines = messageWords[i].rec;
|
||||
DrawRectangleLines(recLines.x, recLines.y, recLines.width, recLines.height, Fade(RED, 0.35f));
|
||||
if(messageWords[i].hover) DrawRectangleRec(messageWords[i].rec, Fade(RED, 0.30f));
|
||||
if (messageWords[i].hover) DrawRectangleRec(messageWords[i].rec, Fade(RED, 0.30f));
|
||||
DrawText(FormatText("%i", messageWords[i].id), i*25, 0, 30, RED);
|
||||
}
|
||||
for (int i = 0; i < MAX_CODING_WORDS; i++)
|
||||
|
|
|
@ -61,15 +61,15 @@ void InitLogoScreen(void)
|
|||
// Logo Screen Update logic
|
||||
void UpdateLogoScreen(void)
|
||||
{
|
||||
if(!fadeOut)
|
||||
if (!fadeOut)
|
||||
{
|
||||
fadeValue += 0.02f;
|
||||
if(fadeValue > 1.01f)
|
||||
if (fadeValue > 1.01f)
|
||||
{
|
||||
fadeValue = 1.0f;
|
||||
framesCounter++;
|
||||
|
||||
if(framesCounter % showLogoFrames == 0)
|
||||
if ((framesCounter%showLogoFrames) == 0)
|
||||
{
|
||||
fadeOut = true;
|
||||
finishScreen = true;
|
||||
|
@ -77,10 +77,7 @@ void UpdateLogoScreen(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(IsKeyPressed(KEY_ENTER))
|
||||
{
|
||||
finishScreen = true;
|
||||
}
|
||||
if (IsKeyPressed(KEY_ENTER)) finishScreen = true;
|
||||
}
|
||||
|
||||
// Logo Screen Draw logic
|
||||
|
|
|
@ -88,8 +88,7 @@ static Music musMission;
|
|||
// Mission Screen Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
static void WriteMissionText();
|
||||
static void EndWritting();
|
||||
static void BlinkKeyword();
|
||||
|
||||
|
||||
// Mission Screen Initialization logic
|
||||
void InitMissionScreen(void)
|
||||
|
@ -167,13 +166,28 @@ void UpdateMissionScreen(void)
|
|||
UpdateMusicStream(musMission);
|
||||
|
||||
if (!writeEnd) WriteMissionText();
|
||||
else BlinkKeyword();
|
||||
else
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
if ((framesCounter%blinkFrames) == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
blinkKeyWord = !blinkKeyWord;
|
||||
}
|
||||
}
|
||||
|
||||
if (showButton)
|
||||
{
|
||||
if (IsKeyPressed(KEY_ENTER) || IsButtonPressed())
|
||||
{
|
||||
if (!writeEnd) EndWritting();
|
||||
if (!writeEnd)
|
||||
{
|
||||
writeEnd = true;
|
||||
writeKeyword = true;
|
||||
writeNumber = true;
|
||||
missionLenght = missionMaxLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
finishScreen = true;
|
||||
|
@ -186,7 +200,7 @@ void UpdateMissionScreen(void)
|
|||
// Mission Screen Draw logic
|
||||
void DrawMissionScreen(void)
|
||||
{
|
||||
// TODO: Draw MISSION screen here!
|
||||
// Draw MISSION screen here!
|
||||
DrawTexture(texBackground, 0,0, WHITE);
|
||||
DrawTexturePro(texBackline, sourceRecBackLine, destRecBackLine, (Vector2){0,0},0, Fade(WHITE, fadeBackLine));
|
||||
|
||||
|
@ -204,7 +218,7 @@ void DrawMissionScreen(void)
|
|||
// Mission Screen Unload logic
|
||||
void UnloadMissionScreen(void)
|
||||
{
|
||||
// TODO: Unload MISSION screen variables here!
|
||||
// Unload MISSION screen variables here!
|
||||
UnloadTexture(texBackground);
|
||||
UnloadTexture(texBackline);
|
||||
UnloadSound(fxTransmit);
|
||||
|
@ -220,54 +234,54 @@ int FinishMissionScreen(void)
|
|||
|
||||
static void WriteMissionText()
|
||||
{
|
||||
if(!startWritting)
|
||||
if (!startWritting)
|
||||
{
|
||||
framesCounter++;
|
||||
if(framesCounter % 60 == 0)
|
||||
if (framesCounter % 60 == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
startWritting = true;
|
||||
}
|
||||
}
|
||||
else if(!writeNumber)
|
||||
else if (!writeNumber)
|
||||
{
|
||||
framesCounter++;
|
||||
fadeBackLine += 0.020f;
|
||||
if(framesCounter % showNumberWaitFrames == 0)
|
||||
if (framesCounter % showNumberWaitFrames == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
writeNumber = true;
|
||||
showButton = true;
|
||||
}
|
||||
}
|
||||
else if(!writeMission)
|
||||
else if (!writeMission)
|
||||
{
|
||||
framesCounter ++;
|
||||
if(framesCounter % showMissionWaitFrames == 0)
|
||||
if (framesCounter % showMissionWaitFrames == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
writeMission = true;
|
||||
writtingMission = true;
|
||||
}
|
||||
}
|
||||
else if(writeMission && writtingMission)
|
||||
else if (writeMission && writtingMission)
|
||||
{
|
||||
framesCounter++;
|
||||
if(framesCounter % missionSpeed == 0)
|
||||
if (framesCounter % missionSpeed == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
missionLenght++;
|
||||
|
||||
if(missionLenght == missionMaxLength)
|
||||
if (missionLenght == missionMaxLength)
|
||||
{
|
||||
writtingMission = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(!writeKeyword)
|
||||
else if (!writeKeyword)
|
||||
{
|
||||
framesCounter++;
|
||||
if(framesCounter % showKeywordWaitFrames == 0)
|
||||
if (framesCounter % showKeywordWaitFrames == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
writeKeyword = true;
|
||||
|
@ -275,19 +289,3 @@ static void WriteMissionText()
|
|||
}
|
||||
}
|
||||
}
|
||||
static void EndWritting()
|
||||
{
|
||||
writeEnd = true;
|
||||
writeKeyword = true;
|
||||
writeNumber = true;
|
||||
missionLenght = missionMaxLength;
|
||||
}
|
||||
static void BlinkKeyword()
|
||||
{
|
||||
framesCounter++;
|
||||
if(framesCounter % blinkFrames == 0)
|
||||
{
|
||||
framesCounter = 0;
|
||||
blinkKeyWord = !blinkKeyWord;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue