Skip to content

Commit

Permalink
Move sound effects constants to sound effects
Browse files Browse the repository at this point in the history
  • Loading branch information
bvschaik committed Nov 12, 2017
1 parent 852fad7 commit ea01e66
Show file tree
Hide file tree
Showing 41 changed files with 159 additions and 190 deletions.
5 changes: 2 additions & 3 deletions src/Building.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "HousePopulation.h"
#include "Resource.h"
#include "Routing.h"
#include "Sound.h"
#include "Terrain.h"
#include "TerrainGraphics.h"
#include "Undo.h"
Expand Down Expand Up @@ -404,7 +403,7 @@ int Building_collapseFirstOfType(int buildingType)

TerrainGraphics_setBuildingAreaRubble(i, Data_Buildings[i].x, Data_Buildings[i].y,
Data_Buildings[i].size);
sound_effect_play(SoundChannel_Explosion);
sound_effect_play(SOUND_EFFECT_EXPLOSION);
Routing_determineLandCitizen();
Routing_determineLandNonCitizen();
return gridOffset;
Expand Down Expand Up @@ -1199,7 +1198,7 @@ void Building_Mercury_removeResources(int bigCurse)
city_message_post(0, MESSAGE_FIRE, b->type, b->gridOffset);
Building_collapseOnFire(maxBuildingId, 0);
Building_collapseLinked(maxBuildingId, 1);
sound_effect_play(SoundChannel_Explosion);
sound_effect_play(SOUND_EFFECT_EXPLOSION);
Routing_determineLandCitizen();
Routing_determineLandNonCitizen();
} else {
Expand Down
1 change: 0 additions & 1 deletion src/CityInfo_Victory.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "CityInfo.h"

#include "Sound.h"
#include "UI/AllWindows.h"
#include "UI/VideoIntermezzo.h"
#include "UI/Window.h"
Expand Down
1 change: 0 additions & 1 deletion src/Data/AllData.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "State.h"
#include "Figure.h"
#include "Building.h"
#include "Sound.h"
#include "CityView.h"
#include "Invasion.h"
#include "FileList.h"
Expand Down
3 changes: 1 addition & 2 deletions src/Event.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "Resource.h"
#include "Routing.h"
#include "SidebarMenu.h"
#include "Sound.h"
#include "TerrainGraphics.h"

#include "Data/Building.h"
Expand Down Expand Up @@ -488,7 +487,7 @@ static void advanceEarthquakeToTile(int x, int y)
if (buildingId) {
Building_collapseOnFire(buildingId, 0);
Building_collapseLinked(buildingId, 1);
sound_effect_play(SoundChannel_Explosion);
sound_effect_play(SOUND_EFFECT_EXPLOSION);
Data_Buildings[buildingId].state = BuildingState_DeletedByGame;
}
Data_Grid_terrain[gridOffset] = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/Figure.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "FigureAction.h"
#include "FigureMovement.h"
#include "Formation.h"
#include "Sound.h"
#include "Terrain.h"
#include "Trader.h"

Expand Down Expand Up @@ -219,7 +218,7 @@ void Figure_createDustCloud(int x, int y, int size)
f->speedMultiplier = dustCloudSpeed[i];
}
}
sound_effect_play(SoundChannel_Explosion);
sound_effect_play(SOUND_EFFECT_EXPLOSION);
}

int Figure_createMissile(int buildingId, int x, int y, int xDst, int yDst, int type)
Expand Down
3 changes: 1 addition & 2 deletions src/FigureAction_Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Figure.h"
#include "Formation.h"
#include "Sound.h"

#include "Data/Constants.h"

Expand Down Expand Up @@ -129,7 +128,7 @@ static void hitOpponent(int figureId, struct Data_Figure *f)
if (opponent->opponentId != figureId && m->figure_type != FIGURE_FORT_LEGIONARY &&
attackIsSameDirection(f->attackDirection, opponent->attackDirection)) {
figureAttack += 4; // attack opponent on the (exposed) back
sound_effect_play(SoundChannel_SwordSwing);
sound_effect_play(SOUND_EFFECT_SWORD_SWING);
}
if (m->is_halted && m->figure_type == FIGURE_FORT_LEGIONARY &&
attackIsSameDirection(f->attackDirection, m->direction)) {
Expand Down
7 changes: 3 additions & 4 deletions src/FigureAction_Enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Figure.h"
#include "Formation.h"
#include "Routing.h"
#include "Sound.h"

#include "Data/CityInfo.h"
#include "Data/Event.h"
Expand Down Expand Up @@ -76,7 +75,7 @@ static void enemyInitial(int figureId, struct Data_Figure *f, const formation *m
Data_CityInfo.soundShootArrow--;
if (Data_CityInfo.soundShootArrow <= 0) {
Data_CityInfo.soundShootArrow = 10;
sound_effect_play(SoundChannel_Arrow);
sound_effect_play(SOUND_EFFECT_ARROW);
}
}
f->attackGraphicOffset++;
Expand Down Expand Up @@ -119,13 +118,13 @@ static void enemyFighting(int figureId, struct Data_Figure *f, const formation *
Data_CityInfo.soundMarchHorse--;
if (Data_CityInfo.soundMarchHorse <= 0) {
Data_CityInfo.soundMarchHorse = 200;
sound_effect_play(SoundChannel_HorseMoving);
sound_effect_play(SOUND_EFFECT_HORSE_MOVING);
}
} else {
Data_CityInfo.soundMarchEnemy--;
if (Data_CityInfo.soundMarchEnemy <= 0) {
Data_CityInfo.soundMarchEnemy = 200;
sound_effect_play(SoundChannel_Marching);
sound_effect_play(SOUND_EFFECT_MARCHING);
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/FigureAction_Missile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Figure.h"
#include "Formation.h"
#include "Sound.h"

#include "figure/formation.h"
#include "figure/properties.h"
Expand Down Expand Up @@ -68,7 +67,7 @@ void FigureAction_arrow(int figureId)
f->state = FigureState_Dead;
int arrowFormation = Data_Figures[f->buildingId].formationId;
formation_record_missile_attack(formationId, arrowFormation);
sound_effect_play(SoundChannel_ArrowHit);
sound_effect_play(SOUND_EFFECT_ARROW_HIT);
} else if (shouldDie) {
f->state = FigureState_Dead;
}
Expand Down Expand Up @@ -113,7 +112,7 @@ void FigureAction_spear(int figureId)
}
int arrowFormation = Data_Figures[f->buildingId].formationId;
formation_record_missile_attack(formationId, arrowFormation);
sound_effect_play(SoundChannel_Javelin);
sound_effect_play(SOUND_EFFECT_JAVELIN);
f->state = FigureState_Dead;
} else if (shouldDie) {
f->state = FigureState_Dead;
Expand Down Expand Up @@ -160,7 +159,7 @@ void FigureAction_javelin(int figureId)
}
int javelinFormation = Data_Figures[f->buildingId].formationId;
formation_record_missile_attack(formationId, javelinFormation);
sound_effect_play(SoundChannel_Javelin);
sound_effect_play(SOUND_EFFECT_JAVELIN);
f->state = FigureState_Dead;
} else if (shouldDie) {
f->state = FigureState_Dead;
Expand Down Expand Up @@ -200,11 +199,11 @@ void FigureAction_bolt(int figureId)
Figure_playDieSound(targetType);
Formation_updateAfterDeath(formationId);
}
sound_effect_play(SoundChannel_BallistaHitPerson);
sound_effect_play(SOUND_EFFECT_BALLISTA_HIT_PERSON);
f->state = FigureState_Dead;
} else if (shouldDie) {
f->state = FigureState_Dead;
sound_effect_play(SoundChannel_BallistaHitGround);
sound_effect_play(SOUND_EFFECT_BALLISTA_HIT_GROUND);
}
int dir = (16 + f->direction - 2 * Data_Settings_Map.orientation) % 16;
f->graphicId = image_group(ID_Graphic_Figure_Missile) + 32 + dir;
Expand Down
3 changes: 1 addition & 2 deletions src/FigureAction_Service.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "Figure.h"
#include "Routing.h"
#include "Security.h"
#include "Sound.h"
#include "Terrain.h"

#include "Data/CityInfo.h"
Expand Down Expand Up @@ -279,7 +278,7 @@ static void prefectExtinguishFire(int figureId, struct Data_Figure *f)
int distance = calc_maximum_distance(f->x, f->y, burn->x, burn->y);
if (BuildingIsInUse(f->destinationBuildingId) && burn->type == BUILDING_BURNING_RUIN && distance < 2) {
burn->fireDuration = 32;
sound_effect_play(SoundChannel_FireSplash);
sound_effect_play(SOUND_EFFECT_FIRE_SPLASH);
} else {
f->waitTicks = 1;
}
Expand Down
3 changes: 1 addition & 2 deletions src/FigureAction_Wall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Figure.h"
#include "Routing.h"
#include "Sound.h"
#include "Terrain.h"

#include "Data/Grid.h"
Expand Down Expand Up @@ -84,7 +83,7 @@ void FigureAction_ballista(int figureId)
f->direction = Routing_getDirectionForMissileShooter(f->x, f->y, xTile, yTile);
f->waitTicksMissile = 0;
Figure_createMissile(figureId, f->x, f->y, xTile, yTile, FIGURE_BOLT);
sound_effect_play(SoundChannel_BallistaShoot);
sound_effect_play(SOUND_EFFECT_BALLISTA_SHOOT);
} else {
f->actionState = FigureActionState_180_BallistaCreated;
}
Expand Down
41 changes: 20 additions & 21 deletions src/Figure_Phrase.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "Building.h"
#include "core/calc.h"
#include "FigureAction.h"
#include "Sound.h"

#include "Data/Building.h"
#include "Data/CityInfo.h"
Expand Down Expand Up @@ -551,26 +550,26 @@ void Figure_playDieSound(int figureType)
int isCitizen = 0;
switch (figureType) {
case FIGURE_WOLF:
sound_effect_play(SoundChannel_WolfDie);
sound_effect_play(SOUND_EFFECT_WOLF_DIE);
break;
case FIGURE_SHEEP:
sound_effect_play(SoundChannel_SheepDie);
sound_effect_play(SOUND_EFFECT_SHEEP_DIE);
break;
case FIGURE_ZEBRA:
sound_effect_play(SoundChannel_ZebraDie);
sound_effect_play(SOUND_EFFECT_ZEBRA_DIE);
break;
case FIGURE_LION_TAMER:
sound_effect_play(SoundChannel_LionDie);
sound_effect_play(SOUND_EFFECT_LION_DIE);
break;
case FIGURE_ENEMY48_CHARIOT:
case FIGURE_ENEMY52_MOUNTED_ARCHER:
sound_effect_play(SoundChannel_Horse2);
sound_effect_play(SOUND_EFFECT_HORSE2);
break;
case FIGURE_ENEMY46_CAMEL:
sound_effect_play(SoundChannel_Camel);
sound_effect_play(SOUND_EFFECT_CAMEL);
break;
case FIGURE_ENEMY47_ELEPHANT:
sound_effect_play(SoundChannel_ElephantDie);
sound_effect_play(SOUND_EFFECT_ELEPHANT_DIE);
break;
case FIGURE_NATIVE_TRADER:
case FIGURE_TRADE_CARAVAN:
Expand Down Expand Up @@ -605,13 +604,13 @@ void Figure_playDieSound(int figureType)
if (Data_CityInfo.dieSoundSoldier >= 4) {
Data_CityInfo.dieSoundSoldier = 0;
}
sound_effect_play(SoundChannel_SoldierDie + Data_CityInfo.dieSoundSoldier);
sound_effect_play(SOUND_EFFECT_SOLDIER_DIE + Data_CityInfo.dieSoundSoldier);
} else if (isCitizen) {
Data_CityInfo.dieSoundCitizen++;
if (Data_CityInfo.dieSoundCitizen >= 4) {
Data_CityInfo.dieSoundCitizen = 0;
}
sound_effect_play(SoundChannel_CitizenDie + Data_CityInfo.dieSoundCitizen);
sound_effect_play(SOUND_EFFECT_CITIZEN_DIE + Data_CityInfo.dieSoundCitizen);
}
if (FigureIsEnemy(figureType)) {
if (Data_CityInfo.numEnemiesInCity == 1) {
Expand All @@ -636,50 +635,50 @@ void Figure_playHitSound(int figureType)
switch (figureType) {
case FIGURE_FORT_LEGIONARY:
case FIGURE_ENEMY_CAESAR_LEGIONARY:
PLAY_HIT_SOUND(soundHitSoldier, SoundChannel_Sword);
PLAY_HIT_SOUND(soundHitSoldier, SOUND_EFFECT_SWORD);
break;
case FIGURE_FORT_MOUNTED:
case FIGURE_ENEMY45_SWORD:
case FIGURE_ENEMY48_CHARIOT:
case FIGURE_ENEMY50_SWORD:
case FIGURE_ENEMY52_MOUNTED_ARCHER:
case FIGURE_ENEMY54_GLADIATOR:
PLAY_HIT_SOUND(soundHitSoldier, SoundChannel_SwordSwing);
PLAY_HIT_SOUND(soundHitSoldier, SOUND_EFFECT_SWORD_SWING);
break;
case FIGURE_FORT_JAVELIN:
PLAY_HIT_SOUND(soundHitSoldier, SoundChannel_SwordLight);
PLAY_HIT_SOUND(soundHitSoldier, SOUND_EFFECT_LIGHT_SWORD);
break;
case FIGURE_ENEMY43_SPEAR:
case FIGURE_ENEMY51_SPEAR:
PLAY_HIT_SOUND(soundHitSpear, SoundChannel_Spear);
PLAY_HIT_SOUND(soundHitSpear, SOUND_EFFECT_SPEAR);
break;
case FIGURE_ENEMY44_SWORD:
case FIGURE_ENEMY49_FAST_SWORD:
PLAY_HIT_SOUND(soundHitClub, SoundChannel_Club);
PLAY_HIT_SOUND(soundHitClub, SOUND_EFFECT_CLUB);
break;
case FIGURE_ENEMY53_AXE:
PLAY_HIT_SOUND(soundHitAxe, SoundChannel_Axe);
PLAY_HIT_SOUND(soundHitAxe, SOUND_EFFECT_AXE);
break;
case FIGURE_ENEMY46_CAMEL:
sound_effect_play(SoundChannel_Camel);
sound_effect_play(SOUND_EFFECT_CAMEL);
break;
case FIGURE_ENEMY47_ELEPHANT:
if (Data_CityInfo.soundHitElephant == 1) {
sound_effect_play(SoundChannel_ElephantHit);
sound_effect_play(SOUND_EFFECT_ELEPHANT_HIT);
Data_CityInfo.soundHitElephant = 0;
} else {
sound_effect_play(SoundChannel_Elephant);
sound_effect_play(SOUND_EFFECT_ELEPHANT);
Data_CityInfo.soundHitElephant = 1;
}
break;
case FIGURE_LION_TAMER:
sound_effect_play(SoundChannel_LionAttack);
sound_effect_play(SOUND_EFFECT_LION_ATTACK);
break;
case FIGURE_WOLF:
Data_CityInfo.soundHitWolf--;
if (Data_CityInfo.soundHitWolf <= 0) {
Data_CityInfo.soundHitWolf = 4;
sound_effect_play(SoundChannel_WolfAttack);
sound_effect_play(SOUND_EFFECT_WOLF_ATTACK);
}
break;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Formation.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "Figure.h"
#include "FigureMovement.h"
#include "Routing.h"
#include "Sound.h"
#include "UI/Warning.h"

#include "Data/Building.h"
Expand Down Expand Up @@ -245,7 +244,7 @@ static void update_legion_enemy_totals(const formation *m, void *data)
enemy_army_totals_add_legion_formation(total_strength);
if (m->figure_type == FIGURE_FORT_LEGIONARY) {
if (!wasHalted && m->is_halted) {
sound_effect_play(SoundChannel_FormationShield);
sound_effect_play(SOUND_EFFECT_FORMATION_SHIELD);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/FormationUpdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "FigureAction.h"
#include "Grid.h"
#include "Routing.h"
#include "Sound.h"
#include "TerrainGraphics.h"

#include "Data/Building.h"
Expand Down Expand Up @@ -792,7 +791,7 @@ static void update_herd_formation(const formation *m)
Data_CityInfo.soundMarchWolf--;
if (Data_CityInfo.soundMarchWolf <= 0) {
Data_CityInfo.soundMarchWolf = 12;
sound_effect_play(SoundChannel_WolfHowl);
sound_effect_play(SOUND_EFFECT_WOLF_HOWL);
}
}
moveAnimals(m, attackingAnimals);
Expand Down
1 change: 0 additions & 1 deletion src/GameFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Resource.h"
#include "Routing.h"
#include "SidebarMenu.h"
#include "Sound.h"
#include "TerrainGraphics.h"
#include "UtilityManagement.h"

Expand Down
1 change: 0 additions & 1 deletion src/GameTick.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "Routing.h"
#include "Security.h"
#include "SidebarMenu.h"
#include "Sound.h"
#include "TerrainGraphics.h"
#include "Trader.h"
#include "Undo.h"
Expand Down
Loading

0 comments on commit ea01e66

Please sign in to comment.