Răsfoiți Sursa

kilka drobnych poprawek dźwięku

mateuszb 18 ani în urmă
părinte
comite
1a01585af8
4 a modificat fișierele cu 12 adăugiri și 4 ștergeri
  1. 2 0
      CGameInfo.h
  2. 1 2
      CMT.cpp
  3. 1 1
      CMusicHandler.cpp
  4. 8 1
      CPreGame.cpp

+ 2 - 0
CGameInfo.h

@@ -9,6 +9,7 @@
 #include "CAmbarCendamo.h"
 #include "CBuildingHandler.h"
 #include "CObjectHandler.h"
+#include "CMusicHandler.h"
 
 /*
 	CGameInfo class
@@ -26,6 +27,7 @@ public:
 	CAmbarCendamo * ac;
 	CBuildingHandler * buildh;
 	CObjectHandler * objh;
+	CMusicHandler * mush;
 };
 
 #endif //CGAMEINFO_H

+ 1 - 2
CMT.cpp

@@ -233,8 +233,6 @@ int _tmain(int argc, _TCHAR* argv[])
 			// well, there's no music, but most games don't break without music...
 		}
 
-		mush->playClick();
-
 		screen = SDL_SetVideoMode(800,600,24,SDL_HWSURFACE|SDL_DOUBLEBUF/*|SDL_FULLSCREEN*/);
 		ekran = screen;
 		//FILE * zr = fopen("mal.txt","r");
@@ -260,6 +258,7 @@ int _tmain(int argc, _TCHAR* argv[])
 		THC timeHandler tmh;
 		CGameInfo * cgi = new CGameInfo;
 		CGameInfo::mainObj = cgi;
+		cgi->mush = mush;
 		CArtHandler * arth = new CArtHandler;
 		arth->loadArtifacts();
 		cgi->arth = arth;

+ 1 - 1
CMusicHandler.cpp

@@ -2,7 +2,7 @@
 
 void CMusicHandler::initMusics()
 {
-	if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048)==-1)
+	if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096)==-1)
 	{
 		printf("Mix_OpenAudio: %s\n", Mix_GetError());
 		exit(2);

+ 8 - 1
CPreGame.cpp

@@ -389,6 +389,8 @@ void CPreGame::scenHandleEv(SDL_Event& sEvent)
 		{
 			if (isItIn(&btns[i]->pos,sEvent.motion.x,sEvent.motion.y))
 			{
+				
+				mush->playClick();
 				btns[i]->press(true);
 				ourScenSel->pressed=btns[i];
 			}
@@ -559,12 +561,12 @@ void CPreGame::runLoop()
 				}
 				else if ((sEvent.type==SDL_MOUSEBUTTONDOWN) && (sEvent.button.button == SDL_BUTTON_LEFT))
 				{
-					mush->playClick();
 					for (int i=0;i<btns.size(); i++)
 					{
 						if (isItIn(&btns[i]->pos,sEvent.motion.x,sEvent.motion.y))
 						{
 							btns[i]->press(true);
+							mush->playClick();
 							//SDL_BlitSurface((btns[i].imgs)->ourImages[1].bitmap,NULL,ekran,&btns[i].pos);
 							//updateRect(&btns[i].pos);
 						}
@@ -574,26 +576,31 @@ void CPreGame::runLoop()
 					{
 						highlightButton(1,1);
 						current->highlighted=1;
+						mush->playClick();
 					}
 					else if (isItIn(&current->lLoadGame,sEvent.motion.x,sEvent.motion.y))
 					{
 						highlightButton(2,1);
 						current->highlighted=2;
+						mush->playClick();
 					}
 					else if (isItIn(&current->lHighScores,sEvent.motion.x,sEvent.motion.y))
 					{
 						highlightButton(3,1);
 						current->highlighted=3;
+						mush->playClick();
 					}
 					else if (isItIn(&current->lCredits,sEvent.motion.x,sEvent.motion.y))
 					{
 						highlightButton(4,1);
 						current->highlighted=4;
+						mush->playClick();
 					}
 					else if (isItIn(&current->lQuit,sEvent.motion.x,sEvent.motion.y))
 					{
 						highlightButton(5,1);
 						current->highlighted=5;
+						mush->playClick();
 					}
 				}
 				else if ((sEvent.type==SDL_MOUSEBUTTONUP) && (sEvent.button.button == SDL_BUTTON_LEFT))