Done!
This commit is contained in:
		| @@ -28,7 +28,7 @@ void Audio::Update3DAudio(Vector3f pos, Vector3f dir, Vector3f vel) { | |||||||
| 								  irrklang::vec3df(vel.x, vel.y, vel.z)); | 								  irrklang::vec3df(vel.x, vel.y, vel.z)); | ||||||
| } | } | ||||||
|  |  | ||||||
| void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f& pos, Vector3f& vel, float volume = 1) { | void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume = 1) { | ||||||
| 	sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), false, false, true, irrklang::ESM_NO_STREAMING, true); | 	sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), false, false, true, irrklang::ESM_NO_STREAMING, true); | ||||||
| 	sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z)); | 	sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z)); | ||||||
| 	sound->setVolume(volume); | 	sound->setVolume(volume); | ||||||
|   | |||||||
| @@ -1,8 +1,8 @@ | |||||||
| #ifndef AUDIO_H__ | #ifndef AUDIO_H__ | ||||||
| #define AUDIO_H__ | #define AUDIO_H__ | ||||||
|  |  | ||||||
| #include "external/irrKlang-1.6.0/include/irrklang.h" | #include <irrKlang.h> | ||||||
| #include "external/irrKlang-1.6.0/include/ik_ISoundSource.h" | #include <ik_ISoundSource.h> | ||||||
| #include "define.h" | #include "define.h" | ||||||
| #include "vector3.h" | #include "vector3.h" | ||||||
|  |  | ||||||
| @@ -18,7 +18,7 @@ public: | |||||||
|  |  | ||||||
| 	void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed); | 	void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed); | ||||||
|  |  | ||||||
| 	void Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f& pos, Vector3f& vel, float volume); | 	void Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume); | ||||||
|  |  | ||||||
| 	void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume); | 	void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -41,7 +41,6 @@ private: | |||||||
|     bool m_isSkybox = true; |     bool m_isSkybox = true; | ||||||
|  |  | ||||||
|     int m_renderCount = 0; |     int m_renderCount = 0; | ||||||
|     int m_badHitCount = 0; |  | ||||||
|  |  | ||||||
|     Shader m_shader01; |     Shader m_shader01; | ||||||
|     BlockInfo* m_blockinfo[BTYPE_LAST]; |     BlockInfo* m_blockinfo[BTYPE_LAST]; | ||||||
| @@ -58,7 +57,6 @@ private: | |||||||
|     Audio m_audio = Audio(AUDIO_PATH "music01.wav"); |     Audio m_audio = Audio(AUDIO_PATH "music01.wav"); | ||||||
|  |  | ||||||
|     irrklang::ISound* m_powpow; |     irrklang::ISound* m_powpow; | ||||||
|     irrklang::ISound* m_step; |  | ||||||
|     irrklang::ISound* m_scream; |     irrklang::ISound* m_scream; | ||||||
|  |  | ||||||
|     Player m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); |     Player m_player = Player(Vector3f(0, CHUNK_SIZE_Y + 1.8f, 0)); | ||||||
|   | |||||||
| @@ -156,10 +156,11 @@ void Player::ApplyPhysics(Vector3f input, World world, float elapsedTime, Audio* | |||||||
| 	if ((sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) < -.2f && !m_airborne) { | 	if ((sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) < -.2f && !m_airborne) { | ||||||
| 		Vector3f vstep; | 		Vector3f vstep; | ||||||
| 		if (leftright) | 		if (leftright) | ||||||
| 			vstep = Vector3f(GetPosition().x - GetDirection().x, GetPosition().y, GetPosition().z + GetDirection().z); | 			vstep = Vector3f(GetPosition().x + GetDirection().z, GetPosition().y - 1.7f, GetPosition().z + GetDirection().x); | ||||||
| 		else vstep = Vector3f(GetPosition().x + GetDirection().x, GetPosition().y, GetPosition().z - GetDirection().z); | 		else vstep = Vector3f(GetPosition().x - GetDirection().z, GetPosition().y - 1.7f, GetPosition().z - GetDirection().x); | ||||||
| 		if (!isStep) { | 		if (!isStep) { | ||||||
| 			audio->Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, GetVelocity(), .8f); | 			audio->Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, GetVelocity(), .8f); | ||||||
|  | 			leftright = !leftright; | ||||||
| 		} | 		} | ||||||
| 		isStep = true; | 		isStep = true; | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -39,8 +39,7 @@ BlockType World::BlockAt(const Vector3f& pos, BlockType defaultBlockType) const | |||||||
| } | } | ||||||
|  |  | ||||||
| void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) { | void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) { | ||||||
| 	int x = 0; | 	int x = 0, y = 0; | ||||||
| 	int y = 0; |  | ||||||
|  |  | ||||||
| 	if (player.GetPosition().x > (WORLD_SIZE_X * CHUNK_SIZE_X) * .66f) ++x; | 	if (player.GetPosition().x > (WORLD_SIZE_X * CHUNK_SIZE_X) * .66f) ++x; | ||||||
| 	else if (player.GetPosition().x < (WORLD_SIZE_X * CHUNK_SIZE_X) * .33f) --x; | 	else if (player.GetPosition().x < (WORLD_SIZE_X * CHUNK_SIZE_X) * .33f) --x; | ||||||
| @@ -211,12 +210,12 @@ bool World::GenerateChunk(int chx, int chy, Perlin& perlin) { | |||||||
| } | } | ||||||
|  |  | ||||||
| void World::UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) { | void World::UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) { | ||||||
| 	if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS; |  | ||||||
| 	if (updates == 0 && ChunkAt(chx, 1, chy) && | 	if (updates == 0 && ChunkAt(chx, 1, chy) && | ||||||
| 		ChunkAt(chx, 1, chy)->IsDirty()) { | 		ChunkAt(chx, 1, chy)->IsDirty()) { | ||||||
| 		ChunkAt(chx, 1, chy)->Update(blockinfo, this); | 		ChunkAt(chx, 1, chy)->Update(blockinfo, this); | ||||||
| 		updates = FRAMES_UPDATE_CHUNKS; | 		updates = FRAMES_UPDATE_CHUNKS; | ||||||
| 	} | 	} | ||||||
|  | 	if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS; | ||||||
| } | } | ||||||
|  |  | ||||||
| void World::ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block) { | void World::ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block) { | ||||||
| @@ -276,7 +275,6 @@ void World::ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| void World::ChangeBlockAtPosition(BlockType blockType, Vector3f pos) { | void World::ChangeBlockAtPosition(BlockType blockType, Vector3f pos) { | ||||||
| 		int bx = (int)pos.x % CHUNK_SIZE_X; | 		int bx = (int)pos.x % CHUNK_SIZE_X; | ||||||
| 		int by = (int)pos.y % CHUNK_SIZE_Y; | 		int by = (int)pos.y % CHUNK_SIZE_Y; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user