Skip to content

Commit b3feddf

Browse files
smartcmdcodeHusky
andauthored
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a4399. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki <lokirautio@gmail.com>
1 parent 84c31a2 commit b3feddf

File tree

2,069 files changed

+247767
-122447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,069 files changed

+247767
-122447
lines changed

CMakeLists.txt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.24)
22

3-
project(MinecraftConsoles LANGUAGES C CXX)
3+
project(MinecraftConsoles LANGUAGES C CXX ASM_MASM)
44

55
if(NOT WIN32)
66
message(FATAL_ERROR "This CMake build currently supports Windows only.")
@@ -28,7 +28,11 @@ target_compile_definitions(MinecraftWorld PRIVATE
2828
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
2929
)
3030
if(MSVC)
31-
target_compile_options(MinecraftWorld PRIVATE /W3 /MP /EHsc)
31+
target_compile_options(MinecraftWorld PRIVATE
32+
$<$<COMPILE_LANGUAGE:C,CXX>:/W3>
33+
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
34+
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
35+
)
3236
endif()
3337

3438
add_executable(MinecraftClient WIN32 ${MINECRAFT_CLIENT_SOURCES})
@@ -43,7 +47,11 @@ target_compile_definitions(MinecraftClient PRIVATE
4347
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
4448
)
4549
if(MSVC)
46-
target_compile_options(MinecraftClient PRIVATE /W3 /MP /EHsc)
50+
target_compile_options(MinecraftClient PRIVATE
51+
$<$<COMPILE_LANGUAGE:C,CXX>:/W3>
52+
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
53+
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
54+
)
4755
endif()
4856

4957
set_target_properties(MinecraftClient PROPERTIES
@@ -55,18 +63,20 @@ target_link_libraries(MinecraftClient PRIVATE
5563
d3d11
5664
XInput9_1_0
5765
Shcore
66+
wsock32
67+
legacy_stdio_definitions
5868
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib"
69+
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyperfmon_w64.lib"
70+
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyexpruntime_w64.lib"
5971
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Miles/lib/mss64.lib"
6072
$<$<CONFIG:Debug>:
6173
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_d.lib"
6274
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_d.lib"
63-
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Profile_d.lib"
6475
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC_d.lib"
6576
>
6677
$<$<NOT:$<CONFIG:Debug>>:
67-
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_r.lib"
68-
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_r.lib"
69-
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Profile_r.lib"
78+
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input.lib"
79+
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage.lib"
7080
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC.lib"
7181
>
7282
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include "stdafx.h"
2+
#include "..\Minecraft.World\net.minecraft.core.h"
3+
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
4+
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
5+
#include "..\Minecraft.World\net.minecraft.world.level.h"
6+
#include "AbstractProjectileDispenseBehavior.h"
7+
8+
shared_ptr<ItemInstance> AbstractProjectileDispenseBehavior::execute(BlockSource *source, shared_ptr<ItemInstance> dispensed)
9+
{
10+
Level *world = source->getWorld();
11+
Position position = DispenserTile::getDispensePosition(source);
12+
FacingEnum *facing = DispenserTile::getFacing(source->getData());
13+
14+
shared_ptr<Projectile> arrow = getProjectile(world, position);
15+
arrow->shoot(facing->getStepX(), facing->getStepY() + .1f, facing->getStepZ(), getPower(), getUncertainty());
16+
world->addEntity(arrow);
17+
18+
dispensed->remove(1);
19+
20+
return dispensed;
21+
}
22+
23+
void AbstractProjectileDispenseBehavior::playSound(BlockSource *source)
24+
{
25+
source->getWorld()->levelEvent(LevelEvent::SOUND_LAUNCH, source->getBlockX(), source->getBlockY(), source->getBlockZ(), 0);
26+
}
27+
28+
29+
float AbstractProjectileDispenseBehavior::getUncertainty()
30+
{
31+
return 6;
32+
}
33+
34+
float AbstractProjectileDispenseBehavior::getPower()
35+
{
36+
return 1.1f;
37+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
3+
#include "..\Minecraft.World\DefaultDispenseItemBehavior.h"
4+
5+
class Projectile;
6+
7+
class AbstractProjectileDispenseBehavior : public DefaultDispenseItemBehavior
8+
{
9+
public:
10+
shared_ptr<ItemInstance> execute(BlockSource *source, shared_ptr<ItemInstance> dispensed);
11+
12+
protected:
13+
virtual void playSound(BlockSource *source);
14+
virtual shared_ptr<Projectile> getProjectile(Level *world, Position *position) = 0;
15+
virtual float getUncertainty();
16+
virtual float getPower();
17+
};

Minecraft.Client/AbstractTexturePack.cpp

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,30 +187,34 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons
187187
wstring animationDefinitionFile = textureName + L".txt";
188188

189189
bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false);
190+
191+
wstring result = L"";
190192

191193
InputStream *fileStream = getResource(L"\\" + path + animationDefinitionFile, requiresFallback);
192194

193-
//Minecraft::getInstance()->getLogger().info("Found animation info for: " + animationDefinitionFile);
195+
if(fileStream)
196+
{
197+
//Minecraft::getInstance()->getLogger().info("Found animation info for: " + animationDefinitionFile);
194198
#ifndef _CONTENT_PACKAGE
195-
wprintf(L"Found animation info for: %ls\n", animationDefinitionFile.c_str() );
199+
app.DebugPrintf("Found animation info for: %ls\n", animationDefinitionFile.c_str() );
196200
#endif
197-
InputStreamReader isr(fileStream);
198-
BufferedReader br(&isr);
199-
200-
wstring result = L"";
201+
InputStreamReader isr(fileStream);
202+
BufferedReader br(&isr);
201203

202-
wstring line = br.readLine();
203-
while (!line.empty())
204-
{
205-
line = trimString(line);
206-
if (line.length() > 0)
204+
205+
wstring line = br.readLine();
206+
while (!line.empty())
207207
{
208-
result.append(L",");
209-
result.append(line);
208+
line = trimString(line);
209+
if (line.length() > 0)
210+
{
211+
result.append(L",");
212+
result.append(line);
213+
}
214+
line = br.readLine();
210215
}
211-
line = br.readLine();
216+
delete fileStream;
212217
}
213-
delete fileStream;
214218

215219
return result;
216220
}
@@ -253,7 +257,14 @@ void AbstractTexturePack::loadColourTable()
253257
void AbstractTexturePack::loadDefaultColourTable()
254258
{
255259
// Load the file
260+
#ifdef __PS3__
261+
// need to check if it's a BD build, so pass in the name
262+
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
263+
264+
#else
256265
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
266+
#endif
267+
257268

258269
if(coloursFile.exists())
259270
{

Minecraft.Client/ArrowRenderer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
44
#include "..\Minecraft.World\Mth.h"
55

6+
ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS);
7+
68
void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a)
79
{
810
// 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr<Entity> we have here -
911
// do some casting around instead
1012
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
11-
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
13+
bindTexture(_arrow); // 4J - was L"/item/arrows.png"
1214

1315
glPushMatrix();
1416

@@ -83,4 +85,9 @@ void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double
8385
}
8486
glDisable(GL_RESCALE_NORMAL);
8587
glPopMatrix();
88+
}
89+
90+
ResourceLocation *ArrowRenderer::getTextureLocation(shared_ptr<Entity> mob)
91+
{
92+
return &ARROW_LOCATION;
8693
}

Minecraft.Client/ArrowRenderer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
class ArrowRenderer : public EntityRenderer
55
{
6+
private:
7+
static ResourceLocation ARROW_LOCATION;
8+
69
public:
710
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
11+
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
812
};

Minecraft.Client/BatModel.cpp

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#include "stdafx.h"
2+
#include "..\Minecraft.World\net.minecraft.world.entity.ambient.h"
3+
#include "BatModel.h"
4+
#include "ModelPart.h"
5+
6+
BatModel::BatModel() : Model()
7+
{
8+
texWidth = 64;
9+
texHeight = 64;
10+
11+
head = new ModelPart(this, 0, 0);
12+
head->addBox(-3, -3, -3, 6, 6, 6);
13+
14+
ModelPart *rightEar = new ModelPart(this, 24, 0);
15+
rightEar->addBox(-4, -6, -2, 3, 4, 1);
16+
head->addChild(rightEar);
17+
ModelPart *leftEar = new ModelPart(this, 24, 0);
18+
leftEar->bMirror = true;
19+
leftEar->addBox(1, -6, -2, 3, 4, 1);
20+
head->addChild(leftEar);
21+
22+
body = new ModelPart(this, 0, 16);
23+
body->addBox(-3, 4, -3, 6, 12, 6);
24+
body->texOffs(0, 34)->addBox(-5, 16, 0, 10, 6, 1);
25+
26+
rightWing = new ModelPart(this, 42, 0);
27+
rightWing->addBox(-12, 1, 1.5f, 10, 16, 1);
28+
rightWingTip = new ModelPart(this, 24, 16);
29+
rightWingTip->setPos(-12, 1, 1.5f);
30+
rightWingTip->addBox(-8, 1, 0, 8, 12, 1);
31+
32+
leftWing = new ModelPart(this, 42, 0);
33+
leftWing->bMirror = true;
34+
leftWing->addBox(2, 1, 1.5f, 10, 16, 1);
35+
leftWingTip = new ModelPart(this, 24, 16);
36+
leftWingTip->bMirror = true;
37+
leftWingTip->setPos(12, 1, 1.5f);
38+
leftWingTip->addBox(0, 1, 0, 8, 12, 1);
39+
40+
body->addChild(rightWing);
41+
body->addChild(leftWing);
42+
rightWing->addChild(rightWingTip);
43+
leftWing->addChild(leftWingTip);
44+
45+
// 4J added - compile now to avoid random performance hit first time cubes are rendered
46+
// 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here
47+
head->compile(1.0f/16.0f);
48+
body->compile(1.0f/16.0f);
49+
rightWing->compile(1.0f/16.0f);
50+
leftWing->compile(1.0f/16.0f);
51+
rightWingTip->compile(1.0f/16.0f);
52+
leftWingTip->compile(1.0f/16.0f);
53+
rightEar->compile(1.0f/16.0f);
54+
leftEar->compile(1.0f/16.0f);
55+
}
56+
57+
int BatModel::modelVersion()
58+
{
59+
return 36;
60+
}
61+
62+
void BatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
63+
{
64+
shared_ptr<Bat> bat = dynamic_pointer_cast<Bat>(entity);
65+
if (bat->isResting())
66+
{
67+
float rad = 180 / PI;
68+
head->xRot = xRot / rad;
69+
head->yRot = PI - yRot / rad;
70+
head->zRot = PI;
71+
72+
head->setPos(0, -2, 0);
73+
rightWing->setPos(-3, 0, 3);
74+
leftWing->setPos(3, 0, 3);
75+
76+
body->xRot = PI;
77+
78+
rightWing->xRot = -PI * .05f;
79+
rightWing->yRot = -PI * .40f;
80+
rightWingTip->yRot = -PI * .55f;
81+
leftWing->xRot = rightWing->xRot;
82+
leftWing->yRot = -rightWing->yRot;
83+
leftWingTip->yRot = -rightWingTip->yRot;
84+
}
85+
else
86+
{
87+
float rad = 180 / PI;
88+
head->xRot = xRot / rad;
89+
head->yRot = yRot / rad;
90+
head->zRot = 0;
91+
92+
head->setPos(0, 0, 0);
93+
rightWing->setPos(0, 0, 0);
94+
leftWing->setPos(0, 0, 0);
95+
96+
body->xRot = PI * .25f + cos(bob * .1f) * .15f;
97+
body->yRot = 0;
98+
99+
rightWing->yRot = cos(bob * 1.3f) * PI * .25f;
100+
leftWing->yRot = -rightWing->yRot;
101+
rightWingTip->yRot = rightWing->yRot * .5f;
102+
leftWingTip->yRot = -rightWing->yRot * .5f;
103+
}
104+
105+
head->render(scale, usecompiled);
106+
body->render(scale, usecompiled);
107+
}

Minecraft.Client/BatModel.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
#include "Model.h"
3+
4+
class BatModel : public Model
5+
{
6+
private:
7+
ModelPart *head;
8+
ModelPart *body;
9+
ModelPart *rightWing;
10+
ModelPart *leftWing;
11+
ModelPart *rightWingTip;
12+
ModelPart *leftWingTip;
13+
14+
public:
15+
BatModel();
16+
17+
int modelVersion();
18+
19+
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
20+
};

0 commit comments

Comments
 (0)