mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-10 21:17:14 +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);
|
||||
qwDeltaTime.QuadPart =
|
||||
qwNewTime.QuadPart - qwTime.QuadPart;
|
||||
fElapsedTime =
|
||||
fSecsPerTick * static_cast<float>(qwDeltaTime.QuadPart);
|
||||
fElapsedTime = fSecsPerTick *
|
||||
static_cast<float>(qwDeltaTime.QuadPart);
|
||||
app.DebugPrintf("Autosave: Elapsed time %f\n",
|
||||
fElapsedTime);
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -23,41 +23,3 @@ void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
|
|||
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool 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::buttonClicked(Button* button) {
|
||||
app.DebugPrintf("CreateWorldScreen::buttonClicked START\n");
|
||||
if (!button->active) return;
|
||||
if (button->id == 1) {
|
||||
app.DebugPrintf("CreateWorldScreen::buttonClicked 'Cancel' minecraft->setScreen(lastScreen)\n");
|
||||
minecraft->setScreen(lastScreen);
|
||||
} else if (button->id == 0) {
|
||||
minecraft->setScreen(
|
||||
|
|
@ -418,4 +420,4 @@ void CreateWorldScreen::tabPressed() {
|
|||
nameEdit->focus(true);
|
||||
seedEdit->focus(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ SelectWorldScreen::SelectWorldScreen(Screen* lastScreen) {
|
|||
}
|
||||
|
||||
void SelectWorldScreen::init() {
|
||||
app.DebugPrintf("SelectWorldScreen::init() START\n");
|
||||
Language* language = Language::getInstance();
|
||||
title = language->getElement(L"selectWorld.title");
|
||||
|
||||
|
|
@ -84,6 +85,7 @@ void SelectWorldScreen::postInit() {
|
|||
}
|
||||
|
||||
void SelectWorldScreen::buttonClicked(Button* button) {
|
||||
app.DebugPrintf("SelectWorldScreen::buttonClicked START\n");
|
||||
if (!button->active) return;
|
||||
if (button->id == BUTTON_DELETE_ID) {
|
||||
std::wstring worldName = getWorldName(selectedWorld);
|
||||
|
|
@ -125,6 +127,7 @@ void SelectWorldScreen::buttonClicked(Button* button) {
|
|||
minecraft->setScreen(
|
||||
new RenameWorldScreen(this, getWorldId(selectedWorld)));
|
||||
} else if (button->id == BUTTON_CANCEL_ID) {
|
||||
app.DebugPrintf("SelectWorldScreen::buttonClicked 'Cancel' minecraft->setScreen(lastScreen)\n");
|
||||
minecraft->setScreen(lastScreen);
|
||||
} else {
|
||||
worldSelectionList->buttonClicked(button);
|
||||
|
|
@ -173,35 +176,38 @@ void SelectWorldScreen::render(int xm, int ym, float a) {
|
|||
Screen::render(xm, ym, a);
|
||||
|
||||
// 4J - debug code - remove
|
||||
static int count = 0;
|
||||
static bool forceCreateLevel = false;
|
||||
if (count++ >= 100) {
|
||||
if (!forceCreateLevel && levelList->size() > 0) {
|
||||
// 4J Stu - For some obscures reason the "delete" button is called
|
||||
// "renameButton" and vice versa.
|
||||
// if( levelList->size() > 2 && deleteButton->active )
|
||||
//{
|
||||
// this->selectedWorld = 2;
|
||||
// count = 0;
|
||||
// buttonClicked(deleteButton);
|
||||
//}
|
||||
// else
|
||||
if (levelList->size() > 1 && renameButton->active) {
|
||||
this->selectedWorld = 1;
|
||||
count = 0;
|
||||
buttonClicked(renameButton);
|
||||
} else if (selectButton->active == true) {
|
||||
this->selectedWorld = 0;
|
||||
buttonClicked(selectButton);
|
||||
// this->worldSelected( 0 );
|
||||
if (0) {
|
||||
static int count = 0;
|
||||
static bool forceCreateLevel = false;
|
||||
if (count++ >= 100) {
|
||||
if (!forceCreateLevel && levelList->size() > 0) {
|
||||
// 4J Stu - For some obscures reason the "delete" button is called
|
||||
// "renameButton" and vice versa.
|
||||
// if( levelList->size() > 2 && deleteButton->active )
|
||||
//{
|
||||
// this->selectedWorld = 2;
|
||||
// count = 0;
|
||||
// buttonClicked(deleteButton);
|
||||
//}
|
||||
// else
|
||||
if (levelList->size() > 1 && renameButton->active) {
|
||||
this->selectedWorld = 1;
|
||||
count = 0;
|
||||
buttonClicked(renameButton);
|
||||
} else if (selectButton->active == true) {
|
||||
this->selectedWorld = 0;
|
||||
buttonClicked(selectButton);
|
||||
// this->worldSelected( 0 );
|
||||
} else {
|
||||
selectButton->active = true;
|
||||
deleteButton->active = true;
|
||||
renameButton->active = true;
|
||||
count = 0;
|
||||
}
|
||||
} else {
|
||||
selectButton->active = true;
|
||||
deleteButton->active = true;
|
||||
renameButton->active = true;
|
||||
count = 0;
|
||||
app.DebugPrintf("SelectWorldScreen::render minecraft->setScreen(new CreateWorldScreen(this))\n");
|
||||
minecraft->setScreen(new CreateWorldScreen(this));
|
||||
}
|
||||
} else {
|
||||
minecraft->setScreen(new CreateWorldScreen(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
71
flake.lock
71
flake.lock
|
|
@ -1,12 +1,54 @@
|
|||
{
|
||||
"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": {
|
||||
"locked": {
|
||||
"lastModified": 1773734432,
|
||||
"narHash": "sha256-IF5ppUWh6gHGHYDbtVUyhwy/i7D261P7fWD1bPefOsw=",
|
||||
"lastModified": 1774106199,
|
||||
"narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cda48547b432e8d3b18b4180ba07473762ec8558",
|
||||
"rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -18,8 +60,12 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"4jlibs": "4jlibs",
|
||||
"miniaudio": "miniaudio",
|
||||
"miniaudio-patch": "miniaudio-patch",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"shiggy": "shiggy"
|
||||
"shiggy": "shiggy",
|
||||
"stb": "stb"
|
||||
}
|
||||
},
|
||||
"shiggy": {
|
||||
|
|
@ -38,6 +84,23 @@
|
|||
"repo": "shiggy",
|
||||
"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",
|
||||
|
|
|
|||
113
flake.nix
113
flake.nix
|
|
@ -3,13 +3,30 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
||||
shiggy = {
|
||||
url = "github:4jcraft/shiggy/main";
|
||||
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
|
||||
allSystems = [
|
||||
"x86_64-linux"
|
||||
|
|
@ -22,50 +39,66 @@
|
|||
});
|
||||
in
|
||||
{
|
||||
packages = forAllSystems ({ pkgs }:
|
||||
{
|
||||
default = pkgs.clangStdenv.mkDerivation {
|
||||
pname = "4jcraft";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
packages = forAllSystems ({ pkgs }: {
|
||||
default = pkgs.clangStdenv.mkDerivation {
|
||||
pname = "4jcraft";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
|
||||
preConfigure = ''
|
||||
mkdir -p subprojects/shiggy
|
||||
cp -r ${shiggy}/. subprojects/shiggy/
|
||||
'';
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
openssl.dev
|
||||
libGL
|
||||
libGLU
|
||||
SDL2
|
||||
zlib
|
||||
];
|
||||
preConfigure = ''
|
||||
cp -r ${inputs.shiggy} subprojects/shiggy
|
||||
cp -r ${inputs.miniaudio} subprojects/miniaudio
|
||||
chmod -R u+w subprojects/miniaudio
|
||||
unzip ${inputs."miniaudio-patch"} -d /tmp/miniaudio-patch/
|
||||
cp -r /tmp/miniaudio-patch/*/. subprojects/miniaudio/
|
||||
cat > subprojects/miniaudio.wrap <<'EOF'
|
||||
[wrap-file]
|
||||
directory = miniaudio
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
lld
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
python3
|
||||
makeWrapper
|
||||
];
|
||||
[provide]
|
||||
dependency_names = miniaudio
|
||||
EOF
|
||||
cp -r ${inputs."4jlibs"} subprojects/4jlibs
|
||||
cp -r ${inputs.stb} subprojects/stb
|
||||
chmod -R u+w subprojects/
|
||||
cp subprojects/packagefiles/stb/meson.build subprojects/stb/meson.build
|
||||
'';
|
||||
|
||||
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"
|
||||
'';
|
||||
buildInputs = with pkgs; [
|
||||
openssl.dev
|
||||
libGL
|
||||
libGLU
|
||||
SDL2
|
||||
zlib
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "4JCraft";
|
||||
platforms = pkgs.lib.platforms.linux;
|
||||
};
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cmake
|
||||
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