mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Merge branch 'dev' into tu19-take-2
This commit is contained in:
commit
d4af59cf77
|
|
@ -1387,8 +1387,8 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) {
|
||||||
QueryPerformanceCounter(&qwNewTime);
|
QueryPerformanceCounter(&qwNewTime);
|
||||||
qwDeltaTime.QuadPart =
|
qwDeltaTime.QuadPart =
|
||||||
qwNewTime.QuadPart - qwTime.QuadPart;
|
qwNewTime.QuadPart - qwTime.QuadPart;
|
||||||
fElapsedTime =
|
fElapsedTime = fSecsPerTick *
|
||||||
fSecsPerTick * static_cast<float>(qwDeltaTime.QuadPart);
|
static_cast<float>(qwDeltaTime.QuadPart);
|
||||||
app.DebugPrintf("Autosave: Elapsed time %f\n",
|
app.DebugPrintf("Autosave: Elapsed time %f\n",
|
||||||
fElapsedTime);
|
fElapsedTime);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
||||||
|
|
@ -23,41 +23,3 @@ void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
|
||||||
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
|
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
|
||||||
m_bIsPlayingNetherMusic = bVal;
|
m_bIsPlayingNetherMusic = bVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleSoundEngine::tick() {
|
|
||||||
if (scheduledSounds.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AUTO_VAR(it, scheduledSounds.begin()); it != scheduledSounds.end();) {
|
|
||||||
SoundEngine::ScheduledSound* next = *it;
|
|
||||||
next->delay--;
|
|
||||||
|
|
||||||
if (next->delay <= 0) {
|
|
||||||
play(next->iSound, next->x, next->y, next->z, next->volume,
|
|
||||||
next->pitch);
|
|
||||||
it = scheduledSounds.erase(it);
|
|
||||||
delete next;
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z,
|
|
||||||
float volume, float pitch, int delayTicks) {
|
|
||||||
scheduledSounds.push_back(new SoundEngine::ScheduledSound(
|
|
||||||
iSound, x, y, z, volume, pitch, delayTicks));
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y,
|
|
||||||
float z, float volume,
|
|
||||||
float pitch, int delay) {
|
|
||||||
this->iSound = iSound;
|
|
||||||
this->x = x;
|
|
||||||
this->y = y;
|
|
||||||
this->z = z;
|
|
||||||
this->volume = volume;
|
|
||||||
this->pitch = pitch;
|
|
||||||
this->delay = delay;
|
|
||||||
}
|
|
||||||
|
|
@ -152,8 +152,10 @@ std::wstring CreateWorldScreen::findAvailableFolderName(
|
||||||
void CreateWorldScreen::removed() { Keyboard::enableRepeatEvents(false); }
|
void CreateWorldScreen::removed() { Keyboard::enableRepeatEvents(false); }
|
||||||
|
|
||||||
void CreateWorldScreen::buttonClicked(Button* button) {
|
void CreateWorldScreen::buttonClicked(Button* button) {
|
||||||
|
app.DebugPrintf("CreateWorldScreen::buttonClicked START\n");
|
||||||
if (!button->active) return;
|
if (!button->active) return;
|
||||||
if (button->id == 1) {
|
if (button->id == 1) {
|
||||||
|
app.DebugPrintf("CreateWorldScreen::buttonClicked 'Cancel' minecraft->setScreen(lastScreen)\n");
|
||||||
minecraft->setScreen(lastScreen);
|
minecraft->setScreen(lastScreen);
|
||||||
} else if (button->id == 0) {
|
} else if (button->id == 0) {
|
||||||
minecraft->setScreen(
|
minecraft->setScreen(
|
||||||
|
|
@ -418,4 +420,4 @@ void CreateWorldScreen::tabPressed() {
|
||||||
nameEdit->focus(true);
|
nameEdit->focus(true);
|
||||||
seedEdit->focus(false);
|
seedEdit->focus(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectWorldScreen::init() {
|
void SelectWorldScreen::init() {
|
||||||
|
app.DebugPrintf("SelectWorldScreen::init() START\n");
|
||||||
Language* language = Language::getInstance();
|
Language* language = Language::getInstance();
|
||||||
title = language->getElement(L"selectWorld.title");
|
title = language->getElement(L"selectWorld.title");
|
||||||
|
|
||||||
|
|
@ -84,6 +85,7 @@ void SelectWorldScreen::postInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectWorldScreen::buttonClicked(Button* button) {
|
void SelectWorldScreen::buttonClicked(Button* button) {
|
||||||
|
app.DebugPrintf("SelectWorldScreen::buttonClicked START\n");
|
||||||
if (!button->active) return;
|
if (!button->active) return;
|
||||||
if (button->id == BUTTON_DELETE_ID) {
|
if (button->id == BUTTON_DELETE_ID) {
|
||||||
std::wstring worldName = getWorldName(selectedWorld);
|
std::wstring worldName = getWorldName(selectedWorld);
|
||||||
|
|
@ -125,6 +127,7 @@ void SelectWorldScreen::buttonClicked(Button* button) {
|
||||||
minecraft->setScreen(
|
minecraft->setScreen(
|
||||||
new RenameWorldScreen(this, getWorldId(selectedWorld)));
|
new RenameWorldScreen(this, getWorldId(selectedWorld)));
|
||||||
} else if (button->id == BUTTON_CANCEL_ID) {
|
} else if (button->id == BUTTON_CANCEL_ID) {
|
||||||
|
app.DebugPrintf("SelectWorldScreen::buttonClicked 'Cancel' minecraft->setScreen(lastScreen)\n");
|
||||||
minecraft->setScreen(lastScreen);
|
minecraft->setScreen(lastScreen);
|
||||||
} else {
|
} else {
|
||||||
worldSelectionList->buttonClicked(button);
|
worldSelectionList->buttonClicked(button);
|
||||||
|
|
@ -173,35 +176,38 @@ void SelectWorldScreen::render(int xm, int ym, float a) {
|
||||||
Screen::render(xm, ym, a);
|
Screen::render(xm, ym, a);
|
||||||
|
|
||||||
// 4J - debug code - remove
|
// 4J - debug code - remove
|
||||||
static int count = 0;
|
if (0) {
|
||||||
static bool forceCreateLevel = false;
|
static int count = 0;
|
||||||
if (count++ >= 100) {
|
static bool forceCreateLevel = false;
|
||||||
if (!forceCreateLevel && levelList->size() > 0) {
|
if (count++ >= 100) {
|
||||||
// 4J Stu - For some obscures reason the "delete" button is called
|
if (!forceCreateLevel && levelList->size() > 0) {
|
||||||
// "renameButton" and vice versa.
|
// 4J Stu - For some obscures reason the "delete" button is called
|
||||||
// if( levelList->size() > 2 && deleteButton->active )
|
// "renameButton" and vice versa.
|
||||||
//{
|
// if( levelList->size() > 2 && deleteButton->active )
|
||||||
// this->selectedWorld = 2;
|
//{
|
||||||
// count = 0;
|
// this->selectedWorld = 2;
|
||||||
// buttonClicked(deleteButton);
|
// count = 0;
|
||||||
//}
|
// buttonClicked(deleteButton);
|
||||||
// else
|
//}
|
||||||
if (levelList->size() > 1 && renameButton->active) {
|
// else
|
||||||
this->selectedWorld = 1;
|
if (levelList->size() > 1 && renameButton->active) {
|
||||||
count = 0;
|
this->selectedWorld = 1;
|
||||||
buttonClicked(renameButton);
|
count = 0;
|
||||||
} else if (selectButton->active == true) {
|
buttonClicked(renameButton);
|
||||||
this->selectedWorld = 0;
|
} else if (selectButton->active == true) {
|
||||||
buttonClicked(selectButton);
|
this->selectedWorld = 0;
|
||||||
// this->worldSelected( 0 );
|
buttonClicked(selectButton);
|
||||||
|
// this->worldSelected( 0 );
|
||||||
|
} else {
|
||||||
|
selectButton->active = true;
|
||||||
|
deleteButton->active = true;
|
||||||
|
renameButton->active = true;
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectButton->active = true;
|
app.DebugPrintf("SelectWorldScreen::render minecraft->setScreen(new CreateWorldScreen(this))\n");
|
||||||
deleteButton->active = true;
|
minecraft->setScreen(new CreateWorldScreen(this));
|
||||||
renameButton->active = true;
|
|
||||||
count = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
minecraft->setScreen(new CreateWorldScreen(this));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
71
flake.lock
71
flake.lock
|
|
@ -1,12 +1,54 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"4jlibs": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774012501,
|
||||||
|
"narHash": "sha256-NoM5LtKcU+3LFPVZUtep1L+hfZS6YSQ4P/xkJU/2NY4=",
|
||||||
|
"owner": "4jcraft",
|
||||||
|
"repo": "4jlibs",
|
||||||
|
"rev": "df5f4a1fc3288fdc021b3d8ee2abaed3083de460",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "4jcraft",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "4jlibs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"miniaudio": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1740378702,
|
||||||
|
"narHash": "sha256-o/7sfBcrhyXEakccOAogQqm8dO4Szj1QSpaIHg6OSt4=",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.22.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.22.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"miniaudio-patch": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-txCgaQ2r4134YVNJjw0oVG9yGGLxGvdLfXnB1j+DI/4=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://wrapdb.mesonbuild.com/v2/miniaudio_0.11.22-2/get_patch"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://wrapdb.mesonbuild.com/v2/miniaudio_0.11.22-2/get_patch"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773734432,
|
"lastModified": 1774106199,
|
||||||
"narHash": "sha256-IF5ppUWh6gHGHYDbtVUyhwy/i7D261P7fWD1bPefOsw=",
|
"narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "cda48547b432e8d3b18b4180ba07473762ec8558",
|
"rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -18,8 +60,12 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"4jlibs": "4jlibs",
|
||||||
|
"miniaudio": "miniaudio",
|
||||||
|
"miniaudio-patch": "miniaudio-patch",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"shiggy": "shiggy"
|
"shiggy": "shiggy",
|
||||||
|
"stb": "stb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"shiggy": {
|
"shiggy": {
|
||||||
|
|
@ -38,6 +84,23 @@
|
||||||
"repo": "shiggy",
|
"repo": "shiggy",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"stb": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1773836560,
|
||||||
|
"narHash": "sha256-bRXN5YdVuSi9gzWn7UbCY+v6OSQdfWaUwrP1WWKrbks=",
|
||||||
|
"owner": "nothings",
|
||||||
|
"repo": "stb",
|
||||||
|
"rev": "28d546d5eb77d4585506a20480f4de2e706dff4c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nothings",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "stb",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
113
flake.nix
113
flake.nix
|
|
@ -3,13 +3,30 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
|
||||||
shiggy = {
|
shiggy = {
|
||||||
url = "github:4jcraft/shiggy/main";
|
url = "github:4jcraft/shiggy/main";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
miniaudio = {
|
||||||
|
url = "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.22.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
miniaudio-patch = {
|
||||||
|
url = "https://wrapdb.mesonbuild.com/v2/miniaudio_0.11.22-2/get_patch";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
"4jlibs" = {
|
||||||
|
url = "github:4jcraft/4jlibs/main";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
stb = {
|
||||||
|
url = "github:nothings/stb/master";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, shiggy, ... }:
|
outputs = { self, nixpkgs, ... } @ inputs:
|
||||||
let
|
let
|
||||||
allSystems = [
|
allSystems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
|
|
@ -22,50 +39,66 @@
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forAllSystems ({ pkgs }:
|
packages = forAllSystems ({ pkgs }: {
|
||||||
{
|
default = pkgs.clangStdenv.mkDerivation {
|
||||||
default = pkgs.clangStdenv.mkDerivation {
|
pname = "4jcraft";
|
||||||
pname = "4jcraft";
|
version = "0.1.0";
|
||||||
version = "0.1.0";
|
src = ./.;
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
preConfigure = ''
|
dontUseCmakeConfigure = true;
|
||||||
mkdir -p subprojects/shiggy
|
|
||||||
cp -r ${shiggy}/. subprojects/shiggy/
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
preConfigure = ''
|
||||||
openssl.dev
|
cp -r ${inputs.shiggy} subprojects/shiggy
|
||||||
libGL
|
cp -r ${inputs.miniaudio} subprojects/miniaudio
|
||||||
libGLU
|
chmod -R u+w subprojects/miniaudio
|
||||||
SDL2
|
unzip ${inputs."miniaudio-patch"} -d /tmp/miniaudio-patch/
|
||||||
zlib
|
cp -r /tmp/miniaudio-patch/*/. subprojects/miniaudio/
|
||||||
];
|
cat > subprojects/miniaudio.wrap <<'EOF'
|
||||||
|
[wrap-file]
|
||||||
|
directory = miniaudio
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
[provide]
|
||||||
lld
|
dependency_names = miniaudio
|
||||||
meson
|
EOF
|
||||||
ninja
|
cp -r ${inputs."4jlibs"} subprojects/4jlibs
|
||||||
pkg-config
|
cp -r ${inputs.stb} subprojects/stb
|
||||||
python3
|
chmod -R u+w subprojects/
|
||||||
makeWrapper
|
cp subprojects/packagefiles/stb/meson.build subprojects/stb/meson.build
|
||||||
];
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
buildInputs = with pkgs; [
|
||||||
mkdir -p $out/share/4jcraft
|
openssl.dev
|
||||||
cp -r Minecraft.Client/. $out/share/4jcraft/
|
libGL
|
||||||
mkdir -p $out/bin
|
libGLU
|
||||||
makeWrapper $out/share/4jcraft/Minecraft.Client \
|
SDL2
|
||||||
$out/bin/4jcraft \
|
zlib
|
||||||
--run "cd $out/share/4jcraft"
|
];
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
nativeBuildInputs = with pkgs; [
|
||||||
description = "4JCraft";
|
cmake
|
||||||
platforms = pkgs.lib.platforms.linux;
|
lld
|
||||||
};
|
meson
|
||||||
|
ninja
|
||||||
|
pkg-config
|
||||||
|
python3
|
||||||
|
makeWrapper
|
||||||
|
unzip
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/4jcraft
|
||||||
|
cp -r Minecraft.Client/. $out/share/4jcraft/
|
||||||
|
mkdir -p $out/bin
|
||||||
|
makeWrapper $out/share/4jcraft/Minecraft.Client \
|
||||||
|
$out/bin/4jcraft \
|
||||||
|
--run "cd $out/share/4jcraft"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "4JCraft";
|
||||||
|
platforms = pkgs.lib.platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
);
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue