aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/fast_btn.png
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2016-08-20 02:05:34 +0100
committerparamat <mat.gregory@virginmedia.com>2016-08-26 05:26:52 +0100
commitfb20b45100490acd47038be43b6f257c1bd75d97 (patch)
tree4fb8f2f8ac48597cc8ebb2d0d08a3fe5b906aff5 /textures/base/pack/fast_btn.png
parente58a55aa82dfc66325a694dcc3519d3c0f3388a6 (diff)
downloadminetest-fb20b45100490acd47038be43b6f257c1bd75d97.tar.gz
minetest-fb20b45100490acd47038be43b6f257c1bd75d97.tar.bz2
minetest-fb20b45100490acd47038be43b6f257c1bd75d97.zip
Camera: Higher frequency limit for view/hand bobbing and footsteps
Rebased and tuned version of Calinou's original pull request. 'm_view_bobbing_speed' controls the frequency of view bobbing, hand bobbing and footsteps, it was limited to a maximum of 40 (walking frequency) so did not increase if player speed was modified by a 'speed buff', a sprinting mod or modified in .conf or advanced settngs. This commit raises the limit to 70 which is suitable for sprinting.
Diffstat (limited to 'textures/base/pack/fast_btn.png')
0 files changed, 0 insertions, 0 deletions
href='#n147'>147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
/*
Minetest-c55
Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "mapsector.h"
#include "jmutexautolock.h"
#include "client.h"
#include "exceptions.h"
#include "mapblock.h"

MapSector::MapSector(Map *parent, v2s16 pos, IGameDef *gamedef):
		differs_from_disk(false),
		m_parent(parent),
		m_pos(pos),
		m_gamedef(gamedef),
		m_block_cache(NULL)
{
}

MapSector::~MapSector()
{
	deleteBlocks();
}

void MapSector::deleteBlocks()
{
	// Clear cache
	m_block_cache = NULL;

	// Delete all
	core::map<s16, MapBlock*>::Iterator i = m_blocks.getIterator();
	for(; i.atEnd() == false; i++)
	{
		delete i.getNode()->getValue();
	}

	// Clear container
	m_blocks.clear();
}

MapBlock * MapSector::getBlockBuffered(s16 y)
{
	MapBlock *block;

	if(m_block_cache != NULL && y == m_block_cache_y){
		return m_block_cache;
	}
	
	// If block doesn't exist, return NULL
	core::map<s16, MapBlock*>::Node *n = m_blocks.find(y);
	if(n == NULL)
	{
		block = NULL;
	}
	// If block exists, return it
	else{
		block = n->getValue();
	}
	
	// Cache the last result
	m_block_cache_y = y;
	m_block_cache = block;
	
	return block;
}

MapBlock * MapSector::getBlockNoCreateNoEx(s16 y)
{
	return getBlockBuffered(y);
}

MapBlock * MapSector::createBlankBlockNoInsert(s16 y)
{
	assert(getBlockBuffered(y) == NULL);

	v3s16 blockpos_map(m_pos.X, y, m_pos.Y);
	
	MapBlock *block = new MapBlock(m_parent, blockpos_map, m_gamedef);
	
	return block;
}