Done!
This commit is contained in:
parent
8e2169420e
commit
9b56a9b4a5
@ -28,7 +28,7 @@ void Audio::Update3DAudio(Vector3f pos, Vector3f dir, Vector3f vel) {
|
||||
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->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z));
|
||||
sound->setVolume(volume);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef AUDIO_H__
|
||||
#define AUDIO_H__
|
||||
|
||||
#include "external/irrKlang-1.6.0/include/irrklang.h"
|
||||
#include "external/irrKlang-1.6.0/include/ik_ISoundSource.h"
|
||||
#include <irrKlang.h>
|
||||
#include <ik_ISoundSource.h>
|
||||
#include "define.h"
|
||||
#include "vector3.h"
|
||||
|
||||
@ -18,7 +18,7 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
|
@ -259,7 +259,7 @@ void Engine::Render(float elapsedTime) {
|
||||
if (m_wireframe)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
static bool fell = false;
|
||||
static bool fell = false;
|
||||
if (m_player.GetPosition().y < 1.7f && !fell) {
|
||||
m_audio.Create3DAudioObj(m_scream, AUDIO_PATH "scream.wav", m_player.GetPOV(), m_player.GetVelocity(), 1.f);
|
||||
fell = true;
|
||||
|
@ -41,7 +41,6 @@ private:
|
||||
bool m_isSkybox = true;
|
||||
|
||||
int m_renderCount = 0;
|
||||
int m_badHitCount = 0;
|
||||
|
||||
Shader m_shader01;
|
||||
BlockInfo* m_blockinfo[BTYPE_LAST];
|
||||
@ -58,7 +57,6 @@ private:
|
||||
Audio m_audio = Audio(AUDIO_PATH "music01.wav");
|
||||
|
||||
irrklang::ISound* m_powpow;
|
||||
irrklang::ISound* m_step;
|
||||
irrklang::ISound* m_scream;
|
||||
|
||||
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) {
|
||||
Vector3f vstep;
|
||||
if (leftright)
|
||||
vstep = Vector3f(GetPosition().x - GetDirection().x, GetPosition().y, GetPosition().z + GetDirection().z);
|
||||
else 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().z, GetPosition().y - 1.7f, GetPosition().z - GetDirection().x);
|
||||
if (!isStep) {
|
||||
audio->Create3DAudioObj(step, AUDIO_PATH "step.wav", vstep, GetVelocity(), .8f);
|
||||
leftright = !leftright;
|
||||
}
|
||||
isStep = true;
|
||||
}
|
||||
|
@ -39,8 +39,7 @@ BlockType World::BlockAt(const Vector3f& pos, BlockType defaultBlockType) const
|
||||
}
|
||||
|
||||
void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int x = 0, y = 0;
|
||||
|
||||
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;
|
||||
@ -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]) {
|
||||
if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS;
|
||||
if (updates == 0 && ChunkAt(chx, 1, chy) &&
|
||||
ChunkAt(chx, 1, chy)->IsDirty()) {
|
||||
ChunkAt(chx, 1, chy)->Update(blockinfo, this);
|
||||
updates = FRAMES_UPDATE_CHUNKS;
|
||||
}
|
||||
if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS;
|
||||
}
|
||||
|
||||
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) {
|
||||
int bx = (int)pos.x % CHUNK_SIZE_X;
|
||||
int by = (int)pos.y % CHUNK_SIZE_Y;
|
||||
|
Loading…
Reference in New Issue
Block a user