Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 2 additions & 2 deletions src/audio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ bool Audio::Init()
Utils::GetPath(PathFile);
Sound[sExpand] = Mix_LoadWAV(PathFile);

strcpy(PathFile, "Sounds/car.wav");
strcpy(PathFile, "Sounds/wagon.wav");
Utils::GetPath(PathFile);
Sound[sCar] = Mix_LoadWAV(PathFile);
Sound[sWagon] = Mix_LoadWAV(PathFile);

strcpy(PathFile, "Sounds/shrink.wav");
Utils::GetPath(PathFile);
Expand Down
2 changes: 1 addition & 1 deletion src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum eSound {
sEnd,
sLose,
sExpand,
sCar,
sWagon,
sShrink,
sLive,
sSize
Expand Down
12 changes: 6 additions & 6 deletions src/editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ eMenu Editor::SDLMain(int LevelNumber)
}
m_level.T[NumN].T[cy * LT + cx] = TypeB;
break;
case car:
m_level.T[NumN].T[cy * LT + cx] = C_Car;
case wagon:
m_level.T[NumN].T[cy * LT + cx] = C_Wagon;
break;
case expander:
m_level.T[NumN].T[cy * LT + cx] = C_Expand;
Expand Down Expand Up @@ -249,8 +249,8 @@ void Editor::Draw() const
// Display possible sprites
for (i = 0; i < LT * HT; i++) {
switch (T[i]) {
case C_Car: // Car sprite
Sprites[car].Draw(i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2, 25);
case C_Wagon: // Wagon sprite
Sprites[wagon].Draw(i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2, 25);
break;
case C_Expand: // Expand sprite
Sprites[expander].Draw(i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2, 25);
Expand Down Expand Up @@ -286,7 +286,7 @@ void Editor::Draw() const
// Displays selected option in the menu
switch (Option) {
case rail:
case car:
case wagon:
case expander:
case shrinker:
case speed:
Expand Down Expand Up @@ -411,7 +411,7 @@ void Editor::GetKeyPress(int Key)
Option = rail;
break;
case 'z':
Option = car;
Option = wagon;
break;
case 'e':
Option = expander;
Expand Down
4 changes: 2 additions & 2 deletions src/game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,8 @@ void Game::DisplayScreen()
// Display options
for (i = 0; i < LT * HT; i++) {
switch (T[i]) {
case C_Car: // if car sprite
m_screen.PrintSprite(car, (GameClock * 40 / 1000 + i * 7) % 50, i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2);
case C_Wagon: // if wagon sprite
m_screen.PrintSprite(wagon, (GameClock * 40 / 1000 + i * 7) % 50, i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2);
break;
case C_Expand: // if expander sprite
m_screen.PrintSprite(expander, (GameClock * 40 / 1000 + i * 7) % 50, i % LT * D_Case + D_Case / 2, i / LT * D_Case + D_Case / 2);
Expand Down
20 changes: 10 additions & 10 deletions src/loco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void Loco::Display(Screen &screen)
int cdx, cdy, cfx = 0, cfy = 0; // Attachment point for cables
float lv;

// Display all wagon/(cars)
// Display all wagon
for (i = 0; i < NWagon; i++) {
// Search wagon points
switch (Wagon[i]) {
Expand All @@ -135,7 +135,7 @@ void Loco::Display(Screen &screen)
lv = 20;
}

// Calculate cars point's position
// Calculate wagons point's position
FindPoint(D - p1, x1, y1);
FindPoint(D - p2, x2, y2);

Expand Down Expand Up @@ -186,7 +186,7 @@ void Loco::Display(Screen &screen)
// Displays the cable
screen.PrintCable(cdx, cdy, cfx, cfy);
}
// Calculate the attachment point for the next Wagon/car
// Calculate the attachment point for the next Wagon
cfx = x1 - (int)(sin(ar + M_PI) * lv);
cfy = y1 - (int)(cos(ar + M_PI) * lv);

Expand Down Expand Up @@ -222,7 +222,7 @@ void Loco::Display(Screen &screen)
}
}

// Add gap between the wagons/cars
// Add gap between the wagons
ltrain += Pref.WagonGap;
}
}
Expand All @@ -240,15 +240,15 @@ void Loco::TestTile(float Dist, long GameDuration, int *Level)
if (D <= DMoy && D + Dist >= DMoy) {
// Check if on an item
switch (Level[T[LocoPos].P]) {
case C_Car: // New wagon/car
m_audio.Play(sCar);
case C_Wagon: // New wagon
m_audio.Play(sWagon);
Level[T[LocoPos].P] = 1; // Remove item from level
Pref.Score += 5;
AddLoco(); // Add a random wagon

Win = true; // Check if it was the last wagon for win condition
for (i = 0; i < LT * HT; i++) {
if (Level[i] == C_Car) {
if (Level[i] == C_Wagon) {
Win = false;
}
}
Expand Down Expand Up @@ -291,7 +291,7 @@ void Loco::TestTile(float Dist, long GameDuration, int *Level)
break;
}

// Collision check with another wagon/car
// Collision check with another wagon
for (i = 1; i < NWagon; i++) {
vx = (float)(PosWagon[i].dx - PosWagon[0].dx);
vy = (float)(PosWagon[i].dy - PosWagon[0].dy);
Expand Down Expand Up @@ -663,9 +663,9 @@ void Loco::FindPoint(float Dist, int &x, int &y)
/*********************************************/
void Loco::AddLoco()
{
Wagon[NWagon] = (e_Sprite)(rand() % (car - logs_wagon) + logs_wagon);
Wagon[NWagon] = (e_Sprite)(rand() % (wagon - logs_wagon) + logs_wagon);
if (Wagon[NWagon] == Wagon[NWagon - 1]) { // Avoids adding the same sprite twice
if (Wagon[NWagon] + 1 == car) {
if (Wagon[NWagon] + 1 == wagon) {
Wagon[NWagon] = logs_wagon;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/loco.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Loco
void MoveForward(int Duration, long GameDuration, int *Key, int *Level); // Makes locomotive move forward for Duration in ms
void FindArrow(int *Level, int *Key); // Search the position of the next intersection
bool TestDir(int FDir, int *Level); // Check if a direction/turn is possible
void AddLoco(); // Adds a random car to the locomotive
void AddLoco(); // Adds a random wagon to the locomotive

inline bool Go(int FutureDirection); // Move the locomotive
inline void FindPoint(float Dist, int &x, int &y); // Searching a point on the map
Expand Down
2 changes: 1 addition & 1 deletion src/preference.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
/*** Possible pieces on the level ***/
#define C_None 0
#define C_Rail 1
#define C_Car 2
#define C_Wagon 2
#define C_Expand 3
#define C_Shrink 4
#define C_Speed 5
Expand Down
2 changes: 1 addition & 1 deletion src/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum e_Sprite {
cargo_wagon,
engine_wagon,
cistern_wagon,
car,
wagon,
expander,
shrinker,
speed,
Expand Down
Loading