Compare commits
8 Commits
0.6.1-alph
...
caedc293eb
| Author | SHA1 | Date | |
|---|---|---|---|
| caedc293eb | |||
| 2e9a9b810c | |||
| ce4c3e9d93 | |||
| 470509ee52 | |||
| 0ea8b87970 | |||
| b4f54083dc | |||
| f17a11c670 | |||
| adb23d18c6 |
31
README.md
31
README.md
@@ -32,6 +32,12 @@ mkdir build && cd build
|
||||
cmake .. -B .
|
||||
make -j4
|
||||
```
|
||||
or
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake --build . --config Release -j 10
|
||||
```
|
||||
|
||||
## Visual Studio
|
||||
|
||||
1. Open the repository folder in **Visual Studio**.
|
||||
@@ -40,17 +46,28 @@ make -j4
|
||||
4. Press **Run** (or F5) to build and launch the game.
|
||||
|
||||
## Android
|
||||
Download [r14b Android NDK](http://dl.google.com/android/repository/android-ndk-r14b-windows-x86_64.zip) and run `build.ps1`:
|
||||
```
|
||||
|
||||
1. Download **Android NDK r14b**:
|
||||
http://dl.google.com/android/repository/android-ndk-r14b-windows-x86_64.zip
|
||||
|
||||
2. Extract it to the root of your `C:` drive so the path becomes:
|
||||
|
||||
```
|
||||
C:\android-ndk-r14b
|
||||
```
|
||||
|
||||
3. Run the build script:
|
||||
|
||||
```powershell
|
||||
# Full build (NDK + Java + APK + install)
|
||||
.\build.ps1
|
||||
|
||||
# Skip NDK recompile (Java/assets changed only)
|
||||
.\build.ps1 -NoJava
|
||||
|
||||
# Skip Java recompile (C++ changed only)
|
||||
# Skip C++ compilation (Java/assets changed only)
|
||||
.\build.ps1 -NoCpp
|
||||
|
||||
# Only repackage + install (no recompile at all)
|
||||
# Skip Java compilation (C++ changed only)
|
||||
.\build.ps1 -NoJava
|
||||
|
||||
# Only repackage + install (no compilation)
|
||||
.\build.ps1 -NoBuild
|
||||
```
|
||||
@@ -78,6 +78,14 @@ void Screen::updateEvents()
|
||||
void Screen::mouseEvent()
|
||||
{
|
||||
const MouseAction& e = Mouse::getEvent();
|
||||
// forward wheel events to subclasses
|
||||
if (e.action == MouseAction::ACTION_WHEEL) {
|
||||
int xm = e.x * width / minecraft->width;
|
||||
int ym = e.y * height / minecraft->height - 1;
|
||||
mouseWheel(e.dx, e.dy, xm, ym);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!e.isButton())
|
||||
return;
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
|
||||
// mouse wheel movement (dx/dy are wheel deltas, xm/ym are GUI coords)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) {}
|
||||
|
||||
virtual void keyPressed(int eventKey);
|
||||
virtual void keyboardNewChar(char inputChar) {}
|
||||
public:
|
||||
|
||||
@@ -548,6 +548,14 @@ void ScrollingPane::stepThroughDecelerationAnimation(bool noAnimation) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScrollingPane::scrollBy(float dx, float dy) {
|
||||
// adjust the translation offsets fpx/fpy by the requested amount
|
||||
float nfpx = fpx + dx;
|
||||
float nfpy = fpy + dy;
|
||||
// convert back to content offset (fpx = -contentOffset.x)
|
||||
setContentOffset(Vec3(-nfpx, -nfpy, 0));
|
||||
}
|
||||
|
||||
void ScrollingPane::setContentOffset(float x, float y) {
|
||||
this->setContentOffsetWithAnimation(Vec3(x, y, 0), false);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
void tick();
|
||||
void render(int xm, int ym, float alpha);
|
||||
|
||||
// scroll the content by the given amount (dx horizontal, dy vertical)
|
||||
// positive values move content downward/rightward
|
||||
void scrollBy(float dx, float dy);
|
||||
|
||||
bool getGridItemFor_slow(int itemIndex, GridItem& out);
|
||||
|
||||
void setSelected(int id, bool selected);
|
||||
|
||||
@@ -202,6 +202,25 @@ void IngameBlockSelectionScreen::keyPressed(int eventKey)
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// wheel support for creative inventory; scroll moves selection vertically
|
||||
void IngameBlockSelectionScreen::mouseWheel(int dx, int dy, int xm, int ym)
|
||||
{
|
||||
if (dy == 0) return;
|
||||
// just move selection up/down one row; desktop UI doesn't have a pane
|
||||
int cols = InventoryCols;
|
||||
int maxIndex = InventorySize - 1;
|
||||
int idx = selectedItem;
|
||||
if (dy > 0) {
|
||||
// wheel up -> previous row
|
||||
if (idx >= cols) idx -= cols;
|
||||
} else {
|
||||
// wheel down -> next row
|
||||
if (idx + cols <= maxIndex) idx += cols;
|
||||
}
|
||||
selectedItem = idx;
|
||||
}
|
||||
|
||||
int IngameBlockSelectionScreen::getSelectedSlot(int x, int y)
|
||||
{
|
||||
int left = width / 2 - InventoryCols * 10;
|
||||
|
||||
@@ -23,6 +23,9 @@ protected:
|
||||
|
||||
virtual void buttonClicked(Button* button);
|
||||
|
||||
// wheel input for creative inventory scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
virtual void keyPressed(int eventKey);
|
||||
private:
|
||||
void renderSlots();
|
||||
|
||||
@@ -356,7 +356,7 @@ void SelectWorldScreen::render( int xm, int ym, float a )
|
||||
worldsList->setComponentSelected(bWorldView.selected);
|
||||
// #ifdef PLATFORM_DESKTOP
|
||||
|
||||
// We should add scrolling with mouse wheel but currently i dont know how to implement it
|
||||
// desktop: render the list normally (mouse wheel handled separately below)
|
||||
if (_mouseHasBeenUp)
|
||||
worldsList->render(xm, ym, a);
|
||||
else {
|
||||
@@ -412,6 +412,28 @@ std::string SelectWorldScreen::getUniqueLevelName( const std::string& level )
|
||||
|
||||
bool SelectWorldScreen::isInGameScreen() { return true; }
|
||||
|
||||
void SelectWorldScreen::mouseWheel(int dx, int dy, int xm, int ym)
|
||||
{
|
||||
if (!worldsList)
|
||||
return;
|
||||
if (dy == 0)
|
||||
return;
|
||||
int num = worldsList->getNumberOfItems();
|
||||
int idx = worldsList->selectedItem;
|
||||
if (dy > 0) {
|
||||
if (idx > 0) {
|
||||
idx--;
|
||||
worldsList->stepLeft();
|
||||
}
|
||||
} else {
|
||||
if (idx < num - 1) {
|
||||
idx++;
|
||||
worldsList->stepRight();
|
||||
}
|
||||
}
|
||||
worldsList->selectedItem = idx;
|
||||
}
|
||||
|
||||
void SelectWorldScreen::keyPressed( int eventKey )
|
||||
{
|
||||
if (bWorldView.selected) {
|
||||
|
||||
@@ -90,6 +90,9 @@ public:
|
||||
|
||||
void render(int xm, int ym, float a);
|
||||
|
||||
// mouse wheel scroll (new in desktop implementation)
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym);
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void loadLevelSource();
|
||||
|
||||
@@ -32,6 +32,13 @@ SimpleChooseLevelScreen::~SimpleChooseLevelScreen()
|
||||
|
||||
void SimpleChooseLevelScreen::init()
|
||||
{
|
||||
// make sure the base class loads the existing level list; the
|
||||
// derived screen uses ChooseLevelScreen::getUniqueLevelName(), which
|
||||
// depends on `levels` being populated. omitting this used to result
|
||||
// in duplicate IDs ("creating the second world would load the
|
||||
// first") when the name already existed.
|
||||
ChooseLevelScreen::init();
|
||||
|
||||
tLevelName.text = "New world";
|
||||
|
||||
// header + close button
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "OptionsScreen.h"
|
||||
#include "PauseScreen.h"
|
||||
#include "PrerenderTilesScreen.h" // test button
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
#include "../../../util/Mth.h"
|
||||
|
||||
@@ -25,7 +26,8 @@
|
||||
StartMenuScreen::StartMenuScreen()
|
||||
: bHost( 2, 0, 0, 160, 24, "Start Game"),
|
||||
bJoin( 3, 0, 0, 160, 24, "Join Game"),
|
||||
bOptions( 4, 0, 0, 78, 22, "Options")
|
||||
bOptions( 4, 0, 0, 78, 22, "Options"),
|
||||
bQuit( 5, "")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -54,10 +56,18 @@ void StartMenuScreen::init()
|
||||
tabButtons.push_back(&bOptions);
|
||||
#endif
|
||||
|
||||
#ifdef DEMO_MODE
|
||||
buttons.push_back(&bBuy);
|
||||
tabButtons.push_back(&bBuy);
|
||||
#endif
|
||||
// add quit button (top right X icon) – match OptionsScreen style
|
||||
{
|
||||
ImageDef def;
|
||||
def.name = "gui/touchgui.png";
|
||||
def.width = 34;
|
||||
def.height = 26;
|
||||
def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
||||
bQuit.setImageDef(def, true);
|
||||
bQuit.scaleWhenPressed = false;
|
||||
buttons.push_back(&bQuit);
|
||||
// don't include in tab navigation
|
||||
}
|
||||
|
||||
copyright = "\xffMojang AB";//. Do not distribute!";
|
||||
|
||||
@@ -100,8 +110,9 @@ void StartMenuScreen::setupPositions() {
|
||||
bJoin.x = (width - bJoin.width) / 2;
|
||||
bOptions.x = (width - bJoin.width) / 2;
|
||||
|
||||
copyrightPosX = width - minecraft->font->width(copyright) - 1;
|
||||
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
|
||||
// position quit icon at top-right (use image-defined size)
|
||||
bQuit.x = width - bQuit.width;
|
||||
bQuit.y = 0;
|
||||
}
|
||||
|
||||
void StartMenuScreen::tick() {
|
||||
@@ -130,6 +141,10 @@ void StartMenuScreen::buttonClicked(Button* button) {
|
||||
{
|
||||
minecraft->setScreen(new OptionsScreen());
|
||||
}
|
||||
if (button == &bQuit)
|
||||
{
|
||||
minecraft->quit();
|
||||
}
|
||||
}
|
||||
|
||||
bool StartMenuScreen::isInGameScreen() { return false; }
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../Screen.h"
|
||||
#include "../components/Button.h"
|
||||
#include "../components/ImageButton.h"
|
||||
|
||||
class StartMenuScreen: public Screen
|
||||
{
|
||||
@@ -25,6 +26,7 @@ private:
|
||||
Button bHost;
|
||||
Button bJoin;
|
||||
Button bOptions;
|
||||
ImageButton bQuit; // X button in top-right corner
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
@@ -33,15 +33,16 @@ void UsernameScreen::setupPositions()
|
||||
int cx = width / 2;
|
||||
int cy = height / 2;
|
||||
|
||||
_btnDone.width = 120;
|
||||
_btnDone.height = 20;
|
||||
// Make the done button match the touch-style option tabs
|
||||
_btnDone.width = 66;
|
||||
_btnDone.height = 26;
|
||||
_btnDone.x = (width - _btnDone.width) / 2;
|
||||
_btnDone.y = height / 2 + 52;
|
||||
|
||||
tUsername.x = _btnDone.x;
|
||||
tUsername.y = _btnDone.y - 60;
|
||||
tUsername.width = 120;
|
||||
tUsername.height = 20;
|
||||
tUsername.x = (width - tUsername.width) / 2;
|
||||
tUsername.y = _btnDone.y - 60;
|
||||
}
|
||||
|
||||
void UsernameScreen::tick()
|
||||
@@ -58,14 +59,20 @@ void UsernameScreen::keyPressed(int eventKey)
|
||||
}
|
||||
|
||||
// deliberately do NOT call super::keyPressed — that would close the screen on Escape
|
||||
_btnDone.active = !tUsername.text.empty();
|
||||
|
||||
Screen::keyPressed(eventKey);
|
||||
|
||||
// enable the Done button only when there is some text (and ensure it updates after backspace)
|
||||
_btnDone.active = !tUsername.text.empty();
|
||||
}
|
||||
|
||||
void UsernameScreen::keyboardNewChar(char inputChar)
|
||||
{
|
||||
for (auto* tb : textBoxes) tb->handleChar(inputChar);
|
||||
// limit username length to 12 characters
|
||||
if (tUsername.text.size() < 12) {
|
||||
for (auto* tb : textBoxes) tb->handleChar(inputChar);
|
||||
}
|
||||
|
||||
_btnDone.active = !tUsername.text.empty();
|
||||
}
|
||||
|
||||
void UsernameScreen::mouseClicked(int x, int y, int button)
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
virtual void buttonClicked(Button* button);
|
||||
|
||||
private:
|
||||
Button _btnDone;
|
||||
Touch::TButton _btnDone;
|
||||
TextBox tUsername;
|
||||
std::string _input;
|
||||
int _cursorBlink;
|
||||
|
||||
@@ -153,6 +153,11 @@ int IngameBlockSelectionScreen::getSlotPosY(int slotY) {
|
||||
return height - 16 - 3 - 22 * 2 - 22 * slotY;
|
||||
}
|
||||
|
||||
int IngameBlockSelectionScreen::getSlotHeight() {
|
||||
// same as non-touch implementation
|
||||
return 22;
|
||||
}
|
||||
|
||||
void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||
_pendingClose = _blockList->_clickArea->isInside((float)x, (float)y);
|
||||
if (!_pendingClose)
|
||||
@@ -166,6 +171,24 @@ void IngameBlockSelectionScreen::mouseReleased(int x, int y, int buttonNum) {
|
||||
super::mouseReleased(x, y, buttonNum);
|
||||
}
|
||||
|
||||
void IngameBlockSelectionScreen::mouseWheel(int dx, int dy, int xm, int ym)
|
||||
{
|
||||
if (dy == 0) return;
|
||||
if (_blockList) {
|
||||
float amount = -dy * getSlotHeight();
|
||||
_blockList->scrollBy(0, amount);
|
||||
}
|
||||
int cols = InventoryColumns;
|
||||
int maxIndex = InventorySize - 1;
|
||||
int idx = selectedItem;
|
||||
if (dy > 0) {
|
||||
if (idx >= cols) idx -= cols;
|
||||
} else {
|
||||
if (idx + cols <= maxIndex) idx += cols;
|
||||
}
|
||||
selectedItem = idx;
|
||||
}
|
||||
|
||||
bool IngameBlockSelectionScreen::addItem(const InventoryPane* pane, int itemId)
|
||||
{
|
||||
Inventory* inventory = minecraft->player->inventory;
|
||||
|
||||
@@ -39,12 +39,16 @@ public:
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
|
||||
// also support wheel scrolling
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
private:
|
||||
void renderDemoOverlay();
|
||||
|
||||
//int getLinearSlotId(int x, int y);
|
||||
int getSlotPosX(int slotX);
|
||||
int getSlotPosY(int slotY);
|
||||
int getSlotHeight();
|
||||
|
||||
private:
|
||||
int selectedItem;
|
||||
|
||||
@@ -389,6 +389,26 @@ static char ILLEGAL_FILE_CHARACTERS[] = {
|
||||
'/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'
|
||||
};
|
||||
|
||||
void SelectWorldScreen::mouseWheel(int dx, int dy, int xm, int ym)
|
||||
{
|
||||
if (!worldsList) return;
|
||||
if (dy == 0) return;
|
||||
int num = worldsList->getNumberOfItems();
|
||||
int idx = worldsList->selectedItem;
|
||||
if (dy > 0) {
|
||||
if (idx > 0) {
|
||||
idx--;
|
||||
worldsList->stepLeft();
|
||||
}
|
||||
} else {
|
||||
if (idx < num - 1) {
|
||||
idx++;
|
||||
worldsList->stepRight();
|
||||
}
|
||||
}
|
||||
worldsList->selectedItem = idx;
|
||||
}
|
||||
|
||||
void SelectWorldScreen::tick()
|
||||
{
|
||||
#if 0
|
||||
|
||||
@@ -97,6 +97,9 @@ public:
|
||||
virtual void buttonClicked(Button* button);
|
||||
virtual void keyPressed(int eventKey);
|
||||
|
||||
// support for mouse wheel when desktop code uses touch variant
|
||||
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
|
||||
|
||||
bool isInGameScreen();
|
||||
private:
|
||||
void loadLevelSource();
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace Touch {
|
||||
StartMenuScreen::StartMenuScreen()
|
||||
: bHost( 2, "Start Game"),
|
||||
bJoin( 3, "Join Game"),
|
||||
bOptions( 4, "Options")
|
||||
bOptions( 4, "Options"),
|
||||
bQuit( 5, "")
|
||||
{
|
||||
ImageDef def;
|
||||
bJoin.width = 75;
|
||||
@@ -58,8 +59,18 @@ void StartMenuScreen::init()
|
||||
buttons.push_back(&bHost);
|
||||
buttons.push_back(&bJoin);
|
||||
buttons.push_back(&bOptions);
|
||||
|
||||
|
||||
// add quit icon (same look as options header)
|
||||
{
|
||||
ImageDef def;
|
||||
def.name = "gui/touchgui.png";
|
||||
def.width = 34;
|
||||
def.height = 26;
|
||||
def.setSrc(IntRectangle(150, 0, (int)def.width, (int)def.height));
|
||||
bQuit.setImageDef(def, true);
|
||||
bQuit.scaleWhenPressed = false;
|
||||
buttons.push_back(&bQuit);
|
||||
}
|
||||
|
||||
tabButtons.push_back(&bHost);
|
||||
tabButtons.push_back(&bJoin);
|
||||
@@ -108,6 +119,10 @@ void StartMenuScreen::setupPositions() {
|
||||
bHost.x = 1*buttonWidth + (int)(2*spacing);
|
||||
bOptions.x = 2*buttonWidth + (int)(3*spacing);
|
||||
|
||||
// quit icon top-right (use size assigned in init)
|
||||
bQuit.x = width - bQuit.width;
|
||||
bQuit.y = 0;
|
||||
|
||||
copyrightPosX = width - minecraft->font->width(copyright) - 1;
|
||||
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
|
||||
}
|
||||
@@ -135,6 +150,10 @@ void StartMenuScreen::buttonClicked(::Button* button) {
|
||||
{
|
||||
minecraft->setScreen(new OptionsScreen());
|
||||
}
|
||||
if (button == &bQuit)
|
||||
{
|
||||
minecraft->quit();
|
||||
}
|
||||
}
|
||||
|
||||
bool StartMenuScreen::isInGameScreen() { return false; }
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../../Screen.h"
|
||||
#include "../../components/LargeImageButton.h"
|
||||
#include "../../components/ImageButton.h"
|
||||
#include "../../components/TextBox.h"
|
||||
|
||||
namespace Touch {
|
||||
@@ -27,6 +28,7 @@ private:
|
||||
LargeImageButton bHost;
|
||||
LargeImageButton bJoin;
|
||||
LargeImageButton bOptions;
|
||||
ImageButton bQuit; // X close icon
|
||||
|
||||
std::string copyright;
|
||||
int copyrightPosX;
|
||||
|
||||
@@ -113,6 +113,14 @@ LRESULT WINAPI windowProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
Multitouch::feed(0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0);
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEWHEEL: {
|
||||
// wheel delta is multiples of WHEEL_DELTA (120); convert to +/-1
|
||||
int delta = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
|
||||
short x = GET_X_LPARAM(lParam);
|
||||
short y = GET_Y_LPARAM(lParam);
|
||||
Mouse::feed(MouseAction::ACTION_WHEEL, 0, x, y, 0, delta);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (uMsg == WM_NCDESTROY) g_running = false;
|
||||
else {
|
||||
|
||||
@@ -165,7 +165,8 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
||||
}
|
||||
if (spawn) {
|
||||
if (!level->isClientSide) {
|
||||
spawnResources(level, x, y, z, data, 0);
|
||||
// use default chance (1.0) so the drop always occurs
|
||||
spawnResources(level, x, y, z, data);
|
||||
}
|
||||
} else {
|
||||
bool signal = level->hasNeighborSignal(x, y, z) || level->hasNeighborSignal(x, y + 1, z);
|
||||
@@ -174,13 +175,12 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// upper half: removal should not drop a second door. the
|
||||
// lower half neighbour handler takes care of spawning the item
|
||||
// whenever the door is broken from either end.
|
||||
if (level->getTile(x, y - 1, z) != id) {
|
||||
level->setTile(x, y, z, 0);
|
||||
if(material == Material::metal) {
|
||||
popResource(level, x, y, z, ItemInstance(Item::door_iron));
|
||||
} else {
|
||||
popResource(level, x, y, z, ItemInstance(Item::door_wood));
|
||||
}
|
||||
// no resource spawn here
|
||||
}
|
||||
if (type > 0 && type != id) {
|
||||
neighborChanged(level, x, y - 1, z, type);
|
||||
@@ -189,7 +189,11 @@ void DoorTile::neighborChanged(Level* level, int x, int y, int z, int type) {
|
||||
}
|
||||
|
||||
int DoorTile::getResource(int data, Random* random) {
|
||||
if ((data & 8) != 0) return 0;
|
||||
// only the lower half should return a resource ID; the upper half
|
||||
// itself never drops anything and playerDestroy suppresses spawning
|
||||
// from the top. This prevents duplicate drops if the bottom half is
|
||||
// mined.
|
||||
if ((data & UPPER_BIT) != 0) return 0;
|
||||
if (material == Material::metal) return Item::door_iron->id;
|
||||
return Item::door_wood->id;
|
||||
}
|
||||
@@ -199,6 +203,14 @@ HitResult DoorTile::clip(Level* level, int xt, int yt, int zt, const Vec3& a, co
|
||||
return super::clip(level, xt, yt, zt, a, b);
|
||||
}
|
||||
|
||||
// override to prevent double-dropping when top half is directly mined
|
||||
void DoorTile::playerDestroy(Level* level, Player* player, int x, int y, int z, int data) {
|
||||
if ((data & UPPER_BIT) == 0) {
|
||||
// only let the lower half handle the actual spawning
|
||||
super::playerDestroy(level, player, x, y, z, data);
|
||||
}
|
||||
}
|
||||
|
||||
int DoorTile::getDir(LevelSource* level, int x, int y, int z) {
|
||||
return getCompositeData(level, x, y, z) & C_DIR_MASK;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ public:
|
||||
|
||||
int getResource(int data, Random* random);
|
||||
|
||||
// override to avoid duplicate drops when upper half is mined directly
|
||||
void playerDestroy(Level* level, Player* player, int x, int y, int z, int data) override;
|
||||
|
||||
HitResult clip(Level* level, int xt, int yt, int zt, const Vec3& a, const Vec3& b);
|
||||
|
||||
int getDir(LevelSource* level, int x, int y, int z);
|
||||
|
||||
Reference in New Issue
Block a user