better graphics, zlib to work on vc++
2
Makefile
|
@ -34,7 +34,7 @@ endif
|
||||||
|
|
||||||
# Target specific settings
|
# Target specific settings
|
||||||
|
|
||||||
all_linux fast_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L$(IRRLICHTPATH)/lib/Linux -L$(JTHREADPATH)/src/.libs -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -ljthread
|
all_linux fast_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L$(IRRLICHTPATH)/lib/Linux -L$(JTHREADPATH)/src/.libs -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -ljthread -lz
|
||||||
all_linux fast_linux clean_linux: SYSTEM=Linux
|
all_linux fast_linux clean_linux: SYSTEM=Linux
|
||||||
|
|
||||||
all_win32: LDFLAGS = -L$(IRRLICHTPATH)/lib/Win32-gcc -L$(JTHREADPATH)/Debug -lIrrlicht -lopengl32 -lm -ljthread
|
all_win32: LDFLAGS = -L$(IRRLICHTPATH)/lib/Win32-gcc -L$(JTHREADPATH)/Debug -lIrrlicht -lopengl32 -lm -ljthread
|
||||||
|
|
BIN
data/grass.png
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
data/skybox1.png
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 5.3 KiB |
BIN
data/stone.png
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 1.6 KiB |
|
@ -53,10 +53,14 @@ Compiling on GNU/Linux:
|
||||||
http://downloads.sourceforge.net/irrlicht/irrlicht-1.7.2.zip
|
http://downloads.sourceforge.net/irrlicht/irrlicht-1.7.2.zip
|
||||||
* JThread:
|
* JThread:
|
||||||
http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jthread
|
http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jthread
|
||||||
- Neither of which can probably be found from your distro's repository.
|
* zlib:
|
||||||
|
- Get the -dev package from your package manager.
|
||||||
|
- Irrlicht and JThread are very likely not to be found from your distro's
|
||||||
|
repository.
|
||||||
- Compiling each of them should be fairly unproblematic, though.
|
- Compiling each of them should be fairly unproblematic, though.
|
||||||
|
|
||||||
Compiling on Windows:
|
Compiling on Windows:
|
||||||
|
- You need Irrlicht, JThread and zlib, see above
|
||||||
- Be sure to
|
- Be sure to
|
||||||
#define JMUTEX_CRITICALSECTION
|
#define JMUTEX_CRITICALSECTION
|
||||||
in jmutex.h before compiling it. Otherwise mutexes will be very slow.
|
in jmutex.h before compiling it. Otherwise mutexes will be very slow.
|
||||||
|
@ -81,7 +85,6 @@ You should have received a copy of the GNU General Public License along
|
||||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
|
||||||
Irrlicht
|
Irrlicht
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#wanted_fps = 30
|
#wanted_fps = 30
|
||||||
#fps_max = 60
|
#fps_max = 60
|
||||||
#viewing_range_nodes_max = 300
|
#viewing_range_nodes_max = 300
|
||||||
#viewing_range_nodes_min = 20
|
#viewing_range_nodes_min = 50
|
||||||
#screenW =
|
#screenW =
|
||||||
#screenH =
|
#screenH =
|
||||||
#host_game =
|
#host_game =
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OmitFramePointers="true"
|
OmitFramePointers="true"
|
||||||
WholeProgramOptimization="true"
|
WholeProgramOptimization="true"
|
||||||
AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"..\jthread\jthread-1.2.1\src";"..\irrlicht\irrlicht-1.7.1\include""
|
AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"..\jthread\jthread-1.2.1\src";"..\irrlicht\irrlicht-1.7.1\include";"..\zlib\zlib-1.2.5""
|
||||||
PreprocessorDefinitions="WIN32;_HAS_ITERATOR_DEBUGGING=0,UNITTEST_DISABLE,_CRT_SECURE_NO_DEPRECATE"
|
PreprocessorDefinitions="WIN32;_HAS_ITERATOR_DEBUGGING=0,UNITTEST_DISABLE,_CRT_SECURE_NO_DEPRECATE"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalLibraryDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib";"..\jthread\jthread-1.2.1\Release";"..\irrlicht\irrlicht-1.7.1\lib\Win32-visualstudio""
|
AdditionalLibraryDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib";"..\jthread\jthread-1.2.1\Release";"..\irrlicht\irrlicht-1.7.1\lib\Win32-visualstudio";..\zlib125dll\dll32"
|
||||||
IgnoreDefaultLibraryNames="libcmtd.lib"
|
IgnoreDefaultLibraryNames="libcmtd.lib"
|
||||||
GenerateDebugInformation="false"
|
GenerateDebugInformation="false"
|
||||||
LinkTimeCodeGeneration="1"
|
LinkTimeCodeGeneration="1"
|
||||||
|
@ -222,6 +222,10 @@
|
||||||
RelativePath=".\src\mapblockobject.cpp"
|
RelativePath=".\src\mapblockobject.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\mapnode.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\mapsector.cpp"
|
RelativePath=".\src\mapsector.cpp"
|
||||||
>
|
>
|
||||||
|
@ -246,6 +250,10 @@
|
||||||
RelativePath=".\src\test.cpp"
|
RelativePath=".\src\test.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\tile.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\utility.cpp"
|
RelativePath=".\src\utility.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -59,9 +59,9 @@ private:
|
||||||
class MaterialItem : public InventoryItem
|
class MaterialItem : public InventoryItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MaterialItem(u8 material, u16 count)
|
MaterialItem(u8 content, u16 count)
|
||||||
{
|
{
|
||||||
m_material = material;
|
m_content = content;
|
||||||
m_count = count;
|
m_count = count;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -76,18 +76,26 @@ public:
|
||||||
//os.imbue(std::locale("C"));
|
//os.imbue(std::locale("C"));
|
||||||
os<<getName();
|
os<<getName();
|
||||||
os<<" ";
|
os<<" ";
|
||||||
os<<(unsigned int)m_material;
|
os<<(unsigned int)m_content;
|
||||||
os<<" ";
|
os<<" ";
|
||||||
os<<m_count;
|
os<<m_count;
|
||||||
}
|
}
|
||||||
virtual InventoryItem* clone()
|
virtual InventoryItem* clone()
|
||||||
{
|
{
|
||||||
return new MaterialItem(m_material, m_count);
|
return new MaterialItem(m_content, m_count);
|
||||||
}
|
}
|
||||||
video::ITexture * getImage()
|
video::ITexture * getImage()
|
||||||
{
|
{
|
||||||
u16 tile = content_tile(m_material, v3s16(1,0,0));
|
/*if(m_content == CONTENT_TORCH)
|
||||||
return g_tile_materials[tile].getTexture(0);
|
return g_texturecache.get("torch_on_floor");
|
||||||
|
|
||||||
|
u16 tile = content_tile(m_content, v3s16(1,0,0));
|
||||||
|
return g_tile_contents[tile].getTexture(0);*/
|
||||||
|
|
||||||
|
if(m_content >= USEFUL_CONTENT_COUNT)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return g_texturecache.get(g_content_inventory_textures[m_content]);
|
||||||
}
|
}
|
||||||
std::string getText()
|
std::string getText()
|
||||||
{
|
{
|
||||||
|
@ -100,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
u8 getMaterial()
|
u8 getMaterial()
|
||||||
{
|
{
|
||||||
return m_material;
|
return m_content;
|
||||||
}
|
}
|
||||||
u16 getCount()
|
u16 getCount()
|
||||||
{
|
{
|
||||||
|
@ -123,7 +131,7 @@ public:
|
||||||
m_count -= count;
|
m_count -= count;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
u8 m_material;
|
u8 m_content;
|
||||||
u16 m_count;
|
u16 m_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -219,6 +219,7 @@ TODO: A mapper to map contents to tile names (for each side)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(lib, "Irrlicht.lib")
|
#pragma comment(lib, "Irrlicht.lib")
|
||||||
#pragma comment(lib, "jthread.lib")
|
#pragma comment(lib, "jthread.lib")
|
||||||
|
#pragma comment(lib, "zlibwapi.lib")
|
||||||
// This would get rid of the console window
|
// This would get rid of the console window
|
||||||
//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
||||||
#endif
|
#endif
|
||||||
|
@ -310,7 +311,7 @@ void set_default_settings()
|
||||||
g_settings.set("wanted_fps", "30");
|
g_settings.set("wanted_fps", "30");
|
||||||
g_settings.set("fps_max", "60");
|
g_settings.set("fps_max", "60");
|
||||||
g_settings.set("viewing_range_nodes_max", "300");
|
g_settings.set("viewing_range_nodes_max", "300");
|
||||||
g_settings.set("viewing_range_nodes_min", "20");
|
g_settings.set("viewing_range_nodes_min", "50");
|
||||||
g_settings.set("screenW", "");
|
g_settings.set("screenW", "");
|
||||||
g_settings.set("screenH", "");
|
g_settings.set("screenH", "");
|
||||||
g_settings.set("host_game", "");
|
g_settings.set("host_game", "");
|
||||||
|
@ -1934,7 +1935,7 @@ int main(int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
Meta-objects
|
Meta-objects
|
||||||
*/
|
*/
|
||||||
if(n.d == CONTENT_LIGHT)
|
if(n.d == CONTENT_TORCH)
|
||||||
{
|
{
|
||||||
v3s16 dir = unpackDir(n.dir);
|
v3s16 dir = unpackDir(n.dir);
|
||||||
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
v3f dir_f = v3f(dir.X, dir.Y, dir.Z);
|
||||||
|
|
|
@ -1846,10 +1846,9 @@ MapBlock * ServerMap::emergeBlock(
|
||||||
|
|
||||||
//float min_slope = 0.45;
|
//float min_slope = 0.45;
|
||||||
//float max_slope = 0.85;
|
//float max_slope = 0.85;
|
||||||
float min_slope = 0.70;
|
float min_slope = 0.60;
|
||||||
float max_slope = 1.20;
|
float max_slope = 1.20;
|
||||||
float min_slope_depth = 4.0;
|
float min_slope_depth = 5.0;
|
||||||
//float min_slope_depth = 5.0;
|
|
||||||
float max_slope_depth = 0;
|
float max_slope_depth = 0;
|
||||||
if(slope < min_slope)
|
if(slope < min_slope)
|
||||||
surface_depth = min_slope_depth;
|
surface_depth = min_slope_depth;
|
||||||
|
@ -2091,7 +2090,7 @@ MapBlock * ServerMap::emergeBlock(
|
||||||
p + v3s16(0,0,0), &changed_blocks_sector))
|
p + v3s16(0,0,0), &changed_blocks_sector))
|
||||||
{
|
{
|
||||||
MapNode n;
|
MapNode n;
|
||||||
n.d = CONTENT_LIGHT;
|
n.d = CONTENT_TORCH;
|
||||||
sector->setNode(p, n);
|
sector->setNode(p, n);
|
||||||
objects_to_remove.push_back(p);
|
objects_to_remove.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,7 +551,7 @@ void MapBlock::updateMesh()
|
||||||
|
|
||||||
MapNode &n = getNodeRef(x,y,z);
|
MapNode &n = getNodeRef(x,y,z);
|
||||||
|
|
||||||
if(n.d == CONTENT_LIGHT)
|
if(n.d == CONTENT_TORCH)
|
||||||
{
|
{
|
||||||
//scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
//scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::SMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
|
|
|
@ -68,7 +68,7 @@ enum Content
|
||||||
CONTENT_STONE,
|
CONTENT_STONE,
|
||||||
CONTENT_GRASS,
|
CONTENT_GRASS,
|
||||||
CONTENT_WATER,
|
CONTENT_WATER,
|
||||||
CONTENT_LIGHT,
|
CONTENT_TORCH,
|
||||||
CONTENT_TREE,
|
CONTENT_TREE,
|
||||||
CONTENT_LEAVES,
|
CONTENT_LEAVES,
|
||||||
CONTENT_GRASS_FOOTSTEPS,
|
CONTENT_GRASS_FOOTSTEPS,
|
||||||
|
@ -81,6 +81,7 @@ enum Content
|
||||||
};
|
};
|
||||||
|
|
||||||
extern u16 g_content_tiles[USEFUL_CONTENT_COUNT][6];
|
extern u16 g_content_tiles[USEFUL_CONTENT_COUNT][6];
|
||||||
|
extern const char * g_content_inventory_textures[USEFUL_CONTENT_COUNT];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If true, the material allows light propagation and brightness is stored
|
If true, the material allows light propagation and brightness is stored
|
||||||
|
@ -88,7 +89,7 @@ extern u16 g_content_tiles[USEFUL_CONTENT_COUNT][6];
|
||||||
*/
|
*/
|
||||||
inline bool light_propagates_content(u8 m)
|
inline bool light_propagates_content(u8 m)
|
||||||
{
|
{
|
||||||
return (m == CONTENT_AIR || m == CONTENT_LIGHT || m == CONTENT_WATER || m == CONTENT_OCEAN);
|
return (m == CONTENT_AIR || m == CONTENT_TORCH || m == CONTENT_WATER || m == CONTENT_OCEAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -96,7 +97,7 @@ inline bool light_propagates_content(u8 m)
|
||||||
*/
|
*/
|
||||||
inline bool sunlight_propagates_content(u8 m)
|
inline bool sunlight_propagates_content(u8 m)
|
||||||
{
|
{
|
||||||
return (m == CONTENT_AIR || m == CONTENT_LIGHT);
|
return (m == CONTENT_AIR || m == CONTENT_TORCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -108,7 +109,8 @@ inline bool sunlight_propagates_content(u8 m)
|
||||||
*/
|
*/
|
||||||
inline u8 content_solidness(u8 m)
|
inline u8 content_solidness(u8 m)
|
||||||
{
|
{
|
||||||
if(m == CONTENT_AIR)
|
// As of now, every pseudo node like torches are added to this
|
||||||
|
if(m == CONTENT_AIR || m == CONTENT_TORCH)
|
||||||
return 0;
|
return 0;
|
||||||
if(m == CONTENT_WATER || m == CONTENT_OCEAN)
|
if(m == CONTENT_WATER || m == CONTENT_OCEAN)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -118,7 +120,7 @@ inline u8 content_solidness(u8 m)
|
||||||
// Objects collide with walkable contents
|
// Objects collide with walkable contents
|
||||||
inline bool content_walkable(u8 m)
|
inline bool content_walkable(u8 m)
|
||||||
{
|
{
|
||||||
return (m != CONTENT_AIR && m != CONTENT_WATER && m != CONTENT_OCEAN && m != CONTENT_LIGHT);
|
return (m != CONTENT_AIR && m != CONTENT_WATER && m != CONTENT_OCEAN && m != CONTENT_TORCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A liquid resists fast movement
|
// A liquid resists fast movement
|
||||||
|
@ -158,6 +160,13 @@ inline bool is_ground_content(u8 m)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*inline bool content_has_faces(u8 c)
|
||||||
|
{
|
||||||
|
return (m != CONTENT_IGNORE
|
||||||
|
&& m != CONTENT_AIR
|
||||||
|
&& m != CONTENT_TORCH);
|
||||||
|
}*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Nodes make a face if contents differ and solidness differs.
|
Nodes make a face if contents differ and solidness differs.
|
||||||
Return value:
|
Return value:
|
||||||
|
@ -185,7 +194,7 @@ inline u8 face_contents(u8 m1, u8 m2)
|
||||||
|
|
||||||
inline bool liquid_replaces_content(u8 c)
|
inline bool liquid_replaces_content(u8 c)
|
||||||
{
|
{
|
||||||
return (c == CONTENT_AIR || c == CONTENT_LIGHT);
|
return (c == CONTENT_AIR || c == CONTENT_TORCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -193,7 +202,7 @@ inline bool liquid_replaces_content(u8 c)
|
||||||
*/
|
*/
|
||||||
inline bool content_directional(u8 c)
|
inline bool content_directional(u8 c)
|
||||||
{
|
{
|
||||||
return (c == CONTENT_LIGHT);
|
return (c == CONTENT_TORCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -336,7 +345,7 @@ struct MapNode
|
||||||
/*
|
/*
|
||||||
Note that a block that isn't light_propagates() can be a light source.
|
Note that a block that isn't light_propagates() can be a light source.
|
||||||
*/
|
*/
|
||||||
if(d == CONTENT_LIGHT)
|
if(d == CONTENT_TORCH)
|
||||||
return LIGHT_MAX;
|
return LIGHT_MAX;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -19,6 +19,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "serialization.h"
|
#include "serialization.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define ZLIB_WINAPI
|
||||||
|
#endif
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
/* report a zlib or i/o error */
|
/* report a zlib or i/o error */
|
||||||
|
|
|
@ -1011,6 +1011,13 @@ void Server::AsyncRunStep()
|
||||||
Flow water
|
Flow water
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
float interval;
|
||||||
|
|
||||||
|
if(g_settings.getBool("endless_water") == false)
|
||||||
|
interval = 1.0;
|
||||||
|
else
|
||||||
|
interval = 0.25;
|
||||||
|
|
||||||
static float counter = 0.0;
|
static float counter = 0.0;
|
||||||
counter += dtime;
|
counter += dtime;
|
||||||
if(counter >= 0.25 && m_flow_active_nodes.size() > 0)
|
if(counter >= 0.25 && m_flow_active_nodes.size() > 0)
|
||||||
|
@ -1028,7 +1035,10 @@ void Server::AsyncRunStep()
|
||||||
v.m_disable_water_climb =
|
v.m_disable_water_climb =
|
||||||
g_settings.getBool("disable_water_climb");
|
g_settings.getBool("disable_water_climb");
|
||||||
|
|
||||||
v.flowWater(m_flow_active_nodes, 0, false, 50);
|
if(g_settings.getBool("endless_water") == false)
|
||||||
|
v.flowWater(m_flow_active_nodes, 0, false, 250);
|
||||||
|
else
|
||||||
|
v.flowWater(m_flow_active_nodes, 0, false, 50);
|
||||||
|
|
||||||
v.blitBack(modified_blocks);
|
v.blitBack(modified_blocks);
|
||||||
|
|
||||||
|
@ -1883,8 +1893,8 @@ void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver)
|
||||||
writeS16(&reply[6], p.Z);
|
writeS16(&reply[6], p.Z);
|
||||||
memcpy(&reply[8], *blockdata, blockdata.getSize());
|
memcpy(&reply[8], *blockdata, blockdata.getSize());
|
||||||
|
|
||||||
dstream<<"Sending block ("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
/*dstream<<"Sending block ("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
||||||
<<": \tpacket size: "<<replysize<<std::endl;
|
<<": \tpacket size: "<<replysize<<std::endl;*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Send packet
|
Send packet
|
||||||
|
|