Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Firelike Drawtype #1658

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+663 −364
Diff settings

Always

Just for now

@@ -422,6 +422,7 @@ Look for examples in games/minimal or games/minetest_game.
- torchlike
- signlike
- plantlike
- firelike
- fencelike
- raillike
- nodebox -- See below. EXPERIMENTAL
@@ -157,9 +157,13 @@
#sound_volume = 0.7
# Whether node texture animations should be desynchronized per MapBlock
#desynchronize_mapblock_texture_animation = true
# (useful if you've there's something to be displayed right or left of hotbar)
# Width of the selectionbox's lines (Between 1 and 5)
#selectionbox_width = 2
# maximum percentage of current window to be used for hotbar
# (usefull if you've there's something to be displayed right or left of hotbar)
#hud_hotbar_max_width = 1.0
# Enable highlighting for nodes (disables selectionboxes)
#enable_node_highlighting = false
# Texture filtering settings
#mip_map = false
#anisotropic_filter = false
@@ -2475,6 +2475,15 @@ int Client::getCrackLevel()
return m_crack_level;
}

void Client::setHighlighted(v3s16 pos, bool show_hud)
{
m_show_hud = show_hud;
v3s16 old_highlighted_pos = m_highlighted_pos;
m_highlighted_pos = pos;
addUpdateMeshTaskForNode(old_highlighted_pos, false, true);
addUpdateMeshTaskForNode(m_highlighted_pos, false, true);
}

void Client::setCrack(int level, v3s16 pos)
{
int old_crack_level = m_crack_level;
@@ -2547,22 +2556,23 @@ void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent)
MapBlock *b = m_env.getMap().getBlockNoCreateNoEx(p);
if(b == NULL)
return;

/*
Create a task to update the mesh of the block
*/

MeshMakeData *data = new MeshMakeData(this);

{
//TimeTaker timer("data fill");
// Release: ~0ms
// Debug: 1-6ms, avg=2ms
data->fill(b);
data->setCrack(m_crack_level, m_crack_pos);
data->setHighlighted(m_highlighted_pos, m_show_hud);
data->setSmoothLighting(g_settings->getBool("smooth_lighting"));
}

// Add task to queue
m_mesh_update_thread.m_queue_in.addBlock(p, data, ack_to_server, urgent);
}
@@ -395,6 +395,9 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
int getCrackLevel();
void setCrack(int level, v3s16 pos);

void setHighlighted(v3s16 pos, bool show_hud);
v3s16 getHighlighted(){ return m_highlighted_pos; }

u16 getHP();
u16 getBreath();

@@ -500,10 +503,12 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
float m_inventory_from_server_age;
std::set<v3s16> m_active_blocks;
PacketCounter m_packetcounter;
bool m_show_hud;
// Block mesh animation parameters
float m_animation_time;
int m_crack_level;
v3s16 m_crack_pos;
v3s16 m_highlighted_pos;
// 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
//s32 m_daynight_i;
//u32 m_daynight_ratio;
@@ -140,17 +140,17 @@ void ClientMediaDownloader::step(Client *client)
// Remote media: check for completion of fetches
if (m_httpfetch_active) {
bool fetched_something = false;
HTTPFetchResult fetchresult;
HTTPFetchResult fetch_result;

while (httpfetch_async_get(m_httpfetch_caller, fetchresult)) {
while (httpfetch_async_get(m_httpfetch_caller, fetch_result)) {
m_httpfetch_active--;
fetched_something = true;

// Is this a hashset (index.mth) or a media file?
if (fetchresult.request_id < m_remotes.size())
remoteHashSetReceived(fetchresult);
if (fetch_result.request_id < m_remotes.size())
remoteHashSetReceived(fetch_result);
else
remoteMediaReceived(fetchresult, client);
remoteMediaReceived(fetch_result, client);
}

if (fetched_something)
@@ -259,17 +259,17 @@ void ClientMediaDownloader::initialStep(Client *client)
actionstream << "Client: Contacting remote server \""
<< remote->baseurl << "\"" << std::endl;

HTTPFetchRequest fetchrequest;
fetchrequest.url =
HTTPFetchRequest fetch_request;
fetch_request.url =
remote->baseurl + MTHASHSET_FILE_NAME;
fetchrequest.caller = m_httpfetch_caller;
fetchrequest.request_id = m_httpfetch_next_id; // == i
fetchrequest.timeout = m_httpfetch_timeout;
fetchrequest.connect_timeout = m_httpfetch_timeout;
fetchrequest.post_data = required_hash_set;
fetchrequest.extra_headers.push_back(
fetch_request.caller = m_httpfetch_caller;
fetch_request.request_id = m_httpfetch_next_id; // == i
fetch_request.timeout = m_httpfetch_timeout;
fetch_request.connect_timeout = m_httpfetch_timeout;
fetch_request.post_data = required_hash_set;
fetch_request.extra_headers.push_back(
"Content-Type: application/octet-stream");
httpfetch_async(fetchrequest);
httpfetch_async(fetch_request);

m_httpfetch_active++;
m_httpfetch_next_id++;
@@ -279,21 +279,21 @@ void ClientMediaDownloader::initialStep(Client *client)
}

void ClientMediaDownloader::remoteHashSetReceived(
const HTTPFetchResult &fetchresult)
const HTTPFetchResult &fetch_result)
{
u32 remote_id = fetchresult.request_id;
u32 remote_id = fetch_result.request_id;
assert(remote_id < m_remotes.size());
RemoteServerStatus *remote = m_remotes[remote_id];

m_outstanding_hash_sets--;

if (fetchresult.succeeded) {
if (fetch_result.succeeded) {
try {
// Server sent a list of file hashes that are
// available on it, try to parse the list

std::set<std::string> sha1_set;
deSerializeHashSet(fetchresult.data, sha1_set);
deSerializeHashSet(fetch_result.data, sha1_set);

// Parsing succeeded: For every file that is
// available on this server, add this server
@@ -320,7 +320,7 @@ void ClientMediaDownloader::remoteHashSetReceived(
// Do NOT check for any particular response code (e.g. 404) here,
// because different servers respond differently

if (!fetchresult.succeeded && !fetchresult.timeout) {
if (!fetch_result.succeeded && !fetch_result.timeout) {
infostream << "Client: Enabling compatibility mode for remote "
<< "server \"" << remote->baseurl << "\"" << std::endl;
remote->request_by_filename = true;
@@ -338,7 +338,7 @@ void ClientMediaDownloader::remoteHashSetReceived(
}

void ClientMediaDownloader::remoteMediaReceived(
const HTTPFetchResult &fetchresult,
const HTTPFetchResult &fetch_result,
Client *client)
{
// Some remote server sent us a file.
@@ -349,7 +349,7 @@ void ClientMediaDownloader::remoteMediaReceived(
std::string name;
{
std::map<unsigned long, std::string>::iterator it =
m_remote_file_transfers.find(fetchresult.request_id);
m_remote_file_transfers.find(fetch_result.request_id);
assert(it != m_remote_file_transfers.end());
name = it->second;
m_remote_file_transfers.erase(it);
@@ -368,9 +368,9 @@ void ClientMediaDownloader::remoteMediaReceived(

// If fetch succeeded, try to load media file

if (fetchresult.succeeded) {
if (fetch_result.succeeded) {
bool success = checkAndLoad(name, filestatus->sha1,
fetchresult.data, false, client);
fetch_result.data, false, client);
if (success) {
filestatus->received = true;
assert(m_uncached_received_count < m_uncached_count);
@@ -445,14 +445,14 @@ void ClientMediaDownloader::startRemoteMediaTransfers()
<< "\"" << name << "\" "
<< "\"" << url << "\"" << std::endl;

HTTPFetchRequest fetchrequest;
fetchrequest.url = url;
fetchrequest.caller = m_httpfetch_caller;
fetchrequest.request_id = m_httpfetch_next_id;
fetchrequest.timeout = 0; // no data timeout!
fetchrequest.connect_timeout =
HTTPFetchRequest fetch_request;
fetch_request.url = url;
fetch_request.caller = m_httpfetch_caller;
fetch_request.request_id = m_httpfetch_next_id;
fetch_request.timeout = 0; // no data timeout!
fetch_request.connect_timeout =
m_httpfetch_timeout;
httpfetch_async(fetchrequest);
httpfetch_async(fetch_request);

m_remote_file_transfers.insert(std::make_pair(
m_httpfetch_next_id,
@@ -96,8 +96,8 @@ class ClientMediaDownloader
};

void initialStep(Client *client);
void remoteHashSetReceived(const HTTPFetchResult &fetchresult);
void remoteMediaReceived(const HTTPFetchResult &fetchresult,
void remoteHashSetReceived(const HTTPFetchResult &fetch_result);
void remoteMediaReceived(const HTTPFetchResult &fetch_result,
Client *client);
s32 selectRemoteServer(FileStatus *filestatus);
void startRemoteMediaTransfers();
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.