mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-19 22:43:32 +00:00
Fix: Creative mode flying and cheats enabled
This commit is contained in:
@@ -721,7 +721,7 @@ void Minecraft::tickInput() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP) || defined (_WIN32)
|
||||||
if (key == Keyboard::KEY_E) {
|
if (key == Keyboard::KEY_E) {
|
||||||
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
||||||
}
|
}
|
||||||
@@ -741,113 +741,105 @@ void Minecraft::tickInput() {
|
|||||||
// Change distance
|
// Change distance
|
||||||
if (key == Keyboard::KEY_F)
|
if (key == Keyboard::KEY_F)
|
||||||
options.viewDistance = (options.viewDistance + 1) % 4;
|
options.viewDistance = (options.viewDistance + 1) % 4;
|
||||||
#endif
|
|
||||||
#if defined(WIN32)
|
|
||||||
if (key == Keyboard::KEY_F) {
|
|
||||||
options.isFlying = !options.isFlying;
|
|
||||||
player->noPhysics = options.isFlying;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (key == Keyboard::KEY_T) {
|
#ifdef CHEATS
|
||||||
// options.thirdPersonView = !options.thirdPersonView;
|
if (key == Keyboard::KEY_J) {
|
||||||
// /*
|
options.isFlying = !options.isFlying;
|
||||||
// ImprovedNoise noise;
|
player->noPhysics = options.isFlying;
|
||||||
// for (int i = 0; i < 16; ++i)
|
|
||||||
// printf("%d\t%f\n", i, noise.grad2(i, 3, 8));
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_O) {
|
|
||||||
useAmbientOcclusion = !useAmbientOcclusion;
|
|
||||||
options.ambientOcclusion = useAmbientOcclusion;
|
|
||||||
levelRenderer->allChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_L)
|
|
||||||
options.viewDistance = (options.viewDistance + 1) % 4;
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_U) {
|
|
||||||
onGraphicsReset();
|
|
||||||
player->heal(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_B || key == 108) // Toggle the game mode
|
|
||||||
setIsCreativeMode(!isCreativeMode());
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_P) // Step forward in time
|
|
||||||
level->setTime( level->getTime() + 1000);
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_G) {
|
|
||||||
setScreen(new ArmorScreen());
|
|
||||||
/*
|
|
||||||
std::vector<AABB>& boxs = level->getCubes(NULL, AABB(128.1f, 73, 128.1f, 128.9f, 74.9f, 128.9f));
|
|
||||||
LOGI("boxes: %d\n", (int)boxs.size());
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_Y) {
|
|
||||||
textures->reloadAll();
|
|
||||||
player->hurtTo(2);
|
|
||||||
}
|
|
||||||
if (key == Keyboard::KEY_Z || key == 108) {
|
|
||||||
for (int i = 0; i < 1; ++i) {
|
|
||||||
Mob* mob = NULL;
|
|
||||||
int forceId = 0;//MobTypes::Sheep;
|
|
||||||
|
|
||||||
int types[] = {
|
|
||||||
MobTypes::Sheep,
|
|
||||||
MobTypes::Pig,
|
|
||||||
MobTypes::Chicken,
|
|
||||||
MobTypes::Cow,
|
|
||||||
};
|
|
||||||
|
|
||||||
int mobType = (forceId > 0)? forceId : types[Mth::random(sizeof(types) / sizeof(int))];
|
|
||||||
mob = MobFactory::CreateMob(mobType, level);
|
|
||||||
|
|
||||||
//((Animal*)mob)->setAge(-1000);
|
|
||||||
float dx = 4 - 8 * Mth::random() + 4 * Mth::sin(Mth::DEGRAD * player->yRot);
|
|
||||||
float dz = 4 - 8 * Mth::random() + 4 * Mth::cos(Mth::DEGRAD * player->yRot);
|
|
||||||
if (mob && !MobSpawner::addMob(level, mob, player->x + dx, player->y, player->z + dz, Mth::random()*360, 0, true))
|
|
||||||
delete mob;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_X) {
|
if (key == Keyboard::KEY_O) {
|
||||||
const EntityList& entities = level->getAllEntities();
|
useAmbientOcclusion = !useAmbientOcclusion;
|
||||||
for (int i = entities.size()-1; i >= 0; --i) {
|
options.ambientOcclusion = useAmbientOcclusion;
|
||||||
Entity* e = entities[i];
|
levelRenderer->allChanged();
|
||||||
if (!e->isPlayer())
|
|
||||||
level->removeEntity(e);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_C /*|| key == 4*/) {
|
if (key == Keyboard::KEY_L)
|
||||||
player->inventory->clearInventoryWithDefault();
|
options.viewDistance = (options.viewDistance + 1) % 4;
|
||||||
// @todo: Add saving here for benchmarking
|
|
||||||
}
|
|
||||||
if (key == Keyboard::KEY_H) {
|
|
||||||
setScreen( new PrerenderTilesScreen() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == Keyboard::KEY_O) {
|
if (key == Keyboard::KEY_U) {
|
||||||
for (int i = Inventory::MAX_SELECTION_SIZE; i < player->inventory->getContainerSize(); ++i)
|
onGraphicsReset();
|
||||||
if (player->inventory->getItem(i))
|
player->heal(100);
|
||||||
player->inventory->dropSlot(i, false);
|
|
||||||
}
|
|
||||||
if (key == Keyboard::KEY_F3) {
|
|
||||||
options.renderDebug = !options.renderDebug;
|
|
||||||
}
|
|
||||||
if (key == Keyboard::KEY_M) {
|
|
||||||
options.difficulty = (options.difficulty == Difficulty::PEACEFUL)?
|
|
||||||
Difficulty::NORMAL : Difficulty::PEACEFUL;
|
|
||||||
//setIsCreativeMode( !isCreativeMode() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.renderDebug) {
|
|
||||||
if (key >= '0' && key <= '9') {
|
|
||||||
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (key == Keyboard::KEY_B || key == 108) // Toggle the game mode
|
||||||
|
setIsCreativeMode(!isCreativeMode());
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_P) // Step forward in time
|
||||||
|
level->setTime( level->getTime() + 1000);
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_G) {
|
||||||
|
setScreen(new ArmorScreen());
|
||||||
|
/*
|
||||||
|
std::vector<AABB>& boxs = level->getCubes(NULL, AABB(128.1f, 73, 128.1f, 128.9f, 74.9f, 128.9f));
|
||||||
|
LOGI("boxes: %d\n", (int)boxs.size());
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_Y) {
|
||||||
|
textures->reloadAll();
|
||||||
|
player->hurtTo(2);
|
||||||
|
}
|
||||||
|
if (key == Keyboard::KEY_Z || key == 108) {
|
||||||
|
for (int i = 0; i < 1; ++i) {
|
||||||
|
Mob* mob = NULL;
|
||||||
|
int forceId = 0;//MobTypes::Sheep;
|
||||||
|
|
||||||
|
int types[] = {
|
||||||
|
MobTypes::Sheep,
|
||||||
|
MobTypes::Pig,
|
||||||
|
MobTypes::Chicken,
|
||||||
|
MobTypes::Cow,
|
||||||
|
};
|
||||||
|
|
||||||
|
int mobType = (forceId > 0)? forceId : types[Mth::random(sizeof(types) / sizeof(int))];
|
||||||
|
mob = MobFactory::CreateMob(mobType, level);
|
||||||
|
|
||||||
|
//((Animal*)mob)->setAge(-1000);
|
||||||
|
float dx = 4 - 8 * Mth::random() + 4 * Mth::sin(Mth::DEGRAD * player->yRot);
|
||||||
|
float dz = 4 - 8 * Mth::random() + 4 * Mth::cos(Mth::DEGRAD * player->yRot);
|
||||||
|
if (mob && !MobSpawner::addMob(level, mob, player->x + dx, player->y, player->z + dz, Mth::random()*360, 0, true))
|
||||||
|
delete mob;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_X) {
|
||||||
|
const EntityList& entities = level->getAllEntities();
|
||||||
|
for (int i = entities.size()-1; i >= 0; --i) {
|
||||||
|
Entity* e = entities[i];
|
||||||
|
if (!e->isPlayer())
|
||||||
|
level->removeEntity(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_C /*|| key == 4*/) {
|
||||||
|
player->inventory->clearInventoryWithDefault();
|
||||||
|
// @todo: Add saving here for benchmarking
|
||||||
|
}
|
||||||
|
if (key == Keyboard::KEY_H) {
|
||||||
|
setScreen( new PrerenderTilesScreen() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == Keyboard::KEY_O) {
|
||||||
|
for (int i = Inventory::MAX_SELECTION_SIZE; i < player->inventory->getContainerSize(); ++i)
|
||||||
|
if (player->inventory->getItem(i))
|
||||||
|
player->inventory->dropSlot(i, false);
|
||||||
|
}
|
||||||
|
if (key == Keyboard::KEY_F3) {
|
||||||
|
options.renderDebug = !options.renderDebug;
|
||||||
|
}
|
||||||
|
if (key == Keyboard::KEY_M) {
|
||||||
|
options.difficulty = (options.difficulty == Difficulty::PEACEFUL)?
|
||||||
|
Difficulty::NORMAL : Difficulty::PEACEFUL;
|
||||||
|
//setIsCreativeMode( !isCreativeMode() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.renderDebug) {
|
||||||
|
if (key >= '0' && key <= '9') {
|
||||||
|
_perfRenderer->debugFpsMeterKeyPress(key - '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PLATFORM_DESKTOP
|
#ifndef PLATFORM_DESKTOP
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void KeyboardInput::tick( Player* player )
|
|||||||
ya *= 0.3f;
|
ya *= 0.3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RPI
|
#if defined(RPI) || defined(PLATFORM_DESKTOP)
|
||||||
wantUp = jumping;
|
wantUp = jumping;
|
||||||
wantDown = sneaking;
|
wantDown = sneaking;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user