forked from Kolyah35/minecraft-pe-0.6.1
.h -> .hpp everything
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,9 +2,9 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "input/IMoveInput.h"
|
||||
#include "../../util/SmoothFloat.h"
|
||||
#include "../../world/entity/player/Player.h"
|
||||
#include "input/IMoveInput.hpp"
|
||||
#include "util/SmoothFloat.hpp"
|
||||
#include "world/entity/player/Player.hpp"
|
||||
|
||||
class MinecraftClient;
|
||||
class Stat;
|
||||
@@ -1,35 +1,35 @@
|
||||
#include "RemotePlayer.h"
|
||||
#include "../../world/entity/player/Inventory.h"
|
||||
#include "../../world/entity/SharedFlags.h"
|
||||
|
||||
RemotePlayer::RemotePlayer(Level* level, bool isCreative)
|
||||
: Player(level, isCreative),
|
||||
hasStartedUsingItem(false)
|
||||
{
|
||||
hasFakeInventory = true;
|
||||
}
|
||||
|
||||
void RemotePlayer::tick() {
|
||||
super::tick();
|
||||
|
||||
if (!hasStartedUsingItem && getSharedFlag(SharedFlagsInformation::FLAG_USINGITEM)) {
|
||||
hasStartedUsingItem = true;
|
||||
ItemInstance* instance = inventory->getItem(Inventory::MAX_SELECTION_SIZE);
|
||||
if (instance) {
|
||||
Item* item = Item::items[instance->id];
|
||||
if (item) {
|
||||
startUsingItem(*instance, item->getUseDuration(instance));
|
||||
//LOGI("Start using item! %s\n", instance->getDescriptionId().c_str());
|
||||
}
|
||||
}
|
||||
} else if (hasStartedUsingItem && !getSharedFlag(SharedFlagsInformation::FLAG_USINGITEM)) {
|
||||
// LOGI("Stop using item! %s\n", useItem.getDescriptionId().c_str());
|
||||
stopUsingItem();
|
||||
hasStartedUsingItem = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RemotePlayer::aiStep() {
|
||||
updateAttackAnim();
|
||||
super::aiStep();
|
||||
}
|
||||
#include "RemotePlayer.hpp"
|
||||
#include "world/entity/player/Inventory.hpp"
|
||||
#include "world/entity/SharedFlags.hpp"
|
||||
|
||||
RemotePlayer::RemotePlayer(Level* level, bool isCreative)
|
||||
: Player(level, isCreative),
|
||||
hasStartedUsingItem(false)
|
||||
{
|
||||
hasFakeInventory = true;
|
||||
}
|
||||
|
||||
void RemotePlayer::tick() {
|
||||
super::tick();
|
||||
|
||||
if (!hasStartedUsingItem && getSharedFlag(SharedFlagsInformation::FLAG_USINGITEM)) {
|
||||
hasStartedUsingItem = true;
|
||||
ItemInstance* instance = inventory->getItem(Inventory::MAX_SELECTION_SIZE);
|
||||
if (instance) {
|
||||
Item* item = Item::items[instance->id];
|
||||
if (item) {
|
||||
startUsingItem(*instance, item->getUseDuration(instance));
|
||||
//LOGI("Start using item! %s\n", instance->getDescriptionId().c_str());
|
||||
}
|
||||
}
|
||||
} else if (hasStartedUsingItem && !getSharedFlag(SharedFlagsInformation::FLAG_USINGITEM)) {
|
||||
// LOGI("Stop using item! %s\n", useItem.getDescriptionId().c_str());
|
||||
stopUsingItem();
|
||||
hasStartedUsingItem = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RemotePlayer::aiStep() {
|
||||
updateAttackAnim();
|
||||
super::aiStep();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "../../world/entity/player/Player.h"
|
||||
#include "world/entity/player/Player.hpp"
|
||||
|
||||
class Level;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITurnInput.h"
|
||||
#include "../../../platform/input/Controller.h"
|
||||
#include "ITurnInput.hpp"
|
||||
#include "platform/input/Controller.hpp"
|
||||
|
||||
/** A Controller Turn input */
|
||||
class ControllerTurnInput : public ITurnInput {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../IConfigListener.h"
|
||||
#include "client/IConfigListener.hpp"
|
||||
class Player;
|
||||
|
||||
class BuildActionIntention {
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "IMoveInput.h"
|
||||
#include "ITurnInput.h"
|
||||
#include "IBuildInput.h"
|
||||
#include "IMoveInput.hpp"
|
||||
#include "ITurnInput.hpp"
|
||||
#include "IBuildInput.hpp"
|
||||
|
||||
#include "../../../platform/input/Mouse.h"
|
||||
#include "platform/input/Mouse.hpp"
|
||||
|
||||
class Player;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "../../IConfigListener.h"
|
||||
#include "client/IConfigListener.hpp"
|
||||
class Player;
|
||||
class Minecraft;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../platform/time.h"
|
||||
#include "../../IConfigListener.h"
|
||||
#include "platform/time.hpp"
|
||||
#include "client/IConfigListener.hpp"
|
||||
#include <cmath>
|
||||
|
||||
/** Representing a Turn delta value */
|
||||
@@ -1,61 +1,61 @@
|
||||
#include "KeyboardInput.h"
|
||||
#include "../../Options.h"
|
||||
#include "../../../world/entity/player/Player.h"
|
||||
|
||||
KeyboardInput::KeyboardInput( Options* options )
|
||||
{
|
||||
for (int i = 0; i < NumKeys; ++i)
|
||||
keys[i] = false;
|
||||
this->options = options;
|
||||
}
|
||||
|
||||
void KeyboardInput::setKey( int key, bool state )
|
||||
{
|
||||
int id = -1;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK;
|
||||
if (id >= 0) {
|
||||
keys[id] = state;
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardInput::releaseAllKeys()
|
||||
{
|
||||
xa = 0;
|
||||
ya = 0;
|
||||
|
||||
for (int i = 0; i < NumKeys; i++) {
|
||||
keys[i] = false;
|
||||
}
|
||||
wantUp = wantDown = false;
|
||||
}
|
||||
|
||||
void KeyboardInput::tick( Player* player )
|
||||
{
|
||||
xa = 0;
|
||||
ya = 0;
|
||||
|
||||
if (keys[KEY_UP]) ya++;
|
||||
if (keys[KEY_DOWN]) ya--;
|
||||
if (keys[KEY_LEFT]) xa++;
|
||||
if (keys[KEY_RIGHT]) xa--;
|
||||
jumping = keys[KEY_JUMP];
|
||||
sneaking = keys[KEY_SNEAK];
|
||||
if (sneaking) {
|
||||
xa *= 0.3f;
|
||||
ya *= 0.3f;
|
||||
}
|
||||
|
||||
wantUp = jumping;
|
||||
wantDown = sneaking;
|
||||
|
||||
if (keys[KEY_CRAFT])
|
||||
player->startCrafting((int)player->x, (int)player->y, (int)player->z, Recipe::SIZE_2X2);
|
||||
|
||||
//printf("\n>- %f %f\n", xa, ya);
|
||||
}
|
||||
|
||||
#include "KeyboardInput.hpp"
|
||||
#include "client/Options.hpp"
|
||||
#include "world/entity/player/Player.hpp"
|
||||
|
||||
KeyboardInput::KeyboardInput( Options* options )
|
||||
{
|
||||
for (int i = 0; i < NumKeys; ++i)
|
||||
keys[i] = false;
|
||||
this->options = options;
|
||||
}
|
||||
|
||||
void KeyboardInput::setKey( int key, bool state )
|
||||
{
|
||||
int id = -1;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_FORWARD)) id = KEY_UP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_BACK)) id = KEY_DOWN;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_LEFT)) id = KEY_LEFT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_RIGHT)) id = KEY_RIGHT;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_JUMP)) id = KEY_JUMP;
|
||||
if (key == options->getIntValue(OPTIONS_KEY_SNEAK)) id = KEY_SNEAK;
|
||||
if (id >= 0) {
|
||||
keys[id] = state;
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardInput::releaseAllKeys()
|
||||
{
|
||||
xa = 0;
|
||||
ya = 0;
|
||||
|
||||
for (int i = 0; i < NumKeys; i++) {
|
||||
keys[i] = false;
|
||||
}
|
||||
wantUp = wantDown = false;
|
||||
}
|
||||
|
||||
void KeyboardInput::tick( Player* player )
|
||||
{
|
||||
xa = 0;
|
||||
ya = 0;
|
||||
|
||||
if (keys[KEY_UP]) ya++;
|
||||
if (keys[KEY_DOWN]) ya--;
|
||||
if (keys[KEY_LEFT]) xa++;
|
||||
if (keys[KEY_RIGHT]) xa--;
|
||||
jumping = keys[KEY_JUMP];
|
||||
sneaking = keys[KEY_SNEAK];
|
||||
if (sneaking) {
|
||||
xa *= 0.3f;
|
||||
ya *= 0.3f;
|
||||
}
|
||||
|
||||
wantUp = jumping;
|
||||
wantDown = sneaking;
|
||||
|
||||
if (keys[KEY_CRAFT])
|
||||
player->startCrafting((int)player->x, (int)player->y, (int)player->z, Recipe::SIZE_2X2);
|
||||
|
||||
//printf("\n>- %f %f\n", xa, ya);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "IMoveInput.h"
|
||||
#include "IMoveInput.hpp"
|
||||
|
||||
class Options;
|
||||
class Player;
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "IBuildInput.h"
|
||||
#include "../../../platform/input/Mouse.h"
|
||||
#include "IBuildInput.hpp"
|
||||
#include "platform/input/Mouse.hpp"
|
||||
|
||||
/** A Mouse Build input */
|
||||
class MouseBuildInput : public IBuildInput {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITurnInput.h"
|
||||
#include "../../../platform/input/Mouse.h"
|
||||
#include "ITurnInput.hpp"
|
||||
#include "platform/input/Mouse.hpp"
|
||||
|
||||
/** A Mouse Turn input */
|
||||
class MouseTurnInput : public ITurnInput {
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "KeyboardInput.h"
|
||||
#include "platform/input/Controller.h"
|
||||
#include "world/entity/player/Player.h"
|
||||
#include "KeyboardInput.hpp"
|
||||
#include "platform/input/Controller.hpp"
|
||||
#include "world/entity/player/Player.hpp"
|
||||
|
||||
// @note: This is just copy-pasted from KeyboardInput right now.
|
||||
class XperiaPlayInput: public KeyboardInput
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../../platform/input/Mouse.h"
|
||||
#include "platform/input/Mouse.hpp"
|
||||
|
||||
class ITouchScreenModel
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "ITouchScreenModel.h"
|
||||
#include "ITouchScreenModel.hpp"
|
||||
#include <vector>
|
||||
#include "../../../../platform/time.h"
|
||||
#include "platform/time.hpp"
|
||||
|
||||
/// Interface for an area that can be point tested
|
||||
class IArea{
|
||||
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "../IInputHolder.h"
|
||||
#include "TouchscreenInput.h"
|
||||
#include "client/player/input/IInputHolder.hpp"
|
||||
#include "TouchscreenInput.hpp"
|
||||
|
||||
#include "../ITurnInput.h"
|
||||
#include "TouchAreaModel.h"
|
||||
#include "../../../../platform/input/Multitouch.h"
|
||||
#include "../../../../platform/time.h"
|
||||
#include "../../../../util/SmoothFloat.h"
|
||||
#include "client/player/input/ITurnInput.hpp"
|
||||
#include "TouchAreaModel.hpp"
|
||||
#include "platform/input/Multitouch.hpp"
|
||||
#include "platform/time.hpp"
|
||||
#include "util/SmoothFloat.hpp"
|
||||
|
||||
#include "../../../../world/entity/player/Player.h"
|
||||
#include "../../../../world/entity/player/Inventory.h"
|
||||
#include "world/entity/player/Player.hpp"
|
||||
#include "world/entity/player/Inventory.hpp"
|
||||
|
||||
template <class T>
|
||||
class ModifyNotify {
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ITurnInput.h"
|
||||
#include "TouchAreaModel.h"
|
||||
#include "../../../../platform/input/Multitouch.h"
|
||||
#include "client/player/input/ITurnInput.hpp"
|
||||
#include "TouchAreaModel.hpp"
|
||||
#include "platform/input/Multitouch.hpp"
|
||||
|
||||
class TouchTurnInput: public ITurnInput
|
||||
{
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,10 @@
|
||||
|
||||
//package net.minecraft.client.player;
|
||||
|
||||
#include "../IMoveInput.h"
|
||||
#include "../../../gui/GuiComponent.h"
|
||||
#include "TouchAreaModel.h"
|
||||
#include "../../../renderer/RenderChunk.h"
|
||||
#include "client/player/input/IMoveInput.hpp"
|
||||
#include "client/gui/GuiComponent.hpp"
|
||||
#include "TouchAreaModel.hpp"
|
||||
#include "client/renderer/RenderChunk.hpp"
|
||||
|
||||
class Options;
|
||||
class Player;
|
||||
Reference in New Issue
Block a user