[c12536] Happy New Year 2013

Update authorship information and prepare for easier ways next year

Signed-off-by: Schmoozerd <schmoozerd@cmangos>

(based on commit [12325] - b7dbcda)
This commit is contained in:
Schmoozerd 2013-03-03 17:39:21 +02:00 committed by Antz
parent 86a243c910
commit a05738717a
542 changed files with 3274 additions and 1846 deletions

24
AUTHORS
View file

@ -1,9 +1,17 @@
SPECIAL THANKS TO THE MAIN CONTRIBUTORS OF THE MaNGOS PROJECT (LISTED BELOW) This file contains authorship information related to the Continued-MaNGOS Project
Julius "h" Kivimaki The code of C-MaNGOS is shipped as it is without any form of warenty,
Ryan "I'm Sabu" Cleary and - except for third party libraries - licensed under the GPL 2.0,
Chris "Realm of Tearrrroorr" Metzen which you can read from the file "COPYING"
Jeffrey "Tigole" Kaplan
Rob "EnoYls" Pardo * The authors are assigned to by git commit authorship information,
Michael "Lamborghini" Morhaime listed within the git commit messages, or if forgotten before mentioned in the github comments related to a commit.
Bobby "I need a raise" Kotick
* The most recent history can be checked at https://github.com/cmangos/mangos-wotlk
* The older history (from svn times) is backed up and can be checked at https://github.com/cmangos/mangos-svn
* Initially the code for this project was written by Wow Daemon team.
The third party libraries have their own way of addressing authorship, and the authorship of commits importing/ updating
a third party library reflects who did the importing instead of who wrote the code within the commit.

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

2
NEWS
View file

@ -1,6 +1,6 @@
= MaNGOS -- History of visible changes = = MaNGOS -- History of visible changes =
Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> This file is part of the Continued-MaNGOS Project
See the COPYING file for copying conditions. See the COPYING file for copying conditions.

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
This small Python script is intended to help with the convertion This small Python script is intended to help with the convertion

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -52,9 +52,10 @@
#define NUM_REMOTES 2 #define NUM_REMOTES 2
#define NUM_DATABASES 3 #define NUM_DATABASES 3
char remotes[NUM_REMOTES][MAX_REMOTE] = { char remotes[NUM_REMOTES][MAX_REMOTE] =
"git@github.com:mangos/server.git", {
"git://github.com/mangos/server.git" // used for fetch if present "git@github.com:cmangos/mangos-cata.git",
"git://github.com/cmangos/mangos-cata.git" // used for fetch if present
}; };
char remote_branch[MAX_REMOTE] = "master"; char remote_branch[MAX_REMOTE] = "master";
@ -63,30 +64,46 @@ char rev_sql_file[MAX_PATH] = "src/shared/revision_sql.h";
char sql_update_dir[MAX_PATH] = "sql/updates"; char sql_update_dir[MAX_PATH] = "sql/updates";
char new_index_file[MAX_PATH] = ".git/git_id_index"; char new_index_file[MAX_PATH] = ".git/git_id_index";
char databases[NUM_DATABASES][MAX_DB] = { char databases[NUM_DATABASES][MAX_DB] =
{
"characters", "characters",
"mangos", "mangos",
"realmd" "realmd"
}; };
char db_version_table[NUM_DATABASES][MAX_DB] = { char db_version_table[NUM_DATABASES][MAX_DB] =
{
"character_db_version", "character_db_version",
"db_version", "db_version",
"realmd_db_version", "realmd_db_version",
}; };
char db_sql_file[NUM_DATABASES][MAX_PATH] = { char db_sql_file[NUM_DATABASES][MAX_PATH] =
{
"sql/characters.sql", "sql/characters.sql",
"sql/mangos.sql", "sql/mangos.sql",
"sql/realmd.sql" "sql/realmd.sql"
}; };
char db_sql_rev_field[NUM_DATABASES][MAX_PATH] = { char db_sql_rev_field[NUM_DATABASES][MAX_PATH] =
{
"REVISION_DB_CHARACTERS", "REVISION_DB_CHARACTERS",
"REVISION_DB_MANGOS", "REVISION_DB_MANGOS",
"REVISION_DB_REALMD" "REVISION_DB_REALMD"
}; };
bool db_sql_rev_parent[NUM_DATABASES] =
{
false,
false,
true
};
#define REV_PREFIX "c"
#define REV_SCAN REV_PREFIX "%d"
#define REV_PRINT REV_PREFIX "%04d"
#define REV_FORMAT "[" REV_PRINT "]"
bool allow_replace = false; bool allow_replace = false;
bool local = false; bool local = false;
bool do_fetch = false; bool do_fetch = false;
@ -97,8 +114,8 @@ bool generate_makefile = false; // not need for cmak
char origins[NUM_REMOTES][MAX_REMOTE]; char origins[NUM_REMOTES][MAX_REMOTE];
int rev; int rev;
int last_sql_rev[NUM_DATABASES] = {0,0,0}; int last_sql_rev[NUM_DATABASES] = {0, 0, 0};
int last_sql_nr[NUM_DATABASES] = {0,0,0}; int last_sql_nr[NUM_DATABASES] = {0, 0, 0};
char head_message[MAX_MSG]; char head_message[MAX_MSG];
char path_prefix[MAX_PATH] = ""; char path_prefix[MAX_PATH] = "";
@ -112,18 +129,18 @@ char new_index_cmd[MAX_CMD];
std::set<std::string> new_sql_updates; std::set<std::string> new_sql_updates;
FILE *cmd_pipe; FILE* cmd_pipe;
bool find_path() bool find_path()
{ {
printf("+ finding path\n"); printf("+ finding path\n");
char *ptr; char* ptr;
char cur_path[MAX_PATH]; char cur_path[MAX_PATH];
getcwd(cur_path, MAX_PATH); getcwd(cur_path, MAX_PATH);
size_t len = strlen(cur_path); size_t len = strlen(cur_path);
strncpy(base_path, cur_path, len+1); strncpy(base_path, cur_path, len + 1);
if(cur_path[len-1] == '/' || cur_path[len-1] == '\\') if (cur_path[len - 1] == '/' || cur_path[len - 1] == '\\')
{ {
// we're in root, don't bother // we're in root, don't bother
return false; return false;
@ -131,15 +148,15 @@ bool find_path()
// don't count the root // don't count the root
int count_fwd = 0, count_back = 0; int count_fwd = 0, count_back = 0;
for(ptr = cur_path-1; ptr = strchr(ptr+1, '/'); count_fwd++); for (ptr = cur_path - 1; ptr = strchr(ptr + 1, '/'); count_fwd++);
for(ptr = cur_path-1; ptr = strchr(ptr+1, '\\'); count_back++); for (ptr = cur_path - 1; ptr = strchr(ptr + 1, '\\'); count_back++);
int count = std::max(count_fwd, count_back); int count = std::max(count_fwd, count_back);
char path[MAX_PATH]; char path[MAX_PATH];
for(int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
snprintf(path, MAX_PATH, "%s.git", path_prefix); snprintf(path, MAX_PATH, "%s.git", path_prefix);
if(0 == chdir(path)) if (0 == chdir(path))
{ {
chdir(cur_path); chdir(cur_path);
return true; return true;
@ -147,11 +164,11 @@ bool find_path()
strncat(path_prefix, "../", MAX_PATH); strncat(path_prefix, "../", MAX_PATH);
ptr = strrchr(base_path, '\\'); ptr = strrchr(base_path, '\\');
if(ptr) *ptr = '\0'; if (ptr) *ptr = '\0';
else else
{ {
ptr = strrchr(base_path, '/'); ptr = strrchr(base_path, '/');
if(ptr) *ptr = '\0'; if (ptr) *ptr = '\0';
} }
} }
@ -161,17 +178,17 @@ bool find_path()
bool find_origin() bool find_origin()
{ {
printf("+ finding origin\n"); printf("+ finding origin\n");
if( (cmd_pipe = popen( "git remote -v", "r" )) == NULL ) if ((cmd_pipe = popen("git remote -v", "r")) == NULL)
return false; return false;
bool ret = false; bool ret = false;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
char name[256], remote[MAX_REMOTE]; char name[256], remote[MAX_REMOTE];
sscanf(buffer, "%s %s", name, remote); sscanf(buffer, "%s %s", name, remote);
for(int i = 0; i < NUM_REMOTES; i++) for (int i = 0; i < NUM_REMOTES; i++)
{ {
if(strcmp(remote, remotes[i]) == 0) if (strcmp(remote, remotes[i]) == 0)
{ {
strncpy(origins[i], name, MAX_REMOTE); strncpy(origins[i], name, MAX_REMOTE);
ret = true; ret = true;
@ -195,21 +212,21 @@ bool check_fwd()
{ {
printf("+ checking fast forward\n"); printf("+ checking fast forward\n");
snprintf(cmd, MAX_CMD, "git log -n 1 --pretty=\"format:%%H\" %s/%s", (origins[1][0] ? origins[1] : origins[0]), remote_branch); snprintf(cmd, MAX_CMD, "git log -n 1 --pretty=\"format:%%H\" %s/%s", (origins[1][0] ? origins[1] : origins[0]), remote_branch);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
if(!fgets(buffer, MAX_BUF, cmd_pipe)) return false; if (!fgets(buffer, MAX_BUF, cmd_pipe)) return false;
strncpy(origin_hash, buffer, MAX_HASH); strncpy(origin_hash, buffer, MAX_HASH);
pclose(cmd_pipe); pclose(cmd_pipe);
if( (cmd_pipe = popen( "git log --pretty=\"format:%H\"", "r" )) == NULL ) if ((cmd_pipe = popen("git log --pretty=\"format:%H\"", "r")) == NULL)
return false; return false;
bool found = false; bool found = false;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if(strncmp(origin_hash, buffer, MAX_BUF) == 0) if (strncmp(origin_hash, buffer, MAX_BUF) == 0)
{ {
found = true; found = true;
break; break;
@ -217,22 +234,24 @@ bool check_fwd()
} }
pclose(cmd_pipe); pclose(cmd_pipe);
if(!found) if (!found)
{ {
// with fetch you still get the latest rev, you just rebase afterwards and push // with fetch you still get the latest rev, you just rebase afterwards and push
// without it you may not get the right rev // without it you may not get the right rev
if(do_fetch) printf("WARNING: non-fastforward, use rebase!\n"); if (do_fetch) printf("WARNING: non-fastforward, use rebase!\n");
else { printf("ERROR: non-fastforward, use rebase!\n"); return false; } else { printf("ERROR: non-fastforward, use rebase!\n"); return false; }
} }
return true; return true;
} }
int get_rev(const char *from_msg) int get_rev(const char* from_msg)
{ {
// accept only the rev number format, not the sql update format // accept only the rev number format, not the sql update format
char nr_str[256]; char nr_str[256];
if(sscanf(from_msg, "[%[0123456789]]", nr_str) != 1) return 0; if (sscanf(from_msg, "[" REV_PREFIX "%[0123456789]]", nr_str) != 1) return 0;
if(from_msg[strlen(nr_str)+1] != ']') return 0; // ("[")+(REV_PREFIX)+("]")-1
if (from_msg[strlen(nr_str) + strlen(REV_PREFIX) + 2 - 1] != ']') return 0;
return atoi(nr_str); return atoi(nr_str);
} }
@ -240,26 +259,26 @@ bool find_rev()
{ {
printf("+ finding next revision number\n"); printf("+ finding next revision number\n");
// find the highest rev number on either of the remotes // find the highest rev number on either of the remotes
for(int i = 0; i < NUM_REMOTES; i++) for (int i = 0; i < NUM_REMOTES; i++)
{ {
if(!local && !origins[i][0]) continue; if (!local && !origins[i][0]) continue;
if(local) snprintf(cmd, MAX_CMD, "git log HEAD --pretty=\"format:%%s\""); if (local) snprintf(cmd, MAX_CMD, "git log HEAD --pretty=\"format:%%s\"");
else sprintf(cmd, "git log %s/%s --pretty=\"format:%%s\"", origins[i], remote_branch); else sprintf(cmd, "git log %s/%s --pretty=\"format:%%s\"", origins[i], remote_branch);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
continue; continue;
int nr; int nr;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
nr = get_rev(buffer); nr = get_rev(buffer);
if(nr >= rev) if (nr >= rev)
rev = nr+1; rev = nr + 1;
} }
pclose(cmd_pipe); pclose(cmd_pipe);
} }
if(rev > 0) printf("Found [%d].\n", rev); if (rev > 0) printf("Found " REV_FORMAT ".\n", rev);
return rev > 0; return rev > 0;
} }
@ -279,38 +298,40 @@ std::string generateSqlHeader()
std::ostringstream newData; std::ostringstream newData;
newData << "#ifndef __REVISION_SQL_H__" << std::endl; newData << "#ifndef __REVISION_SQL_H__" << std::endl;
newData << "#define __REVISION_SQL_H__" << std::endl; newData << "#define __REVISION_SQL_H__" << std::endl;
for(int i = 0; i < NUM_DATABASES; ++i) for (int i = 0; i < NUM_DATABASES; ++i)
{
newData << " #define " << db_sql_rev_field[i] << " \"required_" << last_sql_update[i] << "\"" << std::endl; newData << " #define " << db_sql_rev_field[i] << " \"required_" << last_sql_update[i] << "\"" << std::endl;
}
newData << "#endif // __REVISION_SQL_H__" << std::endl; newData << "#endif // __REVISION_SQL_H__" << std::endl;
return newData.str(); return newData.str();
} }
void system_switch_index(const char *cmd) void system_switch_index(const char* cmd)
{ {
// do the command for the original index and then for the new index // do the command for the original index and then for the new index
// both need to be updated with the changes before commit // both need to be updated with the changes before commit
// but the new index will contains only the desired changes // but the new index will contains only the desired changes
// while the old may contain others // while the old may contain others
system(cmd); system(cmd);
if(!use_new_index) return; if (!use_new_index) return;
if(putenv(new_index_cmd) != 0) return; if (putenv(new_index_cmd) != 0) return;
system(cmd); system(cmd);
if(putenv(old_index_cmd) != 0) return; if (putenv(old_index_cmd) != 0) return;
} }
bool write_rev_nr() bool write_rev_nr()
{ {
printf("+ writing revision_nr.h\n"); printf("+ writing revision_nr.h\n");
char rev_str[256]; char rev_str[256];
sprintf(rev_str, "%d", rev); sprintf(rev_str, "%04d", rev);
std::string header = generateNrHeader(rev_str); std::string header = generateNrHeader(rev_str);
char prefixed_file[MAX_PATH]; char prefixed_file[MAX_PATH];
snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_nr_file); snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_nr_file);
if(FILE* OutputFile = fopen(prefixed_file, "wb")) if (FILE* OutputFile = fopen(prefixed_file, "wb"))
{ {
fprintf(OutputFile,"%s", header.c_str()); fprintf(OutputFile, "%s", header.c_str());
fclose(OutputFile); fclose(OutputFile);
// add the file to both indices, to be committed later // add the file to both indices, to be committed later
@ -325,16 +346,16 @@ bool write_rev_nr()
bool write_rev_sql() bool write_rev_sql()
{ {
if(new_sql_updates.empty()) return true; if (new_sql_updates.empty()) return true;
printf("+ writing revision_sql.h\n"); printf("+ writing revision_sql.h\n");
std::string header = generateSqlHeader(); std::string header = generateSqlHeader();
char prefixed_file[MAX_PATH]; char prefixed_file[MAX_PATH];
snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_sql_file); snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_sql_file);
if(FILE* OutputFile = fopen(prefixed_file, "wb")) if (FILE* OutputFile = fopen(prefixed_file, "wb"))
{ {
fprintf(OutputFile,"%s", header.c_str()); fprintf(OutputFile, "%s", header.c_str());
fclose(OutputFile); fclose(OutputFile);
// add the file to both indices, to be committed later // add the file to both indices, to be committed later
@ -350,28 +371,28 @@ bool write_rev_sql()
bool find_head_msg() bool find_head_msg()
{ {
printf("+ finding last message on HEAD\n"); printf("+ finding last message on HEAD\n");
if( (cmd_pipe = popen( "git log -n 1 --pretty=\"format:%s%n%n%b\"", "r" )) == NULL ) if ((cmd_pipe = popen("git log -n 1 --pretty=\"format:%s%n%n%b\"", "r")) == NULL)
return false; return false;
int poz = 0; int poz = 0;
while(poz < 16384-1 && EOF != (head_message[poz++] = fgetc(cmd_pipe))); while (poz < 16384 - 1 && EOF != (head_message[poz++] = fgetc(cmd_pipe)));
head_message[poz-1] = '\0'; head_message[poz - 1] = '\0';
pclose(cmd_pipe); pclose(cmd_pipe);
if(int head_rev = get_rev(head_message)) if (int head_rev = get_rev(head_message))
{ {
if(!allow_replace) if (!allow_replace)
{ {
printf("Last commit on HEAD is [%d]. Use -r to replace it with [%d].\n", head_rev, rev); printf("Last commit on HEAD is " REV_FORMAT ". Use -r to replace it with " REV_FORMAT ".\n", head_rev, rev);
return false; return false;
} }
// skip the rev number in the commit // skip the rev number in the commit
char *p = strchr(head_message, ']'), *q = head_message; char* p = strchr(head_message, ']'), *q = head_message;
assert(p && *(p+1)); assert(p && *(p + 1));
p+=2; p += 2;
while(*p) *q = *p, p++, q++; while (*p) *q = *p, p++, q++;
*q = 0; *q = 0;
return true; return true;
} }
@ -384,14 +405,14 @@ bool amend_commit()
printf("+ amending last commit\n"); printf("+ amending last commit\n");
// commit the contents of the (new) index // commit the contents of the (new) index
if(use_new_index && putenv(new_index_cmd) != 0) return false; if (use_new_index && putenv(new_index_cmd) != 0) return false;
snprintf(cmd, MAX_CMD, "git commit --amend -F-"); snprintf(cmd, MAX_CMD, "git commit --amend -F-");
if( (cmd_pipe = popen( cmd, "w" )) == NULL ) if ((cmd_pipe = popen(cmd, "w")) == NULL)
return false; return false;
fprintf(cmd_pipe, "[%d] %s", rev, head_message); fprintf(cmd_pipe, REV_FORMAT " %s", rev, head_message);
pclose(cmd_pipe); pclose(cmd_pipe);
if(use_new_index && putenv(old_index_cmd) != 0) return false; if (use_new_index && putenv(old_index_cmd) != 0) return false;
return true; return true;
} }
@ -399,6 +420,7 @@ bool amend_commit()
struct sql_update_info struct sql_update_info
{ {
int rev; int rev;
char parentRev[MAX_BUF];
int nr; int nr;
int db_idx; int db_idx;
char db[MAX_BUF]; char db[MAX_BUF];
@ -406,24 +428,24 @@ struct sql_update_info
bool has_table; bool has_table;
}; };
bool get_sql_update_info(const char *buffer, sql_update_info &info) bool get_sql_update_info(const char* buffer, sql_update_info& info)
{ {
info.table[0] = '\0'; info.table[0] = '\0';
int dummy[3]; int dummy[3];
if(sscanf(buffer, "%d_%d_%d", &dummy[0], &dummy[1], &dummy[2]) == 3) if (sscanf(buffer, REV_SCAN "_%[^_]_%d_%d", &dummy[0], &dummy[1], &dummy[2]) == 3)
return false; return false;
if(sscanf(buffer, "%d_%d_%[^_]_%[^.].sql", &info.rev, &info.nr, info.db, info.table) != 4 && if (sscanf(buffer, REV_SCAN "_%[^_]_%d_%[^_]_%[^.].sql", &info.rev, &info.nr, info.db, info.table) != 4 &&
sscanf(buffer, "%d_%d_%[^.].sql", &info.rev, &info.nr, info.db) != 3) sscanf(buffer, REV_SCAN "_%[^_]_%d_%[^.].sql", &info.rev, &info.nr, info.db) != 3)
{ {
info.rev = 0; // this may be set by the first scans, even if they fail info.rev = 0; // this may be set by the first scans, even if they fail
if(sscanf(buffer, "%d_%[^_]_%[^.].sql", &info.nr, info.db, info.table) != 3 && if (sscanf(buffer, "%d_%[^_]_%[^.].sql", &info.nr, info.db, info.table) != 3 &&
sscanf(buffer, "%d_%[^.].sql", &info.nr, info.db) != 2) sscanf(buffer, "%d_%[^.].sql", &info.nr, info.db) != 2)
return false; return false;
} }
for(info.db_idx = 0; info.db_idx < NUM_DATABASES; info.db_idx++) for (info.db_idx = 0; info.db_idx < NUM_DATABASES; info.db_idx++)
if(strncmp(info.db, databases[info.db_idx], MAX_DB) == 0) break; if (strncmp(info.db, databases[info.db_idx], MAX_DB) == 0) break;
info.has_table = (info.table[0] != '\0'); info.has_table = (info.table[0] != '\0');
return true; return true;
} }
@ -433,24 +455,24 @@ bool find_sql_updates()
printf("+ finding new sql updates on HEAD\n"); printf("+ finding new sql updates on HEAD\n");
// add all updates from HEAD // add all updates from HEAD
snprintf(cmd, MAX_CMD, "git show HEAD:%s", sql_update_dir); snprintf(cmd, MAX_CMD, "git show HEAD:%s", sql_update_dir);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
// skip first two lines // skip first two lines
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
sql_update_info info; sql_update_info info;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if(!get_sql_update_info(buffer, info)) continue; if (!get_sql_update_info(buffer, info)) continue;
if(info.db_idx == NUM_DATABASES) if (info.db_idx == NUM_DATABASES)
{ {
if(info.rev > 0) printf("WARNING: incorrect database name for sql update %s\n", buffer); if (info.rev > 0) printf("WARNING: incorrect database name for sql update %s\n", buffer);
continue; continue;
} }
new_sql_updates.insert(buffer); new_sql_updates.insert(buffer);
@ -458,27 +480,35 @@ bool find_sql_updates()
pclose(cmd_pipe); pclose(cmd_pipe);
// Add last milestone's file information
last_sql_rev[0] = 12300;
last_sql_nr[0] = 2;
sscanf("12300_02_characters_mail", "%s", last_sql_update[0]);
last_sql_rev[2] = 12112;
last_sql_nr[2] = 1;
sscanf("12112_01_realmd_account_access", "%s", last_sql_update[2]);
// remove updates from the last commit also found on origin // remove updates from the last commit also found on origin
snprintf(cmd, MAX_CMD, "git show %s:%s", origin_hash, sql_update_dir); snprintf(cmd, MAX_CMD, "git show %s:%s", origin_hash, sql_update_dir);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
// skip first two lines // skip first two lines
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if(!get_sql_update_info(buffer, info)) continue; if (!get_sql_update_info(buffer, info)) continue;
// find the old update with the highest rev for each database // find the old update with the highest rev for each database
// (will be the required version for the new update) // (will be the required version for the new update)
std::set<std::string>::iterator itr = new_sql_updates.find(buffer); std::set<std::string>::iterator itr = new_sql_updates.find(buffer);
if(itr != new_sql_updates.end() ) if (itr != new_sql_updates.end())
{ {
if(info.rev > 0 && (info.rev > last_sql_rev[info.db_idx] || if (info.rev > 0 && (info.rev > last_sql_rev[info.db_idx] ||
(info.rev == last_sql_rev[info.db_idx] && info.nr > last_sql_nr[info.db_idx]))) (info.rev == last_sql_rev[info.db_idx] && info.nr > last_sql_nr[info.db_idx])))
{ {
last_sql_rev[info.db_idx] = info.rev; last_sql_rev[info.db_idx] = info.rev;
last_sql_nr[info.db_idx] = info.nr; last_sql_nr[info.db_idx] = info.nr;
@ -490,9 +520,9 @@ bool find_sql_updates()
pclose(cmd_pipe); pclose(cmd_pipe);
if(!new_sql_updates.empty()) if (!new_sql_updates.empty())
{ {
for(std::set<std::string>::iterator itr = new_sql_updates.begin(); itr != new_sql_updates.end(); ++itr) for (std::set<std::string>::iterator itr = new_sql_updates.begin(); itr != new_sql_updates.end(); ++itr)
printf("%s\n", itr->c_str()); printf("%s\n", itr->c_str());
} }
else else
@ -501,14 +531,14 @@ bool find_sql_updates()
return true; return true;
} }
bool copy_file(const char *src_file, const char *dst_file) bool copy_file(const char* src_file, const char* dst_file)
{ {
FILE * fin = fopen( src_file, "rb" ); FILE* fin = fopen(src_file, "rb");
if(!fin) return false; if (!fin) return false;
FILE * fout = fopen( dst_file, "wb" ); FILE* fout = fopen(dst_file, "wb");
if(!fout) { fclose(fin); return false; } if (!fout) { fclose(fin); return false; }
for(char c = getc(fin); !feof(fin); putc(c, fout), c = getc(fin)); for (char c = getc(fin); !feof(fin); putc(c, fout), c = getc(fin));
fclose(fin); fclose(fin);
fclose(fout); fclose(fout);
@ -517,16 +547,16 @@ bool copy_file(const char *src_file, const char *dst_file)
bool convert_sql_updates() bool convert_sql_updates()
{ {
if(new_sql_updates.empty()) return true; if (new_sql_updates.empty()) return true;
printf("+ converting sql updates\n"); printf("+ converting sql updates\n");
// rename the sql update files and add the required update statement // rename the sql update files and add the required update statement
for(std::set<std::string>::iterator itr = new_sql_updates.begin(); itr != new_sql_updates.end(); ++itr) for (std::set<std::string>::iterator itr = new_sql_updates.begin(); itr != new_sql_updates.end(); ++itr)
{ {
sql_update_info info; sql_update_info info;
if(!get_sql_update_info(itr->c_str(), info)) return false; if (!get_sql_update_info(itr->c_str(), info)) return false;
if(info.db_idx == NUM_DATABASES) return false; if (info.db_idx == NUM_DATABASES) return false;
// generating the new name should work for updates with or without a rev // generating the new name should work for updates with or without a rev
char src_file[MAX_PATH], new_name[MAX_PATH], dst_file[MAX_PATH]; char src_file[MAX_PATH], new_name[MAX_PATH], dst_file[MAX_PATH];
@ -534,8 +564,8 @@ bool convert_sql_updates()
snprintf(new_name, MAX_PATH, "%d_%0*d_%s%s%s", rev, 2, info.nr, info.db, info.has_table ? "_" : "", info.table); snprintf(new_name, MAX_PATH, "%d_%0*d_%s%s%s", rev, 2, info.nr, info.db, info.has_table ? "_" : "", info.table);
snprintf(dst_file, MAX_PATH, "%s%s/%s.sql", path_prefix, sql_update_dir, new_name); snprintf(dst_file, MAX_PATH, "%s%s/%s.sql", path_prefix, sql_update_dir, new_name);
FILE * fin = fopen( src_file, "r" ); FILE* fin = fopen(src_file, "r");
if(!fin) return false; if (!fin) return false;
std::ostringstream out_buff; std::ostringstream out_buff;
@ -546,12 +576,12 @@ bool convert_sql_updates()
// skip the first one or two lines from the input // skip the first one or two lines from the input
// if it already contains update requirements // if it already contains update requirements
if(fgets(buffer, MAX_BUF, fin)) if (fgets(buffer, MAX_BUF, fin))
{ {
char dummy[MAX_BUF]; char dummy[MAX_BUF];
if(sscanf(buffer, "ALTER TABLE %s CHANGE COLUMN required_%s required_%s bit", dummy, dummy, dummy) == 3) if (sscanf(buffer, "ALTER TABLE %s CHANGE COLUMN required_%s required_%s bit", dummy, dummy, dummy) == 3)
{ {
if(fgets(buffer, MAX_BUF, fin) && buffer[0] != '\n') if (fgets(buffer, MAX_BUF, fin) && buffer[0] != '\n')
out_buff << buffer; out_buff << buffer;
} }
else else
@ -559,15 +589,15 @@ bool convert_sql_updates()
} }
// copy the rest of the file // copy the rest of the file
while(fgets(buffer, MAX_BUF, fin)) while (fgets(buffer, MAX_BUF, fin))
out_buff << buffer; out_buff << buffer;
fclose(fin); fclose(fin);
FILE * fout = fopen( dst_file, "w" ); FILE* fout = fopen(dst_file, "w");
if(!fout) { fclose(fin); return false; } if (!fout) { fclose(fin); return false; }
fprintf(fout, "%s",out_buff.str().c_str()); fprintf(fout, "%s", out_buff.str().c_str());
fclose(fout); fclose(fout);
@ -576,7 +606,7 @@ bool convert_sql_updates()
system_switch_index(cmd); system_switch_index(cmd);
// delete src file if it different by name from dst file // delete src file if it different by name from dst file
if(strncmp(src_file,dst_file,MAX_PATH)) if (strncmp(src_file, dst_file, MAX_PATH))
{ {
snprintf(cmd, MAX_CMD, "git rm --quiet %s", src_file); snprintf(cmd, MAX_CMD, "git rm --quiet %s", src_file);
system_switch_index(cmd); system_switch_index(cmd);
@ -591,30 +621,30 @@ bool convert_sql_updates()
bool generate_sql_makefile() bool generate_sql_makefile()
{ {
if(new_sql_updates.empty()) return true; if (new_sql_updates.empty()) return true;
// find all files in the update dir // find all files in the update dir
snprintf(cmd, MAX_CMD, "git show HEAD:%s", sql_update_dir); snprintf(cmd, MAX_CMD, "git show HEAD:%s", sql_update_dir);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
// skip first two lines // skip first two lines
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
if(!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; } if (!fgets(buffer, MAX_BUF, cmd_pipe)) { pclose(cmd_pipe); return false; }
char newname[MAX_PATH]; char newname[MAX_PATH];
std::set<std::string> file_list; std::set<std::string> file_list;
sql_update_info info; sql_update_info info;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if(buffer[strlen(buffer) - 1] != '/' && if (buffer[strlen(buffer) - 1] != '/' &&
strncmp(buffer, "Makefile.am", MAX_BUF) != 0) strncmp(buffer, "Makefile.am", MAX_BUF) != 0)
{ {
if(new_sql_updates.find(buffer) != new_sql_updates.end()) if (new_sql_updates.find(buffer) != new_sql_updates.end())
{ {
if(!get_sql_update_info(buffer, info)) return false; if (!get_sql_update_info(buffer, info)) return false;
snprintf(newname, MAX_PATH, "%d_%0*d_%s%s%s.sql", rev, 2, info.nr, info.db, info.has_table ? "_" : "", info.table); snprintf(newname, MAX_PATH, "%d_%0*d_%s%s%s.sql", rev, 2, info.nr, info.db, info.has_table ? "_" : "", info.table);
file_list.insert(newname); file_list.insert(newname);
} }
@ -628,11 +658,11 @@ bool generate_sql_makefile()
// write the makefile // write the makefile
char file_name[MAX_PATH]; char file_name[MAX_PATH];
snprintf(file_name, MAX_PATH, "%s%s/Makefile.am", path_prefix, sql_update_dir); snprintf(file_name, MAX_PATH, "%s%s/Makefile.am", path_prefix, sql_update_dir);
FILE *fout = fopen(file_name, "w"); FILE* fout = fopen(file_name, "w");
if(!fout) { pclose(cmd_pipe); return false; } if (!fout) { pclose(cmd_pipe); return false; }
fprintf(fout, fprintf(fout,
"# Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>\n" "# This file is part of the Continued-MaNGOS Project\n"
"#\n" "#\n"
"# This program is free software; you can redistribute it and/or modify\n" "# This program is free software; you can redistribute it and/or modify\n"
"# it under the terms of the GNU General Public License as published by\n" "# it under the terms of the GNU General Public License as published by\n"
@ -669,12 +699,12 @@ bool generate_sql_makefile()
} }
fprintf(fout, fprintf(fout,
"\n## Additional files to include when running 'make dist'\n" "\n## Additional files to include when running 'make dist'\n"
"# SQL update files, to upgrade database schema from older revisions\n" "# SQL update files, to upgrade database schema from older revisions\n"
"EXTRA_DIST = \\\n" "EXTRA_DIST = \\\n"
); );
for(std::set<std::string>::iterator itr = file_list.begin(), next; itr != file_list.end(); ++itr) for (std::set<std::string>::iterator itr = file_list.begin(), next; itr != file_list.end(); ++itr)
{ {
next = itr; ++next; next = itr; ++next;
fprintf(fout, "\t%s%s\n", itr->c_str(), next == file_list.end() ? "" : " \\"); fprintf(fout, "\t%s%s\n", itr->c_str(), next == file_list.end() ? "" : " \\");
@ -690,14 +720,14 @@ bool generate_sql_makefile()
bool change_sql_database() bool change_sql_database()
{ {
if(new_sql_updates.empty()) return true; if (new_sql_updates.empty()) return true;
printf("+ changing database sql files\n"); printf("+ changing database sql files\n");
// rename the database files, copy their contents back // rename the database files, copy their contents back
// and change the required update line // and change the required update line
for(int i = 0; i < NUM_DATABASES; i++) for (int i = 0; i < NUM_DATABASES; i++)
{ {
if(last_sql_update[i][0] == '\0') continue; if (last_sql_update[i][0] == '\0') continue;
char old_file[MAX_PATH], tmp_file[MAX_PATH], dummy[MAX_BUF]; char old_file[MAX_PATH], tmp_file[MAX_PATH], dummy[MAX_BUF];
@ -706,28 +736,29 @@ bool change_sql_database()
rename(old_file, tmp_file); rename(old_file, tmp_file);
FILE *fin = fopen( tmp_file, "r" ); FILE* fin = fopen(tmp_file, "r");
if(!fin) return false; if (!fin) return false;
FILE *fout = fopen( old_file, "w" ); FILE* fout = fopen(old_file, "w");
if(!fout) return false; if (!fout) return false;
snprintf(dummy, MAX_CMD, "CREATE TABLE `%s` (\n", db_version_table[i]); snprintf(dummy, MAX_CMD, "CREATE TABLE `%s` (\n", db_version_table[i]);
while(fgets(buffer, MAX_BUF, fin)) while (fgets(buffer, MAX_BUF, fin))
{ {
fputs(buffer, fout); fputs(buffer, fout);
if(strncmp(buffer, dummy, MAX_BUF) == 0) if (strncmp(buffer, dummy, MAX_BUF) == 0)
break; break;
} }
while(1) while (1)
{ {
if(!fgets(buffer, MAX_BUF, fin)) return false; if (!fgets(buffer, MAX_BUF, fin)) return false;
if(sscanf(buffer, " `required_%s`", dummy) == 1) break; if (sscanf(buffer, " `required_%s`", dummy) == 1) break;
fputs(buffer, fout); fputs(buffer, fout);
} }
fprintf(fout, " `required_%s` bit(1) default NULL\n", last_sql_update[i]); fprintf(fout, " `required_%s` bit(1) default NULL\n", last_sql_update[i]);
while(fgets(buffer, MAX_BUF, fin))
while (fgets(buffer, MAX_BUF, fin))
fputs(buffer, fout); fputs(buffer, fout);
fclose(fin); fclose(fin);
@ -743,26 +774,26 @@ bool change_sql_database()
bool change_sql_history() bool change_sql_history()
{ {
snprintf(cmd, MAX_CMD, "git log HEAD --pretty=\"format:%%H\""); snprintf(cmd, MAX_CMD, "git log HEAD --pretty=\"format:%%H\"");
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
std::list<std::string> hashes; std::list<std::string> hashes;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if(strncmp(origin_hash, buffer, MAX_HASH) == 0) if (strncmp(origin_hash, buffer, MAX_HASH) == 0)
break; break;
hashes.push_back(buffer); hashes.push_back(buffer);
} }
pclose(cmd_pipe); pclose(cmd_pipe);
if(hashes.empty()) return false; // must have at least one commit if (hashes.empty()) return false; // must have at least one commit
if(hashes.size() < 2) return true; // only one commit, ok but nothing to do if (hashes.size() < 2) return true; // only one commit, ok but nothing to do
snprintf(cmd, MAX_CMD, "git reset --hard %s", origin_hash); snprintf(cmd, MAX_CMD, "git reset --hard %s", origin_hash);
system(cmd); system(cmd);
for(std::list<std::string>::reverse_iterator next = hashes.rbegin(), itr = next++; next != hashes.rend(); ++itr, ++next) for (std::list<std::string>::reverse_iterator next = hashes.rbegin(), itr = next++; next != hashes.rend(); ++itr, ++next)
{ {
// stage the changes from the orignal commit // stage the changes from the orignal commit
snprintf(cmd, MAX_CMD, "git cherry-pick -n %s", itr->c_str()); snprintf(cmd, MAX_CMD, "git cherry-pick -n %s", itr->c_str());
@ -774,10 +805,10 @@ bool change_sql_history()
// remove the newly added files // remove the newly added files
snprintf(cmd, MAX_CMD, "git diff --cached --diff-filter=A --name-only %s%s", path_prefix, sql_update_dir); snprintf(cmd, MAX_CMD, "git diff --cached --diff-filter=A --name-only %s%s", path_prefix, sql_update_dir);
if( (cmd_pipe = popen( cmd, "r" )) == NULL ) if ((cmd_pipe = popen(cmd, "r")) == NULL)
return false; return false;
while(fgets(buffer, MAX_BUF, cmd_pipe)) while (fgets(buffer, MAX_BUF, cmd_pipe))
{ {
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
snprintf(cmd, MAX_CMD, "git rm -f --quiet %s%s", path_prefix, buffer); snprintf(cmd, MAX_CMD, "git rm -f --quiet %s%s", path_prefix, buffer);
@ -800,15 +831,16 @@ bool change_sql_history()
bool prepare_new_index() bool prepare_new_index()
{ {
if(!use_new_index) return true; if (!use_new_index) return true;
// only use a new index if there are staged changes that should be preserved // only use a new index if there are staged changes that should be preserved
if( (cmd_pipe = popen( "git diff --cached", "r" )) == NULL ) { if ((cmd_pipe = popen("git diff --cached", "r")) == NULL)
{
use_new_index = false; use_new_index = false;
return false; return false;
} }
if(!fgets(buffer, MAX_BUF, cmd_pipe)) if (!fgets(buffer, MAX_BUF, cmd_pipe))
{ {
use_new_index = false; use_new_index = false;
pclose(cmd_pipe); pclose(cmd_pipe);
@ -822,29 +854,29 @@ bool prepare_new_index()
// copy the existing index file to a new one // copy the existing index file to a new one
char src_file[MAX_PATH], dst_file[MAX_PATH]; char src_file[MAX_PATH], dst_file[MAX_PATH];
char *old_index = getenv("GIT_INDEX_FILE"); char* old_index = getenv("GIT_INDEX_FILE");
if(old_index) strncpy(src_file, old_index, MAX_PATH); if (old_index) strncpy(src_file, old_index, MAX_PATH);
else snprintf(src_file, MAX_PATH, "%s.git/index", path_prefix); else snprintf(src_file, MAX_PATH, "%s.git/index", path_prefix);
snprintf(dst_file, MAX_PATH, "%s%s", path_prefix, new_index_file); snprintf(dst_file, MAX_PATH, "%s%s", path_prefix, new_index_file);
if(!copy_file(src_file, dst_file)) return false; if (!copy_file(src_file, dst_file)) return false;
// doesn't seem to work with path_prefix // doesn't seem to work with path_prefix
snprintf(new_index_cmd, MAX_CMD, "GIT_INDEX_FILE=%s/%s", base_path, new_index_file); snprintf(new_index_cmd, MAX_CMD, "GIT_INDEX_FILE=%s/%s", base_path, new_index_file);
if(putenv(new_index_cmd) != 0) return false; if (putenv(new_index_cmd) != 0) return false;
// clear the new index // clear the new index
system("git reset -q --mixed HEAD"); system("git reset -q --mixed HEAD");
// revert to old index // revert to old index
snprintf(old_index_cmd, MAX_CMD, "GIT_INDEX_FILE="); snprintf(old_index_cmd, MAX_CMD, "GIT_INDEX_FILE=");
if(putenv(old_index_cmd) != 0) return false; if (putenv(old_index_cmd) != 0) return false;
return true; return true;
} }
bool cleanup_new_index() bool cleanup_new_index()
{ {
if(!use_new_index) return true; if (!use_new_index) return true;
printf("+ cleaning up the new index\n"); printf("+ cleaning up the new index\n");
char idx_file[MAX_PATH]; char idx_file[MAX_PATH];
snprintf(idx_file, MAX_PATH, "%s%s", path_prefix, new_index_file); snprintf(idx_file, MAX_PATH, "%s%s", path_prefix, new_index_file);
@ -854,22 +886,22 @@ bool cleanup_new_index()
#define DO(cmd) if(!cmd) { printf("FAILED\n"); return 1; } #define DO(cmd) if(!cmd) { printf("FAILED\n"); return 1; }
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
for(int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
if(argv[i] == NULL) continue; if (argv[i] == NULL) continue;
if(strncmp(argv[i], "-r", 2) == 0 || strncmp(argv[i], "--replace", 9) == 0) if (strncmp(argv[i], "-r", 2) == 0 || strncmp(argv[i], "--replace", 9) == 0)
allow_replace = true; allow_replace = true;
else if(strncmp(argv[i], "-l", 2) == 0 || strncmp(argv[i], "--local", 7) == 0) else if (strncmp(argv[i], "-l", 2) == 0 || strncmp(argv[i], "--local", 7) == 0)
local = true; local = true;
else if(strncmp(argv[i], "-f", 2) == 0 || strncmp(argv[i], "--fetch", 7) == 0) else if (strncmp(argv[i], "-f", 2) == 0 || strncmp(argv[i], "--fetch", 7) == 0)
do_fetch = true; do_fetch = true;
else if(strncmp(argv[i], "-s", 2) == 0 || strncmp(argv[i], "--sql", 5) == 0) else if (strncmp(argv[i], "-s", 2) == 0 || strncmp(argv[i], "--sql", 5) == 0)
do_sql = true; do_sql = true;
else if(strncmp(argv[i], "--branch=", 9) == 0) else if (strncmp(argv[i], "--branch=", 9) == 0)
snprintf(remote_branch, MAX_REMOTE, "%s", argv[i] + 9); snprintf(remote_branch, MAX_REMOTE, "%s", argv[i] + 9);
else if(strncmp(argv[i], "-h", 2) == 0 || strncmp(argv[i], "--help", 6) == 0) else if (strncmp(argv[i], "-h", 2) == 0 || strncmp(argv[i], "--help", 6) == 0)
{ {
printf("Usage: git_id [OPTION]\n"); printf("Usage: git_id [OPTION]\n");
printf("Generates a new rev number and updates revision_nr.h and the commit message.\n"); printf("Generates a new rev number and updates revision_nr.h and the commit message.\n");
@ -893,30 +925,30 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
DO( find_path() ); DO(find_path());
if(!local) if (!local)
{ {
DO( find_origin() ); DO(find_origin());
if(do_fetch) if (do_fetch)
DO( fetch_origin() ); DO(fetch_origin());
DO( check_fwd() ); DO(check_fwd());
} }
DO( find_rev() ); DO(find_rev());
DO( find_head_msg() ); DO(find_head_msg());
if(do_sql) if (do_sql)
DO( find_sql_updates() ); DO(find_sql_updates());
DO( prepare_new_index() ); DO(prepare_new_index());
DO( write_rev_nr() ); DO(write_rev_nr());
if(do_sql) if (do_sql)
{ {
DO( convert_sql_updates() ); DO(convert_sql_updates());
if (generate_makefile) if (generate_makefile)
DO( generate_sql_makefile() ); DO(generate_sql_makefile());
DO( change_sql_database() ); DO(change_sql_database());
DO( write_rev_sql() ); DO(write_rev_sql());
} }
DO( amend_commit() ); DO(amend_commit());
DO( cleanup_new_index() ); DO(cleanup_new_index());
//if(do_sql) //if(do_sql)
// DO( change_sql_history() ); // DO( change_sql_history() );

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> This file is part of the Continued-MaNGOS Project
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
<?php <?php
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without

View file

@ -1,4 +1,4 @@
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@ -12,5 +12,5 @@ cmake_minimum_required (VERSION 2.6)
project (MANGOS_IOMAP_EXTRACTOR) project (MANGOS_IOMAP_EXTRACTOR)
LINK_DIRECTORIES( ${LINK_DIRECTORIES} ../../../dep/libmpq/libmpq/.libs/ ) LINK_DIRECTORIES( ${LINK_DIRECTORIES} ../../../dep/libmpq/libmpq/.libs/ )
add_executable(vmapextractor adtfile.cpp dbcfile.cpp model.cpp mpq_libmpq.cpp vmapexport.cpp wdtfile.cpp wmo.cpp) add_executable(vmapextractor adtfile.cpp dbcfile.cpp gameobject_extract.cpp model.cpp mpq_libmpq.cpp vmapexport.cpp wdtfile.cpp wmo.cpp)
target_link_libraries(vmapextractor libmpq.a bz2 z) target_link_libraries(vmapextractor libmpq.a bz2 z)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -28,54 +28,55 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
const char * GetPlainName(const char * FileName) const char* GetPlainName(const char* FileName)
{ {
const char * szTemp; const char* szTemp;
if((szTemp = strrchr(FileName, '\\')) != NULL) if ((szTemp = strrchr(FileName, '\\')) != NULL)
FileName = szTemp + 1; FileName = szTemp + 1;
return FileName; return FileName;
} }
char * GetPlainName(char * FileName) char* GetPlainName(char* FileName)
{ {
char * szTemp; char* szTemp;
if((szTemp = strrchr(FileName, '\\')) != NULL) if ((szTemp = strrchr(FileName, '\\')) != NULL)
FileName = szTemp + 1; FileName = szTemp + 1;
return FileName; return FileName;
} }
void fixnamen(char *name, size_t len) void fixnamen(char* name, size_t len)
{ {
for (size_t i=0; i<len-3; i++) for (size_t i = 0; i < len - 3; i++)
{ {
if (i>0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1])) if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i - 1]))
{ {
name[i] |= 0x20; name[i] |= 0x20;
} else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z') }
else if ((i == 0 || !isalpha(name[i - 1])) && name[i] >= 'a' && name[i] <= 'z')
{ {
name[i] &= ~0x20; name[i] &= ~0x20;
} }
} }
//extension in lowercase //extension in lowercase
for(size_t i=len-3; i<len; i++) for (size_t i = len - 3; i < len; i++)
name[i] |= 0x20; name[i] |= 0x20;
} }
void fixname2(char *name, size_t len) void fixname2(char* name, size_t len)
{ {
for (size_t i=0; i<len-3; i++) for (size_t i = 0; i < len - 3; i++)
{ {
if(name[i] == ' ') if (name[i] == ' ')
name[i] = '_'; name[i] = '_';
} }
} }
char * GetExtension(char * FileName) char* GetExtension(char* FileName)
{ {
char * szTemp; char* szTemp;
if((szTemp = strrchr(FileName, '.')) != NULL) if ((szTemp = strrchr(FileName, '.')) != NULL)
return szTemp; return szTemp;
return NULL; return NULL;
} }
@ -87,9 +88,9 @@ ADTFile::ADTFile(char* filename): ADT(WorldMpq, filename)
Adtfilename.append(filename); Adtfilename.append(filename);
} }
bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY) bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY, StringSet& failedPaths)
{ {
if(ADT.isEof ()) if (ADT.isEof())
return false; return false;
uint32 size; uint32 size;
@ -97,12 +98,12 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
string xMap; string xMap;
string yMap; string yMap;
Adtfilename.erase(Adtfilename.find(".adt"),4); Adtfilename.erase(Adtfilename.find(".adt"), 4);
string TempMapNumber; string TempMapNumber;
TempMapNumber = Adtfilename.substr(Adtfilename.length()-6,6); TempMapNumber = Adtfilename.substr(Adtfilename.length() - 6, 6);
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_"))); xMap = TempMapNumber.substr(TempMapNumber.find("_") + 1, (TempMapNumber.find_last_of("_") - 1) - (TempMapNumber.find("_")));
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_"))); yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_") + 1, (TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
Adtfilename.erase((Adtfilename.length()-xMap.length()-yMap.length()-2), (xMap.length()+yMap.length()+2)); Adtfilename.erase((Adtfilename.length() - xMap.length() - yMap.length() - 2), (xMap.length() + yMap.length() + 2));
string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str()); string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
//printf("Processing map %s...\n", AdtMapNumber.c_str()); //printf("Processing map %s...\n", AdtMapNumber.c_str());
//printf("MapNumber = %s\n", TempMapNumber.c_str()); //printf("MapNumber = %s\n", TempMapNumber.c_str());
@ -110,9 +111,9 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
//printf("yMap = %s\n", yMap.c_str()); //printf("yMap = %s\n", yMap.c_str());
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin"; std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
FILE *dirfile; FILE* dirfile;
dirfile = fopen(dirname.c_str(), "ab"); dirfile = fopen(dirname.c_str(), "ab");
if(!dirfile) if (!dirfile)
{ {
printf("Can't open dirfile!'%s'\n", dirname.c_str()); printf("Can't open dirfile!'%s'\n", dirname.c_str());
return false; return false;
@ -121,89 +122,90 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
while (!ADT.isEof()) while (!ADT.isEof())
{ {
char fourcc[5]; char fourcc[5];
ADT.read(&fourcc,4); ADT.read(&fourcc, 4);
ADT.read(&size, 4); ADT.read(&size, 4);
flipcc(fourcc); flipcc(fourcc);
fourcc[4] = 0; fourcc[4] = 0;
size_t nextpos = ADT.getPos() + size; size_t nextpos = ADT.getPos() + size;
if (!strcmp(fourcc,"MCIN")) if (!strcmp(fourcc, "MCIN"))
{ {
} }
else if (!strcmp(fourcc,"MTEX")) else if (!strcmp(fourcc, "MTEX"))
{ {
} }
else if (!strcmp(fourcc,"MMDX")) else if (!strcmp(fourcc, "MMDX"))
{ {
if (size) if (size)
{ {
char *buf = new char[size]; char* buf = new char[size];
ADT.read(buf, size); ADT.read(buf, size);
char *p=buf; char* p = buf;
int t=0; int t = 0;
ModelInstansName = new string[size]; ModelInstansName = new string[size];
while (p<buf+size) while (p < buf + size)
{ {
fixnamen(p,strlen(p)); fixnamen(p, strlen(p));
char* s = GetPlainName(p); char* s = GetPlainName(p);
fixname2(s,strlen(s)); fixname2(s, strlen(s));
ModelInstansName[t++] = s; ModelInstansName[t++] = s;
string path(p); string path(p);
ExtractSingleModel(path, failedPaths);
p = p+strlen(p)+1; p = p + strlen(p) + 1;
} }
delete[] buf; delete[] buf;
} }
} }
else if (!strcmp(fourcc,"MWMO")) else if (!strcmp(fourcc, "MWMO"))
{ {
if (size) if (size)
{ {
char *buf = new char[size]; char* buf = new char[size];
ADT.read(buf, size); ADT.read(buf, size);
char *p=buf; char* p = buf;
int q = 0; int q = 0;
WmoInstansName = new string[size]; WmoInstansName = new string[size];
while (p<buf+size) while (p < buf + size)
{ {
string path(p); string path(p);
char* s=GetPlainName(p); char* s = GetPlainName(p);
fixnamen(s,strlen(s)); fixnamen(s, strlen(s));
fixname2(s,strlen(s)); fixname2(s, strlen(s));
p=p+strlen(p)+1; p = p + strlen(p) + 1;
WmoInstansName[q++] = s; WmoInstansName[q++] = s;
} }
delete[] buf; delete[] buf;
} }
} }
//====================== //======================
else if (!strcmp(fourcc,"MDDF")) else if (!strcmp(fourcc, "MDDF"))
{ {
if (size) if (size)
{ {
nMDX = (int)size / 36; nMDX = (int)size / 36;
for (int i=0; i<nMDX; ++i) for (int i = 0; i < nMDX; ++i)
{ {
uint32 id; uint32 id;
ADT.read(&id, 4); ADT.read(&id, 4);
ModelInstance inst(ADT,ModelInstansName[id].c_str(), map_num, tileX, tileY, dirfile); ModelInstance inst(ADT, ModelInstansName[id].c_str(), map_num, tileX, tileY, dirfile);
} }
delete[] ModelInstansName; delete[] ModelInstansName;
} }
} }
else if (!strcmp(fourcc,"MODF")) else if (!strcmp(fourcc, "MODF"))
{ {
if (size) if (size)
{ {
nWMO = (int)size / 64; nWMO = (int)size / 64;
for (int i=0; i<nWMO; ++i) for (int i = 0; i < nWMO; ++i)
{ {
uint32 id; uint32 id;
ADT.read(&id, 4); ADT.read(&id, 4);
WMOInstance inst(ADT,WmoInstansName[id].c_str(), map_num, tileX, tileY, dirfile); WMOInstance inst(ADT, WmoInstansName[id].c_str(), map_num, tileX, tileY, dirfile);
} }
delete[] WmoInstansName; delete[] WmoInstansName;
} }
@ -213,6 +215,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
} }
ADT.close(); ADT.close();
fclose(dirfile); fclose(dirfile);
return true; return true;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@
#include "mpqfile.h" #include "mpqfile.h"
#include "wmo.h" #include "wmo.h"
#include "vmapexport.h"
#include "model.h" #include "model.h"
#define TILESIZE (533.33333f) #define TILESIZE (533.33333f)
@ -34,7 +35,7 @@ typedef struct
float x; float x;
float y; float y;
float z; float z;
}svec; } svec;
struct vec struct vec
{ {
@ -50,9 +51,9 @@ struct triangle
typedef struct typedef struct
{ {
float v9[16*8+1][16*8+1]; float v9[16 * 8 + 1][16 * 8 + 1];
float v8[16*8][16*8]; float v8[16 * 8][16 * 8];
}Cell; } Cell;
typedef struct typedef struct
{ {
@ -62,12 +63,12 @@ typedef struct
//Liquid *lq; //Liquid *lq;
float waterlevel[9][9]; float waterlevel[9][9];
uint8 flag; uint8 flag;
}chunk; } chunk;
typedef struct typedef struct
{ {
chunk ch[16][16]; chunk ch[16][16];
}mcell; } mcell;
struct MapChunkHeader struct MapChunkHeader
{ {
@ -109,35 +110,35 @@ struct MapChunkHeader
class ADTFile class ADTFile
{ {
public: public:
ADTFile(char* filename); ADTFile(char* filename);
~ADTFile(); ~ADTFile();
int nWMO; int nWMO;
int nMDX; int nMDX;
string* WmoInstansName; string* WmoInstansName;
string* ModelInstansName; string* ModelInstansName;
bool init(uint32 map_num, uint32 tileX, uint32 tileY); bool init(uint32 map_num, uint32 tileX, uint32 tileY, StringSet& failedPaths);
//void LoadMapChunks(); //void LoadMapChunks();
//uint32 wmo_count; //uint32 wmo_count;
/* /*
const mcell& Getmcell() const const mcell& Getmcell() const
{ {
return Mcell; return Mcell;
} }
*/ */
private: private:
//size_t mcnk_offsets[256], mcnk_sizes[256]; //size_t mcnk_offsets[256], mcnk_sizes[256];
MPQFile ADT; MPQFile ADT;
//mcell Mcell; //mcell Mcell;
string Adtfilename; string Adtfilename;
}; };
const char * GetPlainName(const char * FileName); const char* GetPlainName(const char* FileName);
char * GetPlainName(char * FileName); char* GetPlainName(char* FileName);
char * GetExtension(char * FileName); char* GetExtension(char* FileName);
void fixnamen(char *name, size_t len); void fixnamen(char* name, size_t len);
void fixname2(char *name, size_t len); void fixname2(char* name, size_t len);
//void fixMapNamen(char *name, size_t len); //void fixMapNamen(char *name, size_t len);
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -69,7 +69,7 @@ bool DBCFile::open()
return false; return false;
_data = new unsigned char[_recordSize * _recordCount + _stringSize]; _data = new unsigned char[_recordSize * _recordCount + _stringSize];
_stringTable = _data + _recordSize*_recordCount; _stringTable = _data + _recordSize * _recordCount;
size_t data_size = _recordSize * _recordCount + _stringSize; size_t data_size = _recordSize * _recordCount + _stringSize;
readBytes = 0; readBytes = 0;
@ -90,7 +90,7 @@ DBCFile::~DBCFile()
DBCFile::Record DBCFile::getRecord(size_t id) DBCFile::Record DBCFile::getRecord(size_t id)
{ {
assert(_data); assert(_data);
return Record(*this, _data + id*_recordSize); return Record(*this, _data + id * _recordSize);
} }
size_t DBCFile::getMaxId() size_t DBCFile::getMaxId()
@ -98,7 +98,7 @@ size_t DBCFile::getMaxId()
assert(_data); assert(_data);
size_t maxId = 0; size_t maxId = 0;
for(size_t i = 0; i < getRecordCount(); ++i) for (size_t i = 0; i < getRecordCount(); ++i)
if (maxId < getRecord(i).getUInt(0)) if (maxId < getRecord(i).getUInt(0))
maxId = getRecord(i).getUInt(0); maxId = getRecord(i).getUInt(0);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -35,17 +35,17 @@ class DBCFile
class Exception class Exception
{ {
public: public:
Exception(const std::string &message) : message(message) { } Exception(const std::string& message) : message(message) { }
virtual ~Exception() { } virtual ~Exception() { }
const std::string &getMessage() { return message; } const std::string& getMessage() { return message; }
private: private:
std::string message; std::string message;
}; };
class NotFound: public Exception class NotFound: public Exception
{ {
public: public:
NotFound(): Exception("Key was not found") { } NotFound(): Exception("Key was not found") { }
}; };
// Iteration over database // Iteration over database
@ -56,22 +56,22 @@ class DBCFile
float getFloat(size_t field) const float getFloat(size_t field) const
{ {
assert(field < file._fieldCount); assert(field < file._fieldCount);
return *reinterpret_cast<float*>(offset+field*4); return *reinterpret_cast<float*>(offset + field * 4);
} }
unsigned int getUInt(size_t field) const unsigned int getUInt(size_t field) const
{ {
assert(field < file._fieldCount); assert(field < file._fieldCount);
return *reinterpret_cast<unsigned int*>(offset+field*4); return *reinterpret_cast<unsigned int*>(offset + field * 4);
} }
int getInt(size_t field) const int getInt(size_t field) const
{ {
assert(field < file._fieldCount); assert(field < file._fieldCount);
return *reinterpret_cast<int*>(offset+field*4); return *reinterpret_cast<int*>(offset + field * 4);
} }
const char *getString(size_t field) const const char* getString(size_t field) const
{ {
assert(field < file._fieldCount); assert(field < file._fieldCount);
size_t stringOffset = getUInt(field); size_t stringOffset = getUInt(field);
@ -80,9 +80,9 @@ class DBCFile
} }
private: private:
Record(DBCFile &file, unsigned char *offset): file(file), offset(offset) {} Record(DBCFile& file, unsigned char* offset): file(file), offset(offset) {}
unsigned char *offset; unsigned char* offset;
DBCFile &file; DBCFile& file;
friend class DBCFile; friend class DBCFile;
friend class DBCFile::Iterator; friend class DBCFile::Iterator;
@ -92,26 +92,26 @@ class DBCFile
class Iterator class Iterator
{ {
public: public:
Iterator(DBCFile &file, unsigned char *offset) : record(file, offset) { } Iterator(DBCFile& file, unsigned char* offset) : record(file, offset) { }
/// Advance (prefix only) /// Advance (prefix only)
Iterator & operator++() Iterator& operator++()
{ {
record.offset += record.file._recordSize; record.offset += record.file._recordSize;
return *this; return *this;
} }
/// Return address of current instance /// Return address of current instance
Record const & operator*() const { return record; } Record const& operator*() const { return record; }
const Record* operator->() const { return &record; } const Record* operator->() const { return &record; }
/// Comparison /// Comparison
bool operator==(const Iterator &b) const bool operator==(const Iterator& b) const
{ {
return record.offset == b.record.offset; return record.offset == b.record.offset;
} }
bool operator!=(const Iterator &b) const bool operator!=(const Iterator& b) const
{ {
return record.offset != b.record.offset; return record.offset != b.record.offset;
} }
@ -138,7 +138,7 @@ class DBCFile
size_t _recordCount; size_t _recordCount;
size_t _fieldCount; size_t _fieldCount;
size_t _stringSize; size_t _stringSize;
unsigned char *_data; unsigned char* _data;
unsigned char* _stringTable; unsigned char* _stringTable;
}; };

View file

@ -0,0 +1,111 @@
#include "model.h"
#include "dbcfile.h"
#include "adtfile.h"
#include "vmapexport.h"
#include <algorithm>
#include <stdio.h>
bool ExtractSingleModel(std::string& fname, StringSet& failedPaths)
{
char* name = GetPlainName((char*)fname.c_str());
char* ext = GetExtension(name);
// < 3.1.0 ADT MMDX section store filename.mdx filenames for corresponded .m2 file
if (!strcmp(ext, ".mdx"))
{
// replace .mdx -> .m2
fname.erase(fname.length() - 2, 2);
fname.append("2");
}
// >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file
// nothing do
std::string output(szWorkDirWmo);
output += "/";
output += name;
if (FileExists(output.c_str()))
return true;
Model mdl(fname);
if (!mdl.open(failedPaths))
return false;
return mdl.ConvertToVMAPModel(output.c_str());
}
extern HANDLE LocaleMpq;
void ExtractGameobjectModels()
{
printf("\n");
printf("Extracting GameObject models...\n");
DBCFile dbc(LocaleMpq, "DBFilesClient\\GameObjectDisplayInfo.dbc");
if (!dbc.open())
{
printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
exit(1);
}
std::string basepath = szWorkDirWmo;
basepath += "/";
std::string path;
StringSet failedPaths;
FILE* model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");
for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
{
path = it->getString(1);
if (path.length() < 4)
continue;
fixnamen((char*)path.c_str(), path.size());
char* name = GetPlainName((char*)path.c_str());
fixname2(name, strlen(name));
char* ch_ext = GetExtension(name);
if (!ch_ext)
continue;
strToLower(ch_ext);
bool result = false;
if (!strcmp(ch_ext, ".wmo"))
{
result = ExtractSingleWmo(path);
}
else if (!strcmp(ch_ext, ".mdl"))
{
// TODO: extract .mdl files, if needed
continue;
}
else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2"))
{
result = ExtractSingleModel(path, failedPaths);
}
if (result)
{
uint32 displayId = it->getUInt(0);
uint32 path_length = strlen(name);
fwrite(&displayId, sizeof(uint32), 1, model_list);
fwrite(&path_length, sizeof(uint32), 1, model_list);
fwrite(name, sizeof(char), path_length, model_list);
}
}
fclose(model_list);
if (!failedPaths.empty())
{
printf("Warning: Some models could not be extracted, see below\n");
for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
printf("Could not find file of model %s\n", itr->c_str());
printf("A few of these warnings are expected to happen, so be not alarmed!\n");
}
printf("Done!\n");
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -52,7 +52,8 @@ typedef uint8_t uint8;
// //
struct file_MVER struct file_MVER
{ {
union{ union
{
uint32 fcc; uint32 fcc;
char fcc_txt[4]; char fcc_txt[4];
}; };
@ -60,18 +61,19 @@ struct file_MVER
uint32 ver; uint32 ver;
}; };
class FileLoader{ class FileLoader
uint8 *data; {
uint32 data_size; uint8* data;
public: uint32 data_size;
virtual bool prepareLoadedData(); public:
uint8 *GetData() {return data;} virtual bool prepareLoadedData();
uint32 GetDataSize() {return data_size;} uint8* GetData() {return data;}
uint32 GetDataSize() {return data_size;}
file_MVER *version; file_MVER* version;
FileLoader(); FileLoader();
~FileLoader(); ~FileLoader();
bool loadFile(char *filename, bool log = true); bool loadFile(char* filename, bool log = true);
virtual void free(); virtual void free();
}; };
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -28,11 +28,11 @@
extern HANDLE WorldMpq; extern HANDLE WorldMpq;
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0) Model::Model(std::string& filename) : filename(filename), vertices(0), indices(0)
{ {
} }
bool Model::open() bool Model::open(StringSet& failedPaths)
{ {
MPQFile f(WorldMpq, filename.c_str()); MPQFile f(WorldMpq, filename.c_str());
@ -41,28 +41,27 @@ bool Model::open()
if (!ok) if (!ok)
{ {
f.close(); f.close();
// Do not show this error on console to avoid confusion, the extractor can continue working even if some models fail to load failedPaths.insert(filename);
//printf("Error loading model %s\n", filename.c_str());
return false; return false;
} }
_unload(); _unload();
memcpy(&header, f.getBuffer(), sizeof(ModelHeader)); memcpy(&header, f.getBuffer(), sizeof(ModelHeader));
if(header.nBoundingTriangles > 0) if (header.nBoundingTriangles > 0)
{ {
f.seek(0); f.seek(0);
f.seekRelative(header.ofsBoundingVertices); f.seekRelative(header.ofsBoundingVertices);
vertices = new Vec3D[header.nBoundingVertices]; vertices = new Vec3D[header.nBoundingVertices];
f.read(vertices,header.nBoundingVertices*12); f.read(vertices, header.nBoundingVertices * 12);
for (uint32 i=0; i<header.nBoundingVertices; i++) for (uint32 i = 0; i < header.nBoundingVertices; i++)
{ {
vertices[i] = fixCoordSystem(vertices[i]); vertices[i] = fixCoordSystem(vertices[i]);
} }
f.seek(0); f.seek(0);
f.seekRelative(header.ofsBoundingTriangles); f.seekRelative(header.ofsBoundingTriangles);
indices = new uint16[header.nBoundingTriangles]; indices = new uint16[header.nBoundingTriangles];
f.read(indices,header.nBoundingTriangles*2); f.read(indices, header.nBoundingTriangles * 2);
f.close(); f.close();
} }
else else
@ -74,52 +73,52 @@ bool Model::open()
return true; return true;
} }
bool Model::ConvertToVMAPModel(const char * outfilename) bool Model::ConvertToVMAPModel(const char* outfilename)
{ {
int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; int N[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
FILE * output=fopen(outfilename,"wb"); FILE* output = fopen(outfilename, "wb");
if(!output) if (!output)
{ {
printf("Can't create the output file '%s'\n",outfilename); printf("Can't create the output file '%s'\n", outfilename);
return false; return false;
} }
fwrite(szRawVMAPMagic,8,1,output); fwrite(szRawVMAPMagic, 8, 1, output);
uint32 nVertices = 0; uint32 nVertices = 0;
nVertices = header.nBoundingVertices; nVertices = header.nBoundingVertices;
fwrite(&nVertices, sizeof(int), 1, output); fwrite(&nVertices, sizeof(int), 1, output);
uint32 nofgroups = 1; uint32 nofgroups = 1;
fwrite(&nofgroups,sizeof(uint32), 1, output); fwrite(&nofgroups, sizeof(uint32), 1, output);
fwrite(N,4*3,1,output);// rootwmoid, flags, groupid fwrite(N, 4 * 3, 1, output); // rootwmoid, flags, groupid
fwrite(N,sizeof(float),3*2,output);//bbox, only needed for WMO currently fwrite(N, sizeof(float), 3 * 2, output); //bbox, only needed for WMO currently
fwrite(N,4,1,output);// liquidflags fwrite(N, 4, 1, output); // liquidflags
fwrite("GRP ",4,1,output); fwrite("GRP ", 4, 1, output);
uint32 branches = 1; uint32 branches = 1;
int wsize; int wsize;
wsize = sizeof(branches) + sizeof(uint32) * branches; wsize = sizeof(branches) + sizeof(uint32) * branches;
fwrite(&wsize, sizeof(int), 1, output); fwrite(&wsize, sizeof(int), 1, output);
fwrite(&branches,sizeof(branches), 1, output); fwrite(&branches, sizeof(branches), 1, output);
uint32 nIndexes = 0; uint32 nIndexes = 0;
nIndexes = header.nBoundingTriangles; nIndexes = header.nBoundingTriangles;
fwrite(&nIndexes,sizeof(uint32), 1, output); fwrite(&nIndexes, sizeof(uint32), 1, output);
fwrite("INDX",4, 1, output); fwrite("INDX", 4, 1, output);
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes; wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
fwrite(&wsize, sizeof(int), 1, output); fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nIndexes, sizeof(uint32), 1, output); fwrite(&nIndexes, sizeof(uint32), 1, output);
if(nIndexes >0) if (nIndexes > 0)
{ {
fwrite(indices, sizeof(unsigned short), nIndexes, output); fwrite(indices, sizeof(unsigned short), nIndexes, output);
} }
fwrite("VERT",4, 1, output); fwrite("VERT", 4, 1, output);
wsize = sizeof(int) + sizeof(float) * 3 * nVertices; wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
fwrite(&wsize, sizeof(int), 1, output); fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nVertices, sizeof(int), 1, output); fwrite(&nVertices, sizeof(int), 1, output);
if(nVertices >0) if (nVertices > 0)
{ {
for(uint32 vpos=0; vpos <nVertices; ++vpos) for (uint32 vpos = 0; vpos < nVertices; ++vpos)
{ {
std::swap(vertices[vpos].y, vertices[vpos].z); std::swap(vertices[vpos].y, vertices[vpos].z);
} }
fwrite(vertices, sizeof(float)*3, nVertices, output); fwrite(vertices, sizeof(float) * 3, nVertices, output);
} }
fclose(output); fclose(output);
@ -138,24 +137,24 @@ Vec3D fixCoordSystem2(Vec3D v)
return Vec3D(v.x, v.z, v.y); return Vec3D(v.x, v.z, v.y);
} }
ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile) ModelInstance::ModelInstance(MPQFile& f, const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
{ {
float ff[3]; float ff[3];
f.read(&id, 4); f.read(&id, 4);
f.read(ff,12); f.read(ff, 12);
pos = fixCoords(Vec3D(ff[0],ff[1],ff[2])); pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
f.read(ff,12); f.read(ff, 12);
rot = Vec3D(ff[0],ff[1],ff[2]); rot = Vec3D(ff[0], ff[1], ff[2]);
f.read(&scale,4); f.read(&scale, 4);
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float? // scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = scale / 1024.0f; sc = scale / 1024.0f;
char tempname[512]; char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName); sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);
FILE *input; FILE* input;
input = fopen(tempname, "r+b"); input = fopen(tempname, "r+b");
if(!input) if (!input)
{ {
//printf("ModelInstance::ModelInstance couldn't open %s\n", tempname); //printf("ModelInstance::ModelInstance couldn't open %s\n", tempname);
return; return;
@ -163,15 +162,15 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
fseek(input, 8, SEEK_SET); // get the correct no of vertices fseek(input, 8, SEEK_SET); // get the correct no of vertices
int nVertices; int nVertices;
fread(&nVertices, sizeof (int), 1, input); fread(&nVertices, sizeof(int), 1, input);
fclose(input); fclose(input);
if(nVertices == 0) if (nVertices == 0)
return; return;
uint16 adtId = 0;// not used for models uint16 adtId = 0;// not used for models
uint32 flags = MOD_M2; uint32 flags = MOD_M2;
if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; if (tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name //write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name
fwrite(&mapID, sizeof(uint32), 1, pDirfile); fwrite(&mapID, sizeof(uint32), 1, pDirfile);
fwrite(&tileX, sizeof(uint32), 1, pDirfile); fwrite(&tileX, sizeof(uint32), 1, pDirfile);
@ -182,7 +181,7 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
fwrite(&pos, sizeof(float), 3, pDirfile); fwrite(&pos, sizeof(float), 3, pDirfile);
fwrite(&rot, sizeof(float), 3, pDirfile); fwrite(&rot, sizeof(float), 3, pDirfile);
fwrite(&sc, sizeof(float), 1, pDirfile); fwrite(&sc, sizeof(float), 1, pDirfile);
uint32 nlen=strlen(ModelInstName); uint32 nlen = strlen(ModelInstName);
fwrite(&nlen, sizeof(uint32), 1, pDirfile); fwrite(&nlen, sizeof(uint32), 1, pDirfile);
fwrite(ModelInstName, sizeof(char), nlen, pDirfile); fwrite(ModelInstName, sizeof(char), nlen, pDirfile);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,8 +23,8 @@
//#include "mpq.h" //#include "mpq.h"
#include "modelheaders.h" #include "modelheaders.h"
#include <vector> #include <vector>
#include "vmapexport.h"
class Model;
class WMOInstance; class WMOInstance;
class MPQFile; class MPQFile;
@ -32,46 +32,45 @@ Vec3D fixCoordSystem(Vec3D v);
class Model class Model
{ {
public: public:
ModelHeader header; ModelHeader header;
uint32 offsBB_vertices, offsBB_indices; uint32 offsBB_vertices, offsBB_indices;
Vec3D *BB_vertices, *vertices; Vec3D* BB_vertices, *vertices;
uint16 *BB_indices, *indices; uint16* BB_indices, *indices;
size_t nIndices; size_t nIndices;
bool open(); bool open(StringSet& failedPaths);
bool ConvertToVMAPModel(const char * outfilename); bool ConvertToVMAPModel(const char* outfilename);
bool ok; bool ok;
Model(std::string &filename); Model(std::string& filename);
~Model() {_unload();} ~Model() {_unload();}
private: private:
void _unload() void _unload()
{ {
delete[] vertices; delete[] vertices;
delete[] indices; delete[] indices;
vertices = NULL; vertices = NULL;
indices = NULL; indices = NULL;
} }
std::string filename; std::string filename;
char outfilename; char outfilename;
}; };
class ModelInstance class ModelInstance
{ {
public: public:
Model *model; Model* model;
uint32 id; uint32 id;
Vec3D pos, rot; Vec3D pos, rot;
unsigned int d1, scale; unsigned int d1, scale;
float w,sc; float w, sc;
ModelInstance() {}
ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
ModelInstance() {}
ModelInstance(MPQFile& f, const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
}; };
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -54,7 +54,8 @@ size_t MPQFile::read(void* dest, size_t bytes)
if (eof) return 0; if (eof) return 0;
size_t rpos = pointer + bytes; size_t rpos = pointer + bytes;
if (rpos > size) { if (rpos > size)
{
bytes = size - pointer; bytes = size - pointer;
eof = true; eof = true;
} }

View file

@ -44,38 +44,38 @@ using namespace std;
class MPQFile class MPQFile
{ {
//MPQHANDLE handle; //MPQHANDLE handle;
bool eof; bool eof;
char *buffer; char* buffer;
size_t pointer,size; size_t pointer, size;
// disable copying // disable copying
MPQFile(const MPQFile &f); MPQFile(const MPQFile& f);
void operator=(const MPQFile &f); void operator=(const MPQFile& f);
public: public:
MPQFile(HANDLE mpq, const char* filename); // filenames are not case sensitive MPQFile(HANDLE mpq, const char* filename); // filenames are not case sensitive
~MPQFile() { close(); } ~MPQFile() { close(); }
size_t read(void* dest, size_t bytes); size_t read(void* dest, size_t bytes);
size_t getSize() { return size; } size_t getSize() { return size; }
size_t getPos() { return pointer; } size_t getPos() { return pointer; }
char* getBuffer() { return buffer; } char* getBuffer() { return buffer; }
char* getPointer() { return buffer + pointer; } char* getPointer() { return buffer + pointer; }
bool isEof() { return eof; } bool isEof() { return eof; }
void seek(int offset); void seek(int offset);
void seekRelative(int offset); void seekRelative(int offset);
void close(); void close();
}; };
inline void flipcc(char *fcc) inline void flipcc(char* fcc)
{ {
char t; char t;
t=fcc[0]; t = fcc[0];
fcc[0]=fcc[3]; fcc[0] = fcc[3];
fcc[3]=t; fcc[3] = t;
t=fcc[1]; t = fcc[1];
fcc[1]=fcc[2]; fcc[1] = fcc[2];
fcc[2]=t; fcc[2] = t;
} }
#endif #endif

View file

@ -0,0 +1,232 @@
#ifndef VEC3D_H
#define VEC3D_H
#include <iostream>
#include <cmath>
class Vec3D
{
public:
float x, y, z;
Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) {}
Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {}
Vec3D& operator= (const Vec3D& v)
{
x = v.x;
y = v.y;
z = v.z;
return *this;
}
Vec3D operator+ (const Vec3D& v) const
{
Vec3D r(x + v.x, y + v.y, z + v.z);
return r;
}
Vec3D operator- (const Vec3D& v) const
{
Vec3D r(x - v.x, y - v.y, z - v.z);
return r;
}
float operator* (const Vec3D& v) const
{
return x * v.x + y * v.y + z * v.z;
}
Vec3D operator* (float d) const
{
Vec3D r(x * d, y * d, z * d);
return r;
}
friend Vec3D operator* (float d, const Vec3D& v)
{
return v * d;
}
Vec3D operator% (const Vec3D& v) const
{
Vec3D r(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x);
return r;
}
Vec3D& operator+= (const Vec3D& v)
{
x += v.x;
y += v.y;
z += v.z;
return *this;
}
Vec3D& operator-= (const Vec3D& v)
{
x -= v.x;
y -= v.y;
z -= v.z;
return *this;
}
Vec3D& operator*= (float d)
{
x *= d;
y *= d;
z *= d;
return *this;
}
float lengthSquared() const
{
return x * x + y * y + z * z;
}
float length() const
{
return sqrt(x * x + y * y + z * z);
}
Vec3D& normalize()
{
this->operator*= (1.0f / length());
return *this;
}
Vec3D operator~() const
{
Vec3D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec3D& v)
{
in >> v.x >> v.y >> v.z;
return in;
}
friend std::ostream& operator<<(std::ostream& out, const Vec3D& v)
{
out << v.x << " " << v.y << " " << v.z;
return out;
}
operator float* ()
{
return (float*)this;
}
};
class Vec2D
{
public:
float x, y;
Vec2D(float x0 = 0.0f, float y0 = 0.0f) : x(x0), y(y0) {}
Vec2D(const Vec2D& v) : x(v.x), y(v.y) {}
Vec2D& operator= (const Vec2D& v)
{
x = v.x;
y = v.y;
return *this;
}
Vec2D operator+ (const Vec2D& v) const
{
Vec2D r(x + v.x, y + v.y);
return r;
}
Vec2D operator- (const Vec2D& v) const
{
Vec2D r(x - v.x, y - v.y);
return r;
}
float operator* (const Vec2D& v) const
{
return x * v.x + y * v.y;
}
Vec2D operator* (float d) const
{
Vec2D r(x * d, y * d);
return r;
}
friend Vec2D operator* (float d, const Vec2D& v)
{
return v * d;
}
Vec2D& operator+= (const Vec2D& v)
{
x += v.x;
y += v.y;
return *this;
}
Vec2D& operator-= (const Vec2D& v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vec2D& operator*= (float d)
{
x *= d;
y *= d;
return *this;
}
float lengthSquared() const
{
return x * x + y * y;
}
float length() const
{
return sqrt(x * x + y * y);
}
Vec2D& normalize()
{
this->operator*= (1.0f / length());
return *this;
}
Vec2D operator~() const
{
Vec2D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec2D& v)
{
in >> v.x >> v.y;
return in;
}
operator float* ()
{
return (float*)this;
}
};
inline void rotate(float x0, float y0, float* x, float* y, float angle)
{
float xa = *x - x0, ya = *y - y0;
*x = xa * cosf(angle) - ya * sinf(angle) + x0;
*y = xa * sinf(angle) + ya * cosf(angle) + y0;
}
#endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -23,13 +23,13 @@
#include <list> #include <list>
#include <errno.h> #include <errno.h>
#ifdef WIN32 #if defined WIN32
#include <Windows.h> #include <Windows.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <direct.h> #include <direct.h>
#define mkdir _mkdir #define mkdir _mkdir
#else #else
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#undef min #undef min
@ -49,6 +49,8 @@
#include "vmapexport.h" #include "vmapexport.h"
#include "vmapexport.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Defines // Defines
@ -62,7 +64,7 @@ HANDLE LocaleMpq = NULL;
uint32 CONF_TargetBuild = 15595; // 4.3.4.15595 uint32 CONF_TargetBuild = 15595; // 4.3.4.15595
// List MPQ for extract maps from // List MPQ for extract maps from
char const* CONF_mpq_list[]= char const* CONF_mpq_list[] =
{ {
"world.MPQ", "world.MPQ",
"art.MPQ", "art.MPQ",
@ -92,20 +94,20 @@ typedef struct
{ {
char name[64]; char name[64];
unsigned int id; unsigned int id;
}map_id; } map_id;
map_id * map_ids; map_id* map_ids;
uint16 *LiqType = 0; uint16* LiqType = 0;
uint32 map_count; uint32 map_count;
char output_path[128]="."; char output_path[128] = ".";
char input_path[1024]="."; char input_path[1024] = ".";
bool preciseVectorData = false; bool preciseVectorData = false;
// Constants // Constants
//static const char * szWorkDirMaps = ".\\Maps"; //static const char * szWorkDirMaps = ".\\Maps";
const char* szWorkDirWmo = "./Buildings"; const char* szWorkDirWmo = "./Buildings";
const char* szRawVMAPMagic = "VMAP004"; const char* szRawVMAPMagic = "VMAPc04";
bool LoadLocaleMPQFile(int locale) bool LoadLocaleMPQFile(int locale)
{ {
@ -263,9 +265,9 @@ bool FileExists(const char* file)
void strToLower(char* str) void strToLower(char* str)
{ {
while(*str) while (*str)
{ {
*str=tolower(*str); *str = tolower(*str);
++str; ++str;
} }
} }
@ -276,7 +278,7 @@ void ReadLiquidTypeTableDBC()
printf("Read LiquidType.dbc file..."); printf("Read LiquidType.dbc file...");
DBCFile dbc(LocaleMpq, "DBFilesClient\\LiquidType.dbc"); DBCFile dbc(LocaleMpq, "DBFilesClient\\LiquidType.dbc");
if(!dbc.open()) if (!dbc.open())
{ {
printf("Fatal error: Invalid LiquidType.dbc file format!\n"); printf("Fatal error: Invalid LiquidType.dbc file format!\n");
exit(1); exit(1);
@ -287,7 +289,7 @@ void ReadLiquidTypeTableDBC()
LiqType = new uint16[LiqType_maxid + 1]; LiqType = new uint16[LiqType_maxid + 1];
memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
for(uint32 x = 0; x < LiqType_count; ++x) for (uint32 x = 0; x < LiqType_count; ++x)
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count); printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count);
@ -324,24 +326,24 @@ bool ExtractSingleWmo(std::string& fname)
// Copy files from archive // Copy files from archive
char szLocalFile[1024]; char szLocalFile[1024];
const char * plain_name = GetPlainName(fname.c_str()); const char* plain_name = GetPlainName(fname.c_str());
sprintf(szLocalFile, "%s/%s", szWorkDirWmo, plain_name); sprintf(szLocalFile, "%s/%s", szWorkDirWmo, plain_name);
fixnamen(szLocalFile,strlen(szLocalFile)); fixnamen(szLocalFile, strlen(szLocalFile));
if (FileExists(szLocalFile)) if (FileExists(szLocalFile))
return true; return true;
int p = 0; int p = 0;
//Select root wmo files //Select root wmo files
const char * rchr = strrchr(plain_name, '_'); const char* rchr = strrchr(plain_name, '_');
if(rchr != NULL) if (rchr != NULL)
{ {
char cpy[4]; char cpy[4];
strncpy((char*)cpy,rchr,4); strncpy((char*)cpy, rchr, 4);
for (int i=0;i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
int m = cpy[i]; int m = cpy[i];
if(isdigit(m)) if (isdigit(m))
p++; p++;
} }
} }
@ -352,13 +354,13 @@ bool ExtractSingleWmo(std::string& fname)
bool file_ok = true; bool file_ok = true;
std::cout << "Extracting " << fname << std::endl; std::cout << "Extracting " << fname << std::endl;
WMORoot froot(fname); WMORoot froot(fname);
if(!froot.open()) if (!froot.open())
{ {
printf("Couldn't open RootWmo!!!\n"); printf("Couldn't open RootWmo!!!\n");
return true; return true;
} }
FILE *output = fopen(szLocalFile,"wb"); FILE* output = fopen(szLocalFile, "wb");
if(!output) if (!output)
{ {
printf("couldn't open %s for writing!\n", szLocalFile); printf("couldn't open %s for writing!\n", szLocalFile);
return false; return false;
@ -366,20 +368,20 @@ bool ExtractSingleWmo(std::string& fname)
froot.ConvertToVMAPRootWmo(output); froot.ConvertToVMAPRootWmo(output);
int Wmo_nVertices = 0; int Wmo_nVertices = 0;
//printf("root has %d groups\n", froot->nGroups); //printf("root has %d groups\n", froot->nGroups);
if (froot.nGroups !=0) if (froot.nGroups != 0)
{ {
for (uint32 i = 0; i < froot.nGroups; ++i) for (uint32 i = 0; i < froot.nGroups; ++i)
{ {
char temp[1024]; char temp[1024];
strcpy(temp, fname.c_str()); strcpy(temp, fname.c_str());
temp[fname.length()-4] = 0; temp[fname.length() - 4] = 0;
char groupFileName[1024]; char groupFileName[1024];
sprintf(groupFileName,"%s_%03d.wmo",temp, i); sprintf(groupFileName, "%s_%03d.wmo", temp, i);
//printf("Trying to open groupfile %s\n",groupFileName); //printf("Trying to open groupfile %s\n",groupFileName);
string s = groupFileName; string s = groupFileName;
WMOGroup fgroup(s); WMOGroup fgroup(s);
if(!fgroup.open()) if (!fgroup.open())
{ {
printf("Could not open all Group file for: %s\n", plain_name); printf("Could not open all Group file for: %s\n", plain_name);
file_ok = false; file_ok = false;
@ -391,7 +393,7 @@ bool ExtractSingleWmo(std::string& fname)
} }
fseek(output, 8, SEEK_SET); // store the correct no of vertices fseek(output, 8, SEEK_SET); // store the correct no of vertices
fwrite(&Wmo_nVertices,sizeof(int),1,output); fwrite(&Wmo_nVertices, sizeof(int), 1, output);
fclose(output); fclose(output);
// Delete the extracted file in the case of an error // Delete the extracted file in the case of an error
@ -405,22 +407,23 @@ void ParsMapFiles()
char fn[512]; char fn[512];
//char id_filename[64]; //char id_filename[64];
char id[10]; char id[10];
for (unsigned int i=0; i<map_count; ++i) StringSet failedPaths;
for (unsigned int i = 0; i < map_count; ++i)
{ {
sprintf(id,"%03u",map_ids[i].id); sprintf(id, "%03u", map_ids[i].id);
sprintf(fn,"World\\Maps\\%s\\%s.wdt", map_ids[i].name, map_ids[i].name); sprintf(fn, "World\\Maps\\%s\\%s.wdt", map_ids[i].name, map_ids[i].name);
WDTFile WDT(fn,map_ids[i].name); WDTFile WDT(fn, map_ids[i].name);
if(WDT.init(id, map_ids[i].id)) if (WDT.init(id, map_ids[i].id))
{ {
printf("Processing Map %u\n[", map_ids[i].id); printf("Processing Map %u\n[", map_ids[i].id);
for (int x=0; x<64; ++x) for (int x = 0; x < 64; ++x)
{ {
for (int y=0; y<64; ++y) for (int y = 0; y < 64; ++y)
{ {
if (ADTFile *ADT = WDT.GetMap(x,y)) if (ADTFile* ADT = WDT.GetMap(x, y))
{ {
//sprintf(id_filename,"%02u %02u %03u",x,y,map_ids[i].id);//!!!!!!!!! //sprintf(id_filename,"%02u %02u %03u",x,y,map_ids[i].id);//!!!!!!!!!
ADT->init(map_ids[i].id, x, y); ADT->init(map_ids[i].id, x, y, failedPaths);
delete ADT; delete ADT;
} }
} }
@ -430,14 +433,22 @@ void ParsMapFiles()
printf("]\n"); printf("]\n");
} }
} }
if (!failedPaths.empty())
{
printf("Warning: Some models could not be extracted, see below\n");
for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
printf("Could not find file of model %s\n", itr->c_str());
printf("A few not found models can be expected and are not alarming.\n");
}
} }
void getGamePath() void getGamePath()
{ {
#ifdef _WIN32 #ifdef _WIN32
strcpy(input_path,"Data\\"); strcpy(input_path, "Data\\");
#else #else
strcpy(input_path,"Data/"); strcpy(input_path, "Data/");
#endif #endif
} }
@ -457,9 +468,9 @@ bool scan_patches(char* scanmatch, std::vector<std::string>& pArchiveNames)
sprintf(path, "%s.MPQ", scanmatch); sprintf(path, "%s.MPQ", scanmatch);
} }
#ifdef __linux__ #ifdef __linux__
if(FILE* h = fopen64(path, "rb")) if (FILE* h = fopen64(path, "rb"))
#else #else
if(FILE* h = fopen(path, "rb")) if (FILE* h = fopen(path, "rb"))
#endif #endif
{ {
fclose(h); fclose(h);
@ -471,24 +482,24 @@ bool scan_patches(char* scanmatch, std::vector<std::string>& pArchiveNames)
return(true); return(true);
} }
bool processArgv(int argc, char ** argv, const char *versionString) bool processArgv(int argc, char** argv)
{ {
bool result = true; bool result = true;
bool hasInputPathParam = false; bool hasInputPathParam = false;
bool preciseVectorData = false; bool preciseVectorData = false;
for(int i=1; i< argc; ++i) for (int i = 1; i < argc; ++i)
{ {
if(strcmp("-s",argv[i]) == 0) if (strcmp("-s", argv[i]) == 0)
{ {
preciseVectorData = false; preciseVectorData = false;
} }
else if(strcmp("-d",argv[i]) == 0) else if (strcmp("-d", argv[i]) == 0)
{ {
if((i+1)<argc) if ((i + 1) < argc)
{ {
hasInputPathParam = true; hasInputPathParam = true;
strcpy(input_path, argv[i+1]); strcpy(input_path, argv[i + 1]);
if (input_path[strlen(input_path) - 1] != '\\' || input_path[strlen(input_path) - 1] != '/') if (input_path[strlen(input_path) - 1] != '\\' || input_path[strlen(input_path) - 1] != '/')
strcat(input_path, "/"); strcat(input_path, "/");
++i; ++i;
@ -498,15 +509,15 @@ bool processArgv(int argc, char ** argv, const char *versionString)
result = false; result = false;
} }
} }
else if(strcmp("-?",argv[1]) == 0) else if (strcmp("-?", argv[1]) == 0)
{ {
result = false; result = false;
} }
else if(strcmp("-l",argv[i]) == 0) else if (strcmp("-l", argv[i]) == 0)
{ {
preciseVectorData = true; preciseVectorData = true;
} }
else if(strcmp("-b",argv[i]) == 0) else if (strcmp("-b", argv[i]) == 0)
{ {
if (i + 1 < argc) // all ok if (i + 1 < argc) // all ok
CONF_TargetBuild = atoi(argv[i++ + 1]); CONF_TargetBuild = atoi(argv[i++ + 1]);
@ -518,9 +529,9 @@ bool processArgv(int argc, char ** argv, const char *versionString)
} }
} }
if(!result) if (!result)
{ {
printf("Extract %s.\n",versionString); printf("Extract for %s.\n", szRawVMAPMagic);
printf("%s [-?][-s][-l][-d <path>]\n", argv[0]); printf("%s [-?][-s][-l][-d <path>]\n", argv[0]);
printf(" -s : (default) small size (data size optimization), ~500MB less vmap data.\n"); printf(" -s : (default) small size (data size optimization), ~500MB less vmap data.\n");
printf(" -l : large size, ~500MB more vmap data. (might contain more details)\n"); printf(" -l : large size, ~500MB more vmap data. (might contain more details)\n");
@ -529,7 +540,7 @@ bool processArgv(int argc, char ** argv, const char *versionString)
printf(" -? : This message.\n"); printf(" -? : This message.\n");
} }
if(!hasInputPathParam) if (!hasInputPathParam)
getGamePath(); getGamePath();
return result; return result;
@ -545,13 +556,12 @@ bool processArgv(int argc, char ** argv, const char *versionString)
// Arg2 - Listfile name // Arg2 - Listfile name
// //
int main(int argc, char ** argv) int main(int argc, char** argv)
{ {
bool success=true; bool success = true;
const char *versionString = "V4.00 2012_08";
// Use command line arguments, when some // Use command line arguments, when some
if(!processArgv(argc, argv, versionString)) if (!processArgv(argc, argv))
return 1; return 1;
// some simple check if working dir is dirty // some simple check if working dir is dirty
@ -570,15 +580,15 @@ int main(int argc, char ** argv)
} }
} }
printf("Extract %s. Beginning work ....\n",versionString); printf("Extract for %s. Beginning work ....\n", szRawVMAPMagic);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Create the working directory // Create the working directory
if(mkdir(szWorkDirWmo if (mkdir(szWorkDirWmo
#ifdef __linux__ #ifdef __linux__
, 0711 , 0711
#endif #endif
)) ))
success = (errno == EEXIST); success = (errno == EEXIST);
LoadCommonMPQFiles(CONF_TargetBuild); LoadCommonMPQFiles(CONF_TargetBuild);
@ -601,27 +611,27 @@ int main(int argc, char ** argv)
ReadLiquidTypeTableDBC(); ReadLiquidTypeTableDBC();
// extract data // extract data
if(success) if (success)
success = ExtractWmo(); success = ExtractWmo();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//map.dbc //map.dbc
if(success) if (success)
{ {
DBCFile * dbc = new DBCFile(LocaleMpq, "DBFilesClient\\Map.dbc"); DBCFile* dbc = new DBCFile(LocaleMpq, "DBFilesClient\\Map.dbc");
if(!dbc->open()) if (!dbc->open())
{ {
delete dbc; delete dbc;
printf("FATAL ERROR: Map.dbc not found in data file.\n"); printf("FATAL ERROR: Map.dbc not found in data file.\n");
return 1; return 1;
} }
map_count=dbc->getRecordCount (); map_count = dbc->getRecordCount();
map_ids=new map_id[map_count]; map_ids = new map_id[map_count];
for(unsigned int x=0;x<map_count;++x) for (unsigned int x = 0; x < map_count; ++x)
{ {
map_ids[x].id=dbc->getRecord (x).getUInt(0); map_ids[x].id = dbc->getRecord(x).getUInt(0);
strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); strcpy(map_ids[x].name, dbc->getRecord(x).getString(1));
printf("Map - %s\n",map_ids[x].name); printf("Map - %s\n", map_ids[x].name);
} }
@ -629,19 +639,21 @@ int main(int argc, char ** argv)
ParsMapFiles(); ParsMapFiles();
delete [] map_ids; delete [] map_ids;
//nError = ERROR_SUCCESS; //nError = ERROR_SUCCESS;
// Extract models, listed in DameObjectDisplayInfo.dbc
ExtractGameobjectModels();
} }
SFileCloseArchive(LocaleMpq); SFileCloseArchive(LocaleMpq);
SFileCloseArchive(WorldMpq); SFileCloseArchive(WorldMpq);
printf("\n"); printf("\n");
if(!success) if (!success)
{ {
printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); printf("ERROR: Extract for %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n", szRawVMAPMagic, preciseVectorData);
getchar(); getchar();
} }
printf("Extract %s. Work complete. No errors.\n",versionString); printf("Extract for %s. Work complete. No errors.\n", szRawVMAPMagic);
delete [] LiqType; delete [] LiqType;
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -20,20 +20,26 @@
#define VMAPEXPORT_H #define VMAPEXPORT_H
#include <string> #include <string>
#include <set>
typedef std::set<std::string> StringSet;
enum ModelFlags enum ModelFlags
{ {
MOD_M2 = 1, MOD_M2 = 1,
MOD_WORLDSPAWN = 1<<1, MOD_WORLDSPAWN = 1 << 1,
MOD_HAS_BOUND = 1<<2 MOD_HAS_BOUND = 1 << 2
}; };
extern const char * szWorkDirWmo; extern const char* szWorkDirWmo;
extern const char * szRawVMAPMagic; // vmap magic string for extracted raw vmap data extern const char* szRawVMAPMagic; // vmap magic string for extracted raw vmap data
bool FileExists(const char * file); bool FileExists(const char* file);
void strToLower(char* str); void strToLower(char* str);
bool ExtractSingleWmo(std::string& fname); bool ExtractSingleWmo(std::string& fname);
bool ExtractSingleModel(std::string& fname, StringSet& failedPaths);
void ExtractGameobjectModels();
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,23 +22,23 @@
#include "adtfile.h" #include "adtfile.h"
#include <cstdio> #include <cstdio>
char * wdtGetPlainName(char * FileName) char* wdtGetPlainName(char* FileName)
{ {
char * szTemp; char* szTemp;
if((szTemp = strrchr(FileName, '\\')) != NULL) if ((szTemp = strrchr(FileName, '\\')) != NULL)
FileName = szTemp + 1; FileName = szTemp + 1;
return FileName; return FileName;
} }
extern HANDLE WorldMpq; extern HANDLE WorldMpq;
WDTFile::WDTFile(char* file_name, char* file_name1):WDT(WorldMpq, file_name) WDTFile::WDTFile(char* file_name, char* file_name1): WDT(WorldMpq, file_name)
{ {
filename.append(file_name1,strlen(file_name1)); filename.append(file_name1, strlen(file_name1));
} }
bool WDTFile::init(char *map_id, unsigned int mapID) bool WDTFile::init(char* map_id, unsigned int mapID)
{ {
if (WDT.isEof()) if (WDT.isEof())
{ {
@ -50,9 +50,9 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
uint32 size; uint32 size;
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin"; std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
FILE *dirfile; FILE* dirfile;
dirfile = fopen(dirname.c_str(), "ab"); dirfile = fopen(dirname.c_str(), "ab");
if(!dirfile) if (!dirfile)
{ {
printf("Can't open dirfile!'%s'\n", dirname.c_str()); printf("Can't open dirfile!'%s'\n", dirname.c_str());
return false; return false;
@ -60,7 +60,7 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
while (!WDT.isEof()) while (!WDT.isEof())
{ {
WDT.read(fourcc,4); WDT.read(fourcc, 4);
WDT.read(&size, 4); WDT.read(&size, 4);
flipcc(fourcc); flipcc(fourcc);
@ -68,31 +68,31 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
size_t nextpos = WDT.getPos() + size; size_t nextpos = WDT.getPos() + size;
if (!strcmp(fourcc,"MAIN")) if (!strcmp(fourcc, "MAIN"))
{ {
} }
if (!strcmp(fourcc,"MWMO")) if (!strcmp(fourcc, "MWMO"))
{ {
// global map objects // global map objects
if (size) if (size)
{ {
char *buf = new char[size]; char* buf = new char[size];
WDT.read(buf, size); WDT.read(buf, size);
char *p=buf; char* p = buf;
int q = 0; int q = 0;
gWmoInstansName = new string[size]; gWmoInstansName = new string[size];
while (p<buf+size) while (p < buf + size)
{ {
string path(p); string path(p);
char* s=wdtGetPlainName(p); char* s = wdtGetPlainName(p);
fixnamen(s,strlen(s)); fixnamen(s, strlen(s));
p=p+strlen(p)+1; p = p + strlen(p) + 1;
gWmoInstansName[q++] = s; gWmoInstansName[q++] = s;
} }
delete[] buf; delete[] buf;
} }
} }
else if (!strcmp(fourcc,"MODF")) else if (!strcmp(fourcc, "MODF"))
{ {
// global wmo instance data // global wmo instance data
if (size) if (size)
@ -103,11 +103,11 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
fake_mapname = "65 65 "; fake_mapname = "65 65 ";
//gWMO_mapname = fake_mapname + filename; //gWMO_mapname = fake_mapname + filename;
gWMO_mapname = fake_mapname + std::string(map_id); gWMO_mapname = fake_mapname + std::string(map_id);
for (int i=0; i<gnWMO; ++i) for (int i = 0; i < gnWMO; ++i)
{ {
int id; int id;
WDT.read(&id, 4); WDT.read(&id, 4);
WMOInstance inst(WDT,gWmoInstansName[id].c_str(),mapID, 65, 65, dirfile); WMOInstance inst(WDT, gWmoInstansName[id].c_str(), mapID, 65, 65, dirfile);
} }
delete[] gWmoInstansName; delete[] gWmoInstansName;
} }
@ -127,11 +127,11 @@ WDTFile::~WDTFile(void)
ADTFile* WDTFile::GetMap(int x, int z) ADTFile* WDTFile::GetMap(int x, int z)
{ {
if(!(x>=0 && z >= 0 && x<64 && z<64)) if (!(x >= 0 && z >= 0 && x < 64 && z < 64))
return NULL; return NULL;
char name[512]; char name[512];
sprintf(name,"World\\Maps\\%s\\%s_%d_%d_obj0.adt", filename.c_str(), filename.c_str(), x, z); sprintf(name, "World\\Maps\\%s\\%s_%d_%d_obj0.adt", filename.c_str(), filename.c_str(), x, z);
return new ADTFile(name); return new ADTFile(name);
} }

View file

@ -0,0 +1,47 @@
/*
* This file is part of the Continued-MaNGOS Project
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WDTFILE_H
#define WDTFILE_H
#include "mpqfile.h"
#include "wmo.h"
#include <string>
#include "stdlib.h"
class ADTFile;
class WDTFile
{
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
bool init(char* map_id, unsigned int mapID);
string* gWmoInstansName;
int gnWMO, nMaps;
ADTFile* GetMap(int x, int z);
private:
MPQFile WDT;
bool maps[64][64];
string filename;
};
#endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,9 +31,9 @@
#include "mpqfile.h" #include "mpqfile.h"
using namespace std; using namespace std;
extern uint16 *LiqType; extern uint16* LiqType;
WMORoot::WMORoot(std::string &filename) : filename(filename) WMORoot::WMORoot(std::string& filename) : filename(filename)
{ {
} }
@ -42,9 +42,9 @@ extern HANDLE WorldMpq;
bool WMORoot::open() bool WMORoot::open()
{ {
MPQFile f(WorldMpq, filename.c_str()); MPQFile f(WorldMpq, filename.c_str());
if(f.isEof ()) if (f.isEof())
{ {
printf("No such file.\n"); printf("No such file %s.\n", filename.c_str());
return false; return false;
} }
@ -53,7 +53,7 @@ bool WMORoot::open()
while (!f.isEof()) while (!f.isEof())
{ {
f.read(fourcc,4); f.read(fourcc, 4);
f.read(&size, 4); f.read(&size, 4);
flipcc(fourcc); flipcc(fourcc);
@ -61,7 +61,7 @@ bool WMORoot::open()
size_t nextpos = f.getPos() + size; size_t nextpos = f.getPos() + size;
if (!strcmp(fourcc,"MOHD"))//header if (!strcmp(fourcc, "MOHD")) //header
{ {
f.read(&nTextures, 4); f.read(&nTextures, 4);
f.read(&nGroups, 4); f.read(&nGroups, 4);
@ -72,8 +72,8 @@ bool WMORoot::open()
f.read(&nDoodadSets, 4); f.read(&nDoodadSets, 4);
f.read(&col, 4); f.read(&col, 4);
f.read(&RootWMOID, 4); f.read(&RootWMOID, 4);
f.read(bbcorn1,12); f.read(bbcorn1, 12);
f.read(bbcorn2,12); f.read(bbcorn2, 12);
f.read(&liquidType, 4); f.read(&liquidType, 4);
break; break;
} }
@ -120,19 +120,19 @@ bool WMORoot::open()
*/ */
f.seek((int)nextpos); f.seek((int)nextpos);
} }
f.close (); f.close();
return true; return true;
} }
bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile) bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
{ {
//printf("Convert RootWmo...\n"); //printf("Convert RootWmo...\n");
fwrite(szRawVMAPMagic,1,8,pOutfile); fwrite(szRawVMAPMagic, 1, 8, pOutfile);
unsigned int nVectors = 0; unsigned int nVectors = 0;
fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later fwrite(&nVectors, sizeof(nVectors), 1, pOutfile); // will be filled later
fwrite(&nGroups,4,1,pOutfile); fwrite(&nGroups, 4, 1, pOutfile);
fwrite(&RootWMOID,4,1,pOutfile); fwrite(&RootWMOID, 4, 1, pOutfile);
return true; return true;
} }
@ -140,15 +140,15 @@ WMORoot::~WMORoot()
{ {
} }
WMOGroup::WMOGroup(std::string &filename) : filename(filename), WMOGroup::WMOGroup(std::string& filename) : filename(filename),
MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0) MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0)
{ {
} }
bool WMOGroup::open() bool WMOGroup::open()
{ {
MPQFile f(WorldMpq, filename.c_str()); MPQFile f(WorldMpq, filename.c_str());
if(f.isEof ()) if (f.isEof())
{ {
printf("No such file.\n"); printf("No such file.\n");
return false; return false;
@ -157,10 +157,10 @@ bool WMOGroup::open()
char fourcc[5]; char fourcc[5];
while (!f.isEof()) while (!f.isEof())
{ {
f.read(fourcc,4); f.read(fourcc, 4);
f.read(&size, 4); f.read(&size, 4);
flipcc(fourcc); flipcc(fourcc);
if (!strcmp(fourcc,"MOGP"))//Fix sizeoff = Data size. if (!strcmp(fourcc, "MOGP")) //Fix sizeoff = Data size.
{ {
size = 68; size = 68;
} }
@ -169,7 +169,7 @@ bool WMOGroup::open()
LiquEx_size = 0; LiquEx_size = 0;
liquflags = 0; liquflags = 0;
if (!strcmp(fourcc,"MOGP"))//header if (!strcmp(fourcc, "MOGP")) //header
{ {
f.read(&groupName, 4); f.read(&groupName, 4);
f.read(&descGroupName, 4); f.read(&descGroupName, 4);
@ -183,40 +183,39 @@ bool WMOGroup::open()
f.read(&nBatchC, 4); f.read(&nBatchC, 4);
f.read(&fogIdx, 4); f.read(&fogIdx, 4);
f.read(&liquidType, 4); f.read(&liquidType, 4);
f.read(&groupWMOID,4); f.read(&groupWMOID, 4);
} }
else if (!strcmp(fourcc,"MOPY")) else if (!strcmp(fourcc, "MOPY"))
{ {
MOPY = new char[size]; MOPY = new char[size];
mopy_size = size; mopy_size = size;
nTriangles = (int)size / 2; nTriangles = (int)size / 2;
f.read(MOPY, size); f.read(MOPY, size);
} }
else if (!strcmp(fourcc,"MOVI")) else if (!strcmp(fourcc, "MOVI"))
{ {
MOVI = new uint16[size/2]; MOVI = new uint16[size / 2];
f.read(MOVI, size); f.read(MOVI, size);
} }
else if (!strcmp(fourcc,"MOVT")) else if (!strcmp(fourcc, "MOVT"))
{ {
MOVT = new float[size/4]; MOVT = new float[size / 4];
f.read(MOVT, size); f.read(MOVT, size);
nVertices = (int)size / 12; nVertices = (int)size / 12;
} }
else if (!strcmp(fourcc,"MONR")) else if (!strcmp(fourcc, "MONR"))
{ {
} }
else if (!strcmp(fourcc,"MOTV")) else if (!strcmp(fourcc, "MOTV"))
{ {
} }
else if (!strcmp(fourcc,"MOBA")) else if (!strcmp(fourcc, "MOBA"))
{ {
MOBA = new uint16[size/2]; MOBA = new uint16[size / 2];
moba_size = size/2; moba_size = size / 2;
f.read(MOBA, size); f.read(MOBA, size);
} }
else if (!strcmp(fourcc,"MLIQ")) else if (!strcmp(fourcc, "MLIQ"))
{ {
liquflags |= 1; liquflags |= 1;
hlq = new WMOLiquidHeader; hlq = new WMOLiquidHeader;
@ -241,79 +240,79 @@ bool WMOGroup::open()
return true; return true;
} }
int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData) int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool pPreciseVectorData)
{ {
fwrite(&mogpFlags,sizeof(uint32),1,output); fwrite(&mogpFlags, sizeof(uint32), 1, output);
fwrite(&groupWMOID,sizeof(uint32),1,output); fwrite(&groupWMOID, sizeof(uint32), 1, output);
// group bound // group bound
fwrite(bbcorn1, sizeof(float), 3, output); fwrite(bbcorn1, sizeof(float), 3, output);
fwrite(bbcorn2, sizeof(float), 3, output); fwrite(bbcorn2, sizeof(float), 3, output);
fwrite(&liquflags,sizeof(uint32),1,output); fwrite(&liquflags, sizeof(uint32), 1, output);
int nColTriangles = 0; int nColTriangles = 0;
if(pPreciseVectorData) if (pPreciseVectorData)
{ {
char GRP[] = "GRP "; char GRP[] = "GRP ";
fwrite(GRP,1,4,output); fwrite(GRP, 1, 4, output);
int k = 0; int k = 0;
int moba_batch = moba_size/12; int moba_batch = moba_size / 12;
MobaEx = new int[moba_batch*4]; MobaEx = new int[moba_batch * 4];
for(int i=8; i<moba_size; i+=12) for (int i = 8; i < moba_size; i += 12)
{ {
MobaEx[k++] = MOBA[i]; MobaEx[k++] = MOBA[i];
} }
int moba_size_grp = moba_batch*4+4; int moba_size_grp = moba_batch * 4 + 4;
fwrite(&moba_size_grp,4,1,output); fwrite(&moba_size_grp, 4, 1, output);
fwrite(&moba_batch,4,1,output); fwrite(&moba_batch, 4, 1, output);
fwrite(MobaEx,4,k,output); fwrite(MobaEx, 4, k, output);
delete [] MobaEx; delete [] MobaEx;
uint32 nIdexes = nTriangles * 3; uint32 nIdexes = nTriangles * 3;
if(fwrite("INDX",4, 1, output) != 1) if (fwrite("INDX", 4, 1, output) != 1)
{ {
printf("Error while writing file nbraches ID"); printf("Error while writing file nbraches ID");
exit(0); exit(0);
} }
int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes; int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes;
if(fwrite(&wsize, sizeof(int), 1, output) != 1) if (fwrite(&wsize, sizeof(int), 1, output) != 1)
{ {
printf("Error while writing file wsize"); printf("Error while writing file wsize");
// no need to exit? // no need to exit?
} }
if(fwrite(&nIdexes, sizeof(uint32), 1, output) != 1) if (fwrite(&nIdexes, sizeof(uint32), 1, output) != 1)
{ {
printf("Error while writing file nIndexes"); printf("Error while writing file nIndexes");
exit(0); exit(0);
} }
if(nIdexes >0) if (nIdexes > 0)
{ {
if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes) if (fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes)
{ {
printf("Error while writing file indexarray"); printf("Error while writing file indexarray");
exit(0); exit(0);
} }
} }
if(fwrite("VERT",4, 1, output) != 1) if (fwrite("VERT", 4, 1, output) != 1)
{ {
printf("Error while writing file nbraches ID"); printf("Error while writing file nbraches ID");
exit(0); exit(0);
} }
wsize = sizeof(int) + sizeof(float) * 3 * nVertices; wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
if(fwrite(&wsize, sizeof(int), 1, output) != 1) if (fwrite(&wsize, sizeof(int), 1, output) != 1)
{ {
printf("Error while writing file wsize"); printf("Error while writing file wsize");
// no need to exit? // no need to exit?
} }
if(fwrite(&nVertices, sizeof(int), 1, output) != 1) if (fwrite(&nVertices, sizeof(int), 1, output) != 1)
{ {
printf("Error while writing file nVertices"); printf("Error while writing file nVertices");
exit(0); exit(0);
} }
if(nVertices >0) if (nVertices > 0)
{ {
if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices) if (fwrite(MOVT, sizeof(float) * 3, nVertices, output) != nVertices)
{ {
printf("Error while writing file vectors"); printf("Error while writing file vectors");
exit(0); exit(0);
@ -325,44 +324,44 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
else else
{ {
char GRP[] = "GRP "; char GRP[] = "GRP ";
fwrite(GRP,1,4,output); fwrite(GRP, 1, 4, output);
int k = 0; int k = 0;
int moba_batch = moba_size/12; int moba_batch = moba_size / 12;
MobaEx = new int[moba_batch*4]; MobaEx = new int[moba_batch * 4];
for(int i=8; i<moba_size; i+=12) for (int i = 8; i < moba_size; i += 12)
{ {
MobaEx[k++] = MOBA[i]; MobaEx[k++] = MOBA[i];
} }
int moba_size_grp = moba_batch*4+4; int moba_size_grp = moba_batch * 4 + 4;
fwrite(&moba_size_grp,4,1,output); fwrite(&moba_size_grp, 4, 1, output);
fwrite(&moba_batch,4,1,output); fwrite(&moba_batch, 4, 1, output);
fwrite(MobaEx,4,k,output); fwrite(MobaEx, 4, k, output);
delete [] MobaEx; delete [] MobaEx;
//-------INDX------------------------------------ //-------INDX------------------------------------
//-------MOPY-------- //-------MOPY--------
MoviEx = new uint16[nTriangles*3]; // "worst case" size... MoviEx = new uint16[nTriangles * 3]; // "worst case" size...
int *IndexRenum = new int[nVertices]; int* IndexRenum = new int[nVertices];
memset(IndexRenum, 0xFF, nVertices*sizeof(int)); memset(IndexRenum, 0xFF, nVertices * sizeof(int));
for (int i=0; i<nTriangles; ++i) for (int i = 0; i < nTriangles; ++i)
{ {
// Skip no collision triangles // Skip no collision triangles
if (MOPY[2*i]&WMO_MATERIAL_NO_COLLISION || if (MOPY[2 * i]&WMO_MATERIAL_NO_COLLISION ||
!(MOPY[2*i]&(WMO_MATERIAL_HINT|WMO_MATERIAL_COLLIDE_HIT)) ) !(MOPY[2 * i] & (WMO_MATERIAL_HINT | WMO_MATERIAL_COLLIDE_HIT)))
continue; continue;
// Use this triangle // Use this triangle
for (int j=0; j<3; ++j) for (int j = 0; j < 3; ++j)
{ {
IndexRenum[MOVI[3*i + j]] = 1; IndexRenum[MOVI[3 * i + j]] = 1;
MoviEx[3*nColTriangles + j] = MOVI[3*i + j]; MoviEx[3 * nColTriangles + j] = MOVI[3 * i + j];
} }
++nColTriangles; ++nColTriangles;
} }
// assign new vertex index numbers // assign new vertex index numbers
int nColVertices = 0; int nColVertices = 0;
for (uint32 i=0; i<nVertices; ++i) for (uint32 i = 0; i < nVertices; ++i)
{ {
if (IndexRenum[i] == 1) if (IndexRenum[i] == 1)
{ {
@ -372,35 +371,35 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
} }
// translate triangle indices to new numbers // translate triangle indices to new numbers
for (int i=0; i<3*nColTriangles; ++i) for (int i = 0; i < 3 * nColTriangles; ++i)
{ {
assert(MoviEx[i] < nVertices); assert(MoviEx[i] < nVertices);
MoviEx[i] = IndexRenum[MoviEx[i]]; MoviEx[i] = IndexRenum[MoviEx[i]];
} }
// write triangle indices // write triangle indices
int INDX[] = {0x58444E49, nColTriangles*6+4, nColTriangles*3}; int INDX[] = {0x58444E49, nColTriangles * 6 + 4, nColTriangles * 3};
fwrite(INDX,4,3,output); fwrite(INDX, 4, 3, output);
fwrite(MoviEx,2,nColTriangles*3,output); fwrite(MoviEx, 2, nColTriangles * 3, output);
// write vertices // write vertices
int VERT[] = {0x54524556, nColVertices*3*sizeof(float)+4, nColVertices};// "VERT" int VERT[] = {0x54524556, nColVertices * 3 * sizeof(float) + 4, nColVertices}; // "VERT"
int check = 3*nColVertices; int check = 3 * nColVertices;
fwrite(VERT,4,3,output); fwrite(VERT, 4, 3, output);
for (uint32 i=0; i<nVertices; ++i) for (uint32 i = 0; i < nVertices; ++i)
if(IndexRenum[i] >= 0) if (IndexRenum[i] >= 0)
check -= fwrite(MOVT+3*i, sizeof(float), 3, output); check -= fwrite(MOVT + 3 * i, sizeof(float), 3, output);
assert(check==0); assert(check == 0);
delete [] MoviEx; delete [] MoviEx;
delete [] IndexRenum; delete [] IndexRenum;
} }
//------LIQU------------------------ //------LIQU------------------------
if(LiquEx_size != 0) if (LiquEx_size != 0)
{ {
int LIQU_h[] = {0x5551494C, sizeof(WMOLiquidHeader) + LiquEx_size + hlq->xtiles*hlq->ytiles};// "LIQU" int LIQU_h[] = {0x5551494C, sizeof(WMOLiquidHeader) + LiquEx_size + hlq->xtiles* hlq->ytiles}; // "LIQU"
fwrite(LIQU_h, 4, 2, output); fwrite(LIQU_h, 4, 2, output);
// according to WoW.Dev Wiki: // according to WoW.Dev Wiki:
@ -463,10 +462,10 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
fwrite(hlq, sizeof(WMOLiquidHeader), 1, output); fwrite(hlq, sizeof(WMOLiquidHeader), 1, output);
// only need height values, the other values are unknown anyway // only need height values, the other values are unknown anyway
for (uint32 i = 0; i<LiquEx_size/sizeof(WMOLiquidVert); ++i) for (uint32 i = 0; i < LiquEx_size / sizeof(WMOLiquidVert); ++i)
fwrite(&LiquEx[i].height, sizeof(float), 1, output); fwrite(&LiquEx[i].height, sizeof(float), 1, output);
// todo: compress to bit field // todo: compress to bit field
fwrite(LiquBytes, 1, hlq->xtiles*hlq->ytiles, output); fwrite(LiquBytes, 1, hlq->xtiles * hlq->ytiles, output);
} }
return nColTriangles; return nColTriangles;
@ -483,34 +482,34 @@ WMOGroup::~WMOGroup()
delete [] LiquBytes; delete [] LiquBytes;
} }
WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile) WMOInstance::WMOInstance(MPQFile& f, const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
{ {
pos = Vec3D(0,0,0); pos = Vec3D(0, 0, 0);
float ff[3]; float ff[3];
f.read(&id, 4); f.read(&id, 4);
f.read(ff,12); f.read(ff, 12);
pos = Vec3D(ff[0],ff[1],ff[2]); pos = Vec3D(ff[0], ff[1], ff[2]);
f.read(ff,12); f.read(ff, 12);
rot = Vec3D(ff[0],ff[1],ff[2]); rot = Vec3D(ff[0], ff[1], ff[2]);
f.read(ff,12); f.read(ff, 12);
pos2 = Vec3D(ff[0],ff[1],ff[2]); pos2 = Vec3D(ff[0], ff[1], ff[2]);
f.read(ff,12); f.read(ff, 12);
pos3 = Vec3D(ff[0],ff[1],ff[2]); pos3 = Vec3D(ff[0], ff[1], ff[2]);
f.read(&d2,4); f.read(&d2, 4);
uint16 trash,adtId; uint16 trash, adtId;
f.read(&adtId,2); f.read(&adtId, 2);
f.read(&trash,2); f.read(&trash, 2);
//-----------add_in _dir_file---------------- //-----------add_in _dir_file----------------
char tempname[512]; char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, WmoInstName); sprintf(tempname, "%s/%s", szWorkDirWmo, WmoInstName);
FILE *input; FILE* input;
input = fopen(tempname, "r+b"); input = fopen(tempname, "r+b");
if(!input) if (!input)
{ {
printf("WMOInstance::WMOInstance: couldn't open %s\n", tempname); printf("WMOInstance::WMOInstance: couldn't open %s\n", tempname);
return; return;
@ -518,19 +517,19 @@ WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint3
fseek(input, 8, SEEK_SET); // get the correct no of vertices fseek(input, 8, SEEK_SET); // get the correct no of vertices
int nVertices; int nVertices;
fread(&nVertices, sizeof (int), 1, input); fread(&nVertices, sizeof(int), 1, input);
fclose(input); fclose(input);
if(nVertices == 0) if (nVertices == 0)
return; return;
float x,z; float x, z;
x = pos.x; x = pos.x;
z = pos.z; z = pos.z;
if(x==0 && z == 0) if (x == 0 && z == 0)
{ {
pos.x = 533.33333f*32; pos.x = 533.33333f * 32;
pos.z = 533.33333f*32; pos.z = 533.33333f * 32;
} }
pos = fixCoords(pos); pos = fixCoords(pos);
pos2 = fixCoords(pos2); pos2 = fixCoords(pos2);
@ -538,7 +537,7 @@ WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint3
float scale = 1.0f; float scale = 1.0f;
uint32 flags = MOD_HAS_BOUND; uint32 flags = MOD_HAS_BOUND;
if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; if (tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name //write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
fwrite(&mapID, sizeof(uint32), 1, pDirfile); fwrite(&mapID, sizeof(uint32), 1, pDirfile);
fwrite(&tileX, sizeof(uint32), 1, pDirfile); fwrite(&tileX, sizeof(uint32), 1, pDirfile);
@ -551,7 +550,7 @@ WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint3
fwrite(&scale, sizeof(float), 1, pDirfile); fwrite(&scale, sizeof(float), 1, pDirfile);
fwrite(&pos2, sizeof(float), 3, pDirfile); fwrite(&pos2, sizeof(float), 3, pDirfile);
fwrite(&pos3, sizeof(float), 3, pDirfile); fwrite(&pos3, sizeof(float), 3, pDirfile);
uint32 nlen=strlen(WmoInstName); uint32 nlen = strlen(WmoInstName);
fwrite(&nlen, sizeof(uint32), 1, pDirfile); fwrite(&nlen, sizeof(uint32), 1, pDirfile);
fwrite(WmoInstName, sizeof(char), nlen, pDirfile); fwrite(WmoInstName, sizeof(char), nlen, pDirfile);

View file

@ -0,0 +1,136 @@
/*
* This file is part of the Continued-MaNGOS Project
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WMO_H
#define WMO_H
#define TILESIZE (533.33333f)
#define CHUNKSIZE ((TILESIZE) / 16.0f)
#include <string>
#include <set>
#include "vec3d.h"
#include "mpqfile.h"
// MOPY flags
#define WMO_MATERIAL_NOCAMCOLLIDE 0x01
#define WMO_MATERIAL_DETAIL 0x02
#define WMO_MATERIAL_NO_COLLISION 0x04
#define WMO_MATERIAL_HINT 0x08
#define WMO_MATERIAL_RENDER 0x10
#define WMO_MATERIAL_COLLIDE_HIT 0x20
#define WMO_MATERIAL_WALL_SURFACE 0x40
class WMOInstance;
class WMOManager;
class MPQFile;
/* for whatever reason a certain company just can't stick to one coordinate system... */
static inline Vec3D fixCoords(const Vec3D& v) { return Vec3D(v.z, v.x, v.y); }
class WMORoot
{
public:
uint32 nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, RootWMOID, liquidType;
unsigned int col;
float bbcorn1[3];
float bbcorn2[3];
WMORoot(std::string& filename);
~WMORoot();
bool open();
bool ConvertToVMAPRootWmo(FILE* output);
private:
std::string filename;
char outfilename;
};
struct WMOLiquidHeader
{
int xverts, yverts, xtiles, ytiles;
float pos_x;
float pos_y;
float pos_z;
short type;
};
struct WMOLiquidVert
{
uint16 unk1;
uint16 unk2;
float height;
};
class WMOGroup
{
public:
// MOGP
int groupName, descGroupName, mogpFlags;
float bbcorn1[3];
float bbcorn2[3];
uint16 moprIdx;
uint16 moprNItems;
uint16 nBatchA;
uint16 nBatchB;
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
int mopy_size, moba_size;
int LiquEx_size;
unsigned int nVertices; // number when loaded
int nTriangles; // number when loaded
char* MOPY;
uint16* MOVI;
uint16* MoviEx;
float* MOVT;
uint16* MOBA;
int* MobaEx;
WMOLiquidHeader* hlq;
WMOLiquidVert* LiquEx;
char* LiquBytes;
uint32 liquflags;
WMOGroup(std::string& filename);
~WMOGroup();
bool open();
int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool pPreciseVectorData);
private:
std::string filename;
char outfilename;
};
class WMOInstance
{
static std::set<int> ids;
public:
std::string MapName;
int currx;
int curry;
WMOGroup* wmo;
Vec3D pos;
Vec3D pos2, pos3, rot;
uint32 indx, id, d2, d3;
int doodadset;
WMOInstance(MPQFile& f, const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
static void reset();
};
#endif

View file

@ -12,7 +12,7 @@
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}</ProjectGuid> <ProjectGuid>{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}</ProjectGuid>
<RootNamespace>vmapExtractor4</RootNamespace> <RootNamespace>vmapExtractor</RootNamespace>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@ -86,6 +86,7 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\vmapextract\adtfile.cpp" /> <ClCompile Include="..\..\vmapextract\adtfile.cpp" />
<ClCompile Include="..\..\vmapextract\dbcfile.cpp" /> <ClCompile Include="..\..\vmapextract\dbcfile.cpp" />
<ClCompile Include="..\..\vmapextract\gameobject_extract.cpp" />
<ClCompile Include="..\..\vmapextract\model.cpp" /> <ClCompile Include="..\..\vmapextract\model.cpp" />
<ClCompile Include="..\..\vmapextract\mpqfile.cpp" /> <ClCompile Include="..\..\vmapextract\mpqfile.cpp" />
<ClCompile Include="..\..\vmapextract\vmapexport.cpp" /> <ClCompile Include="..\..\vmapextract\vmapexport.cpp" />

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}</ProjectGuid>
<RootNamespace>vmapExtractor</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\$(Platform)_$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\$(Platform)_$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\..\dep\StormLib\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\..\dep\StormLib\bin\StormLib\$(Platform)\$(Configuration)AD;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<TargetMachine>MachineX86</TargetMachine>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\..\..\dep\StormLib\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>StormLibRAD.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\..\dep\StormLib\bin\StormLib\$(Platform)\$(Configuration)AD;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\vmapextract\adtfile.cpp" />
<ClCompile Include="..\..\vmapextract\dbcfile.cpp" />
<ClCompile Include="..\..\vmapextract\gameobject_extract.cpp" />
<ClCompile Include="..\..\vmapextract\model.cpp" />
<ClCompile Include="..\..\vmapextract\mpqfile.cpp" />
<ClCompile Include="..\..\vmapextract\vmapexport.cpp" />
<ClCompile Include="..\..\vmapextract\wdtfile.cpp" />
<ClCompile Include="..\..\vmapextract\wmo.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\vmapextract\adtfile.h" />
<ClInclude Include="..\..\vmapextract\dbcfile.h" />
<ClInclude Include="..\..\vmapextract\model.h" />
<ClInclude Include="..\..\vmapextract\modelheaders.h" />
<ClInclude Include="..\..\vmapextract\mpqfile.h" />
<ClInclude Include="..\..\vmapextract\vec3d.h" />
<ClInclude Include="..\..\vmapextract\vmapexport.h" />
<ClInclude Include="..\..\vmapextract\wdtfile.h" />
<ClInclude Include="..\..\vmapextract\wmo.h" />
<ClInclude Include="..\..\vmapextract\loadlib\loadlib.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\vmapextract\adtfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\dbcfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\model.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\mpqfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\vmapexport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\wdtfile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\wmo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\vmapextract\gameobject_extract.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\vmapextract\dbcfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\adtfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\loadlib\loadlib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\model.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\mpqfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\modelheaders.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\vmapexport.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\vec3d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\wdtfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\vmapextract\wmo.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{77920bff-80f2-4d57-8efb-d36d461d04a4}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{093fdfc3-8861-4d64-9c5e-4a58337b9c7e}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View file

@ -183,6 +183,10 @@
RelativePath="..\..\vmapextract\dbcfile.h" RelativePath="..\..\vmapextract\dbcfile.h"
> >
</File> </File>
<File
RelativePath="..\..\vmapextract\gameobject_extract.cpp"
>
</File>
<File <File
RelativePath="..\..\vmapextract\model.cpp" RelativePath="..\..\vmapextract\model.cpp"
> >

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor4", "VC100\vmapExtractor4.vcxproj", "{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor", "VC100\vmapExtractor.vcxproj", "{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055} {78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055}
{B96F612A-C91D-43B3-A4C3-D4294817EC6C} = {B96F612A-C91D-43B3-A4C3-D4294817EC6C} {B96F612A-C91D-43B3-A4C3-D4294817EC6C} = {B96F612A-C91D-43B3-A4C3-D4294817EC6C}

View file

@ -0,0 +1,116 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor", "VC110\vmapExtractor.vcxproj", "{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}"
ProjectSection(ProjectDependencies) = postProject
{78424708-1F6E-4D4B-920C-FB6D26847055} = {78424708-1F6E-4D4B-920C-FB6D26847055}
{B96F612A-C91D-43B3-A4C3-D4294817EC6C} = {B96F612A-C91D-43B3-A4C3-D4294817EC6C}
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\..\..\win\VC110\zlib.vcxproj", "{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "..\..\..\win\VC110\bzip2.vcxproj", "{B96F612A-C91D-43B3-A4C3-D4294817EC6C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StormLib", "..\..\..\dep\StormLib\StormLib_vc110.vcxproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugAD|Win32 = DebugAD|Win32
DebugAD|x64 = DebugAD|x64
DebugAS|Win32 = DebugAS|Win32
DebugAS|x64 = DebugAS|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseAD|Win32 = ReleaseAD|Win32
ReleaseAD|x64 = ReleaseAD|x64
ReleaseAS|Win32 = ReleaseAS|Win32
ReleaseAS|x64 = ReleaseAS|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Debug|Win32.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Debug|Win32.Build.0 = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Debug|x64.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAD|Win32.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAD|Win32.Build.0 = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAD|x64.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAS|Win32.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAS|Win32.Build.0 = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.DebugAS|x64.ActiveCfg = Debug|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Release|Win32.ActiveCfg = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Release|Win32.Build.0 = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.Release|x64.ActiveCfg = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAD|Win32.ActiveCfg = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAD|Win32.Build.0 = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAD|x64.ActiveCfg = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAS|Win32.ActiveCfg = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAS|Win32.Build.0 = Release|Win32
{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}.ReleaseAS|x64.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.ActiveCfg = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|Win32.Build.0 = Debug|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.ActiveCfg = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Debug|x64.Build.0 = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAD|Win32.ActiveCfg = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAD|x64.ActiveCfg = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAD|x64.Build.0 = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAS|Win32.ActiveCfg = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAS|x64.ActiveCfg = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.DebugAS|x64.Build.0 = Debug|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.ActiveCfg = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|Win32.Build.0 = Release|Win32
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.ActiveCfg = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.Release|x64.Build.0 = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAD|Win32.ActiveCfg = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAD|x64.ActiveCfg = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAD|x64.Build.0 = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAS|Win32.ActiveCfg = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAS|x64.ActiveCfg = Release|x64
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}.ReleaseAS|x64.Build.0 = Release|x64
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Debug|Win32.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Debug|Win32.Build.0 = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Debug|x64.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAD|Win32.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAD|Win32.Build.0 = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAD|x64.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAS|Win32.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAS|Win32.Build.0 = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.DebugAS|x64.ActiveCfg = Debug|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Release|Win32.ActiveCfg = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Release|Win32.Build.0 = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.Release|x64.ActiveCfg = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAD|Win32.ActiveCfg = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAD|Win32.Build.0 = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAD|x64.ActiveCfg = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAS|Win32.ActiveCfg = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAS|Win32.Build.0 = Release|Win32
{B96F612A-C91D-43B3-A4C3-D4294817EC6C}.ReleaseAS|x64.ActiveCfg = Release|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|Win32.ActiveCfg = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|Win32.Build.0 = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|Win32.ActiveCfg = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|Win32.Build.0 = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|x64.ActiveCfg = DebugAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|x64.Build.0 = DebugAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|Win32.ActiveCfg = DebugAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|Win32.Build.0 = DebugAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|x64.ActiveCfg = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|x64.Build.0 = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|Win32.ActiveCfg = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|Win32.Build.0 = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|Win32.ActiveCfg = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|Win32.Build.0 = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|x64.ActiveCfg = ReleaseAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|x64.Build.0 = ReleaseAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|Win32.ActiveCfg = ReleaseAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|Win32.Build.0 = ReleaseAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|x64.ActiveCfg = ReleaseAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|x64.Build.0 = ReleaseAS|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor3", "VC90\vmapExtractor3.vcproj", "{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor", "VC90\vmapExtractor.vcproj", "{D4624B20-AC1E-4EE9-8C9C-0FB65EEE3393}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{B96F612A-C91D-43B3-A4C3-D4294817EC6C} = {B96F612A-C91D-43B3-A4C3-D4294817EC6C} {B96F612A-C91D-43B3-A4C3-D4294817EC6C} = {B96F612A-C91D-43B3-A4C3-D4294817EC6C}
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}

View file

@ -1,46 +0,0 @@
@echo off
cls
echo.
echo Welcome to the vmaps extractor and assembler
echo.
echo You need 2GB of free space in disk, CTRL+C to stop process
echo Hit Enter to start . . .
pause>nul
cls
echo.
echo.
echo.
IF EXIST buildings\dir (ECHO The buildings folder already exist do you want to delete it?
echo If YES hit Enter to continue if no CLOSE the program now! . . .
pause>nul
DEL /S /Q buildings)
vmapExtractor4.exe
cls
echo.
echo.
echo.
IF NOT %ERRORLEVEL% LEQ 1 (echo The vmap extract tool finalized with errors.
echo Hit Enter to continue . . .
pause>nul)
cls
echo.
echo.
echo.
echo Vmaps extracted check log.txt for errors, now it's time to assemble the vmaps press any key to continue . . .
pause>nul
md vmaps
vmap_assembler.exe buildings vmaps
cls
echo.
echo.
echo.
IF NOT %ERRORLEVEL% LEQ 1 (echo The vmap assembler tool finalized with errors.
echo Hit Enter to continue . . .
pause>nul)
cls
echo.
echo.
echo.
echo Process done! copy vmaps folder to the MaNGOS main directory
echo Press any key to exit . . .
pause>nul

View file

@ -1,230 +0,0 @@
#ifndef VEC3D_H
#define VEC3D_H
#include <iostream>
#include <cmath>
class Vec3D
{
public:
float x,y,z;
Vec3D(float x0 = 0.0f, float y0 = 0.0f, float z0 = 0.0f) : x(x0), y(y0), z(z0) {}
Vec3D(const Vec3D& v) : x(v.x), y(v.y), z(v.z) {}
Vec3D& operator= (const Vec3D &v) {
x = v.x;
y = v.y;
z = v.z;
return *this;
}
Vec3D operator+ (const Vec3D &v) const
{
Vec3D r(x+v.x,y+v.y,z+v.z);
return r;
}
Vec3D operator- (const Vec3D &v) const
{
Vec3D r(x-v.x,y-v.y,z-v.z);
return r;
}
float operator* (const Vec3D &v) const
{
return x*v.x + y*v.y + z*v.z;
}
Vec3D operator* (float d) const
{
Vec3D r(x*d,y*d,z*d);
return r;
}
friend Vec3D operator* (float d, const Vec3D& v)
{
return v * d;
}
Vec3D operator% (const Vec3D &v) const
{
Vec3D r(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
return r;
}
Vec3D& operator+= (const Vec3D &v)
{
x += v.x;
y += v.y;
z += v.z;
return *this;
}
Vec3D& operator-= (const Vec3D &v)
{
x -= v.x;
y -= v.y;
z -= v.z;
return *this;
}
Vec3D& operator*= (float d)
{
x *= d;
y *= d;
z *= d;
return *this;
}
float lengthSquared() const
{
return x*x+y*y+z*z;
}
float length() const
{
return sqrt(x*x+y*y+z*z);
}
Vec3D& normalize()
{
this->operator*= (1.0f/length());
return *this;
}
Vec3D operator~ () const
{
Vec3D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec3D& v)
{
in >> v.x >> v.y >> v.z;
return in;
}
friend std::ostream& operator<<(std::ostream& out, const Vec3D& v)
{
out << v.x << " " << v.y << " " << v.z;
return out;
}
operator float*()
{
return (float*)this;
}
};
class Vec2D
{
public:
float x,y;
Vec2D(float x0 = 0.0f, float y0 = 0.0f) : x(x0), y(y0) {}
Vec2D(const Vec2D& v) : x(v.x), y(v.y) {}
Vec2D& operator= (const Vec2D &v) {
x = v.x;
y = v.y;
return *this;
}
Vec2D operator+ (const Vec2D &v) const
{
Vec2D r(x+v.x,y+v.y);
return r;
}
Vec2D operator- (const Vec2D &v) const
{
Vec2D r(x-v.x,y-v.y);
return r;
}
float operator* (const Vec2D &v) const
{
return x*v.x + y*v.y;
}
Vec2D operator* (float d) const
{
Vec2D r(x*d,y*d);
return r;
}
friend Vec2D operator* (float d, const Vec2D& v)
{
return v * d;
}
Vec2D& operator+= (const Vec2D &v)
{
x += v.x;
y += v.y;
return *this;
}
Vec2D& operator-= (const Vec2D &v)
{
x -= v.x;
y -= v.y;
return *this;
}
Vec2D& operator*= (float d)
{
x *= d;
y *= d;
return *this;
}
float lengthSquared() const
{
return x*x+y*y;
}
float length() const
{
return sqrt(x*x+y*y);
}
Vec2D& normalize()
{
this->operator*= (1.0f/length());
return *this;
}
Vec2D operator~ () const
{
Vec2D r(*this);
r.normalize();
return r;
}
friend std::istream& operator>>(std::istream& in, Vec2D& v)
{
in >> v.x >> v.y;
return in;
}
operator float*()
{
return (float*)this;
}
};
inline void rotate(float x0, float y0, float *x, float *y, float angle)
{
float xa = *x - x0, ya = *y - y0;
*x = xa*cosf(angle) - ya*sinf(angle) + x0;
*y = xa*sinf(angle) + ya*cosf(angle) + y0;
}
#endif

View file

@ -1,29 +0,0 @@
#ifndef WDTFILE_H
#define WDTFILE_H
#include "mpqfile.h"
#include "wmo.h"
#include <string>
#include "stdlib.h"
class ADTFile;
class WDTFile
{
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
bool init(char *map_id, unsigned int mapID);
string* gWmoInstansName;
int gnWMO, nMaps;
ADTFile* GetMap(int x, int z);
private:
MPQFile WDT;
bool maps[64][64];
string filename;
};
#endif

View file

@ -1,136 +0,0 @@
/*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WMO_H
#define WMO_H
#define TILESIZE (533.33333f)
#define CHUNKSIZE ((TILESIZE) / 16.0f)
#include <string>
#include <set>
#include "vec3d.h"
#include "mpqfile.h"
// MOPY flags
#define WMO_MATERIAL_NOCAMCOLLIDE 0x01
#define WMO_MATERIAL_DETAIL 0x02
#define WMO_MATERIAL_NO_COLLISION 0x04
#define WMO_MATERIAL_HINT 0x08
#define WMO_MATERIAL_RENDER 0x10
#define WMO_MATERIAL_COLLIDE_HIT 0x20
#define WMO_MATERIAL_WALL_SURFACE 0x40
class WMOInstance;
class WMOManager;
class MPQFile;
/* for whatever reason a certain company just can't stick to one coordinate system... */
static inline Vec3D fixCoords(const Vec3D &v){ return Vec3D(v.z, v.x, v.y); }
class WMORoot
{
public:
uint32 nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, RootWMOID, liquidType;
unsigned int col;
float bbcorn1[3];
float bbcorn2[3];
WMORoot(std::string &filename);
~WMORoot();
bool open();
bool ConvertToVMAPRootWmo(FILE *output);
private:
std::string filename;
char outfilename;
};
struct WMOLiquidHeader
{
int xverts, yverts, xtiles, ytiles;
float pos_x;
float pos_y;
float pos_z;
short type;
};
struct WMOLiquidVert
{
uint16 unk1;
uint16 unk2;
float height;
};
class WMOGroup
{
public:
// MOGP
int groupName, descGroupName, mogpFlags;
float bbcorn1[3];
float bbcorn2[3];
uint16 moprIdx;
uint16 moprNItems;
uint16 nBatchA;
uint16 nBatchB;
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
int mopy_size,moba_size;
int LiquEx_size;
unsigned int nVertices; // number when loaded
int nTriangles; // number when loaded
char *MOPY;
uint16 *MOVI;
uint16 *MoviEx;
float *MOVT;
uint16 *MOBA;
int *MobaEx;
WMOLiquidHeader *hlq;
WMOLiquidVert *LiquEx;
char *LiquBytes;
uint32 liquflags;
WMOGroup(std::string &filename);
~WMOGroup();
bool open();
int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
private:
std::string filename;
char outfilename;
};
class WMOInstance
{
static std::set<int> ids;
public:
std::string MapName;
int currx;
int curry;
WMOGroup *wmo;
Vec3D pos;
Vec3D pos2, pos3, rot;
uint32 indx,id, d2, d3;
int doodadset;
WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
static void reset();
};
#endif

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -26,4 +26,4 @@ endif()
add_subdirectory(recastnavigation) add_subdirectory(recastnavigation)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(StormLib) add_subdirectory(StormLib)

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -2,7 +2,7 @@
## Script processing ## Script processing
-- -------------------------- -- --------------------------
Copyright (C) 2010-2012 MaNGOS <http://getmangos.com/> This file is part of the Continued-MaNGOS Project
-- -------------------------- -- --------------------------
## id ## id

View file

@ -1,6 +1,6 @@
= MaNGOS -- README = = MaNGOS -- README =
Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> This file is part of the Continued-MaNGOS Project
See the COPYING file for copying conditions. See the COPYING file for copying conditions.

View file

@ -1,6 +1,6 @@
= MaNGOS -- README = = MaNGOS -- README =
Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> This file is part of the Continued-MaNGOS Project
See the COPYING file for copying conditions. See the COPYING file for copying conditions.

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://www.mangosproject.org/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
# #
# Copyright (C) 2005-2012 MaNGOS project <http://getmangos.com/> # This file is part of the Continued-MaNGOS Project
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/> * This file is part of the Continued-MaNGOS Project
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

Some files were not shown because too many files have changed in this diff Show more