Pre-prending RL_ prefix for some raylib header macros.

This commit is contained in:
Marco Lizza 2018-12-20 16:06:59 +01:00
commit 8cea5f28b0
6 changed files with 210 additions and 210 deletions

View file

@ -145,14 +145,14 @@ void InitGame(void)
victory = false;
pause = false;
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
// Initialization player
player.position = (Vector2){screenWidth/2, screenHeight/2 - shipHeight/2};
player.speed = (Vector2){0, 0};
player.acceleration = 0;
player.rotation = 0;
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
player.color = LIGHTGRAY;
destroyedMeteorsCount = 0;
@ -246,8 +246,8 @@ void UpdateGame(void)
if (IsKeyDown(KEY_RIGHT)) player.rotation += 5;
// Player logic: speed
player.speed.x = sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
player.speed.y = cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
player.speed.x = sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
player.speed.y = cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
// Player logic: acceleration
if (IsKeyDown(KEY_UP))
@ -282,10 +282,10 @@ void UpdateGame(void)
{
if (!shoot[i].active)
{
shoot[i].position = (Vector2){ player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight) };
shoot[i].position = (Vector2){ player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight) };
shoot[i].active = true;
shoot[i].speed.x = 1.5*sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
shoot[i].speed.y = 1.5*cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
shoot[i].speed.x = 1.5*sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
shoot[i].speed.y = 1.5*cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
shoot[i].rotation = player.rotation;
break;
}
@ -341,7 +341,7 @@ void UpdateGame(void)
}
// Collision logic: player vs meteors
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
for (int a = 0; a < MAX_BIG_METEORS; a++)
{
@ -428,12 +428,12 @@ void UpdateGame(void)
if (midMeteorsCount%2 == 0)
{
mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1};
}
else
{
mediumMeteor[midMeteorsCount].position = (Vector2){bigMeteor[a].position.x, bigMeteor[a].position.y};
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
mediumMeteor[midMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED};
}
mediumMeteor[midMeteorsCount].active = true;
@ -459,12 +459,12 @@ void UpdateGame(void)
if (smallMeteorsCount%2 == 0)
{
smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED*-1};
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED*-1};
}
else
{
smallMeteor[smallMeteorsCount].position = (Vector2){mediumMeteor[b].position.x, mediumMeteor[b].position.y};
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*DEG2RAD)*METEORS_SPEED};
smallMeteor[smallMeteorsCount].speed = (Vector2){cos(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED, sin(shoot[i].rotation*RL_DEG2RAD)*METEORS_SPEED};
}
smallMeteor[smallMeteorsCount].active = true;
@ -515,9 +515,9 @@ void DrawGame(void)
if (!gameOver)
{
// Draw spaceship
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
DrawTriangle(v1, v2, v3, MAROON);
// Draw meteors

View file

@ -130,14 +130,14 @@ void InitGame(void)
framesCounter = 0;
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
// Initialization player
player.position = (Vector2){screenWidth/2, screenHeight/2 - shipHeight/2};
player.speed = (Vector2){0, 0};
player.acceleration = 0;
player.rotation = 0;
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
player.color = LIGHTGRAY;
for (int i = 0; i < MAX_MEDIUM_METEORS; i++)
@ -239,8 +239,8 @@ void UpdateGame(void)
if (IsKeyDown(KEY_RIGHT)) player.rotation += 5;
// Speed
player.speed.x = sin(player.rotation*DEG2RAD)*PLAYER_SPEED;
player.speed.y = cos(player.rotation*DEG2RAD)*PLAYER_SPEED;
player.speed.x = sin(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
player.speed.y = cos(player.rotation*RL_DEG2RAD)*PLAYER_SPEED;
// Controller
if (IsKeyDown(KEY_UP))
@ -269,7 +269,7 @@ void UpdateGame(void)
else if (player.position.y < -(shipHeight)) player.position.y = screenHeight + shipHeight;
// Collision Player to meteors
player.collider = (Vector3){player.position.x + sin(player.rotation*DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*DEG2RAD)*(shipHeight/2.5f), 12};
player.collider = (Vector3){player.position.x + sin(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), player.position.y - cos(player.rotation*RL_DEG2RAD)*(shipHeight/2.5f), 12};
for (int a = 0; a < MAX_MEDIUM_METEORS; a++)
{
@ -336,9 +336,9 @@ void DrawGame(void)
if (!gameOver)
{
// Draw spaceship
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
DrawTriangle(v1, v2, v3, MAROON);
// Draw meteor

View file

@ -430,7 +430,7 @@ static bool UpdatePlayer(int playerTurn)
// Distance (calculating the fire power)
player[playerTurn].aimingPower = sqrt(pow(player[playerTurn].position.x - GetMousePosition().x, 2) + pow(player[playerTurn].position.y - GetMousePosition().y, 2));
// Calculates the angle via arcsin
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RAD2DEG;
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RL_RAD2DEG;
// Point of the screen we are aiming at
player[playerTurn].aimingPoint = GetMousePosition();
@ -451,7 +451,7 @@ static bool UpdatePlayer(int playerTurn)
// Distance (calculating the fire power)
player[playerTurn].aimingPower = sqrt(pow(player[playerTurn].position.x - GetMousePosition().x, 2) + pow(player[playerTurn].position.y - GetMousePosition().y, 2));
// Calculates the angle via arcsin
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RAD2DEG;
player[playerTurn].aimingAngle = asin((player[playerTurn].position.y - GetMousePosition().y)/player[playerTurn].aimingPower)*RL_RAD2DEG;
// Point of the screen we are aiming at
player[playerTurn].aimingPoint = GetMousePosition();
@ -492,14 +492,14 @@ static bool UpdateBall(int playerTurn)
{
if (player[playerTurn].isLeftTeam)
{
ball.speed.x = cos(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.y = -sin(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.x = cos(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.y = -sin(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.active = true;
}
else
{
ball.speed.x = -cos(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.y = -sin(player[playerTurn].previousAngle*DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.x = -cos(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.speed.y = -sin(player[playerTurn].previousAngle*RL_DEG2RAD)*player[playerTurn].previousPower*3/DELTA_FPS;
ball.active = true;
}
}

View file

@ -943,7 +943,7 @@ void UpdateGameplayScreen(void)
if (beeActive == true && !isHitBee)
{
bee.x -= 3*speed;
beeMov = sin(2*PI/400*bee.x) * 5;
beeMov = sin(2*RL_PI/400*bee.x) * 5;
bee.y += beeMov*TIME_FACTOR;
if (CheckCollisionRecs(bee, player) && (state != FINALFORM) && (state != KICK))
@ -1870,7 +1870,7 @@ void UpdateGameplayScreen(void)
{
dandelionParticle.particles[i].position.y += 3*speedMod*TIME_FACTOR;
dandelionParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
dandelionParticle.particles[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30);
dandelionParticle.particles[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30);
if (dandelionParticle.particles[i].position.y >= GetScreenHeight()) dandelionParticle.particles[i].active = false;
}
@ -1879,7 +1879,7 @@ void UpdateGameplayScreen(void)
{
dandelionBackParticle.particles[i].position.y += (int)1.5f*speedMod*TIME_FACTOR;
dandelionBackParticle.particles[i].position.x -= 5*speedMod*TIME_FACTOR;
dandelionBackParticle.particles[i].rotation = 30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30;
dandelionBackParticle.particles[i].rotation = 30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particles[i].rotPhy) + 30;
if (dandelionBackParticle.particles[i].position.y >= GetScreenHeight()) dandelionBackParticle.particles[i].active = false;
}

View file

@ -690,7 +690,7 @@ void UpdateTitleScreen(void)
{
dandelionParticle.particle[i].position.y += 2.5*TIME_FACTOR;
dandelionParticle.particle[i].position.x -= 2*TIME_FACTOR;
dandelionParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
dandelionParticle.particle[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
if (dandelionParticle.particle[i].position.y >= GetScreenHeight()) dandelionParticle.particle[i].active = false;
}
@ -698,7 +698,7 @@ void UpdateTitleScreen(void)
{
dandelionBackParticle.particle[i].position.y += 2*TIME_FACTOR;
dandelionBackParticle.particle[i].position.x -= 3*TIME_FACTOR;
dandelionBackParticle.particle[i].rotation = -(30*sin(2*PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
dandelionBackParticle.particle[i].rotation = -(30*sin(2*RL_PI/120*globalFrameCounter + dandelionParticle.particle[i].rotPhy) + 30);
if (dandelionBackParticle.particle[i].position.y >= GetScreenHeight()) dandelionBackParticle.particle[i].active = false;
}

View file

@ -163,7 +163,7 @@ static void InitGame(void)
gravity = 0.25f;
linePosition = (Vector2){ 0.0f , 0.0f };
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*DEG2RAD);
shipHeight = (PLAYER_BASE_SIZE/2)/tanf(20*RL_DEG2RAD);
// Initialization player
player.position = (Vector2){ screenWidth/2, screenHeight };
@ -556,9 +556,9 @@ void DrawGame(void)
if (!gameOver)
{
// Draw player
Vector2 v1 = { player.position.x + sinf(player.rotation*DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v1 = { player.position.x + sinf(player.rotation*RL_DEG2RAD)*(shipHeight), player.position.y - cosf(player.rotation*RL_DEG2RAD)*(shipHeight) };
Vector2 v2 = { player.position.x - cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y - sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
Vector2 v3 = { player.position.x + cosf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2), player.position.y + sinf(player.rotation*RL_DEG2RAD)*(PLAYER_BASE_SIZE/2) };
DrawTriangle(v1, v2, v3, MAROON);
// Draw meteors (big)