mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 21:12:26 +00:00
commit
e3e6889a30
@ -30,6 +30,7 @@
|
||||
#EQEMU_BUILD_LUA
|
||||
#EQEMU_SANITIZE_LUA_LIBS
|
||||
#EQEMU_BUILD_CLIENT_FILES
|
||||
#EQEMU_USE_MAP_MMFS
|
||||
#EQEMU_MAP_DIR
|
||||
|
||||
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
|
||||
@ -275,6 +276,11 @@ IF(EQEMU_BUILD_LUA)
|
||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
OPTION(EQEMU_USE_MAP_MMFS "Create and use Zone Map MMF files." OFF)
|
||||
IF(EQEMU_USE_MAP_MMFS)
|
||||
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
||||
ENDIF(EQEMU_USE_MAP_MMFS)
|
||||
|
||||
SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.")
|
||||
|
||||
ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL})
|
||||
|
||||
72
README.md
72
README.md
@ -1,53 +1,59 @@
|
||||
EQEmu
|
||||
===
|
||||
# EQEmulator Core Server
|
||||
|Travis CI (Linux)|Appveyor (Windows) |
|
||||
|:---:|:---:|
|
||||
|[](https://travis-ci.org/EQEmu/Server) |[](https://ci.appveyor.com/project/KimLS/server/branch/master) |
|
||||
|
||||
[](https://travis-ci.org/EQEmu/Server)
|
||||
***
|
||||
|
||||
Overview
|
||||
---
|
||||
**EQEmulator is a custom completely from-scratch open source server implementation for EverQuest built mostly on C++**
|
||||
* MySQL/MariaDB is used as the database engine (over 200+ tables)
|
||||
* Perl and LUA are both supported scripting languages for NPC/Player/Quest oriented events
|
||||
* Open source database (Project EQ) has content up to expansion GoD (included in server installs)
|
||||
* Game server environments and databases can be heavily customized to create all new experiences
|
||||
* Hundreds of Quests/events created and maintained by Project EQ
|
||||
|
||||
EQEmu is a custom server implementation for EverQuest
|
||||
## Server Installs
|
||||
| |Windows|Linux|
|
||||
|:---:|:---:|:---:|
|
||||
|**Install Count**|||
|
||||
### > Windows
|
||||
* [Easy Install](http://wiki.eqemulator.org/p?Akkas_PEQ_Server_Installer&frm=Main#from-scratch-installation-instructions-windows)
|
||||
* [Advanced Setup](http://wiki.eqemulator.org/p?Complete_Windows-based_Server_Setup_Guide)
|
||||
|
||||
Dependencies
|
||||
---
|
||||
### > Debian/Ubuntu
|
||||
|
||||
For Windows: http://eqemu.github.io
|
||||
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
|
||||
|
||||
Login Server dependencies for Windows/Linux/OSX: http://eqemu.github.io
|
||||
### > CentOS/Fedora
|
||||
|
||||
For Debian based distros (adjust to your local flavor):
|
||||
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
||||
|
||||
- libmysqlclient-dev
|
||||
- libperl-dev
|
||||
- liblua5.1-0-dev (5.2 should work as well)
|
||||
- libboost-dev
|
||||
## Supported Clients
|
||||
|
||||
Further instructions on building the source can be found on the
|
||||
[wiki](http://wiki.eqemulator.org/i?M=Wiki).
|
||||
|Titanium Edition|Secrets of Faydwer|Seeds of Destruction|Underfoot|Rain of Fear|
|
||||
|:---:|:---:|:---:|:---:|:---:|
|
||||
|<img src="http://i.imgur.com/hrwDxoM.jpg" height="150">|<img src="http://i.imgur.com/cRDW5tn.png" height="150">|<img src="http://i.imgur.com/V48kuVn.jpg" height="150">|<img src="http://i.imgur.com/IJQ0XMa.jpg" height="150">|<img src="http://i.imgur.com/OMpHkKa.png" height="100">|
|
||||
|
||||
Bug reports
|
||||
---
|
||||
|
||||
Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
||||
## Bug Reports <img src="http://i.imgur.com/daf1Vjw.png" height="20">
|
||||
* Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
||||
reports or feature requests.
|
||||
* The [EQEmu Forums](http://www.eqemulator.org/forums/) are also a place to submit and get help with bugs.
|
||||
|
||||
The [EQEmu Forums](http://www.eqemulator.org/forums/) also have forums to submit
|
||||
bugs/get help with bugs.
|
||||
## Contributions <img src="http://image.flaticon.com/icons/png/512/25/25231.png" width="20">
|
||||
|
||||
Contributions
|
||||
---
|
||||
|
||||
The preferred way to contribute is to fork the repo and submit a pull request on
|
||||
* The preferred way to contribute is to fork the repo and submit a pull request on
|
||||
GitHub. If you need help with your changes, you can always post on the forums or
|
||||
try IRC. You can also post unified diffs (`git diff` should do the trick) on the
|
||||
try Discord. You can also post unified diffs (`git diff` should do the trick) on the
|
||||
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
|
||||
forum, although pull requests will be much quicker and easier on all parties.
|
||||
|
||||
Contact
|
||||
---
|
||||
- **User IRC Channel**: `#eqemu` on `irc.eqemulator.net`
|
||||
- **Developer IRC Channel**: `#eqemucoders` on `irc.eqemulator.net`
|
||||
## Contact <img src="http://gamerescape.com/wp-content/uploads/2015/06/discord.png" height="20">
|
||||
|
||||
- Discord Channel: https://discord.gg/QHsm7CD
|
||||
- **User Discord Channel**: `#general`
|
||||
- **Developer Discord Channel**: `#eqemucoders`
|
||||
|
||||
Resources
|
||||
---
|
||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
||||
- [EQEmulator Wiki](http://wiki.eqemulator.org/i?M=Wiki)
|
||||
|
||||
|
||||
734
changelog.txt
734
changelog.txt
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys Log;
|
||||
EQEmuLogSys LogSys;
|
||||
|
||||
void ExportSpells(SharedDatabase *db);
|
||||
void ExportSkillCaps(SharedDatabase *db);
|
||||
@ -36,46 +36,46 @@ void ExportDBStrings(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log.Out(Logs::General, Logs::Status, "Client Files Export Utility");
|
||||
Log(Logs::General, Logs::Status, "Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
auto Config = EQEmuConfig::get();
|
||||
|
||||
SharedDatabase database;
|
||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Register Log System and Settings */
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
ExportSpells(&database);
|
||||
ExportSkillCaps(&database);
|
||||
ExportBaseData(&database);
|
||||
ExportDBStrings(&database);
|
||||
|
||||
Log.CloseFileLogs();
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Spells...");
|
||||
Log(Logs::General, Logs::Status, "Exporting Spells...");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -142,11 +142,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
||||
Log(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,11 +171,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Base Data...");
|
||||
Log(Logs::General, Logs::Status, "Exporting Base Data...");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -202,11 +202,11 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportDBStrings(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting DB Strings...");
|
||||
Log(Logs::General, Logs::Status, "Exporting DB Strings...");
|
||||
|
||||
FILE *f = fopen("export/dbstr_us.txt", "w");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open export/dbstr_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys Log;
|
||||
EQEmuLogSys LogSys;
|
||||
|
||||
void ImportSpells(SharedDatabase *db);
|
||||
void ImportSkillCaps(SharedDatabase *db);
|
||||
@ -34,35 +34,35 @@ void ImportDBStrings(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log.Out(Logs::General, Logs::Status, "Client Files Import Utility");
|
||||
Log(Logs::General, Logs::Status, "Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
Log(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
auto Config = EQEmuConfig::get();
|
||||
|
||||
SharedDatabase database;
|
||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
Log(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
ImportSpells(&database);
|
||||
ImportSkillCaps(&database);
|
||||
ImportBaseData(&database);
|
||||
ImportDBStrings(&database);
|
||||
|
||||
Log.CloseFileLogs();
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -97,10 +97,10 @@ bool IsStringField(int i) {
|
||||
}
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Spells...");
|
||||
Log(Logs::General, Logs::Status, "Importing Spells...");
|
||||
FILE *f = fopen("import/spells_us.txt", "r");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -173,23 +173,23 @@ void ImportSpells(SharedDatabase *db) {
|
||||
|
||||
spells_imported++;
|
||||
if(spells_imported % 1000 == 0) {
|
||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
}
|
||||
|
||||
if(spells_imported % 1000 != 0) {
|
||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
Log(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Skill Caps...");
|
||||
Log(Logs::General, Logs::Status, "Importing Skill Caps...");
|
||||
|
||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -220,11 +220,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportBaseData(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Base Data...");
|
||||
Log(Logs::General, Logs::Status, "Importing Base Data...");
|
||||
|
||||
FILE *f = fopen("import/BaseData.txt", "r");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -265,11 +265,11 @@ void ImportBaseData(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportDBStrings(SharedDatabase *db) {
|
||||
Log.Out(Logs::General, Logs::Status, "Importing DB Strings...");
|
||||
Log(Logs::General, Logs::Status, "Importing DB Strings...");
|
||||
|
||||
FILE *f = fopen("import/dbstr_us.txt", "r");
|
||||
if(!f) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
||||
Log(Logs::General, Logs::Error, "Unable to open import/dbstr_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -11,15 +11,20 @@ SET(common_sources
|
||||
database_conversions.cpp
|
||||
database_instances.cpp
|
||||
dbcore.cpp
|
||||
deity.cpp
|
||||
emu_constants.cpp
|
||||
emu_legacy.cpp
|
||||
emu_limits.cpp
|
||||
emu_opcodes.cpp
|
||||
emu_tcp_connection.cpp
|
||||
emu_tcp_server.cpp
|
||||
eq_dictionary.cpp
|
||||
emu_versions.cpp
|
||||
eqdb.cpp
|
||||
eqdb_res.cpp
|
||||
eqemu_exception.cpp
|
||||
eqemu_config.cpp
|
||||
eqemu_logsys.cpp
|
||||
eq_limits.cpp
|
||||
eq_packet.cpp
|
||||
eq_stream.cpp
|
||||
eq_stream_factory.cpp
|
||||
@ -30,9 +35,14 @@ SET(common_sources
|
||||
faction.cpp
|
||||
guild_base.cpp
|
||||
guilds.cpp
|
||||
inventory_profile.cpp
|
||||
inventory_slot.cpp
|
||||
ipc_mutex.cpp
|
||||
item.cpp
|
||||
item_data.cpp
|
||||
item_instance.cpp
|
||||
light_source.cpp
|
||||
md5.cpp
|
||||
memory_buffer.cpp
|
||||
memory_mapped_file.cpp
|
||||
misc.cpp
|
||||
misc_functions.cpp
|
||||
@ -51,6 +61,7 @@ SET(common_sources
|
||||
races.cpp
|
||||
rdtsc.cpp
|
||||
rulesys.cpp
|
||||
say_link.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
@ -59,6 +70,7 @@ SET(common_sources
|
||||
struct_strategy.cpp
|
||||
tcp_connection.cpp
|
||||
tcp_server.cpp
|
||||
textures.cpp
|
||||
timeoutmgr.cpp
|
||||
timer.cpp
|
||||
unix.cpp
|
||||
@ -67,11 +79,17 @@ SET(common_sources
|
||||
platform.cpp
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sod_limits.cpp
|
||||
patches/sof.cpp
|
||||
patches/sof_limits.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof_limits.cpp
|
||||
patches/rof2.cpp
|
||||
patches/rof2_limits.cpp
|
||||
patches/titanium.cpp
|
||||
patches/titanium_limits.cpp
|
||||
patches/uf.cpp
|
||||
patches/uf_limits.cpp
|
||||
SocketLib/Base64.cpp
|
||||
SocketLib/File.cpp
|
||||
SocketLib/HttpdCookies.cpp
|
||||
@ -104,12 +122,15 @@ SET(common_headers
|
||||
database.h
|
||||
dbcore.h
|
||||
deity.h
|
||||
emu_constants.h
|
||||
emu_legacy.h
|
||||
emu_limits.h
|
||||
emu_opcodes.h
|
||||
emu_oplist.h
|
||||
emu_tcp_connection.h
|
||||
emu_tcp_server.h
|
||||
emu_versions.h
|
||||
eq_constants.h
|
||||
eq_dictionary.h
|
||||
eq_packet_structs.h
|
||||
eqdb.h
|
||||
eqdb_res.h
|
||||
@ -117,6 +138,7 @@ SET(common_headers
|
||||
eqemu_config.h
|
||||
eqemu_config_elements.h
|
||||
eqemu_logsys.h
|
||||
eq_limits.h
|
||||
eq_packet.h
|
||||
eq_stream.h
|
||||
eq_stream_factory.h
|
||||
@ -135,15 +157,19 @@ SET(common_headers
|
||||
global_define.h
|
||||
guild_base.h
|
||||
guilds.h
|
||||
inventory_profile.h
|
||||
inventory_slot.h
|
||||
ipc_mutex.h
|
||||
item.h
|
||||
item_data.h
|
||||
item_fieldlist.h
|
||||
item_struct.h
|
||||
item_instance.h
|
||||
languages.h
|
||||
light_source.h
|
||||
linked_list.h
|
||||
loottable.h
|
||||
mail_oplist.h
|
||||
md5.h
|
||||
memory_buffer.h
|
||||
memory_mapped_file.h
|
||||
misc.h
|
||||
misc_functions.h
|
||||
@ -166,6 +192,7 @@ SET(common_headers
|
||||
rdtsc.h
|
||||
rulesys.h
|
||||
ruletypes.h
|
||||
say_link.h
|
||||
seperator.h
|
||||
serverinfo.h
|
||||
servertalk.h
|
||||
@ -177,6 +204,7 @@ SET(common_headers
|
||||
tcp_basic_server.h
|
||||
tcp_connection.h
|
||||
tcp_server.h
|
||||
textures.h
|
||||
timeoutmgr.h
|
||||
timer.h
|
||||
types.h
|
||||
@ -188,38 +216,30 @@ SET(common_headers
|
||||
zone_numbers.h
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_constants.h
|
||||
patches/sod_itemfields.h
|
||||
patches/sod_limits.h
|
||||
patches/sod_ops.h
|
||||
patches/sod_structs.h
|
||||
patches/sof.h
|
||||
patches/sof_constants.h
|
||||
patches/sof_itemfields.h
|
||||
patches/sof_opcode_list.h
|
||||
patches/sof_limits.h
|
||||
patches/sof_ops.h
|
||||
patches/sof_structs.h
|
||||
patches/ss_declare.h
|
||||
patches/ss_define.h
|
||||
patches/ss_register.h
|
||||
patches/rof.h
|
||||
patches/rof_constants.h
|
||||
patches/rof_itemfields.h
|
||||
patches/rof_limits.h
|
||||
patches/rof_ops.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_limits.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_itemfields_a.h
|
||||
patches/titanium_itemfields_b.h
|
||||
patches/titanium_limits.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_structs.h
|
||||
patches/uf.h
|
||||
patches/uf_constants.h
|
||||
patches/uf_itemfields.h
|
||||
patches/uf_limits.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_structs.h
|
||||
SocketLib/Base64.h
|
||||
@ -242,47 +262,45 @@ SET(common_headers
|
||||
SOURCE_GROUP(Patches FILES
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_itemfields.h
|
||||
patches/sod_limits.h
|
||||
patches/sod_ops.h
|
||||
patches/sod_constants.h
|
||||
patches/sod_structs.h
|
||||
patches/sof.h
|
||||
patches/sof_itemfields.h
|
||||
patches/sof_opcode_list.h
|
||||
patches/sof_limits.h
|
||||
patches/sof_ops.h
|
||||
patches/sof_constants.h
|
||||
patches/sof_structs.h
|
||||
patches/ss_declare.h
|
||||
patches/ss_define.h
|
||||
patches/ss_register.h
|
||||
patches/rof.h
|
||||
patches/rof_itemfields.h
|
||||
patches/rof_limits.h
|
||||
patches/rof_ops.h
|
||||
patches/rof_constants.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_limits.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_itemfields_a.h
|
||||
patches/titanium_itemfields_b.h
|
||||
patches/titanium_limits.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_structs.h
|
||||
patches/uf.h
|
||||
patches/uf_itemfields.h
|
||||
patches/uf_limits.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_constants.h
|
||||
patches/uf_structs.h
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sod_limits.cpp
|
||||
patches/sof.cpp
|
||||
patches/sof_limits.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof_limits.cpp
|
||||
patches/rof2.cpp
|
||||
patches/rof2_limits.cpp
|
||||
patches/titanium.cpp
|
||||
patches/titanium_limits.cpp
|
||||
patches/uf.cpp
|
||||
patches/uf_limits.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(SocketLib FILES
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WINDOWS
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@ -18,275 +18,576 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/classes.h"
|
||||
|
||||
const char* GetEQClassName(uint8 class_, uint8 level) {
|
||||
switch(class_) {
|
||||
case WARRIOR:
|
||||
if (level >= 70)
|
||||
return "Vanquisher";
|
||||
else if (level >= 65)
|
||||
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
||||
else if (level >= 60)
|
||||
return "Warlord";
|
||||
else if (level >= 55)
|
||||
return "Myrmidon";
|
||||
else if (level >= 51)
|
||||
return "Champion";
|
||||
else
|
||||
return "Warrior";
|
||||
case CLERIC:
|
||||
if (level >= 70)
|
||||
return "Prelate";
|
||||
else if (level >= 65)
|
||||
return "Archon";
|
||||
else if (level >= 60)
|
||||
return "High Priest";
|
||||
else if (level >= 55)
|
||||
return "Templar";
|
||||
else if (level >= 51)
|
||||
return "Vicar";
|
||||
else
|
||||
return "Cleric";
|
||||
case PALADIN:
|
||||
if (level >= 70)
|
||||
return "Lord";
|
||||
else if (level >= 65)
|
||||
return "Lord Protector";
|
||||
else if (level >= 60)
|
||||
return "Crusader";
|
||||
else if (level >= 55)
|
||||
return "Knight";
|
||||
else if (level >= 51)
|
||||
return "Cavalier";
|
||||
else
|
||||
return "Paladin";
|
||||
case RANGER:
|
||||
if (level >= 70)
|
||||
return "Plainswalker";
|
||||
else if (level >= 65)
|
||||
return "Forest Stalker";
|
||||
else if (level >= 60)
|
||||
return "Warder";
|
||||
else if (level >= 55)
|
||||
return "Outrider";
|
||||
else if (level >= 51)
|
||||
return "Pathfinder";
|
||||
else
|
||||
return "Ranger";
|
||||
case SHADOWKNIGHT:
|
||||
if (level >= 70)
|
||||
return "Scourge Knight";
|
||||
else if (level >= 65)
|
||||
return "Dread Lord";
|
||||
else if (level >= 60)
|
||||
return "Grave Lord";
|
||||
else if (level >= 55)
|
||||
return "Revenant";
|
||||
else if (level >= 51)
|
||||
return "Reaver";
|
||||
else
|
||||
return "Shadowknight";
|
||||
case DRUID:
|
||||
if (level >= 70)
|
||||
return "Natureguard";
|
||||
else if (level >= 65)
|
||||
return "Storm Warden";
|
||||
else if (level >= 60)
|
||||
return "Hierophant";
|
||||
else if (level >= 55)
|
||||
return "Preserver";
|
||||
else if (level >= 51)
|
||||
return "Wanderer";
|
||||
else
|
||||
return "Druid";
|
||||
case MONK:
|
||||
if (level >= 70)
|
||||
return "Stone Fist";
|
||||
else if (level >= 65)
|
||||
return "Transcendent";
|
||||
else if (level >= 60)
|
||||
return "Grandmaster";
|
||||
else if (level >= 55)
|
||||
return "Master";
|
||||
else if (level >= 51)
|
||||
return "Disciple";
|
||||
else
|
||||
return "Monk";
|
||||
case BARD:
|
||||
if (level >= 70)
|
||||
return "Performer";
|
||||
else if (level >= 65)
|
||||
return "Maestro";
|
||||
else if (level >= 60)
|
||||
return "Virtuoso";
|
||||
else if (level >= 55)
|
||||
return "Troubadour";
|
||||
else if (level >= 51)
|
||||
return "Minstrel";
|
||||
else
|
||||
return "Bard";
|
||||
case ROGUE:
|
||||
if (level >= 70)
|
||||
return "Nemesis";
|
||||
else if (level >= 65)
|
||||
return "Deceiver";
|
||||
else if (level >= 60)
|
||||
return "Assassin";
|
||||
else if (level >= 55)
|
||||
return "Blackguard";
|
||||
else if (level >= 51)
|
||||
return "Rake";
|
||||
else
|
||||
return "Rogue";
|
||||
case SHAMAN:
|
||||
if (level >= 70)
|
||||
return "Soothsayer";
|
||||
else if (level >= 65)
|
||||
return "Prophet";
|
||||
else if (level >= 60)
|
||||
return "Oracle";
|
||||
else if (level >= 55)
|
||||
return "Luminary";
|
||||
else if (level >= 51)
|
||||
return "Mystic";
|
||||
else
|
||||
return "Shaman";
|
||||
case NECROMANCER:
|
||||
if (level >= 70)
|
||||
return "Wraith";
|
||||
else if (level >= 65)
|
||||
return "Arch Lich";
|
||||
else if (level >= 60)
|
||||
return "Warlock";
|
||||
else if (level >= 55)
|
||||
return "Defiler";
|
||||
else if (level >= 51)
|
||||
return "Heretic";
|
||||
else
|
||||
return "Necromancer";
|
||||
case WIZARD:
|
||||
if (level >= 70)
|
||||
return "Grand Arcanist";
|
||||
else if (level >= 65)
|
||||
return "Arcanist";
|
||||
else if (level >= 60)
|
||||
return "Sorcerer";
|
||||
else if (level >= 55)
|
||||
return "Evoker";
|
||||
else if (level >= 51)
|
||||
return "Channeler";
|
||||
else
|
||||
return "Wizard";
|
||||
case MAGICIAN:
|
||||
if (level >= 70)
|
||||
return "Arch Magus";
|
||||
else if (level >= 65)
|
||||
return "Arch Convoker";
|
||||
else if (level >= 60)
|
||||
return "Arch Mage";
|
||||
else if (level >= 55)
|
||||
return "Conjurer";
|
||||
if (level >= 51)
|
||||
return "Elementalist";
|
||||
else
|
||||
return "Magician";
|
||||
case ENCHANTER:
|
||||
if (level >= 70)
|
||||
return "Bedazzler";
|
||||
else if (level >= 65)
|
||||
return "Coercer";
|
||||
else if (level >= 60)
|
||||
return "Phantasmist";
|
||||
else if (level >= 55)
|
||||
return "Beguiler";
|
||||
else if (level >= 51)
|
||||
return "Illusionist";
|
||||
else
|
||||
return "Enchanter";
|
||||
case BEASTLORD:
|
||||
if (level >= 70)
|
||||
return "Wildblood";
|
||||
else if (level >= 65)
|
||||
return "Feral Lord";
|
||||
else if (level >= 60)
|
||||
return "Savage Lord";
|
||||
else if (level >= 55)
|
||||
return "Animist";
|
||||
else if (level >= 51)
|
||||
return "Primalist";
|
||||
else
|
||||
return "Beastlord";
|
||||
case BERSERKER:
|
||||
if (level >= 70)
|
||||
return "Ravager";
|
||||
else if (level >= 65)
|
||||
return "Fury";
|
||||
else if (level >= 60)
|
||||
return "Rager";
|
||||
else if (level >= 55)
|
||||
return "Vehement";
|
||||
else if (level >= 51)
|
||||
return "Brawler";
|
||||
else
|
||||
return "Berserker";
|
||||
case BANKER:
|
||||
if (level >= 70)
|
||||
return "Master Banker";
|
||||
else if (level >= 65)
|
||||
return "Elder Banker";
|
||||
else if (level >= 60)
|
||||
return "Oldest Banker";
|
||||
else if (level >= 55)
|
||||
return "Older Banker";
|
||||
else if (level >= 51)
|
||||
return "Old Banker";
|
||||
else
|
||||
return "Banker";
|
||||
case WARRIORGM:
|
||||
return "Warrior Guildmaster";
|
||||
case CLERICGM:
|
||||
return "Cleric Guildmaster";
|
||||
case PALADINGM:
|
||||
return "Paladin Guildmaster";
|
||||
case RANGERGM:
|
||||
return "Ranger Guildmaster";
|
||||
case SHADOWKNIGHTGM:
|
||||
return "Shadowknight Guildmaster";
|
||||
case DRUIDGM:
|
||||
return "Druid Guildmaster";
|
||||
case MONKGM:
|
||||
return "Monk Guildmaster";
|
||||
case BARDGM:
|
||||
return "Bard Guildmaster";
|
||||
case ROGUEGM:
|
||||
return "Rogue Guildmaster";
|
||||
case SHAMANGM:
|
||||
return "Shaman Guildmaster";
|
||||
case NECROMANCERGM:
|
||||
return "Necromancer Guildmaster";
|
||||
case WIZARDGM:
|
||||
return "Wizard Guildmaster";
|
||||
case MAGICIANGM:
|
||||
return "Magician Guildmaster";
|
||||
case ENCHANTERGM:
|
||||
return "Enchanter Guildmaster";
|
||||
case BEASTLORDGM:
|
||||
return "Beastlord Guildmaster";
|
||||
case BERSERKERGM:
|
||||
return "Berserker Guildmaster";
|
||||
case MERCHANT:
|
||||
return "Merchant";
|
||||
case ADVENTURERECRUITER:
|
||||
return "Adventure Recruiter";
|
||||
case ADVENTUREMERCHANT:
|
||||
return "Adventure Merchant";
|
||||
case CORPSE_CLASS:
|
||||
return "Corpse Class";
|
||||
case TRIBUTE_MASTER:
|
||||
return "Tribute Master";
|
||||
case GUILD_TRIBUTE_MASTER:
|
||||
return "Guild Tribute Master";
|
||||
default:
|
||||
return "Unknown";
|
||||
const char* GetClassIDName(uint8 class_id, uint8 level)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
if (level >= 70)
|
||||
return "Vanquisher";
|
||||
else if (level >= 65)
|
||||
return "Overlord"; //Baron-Sprite: LEAVE MY CLASSES ALONE.
|
||||
else if (level >= 60)
|
||||
return "Warlord";
|
||||
else if (level >= 55)
|
||||
return "Myrmidon";
|
||||
else if (level >= 51)
|
||||
return "Champion";
|
||||
else
|
||||
return "Warrior";
|
||||
case CLERIC:
|
||||
if (level >= 70)
|
||||
return "Prelate";
|
||||
else if (level >= 65)
|
||||
return "Archon";
|
||||
else if (level >= 60)
|
||||
return "High Priest";
|
||||
else if (level >= 55)
|
||||
return "Templar";
|
||||
else if (level >= 51)
|
||||
return "Vicar";
|
||||
else
|
||||
return "Cleric";
|
||||
case PALADIN:
|
||||
if (level >= 70)
|
||||
return "Lord";
|
||||
else if (level >= 65)
|
||||
return "Lord Protector";
|
||||
else if (level >= 60)
|
||||
return "Crusader";
|
||||
else if (level >= 55)
|
||||
return "Knight";
|
||||
else if (level >= 51)
|
||||
return "Cavalier";
|
||||
else
|
||||
return "Paladin";
|
||||
case RANGER:
|
||||
if (level >= 70)
|
||||
return "Plainswalker";
|
||||
else if (level >= 65)
|
||||
return "Forest Stalker";
|
||||
else if (level >= 60)
|
||||
return "Warder";
|
||||
else if (level >= 55)
|
||||
return "Outrider";
|
||||
else if (level >= 51)
|
||||
return "Pathfinder";
|
||||
else
|
||||
return "Ranger";
|
||||
case SHADOWKNIGHT:
|
||||
if (level >= 70)
|
||||
return "Scourge Knight";
|
||||
else if (level >= 65)
|
||||
return "Dread Lord";
|
||||
else if (level >= 60)
|
||||
return "Grave Lord";
|
||||
else if (level >= 55)
|
||||
return "Revenant";
|
||||
else if (level >= 51)
|
||||
return "Reaver";
|
||||
else
|
||||
return "Shadowknight";
|
||||
case DRUID:
|
||||
if (level >= 70)
|
||||
return "Natureguard";
|
||||
else if (level >= 65)
|
||||
return "Storm Warden";
|
||||
else if (level >= 60)
|
||||
return "Hierophant";
|
||||
else if (level >= 55)
|
||||
return "Preserver";
|
||||
else if (level >= 51)
|
||||
return "Wanderer";
|
||||
else
|
||||
return "Druid";
|
||||
case MONK:
|
||||
if (level >= 70)
|
||||
return "Stone Fist";
|
||||
else if (level >= 65)
|
||||
return "Transcendent";
|
||||
else if (level >= 60)
|
||||
return "Grandmaster";
|
||||
else if (level >= 55)
|
||||
return "Master";
|
||||
else if (level >= 51)
|
||||
return "Disciple";
|
||||
else
|
||||
return "Monk";
|
||||
case BARD:
|
||||
if (level >= 70)
|
||||
return "Performer";
|
||||
else if (level >= 65)
|
||||
return "Maestro";
|
||||
else if (level >= 60)
|
||||
return "Virtuoso";
|
||||
else if (level >= 55)
|
||||
return "Troubadour";
|
||||
else if (level >= 51)
|
||||
return "Minstrel";
|
||||
else
|
||||
return "Bard";
|
||||
case ROGUE:
|
||||
if (level >= 70)
|
||||
return "Nemesis";
|
||||
else if (level >= 65)
|
||||
return "Deceiver";
|
||||
else if (level >= 60)
|
||||
return "Assassin";
|
||||
else if (level >= 55)
|
||||
return "Blackguard";
|
||||
else if (level >= 51)
|
||||
return "Rake";
|
||||
else
|
||||
return "Rogue";
|
||||
case SHAMAN:
|
||||
if (level >= 70)
|
||||
return "Soothsayer";
|
||||
else if (level >= 65)
|
||||
return "Prophet";
|
||||
else if (level >= 60)
|
||||
return "Oracle";
|
||||
else if (level >= 55)
|
||||
return "Luminary";
|
||||
else if (level >= 51)
|
||||
return "Mystic";
|
||||
else
|
||||
return "Shaman";
|
||||
case NECROMANCER:
|
||||
if (level >= 70)
|
||||
return "Wraith";
|
||||
else if (level >= 65)
|
||||
return "Arch Lich";
|
||||
else if (level >= 60)
|
||||
return "Warlock";
|
||||
else if (level >= 55)
|
||||
return "Defiler";
|
||||
else if (level >= 51)
|
||||
return "Heretic";
|
||||
else
|
||||
return "Necromancer";
|
||||
case WIZARD:
|
||||
if (level >= 70)
|
||||
return "Grand Arcanist";
|
||||
else if (level >= 65)
|
||||
return "Arcanist";
|
||||
else if (level >= 60)
|
||||
return "Sorcerer";
|
||||
else if (level >= 55)
|
||||
return "Evoker";
|
||||
else if (level >= 51)
|
||||
return "Channeler";
|
||||
else
|
||||
return "Wizard";
|
||||
case MAGICIAN:
|
||||
if (level >= 70)
|
||||
return "Arch Magus";
|
||||
else if (level >= 65)
|
||||
return "Arch Convoker";
|
||||
else if (level >= 60)
|
||||
return "Arch Mage";
|
||||
else if (level >= 55)
|
||||
return "Conjurer";
|
||||
if (level >= 51)
|
||||
return "Elementalist";
|
||||
else
|
||||
return "Magician";
|
||||
case ENCHANTER:
|
||||
if (level >= 70)
|
||||
return "Bedazzler";
|
||||
else if (level >= 65)
|
||||
return "Coercer";
|
||||
else if (level >= 60)
|
||||
return "Phantasmist";
|
||||
else if (level >= 55)
|
||||
return "Beguiler";
|
||||
else if (level >= 51)
|
||||
return "Illusionist";
|
||||
else
|
||||
return "Enchanter";
|
||||
case BEASTLORD:
|
||||
if (level >= 70)
|
||||
return "Wildblood";
|
||||
else if (level >= 65)
|
||||
return "Feral Lord";
|
||||
else if (level >= 60)
|
||||
return "Savage Lord";
|
||||
else if (level >= 55)
|
||||
return "Animist";
|
||||
else if (level >= 51)
|
||||
return "Primalist";
|
||||
else
|
||||
return "Beastlord";
|
||||
case BERSERKER:
|
||||
if (level >= 70)
|
||||
return "Ravager";
|
||||
else if (level >= 65)
|
||||
return "Fury";
|
||||
else if (level >= 60)
|
||||
return "Rager";
|
||||
else if (level >= 55)
|
||||
return "Vehement";
|
||||
else if (level >= 51)
|
||||
return "Brawler";
|
||||
else
|
||||
return "Berserker";
|
||||
case BANKER:
|
||||
if (level >= 70)
|
||||
return "Master Banker";
|
||||
else if (level >= 65)
|
||||
return "Elder Banker";
|
||||
else if (level >= 60)
|
||||
return "Oldest Banker";
|
||||
else if (level >= 55)
|
||||
return "Older Banker";
|
||||
else if (level >= 51)
|
||||
return "Old Banker";
|
||||
else
|
||||
return "Banker";
|
||||
case WARRIORGM:
|
||||
return "Warrior Guildmaster";
|
||||
case CLERICGM:
|
||||
return "Cleric Guildmaster";
|
||||
case PALADINGM:
|
||||
return "Paladin Guildmaster";
|
||||
case RANGERGM:
|
||||
return "Ranger Guildmaster";
|
||||
case SHADOWKNIGHTGM:
|
||||
return "Shadowknight Guildmaster";
|
||||
case DRUIDGM:
|
||||
return "Druid Guildmaster";
|
||||
case MONKGM:
|
||||
return "Monk Guildmaster";
|
||||
case BARDGM:
|
||||
return "Bard Guildmaster";
|
||||
case ROGUEGM:
|
||||
return "Rogue Guildmaster";
|
||||
case SHAMANGM:
|
||||
return "Shaman Guildmaster";
|
||||
case NECROMANCERGM:
|
||||
return "Necromancer Guildmaster";
|
||||
case WIZARDGM:
|
||||
return "Wizard Guildmaster";
|
||||
case MAGICIANGM:
|
||||
return "Magician Guildmaster";
|
||||
case ENCHANTERGM:
|
||||
return "Enchanter Guildmaster";
|
||||
case BEASTLORDGM:
|
||||
return "Beastlord Guildmaster";
|
||||
case BERSERKERGM:
|
||||
return "Berserker Guildmaster";
|
||||
case MERCHANT:
|
||||
return "Merchant";
|
||||
case ADVENTURERECRUITER:
|
||||
return "Adventure Recruiter";
|
||||
case ADVENTUREMERCHANT:
|
||||
return "Adventure Merchant";
|
||||
case CORPSE_CLASS:
|
||||
return "Corpse Class";
|
||||
case TRIBUTE_MASTER:
|
||||
return "Tribute Master";
|
||||
case GUILD_TRIBUTE_MASTER:
|
||||
return "Guild Tribute Master";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char* GetPlayerClassName(uint32 player_class_value, uint8 level)
|
||||
{
|
||||
return GetClassIDName(GetClassIDFromPlayerClassValue(player_class_value), level);
|
||||
}
|
||||
|
||||
uint32 GetPlayerClassValue(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
case BEASTLORD:
|
||||
case BERSERKER:
|
||||
return class_id;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetPlayerClassBit(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
return PLAYER_CLASS_WARRIOR_BIT;
|
||||
case CLERIC:
|
||||
return PLAYER_CLASS_CLERIC_BIT;
|
||||
case PALADIN:
|
||||
return PLAYER_CLASS_PALADIN_BIT;
|
||||
case RANGER:
|
||||
return PLAYER_CLASS_RANGER_BIT;
|
||||
case SHADOWKNIGHT:
|
||||
return PLAYER_CLASS_SHADOWKNIGHT_BIT;
|
||||
case DRUID:
|
||||
return PLAYER_CLASS_DRUID_BIT;
|
||||
case MONK:
|
||||
return PLAYER_CLASS_MONK_BIT;
|
||||
case BARD:
|
||||
return PLAYER_CLASS_BARD_BIT;
|
||||
case ROGUE:
|
||||
return PLAYER_CLASS_ROGUE_BIT;
|
||||
case SHAMAN:
|
||||
return PLAYER_CLASS_SHAMAN_BIT;
|
||||
case NECROMANCER:
|
||||
return PLAYER_CLASS_NECROMANCER_BIT;
|
||||
case WIZARD:
|
||||
return PLAYER_CLASS_WIZARD_BIT;
|
||||
case MAGICIAN:
|
||||
return PLAYER_CLASS_MAGICIAN_BIT;
|
||||
case ENCHANTER:
|
||||
return PLAYER_CLASS_ENCHANTER_BIT;
|
||||
case BEASTLORD:
|
||||
return PLAYER_CLASS_BEASTLORD_BIT;
|
||||
case BERSERKER:
|
||||
return PLAYER_CLASS_BERSERKER_BIT;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetClassIDFromPlayerClassValue(uint32 player_class_value)
|
||||
{
|
||||
switch (player_class_value) {
|
||||
case PLAYER_CLASS_WARRIOR:
|
||||
case PLAYER_CLASS_CLERIC:
|
||||
case PLAYER_CLASS_PALADIN:
|
||||
case PLAYER_CLASS_RANGER:
|
||||
case PLAYER_CLASS_SHADOWKNIGHT:
|
||||
case PLAYER_CLASS_DRUID:
|
||||
case PLAYER_CLASS_MONK:
|
||||
case PLAYER_CLASS_BARD:
|
||||
case PLAYER_CLASS_ROGUE:
|
||||
case PLAYER_CLASS_SHAMAN:
|
||||
case PLAYER_CLASS_NECROMANCER:
|
||||
case PLAYER_CLASS_WIZARD:
|
||||
case PLAYER_CLASS_MAGICIAN:
|
||||
case PLAYER_CLASS_ENCHANTER:
|
||||
case PLAYER_CLASS_BEASTLORD:
|
||||
case PLAYER_CLASS_BERSERKER:
|
||||
return player_class_value;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetClassIDFromPlayerClassBit(uint32 player_class_bit)
|
||||
{
|
||||
switch (player_class_bit) {
|
||||
case PLAYER_CLASS_WARRIOR_BIT:
|
||||
return WARRIOR;
|
||||
case PLAYER_CLASS_CLERIC_BIT:
|
||||
return CLERIC;
|
||||
case PLAYER_CLASS_PALADIN_BIT:
|
||||
return PALADIN;
|
||||
case PLAYER_CLASS_RANGER_BIT:
|
||||
return RANGER;
|
||||
case PLAYER_CLASS_SHADOWKNIGHT_BIT:
|
||||
return SHADOWKNIGHT;
|
||||
case PLAYER_CLASS_DRUID_BIT:
|
||||
return DRUID;
|
||||
case PLAYER_CLASS_MONK_BIT:
|
||||
return MONK;
|
||||
case PLAYER_CLASS_BARD_BIT:
|
||||
return BARD;
|
||||
case PLAYER_CLASS_ROGUE_BIT:
|
||||
return ROGUE;
|
||||
case PLAYER_CLASS_SHAMAN_BIT:
|
||||
return SHAMAN;
|
||||
case PLAYER_CLASS_NECROMANCER_BIT:
|
||||
return NECROMANCER;
|
||||
case PLAYER_CLASS_WIZARD_BIT:
|
||||
return WIZARD;
|
||||
case PLAYER_CLASS_MAGICIAN_BIT:
|
||||
return MAGICIAN;
|
||||
case PLAYER_CLASS_ENCHANTER_BIT:
|
||||
return ENCHANTER;
|
||||
case PLAYER_CLASS_BEASTLORD_BIT:
|
||||
return BEASTLORD;
|
||||
case PLAYER_CLASS_BERSERKER_BIT:
|
||||
return BERSERKER;
|
||||
default:
|
||||
return PLAYER_CLASS_UNKNOWN; // watch
|
||||
}
|
||||
}
|
||||
|
||||
bool IsFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case BEASTLORD:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSpellFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case PALADIN:
|
||||
case RANGER:
|
||||
case SHADOWKNIGHT:
|
||||
case BEASTLORD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsNonSpellFighterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case MONK:
|
||||
case BARD:
|
||||
case ROGUE:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case CLERIC:
|
||||
case DRUID:
|
||||
case SHAMAN:
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsINTCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsWISCasterClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case CLERIC:
|
||||
case DRUID:
|
||||
case SHAMAN:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsPlateClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case SHADOWKNIGHT:
|
||||
case BARD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsChainClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case RANGER:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case BERSERKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsLeatherClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BEASTLORD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsClothClass(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 ClassArmorType(uint8 class_id)
|
||||
{
|
||||
switch (class_id) {
|
||||
case WARRIOR:
|
||||
case CLERIC:
|
||||
case PALADIN:
|
||||
case SHADOWKNIGHT:
|
||||
case BARD:
|
||||
return ARMOR_TYPE_PLATE;
|
||||
case RANGER:
|
||||
case ROGUE:
|
||||
case SHAMAN:
|
||||
case BERSERKER:
|
||||
return ARMOR_TYPE_CHAIN;
|
||||
case DRUID:
|
||||
case MONK:
|
||||
case BEASTLORD:
|
||||
return ARMOR_TYPE_LEATHER;
|
||||
case NECROMANCER:
|
||||
case WIZARD:
|
||||
case MAGICIAN:
|
||||
case ENCHANTER:
|
||||
return ARMOR_TYPE_CLOTH;
|
||||
default:
|
||||
return ARMOR_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
142
common/classes.h
142
common/classes.h
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@ -17,26 +17,25 @@
|
||||
*/
|
||||
#ifndef CLASSES_CH
|
||||
#define CLASSES_CH
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#define Array_Class_UNKNOWN 0
|
||||
#define WARRIOR 1
|
||||
#define CLERIC 2
|
||||
#define PALADIN 3
|
||||
#define RANGER 4
|
||||
#define SHADOWKNIGHT 5
|
||||
#define DRUID 6
|
||||
#define MONK 7
|
||||
#define BARD 8
|
||||
#define ROGUE 9
|
||||
#define SHAMAN 10
|
||||
#define NECROMANCER 11
|
||||
#define WIZARD 12
|
||||
#define MAGICIAN 13
|
||||
#define ENCHANTER 14
|
||||
#define BEASTLORD 15
|
||||
#define BERSERKER 16
|
||||
#define PLAYER_CLASS_COUNT 16 // used for array defines, must be the count of playable classes
|
||||
#define WARRIOR 1
|
||||
#define CLERIC 2
|
||||
#define PALADIN 3
|
||||
#define RANGER 4
|
||||
#define SHADOWKNIGHT 5
|
||||
#define DRUID 6
|
||||
#define MONK 7
|
||||
#define BARD 8
|
||||
#define ROGUE 9
|
||||
#define SHAMAN 10
|
||||
#define NECROMANCER 11
|
||||
#define WIZARD 12
|
||||
#define MAGICIAN 13
|
||||
#define ENCHANTER 14
|
||||
#define BEASTLORD 15
|
||||
#define BERSERKER 16
|
||||
#define WARRIORGM 20
|
||||
#define CLERICGM 21
|
||||
#define PALADINGM 22
|
||||
@ -58,33 +57,92 @@
|
||||
#define DISCORD_MERCHANT 59
|
||||
#define ADVENTURERECRUITER 60
|
||||
#define ADVENTUREMERCHANT 61
|
||||
#define LDON_TREASURE 62 //objects you can use /open on first seen in LDONs
|
||||
#define CORPSE_CLASS 62 //only seen on Danvi's Corpse in Akheva so far..
|
||||
#define TRIBUTE_MASTER 63
|
||||
#define GUILD_TRIBUTE_MASTER 64 //not sure
|
||||
#define LDON_TREASURE 62 // objects you can use /open on first seen in LDONs
|
||||
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
|
||||
#define TRIBUTE_MASTER 63
|
||||
#define GUILD_TRIBUTE_MASTER 64 // not sure
|
||||
#define NORRATHS_KEEPERS_MERCHANT 67
|
||||
#define DARK_REIGN_MERCHANT 68
|
||||
#define FELLOWSHIP_MASTER 69
|
||||
#define ALT_CURRENCY_MERCHANT 70
|
||||
#define MERCERNARY_MASTER 71
|
||||
#define warrior_1 1
|
||||
#define monk_1 64
|
||||
#define paladin_1 4
|
||||
#define shadow_1 16
|
||||
#define bard_1 128
|
||||
#define cleric_1 2
|
||||
#define necromancer_1 1024
|
||||
#define ranger_1 8
|
||||
#define druid_1 32
|
||||
#define mage_1 4096
|
||||
#define wizard_1 2048
|
||||
#define enchanter_1 8192
|
||||
#define rogue_1 256
|
||||
#define shaman_1 512
|
||||
#define beastlord_1 16384
|
||||
#define berserker_1 32768
|
||||
#define call_1 65536
|
||||
|
||||
const char* GetEQClassName(uint8 class_, uint8 level = 0);
|
||||
|
||||
// player class values
|
||||
#define PLAYER_CLASS_UNKNOWN 0
|
||||
#define PLAYER_CLASS_WARRIOR 1
|
||||
#define PLAYER_CLASS_CLERIC 2
|
||||
#define PLAYER_CLASS_PALADIN 3
|
||||
#define PLAYER_CLASS_RANGER 4
|
||||
#define PLAYER_CLASS_SHADOWKNIGHT 5
|
||||
#define PLAYER_CLASS_DRUID 6
|
||||
#define PLAYER_CLASS_MONK 7
|
||||
#define PLAYER_CLASS_BARD 8
|
||||
#define PLAYER_CLASS_ROGUE 9
|
||||
#define PLAYER_CLASS_SHAMAN 10
|
||||
#define PLAYER_CLASS_NECROMANCER 11
|
||||
#define PLAYER_CLASS_WIZARD 12
|
||||
#define PLAYER_CLASS_MAGICIAN 13
|
||||
#define PLAYER_CLASS_ENCHANTER 14
|
||||
#define PLAYER_CLASS_BEASTLORD 15
|
||||
#define PLAYER_CLASS_BERSERKER 16
|
||||
|
||||
#define PLAYER_CLASS_COUNT 16
|
||||
|
||||
|
||||
// player class bits
|
||||
#define PLAYER_CLASS_UNKNOWN_BIT 0
|
||||
#define PLAYER_CLASS_WARRIOR_BIT 1
|
||||
#define PLAYER_CLASS_CLERIC_BIT 2
|
||||
#define PLAYER_CLASS_PALADIN_BIT 4
|
||||
#define PLAYER_CLASS_RANGER_BIT 8
|
||||
#define PLAYER_CLASS_SHADOWKNIGHT_BIT 16
|
||||
#define PLAYER_CLASS_DRUID_BIT 32
|
||||
#define PLAYER_CLASS_MONK_BIT 64
|
||||
#define PLAYER_CLASS_BARD_BIT 128
|
||||
#define PLAYER_CLASS_ROGUE_BIT 256
|
||||
#define PLAYER_CLASS_SHAMAN_BIT 512
|
||||
#define PLAYER_CLASS_NECROMANCER_BIT 1024
|
||||
#define PLAYER_CLASS_WIZARD_BIT 2048
|
||||
#define PLAYER_CLASS_MAGICIAN_BIT 4096
|
||||
#define PLAYER_CLASS_ENCHANTER_BIT 8192
|
||||
#define PLAYER_CLASS_BEASTLORD_BIT 16384
|
||||
#define PLAYER_CLASS_BERSERKER_BIT 32768
|
||||
|
||||
#define PLAYER_CLASS_ALL_MASK 65535 // was 65536
|
||||
|
||||
|
||||
#define ARMOR_TYPE_UNKNOWN 0
|
||||
#define ARMOR_TYPE_CLOTH 1
|
||||
#define ARMOR_TYPE_LEATHER 2
|
||||
#define ARMOR_TYPE_CHAIN 3
|
||||
#define ARMOR_TYPE_PLATE 4
|
||||
|
||||
#define ARMOR_TYPE_FIRST ARMOR_TYPE_UNKNOWN
|
||||
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
||||
#define ARMOR_TYPE_COUNT 5
|
||||
|
||||
|
||||
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
||||
const char* GetPlayerClassName(uint32 player_class_value, uint8 level = 0);
|
||||
|
||||
uint32 GetPlayerClassValue(uint8 class_id);
|
||||
uint32 GetPlayerClassBit(uint8 class_id);
|
||||
|
||||
uint8 GetClassIDFromPlayerClassValue(uint32 player_class_value);
|
||||
uint8 GetClassIDFromPlayerClassBit(uint32 player_class_bit);
|
||||
|
||||
bool IsFighterClass(uint8 class_id);
|
||||
bool IsSpellFighterClass(uint8 class_id);
|
||||
bool IsNonSpellFighterClass(uint8 class_id);
|
||||
bool IsCasterClass(uint8 class_id);
|
||||
bool IsINTCasterClass(uint8 class_id);
|
||||
bool IsWISCasterClass(uint8 class_id);
|
||||
|
||||
bool IsPlateClass(uint8 class_id);
|
||||
bool IsChainClass(uint8 class_id);
|
||||
bool IsLeatherClass(uint8 class_id);
|
||||
bool IsClothClass(uint8 class_id);
|
||||
uint8 ClassArmorType(uint8 class_id);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,182 +0,0 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 CLIENTVERSIONS_H
|
||||
#define CLIENTVERSIONS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
static const uint32 BIT_Client62 = 0x00000001; // 1 (unsupported - placeholder for scripts)
|
||||
|
||||
static const uint32 BIT_Titanium = 0x00000002; // 2
|
||||
static const uint32 BIT_SoF = 0x00000004; // 4
|
||||
static const uint32 BIT_SoD = 0x00000008; // 8
|
||||
static const uint32 BIT_UF = 0x00000010; // 16
|
||||
static const uint32 BIT_RoF = 0x00000020; // 32
|
||||
static const uint32 BIT_RoF2 = 0x00000040; // 64
|
||||
|
||||
static const uint32 BIT_TitaniumAndEarlier = 0x00000003; // 3
|
||||
static const uint32 BIT_SoFAndEarlier = 0x00000007; // 7
|
||||
static const uint32 BIT_SoDAndEarlier = 0x0000000F; // 15
|
||||
static const uint32 BIT_UFAndEarlier = 0x0000001F; // 31
|
||||
static const uint32 BIT_RoFAndEarlier = 0x0000003F; // 63
|
||||
|
||||
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC; // 4294967292
|
||||
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8; // 4294967288
|
||||
static const uint32 BIT_UFAndLater = 0xFFFFFFF0; // 4294967280
|
||||
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0; // 4294967264
|
||||
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0; // 4294967232
|
||||
|
||||
static const uint32 BIT_AllClients = 0xFFFFFFFF;
|
||||
|
||||
enum class ClientVersion
|
||||
{
|
||||
Unknown = 0,
|
||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
SoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
RoF2, // Build: 'May 10 2013 23:30:08'
|
||||
|
||||
MobNPC,
|
||||
MobMerc,
|
||||
MobBot,
|
||||
MobPet,
|
||||
};
|
||||
|
||||
#define CLIENT_VERSION_COUNT 12
|
||||
#define LAST_PC_CLIENT ClientVersion::RoF2
|
||||
#define LAST_NPC_CLIENT ClientVersion::MobPet
|
||||
|
||||
|
||||
static const char* ClientVersionName(ClientVersion version)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case ClientVersion::Unknown:
|
||||
return "Unknown";
|
||||
case ClientVersion::Client62:
|
||||
return "Client62";
|
||||
case ClientVersion::Titanium:
|
||||
return "Titanium";
|
||||
case ClientVersion::SoF:
|
||||
return "SoF";
|
||||
case ClientVersion::SoD:
|
||||
return "SoD";
|
||||
case ClientVersion::UF:
|
||||
return "UF";
|
||||
case ClientVersion::RoF:
|
||||
return "RoF";
|
||||
case ClientVersion::RoF2:
|
||||
return "RoF2";
|
||||
case ClientVersion::MobNPC:
|
||||
return "MobNPC";
|
||||
case ClientVersion::MobMerc:
|
||||
return "MobMerc";
|
||||
case ClientVersion::MobBot:
|
||||
return "MobBot";
|
||||
case ClientVersion::MobPet:
|
||||
return "MobPet";
|
||||
default:
|
||||
return "<ERROR> Invalid ClientVersion";
|
||||
};
|
||||
}
|
||||
|
||||
static uint32 ClientBitFromVersion(ClientVersion clientVersion)
|
||||
{
|
||||
switch (clientVersion)
|
||||
{
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
return 0;
|
||||
case ClientVersion::Titanium:
|
||||
case ClientVersion::SoF:
|
||||
case ClientVersion::SoD:
|
||||
case ClientVersion::UF:
|
||||
case ClientVersion::RoF:
|
||||
case ClientVersion::RoF2:
|
||||
case ClientVersion::MobNPC:
|
||||
case ClientVersion::MobMerc:
|
||||
case ClientVersion::MobBot:
|
||||
case ClientVersion::MobPet:
|
||||
return ((uint32)1 << (static_cast<unsigned int>(clientVersion) - 1));
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static ClientVersion ClientVersionFromBit(uint32 clientVersionBit)
|
||||
{
|
||||
switch (clientVersionBit)
|
||||
{
|
||||
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown):
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)):
|
||||
return ClientVersion::Unknown;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)):
|
||||
return ClientVersion::Titanium;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)):
|
||||
return ClientVersion::SoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)):
|
||||
return ClientVersion::SoD;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)):
|
||||
return ClientVersion::UF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)):
|
||||
return ClientVersion::RoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)):
|
||||
return ClientVersion::RoF2;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::MobNPC) - 1)):
|
||||
return ClientVersion::MobNPC;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::MobMerc) - 1)):
|
||||
return ClientVersion::MobMerc;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::MobBot) - 1)):
|
||||
return ClientVersion::MobBot;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::MobPet) - 1)):
|
||||
return ClientVersion::MobPet;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32 ExpansionFromClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
switch(clientVersion)
|
||||
{
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
case ClientVersion::Titanium:
|
||||
return 0x000007FFU;
|
||||
case ClientVersion::SoF:
|
||||
return 0x00007FFFU;
|
||||
case ClientVersion::SoD:
|
||||
return 0x0000FFFFU;
|
||||
case ClientVersion::UF:
|
||||
return 0x0001FFFFU;
|
||||
case ClientVersion::RoF:
|
||||
case ClientVersion::RoF2:
|
||||
return 0x000FFFFFU;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CLIENTVERSIONS_H */
|
||||
@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
Log.Out(Logs::General, Logs::Crash, buffer);
|
||||
Log(Logs::General, Logs::Crash, buffer);
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
};
|
||||
@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
break;
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
break;
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
||||
break;
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
break;
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
break;
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
break;
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
break;
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
break;
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
break;
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
break;
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
break;
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
break;
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
Log(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
break;
|
||||
default:
|
||||
Log.Out(Logs::General, Logs::Crash, "Unknown Exception");
|
||||
Log(Logs::General, Logs::Crash, "Unknown Exception");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@ -13,36 +14,42 @@
|
||||
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef COMMON_DATA_VERIFICATION_H
|
||||
#define COMMON_DATA_VERIFICATION_H
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
template <typename T>
|
||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(value, upper));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(value, upper));
|
||||
}
|
||||
template <typename T>
|
||||
T ClampLower(const T& value, const T& lower) {
|
||||
return std::max(lower, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ClampLower(const T& value, const T& lower) {
|
||||
return std::max(lower, value);
|
||||
}
|
||||
template <typename T>
|
||||
T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
template <typename T1, typename T2, typename T3>
|
||||
bool ValueWithin(const T1& value, const T2& lower, const T3& upper) {
|
||||
return value >= (T1)lower && value <= (T1)upper;
|
||||
}
|
||||
|
||||
}
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif
|
||||
#endif /*COMMON_DATA_VERIFICATION_H*/
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <mysqld_error.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -48,7 +49,6 @@
|
||||
extern Client client;
|
||||
|
||||
Database::Database () {
|
||||
DBInitVars();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -57,7 +57,6 @@ Establish a connection to a mysql database with the supplied parameters
|
||||
|
||||
Database::Database(const char* host, const char* user, const char* passwd, const char* database, uint32 port)
|
||||
{
|
||||
DBInitVars();
|
||||
Connect(host, user, passwd, database, port);
|
||||
}
|
||||
|
||||
@ -65,34 +64,21 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
uint32 errnum= 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
Log.Out(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
Log(Logs::General, Logs::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Log.Out(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port);
|
||||
Log(Logs::General, Logs::Status, "Using database '%s' at %s:%d", database, host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Database::DBInitVars() {
|
||||
varcache_array = 0;
|
||||
varcache_max = 0;
|
||||
varcache_lastupdate = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Close the connection to the database
|
||||
*/
|
||||
|
||||
Database::~Database()
|
||||
{
|
||||
unsigned int x;
|
||||
if (varcache_array) {
|
||||
for (x=0; x<varcache_max; x++) {
|
||||
safe_delete_array(varcache_array[x]);
|
||||
}
|
||||
safe_delete_array(varcache_array);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -222,7 +208,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta
|
||||
else
|
||||
query = StringFormat("INSERT INTO account SET name='%s', status=%i, lsaccount_id=%i, time_creation=UNIX_TIMESTAMP();",name, status, lsaccount_id);
|
||||
|
||||
Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status);
|
||||
Log(Logs::General, Logs::World_Server, "Account Attempting to be created: '%s' status: %i", name, status);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
@ -239,7 +225,7 @@ uint32 Database::CreateAccount(const char* name, const char* password, int16 sta
|
||||
|
||||
bool Database::DeleteAccount(const char* name) {
|
||||
std::string query = StringFormat("DELETE FROM account WHERE name='%s';",name);
|
||||
Log.Out(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name);
|
||||
Log(Logs::General, Logs::World_Server, "Account Attempting to be deleted:'%s'", name);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
@ -286,7 +272,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
if (row[0] && atoi(row[0]) > 0){
|
||||
Log.Out(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name);
|
||||
Log(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -304,20 +290,24 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
||||
bool Database::DeleteCharacter(char *name) {
|
||||
uint32 charid = 0;
|
||||
if(!name || !strlen(name)) {
|
||||
Log.Out(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)");
|
||||
Log(Logs::General, Logs::World_Server, "DeleteCharacter: request to delete without a name (empty char slot)");
|
||||
return false;
|
||||
}
|
||||
Log.Out(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name);
|
||||
Log(Logs::General, Logs::World_Server, "Database::DeleteCharacter name : '%s'", name);
|
||||
|
||||
/* Get id from character_data before deleting record so we can clean up the rest of the tables */
|
||||
std::string query = StringFormat("SELECT `id` from `character_data` WHERE `name` = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) { charid = atoi(row[0]); }
|
||||
if (charid <= 0){ std::cerr << "Database::DeleteCharacter :: Character not found, stopping delete...\n"; return false; }
|
||||
if (charid <= 0){
|
||||
Log(Logs::General, Logs::Error, "Database::DeleteCharacter :: Character (%s) not found, stopping delete...", name);
|
||||
return false;
|
||||
}
|
||||
|
||||
query = StringFormat("DELETE FROM `quest_globals` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `character_activities` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `character_enabledtasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `character_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `completed_tasks` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `friends` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
query = StringFormat("DELETE FROM `mail` WHERE `charid` = '%d'", charid); QueryDatabase(query);
|
||||
@ -638,10 +628,23 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
/* Save Bind Points */
|
||||
query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, slot)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||
character_id, pp->binds[2].zoneId, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
|
||||
character_id, pp->binds[3].zoneId, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
|
||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||
); results = QueryDatabase(query);
|
||||
); results = QueryDatabase(query);
|
||||
|
||||
/* HoTT Ability */
|
||||
if(RuleB(Character, GrantHoTTOnCreate))
|
||||
{
|
||||
query = StringFormat("INSERT INTO `character_leadership_abilities` (id, slot, rank) VALUES (%u, %i, %i)", character_id, 14, 1);
|
||||
results = QueryDatabase(query);
|
||||
}
|
||||
|
||||
/* Save Skills */
|
||||
int firstquery = 0;
|
||||
@ -677,14 +680,14 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
}
|
||||
|
||||
/* This only for new Character creation storing */
|
||||
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv) {
|
||||
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv) {
|
||||
uint32 charid = 0;
|
||||
char zone[50];
|
||||
float x, y, z;
|
||||
charid = GetCharacterID(pp->name);
|
||||
|
||||
if(!charid) {
|
||||
Log.Out(Logs::General, Logs::Error, "StoreCharacter: no character id");
|
||||
Log(Logs::General, Logs::Error, "StoreCharacter: no character id");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -705,8 +708,8 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
|
||||
/* Insert starting inventory... */
|
||||
std::string invquery;
|
||||
for (int16 i=EmuConstants::EQUIPMENT_BEGIN; i<=EmuConstants::BANK_BAGS_END;) {
|
||||
const ItemInst* newinv = inv->GetItem(i);
|
||||
for (int16 i = EQEmu::legacy::EQUIPMENT_BEGIN; i <= EQEmu::legacy::BANK_BAGS_END;) {
|
||||
const EQEmu::ItemInstance* newinv = inv->GetItem(i);
|
||||
if (newinv) {
|
||||
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
||||
@ -714,16 +717,16 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
auto results = QueryDatabase(invquery);
|
||||
}
|
||||
|
||||
if (i == MainCursor) {
|
||||
i = EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
if (i == EQEmu::inventory::slotCursor) {
|
||||
i = EQEmu::legacy::GENERAL_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EmuConstants::CURSOR_BAG_END) {
|
||||
i = EmuConstants::BANK_BEGIN;
|
||||
else if (i == EQEmu::legacy::CURSOR_BAG_END) {
|
||||
i = EQEmu::legacy::BANK_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EmuConstants::BANK_END) {
|
||||
i = EmuConstants::BANK_BAGS_BEGIN;
|
||||
else if (i == EQEmu::legacy::BANK_END) {
|
||||
i = EQEmu::legacy::BANK_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
@ -836,7 +839,7 @@ void Database::GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID
|
||||
|
||||
}
|
||||
|
||||
void Database::GetCharName(uint32 char_id, char* name) {
|
||||
void Database::GetCharName(uint32 char_id, char* name) {
|
||||
std::string query = StringFormat("SELECT `name` FROM `character_data` WHERE id='%i'", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
@ -851,145 +854,69 @@ void Database::GetCharName(uint32 char_id, char* name) {
|
||||
}
|
||||
|
||||
bool Database::LoadVariables() {
|
||||
char *query = nullptr;
|
||||
|
||||
auto results = QueryDatabase(query, LoadVariables_MQ(&query));
|
||||
auto results = QueryDatabase(StringFormat("SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache.last_update));
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
safe_delete_array(query);
|
||||
return false;
|
||||
}
|
||||
|
||||
safe_delete_array(query);
|
||||
return LoadVariables_result(std::move(results));
|
||||
}
|
||||
|
||||
uint32 Database::LoadVariables_MQ(char** query)
|
||||
{
|
||||
return MakeAnyLenString(query, "SELECT varname, value, unix_timestamp() FROM variables where unix_timestamp(ts) >= %d", varcache_lastupdate);
|
||||
}
|
||||
|
||||
// always returns true? not sure about this.
|
||||
bool Database::LoadVariables_result(MySQLRequestResult results)
|
||||
{
|
||||
uint32 i = 0;
|
||||
LockMutex lock(&Mvarcache);
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return true;
|
||||
|
||||
if (!varcache_array) {
|
||||
varcache_max = results.RowCount();
|
||||
varcache_array = new VarCache_Struct*[varcache_max];
|
||||
for (i=0; i<varcache_max; i++)
|
||||
varcache_array[i] = 0;
|
||||
}
|
||||
else {
|
||||
uint32 tmpnewmax = varcache_max + results.RowCount();
|
||||
VarCache_Struct** tmp = new VarCache_Struct*[tmpnewmax];
|
||||
for (i=0; i<tmpnewmax; i++)
|
||||
tmp[i] = 0;
|
||||
for (i=0; i<varcache_max; i++)
|
||||
tmp[i] = varcache_array[i];
|
||||
VarCache_Struct** tmpdel = varcache_array;
|
||||
varcache_array = tmp;
|
||||
varcache_max = tmpnewmax;
|
||||
delete [] tmpdel;
|
||||
}
|
||||
LockMutex lock(&Mvarcache);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
varcache_lastupdate = atoi(row[2]);
|
||||
for (i=0; i<varcache_max; i++) {
|
||||
if (varcache_array[i]) {
|
||||
if (strcasecmp(varcache_array[i]->varname, row[0]) == 0) {
|
||||
delete varcache_array[i];
|
||||
varcache_array[i] = (VarCache_Struct*) new uint8[sizeof(VarCache_Struct) + strlen(row[1]) + 1];
|
||||
strn0cpy(varcache_array[i]->varname, row[0], sizeof(varcache_array[i]->varname));
|
||||
strcpy(varcache_array[i]->value, row[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
varcache_array[i] = (VarCache_Struct*) new uint8[sizeof(VarCache_Struct) + strlen(row[1]) + 1];
|
||||
strcpy(varcache_array[i]->varname, row[0]);
|
||||
strcpy(varcache_array[i]->value, row[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::string key, value;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
varcache.last_update = atoi(row[2]); // ahh should we be comparing if this is newer?
|
||||
key = row[0];
|
||||
value = row[1];
|
||||
std::transform(std::begin(key), std::end(key), std::begin(key), ::tolower); // keys are lower case, DB doesn't have to be
|
||||
varcache.Add(key, value);
|
||||
}
|
||||
|
||||
uint32 max_used = 0;
|
||||
for (i=0; i<varcache_max; i++) {
|
||||
if (varcache_array[i]) {
|
||||
if (i > max_used)
|
||||
max_used = i;
|
||||
}
|
||||
}
|
||||
|
||||
varcache_max = max_used + 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Gets variable from 'variables' table
|
||||
bool Database::GetVariable(const char* varname, char* varvalue, uint16 varvalue_len) {
|
||||
varvalue[0] = '\0';
|
||||
bool Database::GetVariable(std::string varname, std::string &varvalue)
|
||||
{
|
||||
varvalue.clear();
|
||||
|
||||
LockMutex lock(&Mvarcache);
|
||||
if (strlen(varname) <= 1)
|
||||
return false;
|
||||
for (uint32 i=0; i<varcache_max; i++) {
|
||||
|
||||
if (varcache_array[i]) {
|
||||
if (strcasecmp(varcache_array[i]->varname, varname) == 0) {
|
||||
snprintf(varvalue, varvalue_len, "%s", varcache_array[i]->value);
|
||||
varvalue[varvalue_len-1] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
if (varname.empty())
|
||||
return false;
|
||||
|
||||
std::transform(std::begin(varname), std::end(varname), std::begin(varname), ::tolower); // all keys are lower case
|
||||
auto tmp = varcache.Get(varname);
|
||||
if (tmp) {
|
||||
varvalue = *tmp;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Database::SetVariable(const char* varname_in, const char* varvalue_in) {
|
||||
|
||||
char *varname,*varvalue;
|
||||
|
||||
varname=(char *)malloc(strlen(varname_in)*2+1);
|
||||
varvalue=(char *)malloc(strlen(varvalue_in)*2+1);
|
||||
DoEscapeString(varname, varname_in, strlen(varname_in));
|
||||
DoEscapeString(varvalue, varvalue_in, strlen(varvalue_in));
|
||||
|
||||
std::string query = StringFormat("Update variables set value='%s' WHERE varname like '%s'", varvalue, varname);
|
||||
bool Database::SetVariable(const std::string varname, const std::string &varvalue)
|
||||
{
|
||||
std::string escaped_name = EscapeString(varname);
|
||||
std::string escaped_value = EscapeString(varvalue);
|
||||
std::string query = StringFormat("Update variables set value='%s' WHERE varname like '%s'", escaped_value.c_str(), escaped_name.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
free(varname);
|
||||
free(varvalue);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowsAffected() == 1)
|
||||
{
|
||||
LoadVariables(); // refresh cache
|
||||
free(varname);
|
||||
free(varvalue);
|
||||
return true;
|
||||
}
|
||||
|
||||
query = StringFormat("Insert Into variables (varname, value) values ('%s', '%s')", varname, varvalue);
|
||||
query = StringFormat("Insert Into variables (varname, value) values ('%s', '%s')", escaped_name.c_str(), escaped_value.c_str());
|
||||
results = QueryDatabase(query);
|
||||
free(varname);
|
||||
free(varvalue);
|
||||
|
||||
if (results.RowsAffected() != 1)
|
||||
return false;
|
||||
|
||||
|
||||
LoadVariables(); // refresh cache
|
||||
return true;
|
||||
}
|
||||
@ -1555,8 +1482,9 @@ void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) {
|
||||
QueryDatabase(query);
|
||||
}
|
||||
|
||||
void Database::AddReport(std::string who, std::string against, std::string lines) {
|
||||
char *escape_str = new char[lines.size()*2+1];
|
||||
void Database::AddReport(std::string who, std::string against, std::string lines)
|
||||
{
|
||||
auto escape_str = new char[lines.size() * 2 + 1];
|
||||
DoEscapeString(escape_str, lines.c_str(), lines.size());
|
||||
|
||||
std::string query = StringFormat("INSERT INTO reports (name, reported, reported_text) VALUES('%s', '%s', '%s')", EscapeString(who).c_str(), EscapeString(against).c_str(), escape_str);
|
||||
@ -1572,7 +1500,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
Log.Out(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||
Log(Logs::General, Logs::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1615,7 +1543,7 @@ uint32 Database::GetGroupID(const char* name){
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
// Commenting this out until logging levels can prevent this from going to console
|
||||
//Log.Out(Logs::General, Logs::None,, "Character not in a group: %s", name);
|
||||
//Log(Logs::General, Logs::None,, "Character not in a group: %s", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1662,7 +1590,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) {
|
||||
result = QueryDatabase(query);
|
||||
|
||||
if(!result.Success()) {
|
||||
Log.Out(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||
Log(Logs::General, Logs::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1859,7 +1787,7 @@ const char* Database::GetRaidLeaderName(uint32 raid_id)
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
Log.Out(Logs::General, Logs::Debug, "Unable to get Raid Leader Name for Raid ID: %u", raid_id);
|
||||
Log(Logs::General, Logs::Debug, "Unable to get Raid Leader Name for Raid ID: %u", raid_id);
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
@ -2128,6 +2056,8 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
|
||||
|
||||
void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
||||
{
|
||||
// log_settings previously initialized to '0' by EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
|
||||
std::string query =
|
||||
"SELECT "
|
||||
"log_category_id, "
|
||||
@ -2141,10 +2071,13 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
int log_category = 0;
|
||||
Log.file_logs_enabled = false;
|
||||
LogSys.file_logs_enabled = false;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
log_category = atoi(row[0]);
|
||||
if (log_category <= Logs::None || log_category >= Logs::MaxCategoryID)
|
||||
continue;
|
||||
|
||||
log_settings[log_category].log_to_console = atoi(row[2]);
|
||||
log_settings[log_category].log_to_file = atoi(row[3]);
|
||||
log_settings[log_category].log_to_gmsay = atoi(row[4]);
|
||||
@ -2164,7 +2097,7 @@ void Database::LoadLogSettings(EQEmuLogSys::LogSettings* log_settings)
|
||||
If we go through this whole loop and nothing is set to any debug level, there is no point to create a file or keep anything open
|
||||
*/
|
||||
if (log_settings[log_category].log_to_file > 0){
|
||||
Log.file_logs_enabled = true;
|
||||
LogSys.file_logs_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2186,7 +2119,7 @@ struct TimeOfDay_Struct Database::LoadTime(time_t &realtime)
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success() || results.RowCount() == 0){
|
||||
Log.Out(Logs::Detail, Logs::World_Server, "Loading EQ time of day failed. Using defaults.");
|
||||
Log(Logs::Detail, Logs::World_Server, "Loading EQ time of day failed. Using defaults.");
|
||||
eqTime.minute = 0;
|
||||
eqTime.hour = 9;
|
||||
eqTime.day = 1;
|
||||
@ -2216,3 +2149,27 @@ bool Database::SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year
|
||||
return results.Success();
|
||||
|
||||
}
|
||||
|
||||
int Database::GetIPExemption(std::string account_ip) {
|
||||
std::string query = StringFormat("SELECT `exemption_amount` FROM `ip_exemptions` WHERE `exemption_ip` = '%s'", account_ip.c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (results.Success() && results.RowCount() > 0) {
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
return RuleI(World, MaxClientsPerIP);
|
||||
}
|
||||
|
||||
int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
||||
std::string query = StringFormat("SELECT instance_list.id FROM instance_list INNER JOIN instance_list_player ON instance_list.id = instance_list_player.id WHERE instance_list.zone = '%i' AND instance_list_player.charid = '%i'", zone_id, char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (results.Success() && results.RowCount() > 0) {
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@ -37,10 +37,14 @@
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
|
||||
class Inventory;
|
||||
class MySQLRequestResult;
|
||||
class Client;
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
class InventoryProfile;
|
||||
}
|
||||
|
||||
struct EventLogDetails_Struct {
|
||||
uint32 id;
|
||||
char accountname[64];
|
||||
@ -67,8 +71,14 @@ struct npcDecayTimes_Struct {
|
||||
|
||||
|
||||
struct VarCache_Struct {
|
||||
char varname[26];
|
||||
char value[0];
|
||||
std::map<std::string, std::string> m_cache;
|
||||
uint32 last_update;
|
||||
VarCache_Struct() : last_update(0) { }
|
||||
void Add(const std::string &key, const std::string &value) { m_cache[key] = value; }
|
||||
const std::string *Get(const std::string &key) {
|
||||
auto it = m_cache.find(key);
|
||||
return (it != m_cache.end() ? &it->second : nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
class PTimerList;
|
||||
@ -88,7 +98,7 @@ class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
~Database();
|
||||
|
||||
/* Character Creation */
|
||||
@ -103,7 +113,7 @@ public:
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
|
||||
/* General Information Queries */
|
||||
@ -180,6 +190,10 @@ public:
|
||||
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
void SetAgreementFlag(uint32 acctid);
|
||||
|
||||
int GetIPExemption(std::string account_ip);
|
||||
|
||||
int GetInstanceID(uint32 char_id, uint32 zone_id);
|
||||
|
||||
|
||||
/* Groups */
|
||||
@ -215,11 +229,9 @@ public:
|
||||
|
||||
/* Database Variables */
|
||||
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool SetVariable(const char* varname, const char* varvalue);
|
||||
bool GetVariable(std::string varname, std::string &varvalue);
|
||||
bool SetVariable(const std::string varname, const std::string &varvalue);
|
||||
bool LoadVariables();
|
||||
uint32 LoadVariables_MQ(char** query);
|
||||
bool LoadVariables_result(MySQLRequestResult results);
|
||||
|
||||
/* General Queries */
|
||||
|
||||
@ -256,14 +268,10 @@ public:
|
||||
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||
|
||||
private:
|
||||
void DBInitVars();
|
||||
|
||||
std::map<uint32,std::string> zonename_array;
|
||||
|
||||
Mutex Mvarcache;
|
||||
uint32 varcache_max;
|
||||
VarCache_Struct** varcache_array;
|
||||
uint32 varcache_lastupdate;
|
||||
Mutex Mvarcache;
|
||||
VarCache_Struct varcache;
|
||||
|
||||
/* Groups, utility methods. */
|
||||
void ClearAllGroupLeaders();
|
||||
|
||||
@ -186,7 +186,7 @@ namespace Convert {
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*510*/ uint32 Items[EQEmu::textures::materialCount];
|
||||
/*546*/ char Name[64];
|
||||
/*610*/
|
||||
};
|
||||
@ -227,9 +227,9 @@ namespace Convert {
|
||||
/*0304*/ uint8 ability_time_minutes;
|
||||
/*0305*/ uint8 ability_time_hours; //place holder
|
||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||
/*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items
|
||||
/*0312*/ uint32 item_material[EQEmu::textures::materialCount]; // Item texture/material of worn/held items
|
||||
/*0348*/ uint8 unknown0348[44];
|
||||
/*0392*/ Convert::Color_Struct item_tint[_MaterialCount];
|
||||
/*0392*/ Convert::Color_Struct item_tint[EQEmu::textures::materialCount];
|
||||
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||
/*2352*/ char servername[32]; // length probably not right
|
||||
@ -330,7 +330,7 @@ namespace Convert {
|
||||
/*7212*/ uint32 tribute_points;
|
||||
/*7216*/ uint32 unknown7252;
|
||||
/*7220*/ uint32 tribute_active; //1=active
|
||||
/*7224*/ Convert::Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
|
||||
/*7224*/ Convert::Tribute_Struct tributes[EQEmu::legacy::TRIBUTE_SIZE];
|
||||
/*7264*/ Convert::Disciplines_Struct disciplines;
|
||||
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
|
||||
/*7744*/ char unknown7780[160];
|
||||
@ -472,31 +472,18 @@ bool Database::CheckDatabaseConversions() {
|
||||
CheckDatabaseConvertPPDeblob();
|
||||
CheckDatabaseConvertCorpseDeblob();
|
||||
|
||||
/* Fetch Automatic Upgrade Script */
|
||||
if (!std::ifstream("eqemu_update.pl")){
|
||||
/* Fetch EQEmu Server script */
|
||||
if (!std::ifstream("eqemu_server.pl")){
|
||||
std::cout << "Pulling down automatic database upgrade script..." << std::endl;
|
||||
#ifdef _WIN32
|
||||
system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl'); if ($response->is_success){ open(FILE, '> eqemu_update.pl'); print FILE $response->decoded_content; close(FILE); }\"");
|
||||
system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_server.pl'); if ($response->is_success){ open(FILE, '> eqemu_server.pl'); print FILE $response->decoded_content; close(FILE); }\"");
|
||||
#else
|
||||
system("wget --no-check-certificate -O eqemu_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl");
|
||||
system("wget --no-check-certificate -O eqemu_server.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_server.pl");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Automatic (Database) Upgrade Script
|
||||
Script: eqemu_update.pl V 1 - the number that world passes to the script will
|
||||
force the script to check for a newer version to update itself with
|
||||
eqemu_update.pl ran_from_world - won't bring up a menu if your database versions match
|
||||
eqemu_update.pl - ran standalone will bring up a menu prompt
|
||||
*/
|
||||
|
||||
/* Check for a new version of this script, the arg passed
|
||||
would have to be higher than the copy they have downloaded
|
||||
locally and they will re fetch */
|
||||
system("perl eqemu_update.pl V 14");
|
||||
|
||||
/* Run Automatic Database Upgrade Script */
|
||||
system("perl eqemu_update.pl ran_from_world");
|
||||
/* Run EQEmu Server script (Checks for database updates) */
|
||||
system("perl eqemu_server.pl ran_from_world");
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1416,7 +1403,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
/* Run Material Color Convert */
|
||||
first_entry = 0; rquery = "";
|
||||
for (i = 0; i < _MaterialCount; i++){
|
||||
for (i = EQEmu::textures::textureBegin; i < EQEmu::textures::materialCount; i++){
|
||||
if (pp->item_tint[i].color > 0){
|
||||
if (first_entry != 1){
|
||||
rquery = StringFormat("REPLACE INTO `character_material` (id, slot, blue, green, red, use_tint, color) VALUES (%u, %u, %u, %u, %u, %u, %u)", character_id, i, pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint, pp->item_tint[i].color);
|
||||
@ -1428,7 +1415,7 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
/* Run Tribute Convert */
|
||||
first_entry = 0; rquery = "";
|
||||
for (i = 0; i < EmuConstants::TRIBUTE_SIZE; i++){
|
||||
for (i = 0; i < EQEmu::legacy::TRIBUTE_SIZE; i++){
|
||||
if (pp->tributes[i].tribute > 0 && pp->tributes[i].tribute != 4294967295){
|
||||
if (first_entry != 1){
|
||||
rquery = StringFormat("REPLACE INTO `character_tribute` (id, tier, tribute) VALUES (%u, %u, %u)", character_id, pp->tributes[i].tier, pp->tributes[i].tribute);
|
||||
|
||||
@ -98,20 +98,20 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
|
||||
pStatus = Error;
|
||||
|
||||
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
||||
}
|
||||
|
||||
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
auto errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
/* Implement Logging at the Root */
|
||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||
if (Log.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
||||
Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
||||
if (LogSys.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
||||
Log(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
||||
}
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||
@ -127,12 +127,14 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
|
||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||
|
||||
if (Log.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
||||
{
|
||||
if ((strncasecmp(query, "select", 6) == 0))
|
||||
Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s");
|
||||
else
|
||||
Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s");
|
||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s returned)", query, requestResult.RowCount(), requestResult.RowCount() == 1 ? "" : "s");
|
||||
}
|
||||
else {
|
||||
Log(Logs::General, Logs::MySQLQuery, "%s (%u row%s affected)", query, requestResult.RowsAffected(), requestResult.RowsAffected() == 1 ? "" : "s");
|
||||
}
|
||||
}
|
||||
|
||||
return requestResult;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define DBCORE_H
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
149
common/deity.cpp
Normal file
149
common/deity.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
|
||||
#include "deity.h"
|
||||
|
||||
|
||||
EQEmu::deity::DeityTypeBit EQEmu::deity::ConvertDeityTypeToDeityTypeBit(DeityType deity_type)
|
||||
{
|
||||
switch (deity_type) {
|
||||
case DeityBertoxxulous:
|
||||
return bit_DeityBertoxxulous;
|
||||
case DeityBrellSirilis:
|
||||
return bit_DeityBrellSirilis;
|
||||
case DeityCazicThule:
|
||||
return bit_DeityCazicThule;
|
||||
case DeityErollisiMarr:
|
||||
return bit_DeityErollisiMarr;
|
||||
case DeityBristlebane:
|
||||
return bit_DeityBristlebane;
|
||||
case DeityInnoruuk:
|
||||
return bit_DeityInnoruuk;
|
||||
case DeityKarana:
|
||||
return bit_DeityKarana;
|
||||
case DeityMithanielMarr:
|
||||
return bit_DeityMithanielMarr;
|
||||
case DeityPrexus:
|
||||
return bit_DeityPrexus;
|
||||
case DeityQuellious:
|
||||
return bit_DeityQuellious;
|
||||
case DeityRallosZek:
|
||||
return bit_DeityRallosZek;
|
||||
case DeityRodcetNife:
|
||||
return bit_DeityRodcetNife;
|
||||
case DeitySolusekRo:
|
||||
return bit_DeitySolusekRo;
|
||||
case DeityTheTribunal:
|
||||
return bit_DeityTheTribunal;
|
||||
case DeityTunare:
|
||||
return bit_DeityTunare;
|
||||
case DeityVeeshan:
|
||||
return bit_DeityVeeshan;
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic:
|
||||
return bit_DeityAgnostic;
|
||||
default:
|
||||
return bit_DeityAll;
|
||||
};
|
||||
}
|
||||
|
||||
EQEmu::deity::DeityType EQEmu::deity::ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit)
|
||||
{
|
||||
switch (deity_type_bit) {
|
||||
case bit_DeityAgnostic:
|
||||
return DeityAgnostic;
|
||||
case bit_DeityBertoxxulous:
|
||||
return DeityBertoxxulous;
|
||||
case bit_DeityBrellSirilis:
|
||||
return DeityBrellSirilis;
|
||||
case bit_DeityCazicThule:
|
||||
return DeityCazicThule;
|
||||
case bit_DeityErollisiMarr:
|
||||
return DeityErollisiMarr;
|
||||
case bit_DeityBristlebane:
|
||||
return DeityBristlebane;
|
||||
case bit_DeityInnoruuk:
|
||||
return DeityInnoruuk;
|
||||
case bit_DeityKarana:
|
||||
return DeityKarana;
|
||||
case bit_DeityMithanielMarr:
|
||||
return DeityMithanielMarr;
|
||||
case bit_DeityPrexus:
|
||||
return DeityPrexus;
|
||||
case bit_DeityQuellious:
|
||||
return DeityQuellious;
|
||||
case bit_DeityRallosZek:
|
||||
return DeityRallosZek;
|
||||
case bit_DeityRodcetNife:
|
||||
return DeityRodcetNife;
|
||||
case bit_DeitySolusekRo:
|
||||
return DeitySolusekRo;
|
||||
case bit_DeityTheTribunal:
|
||||
return DeityTheTribunal;
|
||||
case bit_DeityTunare:
|
||||
return DeityTunare;
|
||||
case bit_DeityVeeshan:
|
||||
return DeityVeeshan;
|
||||
default:
|
||||
return DeityUnknown;
|
||||
};
|
||||
}
|
||||
|
||||
const char* EQEmu::deity::DeityName(DeityType deity_type)
|
||||
{
|
||||
switch (deity_type) {
|
||||
case DeityBertoxxulous:
|
||||
return "Bertoxxulous";
|
||||
case DeityBrellSirilis:
|
||||
return "Brell Serilis";
|
||||
case DeityCazicThule:
|
||||
return "Cazic-Thule";
|
||||
case DeityErollisiMarr:
|
||||
return "Erollisi Marr";
|
||||
case DeityBristlebane:
|
||||
return "Bristlebane";
|
||||
case DeityInnoruuk:
|
||||
return "Innoruuk";
|
||||
case DeityKarana:
|
||||
return "Karana";
|
||||
case DeityMithanielMarr:
|
||||
return "Mithaniel Marr";
|
||||
case DeityPrexus:
|
||||
return "Prexus";
|
||||
case DeityQuellious:
|
||||
return "Quellious";
|
||||
case DeityRallosZek:
|
||||
return "Rallos Zek";
|
||||
case DeityRodcetNife:
|
||||
return "Rodcet Nife";
|
||||
case DeitySolusekRo:
|
||||
return "Solusek Ro";
|
||||
case DeityTheTribunal:
|
||||
return "The Tribunal";
|
||||
case DeityTunare:
|
||||
return "Tunare";
|
||||
case DeityVeeshan:
|
||||
return "Veeshan";
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic:
|
||||
return "Agnostic";
|
||||
default:
|
||||
return "Unknown";
|
||||
};
|
||||
}
|
||||
197
common/deity.h
197
common/deity.h
@ -1,5 +1,6 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
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
|
||||
@ -13,154 +14,68 @@
|
||||
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef DEITY_H
|
||||
#define DEITY_H
|
||||
|
||||
#ifndef COMMON_DEITY_H
|
||||
#define COMMON_DEITY_H
|
||||
|
||||
#include "types.h"
|
||||
#include <string>
|
||||
|
||||
// NOTE: This code is not fully implemented since there are no references in the existing code
|
||||
|
||||
/*
|
||||
** Diety types
|
||||
**
|
||||
** (ref: eqstr_us.txt)
|
||||
**
|
||||
** (Another orphaned enumeration...)
|
||||
*/
|
||||
enum DeityTypes
|
||||
namespace EQEmu
|
||||
{
|
||||
/*----*/ DeityUnknown = 0,
|
||||
/*----*/ DeityAgnostic_LB = 140,
|
||||
/*3251*/ DeityBertoxxulous = 201,
|
||||
/*3262*/ DeityBrellSirilis,
|
||||
/*3253*/ DeityCazicThule,
|
||||
/*3256*/ DeityErollisiMarr,
|
||||
/*3252*/ DeityBristlebane,
|
||||
/*3254*/ DeityInnoruuk,
|
||||
/*3255*/ DeityKarana,
|
||||
/*3257*/ DeityMithanielMarr,
|
||||
/*3259*/ DeityPrexus,
|
||||
/*3260*/ DeityQuellious,
|
||||
/*3266*/ DeityRallosZek,
|
||||
/*3258*/ DeityRodcetNife,
|
||||
/*3261*/ DeitySolusekRo,
|
||||
/*3263*/ DeityTheTribunal,
|
||||
/*3264*/ DeityTunare,
|
||||
/*3265*/ DeityVeeshan,
|
||||
/*3250*/ DeityAgnostic = 396
|
||||
};
|
||||
namespace deity {
|
||||
enum DeityType {
|
||||
DeityUnknown = 0,
|
||||
DeityAgnostic_LB = 140,
|
||||
DeityBertoxxulous = 201,
|
||||
DeityBrellSirilis,
|
||||
DeityCazicThule,
|
||||
DeityErollisiMarr,
|
||||
DeityBristlebane,
|
||||
DeityInnoruuk,
|
||||
DeityKarana,
|
||||
DeityMithanielMarr,
|
||||
DeityPrexus,
|
||||
DeityQuellious,
|
||||
DeityRallosZek,
|
||||
DeityRodcetNife,
|
||||
DeitySolusekRo,
|
||||
DeityTheTribunal,
|
||||
DeityTunare,
|
||||
DeityVeeshan,
|
||||
DeityAgnostic = 396
|
||||
};
|
||||
|
||||
/*
|
||||
** Deity type bits
|
||||
**
|
||||
** (New orphan, but make use of it!)
|
||||
*/
|
||||
enum DeityTypeBits : uint32
|
||||
{
|
||||
BIT_DeityAll = 0x00000000,
|
||||
BIT_DeityAgnostic = 0x00000001,
|
||||
BIT_DeityBertoxxulous = 0x00000002,
|
||||
BIT_DeityBrellSirilis = 0x00000004,
|
||||
BIT_DeityCazicThule = 0x00000008,
|
||||
BIT_DeityErollisiMarr = 0x00000010,
|
||||
BIT_DeityBristlebane = 0x00000020,
|
||||
BIT_DeityInnoruuk = 0x00000040,
|
||||
BIT_DeityKarana = 0x00000080,
|
||||
BIT_DeityMithanielMarr = 0x00000100,
|
||||
BIT_DeityPrexus = 0x00000200,
|
||||
BIT_DeityQuellious = 0x00000400,
|
||||
BIT_DeityRallosZek = 0x00000800,
|
||||
BIT_DeityRodcetNife = 0x00001000,
|
||||
BIT_DeitySolusekRo = 0x00002000,
|
||||
BIT_DeityTheTribunal = 0x00004000,
|
||||
BIT_DeityTunare = 0x00008000,
|
||||
BIT_DeityVeeshan = 0x00010000
|
||||
};
|
||||
enum DeityTypeBit : uint32 {
|
||||
bit_DeityNone = 0x00000000,
|
||||
bit_DeityAgnostic = 0x00000001,
|
||||
bit_DeityBertoxxulous = 0x00000002,
|
||||
bit_DeityBrellSirilis = 0x00000004,
|
||||
bit_DeityCazicThule = 0x00000008,
|
||||
bit_DeityErollisiMarr = 0x00000010,
|
||||
bit_DeityBristlebane = 0x00000020,
|
||||
bit_DeityInnoruuk = 0x00000040,
|
||||
bit_DeityKarana = 0x00000080,
|
||||
bit_DeityMithanielMarr = 0x00000100,
|
||||
bit_DeityPrexus = 0x00000200,
|
||||
bit_DeityQuellious = 0x00000400,
|
||||
bit_DeityRallosZek = 0x00000800,
|
||||
bit_DeityRodcetNife = 0x00001000,
|
||||
bit_DeitySolusekRo = 0x00002000,
|
||||
bit_DeityTheTribunal = 0x00004000,
|
||||
bit_DeityTunare = 0x00008000,
|
||||
bit_DeityVeeshan = 0x00010000,
|
||||
bit_DeityAll = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
static DeityTypeBits ConvertDeityToBitDeity(DeityTypes deity)
|
||||
{
|
||||
switch(deity)
|
||||
{
|
||||
case DeityBertoxxulous: { return BIT_DeityBertoxxulous; }
|
||||
case DeityBrellSirilis: { return BIT_DeityBrellSirilis; }
|
||||
case DeityCazicThule: { return BIT_DeityCazicThule; }
|
||||
case DeityErollisiMarr: { return BIT_DeityErollisiMarr; }
|
||||
case DeityBristlebane: { return BIT_DeityBristlebane; }
|
||||
case DeityInnoruuk: { return BIT_DeityInnoruuk; }
|
||||
case DeityKarana: { return BIT_DeityKarana; }
|
||||
case DeityMithanielMarr: { return BIT_DeityMithanielMarr; }
|
||||
case DeityPrexus: { return BIT_DeityPrexus; }
|
||||
case DeityQuellious: { return BIT_DeityQuellious; }
|
||||
case DeityRallosZek: { return BIT_DeityRallosZek; }
|
||||
case DeityRodcetNife: { return BIT_DeityRodcetNife; }
|
||||
case DeitySolusekRo: { return BIT_DeitySolusekRo; }
|
||||
case DeityTheTribunal: { return BIT_DeityTheTribunal; }
|
||||
case DeityTunare: { return BIT_DeityTunare; }
|
||||
case DeityVeeshan: { return BIT_DeityVeeshan; }
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic: { return BIT_DeityAgnostic; }
|
||||
default: { break; }
|
||||
};
|
||||
extern DeityTypeBit ConvertDeityTypeToDeityTypeBit(DeityType deity_type);
|
||||
extern DeityType ConvertDeityTypeBitToDeityType(DeityTypeBit deity_type_bit);
|
||||
extern const char* DeityName(DeityType deity_type);
|
||||
|
||||
return BIT_DeityAll;
|
||||
};
|
||||
} /*deity*/
|
||||
|
||||
static DeityTypes ConvertBitDeityToDeity(DeityTypeBits deity_bit)
|
||||
{
|
||||
switch(deity_bit)
|
||||
{
|
||||
case BIT_DeityAgnostic: { return DeityAgnostic; }
|
||||
case BIT_DeityBertoxxulous: { return DeityBertoxxulous; }
|
||||
case BIT_DeityBrellSirilis: { return DeityBrellSirilis; }
|
||||
case BIT_DeityCazicThule: { return DeityCazicThule; }
|
||||
case BIT_DeityErollisiMarr: { return DeityErollisiMarr; }
|
||||
case BIT_DeityBristlebane: { return DeityBristlebane; }
|
||||
case BIT_DeityInnoruuk: { return DeityInnoruuk; }
|
||||
case BIT_DeityKarana: { return DeityKarana; }
|
||||
case BIT_DeityMithanielMarr: { return DeityMithanielMarr; }
|
||||
case BIT_DeityPrexus: { return DeityPrexus; }
|
||||
case BIT_DeityQuellious: { return DeityQuellious; }
|
||||
case BIT_DeityRallosZek: { return DeityRallosZek; }
|
||||
case BIT_DeityRodcetNife: { return DeityRodcetNife; }
|
||||
case BIT_DeitySolusekRo: { return DeitySolusekRo; }
|
||||
case BIT_DeityTheTribunal: { return DeityTheTribunal; }
|
||||
case BIT_DeityTunare: { return DeityTunare; }
|
||||
case BIT_DeityVeeshan: { return DeityVeeshan; }
|
||||
default: { break; }
|
||||
};
|
||||
} /*EQEmu*/
|
||||
|
||||
return DeityUnknown;
|
||||
};
|
||||
|
||||
static std::string GetDeityName(DeityTypes deity)
|
||||
{
|
||||
switch(deity)
|
||||
{
|
||||
case DeityBertoxxulous: { return "Bertoxxulous"; }
|
||||
case DeityBrellSirilis: { return "Brell Serilis"; }
|
||||
case DeityCazicThule: { return "Cazic-Thule"; }
|
||||
case DeityErollisiMarr: { return "Erollisi Marr"; }
|
||||
case DeityBristlebane: { return "Bristlebane"; }
|
||||
case DeityInnoruuk: { return "Innoruuk"; }
|
||||
case DeityKarana: { return "Karana"; }
|
||||
case DeityMithanielMarr: { return "Mithaniel Marr"; }
|
||||
case DeityPrexus: { return "Prexus"; }
|
||||
case DeityQuellious: { return "Quellious"; }
|
||||
case DeityRallosZek: { return "Rallos Zek"; }
|
||||
case DeityRodcetNife: { return "Rodcet Nife"; }
|
||||
case DeitySolusekRo: { return "Solusek Ro"; }
|
||||
case DeityTheTribunal: { return "The Tribunal"; }
|
||||
case DeityTunare: { return "Tunare"; }
|
||||
case DeityVeeshan: { return "Veeshan"; }
|
||||
case DeityAgnostic_LB:
|
||||
case DeityAgnostic: { return "Agnostic"; }
|
||||
default: { break; }
|
||||
};
|
||||
|
||||
return "Unknown";
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* COMMON_DEITY_H */
|
||||
|
||||
20
common/emu_constants.cpp
Normal file
20
common/emu_constants.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
|
||||
#include "emu_constants.h"
|
||||
158
common/emu_constants.h
Normal file
158
common/emu_constants.h
Normal file
@ -0,0 +1,158 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 COMMON_EMU_CONSTANTS_H
|
||||
#define COMMON_EMU_CONSTANTS_H
|
||||
|
||||
#include "eq_limits.h"
|
||||
#include "emu_legacy.h"
|
||||
#include "emu_versions.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace inventory {
|
||||
//using namespace RoF2::invtype;
|
||||
//using namespace RoF2::invslot;
|
||||
//using namespace RoF2::invbag;
|
||||
//using namespace RoF2::invaug;
|
||||
|
||||
enum : int16 { typeInvalid = -1, slotInvalid = -1, containerInvalid = -1, socketInvalid = -1 }; // temporary
|
||||
enum : int16 { typeBegin = 0, slotBegin = 0, containerBegin = 0, socketBegin = 0 }; // temporary
|
||||
|
||||
enum PossessionsSlots : int16 { // temporary
|
||||
slotCharm = 0,
|
||||
slotEar1,
|
||||
slotHead,
|
||||
slotFace,
|
||||
slotEar2,
|
||||
slotNeck, // 5
|
||||
slotShoulders,
|
||||
slotArms,
|
||||
slotBack,
|
||||
slotWrist1,
|
||||
slotWrist2, // 10
|
||||
slotRange,
|
||||
slotHands,
|
||||
slotPrimary,
|
||||
slotSecondary,
|
||||
slotFinger1, // 15
|
||||
slotFinger2,
|
||||
slotChest,
|
||||
slotLegs,
|
||||
slotFeet,
|
||||
slotWaist, // 20
|
||||
slotPowerSource = 9999,
|
||||
slotAmmo = 21,
|
||||
slotGeneral1,
|
||||
slotGeneral2,
|
||||
slotGeneral3,
|
||||
slotGeneral4, // 25
|
||||
slotGeneral5,
|
||||
slotGeneral6,
|
||||
slotGeneral7,
|
||||
slotGeneral8,
|
||||
slotCursor, // 30
|
||||
slotCount
|
||||
};
|
||||
|
||||
enum InventoryTypes : int16 { // temporary
|
||||
typePossessions = 0,
|
||||
typeBank,
|
||||
typeSharedBank,
|
||||
typeTrade,
|
||||
typeWorld,
|
||||
typeLimbo, // 5
|
||||
typeTribute,
|
||||
typeTrophyTribute,
|
||||
typeGuildTribute,
|
||||
typeMerchant,
|
||||
typeDeleted, // 10
|
||||
typeCorpse,
|
||||
typeBazaar,
|
||||
typeInspect,
|
||||
typeRealEstate,
|
||||
typeViewMODPC, // 15
|
||||
typeViewMODBank,
|
||||
typeViewMODSharedBank,
|
||||
typeViewMODLimbo,
|
||||
typeAltStorage,
|
||||
typeArchived, // 20
|
||||
typeMail,
|
||||
typeGuildTrophyTribute,
|
||||
typeKrono,
|
||||
typeOther,
|
||||
typeCount
|
||||
};
|
||||
|
||||
static int16 SlotCount(int16 type_index) { return 0; } // temporary
|
||||
|
||||
const int16 ContainerCount = 10; // temporary
|
||||
const int16 SocketCount = 6; // temporary
|
||||
|
||||
} /*inventory*/
|
||||
|
||||
namespace constants {
|
||||
const EQEmu::versions::ClientVersion CharacterCreationClient = EQEmu::versions::ClientVersion::RoF2;
|
||||
const size_t CharacterCreationMax = RoF2::constants::CharacterCreationLimit;
|
||||
|
||||
const size_t SayLinkBodySize = RoF2::constants::SayLinkBodySize;
|
||||
|
||||
const int LongBuffs = RoF2::constants::LongBuffs;
|
||||
const int ShortBuffs = RoF2::constants::ShortBuffs;
|
||||
const int DiscBuffs = RoF2::constants::DiscBuffs;
|
||||
const int TotalBuffs = RoF2::constants::TotalBuffs;
|
||||
const int NPCBuffs = RoF2::constants::NPCBuffs;
|
||||
const int PetBuffs = RoF2::constants::PetBuffs;
|
||||
const int MercBuffs = RoF2::constants::MercBuffs;
|
||||
|
||||
} /*constants*/
|
||||
|
||||
enum class CastingSlot : uint32 {
|
||||
Gem1 = 0,
|
||||
Gem2 = 1,
|
||||
Gem3 = 2,
|
||||
Gem4 = 3,
|
||||
Gem5 = 4,
|
||||
Gem6 = 5,
|
||||
Gem7 = 6,
|
||||
Gem8 = 7,
|
||||
Gem9 = 8,
|
||||
Gem10 = 9,
|
||||
Gem11 = 10,
|
||||
Gem12 = 11,
|
||||
MaxGems = 12,
|
||||
Ability = 20, // HT/LoH for Tit
|
||||
PotionBelt = 21, // Tit uses a different slot for PB
|
||||
Item = 22,
|
||||
Discipline = 23,
|
||||
AltAbility = 0xFF
|
||||
};
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||
|
||||
/* hack list to prevent circular references
|
||||
|
||||
eq_limits.h:EQEmu::inventory::LookupEntry::InventoryTypeSize[n];
|
||||
|
||||
*/
|
||||
20
common/emu_legacy.cpp
Normal file
20
common/emu_legacy.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
|
||||
#include "emu_legacy.h"
|
||||
182
common/emu_legacy.h
Normal file
182
common/emu_legacy.h
Normal file
@ -0,0 +1,182 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 COMMON_EMU_LEGACY_H
|
||||
#define COMMON_EMU_LEGACY_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
// this is for perl and other legacy systems
|
||||
namespace legacy {
|
||||
enum InventorySlot {
|
||||
SLOT_CHARM = 0,
|
||||
SLOT_EAR01 = 1,
|
||||
SLOT_HEAD = 2,
|
||||
SLOT_FACE = 3,
|
||||
SLOT_EAR02 = 4,
|
||||
SLOT_NECK = 5,
|
||||
SLOT_SHOULDER = 6,
|
||||
SLOT_ARMS = 7,
|
||||
SLOT_BACK = 8,
|
||||
SLOT_BRACER01 = 9,
|
||||
SLOT_BRACER02 = 10,
|
||||
SLOT_RANGE = 11,
|
||||
SLOT_HANDS = 12,
|
||||
SLOT_PRIMARY = 13,
|
||||
SLOT_SECONDARY = 14,
|
||||
SLOT_RING01 = 15,
|
||||
SLOT_RING02 = 16,
|
||||
SLOT_CHEST = 17,
|
||||
SLOT_LEGS = 18,
|
||||
SLOT_FEET = 19,
|
||||
SLOT_WAIST = 20,
|
||||
SLOT_POWER_SOURCE = 9999,
|
||||
SLOT_AMMO = 21,
|
||||
SLOT_GENERAL_1 = 22,
|
||||
SLOT_GENERAL_2 = 23,
|
||||
SLOT_GENERAL_3 = 24,
|
||||
SLOT_GENERAL_4 = 25,
|
||||
SLOT_GENERAL_5 = 26,
|
||||
SLOT_GENERAL_6 = 27,
|
||||
SLOT_GENERAL_7 = 28,
|
||||
SLOT_GENERAL_8 = 29,
|
||||
SLOT_CURSOR = 30,
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
SLOT_INVALID = (int16)0xFFFF,
|
||||
SLOT_POSSESSIONS_BEGIN = 0,
|
||||
SLOT_POSSESSIONS_END = 30,
|
||||
SLOT_EQUIPMENT_BEGIN = 0,
|
||||
SLOT_EQUIPMENT_END = 21,
|
||||
SLOT_PERSONAL_BEGIN = 22,
|
||||
SLOT_PERSONAL_END = 29,
|
||||
SLOT_PERSONAL_BAGS_BEGIN = 251,
|
||||
SLOT_PERSONAL_BAGS_END = 330,
|
||||
SLOT_CURSOR_BAG_BEGIN = 331,
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
SLOT_BANK_BAGS_END = 2270,
|
||||
SLOT_SHARED_BANK_BEGIN = 2500,
|
||||
SLOT_SHARED_BANK_END = 2501,
|
||||
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
|
||||
SLOT_SHARED_BANK_BAGS_END = 2550,
|
||||
SLOT_TRADE_BEGIN = 3000,
|
||||
SLOT_TRADE_END = 3007,
|
||||
SLOT_TRADE_BAGS_BEGIN = 3031,
|
||||
SLOT_TRADE_BAGS_END = 3110,
|
||||
SLOT_WORLD_BEGIN = 4000,
|
||||
SLOT_WORLD_END = 4009
|
||||
};
|
||||
|
||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||
static const uint16 TYPE_POSSESSIONS_SIZE = 31;
|
||||
static const uint16 TYPE_BANK_SIZE = 24;
|
||||
static const uint16 TYPE_SHARED_BANK_SIZE = 2;
|
||||
static const uint16 TYPE_TRADE_SIZE = 8;
|
||||
static const uint16 TYPE_WORLD_SIZE = 10;
|
||||
static const uint16 TYPE_LIMBO_SIZE = 36;
|
||||
static const uint16 TYPE_TRIBUTE_SIZE = 5; // (need client values)
|
||||
static const uint16 TYPE_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_GUILD_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_MERCHANT_SIZE = 0;
|
||||
static const uint16 TYPE_DELETED_SIZE = 0;
|
||||
static const uint16 TYPE_CORPSE_SIZE = 31; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
||||
static const uint16 TYPE_BAZAAR_SIZE = 80;
|
||||
static const uint16 TYPE_INSPECT_SIZE = 22;
|
||||
static const uint16 TYPE_REAL_ESTATE_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_PC_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_BANK_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_SHARED_BANK_SIZE = 0;
|
||||
static const uint16 TYPE_VIEW_MOD_LIMBO_SIZE = 0;
|
||||
static const uint16 TYPE_ALT_STORAGE_SIZE = 0;
|
||||
static const uint16 TYPE_ARCHIVED_SIZE = 0;
|
||||
static const uint16 TYPE_MAIL_SIZE = 0;
|
||||
static const uint16 TYPE_GUILD_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 TYPE_KRONO_SIZE = 0;
|
||||
static const uint16 TYPE_OTHER_SIZE = 0;
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||
static const int16 EQUIPMENT_BEGIN = 0;
|
||||
static const int16 EQUIPMENT_END = 21;
|
||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||
|
||||
static const int16 GENERAL_BEGIN = 22;
|
||||
static const int16 GENERAL_END = 29;
|
||||
static const uint16 GENERAL_SIZE = 8;
|
||||
static const int16 GENERAL_BAGS_BEGIN = 251;
|
||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 CURSOR_BAG_BEGIN = 331;
|
||||
static const int16 CURSOR_BAG_END_OFFSET = 9;
|
||||
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
|
||||
|
||||
static const int16 BANK_BEGIN = 2000;
|
||||
static const int16 BANK_END = 2023;
|
||||
static const int16 BANK_BAGS_BEGIN = 2031;
|
||||
static const int16 BANK_BAGS_END_OFFSET = 239;
|
||||
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 SHARED_BANK_BEGIN = 2500;
|
||||
static const int16 SHARED_BANK_END = 2501;
|
||||
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
|
||||
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
|
||||
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 WORLD_BEGIN = 4000;
|
||||
static const int16 WORLD_END = 4009;
|
||||
static const int16 WORLD_SIZE = TYPE_WORLD_SIZE;
|
||||
|
||||
static const int16 TRIBUTE_BEGIN = 400;
|
||||
static const int16 TRIBUTE_END = 404;
|
||||
static const int16 TRIBUTE_SIZE = TYPE_TRIBUTE_SIZE;
|
||||
|
||||
static const int16 CORPSE_BEGIN = 22;
|
||||
|
||||
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t BANDOLIERS_SIZE = 20; // number of bandolier instances
|
||||
static const size_t BANDOLIER_ITEM_COUNT = 4; // number of equipment slots in bandolier instance
|
||||
|
||||
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t POTION_BELT_ITEM_COUNT = 5;
|
||||
|
||||
static const size_t TEXT_LINK_BODY_LENGTH = 56;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* COMMON_EMU_LEGACY_H */
|
||||
18
common/emu_limits.cpp
Normal file
18
common/emu_limits.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
104
common/emu_limits.h
Normal file
104
common/emu_limits.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 COMMON_EMU_LIMITS_H
|
||||
#define COMMON_EMU_LIMITS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EntityLimits
|
||||
{
|
||||
namespace NPC {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*NPC*/
|
||||
|
||||
namespace NPCMerchant {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*NPCMerchant*/
|
||||
|
||||
namespace Merc {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Merc*/
|
||||
|
||||
namespace Bot {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 8;
|
||||
|
||||
} /*Bot*/
|
||||
|
||||
namespace ClientPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace NPCPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace MercPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
namespace BotPet {
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
const size_t InvTypeTradeSize = 4;
|
||||
|
||||
} /*Pet*/
|
||||
|
||||
}; /*EntityLimits*/
|
||||
|
||||
#endif /*COMMON_EMU_LIMITS_H*/
|
||||
@ -25,6 +25,9 @@ N(OP_AdventureRequest),
|
||||
N(OP_AdventureStatsReply),
|
||||
N(OP_AdventureStatsRequest),
|
||||
N(OP_AdventureUpdate),
|
||||
N(OP_AggroMeterLockTarget),
|
||||
N(OP_AggroMeterTargetInfo),
|
||||
N(OP_AggroMeterUpdate),
|
||||
N(OP_AltCurrency),
|
||||
N(OP_AltCurrencyMerchantReply),
|
||||
N(OP_AltCurrencyMerchantRequest),
|
||||
@ -64,6 +67,7 @@ N(OP_BuffRemoveRequest),
|
||||
N(OP_Bug),
|
||||
N(OP_CameraEffect),
|
||||
N(OP_Camp),
|
||||
N(OP_CancelSneakHide),
|
||||
N(OP_CancelTask),
|
||||
N(OP_CancelTrade),
|
||||
N(OP_CastSpell),
|
||||
@ -164,6 +168,7 @@ N(OP_FinishTrade),
|
||||
N(OP_FinishWindow),
|
||||
N(OP_FinishWindow2),
|
||||
N(OP_Fishing),
|
||||
N(OP_Fling),
|
||||
N(OP_FloatListThing),
|
||||
N(OP_Forage),
|
||||
N(OP_ForceFindPerson),
|
||||
@ -287,6 +292,7 @@ N(OP_LFGuild),
|
||||
N(OP_LFPCommand),
|
||||
N(OP_LFPGetMatchesRequest),
|
||||
N(OP_LFPGetMatchesResponse),
|
||||
N(OP_LinkedReuse),
|
||||
N(OP_LoadSpellSet),
|
||||
N(OP_LocInfo),
|
||||
N(OP_LockoutTimerInfo),
|
||||
|
||||
@ -456,21 +456,21 @@ void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
||||
std::cout << reason;
|
||||
std::cout << "': " << inet_ntoa(in) << ":" << GetPort() << std::endl;
|
||||
#endif
|
||||
ServerPacket* pack = new ServerPacket(0);
|
||||
pack->size = 1;
|
||||
if (reason)
|
||||
pack->size += strlen(reason) + 1;
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memset(pack->pBuffer, 0, pack->size);
|
||||
pack->pBuffer[0] = 255;
|
||||
strcpy((char*) &pack->pBuffer[1], reason);
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
auto pack = new ServerPacket(0);
|
||||
pack->size = 1;
|
||||
if (reason)
|
||||
pack->size += strlen(reason) + 1;
|
||||
pack->pBuffer = new uchar[pack->size];
|
||||
memset(pack->pBuffer, 0, pack->size);
|
||||
pack->pBuffer[0] = 255;
|
||||
strcpy((char *)&pack->pBuffer[1], reason);
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect) {
|
||||
if (iSendRelayDisconnect) {
|
||||
ServerPacket* pack = new ServerPacket(0, 5);
|
||||
auto pack = new ServerPacket(0, 5);
|
||||
pack->pBuffer[0] = 3;
|
||||
*((uint32*) &pack->pBuffer[1]) = relay->GetRemoteID();
|
||||
SendPacket(pack);
|
||||
@ -609,7 +609,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
||||
if (base >= recvbuf_used) {
|
||||
safe_delete_array(recvbuf);
|
||||
} else {
|
||||
uchar* tmpbuf = new uchar[recvbuf_size - base];
|
||||
auto tmpbuf = new uchar[recvbuf_size - base];
|
||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
||||
safe_delete_array(recvbuf);
|
||||
recvbuf = tmpbuf;
|
||||
@ -683,7 +683,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
||||
safe_delete_array(recvbuf);
|
||||
}
|
||||
else {
|
||||
uchar* tmpbuf = new uchar[recvbuf_size - base];
|
||||
auto tmpbuf = new uchar[recvbuf_size - base];
|
||||
memcpy(tmpbuf, &recvbuf[base], recvbuf_used - base);
|
||||
safe_delete_array(recvbuf);
|
||||
recvbuf = tmpbuf;
|
||||
@ -739,7 +739,8 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
SendNetErrorPacket("New RelayClient: illegal on outgoing connection");
|
||||
break;
|
||||
}
|
||||
EmuTCPConnection* con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32*) data), *((uint32*) &data[4]), *((uint16*) &data[8]));
|
||||
auto con = new EmuTCPConnection(Server->GetNextID(), Server, this, *((uint32 *)data),
|
||||
*((uint32 *)&data[4]), *((uint16 *)&data[8]));
|
||||
Server->AddConnection(con);
|
||||
RelayCount++;
|
||||
break;
|
||||
@ -787,7 +788,7 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
||||
if(sent_something)
|
||||
keepalive_timer.Start();
|
||||
else if (TCPMode == modePacket && keepalive_timer.Check()) {
|
||||
ServerPacket* pack = new ServerPacket(0, 0);
|
||||
auto pack = new ServerPacket(0, 0);
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
#if TCPN_DEBUG >= 5
|
||||
|
||||
@ -24,7 +24,7 @@ void EmuTCPServer::Process() {
|
||||
|
||||
void EmuTCPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
||||
{
|
||||
EmuTCPConnection *conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat);
|
||||
auto conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat);
|
||||
AddConnection(conn);
|
||||
}
|
||||
|
||||
|
||||
370
common/emu_versions.cpp
Normal file
370
common/emu_versions.cpp
Normal file
@ -0,0 +1,370 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
|
||||
#include "emu_versions.h"
|
||||
|
||||
|
||||
bool EQEmu::versions::IsValidClientVersion(ClientVersion client_version)
|
||||
{
|
||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ValidateClientVersion(ClientVersion client_version)
|
||||
{
|
||||
if (client_version <= ClientVersion::Unknown || client_version > LastClientVersion)
|
||||
return ClientVersion::Unknown;
|
||||
|
||||
return client_version;
|
||||
}
|
||||
|
||||
const char* EQEmu::versions::ClientVersionName(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
return "Unknown Version";
|
||||
case ClientVersion::Client62:
|
||||
return "Client 6.2";
|
||||
case ClientVersion::Titanium:
|
||||
return "Titanium";
|
||||
case ClientVersion::SoF:
|
||||
return "SoF";
|
||||
case ClientVersion::SoD:
|
||||
return "SoD";
|
||||
case ClientVersion::UF:
|
||||
return "UF";
|
||||
case ClientVersion::RoF:
|
||||
return "RoF";
|
||||
case ClientVersion::RoF2:
|
||||
return "RoF2";
|
||||
default:
|
||||
return "Invalid Version";
|
||||
};
|
||||
}
|
||||
|
||||
uint32 EQEmu::versions::ConvertClientVersionToClientVersionBit(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
return bit_Unknown;
|
||||
case ClientVersion::Titanium:
|
||||
return bit_Titanium;
|
||||
case ClientVersion::SoF:
|
||||
return bit_SoF;
|
||||
case ClientVersion::SoD:
|
||||
return bit_SoD;
|
||||
case ClientVersion::UF:
|
||||
return bit_UF;
|
||||
case ClientVersion::RoF:
|
||||
return bit_RoF;
|
||||
case ClientVersion::RoF2:
|
||||
return bit_RoF2;
|
||||
default:
|
||||
return bit_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertClientVersionBitToClientVersion(uint32 client_version_bit)
|
||||
{
|
||||
switch (client_version_bit) {
|
||||
case (uint32)static_cast<unsigned int>(ClientVersion::Unknown) :
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Client62) - 1)) :
|
||||
return ClientVersion::Unknown;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::Titanium) - 1)) :
|
||||
return ClientVersion::Titanium;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoF) - 1)) :
|
||||
return ClientVersion::SoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::SoD) - 1)) :
|
||||
return ClientVersion::SoD;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::UF) - 1)) :
|
||||
return ClientVersion::UF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF) - 1)) :
|
||||
return ClientVersion::RoF;
|
||||
case ((uint32)1 << (static_cast<unsigned int>(ClientVersion::RoF2) - 1)) :
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 EQEmu::versions::ConvertClientVersionToExpansion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
case ClientVersion::Titanium:
|
||||
return 0x000007FFU;
|
||||
case ClientVersion::SoF:
|
||||
return 0x00007FFFU;
|
||||
case ClientVersion::SoD:
|
||||
return 0x0000FFFFU;
|
||||
case ClientVersion::UF:
|
||||
return 0x0001FFFFU;
|
||||
case ClientVersion::RoF:
|
||||
case ClientVersion::RoF2:
|
||||
return 0x000FFFFFU;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidNonPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEmu::versions::IsValidOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidatePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= MobVersion::Unknown || mob_version > LastPCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateNonPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastPCMobVersion || mob_version > LastNonPCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ValidateOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
if (mob_version <= LastNonPCMobVersion || mob_version > LastOfflinePCMobVersion)
|
||||
return MobVersion::Unknown;
|
||||
|
||||
return mob_version;
|
||||
}
|
||||
|
||||
const char* EQEmu::versions::MobVersionName(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Unknown:
|
||||
return "Unknown Version";
|
||||
case MobVersion::Client62:
|
||||
return "Client 6.2";
|
||||
case MobVersion::Titanium:
|
||||
return "Titanium";
|
||||
case MobVersion::SoF:
|
||||
return "SoF";
|
||||
case MobVersion::SoD:
|
||||
return "SoD";
|
||||
case MobVersion::UF:
|
||||
return "UF";
|
||||
case MobVersion::RoF:
|
||||
return "RoF";
|
||||
case MobVersion::RoF2:
|
||||
return "RoF2";
|
||||
case MobVersion::NPC:
|
||||
return "NPC";
|
||||
case MobVersion::NPCMerchant:
|
||||
return "NPC Merchant";
|
||||
case MobVersion::Merc:
|
||||
return "Merc";
|
||||
case MobVersion::Bot:
|
||||
return "Bot";
|
||||
case MobVersion::ClientPet:
|
||||
return "Client Pet";
|
||||
case MobVersion::NPCPet:
|
||||
return "NPC Pet";
|
||||
case MobVersion::MercPet:
|
||||
return "Merc Pet";
|
||||
case MobVersion::BotPet:
|
||||
return "Bot Pet";
|
||||
case MobVersion::OfflineTitanium:
|
||||
return "Offline Titanium";
|
||||
case MobVersion::OfflineSoF:
|
||||
return "Offline SoF";
|
||||
case MobVersion::OfflineSoD:
|
||||
return "Offline SoD";
|
||||
case MobVersion::OfflineUF:
|
||||
return "Offline UF";
|
||||
case MobVersion::OfflineRoF:
|
||||
return "Offline RoF";
|
||||
case MobVersion::OfflineRoF2:
|
||||
return "Offline RoF2";
|
||||
default:
|
||||
return "Invalid Version";
|
||||
};
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertMobVersionToClientVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Unknown:
|
||||
case MobVersion::Client62:
|
||||
return ClientVersion::Unknown;
|
||||
case MobVersion::Titanium:
|
||||
return ClientVersion::Titanium;
|
||||
case MobVersion::SoF:
|
||||
return ClientVersion::SoF;
|
||||
case MobVersion::SoD:
|
||||
return ClientVersion::SoD;
|
||||
case MobVersion::UF:
|
||||
return ClientVersion::UF;
|
||||
case MobVersion::RoF:
|
||||
return ClientVersion::RoF;
|
||||
case MobVersion::RoF2:
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToMobVersion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Unknown:
|
||||
case ClientVersion::Client62:
|
||||
return MobVersion::Unknown;
|
||||
case ClientVersion::Titanium:
|
||||
return MobVersion::Titanium;
|
||||
case ClientVersion::SoF:
|
||||
return MobVersion::SoF;
|
||||
case ClientVersion::SoD:
|
||||
return MobVersion::SoD;
|
||||
case ClientVersion::UF:
|
||||
return MobVersion::UF;
|
||||
case ClientVersion::RoF:
|
||||
return MobVersion::RoF;
|
||||
case ClientVersion::RoF2:
|
||||
return MobVersion::RoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::Titanium:
|
||||
return MobVersion::OfflineTitanium;
|
||||
case MobVersion::SoF:
|
||||
return MobVersion::OfflineSoF;
|
||||
case MobVersion::SoD:
|
||||
return MobVersion::OfflineSoD;
|
||||
case MobVersion::UF:
|
||||
return MobVersion::OfflineUF;
|
||||
case MobVersion::RoF:
|
||||
return MobVersion::OfflineRoF;
|
||||
case MobVersion::RoF2:
|
||||
return MobVersion::OfflineRoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::OfflineTitanium:
|
||||
return MobVersion::Titanium;
|
||||
case MobVersion::OfflineSoF:
|
||||
return MobVersion::SoF;
|
||||
case MobVersion::OfflineSoD:
|
||||
return MobVersion::SoD;
|
||||
case MobVersion::OfflineUF:
|
||||
return MobVersion::UF;
|
||||
case MobVersion::OfflineRoF:
|
||||
return MobVersion::RoF;
|
||||
case MobVersion::OfflineRoF2:
|
||||
return MobVersion::RoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::ClientVersion EQEmu::versions::ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version)
|
||||
{
|
||||
switch (mob_version) {
|
||||
case MobVersion::OfflineTitanium:
|
||||
return ClientVersion::Titanium;
|
||||
case MobVersion::OfflineSoF:
|
||||
return ClientVersion::SoF;
|
||||
case MobVersion::OfflineSoD:
|
||||
return ClientVersion::SoD;
|
||||
case MobVersion::OfflineUF:
|
||||
return ClientVersion::UF;
|
||||
case MobVersion::OfflineRoF:
|
||||
return ClientVersion::RoF;
|
||||
case MobVersion::OfflineRoF2:
|
||||
return ClientVersion::RoF2;
|
||||
default:
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
EQEmu::versions::MobVersion EQEmu::versions::ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version)
|
||||
{
|
||||
switch (client_version) {
|
||||
case ClientVersion::Titanium:
|
||||
return MobVersion::OfflineTitanium;
|
||||
case ClientVersion::SoF:
|
||||
return MobVersion::OfflineSoF;
|
||||
case ClientVersion::SoD:
|
||||
return MobVersion::OfflineSoD;
|
||||
case ClientVersion::UF:
|
||||
return MobVersion::OfflineUF;
|
||||
case ClientVersion::RoF:
|
||||
return MobVersion::OfflineRoF;
|
||||
case ClientVersion::RoF2:
|
||||
return MobVersion::OfflineRoF2;
|
||||
default:
|
||||
return MobVersion::Unknown;
|
||||
}
|
||||
}
|
||||
128
common/emu_versions.h
Normal file
128
common/emu_versions.h
Normal file
@ -0,0 +1,128 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 COMMON_EMU_VERSIONS_H
|
||||
#define COMMON_EMU_VERSIONS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace versions {
|
||||
enum class ClientVersion {
|
||||
Unknown = 0,
|
||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
SoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
RoF2 // Build: 'May 10 2013 23:30:08'
|
||||
};
|
||||
|
||||
enum ClientVersionBit : uint32 {
|
||||
bit_Unknown = 0,
|
||||
bit_Client62 = 0x00000001, // unsupported (placeholder for scripts)
|
||||
bit_Titanium = 0x00000002,
|
||||
bit_SoF = 0x00000004,
|
||||
bit_SoD = 0x00000008,
|
||||
bit_UF = 0x00000010,
|
||||
bit_RoF = 0x00000020,
|
||||
bit_RoF2 = 0x00000040,
|
||||
bit_TitaniumAndEarlier = 0x00000003,
|
||||
bit_SoFAndEarlier = 0x00000007,
|
||||
bit_SoDAndEarlier = 0x0000000F,
|
||||
bit_UFAndEarlier = 0x0000001F,
|
||||
bit_RoFAndEarlier = 0x0000003F,
|
||||
bit_SoFAndLater = 0xFFFFFFFC,
|
||||
bit_SoDAndLater = 0xFFFFFFF8,
|
||||
bit_UFAndLater = 0xFFFFFFF0,
|
||||
bit_RoFAndLater = 0xFFFFFFE0,
|
||||
bit_RoF2AndLater = 0xFFFFFFC0,
|
||||
bit_AllClients = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
const ClientVersion LastClientVersion = ClientVersion::RoF2;
|
||||
const size_t ClientVersionCount = (static_cast<size_t>(LastClientVersion) + 1);
|
||||
|
||||
bool IsValidClientVersion(ClientVersion client_version);
|
||||
ClientVersion ValidateClientVersion(ClientVersion client_version);
|
||||
const char* ClientVersionName(ClientVersion client_version);
|
||||
uint32 ConvertClientVersionToClientVersionBit(ClientVersion client_version);
|
||||
ClientVersion ConvertClientVersionBitToClientVersion(uint32 client_version_bit);
|
||||
uint32 ConvertClientVersionToExpansion(ClientVersion client_version);
|
||||
|
||||
|
||||
enum class MobVersion {
|
||||
Unknown = 0,
|
||||
Client62,
|
||||
Titanium,
|
||||
SoF,
|
||||
SoD,
|
||||
UF,
|
||||
RoF,
|
||||
RoF2,
|
||||
NPC,
|
||||
NPCMerchant,
|
||||
Merc,
|
||||
Bot,
|
||||
ClientPet,
|
||||
NPCPet,
|
||||
MercPet,
|
||||
BotPet,
|
||||
OfflineTitanium,
|
||||
OfflineSoF,
|
||||
OfflineSoD,
|
||||
OfflineUF,
|
||||
OfflineRoF,
|
||||
OfflineRoF2
|
||||
};
|
||||
|
||||
const MobVersion LastMobVersion = MobVersion::OfflineRoF2;
|
||||
const MobVersion LastPCMobVersion = MobVersion::RoF2;
|
||||
const MobVersion LastNonPCMobVersion = MobVersion::BotPet;
|
||||
const MobVersion LastOfflinePCMobVersion = MobVersion::OfflineRoF2;
|
||||
const size_t MobVersionCount = (static_cast<size_t>(LastMobVersion) + 1);
|
||||
|
||||
bool IsValidMobVersion(MobVersion mob_version);
|
||||
bool IsValidPCMobVersion(MobVersion mob_version);
|
||||
bool IsValidNonPCMobVersion(MobVersion mob_version);
|
||||
bool IsValidOfflinePCMobVersion(MobVersion mob_version);
|
||||
|
||||
MobVersion ValidateMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidatePCMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidateNonPCMobVersion(MobVersion mob_version);
|
||||
MobVersion ValidateOfflinePCMobVersion(MobVersion mob_version);
|
||||
|
||||
const char* MobVersionName(MobVersion mob_version);
|
||||
ClientVersion ConvertMobVersionToClientVersion(MobVersion mob_version);
|
||||
MobVersion ConvertClientVersionToMobVersion(ClientVersion client_version);
|
||||
MobVersion ConvertPCMobVersionToOfflinePCMobVersion(MobVersion mob_version);
|
||||
MobVersion ConvertOfflinePCMobVersionToPCMobVersion(MobVersion mob_version);
|
||||
ClientVersion ConvertOfflinePCMobVersionToClientVersion(MobVersion mob_version);
|
||||
MobVersion ConvertClientVersionToOfflinePCMobVersion(ClientVersion client_version);
|
||||
|
||||
} /*versions*/
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
#endif /*COMMON_EMU_VERSIONS_H*/
|
||||
@ -1,5 +1,6 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@ -13,407 +14,57 @@
|
||||
|
||||
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
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef EQ_CONSTANTS_H
|
||||
#define EQ_CONSTANTS_H
|
||||
|
||||
#ifndef COMMON_EQ_CONSTANTS_H
|
||||
#define COMMON_EQ_CONSTANTS_H
|
||||
|
||||
#include "skills.h"
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
** Light Types
|
||||
**
|
||||
*/
|
||||
enum LightTypes
|
||||
{
|
||||
lightTypeNone = 0,
|
||||
lightTypeCandle,
|
||||
lightTypeTorch,
|
||||
lightTypeTinyGlowingSkull,
|
||||
lightTypeSmallLantern,
|
||||
lightTypeSteinOfMoggok, // 5
|
||||
lightTypeLargeLantern,
|
||||
lightTypeFlamelessLantern,
|
||||
lightTypeGlobeOfStars,
|
||||
lightTypeLightGlobe,
|
||||
lightTypeLightstone, // 10
|
||||
lightTypeGreaterLightstone,
|
||||
lightTypeFireBeetleEye,
|
||||
lightTypeColdlight,
|
||||
lightTypeUnknown1,
|
||||
lightTypeUnknown2 // 15
|
||||
};
|
||||
|
||||
#define LIGHT_TYPES_COUNT 16
|
||||
//SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2)
|
||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point (default action)
|
||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||
//#define AT_2 2 // unknown
|
||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||
#define AT_Anim 14 // 100=standing, 110=sitting, 111=ducking, 115=feigned, 105=looting
|
||||
#define AT_Sneak 15 // 0 = normal, 1 = sneaking
|
||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate
|
||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||
#define AT_GuildID 22
|
||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||
//#define AT_27 27 // unknown
|
||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on (not showing in SoF+) (client-to-server only)
|
||||
#define AT_Size 29 // spawn's size (present: SoF, absent: RoF2)
|
||||
//#define AT_30 30 // unknown
|
||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name
|
||||
//#define AT_32 32 // unknown
|
||||
//#define AT_33 33 // unknown
|
||||
//#define AT_34 34 // unknown (present: SoF, absent: RoF2)
|
||||
//#define AT_35 35 // unknown
|
||||
//#define AT_36 36 // unknown
|
||||
//#define AT_37 37 // unknown
|
||||
//#define AT_38 38 // unknown
|
||||
//#define AT_39 39 // unknown
|
||||
#define AT_ShowHelm 43 // 0 = hide graphic, 1 = show graphic
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
||||
//#define AT_46 46 // unknown
|
||||
//#define AT_48 48 // unknown
|
||||
//#define AT_49 49 // unknown
|
||||
//#define AT_52 52 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
||||
//#define AT_53 53 // (absent: SoF, present: RoF2) (not a replacement for RoF absent 29 or 34)
|
||||
|
||||
/*
|
||||
** Light Levels
|
||||
**
|
||||
*/
|
||||
enum LightLevels
|
||||
{
|
||||
lightLevelUnlit = 0,
|
||||
lightLevelCandle,
|
||||
lightLevelTorch,
|
||||
lightLevelSmallMagic,
|
||||
lightLevelRedLight,
|
||||
lightLevelBlueLight, // 5
|
||||
lightLevelSmallLantern,
|
||||
lightLevelMagicLantern,
|
||||
lightLevelLargeLantern,
|
||||
lightLevelLargeMagic,
|
||||
lightLevelBrilliant // 10
|
||||
};
|
||||
|
||||
#define LIGHT_LEVELS_COUNT 11
|
||||
|
||||
/*
|
||||
** Item attributes
|
||||
**
|
||||
** (There are no grepwin hits other than these declarations... Do they have a use?)
|
||||
*/
|
||||
enum ItemAttributes : uint32
|
||||
{
|
||||
ItemAttrNone = 0x00000000,
|
||||
ItemAttrLore = 0x00000001,
|
||||
ItemAttrArtifact = 0x00000002,
|
||||
ItemAttrSummoned = 0x00000004,
|
||||
ItemAttrMagic = 0x00000008,
|
||||
ItemAttrAugment = 0x00000010,
|
||||
ItemAttrPendingLore = 0x00000020,
|
||||
ItemAttrUnknown = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/*
|
||||
** Item class types
|
||||
**
|
||||
*/
|
||||
enum ItemClassTypes
|
||||
{
|
||||
ItemClassCommon = 0,
|
||||
ItemClassContainer,
|
||||
ItemClassBook,
|
||||
_ItemClassCount
|
||||
};
|
||||
|
||||
/*
|
||||
** Item use types
|
||||
**
|
||||
** (ref: database and eqstr_us.txt)
|
||||
**
|
||||
** (Looking at a recent database, it's possible that some of the item values may be off [10-27-2013])
|
||||
*/
|
||||
enum ItemUseTypes : uint8
|
||||
{
|
||||
/*9138*/ ItemType1HSlash = 0,
|
||||
/*9141*/ ItemType2HSlash,
|
||||
/*9140*/ ItemType1HPiercing,
|
||||
/*9139*/ ItemType1HBlunt,
|
||||
/*9142*/ ItemType2HBlunt,
|
||||
/*5504*/ ItemTypeBow, // 5
|
||||
/*----*/ ItemTypeUnknown1,
|
||||
/*----*/ ItemTypeLargeThrowing,
|
||||
/*5505*/ ItemTypeShield,
|
||||
/*5506*/ ItemTypeScroll,
|
||||
/*5507*/ ItemTypeArmor, // 10
|
||||
/*5508*/ ItemTypeMisc, // a lot of random crap has this item use.
|
||||
/*7564*/ ItemTypeLockPick,
|
||||
/*----*/ ItemTypeUnknown2,
|
||||
/*5509*/ ItemTypeFood,
|
||||
/*5510*/ ItemTypeDrink, // 15
|
||||
/*5511*/ ItemTypeLight,
|
||||
/*5512*/ ItemTypeCombinable, // not all stackable items are this use...
|
||||
/*5513*/ ItemTypeBandage,
|
||||
/*----*/ ItemTypeSmallThrowing,
|
||||
/*----*/ ItemTypeSpell, // 20 // spells and tomes
|
||||
/*5514*/ ItemTypePotion,
|
||||
/*----*/ ItemTypeUnknown3,
|
||||
/*0406*/ ItemTypeWindInstrument,
|
||||
/*0407*/ ItemTypeStringedInstrument,
|
||||
/*0408*/ ItemTypeBrassInstrument, // 25
|
||||
/*0405*/ ItemTypePercussionInstrument,
|
||||
/*5515*/ ItemTypeArrow,
|
||||
/*----*/ ItemTypeUnknown4,
|
||||
/*5521*/ ItemTypeJewelry,
|
||||
/*----*/ ItemTypeSkull, // 30
|
||||
/*5516*/ ItemTypeBook, // skill-up tomes/books? (would probably need a pp flag if true...)
|
||||
/*5517*/ ItemTypeNote,
|
||||
/*5518*/ ItemTypeKey,
|
||||
/*----*/ ItemTypeCoin,
|
||||
/*5520*/ ItemType2HPiercing, // 35
|
||||
/*----*/ ItemTypeFishingPole,
|
||||
/*----*/ ItemTypeFishingBait,
|
||||
/*5519*/ ItemTypeAlcohol,
|
||||
/*----*/ ItemTypeKey2, // keys and satchels?? (questable keys?)
|
||||
/*----*/ ItemTypeCompass, // 40
|
||||
/*----*/ ItemTypeUnknown5,
|
||||
/*----*/ ItemTypePoison, // might be wrong, but includes poisons
|
||||
/*----*/ ItemTypeUnknown6,
|
||||
/*----*/ ItemTypeUnknown7,
|
||||
/*5522*/ ItemTypeMartial, // 45
|
||||
/*----*/ ItemTypeUnknown8,
|
||||
/*----*/ ItemTypeUnknown9,
|
||||
/*----*/ ItemTypeUnknown10,
|
||||
/*----*/ ItemTypeUnknown11,
|
||||
/*----*/ ItemTypeSinging, // 50
|
||||
/*5750*/ ItemTypeAllInstrumentTypes,
|
||||
/*5776*/ ItemTypeCharm,
|
||||
/*----*/ ItemTypeDye,
|
||||
/*----*/ ItemTypeAugmentation,
|
||||
/*----*/ ItemTypeAugmentationSolvent, // 55
|
||||
/*----*/ ItemTypeAugmentationDistiller,
|
||||
/*----*/ ItemTypeUnknown12,
|
||||
/*----*/ ItemTypeFellowshipKit,
|
||||
/*----*/ ItemTypeUnknown13,
|
||||
/*----*/ ItemTypeRecipe, // 60
|
||||
/*----*/ ItemTypeAdvancedRecipe,
|
||||
/*----*/ ItemTypeJournal, // only one(1) database entry
|
||||
/*----*/ ItemTypeAltCurrency, // alt-currency (as opposed to coinage)
|
||||
/*5881*/ ItemTypePerfectedAugmentationDistiller,
|
||||
/*----*/ _ItemTypeCount
|
||||
|
||||
/*
|
||||
Unknowns:
|
||||
|
||||
Mounts?
|
||||
Ornamentations?
|
||||
GuildBanners?
|
||||
Collectible?
|
||||
Placeable?
|
||||
(others?)
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation use type bitmasks (1-based)
|
||||
**
|
||||
** (ref: dbstr_us.txt)
|
||||
**
|
||||
*/
|
||||
enum AugmentationUseTypeBitmasks : uint32 {
|
||||
AugUseNone = 0x00000000,
|
||||
AugUseGeneralSingleStat = 0x00000001, /*1^16^1 (General: Single Stat)^0*/
|
||||
AugUseGeneralMultipleStat = 0x00000002, /*2^16^2 (General: Multiple Stat)^0*/
|
||||
AugUseGeneralSpellEffect = 0x00000004, /*3^16^3 (General: Spell Effect)^0*/
|
||||
AugUseWeaponGeneral = 0x00000008, /*4^16^4 (Weapon: General)^0*/
|
||||
AugUseWeaponElemDamage = 0x00000010, /*5^16^5 (Weapon: Elem Damage)^0*/
|
||||
AugUseWeaponBaseDamage = 0x00000020, /*6^16^6 (Weapon: Base Damage)^0*/
|
||||
AugUseGeneralGroup = 0x00000040, /*7^16^7 (General: Group)^0*/
|
||||
AugUseGeneralRaid = 0x00000080, /*8^16^8 (General: Raid)^0*/
|
||||
AugUseGeneralDragonsPoints = 0x00000100, /*9^16^9 (General: Dragons Points)^0*/
|
||||
AugUseCraftedCommon = 0x00000200, /*10^16^10 (Crafted: Common)^0*/
|
||||
AugUseCraftedGroup1 = 0x00000400, /*11^16^11 (Crafted: Group)^0*/
|
||||
AugUseCraftedRaid1 = 0x00000800, /*12^16^12 (Crafted: Raid)^0*/
|
||||
AugUseEnergeiacGroup = 0x00001000, /*13^16^13 (Energeiac: Group)^0*/
|
||||
AugUseEnergeiacRaid = 0x00002000, /*14^16^14 (Energeiac: Raid)^0*/
|
||||
AugUseEmblem = 0x00004000, /*15^16^15 (Emblem)^0*/
|
||||
AugUseCraftedGroup2 = 0x00008000, /*16^16^16 (Crafted: Group)^0*/
|
||||
AugUseCraftedRaid2 = 0x00010000, /*17^16^17 (Crafted: Raid)^0*/
|
||||
AugUseUnknown1 = 0x00020000, /*18^16^18^0*/
|
||||
AugUseUnknown2 = 0x00040000, /*19^16^19^0*/
|
||||
AugUseOrnamentation = 0x00080000, /*20^16^20 (Ornamentation)^0*/
|
||||
AugUseSpecialOrnamentation = 0x00100000, /*21^16^21 (Special Ornamentation)^0*/
|
||||
AugUseUnknown3 = 0x00200000, /*22^16^22^0*/
|
||||
AugUseUnknown4 = 0x00400000, /*23^16^23^0*/
|
||||
AugUseUnknown5 = 0x00800000, /*24^16^24^0*/
|
||||
AugUseUnknown6 = 0x01000000, /*25^16^25^0*/
|
||||
AugUseUnknown7 = 0x02000000, /*26^16^26^0*/
|
||||
AugUseUnknown8 = 0x04000000, /*27^16^27^0*/
|
||||
AugUseUnknown9 = 0x08000000, /*28^16^28^0*/
|
||||
AugUseUnknown10 = 0x10000000, /*29^16^29^0*/
|
||||
AugUseEpic25 = 0x20000000, /*30^16^30^0*/
|
||||
AugUseTest = 0x40000000, /*31^16^Test^0*/ // listed as 31^16^31^0 in 5-10 client
|
||||
AugUseAll = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation use types (enumerated)
|
||||
**
|
||||
*/
|
||||
enum AugmentationUseTypes : uint8 {
|
||||
AugTypeNone = 0,
|
||||
AugTypeGeneralSingleStat,
|
||||
AugTypeGeneralMultipleStat,
|
||||
AugTypeGeneralSpellEffect,
|
||||
AugTypeWeaponGeneral,
|
||||
AugTypeWeaponElemDamage, // 5
|
||||
AugTypeWeaponBaseDamage,
|
||||
AugTypeGeneralGroup,
|
||||
AugTypeGeneralRaid,
|
||||
AugTypeGeneralDragonsPoints,
|
||||
AugTypeCraftedCommon, // 10
|
||||
AugTypeCraftedGroup1,
|
||||
AugTypeCraftedRaid1,
|
||||
AugTypeEnergeiacGroup,
|
||||
AugTypeEnergeiacRaid,
|
||||
AugTypeEmblem, // 15
|
||||
AugTypeCraftedGroup2,
|
||||
AugTypeCraftedRaid2,
|
||||
AugTypeUnknown1,
|
||||
AugTypeUnknown2,
|
||||
AugTypeOrnamentation, // 20
|
||||
AugTypeSpecialOrnamentation,
|
||||
AugTypeUnknown3,
|
||||
AugTypeUnknown4,
|
||||
AugTypeUnknown5,
|
||||
AugTypeUnknown6, // 25
|
||||
AugTypeUnknown7,
|
||||
AugTypeUnknown8,
|
||||
AugTypeUnknown9,
|
||||
AugTypeUnknown10,
|
||||
AugTypeEpic25, // 30
|
||||
AugTypeTest,
|
||||
_AugTypeCount,
|
||||
AugTypeAll = 255
|
||||
};
|
||||
|
||||
/*
|
||||
** Augmentation restriction types (in-work)
|
||||
**
|
||||
** (ref: eqstr_us.txt)
|
||||
**
|
||||
*/
|
||||
enum AugmentationRestrictionTypes : uint8 {
|
||||
/*4690*/ AugRestrAny = 0,
|
||||
/*9134*/ AugRestrArmor,
|
||||
/*9135*/ AugRestrWeapons,
|
||||
/*9136*/ AugRestr1HWeapons,
|
||||
/*9137*/ AugRestr2HWeapons,
|
||||
/*9138*/ AugRestr1HSlash, // 5
|
||||
/*9139*/ AugRestr1HBlunt,
|
||||
/*9140*/ AugRestrPiercing,
|
||||
/*9148*/ AugRestrHandToHand,
|
||||
/*9141*/ AugRestr2HSlash,
|
||||
/*9142*/ AugRestr2HBlunt, // 10
|
||||
/*9143*/ AugRestr2HPierce,
|
||||
/*9144*/ AugRestrBows,
|
||||
/*9145*/ AugRestrShields,
|
||||
/*8052*/ AugRestr1HSlash1HBluntOrHandToHand,
|
||||
/*9200*/ AugRestr1HBluntOrHandToHand, // 15 // no listed peq entries
|
||||
|
||||
// these three appear to be post-RoF (12-10-2012) and can not be verified until RoF (05-10-2013) is supported
|
||||
/*????*/ AugRestrUnknown1,
|
||||
/*????*/ AugRestrUnknown2,
|
||||
/*????*/ AugRestrUnknown3, // last value in peq entries
|
||||
_AugRestrCount
|
||||
|
||||
/*4687*/ //AugTypeAllItems, // ?? unknown atm
|
||||
/*4688*/ //AugTypePrestige, // ?? unknown atm
|
||||
/*4689*/ //AugTypeNonPrestige, // ?? unknown atm
|
||||
};
|
||||
|
||||
/*
|
||||
** Container use types
|
||||
**
|
||||
** This correlates to world 'object.type' (object.h/Object.cpp) as well as Item_Struct.BagType
|
||||
**
|
||||
** (ref: database, web forums and eqstr_us.txt)
|
||||
*/
|
||||
enum ContainerUseTypes : uint8
|
||||
{
|
||||
/*3400*/ BagTypeSmallBag = 0,
|
||||
/*3401*/ BagTypeLargeBag,
|
||||
/*3402*/ BagTypeQuiver,
|
||||
/*3403*/ BagTypeBeltPouch,
|
||||
/*3404*/ BagTypeWristPouch,
|
||||
/*3405*/ BagTypeBackPack, // 5
|
||||
/*3406*/ BagTypeSmallChest,
|
||||
/*3407*/ BagTypeLargeChest,
|
||||
/*----*/ BagTypeBandolier, // <*Database Reference Only>
|
||||
/*3408*/ BagTypeMedicineBag,
|
||||
/*3409*/ BagTypeToolBox, // 10
|
||||
/*3410*/ BagTypeLexicon,
|
||||
/*3411*/ BagTypeMortar,
|
||||
/*3412*/ BagTypeSelfDusting, // Quest container (Auto-clear contents?)
|
||||
/*3413*/ BagTypeMixingBowl,
|
||||
/*3414*/ BagTypeOven, // 15
|
||||
/*3415*/ BagTypeSewingKit,
|
||||
/*3416*/ BagTypeForge,
|
||||
/*3417*/ BagTypeFletchingKit,
|
||||
/*3418*/ BagTypeBrewBarrel,
|
||||
/*3419*/ BagTypeJewelersKit, // 20
|
||||
/*3420*/ BagTypePotteryWheel,
|
||||
/*3421*/ BagTypeKiln,
|
||||
/*3422*/ BagTypeKeymaker, // (no database entries as of peq rev 69)
|
||||
/*3423*/ BagTypeWizardsLexicon,
|
||||
/*3424*/ BagTypeMagesLexicon, // 25
|
||||
/*3425*/ BagTypeNecromancersLexicon,
|
||||
/*3426*/ BagTypeEnchantersLexicon,
|
||||
/*----*/ BagTypeUnknown1, // (a coin pouch/purse?) (no database entries as of peq rev 69)
|
||||
/*----*/ BagTypeConcordanceofResearch, // <*Database Reference Only>
|
||||
/*3427*/ BagTypeAlwaysWorks, // 30 // Quest container (Never-fail combines?)
|
||||
/*3428*/ BagTypeKoadaDalForge, // High Elf
|
||||
/*3429*/ BagTypeTeirDalForge, // Dark Elf
|
||||
/*3430*/ BagTypeOggokForge, // Ogre
|
||||
/*3431*/ BagTypeStormguardForge, // Dwarf
|
||||
/*3432*/ BagTypeAkanonForge, // 35 // Gnome
|
||||
/*3433*/ BagTypeNorthmanForge, // Barbarian
|
||||
/*----*/ BagTypeUnknown2, // (no database entries as of peq rev 69)
|
||||
/*3434*/ BagTypeCabilisForge, // Iksar
|
||||
/*3435*/ BagTypeFreeportForge, // Human 1
|
||||
/*3436*/ BagTypeRoyalQeynosForge, // 40 // Human 2
|
||||
/*3439*/ BagTypeHalflingTailoringKit,
|
||||
/*3438*/ BagTypeErudTailoringKit,
|
||||
/*3440*/ BagTypeFierDalTailoringKit, // Wood Elf
|
||||
/*3441*/ BagTypeFierDalFletchingKit, // Wood Elf
|
||||
/*3437*/ BagTypeIksarPotteryWheel, // 45
|
||||
/*3442*/ BagTypeTackleBox,
|
||||
/*3443*/ BagTypeTrollForge,
|
||||
/*3445*/ BagTypeFierDalForge, // Wood Elf
|
||||
/*3444*/ BagTypeValeForge, // Halfling
|
||||
/*3446*/ BagTypeErudForge, // 50
|
||||
/*----*/ BagTypeTradersSatchel, // <*Database Reference Only> (db: Yellow Trader's Satchel Token?)
|
||||
/*5785*/ BagTypeGuktaForge, // Froglok (no database entries as of peq rev 69)
|
||||
/*3359*/ BagTypeAugmentationSealer,
|
||||
/*----*/ BagTypeIceCreamChurn, // <*Database Reference Only>
|
||||
/*6325*/ BagTypeTransformationmold, // 55 // Ornamentation
|
||||
/*6340*/ BagTypeDetransformationmold, // Ornamentation Stripper
|
||||
/*5400*/ BagTypeUnattuner,
|
||||
/*7684*/ BagTypeTradeskillBag,
|
||||
/*7692*/ BagTypeCollectibleBag,
|
||||
/*----*/ _BagTypeCount
|
||||
};
|
||||
|
||||
/*
|
||||
** Item Effect Types
|
||||
**
|
||||
*/
|
||||
enum {
|
||||
ET_CombatProc = 0,
|
||||
ET_ClickEffect = 1,
|
||||
ET_WornEffect = 2,
|
||||
ET_Expendable = 3,
|
||||
ET_EquipClick = 4,
|
||||
ET_ClickEffect2 = 5, //name unknown
|
||||
ET_Focus = 6,
|
||||
ET_Scroll = 7
|
||||
};
|
||||
|
||||
//SpawnAppearance types:
|
||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point
|
||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||
#define AT_Anim 14 // 100=standing, 110=sitting, 111=ducking, 115=feigned, 105=looting
|
||||
#define AT_Sneak 15 // 0 = normal, 1 = sneaking
|
||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate
|
||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||
#define AT_GuildID 22
|
||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on
|
||||
#define AT_Size 29 // spawn's size
|
||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name
|
||||
#define AT_ShowHelm 43 // 0 = do not show helmet graphic, 1 = show graphic
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
||||
//#define AT_Trader 300 // Bazzar Trader Mode
|
||||
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
|
||||
|
||||
// animations for AT_Anim
|
||||
#define ANIM_FREEZE 102
|
||||
@ -519,15 +170,40 @@ typedef enum {
|
||||
#define MT_StrikeThrough 339
|
||||
#define MT_Stun 340
|
||||
|
||||
// TODO: Really should combine above and below into one
|
||||
|
||||
//from showeq
|
||||
enum ChatColor
|
||||
{
|
||||
/*
|
||||
CC_Default = 0,
|
||||
CC_DarkGrey = 1,
|
||||
CC_DarkGreen = 2,
|
||||
CC_DarkBlue = 3,
|
||||
CC_Purple = 5,
|
||||
CC_LightGrey = 6,
|
||||
*/
|
||||
|
||||
CC_WhiteSmoke = 0, // FF|F0F0F0
|
||||
CC_Green = 2, // FF|008000
|
||||
CC_BrightBlue = 3, // FF|0040FF
|
||||
CC_Magenta = 5, // FF|F000F0
|
||||
CC_Gray = 6, // FF|808080
|
||||
CC_LightGray = 7, // FF|E0E0E0
|
||||
//CC_WhiteSmoke2 = 10, // FF|F0F0F0
|
||||
CC_DarkGray = 12, // FF|A0A0A0
|
||||
CC_Red = 13, // FF|F00000
|
||||
CC_Lime = 14, // FF|00F000
|
||||
CC_Yellow = 15, // FF|F0F000
|
||||
CC_Blue = 16, // FF|0000F0
|
||||
CC_LightNavy = 17, // FF|0000AF
|
||||
CC_Cyan = 18, // FF|00F0F0
|
||||
CC_Black = 20, // FF|000000
|
||||
|
||||
// any index <= 255 that is not defined above
|
||||
CC_DimGray = 1, // FF|606060
|
||||
CC_Default = 1,
|
||||
|
||||
CC_User_Say = 256,
|
||||
CC_User_Tell = 257,
|
||||
CC_User_Group = 258,
|
||||
@ -723,7 +399,7 @@ static const uint8 DamageTypeUnknown = 0xFF;
|
||||
**
|
||||
** (indexed by 'Skill' of SkillUseTypes)
|
||||
*/
|
||||
static const uint8 SkillDamageTypes[HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
|
||||
static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // change to _SkillServerArraySize once activated
|
||||
{
|
||||
/*1HBlunt*/ 0,
|
||||
/*1HSlashing*/ 1,
|
||||
@ -805,25 +481,6 @@ static const uint8 SkillDamageTypes[HIGHEST_SKILL + 1] = // change to _SkillServ
|
||||
/*2HPiercing*/ 36 // Needs research (set for 1HPiercing value - similar to slash/blunt)
|
||||
};
|
||||
|
||||
/*
|
||||
** Material use slots
|
||||
**
|
||||
*/
|
||||
enum MaterialUseSlots : uint8
|
||||
{
|
||||
MaterialHead = 0,
|
||||
MaterialChest,
|
||||
MaterialArms,
|
||||
MaterialWrist,
|
||||
MaterialHands,
|
||||
MaterialLegs, // 5
|
||||
MaterialFeet,
|
||||
MaterialPrimary,
|
||||
MaterialSecondary,
|
||||
_MaterialCount,
|
||||
_MaterialInvalid = 255
|
||||
};
|
||||
|
||||
/*
|
||||
// Used for worn NPC inventory tracking. NPCs don't use
|
||||
// augments, so only the basic slots need to be kept track of.
|
||||
@ -858,164 +515,8 @@ enum MaterialUseSlots : uint8
|
||||
**
|
||||
*/
|
||||
|
||||
enum InventoryMapTypes : int16 {
|
||||
MapPossessions = 0,
|
||||
MapBank,
|
||||
MapSharedBank,
|
||||
MapTrade,
|
||||
MapWorld,
|
||||
MapLimbo, // 5
|
||||
MapTribute,
|
||||
MapTrophyTribute,
|
||||
MapGuildTribute,
|
||||
MapMerchant,
|
||||
MapDeleted, // 10
|
||||
MapCorpse,
|
||||
MapBazaar,
|
||||
MapInspect,
|
||||
MapRealEstate,
|
||||
MapViewMODPC, // 15
|
||||
MapViewMODBank,
|
||||
MapViewMODSharedBank,
|
||||
MapViewMODLimbo,
|
||||
MapAltStorage,
|
||||
MapArchived, // 20
|
||||
MapMail,
|
||||
MapGuildTrophyTribute,
|
||||
MapKrono,
|
||||
MapOther,
|
||||
_MapCount
|
||||
};
|
||||
|
||||
enum InventoryMainTypes : int16 {
|
||||
MainCharm = 0,
|
||||
MainEar1,
|
||||
MainHead,
|
||||
MainFace,
|
||||
MainEar2,
|
||||
MainNeck, // 5
|
||||
MainShoulders,
|
||||
MainArms,
|
||||
MainBack,
|
||||
MainWrist1,
|
||||
MainWrist2, // 10
|
||||
MainRange,
|
||||
MainHands,
|
||||
MainPrimary,
|
||||
MainSecondary,
|
||||
MainFinger1, // 15
|
||||
MainFinger2,
|
||||
MainChest,
|
||||
MainLegs,
|
||||
MainFeet,
|
||||
MainWaist, // 20
|
||||
MainPowerSource = 9999, // temp
|
||||
MainAmmo = 21, // temp
|
||||
MainGeneral1,
|
||||
MainGeneral2,
|
||||
MainGeneral3,
|
||||
MainGeneral4, // 25
|
||||
MainGeneral5,
|
||||
MainGeneral6,
|
||||
MainGeneral7,
|
||||
MainGeneral8,
|
||||
//MainGeneral9,
|
||||
//MainGeneral10,
|
||||
MainCursor, // 30
|
||||
_MainCount
|
||||
};
|
||||
|
||||
#define INVALID_INDEX -1
|
||||
#define NOT_USED 0
|
||||
#define NO_ITEM 0
|
||||
|
||||
// yes..these are redundant... but, they help to identify and define what is actually being performed
|
||||
// plus, since they're pre-op's, they don't affect the actual binary size
|
||||
#define MAP_BEGIN 0
|
||||
#define MAIN_BEGIN 0
|
||||
#define SUB_BEGIN 0
|
||||
#define AUG_BEGIN 0
|
||||
|
||||
namespace legacy {
|
||||
// this is for perl and other legacy systems
|
||||
|
||||
typedef enum {
|
||||
SLOT_CHARM = 0,
|
||||
SLOT_EAR01 = 1,
|
||||
SLOT_HEAD = 2,
|
||||
SLOT_FACE = 3,
|
||||
SLOT_EAR02 = 4,
|
||||
SLOT_NECK = 5,
|
||||
SLOT_SHOULDER = 6,
|
||||
SLOT_ARMS = 7,
|
||||
SLOT_BACK = 8,
|
||||
SLOT_BRACER01 = 9,
|
||||
SLOT_BRACER02 = 10,
|
||||
SLOT_RANGE = 11,
|
||||
SLOT_HANDS = 12,
|
||||
SLOT_PRIMARY = 13,
|
||||
SLOT_SECONDARY = 14,
|
||||
SLOT_RING01 = 15,
|
||||
SLOT_RING02 = 16,
|
||||
SLOT_CHEST = 17,
|
||||
SLOT_LEGS = 18,
|
||||
SLOT_FEET = 19,
|
||||
SLOT_WAIST = 20,
|
||||
SLOT_POWER_SOURCE = 9999,
|
||||
SLOT_AMMO = 21,
|
||||
SLOT_GENERAL_1 = 22,
|
||||
SLOT_GENERAL_2 = 23,
|
||||
SLOT_GENERAL_3 = 24,
|
||||
SLOT_GENERAL_4 = 25,
|
||||
SLOT_GENERAL_5 = 26,
|
||||
SLOT_GENERAL_6 = 27,
|
||||
SLOT_GENERAL_7 = 28,
|
||||
SLOT_GENERAL_8 = 29,
|
||||
//SLOT_GENERAL_9 = not supported
|
||||
//SLOT_GENERAL_10 = not supported
|
||||
SLOT_CURSOR = 30,
|
||||
SLOT_CURSOR_END = (int16)0xFFFE, // I hope no one is using this...
|
||||
SLOT_TRADESKILL = 1000,
|
||||
SLOT_AUGMENT = 1001,
|
||||
SLOT_INVALID = (int16)0xFFFF,
|
||||
|
||||
SLOT_POSSESSIONS_BEGIN = 0,
|
||||
SLOT_POSSESSIONS_END = 30,
|
||||
|
||||
SLOT_EQUIPMENT_BEGIN = 0,
|
||||
SLOT_EQUIPMENT_END = 21,
|
||||
|
||||
SLOT_PERSONAL_BEGIN = 22,
|
||||
SLOT_PERSONAL_END = 29,
|
||||
SLOT_PERSONAL_BAGS_BEGIN = 251,
|
||||
SLOT_PERSONAL_BAGS_END = 330,
|
||||
|
||||
SLOT_CURSOR_BAG_BEGIN = 331,
|
||||
SLOT_CURSOR_BAG_END = 340,
|
||||
|
||||
SLOT_TRIBUTE_BEGIN = 400,
|
||||
SLOT_TRIBUTE_END = 404,
|
||||
|
||||
SLOT_BANK_BEGIN = 2000,
|
||||
SLOT_BANK_END = 2023,
|
||||
SLOT_BANK_BAGS_BEGIN = 2031,
|
||||
SLOT_BANK_BAGS_END = 2270,
|
||||
|
||||
SLOT_SHARED_BANK_BEGIN = 2500,
|
||||
SLOT_SHARED_BANK_END = 2501,
|
||||
SLOT_SHARED_BANK_BAGS_BEGIN = 2531,
|
||||
SLOT_SHARED_BANK_BAGS_END = 2550,
|
||||
|
||||
SLOT_TRADE_BEGIN = 3000,
|
||||
SLOT_TRADE_END = 3007,
|
||||
SLOT_TRADE_BAGS_BEGIN = 3031,
|
||||
SLOT_TRADE_BAGS_END = 3110,
|
||||
|
||||
SLOT_WORLD_BEGIN = 4000,
|
||||
SLOT_WORLD_END = 4009
|
||||
} InventorySlot;
|
||||
}
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
#endif
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
@ -1,943 +0,0 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#include "eq_dictionary.h"
|
||||
#include "string_util.h"
|
||||
|
||||
//
|
||||
// class EmuConstants
|
||||
//
|
||||
uint16 EmuConstants::InventoryMapSize(int16 indexMap)
|
||||
{
|
||||
switch (indexMap)
|
||||
{
|
||||
case MapPossessions:
|
||||
return MAP_POSSESSIONS_SIZE;
|
||||
case MapBank:
|
||||
return MAP_BANK_SIZE;
|
||||
case MapSharedBank:
|
||||
return MAP_SHARED_BANK_SIZE;
|
||||
case MapTrade:
|
||||
return MAP_TRADE_SIZE;
|
||||
case MapWorld:
|
||||
return MAP_WORLD_SIZE;
|
||||
case MapLimbo:
|
||||
return MAP_LIMBO_SIZE;
|
||||
case MapTribute:
|
||||
return MAP_TRIBUTE_SIZE;
|
||||
case MapTrophyTribute:
|
||||
return MAP_TROPHY_TRIBUTE_SIZE;
|
||||
case MapGuildTribute:
|
||||
return MAP_GUILD_TRIBUTE_SIZE;
|
||||
case MapMerchant:
|
||||
return MAP_MERCHANT_SIZE;
|
||||
case MapDeleted:
|
||||
return MAP_DELETED_SIZE;
|
||||
case MapCorpse:
|
||||
return MAP_CORPSE_SIZE;
|
||||
case MapBazaar:
|
||||
return MAP_BAZAAR_SIZE;
|
||||
case MapInspect:
|
||||
return MAP_INSPECT_SIZE;
|
||||
case MapRealEstate:
|
||||
return MAP_REAL_ESTATE_SIZE;
|
||||
case MapViewMODPC:
|
||||
return MAP_VIEW_MOD_PC_SIZE;
|
||||
case MapViewMODBank:
|
||||
return MAP_VIEW_MOD_BANK_SIZE;
|
||||
case MapViewMODSharedBank:
|
||||
return MAP_VIEW_MOD_SHARED_BANK_SIZE;
|
||||
case MapViewMODLimbo:
|
||||
return MAP_VIEW_MOD_LIMBO_SIZE;
|
||||
case MapAltStorage:
|
||||
return MAP_ALT_STORAGE_SIZE;
|
||||
case MapArchived:
|
||||
return MAP_ARCHIVED_SIZE;
|
||||
case MapMail:
|
||||
return MAP_MAIL_SIZE;
|
||||
case MapGuildTrophyTribute:
|
||||
return MAP_GUILD_TROPHY_TRIBUTE_SIZE;
|
||||
case MapKrono:
|
||||
return MAP_KRONO_SIZE;
|
||||
case MapOther:
|
||||
return MAP_OTHER_SIZE;
|
||||
default:
|
||||
return NOT_USED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
std::string EmuConstants::InventoryLocationName(Location_Struct location)
|
||||
{
|
||||
// not ready for implementation...
|
||||
std::string ret_str;
|
||||
StringFormat(ret_str, "%s, %s, %s, %s", InventoryMapName(location.map), InventoryMainName(location.main), InventorySubName(location.sub), InventoryAugName(location.aug));
|
||||
return ret_str;
|
||||
}
|
||||
*/
|
||||
|
||||
std::string EmuConstants::InventoryMapName(int16 indexMap)
|
||||
{
|
||||
switch (indexMap)
|
||||
{
|
||||
case INVALID_INDEX:
|
||||
return "Invalid Map";
|
||||
case MapPossessions:
|
||||
return "Possessions";
|
||||
case MapBank:
|
||||
return "Bank";
|
||||
case MapSharedBank:
|
||||
return "SharedBank";
|
||||
case MapTrade:
|
||||
return "Trade";
|
||||
case MapWorld:
|
||||
return "World";
|
||||
case MapLimbo:
|
||||
return "Limbo";
|
||||
case MapTribute:
|
||||
return "Tribute";
|
||||
case MapTrophyTribute:
|
||||
return "TrophyTribute";
|
||||
case MapGuildTribute:
|
||||
return "GuildTribute";
|
||||
case MapMerchant:
|
||||
return "Merchant";
|
||||
case MapDeleted:
|
||||
return "Deleted";
|
||||
case MapCorpse:
|
||||
return "Corpse";
|
||||
case MapBazaar:
|
||||
return "Bazaar";
|
||||
case MapInspect:
|
||||
return "Inspect";
|
||||
case MapRealEstate:
|
||||
return "RealEstate";
|
||||
case MapViewMODPC:
|
||||
return "ViewMODPC";
|
||||
case MapViewMODBank:
|
||||
return "ViewMODBank";
|
||||
case MapViewMODSharedBank:
|
||||
return "ViewMODSharedBank";
|
||||
case MapViewMODLimbo:
|
||||
return "ViewMODLimbo";
|
||||
case MapAltStorage:
|
||||
return "AltStorage";
|
||||
case MapArchived:
|
||||
return "Archived";
|
||||
case MapMail:
|
||||
return "Mail";
|
||||
case MapGuildTrophyTribute:
|
||||
return "GuildTrophyTribute";
|
||||
case MapKrono:
|
||||
return "Krono";
|
||||
case MapOther:
|
||||
return "Other";
|
||||
default:
|
||||
return "Unknown Map";
|
||||
}
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventoryMainName(int16 indexMain)
|
||||
{
|
||||
switch (indexMain)
|
||||
{
|
||||
case INVALID_INDEX:
|
||||
return "Invalid Main";
|
||||
case MainCharm:
|
||||
return "Charm";
|
||||
case MainEar1:
|
||||
return "Ear1";
|
||||
case MainHead:
|
||||
return "Head";
|
||||
case MainFace:
|
||||
return "Face";
|
||||
case MainEar2:
|
||||
return "Ear2";
|
||||
case MainNeck:
|
||||
return "Neck";
|
||||
case MainShoulders:
|
||||
return "Shoulders";
|
||||
case MainArms:
|
||||
return "Arms";
|
||||
case MainBack:
|
||||
return "Back";
|
||||
case MainWrist1:
|
||||
return "Wrist1";
|
||||
case MainWrist2:
|
||||
return "Wrist2";
|
||||
case MainRange:
|
||||
return "Range";
|
||||
case MainHands:
|
||||
return "Hands";
|
||||
case MainPrimary:
|
||||
return "Primary";
|
||||
case MainSecondary:
|
||||
return "Secondary";
|
||||
case MainFinger1:
|
||||
return "Finger1";
|
||||
case MainFinger2:
|
||||
return "Finger2";
|
||||
case MainChest:
|
||||
return "Chest";
|
||||
case MainLegs:
|
||||
return "Legs";
|
||||
case MainFeet:
|
||||
return "Feet";
|
||||
case MainWaist:
|
||||
return "Waist";
|
||||
case MainPowerSource:
|
||||
return "PowerSource";
|
||||
case MainAmmo:
|
||||
return "Ammo";
|
||||
case MainGeneral1:
|
||||
return "General1";
|
||||
case MainGeneral2:
|
||||
return "General2";
|
||||
case MainGeneral3:
|
||||
return "General3";
|
||||
case MainGeneral4:
|
||||
return "General4";
|
||||
case MainGeneral5:
|
||||
return "General5";
|
||||
case MainGeneral6:
|
||||
return "General6";
|
||||
case MainGeneral7:
|
||||
return "General7";
|
||||
case MainGeneral8:
|
||||
return "General8";
|
||||
/*
|
||||
case MainGeneral9:
|
||||
return "General9";
|
||||
case MainGeneral10:
|
||||
return "General10";
|
||||
*/
|
||||
case MainCursor:
|
||||
return "Cursor";
|
||||
default:
|
||||
return "Unknown Main";
|
||||
}
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventorySubName(int16 indexSub)
|
||||
{
|
||||
if (indexSub == INVALID_INDEX)
|
||||
return "Invalid Sub";
|
||||
|
||||
if ((uint16)indexSub >= ITEM_CONTAINER_SIZE)
|
||||
return "Unknown Sub";
|
||||
|
||||
std::string ret_str;
|
||||
ret_str = StringFormat("Container%i", (indexSub + 1)); // zero-based index..but, count starts at one
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventoryAugName(int16 indexAug)
|
||||
{
|
||||
if (indexAug == INVALID_INDEX)
|
||||
return "Invalid Aug";
|
||||
|
||||
if ((uint16)indexAug >= ITEM_COMMON_SIZE)
|
||||
return "Unknown Aug";
|
||||
|
||||
std::string ret_str;
|
||||
ret_str = StringFormat("Augment%i", (indexAug + 1)); // zero-based index..but, count starts at one
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// class EQLimits
|
||||
//
|
||||
// client validation
|
||||
bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
// npc validation
|
||||
bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
// mob validation
|
||||
bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion)
|
||||
{
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
// database
|
||||
size_t EQLimits::CharacterCreationLimit(ClientVersion clientVersion)
|
||||
{
|
||||
static const size_t local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*Client62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::CHARACTER_CREATION_LIMIT,
|
||||
/*SoF*/ SoF::consts::CHARACTER_CREATION_LIMIT,
|
||||
/*SoD*/ SoD::consts::CHARACTER_CREATION_LIMIT,
|
||||
/*UF*/ UF::consts::CHARACTER_CREATION_LIMIT,
|
||||
/*RoF*/ RoF::consts::CHARACTER_CREATION_LIMIT,
|
||||
/*RoF2*/ RoF2::consts::CHARACTER_CREATION_LIMIT,
|
||||
|
||||
/*MobNPC*/ NOT_USED,
|
||||
/*MobMerc*/ NOT_USED,
|
||||
/*MobBot*/ NOT_USED,
|
||||
/*MobPet*/ NOT_USED
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
// inventory
|
||||
uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion)
|
||||
{
|
||||
// not all maps will have an instantiated container..some are references for queue generators (i.e., bazaar, mail, etc...)
|
||||
// a zero '0' indicates a needed value..otherwise, change to '_NOTUSED' for a null value so indices requiring research can be identified
|
||||
// ALL of these values need to be verified before pushing to live
|
||||
//
|
||||
// make sure that you transcribe the actual value from 'defaults' to here before updating or client crashes will ensue..and/or...
|
||||
// insert older clients inside of the progression of client order
|
||||
//
|
||||
// MAP_POSSESSIONS_SIZE does not reflect all actual <client>_constants size due to bitmask-use compatibility
|
||||
//
|
||||
// when setting NPC-based values, try to adhere to an EmuConstants::<property> or NOT_USED value to avoid unnecessary issues
|
||||
|
||||
static const uint16 local[_MapCount][CLIENT_VERSION_COUNT] = {
|
||||
// server and database are sync'd to current MapPossessions's client as set in 'using namespace RoF::slots;' and
|
||||
// 'EmuConstants::MAP_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask()
|
||||
// for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations
|
||||
{ // local[MainPossessions]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Merc*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Bot*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Pet*/ EmuConstants::MAP_POSSESSIONS_SIZE
|
||||
},
|
||||
{ // local[MapBank]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_BANK_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_BANK_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
/*Bot*/ NOT_USED,
|
||||
/*Pet*/ NOT_USED
|
||||
},
|
||||
{ // local[MapSharedBank]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
/*Bot*/ NOT_USED,
|
||||
/*Pet*/ NOT_USED
|
||||
},
|
||||
{ // local[MapTrade]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
|
||||
/*NPC*/ 4,
|
||||
/*Merc*/ 4,
|
||||
/*Bot*/ EmuConstants::MAP_TRADE_SIZE, // client thinks this is another client
|
||||
/*Pet*/ 4
|
||||
},
|
||||
{ // local[MapWorld]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
/*Bot*/ NOT_USED,
|
||||
/*Pet*/ NOT_USED
|
||||
},
|
||||
{ // local[MapLimbo]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
/*Bot*/ NOT_USED,
|
||||
/*Pet*/ NOT_USED
|
||||
},
|
||||
{ // local[MapTribute]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapTrophyTribute]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapGuildTribute]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapMerchant]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_MERCHANT_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_MERCHANT_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapDeleted]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_DELETED_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_DELETED_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapCorpse]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE,
|
||||
/*SoF*/ SoF::consts::MAP_CORPSE_SIZE,
|
||||
/*SoD*/ SoD::consts::MAP_CORPSE_SIZE,
|
||||
/*Underfoot*/ UF::consts::MAP_CORPSE_SIZE,
|
||||
/*RoF*/ RoF::consts::MAP_CORPSE_SIZE,
|
||||
/*RoF2*/ RoF2::consts::MAP_CORPSE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapBazaar]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*Titanium*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
|
||||
/*NPC*/ 0, // this may need to be 'EmuConstants::MAP_BAZAAR_SIZE' if offline client traders respawn as an npc
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapInspect]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE,
|
||||
/*SoF*/ SoF::consts::MAP_INSPECT_SIZE,
|
||||
/*SoD*/ SoD::consts::MAP_INSPECT_SIZE,
|
||||
/*Underfoot*/ UF::consts::MAP_INSPECT_SIZE,
|
||||
/*RoF*/ RoF::consts::MAP_INSPECT_SIZE,
|
||||
/*RoF2*/ RoF2::consts::MAP_INSPECT_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
/*Bot*/ NOT_USED,
|
||||
/*Pet*/ NOT_USED
|
||||
},
|
||||
{ // local[MapRealEstate]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_REAL_ESTATE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_REAL_ESTATE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapViewMODPC]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapViewMODBank]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapViewMODSharedBank]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapViewMODLimbo]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapAltStorage]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_ALT_STORAGE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_ALT_STORAGE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapArchived]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_ARCHIVED_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_ARCHIVED_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapMail]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_MAIL_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_MAIL_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapGuildTrophyTribute]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapKrono]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ NOT_USED,
|
||||
/*SoF*/ NOT_USED,
|
||||
/*SoD*/ NOT_USED,
|
||||
/*Underfoot*/ NOT_USED,
|
||||
/*RoF*/ EmuConstants::MAP_KRONO_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_KRONO_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
},
|
||||
{ // local[MapOther]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0,
|
||||
/*Titanium*/ 0,
|
||||
/*SoF*/ 0,
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_OTHER_SIZE,
|
||||
/*RoF2*/ EmuConstants::MAP_OTHER_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
}
|
||||
};
|
||||
|
||||
if ((uint16)indexMap < _MapCount)
|
||||
return local[indexMap][static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
|
||||
return NOT_USED;
|
||||
}
|
||||
|
||||
uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion)
|
||||
{
|
||||
// these are for the new inventory system (RoF)..not the current (Ti) one...
|
||||
// 0x0000000000200000 is SlotPowerSource (SoF+)
|
||||
// 0x0000000080000000 is SlotGeneral9 (RoF+)
|
||||
// 0x0000000100000000 is SlotGeneral10 (RoF+)
|
||||
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x000000027FDFFFFF,
|
||||
/*Titanium*/ 0x000000027FDFFFFF,
|
||||
/*SoF*/ 0x000000027FFFFFFF,
|
||||
/*SoD*/ 0x000000027FFFFFFF,
|
||||
/*Underfoot*/ 0x000000027FFFFFFF,
|
||||
/*RoF*/ 0x00000003FFFFFFFF,
|
||||
/*RoF2*/ 0,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion)
|
||||
{
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x00000000005FFFFF,
|
||||
/*Titanium*/ 0x00000000005FFFFF,
|
||||
/*SoF*/ 0x00000000007FFFFF,
|
||||
/*SoD*/ 0x00000000007FFFFF,
|
||||
/*Underfoot*/ 0x00000000007FFFFF,
|
||||
/*RoF*/ 0x00000000007FFFFF,
|
||||
/*RoF2*/ 0,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion)
|
||||
{
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x000000007F800000,
|
||||
/*Titanium*/ 0x000000007F800000,
|
||||
/*SoF*/ 0x000000007F800000,
|
||||
/*SoD*/ 0x000000007F800000,
|
||||
/*Underfoot*/ 0x000000007F800000,
|
||||
/*RoF*/ 0x00000001FF800000,
|
||||
/*RoF2*/ 0,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::CursorBitmask(ClientVersion clientVersion)
|
||||
{
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x0000000200000000,
|
||||
/*Titanium*/ 0x0000000200000000,
|
||||
/*SoF*/ 0x0000000200000000,
|
||||
/*SoD*/ 0x0000000200000000,
|
||||
/*Underfoot*/ 0x0000000200000000,
|
||||
/*RoF*/ 0x0000000200000000,
|
||||
/*RoF2*/ 0,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
/*Bot*/ 0,
|
||||
/*Pet*/ 0
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion)
|
||||
{
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ false,
|
||||
/*62*/ false,
|
||||
/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*Underfoot*/ UF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
|
||||
/*NPC*/ false,
|
||||
/*Merc*/ false,
|
||||
/*Bot*/ false,
|
||||
/*Pet*/ false
|
||||
};
|
||||
|
||||
return false; // not implemented
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion)
|
||||
{
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ false,
|
||||
/*62*/ false,
|
||||
/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*Underfoot*/ UF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
|
||||
/*NPC*/ false,
|
||||
/*Merc*/ false,
|
||||
/*Bot*/ false,
|
||||
/*Pet*/ false
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
// items
|
||||
uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion)
|
||||
{
|
||||
static const uint16 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Titanium*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*SoF*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*SoD*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Underfoot*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*RoF*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*RoF2*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Merc*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Bot*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Pet*/ EmuConstants::ITEM_COMMON_SIZE
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion)
|
||||
{
|
||||
static const uint16 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*SoF*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Underfoot*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*RoF*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*RoF2*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Merc*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Bot*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Pet*/ EmuConstants::ITEM_CONTAINER_SIZE
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::CoinHasWeight(ClientVersion clientVersion)
|
||||
{
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ true,
|
||||
/*62*/ true,
|
||||
/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT,
|
||||
/*SoF*/ SoF::limits::COIN_HAS_WEIGHT,
|
||||
/*SoD*/ SoD::limits::COIN_HAS_WEIGHT,
|
||||
/*Underfoot*/ UF::limits::COIN_HAS_WEIGHT,
|
||||
/*RoF*/ RoF::limits::COIN_HAS_WEIGHT,
|
||||
/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT,
|
||||
|
||||
/*NPC*/ true,
|
||||
/*Merc*/ true,
|
||||
/*Bot*/ true,
|
||||
/*Pet*/ true
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
@ -1,205 +0,0 @@
|
||||
/*
|
||||
EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 EQ_DICTIONARY_H
|
||||
#define EQ_DICTIONARY_H
|
||||
|
||||
#include "types.h"
|
||||
#include "eq_constants.h"
|
||||
#include "clientversions.h"
|
||||
#include <string>
|
||||
#include "../common/patches/titanium_constants.h"
|
||||
#include "../common/patches/sof_constants.h"
|
||||
#include "../common/patches/sod_constants.h"
|
||||
#include "../common/patches/uf_constants.h"
|
||||
#include "../common/patches/rof_constants.h"
|
||||
#include "../common/patches/rof2_constants.h"
|
||||
|
||||
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
|
||||
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
|
||||
|
||||
// Hard-coded values usually indicate that further research is needed and the values given are from the old (known) system
|
||||
|
||||
// (future use)
|
||||
//using namespace RoF2::maps; // server inventory maps enumeration (code and database sync'd to reference)
|
||||
//using namespace RoF::slots; // server possessions slots enumeration (code and database sync'd to reference)
|
||||
|
||||
class EmuConstants
|
||||
{
|
||||
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
|
||||
public:
|
||||
// database
|
||||
static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client
|
||||
|
||||
static const size_t CHARACTER_CREATION_LIMIT = RoF2::consts::CHARACTER_CREATION_LIMIT;
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 indexMap);
|
||||
//static std::string InventoryLocationName(Location_Struct location);
|
||||
static std::string InventoryMapName(int16 indexMap);
|
||||
static std::string InventoryMainName(int16 indexMain);
|
||||
static std::string InventorySubName(int16 indexSub);
|
||||
static std::string InventoryAugName(int16 indexAug);
|
||||
|
||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||
static const uint16 MAP_POSSESSIONS_SIZE = _MainCount;
|
||||
static const uint16 MAP_BANK_SIZE = 24;
|
||||
static const uint16 MAP_SHARED_BANK_SIZE = 2;
|
||||
static const uint16 MAP_TRADE_SIZE = 8;
|
||||
static const uint16 MAP_WORLD_SIZE = 10;
|
||||
static const uint16 MAP_LIMBO_SIZE = 36;
|
||||
static const uint16 MAP_TRIBUTE_SIZE = 5; // (need client values)
|
||||
static const uint16 MAP_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_GUILD_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_MERCHANT_SIZE = 0;
|
||||
static const uint16 MAP_DELETED_SIZE = 0;
|
||||
static const uint16 MAP_CORPSE_SIZE = _MainCount; // no bitmask use..limits to size of client corpse window (see EQLimits::InventoryMapSize(MapCorpse, <EQClientVersion))
|
||||
static const uint16 MAP_BAZAAR_SIZE = 80;
|
||||
static const uint16 MAP_INSPECT_SIZE = 22;
|
||||
static const uint16 MAP_REAL_ESTATE_SIZE = 0;
|
||||
static const uint16 MAP_VIEW_MOD_PC_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_BANK_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_SHARED_BANK_SIZE = NOT_USED;
|
||||
static const uint16 MAP_VIEW_MOD_LIMBO_SIZE = NOT_USED;
|
||||
static const uint16 MAP_ALT_STORAGE_SIZE = 0;
|
||||
static const uint16 MAP_ARCHIVED_SIZE = 0;
|
||||
static const uint16 MAP_MAIL_SIZE = 0;
|
||||
static const uint16 MAP_GUILD_TROPHY_TRIBUTE_SIZE = 0;
|
||||
static const uint16 MAP_KRONO_SIZE = 0;
|
||||
static const uint16 MAP_OTHER_SIZE = 0;
|
||||
|
||||
// most of these definitions will go away with the structure-based system..this maintains compatibility for now
|
||||
// (these are mainly to assign specific values to constants used in conversions and to identify per-client ranges/offsets)
|
||||
static const int16 EQUIPMENT_BEGIN = MainCharm;
|
||||
static const int16 EQUIPMENT_END = MainAmmo;
|
||||
static const uint16 EQUIPMENT_SIZE = 22; // does not account for 'Power Source' - used mainly for npc equipment arrays
|
||||
|
||||
static const int16 GENERAL_BEGIN = MainGeneral1;
|
||||
static const int16 GENERAL_END = MainGeneral8;
|
||||
static const uint16 GENERAL_SIZE = 8;
|
||||
static const int16 GENERAL_BAGS_BEGIN = 251;
|
||||
static const int16 GENERAL_BAGS_END_OFFSET = 79;
|
||||
static const int16 GENERAL_BAGS_END = GENERAL_BAGS_BEGIN + GENERAL_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 CURSOR_BAG_BEGIN = 331;
|
||||
static const int16 CURSOR_BAG_END_OFFSET = 9;
|
||||
static const int16 CURSOR_BAG_END = CURSOR_BAG_BEGIN + CURSOR_BAG_END_OFFSET;
|
||||
|
||||
static const int16 BANK_BEGIN = 2000;
|
||||
static const int16 BANK_END = 2023;
|
||||
static const int16 BANK_BAGS_BEGIN = 2031;
|
||||
static const int16 BANK_BAGS_END_OFFSET = 239;
|
||||
static const int16 BANK_BAGS_END = BANK_BAGS_BEGIN + BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 SHARED_BANK_BEGIN = 2500;
|
||||
static const int16 SHARED_BANK_END = 2501;
|
||||
static const int16 SHARED_BANK_BAGS_BEGIN = 2531;
|
||||
static const int16 SHARED_BANK_BAGS_END_OFFSET = 19;
|
||||
static const int16 SHARED_BANK_BAGS_END = SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 TRADE_BEGIN = 3000;
|
||||
static const int16 TRADE_END = 3007;
|
||||
static const int16 TRADE_NPC_END = 3003;
|
||||
static const int16 TRADE_BAGS_BEGIN = 3031;
|
||||
static const int16 TRADE_BAGS_END_OFFSET = 79;
|
||||
static const int16 TRADE_BAGS_END = TRADE_BAGS_BEGIN + TRADE_BAGS_END_OFFSET;
|
||||
|
||||
static const int16 WORLD_BEGIN = 4000;
|
||||
static const int16 WORLD_END = 4009;
|
||||
static const int16 WORLD_SIZE = MAP_WORLD_SIZE;
|
||||
|
||||
static const int16 TRIBUTE_BEGIN = 400;
|
||||
static const int16 TRIBUTE_END = 404;
|
||||
static const int16 TRIBUTE_SIZE = MAP_TRIBUTE_SIZE;
|
||||
|
||||
static const int16 CORPSE_BEGIN = 22;
|
||||
//static const int16 CORPSE_END = RoF::consts::CORPSE_END; // not ready for use
|
||||
|
||||
static const int16 MATERIAL_BEGIN = MaterialHead;
|
||||
static const int16 MATERIAL_END = MaterialSecondary;
|
||||
static const int16 MATERIAL_TINT_END = MaterialFeet;
|
||||
static const int16 MATERIAL_SIZE = _MaterialCount;
|
||||
|
||||
// items
|
||||
// common and container sizes will not increase until the new 'location' struct is implemented
|
||||
static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE;
|
||||
static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE;
|
||||
|
||||
// BANDOLIERS_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t BANDOLIERS_SIZE = RoF2::consts::BANDOLIERS_SIZE; // number of bandolier instances
|
||||
static const size_t BANDOLIER_ITEM_COUNT = RoF2::consts::BANDOLIER_ITEM_COUNT; // number of equipment slots in bandolier instance
|
||||
|
||||
// POTION_BELT_SIZE sets maximum limit..active limit will need to be handled by the appropriate AA or spell (or item?)
|
||||
static const size_t POTION_BELT_ITEM_COUNT = RoF2::consts::POTION_BELT_ITEM_COUNT;
|
||||
|
||||
static const size_t TEXT_LINK_BODY_LENGTH = RoF2::consts::TEXT_LINK_BODY_LENGTH;
|
||||
};
|
||||
|
||||
class EQLimits
|
||||
{
|
||||
// values should default to a non-beneficial value..unless value conflicts with intended operation
|
||||
//
|
||||
// EmuConstants may be used as references..but, not every reference needs to be in EmuConstants (i.e., AllowsEmptyBagInBag(), CoinHasWeight(), etc...)
|
||||
public:
|
||||
// client version validation (checks to avoid crashing zone server when accessing reference arrays)
|
||||
// use this inside of class Client (limits to actual clients)
|
||||
static bool IsValidPCClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidatePCClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// basically..any non-client classes - do not when setting a valid client
|
||||
static bool IsValidNPCClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidateNPCClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// these are 'universal' - do not when setting a valid client
|
||||
static bool IsValidMobClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// database
|
||||
static size_t CharacterCreationLimit(ClientVersion clientVersion);
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 indexMap, ClientVersion clientVersion);
|
||||
static uint64 PossessionsBitmask(ClientVersion clientVersion);
|
||||
static uint64 EquipmentBitmask(ClientVersion clientVersion);
|
||||
static uint64 GeneralBitmask(ClientVersion clientVersion);
|
||||
static uint64 CursorBitmask(ClientVersion clientVersion);
|
||||
|
||||
static bool AllowsEmptyBagInBag(ClientVersion clientVersion);
|
||||
static bool AllowsClickCastFromBag(ClientVersion clientVersion);
|
||||
|
||||
// items
|
||||
static uint16 ItemCommonSize(ClientVersion clientVersion);
|
||||
static uint16 ItemContainerSize(ClientVersion clientVersion);
|
||||
|
||||
// player profile
|
||||
static bool CoinHasWeight(ClientVersion clientVersion);
|
||||
};
|
||||
|
||||
#endif /* EQ_DICTIONARY_H */
|
||||
|
||||
/*
|
||||
Working Notes:
|
||||
--------------
|
||||
|
||||
- full review of client_packet.cpp and client translators needed
|
||||
|
||||
|
||||
*/
|
||||
983
common/eq_limits.cpp
Normal file
983
common/eq_limits.cpp
Normal file
@ -0,0 +1,983 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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
|
||||
*/
|
||||
|
||||
#include "emu_constants.h"
|
||||
#include "emu_limits.h"
|
||||
|
||||
|
||||
static const EQEmu::constants::LookupEntry constants_lookup_entries[EQEmu::versions::ClientVersionCount] =
|
||||
{
|
||||
{
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null
|
||||
},
|
||||
{
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null
|
||||
},
|
||||
{
|
||||
Titanium::constants::CharacterCreationLimit,
|
||||
Titanium::constants::LongBuffs,
|
||||
Titanium::constants::ShortBuffs,
|
||||
Titanium::constants::DiscBuffs,
|
||||
Titanium::constants::TotalBuffs,
|
||||
Titanium::constants::NPCBuffs,
|
||||
Titanium::constants::PetBuffs,
|
||||
Titanium::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
SoF::constants::CharacterCreationLimit,
|
||||
SoF::constants::LongBuffs,
|
||||
SoF::constants::ShortBuffs,
|
||||
SoF::constants::DiscBuffs,
|
||||
SoF::constants::TotalBuffs,
|
||||
SoF::constants::NPCBuffs,
|
||||
SoF::constants::PetBuffs,
|
||||
SoF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
SoD::constants::CharacterCreationLimit,
|
||||
SoD::constants::LongBuffs,
|
||||
SoD::constants::ShortBuffs,
|
||||
SoD::constants::DiscBuffs,
|
||||
SoD::constants::TotalBuffs,
|
||||
SoD::constants::NPCBuffs,
|
||||
SoD::constants::PetBuffs,
|
||||
SoD::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
UF::constants::CharacterCreationLimit,
|
||||
UF::constants::LongBuffs,
|
||||
UF::constants::ShortBuffs,
|
||||
UF::constants::DiscBuffs,
|
||||
UF::constants::TotalBuffs,
|
||||
UF::constants::NPCBuffs,
|
||||
UF::constants::PetBuffs,
|
||||
UF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
RoF::constants::CharacterCreationLimit,
|
||||
RoF::constants::LongBuffs,
|
||||
RoF::constants::ShortBuffs,
|
||||
RoF::constants::DiscBuffs,
|
||||
RoF::constants::TotalBuffs,
|
||||
RoF::constants::NPCBuffs,
|
||||
RoF::constants::PetBuffs,
|
||||
RoF::constants::MercBuffs
|
||||
},
|
||||
{
|
||||
RoF2::constants::CharacterCreationLimit,
|
||||
RoF2::constants::LongBuffs,
|
||||
RoF2::constants::ShortBuffs,
|
||||
RoF2::constants::DiscBuffs,
|
||||
RoF2::constants::TotalBuffs,
|
||||
RoF2::constants::NPCBuffs,
|
||||
RoF2::constants::PetBuffs,
|
||||
RoF2::constants::MercBuffs
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::constants::LookupEntry* EQEmu::constants::Lookup(versions::ClientVersion client_version)
|
||||
{
|
||||
return &constants_lookup_entries[static_cast<int>(versions::ValidateClientVersion(client_version))];
|
||||
}
|
||||
|
||||
static const EQEmu::inventory::LookupEntry inventory_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
{
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
ClientUnknown::Null,
|
||||
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False,
|
||||
ClientUnknown::False
|
||||
},
|
||||
{
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
Client62::Null,
|
||||
|
||||
Client62::False,
|
||||
Client62::False,
|
||||
Client62::False,
|
||||
Client62::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*Titanium::invtype::InvTypePossessionsSize,*/
|
||||
Titanium::invtype::InvTypeBankSize,
|
||||
Titanium::invtype::InvTypeSharedBankSize,
|
||||
Titanium::invtype::InvTypeTradeSize,
|
||||
Titanium::invtype::InvTypeWorldSize,
|
||||
Titanium::invtype::InvTypeLimboSize,
|
||||
Titanium::invtype::InvTypeTributeSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null, /*Titanium::invtype::InvTypeGuildTributeSize,*/
|
||||
Titanium::invtype::InvTypeMerchantSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*Titanium::invtype::InvTypeBazaarSize,*/
|
||||
Titanium::invtype::InvTypeInspectSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeViewMODPCSize,
|
||||
Titanium::invtype::InvTypeViewMODBankSize,
|
||||
Titanium::invtype::InvTypeViewMODSharedBankSize,
|
||||
Titanium::invtype::InvTypeViewMODLimboSize,
|
||||
Titanium::invtype::InvTypeAltStorageSize,
|
||||
Titanium::invtype::InvTypeArchivedSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeOtherSize,
|
||||
|
||||
Titanium::Null, /*0x000000027FDFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*Titanium::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*Titanium::invaug::ItemAugSize,*/
|
||||
|
||||
Titanium::inventory::AllowEmptyBagInBag,
|
||||
Titanium::inventory::AllowClickCastFromBag,
|
||||
Titanium::inventory::ConcatenateInvTypeLimbo,
|
||||
Titanium::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoF::invtype::InvTypePossessionsSize,*/
|
||||
SoF::invtype::InvTypeBankSize,
|
||||
SoF::invtype::InvTypeSharedBankSize,
|
||||
SoF::invtype::InvTypeTradeSize,
|
||||
SoF::invtype::InvTypeWorldSize,
|
||||
SoF::invtype::InvTypeLimboSize,
|
||||
SoF::invtype::InvTypeTributeSize,
|
||||
SoF::Null,
|
||||
SoF::Null, /*SoF::invtype::InvTypeGuildTributeSize,*/
|
||||
SoF::invtype::InvTypeMerchantSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoF::invtype::InvTypeBazaarSize,*/
|
||||
SoF::invtype::InvTypeInspectSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeViewMODPCSize,
|
||||
SoF::invtype::InvTypeViewMODBankSize,
|
||||
SoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoF::invtype::InvTypeViewMODLimboSize,
|
||||
SoF::invtype::InvTypeAltStorageSize,
|
||||
SoF::invtype::InvTypeArchivedSize, SoF::Null, SoF::Null, SoF::Null, SoF::invtype::InvTypeOtherSize,
|
||||
|
||||
SoF::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*SoF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*SoF::invaug::ItemAugSize,*/
|
||||
|
||||
SoF::inventory::AllowEmptyBagInBag,
|
||||
SoF::inventory::AllowClickCastFromBag,
|
||||
SoF::inventory::ConcatenateInvTypeLimbo,
|
||||
SoF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*SoD::invtype::InvTypePossessionsSize,*/
|
||||
SoD::invtype::InvTypeBankSize,
|
||||
SoD::invtype::InvTypeSharedBankSize,
|
||||
SoD::invtype::InvTypeTradeSize,
|
||||
SoD::invtype::InvTypeWorldSize,
|
||||
SoD::invtype::InvTypeLimboSize,
|
||||
SoD::invtype::InvTypeTributeSize,
|
||||
SoD::Null,
|
||||
SoD::Null, /*SoD::invtype::InvTypeGuildTributeSize,*/
|
||||
SoD::invtype::InvTypeMerchantSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*SoD::invtype::InvTypeBazaarSize,*/
|
||||
SoD::invtype::InvTypeInspectSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeViewMODPCSize,
|
||||
SoD::invtype::InvTypeViewMODBankSize,
|
||||
SoD::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoD::invtype::InvTypeViewMODLimboSize,
|
||||
SoD::invtype::InvTypeAltStorageSize,
|
||||
SoD::invtype::InvTypeArchivedSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeOtherSize,
|
||||
|
||||
SoD::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*SoD::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*SoD::invaug::ItemAugSize,*/
|
||||
|
||||
SoD::inventory::AllowEmptyBagInBag,
|
||||
SoD::inventory::AllowClickCastFromBag,
|
||||
SoD::inventory::ConcatenateInvTypeLimbo,
|
||||
SoD::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*UF::invtype::InvTypePossessionsSize,*/
|
||||
UF::invtype::InvTypeBankSize,
|
||||
UF::invtype::InvTypeSharedBankSize,
|
||||
UF::invtype::InvTypeTradeSize,
|
||||
UF::invtype::InvTypeWorldSize,
|
||||
UF::invtype::InvTypeLimboSize,
|
||||
UF::invtype::InvTypeTributeSize,
|
||||
UF::Null,
|
||||
UF::Null, /*UF::invtype::InvTypeGuildTributeSize,*/
|
||||
UF::invtype::InvTypeMerchantSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*UF::invtype::InvTypeBazaarSize,*/
|
||||
UF::invtype::InvTypeInspectSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeViewMODPCSize,
|
||||
UF::invtype::InvTypeViewMODBankSize,
|
||||
UF::invtype::InvTypeViewMODSharedBankSize,
|
||||
UF::invtype::InvTypeViewMODLimboSize,
|
||||
UF::invtype::InvTypeAltStorageSize,
|
||||
UF::invtype::InvTypeArchivedSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeOtherSize,
|
||||
|
||||
UF::Null, /*0x000000027FFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*UF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*UF::invaug::ItemAugSize,*/
|
||||
|
||||
UF::inventory::AllowEmptyBagInBag,
|
||||
UF::inventory::AllowClickCastFromBag,
|
||||
UF::inventory::ConcatenateInvTypeLimbo,
|
||||
UF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF::invtype::InvTypePossessionsSize,*/
|
||||
RoF::invtype::InvTypeBankSize,
|
||||
RoF::invtype::InvTypeSharedBankSize,
|
||||
RoF::invtype::InvTypeTradeSize,
|
||||
RoF::invtype::InvTypeWorldSize,
|
||||
RoF::invtype::InvTypeLimboSize,
|
||||
RoF::invtype::InvTypeTributeSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeTrophyTributeSize,*/
|
||||
RoF::Null, /*RoF::invtype::InvTypeGuildTributeSize,*/
|
||||
RoF::invtype::InvTypeMerchantSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeDeletedSize,*/
|
||||
RoF::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF::invtype::InvTypeBazaarSize,*/
|
||||
RoF::invtype::InvTypeInspectSize,
|
||||
RoF::Null, /*RoF::invtype::InvTypeRealEstateSize,*/
|
||||
RoF::invtype::InvTypeViewMODPCSize,
|
||||
RoF::invtype::InvTypeViewMODBankSize,
|
||||
RoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF::invtype::InvTypeViewMODLimboSize,
|
||||
RoF::invtype::InvTypeAltStorageSize,
|
||||
RoF::invtype::InvTypeArchivedSize,
|
||||
RoF::invtype::InvTypeMailSize,
|
||||
RoF::invtype::InvTypeGuildTrophyTributeSize,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeOtherSize,
|
||||
|
||||
RoF::Null, /*0x00000003FFFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*RoF::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*RoF::invaug::ItemAugSize,*/
|
||||
|
||||
RoF::False, /*RoF::inventory::AllowEmptyBagInBag,*/
|
||||
RoF::inventory::AllowClickCastFromBag,
|
||||
RoF::inventory::ConcatenateInvTypeLimbo,
|
||||
RoF::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*RoF2::invtype::InvTypePossessionsSize,*/
|
||||
RoF2::invtype::InvTypeBankSize,
|
||||
RoF2::invtype::InvTypeSharedBankSize,
|
||||
RoF2::invtype::InvTypeTradeSize,
|
||||
RoF2::invtype::InvTypeWorldSize,
|
||||
RoF2::invtype::InvTypeLimboSize,
|
||||
RoF2::invtype::InvTypeTributeSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeTrophyTributeSize,*/
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeGuildTributeSize,*/
|
||||
RoF2::invtype::InvTypeMerchantSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeDeletedSize,*/
|
||||
RoF2::invtype::InvTypeCorpseSize,
|
||||
EQEmu::legacy::TYPE_BAZAAR_SIZE, /*RoF2::invtype::InvTypeBazaarSize,*/
|
||||
RoF2::invtype::InvTypeInspectSize,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeRealEstateSize*/
|
||||
RoF2::invtype::InvTypeViewMODPCSize,
|
||||
RoF2::invtype::InvTypeViewMODBankSize,
|
||||
RoF2::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF2::invtype::InvTypeViewMODLimboSize,
|
||||
RoF2::invtype::InvTypeAltStorageSize,
|
||||
RoF2::invtype::InvTypeArchivedSize,
|
||||
RoF2::invtype::InvTypeMailSize,
|
||||
RoF2::invtype::InvTypeGuildTrophyTributeSize,
|
||||
RoF2::invtype::InvTypeKronoSize,
|
||||
RoF2::invtype::InvTypeOtherSize,
|
||||
|
||||
RoF2::Null, /*0x00000003FFFFFFFF,*/
|
||||
EQEmu::inventory::ContainerCount, /*RoF2::invbag::ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*RoF2::invaug::ItemAugSize,*/
|
||||
|
||||
RoF2::False, /*RoF2::inventory::AllowEmptyBagInBag,*/
|
||||
RoF2::inventory::AllowClickCastFromBag,
|
||||
RoF2::inventory::ConcatenateInvTypeLimbo,
|
||||
RoF2::inventory::AllowOverLevelEquipment
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::InvTypeTradeSize,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
EntityLimits::NPC::Null,
|
||||
|
||||
EntityLimits::NPC::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False,
|
||||
EntityLimits::NPC::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::InvTypeTradeSize,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
|
||||
EntityLimits::NPCMerchant::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False,
|
||||
EntityLimits::NPCMerchant::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::InvTypeTradeSize,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
EntityLimits::Merc::Null,
|
||||
|
||||
EntityLimits::Merc::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False,
|
||||
EntityLimits::Merc::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::InvTypeTradeSize,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
EntityLimits::Bot::Null,
|
||||
|
||||
EntityLimits::Bot::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False,
|
||||
EntityLimits::Bot::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::InvTypeTradeSize,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
EntityLimits::ClientPet::Null,
|
||||
|
||||
EntityLimits::ClientPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False,
|
||||
EntityLimits::ClientPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::InvTypeTradeSize,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
EntityLimits::NPCPet::Null,
|
||||
|
||||
EntityLimits::NPCPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False,
|
||||
EntityLimits::NPCPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::InvTypeTradeSize,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
EntityLimits::MercPet::Null,
|
||||
|
||||
EntityLimits::MercPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False,
|
||||
EntityLimits::MercPet::False
|
||||
},
|
||||
{
|
||||
EQEmu::legacy::TYPE_POSSESSIONS_SIZE, /*InvTypePossessionsSize,*/
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::InvTypeTradeSize,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null, /*InvTypeCorpseSize,*/
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
EntityLimits::BotPet::Null,
|
||||
|
||||
EntityLimits::BotPet::Null,
|
||||
EQEmu::inventory::ContainerCount, /*ItemBagSize,*/
|
||||
EQEmu::inventory::SocketCount, /*ItemAugSize,*/
|
||||
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False,
|
||||
EntityLimits::BotPet::False
|
||||
},
|
||||
{ // OfflineTitanium
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeTradeSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeMerchantSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null, /*Titanium::invtype::InvTypeBazaarSize,*/
|
||||
Titanium::invtype::InvTypeInspectSize,
|
||||
Titanium::Null,
|
||||
Titanium::invtype::InvTypeViewMODPCSize,
|
||||
Titanium::invtype::InvTypeViewMODBankSize,
|
||||
Titanium::invtype::InvTypeViewMODSharedBankSize,
|
||||
Titanium::invtype::InvTypeViewMODLimboSize,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
Titanium::Null,
|
||||
|
||||
Titanium::Null,
|
||||
EQEmu::inventory::ContainerCount, /*Titanium::Null,*/
|
||||
Titanium::Null,
|
||||
|
||||
Titanium::False,
|
||||
Titanium::False,
|
||||
Titanium::False,
|
||||
Titanium::False
|
||||
},
|
||||
{ // OfflineSoF
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeTradeSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeMerchantSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null, /*SoF::invtype::InvTypeBazaarSize,*/
|
||||
SoF::invtype::InvTypeInspectSize,
|
||||
SoF::Null,
|
||||
SoF::invtype::InvTypeViewMODPCSize,
|
||||
SoF::invtype::InvTypeViewMODBankSize,
|
||||
SoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoF::invtype::InvTypeViewMODLimboSize,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
SoF::Null,
|
||||
|
||||
SoF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*SoF::Null,*/
|
||||
SoF::Null,
|
||||
|
||||
SoF::False,
|
||||
SoF::False,
|
||||
SoF::False,
|
||||
SoF::False
|
||||
},
|
||||
{ // OfflineSoD
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeTradeSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeMerchantSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null, /*SoD::invtype::InvTypeBazaarSize,*/
|
||||
SoD::invtype::InvTypeInspectSize,
|
||||
SoD::Null,
|
||||
SoD::invtype::InvTypeViewMODPCSize,
|
||||
SoD::invtype::InvTypeViewMODBankSize,
|
||||
SoD::invtype::InvTypeViewMODSharedBankSize,
|
||||
SoD::invtype::InvTypeViewMODLimboSize,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
SoD::Null,
|
||||
|
||||
SoD::Null,
|
||||
EQEmu::inventory::ContainerCount, /*SoD::Null,*/
|
||||
SoD::Null,
|
||||
|
||||
SoD::False,
|
||||
SoD::False,
|
||||
SoD::False,
|
||||
SoD::False
|
||||
},
|
||||
{ // OfflineUF
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeTradeSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeMerchantSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null, /*UF::invtype::InvTypeBazaarSize,*/
|
||||
UF::invtype::InvTypeInspectSize,
|
||||
UF::Null,
|
||||
UF::invtype::InvTypeViewMODPCSize,
|
||||
UF::invtype::InvTypeViewMODBankSize,
|
||||
UF::invtype::InvTypeViewMODSharedBankSize,
|
||||
UF::invtype::InvTypeViewMODLimboSize,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
UF::Null,
|
||||
|
||||
UF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*UF::Null,*/
|
||||
UF::Null,
|
||||
|
||||
UF::False,
|
||||
UF::False,
|
||||
UF::False,
|
||||
UF::False
|
||||
},
|
||||
{ // OfflineRoF
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeTradeSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeMerchantSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null, /*RoF::invtype::InvTypeBazaarSize,*/
|
||||
RoF::invtype::InvTypeInspectSize,
|
||||
RoF::Null,
|
||||
RoF::invtype::InvTypeViewMODPCSize,
|
||||
RoF::invtype::InvTypeViewMODBankSize,
|
||||
RoF::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF::invtype::InvTypeViewMODLimboSize,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
RoF::Null,
|
||||
|
||||
RoF::Null,
|
||||
EQEmu::inventory::ContainerCount, /*RoF::Null,*/
|
||||
RoF::Null,
|
||||
|
||||
RoF::False,
|
||||
RoF::False,
|
||||
RoF::False,
|
||||
RoF::False
|
||||
},
|
||||
{ // OfflineRoF2
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeTradeSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeMerchantSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null, /*RoF2::invtype::InvTypeBazaarSize,*/
|
||||
RoF2::invtype::InvTypeInspectSize,
|
||||
RoF2::Null,
|
||||
RoF2::invtype::InvTypeViewMODPCSize,
|
||||
RoF2::invtype::InvTypeViewMODBankSize,
|
||||
RoF2::invtype::InvTypeViewMODSharedBankSize,
|
||||
RoF2::invtype::InvTypeViewMODLimboSize,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
RoF2::Null,
|
||||
|
||||
RoF2::Null,
|
||||
EQEmu::inventory::ContainerCount, /*RoF2::Null,*/
|
||||
RoF2::Null,
|
||||
|
||||
RoF2::False,
|
||||
RoF2::False,
|
||||
RoF2::False,
|
||||
RoF2::False
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::inventory::LookupEntry* EQEmu::inventory::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &inventory_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
|
||||
static const EQEmu::behavior::LookupEntry behavior_lookup_entries[EQEmu::versions::MobVersionCount] =
|
||||
{
|
||||
{ // Unknown
|
||||
ClientUnknown::True
|
||||
},
|
||||
{ // Client62
|
||||
Client62::True
|
||||
},
|
||||
{ // Titanium
|
||||
Titanium::behavior::CoinHasWeight
|
||||
},
|
||||
{ // SoF
|
||||
SoF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // SoD
|
||||
SoD::behavior::CoinHasWeight
|
||||
},
|
||||
{ // UF
|
||||
UF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // RoF
|
||||
RoF::behavior::CoinHasWeight
|
||||
},
|
||||
{ // RoF2
|
||||
RoF2::behavior::CoinHasWeight
|
||||
},
|
||||
{ // NPC
|
||||
EntityLimits::NPC::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // NPCMerchant
|
||||
EntityLimits::NPC::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // Merc
|
||||
EntityLimits::Merc::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // Bot
|
||||
EntityLimits::Bot::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // ClientPet
|
||||
EntityLimits::ClientPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // NPCPet
|
||||
EntityLimits::NPCPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // MercPet
|
||||
EntityLimits::MercPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // BotPet
|
||||
EntityLimits::BotPet::True /*CoinHasWeight*/
|
||||
},
|
||||
{ // OfflineTitanium
|
||||
Titanium::False
|
||||
},
|
||||
{ // OfflineSoF
|
||||
SoF::False
|
||||
},
|
||||
{ // OfflineSoD
|
||||
SoD::False
|
||||
},
|
||||
{ // OfflineUF
|
||||
UF::False
|
||||
},
|
||||
{ // OfflineRoF
|
||||
RoF::False
|
||||
},
|
||||
{ // OfflineRoF2
|
||||
RoF2::False
|
||||
}
|
||||
};
|
||||
|
||||
const EQEmu::behavior::LookupEntry* EQEmu::behavior::Lookup(versions::MobVersion mob_version)
|
||||
{
|
||||
return &behavior_lookup_entries[static_cast<int>(versions::ValidateMobVersion(mob_version))];
|
||||
}
|
||||
101
common/eq_limits.h
Normal file
101
common/eq_limits.h
Normal file
@ -0,0 +1,101 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
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 COMMON_EQ_LIMITS_H
|
||||
#define COMMON_EQ_LIMITS_H
|
||||
|
||||
#include "emu_legacy.h"
|
||||
#include "types.h"
|
||||
#include "eq_constants.h"
|
||||
#include "emu_versions.h"
|
||||
#include "../common/patches/titanium_limits.h"
|
||||
#include "../common/patches/sof_limits.h"
|
||||
#include "../common/patches/sod_limits.h"
|
||||
#include "../common/patches/uf_limits.h"
|
||||
#include "../common/patches/rof_limits.h"
|
||||
#include "../common/patches/rof2_limits.h"
|
||||
|
||||
|
||||
namespace EQEmu
|
||||
{
|
||||
namespace constants {
|
||||
class LookupEntry {
|
||||
public:
|
||||
size_t CharacterCreationLimit;
|
||||
int LongBuffs;
|
||||
int ShortBuffs;
|
||||
int DiscBuffs;
|
||||
int TotalBuffs;
|
||||
int NPCBuffs;
|
||||
int PetBuffs;
|
||||
int MercBuffs;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::ClientVersion client_version);
|
||||
|
||||
} /*constants*/
|
||||
|
||||
namespace inventory {
|
||||
class LookupEntry {
|
||||
public:
|
||||
size_t InventoryTypeSize[25]; // should reflect EQEmu::inventory::typeCount referenced in emu_constants.h
|
||||
|
||||
uint64 PossessionsBitmask;
|
||||
size_t ItemBagSize;
|
||||
size_t ItemAugSize;
|
||||
|
||||
bool AllowEmptyBagInBag;
|
||||
bool AllowClickCastFromBag;
|
||||
bool ConcatenateInvTypeLimbo;
|
||||
bool AllowOverLevelEquipment;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*inventory*/
|
||||
|
||||
namespace behavior {
|
||||
class LookupEntry {
|
||||
public:
|
||||
bool CoinHasWeight;
|
||||
};
|
||||
|
||||
const LookupEntry* Lookup(versions::MobVersion mob_version);
|
||||
|
||||
} /*behavior*/
|
||||
|
||||
} /*EQEmu*/
|
||||
|
||||
namespace ClientUnknown
|
||||
{
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
} /*ClientUnknown*/
|
||||
|
||||
namespace Client62
|
||||
{
|
||||
enum : int { Invalid = -1, Null, Safety };
|
||||
|
||||
enum : bool { False = false, True = true };
|
||||
|
||||
} /*Client62*/
|
||||
|
||||
#endif /*COMMON_EQ_LIMITS_H*/
|
||||
@ -260,7 +260,7 @@ bool EQProtocolPacket::combine(const EQProtocolPacket *rhs)
|
||||
{
|
||||
bool result=false;
|
||||
if (opcode==OP_Combined && size+rhs->size+5<256) {
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+3];
|
||||
auto tmpbuffer = new unsigned char[size + rhs->size + 3];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
uint32 offset=size;
|
||||
tmpbuffer[offset++]=rhs->Size();
|
||||
@ -270,7 +270,7 @@ bool result=false;
|
||||
pBuffer=tmpbuffer;
|
||||
result=true;
|
||||
} else if (size+rhs->size+7<256) {
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+6];
|
||||
auto tmpbuffer = new unsigned char[size + rhs->size + 6];
|
||||
uint32 offset=0;
|
||||
tmpbuffer[offset++]=Size();
|
||||
offset+=serialize(tmpbuffer+offset);
|
||||
@ -457,7 +457,7 @@ EQApplicationPacket *EQApplicationPacket::Copy() const {
|
||||
}
|
||||
|
||||
EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const {
|
||||
EQRawApplicationPacket *res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
auto res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
res->copyInfo(this);
|
||||
return(res);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class EQProtocolPacket : public BasePacket {
|
||||
friend class EQStream;
|
||||
friend class EQStreamPair;
|
||||
public:
|
||||
EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf,len), opcode(op) { acked = false; }
|
||||
EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len) : BasePacket(buf, len), opcode(op) { acked = false; sent_time = 0; }
|
||||
// EQProtocolPacket(const unsigned char *buf, uint32 len);
|
||||
bool combine(const EQProtocolPacket *rhs);
|
||||
uint32 serialize (unsigned char *dest) const;
|
||||
@ -70,6 +70,7 @@ public:
|
||||
EQRawApplicationPacket *MakeAppPacket() const;
|
||||
|
||||
bool acked;
|
||||
uint32 sent_time;
|
||||
|
||||
virtual void build_raw_header_dump(char *buffer, uint16 seq=0xffff) const;
|
||||
virtual void build_header_dump(char *buffer) const;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
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
|
||||
@ -25,16 +25,17 @@
|
||||
#include <list>
|
||||
#include <time.h>
|
||||
#include "../common/version.h"
|
||||
//#include "../common/item_struct.h"
|
||||
#include "emu_constants.h"
|
||||
#include "textures.h"
|
||||
|
||||
|
||||
static const uint32 BUFF_COUNT = 25;
|
||||
static const uint32 PET_BUFF_COUNT = 30;
|
||||
static const uint32 MAX_MERC = 100;
|
||||
static const uint32 MAX_MERC_GRADES = 10;
|
||||
static const uint32 MAX_MERC_STANCES = 10;
|
||||
static const uint32 BLOCKED_BUFF_COUNT = 20;
|
||||
|
||||
//#include "eq_constants.h"
|
||||
#include "eq_dictionary.h"
|
||||
|
||||
/*
|
||||
** Compiler override to ensure
|
||||
@ -126,37 +127,7 @@ struct LDoNTrapTemplate
|
||||
|
||||
// All clients translate the character select information to some degree
|
||||
|
||||
struct Color_Struct
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
uint8 Blue;
|
||||
uint8 Green;
|
||||
uint8 Red;
|
||||
uint8 UseTint; // if there's a tint this is FF
|
||||
} RGB;
|
||||
uint32 Color;
|
||||
};
|
||||
};
|
||||
|
||||
struct EquipStruct
|
||||
{
|
||||
uint32 Material;
|
||||
uint32 Unknown1;
|
||||
uint32 EliteMaterial;
|
||||
uint32 HeroForgeModel;
|
||||
uint32 Material2; // Same as material?
|
||||
};
|
||||
|
||||
struct CharSelectEquip
|
||||
{
|
||||
uint32 Material;
|
||||
uint32 Unknown1;
|
||||
uint32 EliteMaterial;
|
||||
uint32 HeroForgeModel;
|
||||
uint32 Material2;
|
||||
Color_Struct Color;
|
||||
};
|
||||
struct CharSelectEquip : EQEmu::textures::Texture_Struct, EQEmu::textures::Tint_Struct {};
|
||||
|
||||
// RoF2-based hybrid struct
|
||||
struct CharacterSelectEntry_Struct
|
||||
@ -171,7 +142,7 @@ struct CharacterSelectEntry_Struct
|
||||
uint16 Instance;
|
||||
uint8 Gender;
|
||||
uint8 Face;
|
||||
CharSelectEquip Equip[9];
|
||||
CharSelectEquip Equip[EQEmu::textures::materialCount];
|
||||
uint8 Unknown15; // Seen FF
|
||||
uint8 Unknown19; // Seen FF
|
||||
uint32 DrakkinTattoo;
|
||||
@ -280,22 +251,7 @@ struct Spawn_Struct {
|
||||
/*0189*/ uint32 petOwnerId; // If this is a pet, the spawn id of owner
|
||||
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
|
||||
/*0194*/ uint8 unknown0194[3];
|
||||
/*0197*/ union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/*0000*/ EquipStruct equip_helmet; // Equipment: Helmet visual
|
||||
/*0000*/ EquipStruct equip_chest; // Equipment: Chest visual
|
||||
/*0000*/ EquipStruct equip_arms; // Equipment: Arms visual
|
||||
/*0000*/ EquipStruct equip_bracers; // Equipment: Wrist visual
|
||||
/*0000*/ EquipStruct equip_hands; // Equipment: Hands visual
|
||||
/*0000*/ EquipStruct equip_legs; // Equipment: Legs visual
|
||||
/*0000*/ EquipStruct equip_feet; // Equipment: Boots visual
|
||||
/*0000*/ EquipStruct equip_primary; // Equipment: Main visual
|
||||
/*0000*/ EquipStruct equip_secondary; // Equipment: Off visual
|
||||
} equip;
|
||||
/*0000*/ EquipStruct equipment[_MaterialCount];
|
||||
};
|
||||
/*0197*/ EQEmu::TextureProfile equipment;
|
||||
/*0233*/ float runspeed; // Speed when running
|
||||
/*0036*/ uint8 afk; // 0=no, 1=afk
|
||||
/*0238*/ uint32 guildID; // Current guild
|
||||
@ -326,22 +282,7 @@ union
|
||||
/*0340*/ uint32 spawnId; // Spawn Id
|
||||
/*0344*/ uint8 unknown0344[3];
|
||||
/*0347*/ uint8 IsMercenary;
|
||||
/*0348*/ union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/*0348*/ Color_Struct color_helmet; // Color of helmet item
|
||||
/*0352*/ Color_Struct color_chest; // Color of chest item
|
||||
/*0356*/ Color_Struct color_arms; // Color of arms item
|
||||
/*0360*/ Color_Struct color_bracers; // Color of bracers item
|
||||
/*0364*/ Color_Struct color_hands; // Color of hands item
|
||||
/*0368*/ Color_Struct color_legs; // Color of legs item
|
||||
/*0372*/ Color_Struct color_feet; // Color of feet item
|
||||
/*0376*/ Color_Struct color_primary; // Color of primary item
|
||||
/*0380*/ Color_Struct color_secondary; // Color of secondary item
|
||||
} equipment_colors;
|
||||
/*0348*/ Color_Struct colors[_MaterialCount]; // Array elements correspond to struct equipment_colors above
|
||||
};
|
||||
/*0348*/ EQEmu::TintProfile equipment_tint;
|
||||
/*0384*/ uint8 lfg; // 0=off, 1=lfg on
|
||||
/*0385*/
|
||||
|
||||
@ -446,7 +387,19 @@ struct MemorizeSpell_Struct {
|
||||
uint32 slot; // Spot in the spell book/memorized slot
|
||||
uint32 spell_id; // Spell id (200 or c8 is minor healing, etc)
|
||||
uint32 scribing; // 1 if memorizing a spell, set to 0 if scribing to book, 2 if un-memming
|
||||
uint32 unknown12;
|
||||
uint32 reduction; // lower reuse
|
||||
};
|
||||
|
||||
/*
|
||||
** Linked Spell Reuse Timer
|
||||
** Length: 12
|
||||
** Comes before the OP_Memorize
|
||||
** Live (maybe TDS steam) has an extra DWORD after timer_id
|
||||
*/
|
||||
struct LinkedSpellReuseTimer_Struct {
|
||||
uint32 timer_id; // Timer ID of the spell
|
||||
uint32 end_time; // timestamp of when it will be ready
|
||||
uint32 start_time; // timestamp of when it started
|
||||
};
|
||||
|
||||
/*
|
||||
@ -479,10 +432,11 @@ struct DeleteSpell_Struct
|
||||
|
||||
struct ManaChange_Struct
|
||||
{
|
||||
uint32 new_mana; // New Mana AMount
|
||||
uint32 stamina;
|
||||
uint32 spell_id;
|
||||
uint32 unknown12;
|
||||
/*00*/ uint32 new_mana; // New Mana AMount
|
||||
/*04*/ uint32 stamina;
|
||||
/*08*/ uint32 spell_id;
|
||||
/*12*/ uint8 keepcasting; // won't stop the cast. Change mana while casting?
|
||||
/*13*/ uint8 padding[3]; // client doesn't read it, garbage data seems like
|
||||
};
|
||||
|
||||
struct SwapSpell_Struct
|
||||
@ -548,30 +502,28 @@ struct SpawnAppearance_Struct
|
||||
// this is used inside profile
|
||||
struct SpellBuff_Struct
|
||||
{
|
||||
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
|
||||
/*001*/ uint8 level;
|
||||
/*000*/ uint8 effect_type; // 0 = no buff, 2 = buff, 4 = inverse affects of buff
|
||||
/*001*/ uint8 level;
|
||||
/*002*/ uint8 bard_modifier;
|
||||
/*003*/ uint8 effect; //not real
|
||||
/*003*/ uint8 unknown003; // MQ2 used to call this "damage shield" -- don't see client referencing it, so maybe server side DS type tracking? -- OSX client calls this "activated"
|
||||
/*004*/ uint32 spellid;
|
||||
/*008*/ int32 duration;
|
||||
/*012*/ uint32 counters;
|
||||
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
|
||||
/*020*/
|
||||
/*008*/ int32 duration;
|
||||
/*012*/ uint32 counters; // single book keeping value (counters, rune/vie)
|
||||
/*016*/ uint32 player_id; // caster ID, pretty sure just zone ID
|
||||
// extra stuff for newer packets
|
||||
/*020*/ uint32 num_hits;
|
||||
/*024*/ float y; // referenced by SPA 441
|
||||
/*028*/ float x; // unsure if all buffs get them
|
||||
/*032*/ float z; // as valid data
|
||||
/*036*/
|
||||
};
|
||||
|
||||
struct SpellBuffFade_Struct {
|
||||
struct SpellBuffPacket_Struct {
|
||||
/*000*/ uint32 entityid;
|
||||
/*004*/ uint8 slot;
|
||||
/*005*/ uint8 level;
|
||||
/*006*/ uint8 effect;
|
||||
/*007*/ uint8 unknown7;
|
||||
/*008*/ uint32 spellid;
|
||||
/*012*/ int32 duration;
|
||||
/*016*/ uint32 num_hits;
|
||||
/*020*/ uint32 unknown020; //prolly global player ID
|
||||
/*024*/ uint32 slotid;
|
||||
/*028*/ uint32 bufffade;
|
||||
/*032*/
|
||||
/*004*/ SpellBuff_Struct buff;
|
||||
/*040*/ uint32 slotid;
|
||||
/*044*/ uint32 bufffade;
|
||||
/*048*/
|
||||
};
|
||||
|
||||
// Underfoot & later struct.
|
||||
@ -584,8 +536,8 @@ struct BuffRemoveRequest_Struct
|
||||
|
||||
struct PetBuff_Struct {
|
||||
/*000*/ uint32 petid;
|
||||
/*004*/ uint32 spellid[BUFF_COUNT+5];
|
||||
/*124*/ int32 ticsremaining[BUFF_COUNT+5];
|
||||
/*004*/ uint32 spellid[PET_BUFF_COUNT];
|
||||
/*124*/ int32 ticsremaining[PET_BUFF_COUNT];
|
||||
/*244*/ uint32 buffcount;
|
||||
};
|
||||
|
||||
@ -777,7 +729,7 @@ struct BandolierItem_Struct
|
||||
struct Bandolier_Struct
|
||||
{
|
||||
char Name[32];
|
||||
BandolierItem_Struct Items[EmuConstants::BANDOLIER_ITEM_COUNT];
|
||||
BandolierItem_Struct Items[EQEmu::legacy::BANDOLIER_ITEM_COUNT];
|
||||
};
|
||||
|
||||
//len = 72
|
||||
@ -791,7 +743,7 @@ struct PotionBeltItem_Struct
|
||||
//len = 288
|
||||
struct PotionBelt_Struct
|
||||
{
|
||||
PotionBeltItem_Struct Items[EmuConstants::POTION_BELT_ITEM_COUNT];
|
||||
PotionBeltItem_Struct Items[EQEmu::legacy::POTION_BELT_ITEM_COUNT];
|
||||
};
|
||||
|
||||
struct MovePotionToBelt_Struct
|
||||
@ -882,7 +834,7 @@ struct SuspendedMinion_Struct
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*510*/ EQEmu::TextureMaterialProfile Items;
|
||||
/*546*/ char Name[64];
|
||||
/*610*/
|
||||
};
|
||||
@ -896,7 +848,7 @@ struct SuspendedMinion_Struct
|
||||
*/
|
||||
static const uint32 MAX_PP_LANGUAGE = 28;
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
|
||||
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
|
||||
static const uint32 MAX_PP_MEMSPELL = static_cast<uint32>(EQEmu::CastingSlot::MaxGems); // Set to latest client so functions can work right -- 12
|
||||
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
|
||||
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
||||
|
||||
@ -977,7 +929,7 @@ struct PlayerProfile_Struct
|
||||
/*0245*/ uint8 guildbanker;
|
||||
/*0246*/ uint8 unknown0246[6]; //
|
||||
/*0252*/ uint32 intoxication;
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms
|
||||
/*0292*/ uint32 abilitySlotRefresh;
|
||||
/*0296*/ uint8 haircolor; // Player hair color
|
||||
/*0297*/ uint8 beardcolor; // Player beard color
|
||||
@ -990,9 +942,9 @@ struct PlayerProfile_Struct
|
||||
/*0304*/ uint8 ability_time_minutes;
|
||||
/*0305*/ uint8 ability_time_hours; //place holder
|
||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||
/*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items
|
||||
/*0312*/ EQEmu::TextureMaterialProfile item_material; // Item texture/material of worn/held items
|
||||
/*0348*/ uint8 unknown0348[44];
|
||||
/*0392*/ Color_Struct item_tint[_MaterialCount];
|
||||
/*0392*/ EQEmu::TintProfile item_tint;
|
||||
/*0428*/ AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||
/*2352*/ char servername[32]; // length probably not right
|
||||
@ -1018,7 +970,7 @@ struct PlayerProfile_Struct
|
||||
/*2580*/ uint8 unknown2616[4];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL];
|
||||
/*4668*/ uint8 unknown4704[32]; //
|
||||
/*4700*/ float y; // Player y position
|
||||
/*4704*/ float x; // Player x position
|
||||
@ -1093,7 +1045,7 @@ struct PlayerProfile_Struct
|
||||
/*7212*/ uint32 tribute_points;
|
||||
/*7216*/ uint32 unknown7252;
|
||||
/*7220*/ uint32 tribute_active; //1=active
|
||||
/*7224*/ Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
|
||||
/*7224*/ Tribute_Struct tributes[EQEmu::legacy::TRIBUTE_SIZE];
|
||||
/*7264*/ Disciplines_Struct disciplines;
|
||||
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
|
||||
/*7744*/ char unknown7780[160];
|
||||
@ -1120,7 +1072,7 @@ struct PlayerProfile_Struct
|
||||
/*12800*/ uint32 expAA;
|
||||
/*12804*/ uint32 aapoints; //avaliable, unspent
|
||||
/*12808*/ uint8 unknown12844[36];
|
||||
/*12844*/ Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_SIZE];
|
||||
/*12844*/ Bandolier_Struct bandoliers[EQEmu::legacy::BANDOLIERS_SIZE];
|
||||
/*14124*/ uint8 unknown14160[4506];
|
||||
/*18630*/ SuspendedMinion_Struct SuspendedMinion; // No longer in use
|
||||
/*19240*/ uint32 timeentitledonaccount;
|
||||
@ -1227,7 +1179,7 @@ struct WearChange_Struct{
|
||||
/*010*/ uint32 elite_material; // 1 for Drakkin Elite Material
|
||||
/*014*/ uint32 hero_forge_model; // New to VoA
|
||||
/*018*/ uint32 unknown18; // New to RoF
|
||||
/*022*/ Color_Struct color;
|
||||
/*022*/ EQEmu::textures::Tint_Struct color;
|
||||
/*026*/ uint8 wear_slot_id;
|
||||
/*027*/
|
||||
};
|
||||
@ -1518,17 +1470,38 @@ struct ExpUpdate_Struct
|
||||
enum ItemPacketType
|
||||
{
|
||||
ItemPacketViewLink = 0x00,
|
||||
ItemPacketMerchant = 0x64,
|
||||
ItemPacketTradeView = 0x65,
|
||||
ItemPacketLoot = 0x66,
|
||||
ItemPacketTrade = 0x67,
|
||||
ItemPacketCharInventory = 0x69,
|
||||
ItemPacketSummonItem = 0x6A,
|
||||
ItemPacketTributeItem = 0x6C,
|
||||
ItemPacketMerchant = 0x64,
|
||||
ItemPacketLimbo = 0x6A,
|
||||
ItemPacketWorldContainer = 0x6B,
|
||||
ItemPacketCharmUpdate = 0x6E,
|
||||
ItemPacketTributeItem = 0x6C,
|
||||
ItemPacketGuildTribute = 0x6D,
|
||||
ItemPacketCharmUpdate = 0x6E, // noted as incorrect
|
||||
ItemPacketInvalid = 0xFF
|
||||
};
|
||||
|
||||
//enum ItemPacketType
|
||||
//{
|
||||
// ItemPacketMerchant = /*100*/ 0x64, // Titanium+
|
||||
// ItemPacketTradeView = /*101*/ 0x65,
|
||||
// ItemPacketLoot = /*102*/ 0x66,
|
||||
// ItemPacketTrade = /*103*/ 0x67,
|
||||
// ItemPacketCharInventory = /*105*/ 0x69, // 105 looks like raw item packet (no appearance update) thru shared bank..110, possibly possessions with appearance update
|
||||
// ItemPacketLimbo = /*106*/ 0x6A,
|
||||
// ItemPacketWorldContainer = /*107*/ 0x6B,
|
||||
// ItemPacketTributeItem = /*108*/ 0x6C,
|
||||
// ItemPacketGuildTribute = /*109*/ 0x6D, // missing from EQEmu
|
||||
// ItemPacket10 = /*110*/ 0x6E,
|
||||
// ItemPacket11 = /*111*/ 0x6F, // UF+ (equipment slots only) (RoF+ checks '(WORD*)slot + 4 != -1' [(WORD*)]slot + 2 would be bag index - if used) (guess) (appearance (over-level) items?)
|
||||
// ItemPacket12 = /*112*/ 0x70, // RoF+ (causes stat update) (could be TrophyTribute and GuildTrophyTribute together - two case methodology - is it checking for GuildID?)
|
||||
// ItemPacketMerchantRecovery = /*113*/ 0x71,
|
||||
// ItemPacket14 = /*115*/ 0x73, (real estate/moving crate?)
|
||||
// ItemPacket__ = /*xxx*/ 0xXX // switch 'default' - all clients
|
||||
//};
|
||||
|
||||
struct ItemPacket_Struct
|
||||
{
|
||||
/*00*/ ItemPacketType PacketType;
|
||||
@ -1670,7 +1643,7 @@ struct LootingItem_Struct {
|
||||
/*002*/ uint32 looter;
|
||||
/*004*/ uint16 slot_id;
|
||||
/*006*/ uint8 unknown3[2];
|
||||
/*008*/ uint32 auto_loot;
|
||||
/*008*/ int32 auto_loot;
|
||||
};
|
||||
|
||||
struct GuildManageStatus_Struct{
|
||||
@ -1961,8 +1934,7 @@ struct Merchant_Sell_Struct {
|
||||
/*004*/ uint32 playerid; // Player's entity id
|
||||
/*008*/ uint32 itemslot;
|
||||
uint32 unknown12;
|
||||
/*016*/ uint8 quantity; // Already sold
|
||||
/*017*/ uint8 Unknown016[3];
|
||||
/*016*/ uint32 quantity;
|
||||
/*020*/ uint32 price;
|
||||
};
|
||||
struct Merchant_Purchase_Struct {
|
||||
@ -2099,7 +2071,7 @@ struct AdventureLeaderboard_Struct
|
||||
/*struct Item_Shop_Struct {
|
||||
uint16 merchantid;
|
||||
uint8 itemtype;
|
||||
Item_Struct item;
|
||||
EQEmu::ItemData item;
|
||||
uint8 iss_unknown001[6];
|
||||
};*/
|
||||
|
||||
@ -2125,7 +2097,7 @@ struct Illusion_Struct { //size: 256 - SoF
|
||||
/*092*/ uint32 drakkin_heritage; //
|
||||
/*096*/ uint32 drakkin_tattoo; //
|
||||
/*100*/ uint32 drakkin_details; //
|
||||
/*104*/ uint32 armor_tint[_MaterialCount]; //
|
||||
/*104*/ EQEmu::TintProfile armor_tint; //
|
||||
/*140*/ uint8 eyecolor1; // Field Not Identified in any Illusion Struct
|
||||
/*141*/ uint8 eyecolor2; // Field Not Identified in any Illusion Struct
|
||||
/*142*/ uint8 unknown138[114]; //
|
||||
@ -2271,6 +2243,7 @@ struct GroupFollow_Struct { // SoF Follow Struct
|
||||
/*0132*/
|
||||
};
|
||||
|
||||
// this is generic struct
|
||||
struct GroupLeaderChange_Struct
|
||||
{
|
||||
/*000*/ char Unknown000[64];
|
||||
@ -2523,6 +2496,7 @@ struct BookRequest_Struct {
|
||||
uint8 window; // where to display the text (0xFF means new window)
|
||||
uint8 type; //type: 0=scroll, 1=book, 2=item info.. prolly others.
|
||||
uint32 invslot; // Only used in Sof and later clients;
|
||||
int16 subslot; // The subslot inside of a bag if it is inside one.
|
||||
char txtfile[20];
|
||||
};
|
||||
|
||||
@ -2536,23 +2510,25 @@ struct BookRequest_Struct {
|
||||
*/
|
||||
struct Object_Struct {
|
||||
/*00*/ uint32 linked_list_addr[2];// They are, get this, prev and next, ala linked list
|
||||
/*08*/ uint16 size; //
|
||||
/*08*/ float size; //
|
||||
/*10*/ uint16 solidtype; //
|
||||
/*12*/ uint32 drop_id; // Unique object id for zone
|
||||
/*16*/ uint16 zone_id; // Redudant, but: Zone the object appears in
|
||||
/*18*/ uint16 zone_instance; //
|
||||
/*20*/ uint32 unknown020; //
|
||||
/*24*/ uint32 unknown024; //
|
||||
/*28*/ float heading; // heading
|
||||
/*32*/ float z; // z coord
|
||||
/*36*/ float x; // x coord
|
||||
/*40*/ float y; // y coord
|
||||
/*44*/ char object_name[32]; // Name of object, usually something like IT63_ACTORDEF
|
||||
/*76*/ uint32 unknown076; //
|
||||
/*80*/ uint32 object_type; // Type of object, not directly translated to OP_OpenObject
|
||||
/*84*/ uint32 unknown084; //set to 0xFF
|
||||
/*88*/ uint32 spawn_id; // Spawn Id of client interacting with object
|
||||
/*92*/
|
||||
/*28*/ float tilt_x;
|
||||
/*32*/ float tilt_y;
|
||||
/*36*/ float heading; // heading
|
||||
/*40*/ float z; // z coord
|
||||
/*44*/ float x; // x coord
|
||||
/*76*/ float y; // y coord
|
||||
/*80*/ char object_name[32]; // Name of object, usually something like IT63_ACTORDEF
|
||||
/*84*/ uint32 unknown076; //
|
||||
/*88*/ uint32 object_type; // Type of object, not directly translated to OP_OpenObject
|
||||
/*92*/ uint32 unknown084; //set to 0xFF
|
||||
uint32 spawn_id; // Spawn Id of client interacting with object
|
||||
|
||||
};
|
||||
// 01 = generic drop, 02 = armor, 19 = weapon
|
||||
//[13:40] and 0xff seems to be indicative of the tradeskill/openable items that end up returning the old style item type in the OP_OpenObject
|
||||
@ -3395,27 +3371,6 @@ struct PetitionBug_Struct{
|
||||
char text[1028];
|
||||
};
|
||||
|
||||
struct DyeStruct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct Color_Struct head;
|
||||
struct Color_Struct chest;
|
||||
struct Color_Struct arms;
|
||||
struct Color_Struct wrists;
|
||||
struct Color_Struct hands;
|
||||
struct Color_Struct legs;
|
||||
struct Color_Struct feet;
|
||||
struct Color_Struct primary; // you can't actually dye this
|
||||
struct Color_Struct secondary; // or this
|
||||
}
|
||||
dyes;
|
||||
struct Color_Struct dye[_MaterialCount];
|
||||
};
|
||||
};
|
||||
|
||||
struct ApproveZone_Struct {
|
||||
char name[64];
|
||||
uint32 zoneid;
|
||||
@ -3473,8 +3428,8 @@ struct SelectTributeReply_Struct {
|
||||
|
||||
struct TributeInfo_Struct {
|
||||
uint32 active; //0 == inactive, 1 == active
|
||||
uint32 tributes[EmuConstants::TRIBUTE_SIZE]; //-1 == NONE
|
||||
uint32 tiers[EmuConstants::TRIBUTE_SIZE]; //all 00's
|
||||
uint32 tributes[EQEmu::legacy::TRIBUTE_SIZE]; //-1 == NONE
|
||||
uint32 tiers[EQEmu::legacy::TRIBUTE_SIZE]; //all 00's
|
||||
uint32 tribute_master_id;
|
||||
};
|
||||
|
||||
@ -3564,6 +3519,20 @@ struct RecipeAutoCombine_Struct {
|
||||
// f5 ff ff ff in 'you dont have all the stuff' reply
|
||||
};
|
||||
|
||||
// this is the "value#a" data
|
||||
enum EParticlePoint {
|
||||
eDefault,
|
||||
eChest,
|
||||
eHead,
|
||||
eLeftHand,
|
||||
eRigthHand,
|
||||
eLeftFoot,
|
||||
eRightFood,
|
||||
eLeftEye,
|
||||
eRightEye,
|
||||
eMouth
|
||||
};
|
||||
|
||||
struct LevelAppearance_Struct { //Sends a little graphic on level up
|
||||
uint32 spawn_id;
|
||||
uint32 parm1;
|
||||
@ -4796,6 +4765,7 @@ struct BuffIcon_Struct
|
||||
uint8 all_buffs;
|
||||
uint16 count;
|
||||
uint8 type; // 0 = self buff window, 1 = self target window, 4 = group, 5 = PC, 7 = NPC
|
||||
int32 tic_timer;
|
||||
BuffIconEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
@ -5342,21 +5312,18 @@ struct ClientMarqueeMessage_Struct {
|
||||
|
||||
typedef std::list<ServerLootItem_Struct*> ItemList;
|
||||
|
||||
struct TextLinkBody_Struct {
|
||||
// Current server mask: EQClientRoF2
|
||||
uint8 unknown_1; /* %1X */
|
||||
uint32 item_id; /* %05X */
|
||||
uint32 augment_1; /* %05X */
|
||||
uint32 augment_2; /* %05X */
|
||||
uint32 augment_3; /* %05X */
|
||||
uint32 augment_4; /* %05X */
|
||||
uint32 augment_5; /* %05X */
|
||||
uint32 augment_6; /* %05X */
|
||||
uint8 is_evolving; /* %1X */
|
||||
uint32 evolve_group; /* %05X */
|
||||
uint8 evolve_level; /* %02X */
|
||||
uint32 ornament_icon; /* %05X */
|
||||
int hash; /* %08X */
|
||||
|
||||
struct fling_struct {
|
||||
/* 00 */ uint32 collision; // 0 collision is off, anything else it's on
|
||||
/* 04 */ int32 travel_time; // ms -- UF we need to calc this, RoF+ -1 auto calcs
|
||||
/* 08 */ uint8 unk3; // bool, set to 1 has something to do with z-axis or something weird things happen if the new Z is above or equal to yours
|
||||
/* 09 */ uint8 disable_fall_damage; // 1 you take no fall damage, 0 you take fall damage
|
||||
/* 10 */ uint8 padding[2];
|
||||
/* 12 */ float speed_z;
|
||||
/* 16 */ float new_y;
|
||||
/* 20 */ float new_x;
|
||||
/* 24 */ float new_z;
|
||||
/* 28 */
|
||||
};
|
||||
|
||||
// Restore structure packing to default
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -153,7 +153,6 @@ class EQStream : public EQStreamInterface {
|
||||
std::deque<EQProtocolPacket *> SequencedQueue;
|
||||
uint16 NextOutSeq;
|
||||
uint16 SequencedBase; //the sequence number of SequencedQueue[0]
|
||||
long NextSequencedSend; //index into SequencedQueue
|
||||
Mutex MOutboundQueue;
|
||||
|
||||
//a buffer we use for compression/decompression
|
||||
@ -174,7 +173,7 @@ class EQStream : public EQStreamInterface {
|
||||
Mutex MRate;
|
||||
int32 RateThreshold;
|
||||
int32 DecayRate;
|
||||
|
||||
uint32 AverageDelta;
|
||||
|
||||
OpcodeManager **OpMgr;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "eq_stream_factory.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock.h>
|
||||
#include <winsock2.h>
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
@ -23,18 +23,10 @@
|
||||
|
||||
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
fs->ReaderLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
}
|
||||
|
||||
@ -42,16 +34,8 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
fs->WriterLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
}
|
||||
|
||||
@ -120,7 +104,7 @@ std::shared_ptr<EQStream> EQStreamFactory::Pop()
|
||||
{
|
||||
std::shared_ptr<EQStream> s = nullptr;
|
||||
MNewStreams.lock();
|
||||
if (NewStreams.size()) {
|
||||
if (!NewStreams.empty()) {
|
||||
s = NewStreams.front();
|
||||
NewStreams.pop();
|
||||
s->PutInUse();
|
||||
@ -235,7 +219,7 @@ void EQStreamFactory::CheckTimeout()
|
||||
//give it a little time for everybody to finish with it
|
||||
} else {
|
||||
//everybody is done, we can delete it now
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator temp = stream_itr;
|
||||
auto temp = stream_itr;
|
||||
++stream_itr;
|
||||
temp->second = nullptr;
|
||||
Streams.erase(temp);
|
||||
@ -250,8 +234,7 @@ void EQStreamFactory::CheckTimeout()
|
||||
|
||||
void EQStreamFactory::WriterLoop()
|
||||
{
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
bool havework=true;
|
||||
bool havework = true;
|
||||
std::vector<std::shared_ptr<EQStream>> wants_write;
|
||||
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
|
||||
bool decay = false;
|
||||
@ -260,7 +243,7 @@ void EQStreamFactory::WriterLoop()
|
||||
WriterRunning = true;
|
||||
DecayTimer.Enable();
|
||||
|
||||
while(sock!=-1) {
|
||||
while (sock != -1) {
|
||||
MWriterRunning.lock();
|
||||
if (!WriterRunning)
|
||||
break;
|
||||
@ -269,34 +252,36 @@ void EQStreamFactory::WriterLoop()
|
||||
havework = false;
|
||||
wants_write.clear();
|
||||
|
||||
decay=DecayTimer.Check();
|
||||
decay = DecayTimer.Check();
|
||||
|
||||
//copy streams into a seperate list so we dont have to keep
|
||||
//MStreams locked while we are writting
|
||||
// copy streams into a seperate list so we dont have to keep
|
||||
// MStreams locked while we are writting
|
||||
MStreams.lock();
|
||||
for(stream_itr=Streams.begin();stream_itr!=Streams.end();++stream_itr) {
|
||||
for (auto stream_itr = Streams.begin(); stream_itr != Streams.end(); ++stream_itr) {
|
||||
// If it's time to decay the bytes sent, then let's do it before we try to write
|
||||
if (decay)
|
||||
stream_itr->second->Decay();
|
||||
|
||||
//bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||
if(stream_itr->second == nullptr) {
|
||||
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i", stream_itr->first.first, stream_itr->first.second);
|
||||
// bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||
if (stream_itr->second == nullptr) {
|
||||
fprintf(stderr,
|
||||
"ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i",
|
||||
stream_itr->first.first, stream_itr->first.second);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stream_itr->second->HasOutgoingData()) {
|
||||
havework=true;
|
||||
havework = true;
|
||||
stream_itr->second->PutInUse();
|
||||
wants_write.push_back(stream_itr->second);
|
||||
}
|
||||
}
|
||||
MStreams.unlock();
|
||||
|
||||
//do the actual writes
|
||||
// do the actual writes
|
||||
cur = wants_write.begin();
|
||||
end = wants_write.end();
|
||||
for(; cur != end; ++cur) {
|
||||
for (; cur != end; ++cur) {
|
||||
(*cur)->Write(sock);
|
||||
(*cur)->ReleaseFromUse();
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#include <utility>
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eq_stream_ident.h"
|
||||
@ -25,7 +27,7 @@ EQStreamIdentifier::~EQStreamIdentifier() {
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const char *name, OpcodeManager ** opcodes, const StructStrategy *structs) {
|
||||
Patch *p = new Patch;
|
||||
auto p = new Patch;
|
||||
p->signature = sig;
|
||||
p->name = name;
|
||||
p->opcodes = opcodes;
|
||||
@ -45,7 +47,7 @@ void EQStreamIdentifier::Process() {
|
||||
//first see if this stream has expired
|
||||
if(r.expire.Check(false)) {
|
||||
//this stream has failed to match any pattern in our timeframe.
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->ReleaseFromUse();
|
||||
cur = m_streams.erase(cur);
|
||||
continue;
|
||||
@ -60,23 +62,23 @@ void EQStreamIdentifier::Process() {
|
||||
}
|
||||
if(r.stream->GetState() != ESTABLISHED) {
|
||||
//the stream closed before it was identified.
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
switch(r.stream->GetState())
|
||||
{
|
||||
case ESTABLISHED:
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
||||
break;
|
||||
case CLOSING:
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
||||
break;
|
||||
case DISCONNECTING:
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
||||
break;
|
||||
case CLOSED:
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
||||
break;
|
||||
default:
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
||||
break;
|
||||
}
|
||||
r.stream->ReleaseFromUse();
|
||||
@ -106,7 +108,7 @@ void EQStreamIdentifier::Process() {
|
||||
case EQStream::MatchSuccessful: {
|
||||
//yay, a match.
|
||||
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
|
||||
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
|
||||
r.stream->SetActive(true);
|
||||
@ -120,7 +122,7 @@ void EQStreamIdentifier::Process() {
|
||||
}
|
||||
case EQStream::MatchFailed:
|
||||
//do nothing...
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
Log(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -128,7 +130,7 @@ void EQStreamIdentifier::Process() {
|
||||
//if we checked all patches and did not find a match.
|
||||
if(all_ready && !found_one) {
|
||||
//the stream cannot be identified.
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
Log(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->ReleaseFromUse();
|
||||
}
|
||||
|
||||
@ -156,7 +158,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
|
||||
}
|
||||
|
||||
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
|
||||
: stream(s),
|
||||
: stream(std::move(s)),
|
||||
expire(STREAM_IDENT_WAIT_MS)
|
||||
{
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
//this is the only part of an EQStream that is seen by the application.
|
||||
|
||||
#include <string>
|
||||
#include "clientversions.h"
|
||||
#include "emu_versions.h"
|
||||
|
||||
typedef enum {
|
||||
ESTABLISHED,
|
||||
@ -35,7 +35,7 @@ public:
|
||||
virtual const uint32 GetBytesRecieved() const { return 0; }
|
||||
virtual const uint32 GetBytesSentPerSecond() const { return 0; }
|
||||
virtual const uint32 GetBytesRecvPerSecond() const { return 0; }
|
||||
virtual const ClientVersion GetClientVersion() const { return ClientVersion::Unknown; }
|
||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const { return EQEmu::versions::ClientVersion::Unknown; }
|
||||
};
|
||||
|
||||
#endif /*EQSTREAMINTF_H_*/
|
||||
|
||||
@ -21,9 +21,9 @@ std::string EQStreamProxy::Describe() const {
|
||||
return(m_structs->Describe());
|
||||
}
|
||||
|
||||
const ClientVersion EQStreamProxy::GetClientVersion() const
|
||||
const EQEmu::versions::ClientVersion EQStreamProxy::ClientVersion() const
|
||||
{
|
||||
return m_structs->GetClientVersion();
|
||||
return m_structs->ClientVersion();
|
||||
}
|
||||
|
||||
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
virtual void RemoveData();
|
||||
virtual bool CheckState(EQStreamState state);
|
||||
virtual std::string Describe() const;
|
||||
virtual const ClientVersion GetClientVersion() const;
|
||||
virtual const EQEmu::versions::ClientVersion ClientVersion() const;
|
||||
|
||||
virtual const uint32 GetBytesSent() const;
|
||||
virtual const uint32 GetBytesRecieved() const;
|
||||
|
||||
@ -63,7 +63,7 @@ EQDBRes * EQDB::query(Const_char *q) {
|
||||
//NOT THREAD SAFE!
|
||||
Const_char *EQDB::escape_string(Const_char *from) {
|
||||
int len = strlen(from);
|
||||
char *res = new char[len*2+1];
|
||||
auto res = new char[len * 2 + 1];
|
||||
|
||||
mysql_real_escape_string(mysql_ref,res,from,len);
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ void EQEmuConfig::do_world(TiXmlElement *ele)
|
||||
sprintf(str, "loginserver%i", ++LoginCount);
|
||||
sub_ele = ele->FirstChildElement(str);
|
||||
if (sub_ele) {
|
||||
LoginConfig* loginconfig = new LoginConfig;
|
||||
auto loginconfig = new LoginConfig;
|
||||
text = ParseTextBlock(sub_ele, "host", true);
|
||||
if (text) {
|
||||
loginconfig->LoginHost = text;
|
||||
@ -254,6 +254,10 @@ void EQEmuConfig::do_files(TiXmlElement *ele)
|
||||
if (text) {
|
||||
OpCodesFile = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "plugin.pl", true);
|
||||
if (text) {
|
||||
PluginPlFile = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||
@ -262,14 +266,45 @@ void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||
text = ParseTextBlock(ele, "maps", true);
|
||||
if (text) {
|
||||
MapDir = text;
|
||||
if ( MapDir.back() != '/' )
|
||||
MapDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "quests", true);
|
||||
if (text) {
|
||||
QuestDir = text;
|
||||
if ( QuestDir.back() != '/' )
|
||||
QuestDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "plugins", true);
|
||||
if (text) {
|
||||
PluginDir = text;
|
||||
if ( PluginDir.back() != '/' )
|
||||
PluginDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "lua_modules", true);
|
||||
if (text) {
|
||||
LuaModuleDir = text;
|
||||
if ( LuaModuleDir.back() != '/' )
|
||||
LuaModuleDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "patches", true);
|
||||
if (text) {
|
||||
PatchDir = text;
|
||||
if ( PatchDir.back() != '/' )
|
||||
PatchDir += '/';
|
||||
}
|
||||
text = ParseTextBlock(ele, "shared_memory", true);
|
||||
if (text) {
|
||||
SharedMemDir = text;
|
||||
if ( SharedMemDir.back() != '/' )
|
||||
SharedMemDir += '/';
|
||||
}
|
||||
//Not Fully Implemented yet LogDir
|
||||
text = ParseTextBlock(ele, "logs", true);
|
||||
if (text) {
|
||||
LogDir = text;
|
||||
if ( LogDir.back() != '/' )
|
||||
LogDir += '/';
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,6 +439,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
if (var_name == "OpCodesFile") {
|
||||
return (OpCodesFile);
|
||||
}
|
||||
if (var_name == "PluginPlFile") {
|
||||
return (PluginPlFile);
|
||||
}
|
||||
if (var_name == "MapDir") {
|
||||
return (MapDir);
|
||||
}
|
||||
@ -413,6 +451,18 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
if (var_name == "PluginDir") {
|
||||
return (PluginDir);
|
||||
}
|
||||
if (var_name == "LuaModuleDir") {
|
||||
return (LuaModuleDir);
|
||||
}
|
||||
if (var_name == "PatchDir") {
|
||||
return (PatchDir);
|
||||
}
|
||||
if (var_name == "SharedMemDir") {
|
||||
return (SharedMemDir);
|
||||
}
|
||||
if (var_name == "LogDir") {
|
||||
return (LogDir);
|
||||
}
|
||||
if (var_name == "LogPrefix") {
|
||||
return (LogPrefix);
|
||||
}
|
||||
@ -468,9 +518,14 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
|
||||
std::cout << "SpellsFile = " << SpellsFile << std::endl;
|
||||
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
|
||||
std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
|
||||
std::cout << "MapDir = " << MapDir << std::endl;
|
||||
std::cout << "QuestDir = " << QuestDir << std::endl;
|
||||
std::cout << "PluginDir = " << PluginDir << std::endl;
|
||||
std::cout << "LuaModuleDir = " << LuaModuleDir << std::endl;
|
||||
std::cout << "PatchDir = " << PatchDir << std::endl;
|
||||
std::cout << "SharedMemDir = " << SharedMemDir << std::endl;
|
||||
std::cout << "LogDir = " << LogDir << std::endl;
|
||||
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
|
||||
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
|
||||
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
||||
|
||||
@ -79,11 +79,16 @@ class EQEmuConfig : public XMLParser
|
||||
// From <files/>
|
||||
std::string SpellsFile;
|
||||
std::string OpCodesFile;
|
||||
std::string PluginPlFile;
|
||||
|
||||
// From <directories/>
|
||||
std::string MapDir;
|
||||
std::string QuestDir;
|
||||
std::string PluginDir;
|
||||
std::string LuaModuleDir;
|
||||
std::string PatchDir;
|
||||
std::string SharedMemDir;
|
||||
std::string LogDir;
|
||||
|
||||
// From <launcher/>
|
||||
std::string LogPrefix;
|
||||
@ -153,10 +158,16 @@ class EQEmuConfig : public XMLParser
|
||||
// Files
|
||||
SpellsFile = "spells_us.txt";
|
||||
OpCodesFile = "opcodes.conf";
|
||||
PluginPlFile = "plugin.pl";
|
||||
// Dirs
|
||||
MapDir = "Maps";
|
||||
QuestDir = "quests";
|
||||
PluginDir = "plugins";
|
||||
MapDir = "Maps/";
|
||||
QuestDir = "quests/";
|
||||
PluginDir = "plugins/";
|
||||
LuaModuleDir = "lua_modules/";
|
||||
PatchDir = "./";
|
||||
SharedMemDir = "shared/";
|
||||
LogDir = "logs/";
|
||||
|
||||
// Launcher
|
||||
LogPrefix = "logs/zone-";
|
||||
LogSuffix = ".log";
|
||||
|
||||
@ -123,26 +123,21 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
std::string category_string;
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
||||
std::string ret;
|
||||
ret.push_back('[');
|
||||
ret.append(Logs::LogCategoryName[log_category]);
|
||||
ret.push_back(']');
|
||||
ret.push_back(' ');
|
||||
ret.append(in_message);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_gmsay == 0)
|
||||
return;
|
||||
|
||||
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
||||
if (log_category == Logs::LogCategory::Netcode)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level)
|
||||
return;
|
||||
|
||||
/* Check to see if the process that actually ran this is zone */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
on_log_gmsay_hook(log_category, message);
|
||||
@ -160,14 +155,6 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const
|
||||
crash_log.close();
|
||||
}
|
||||
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_file == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_file < debug_level)
|
||||
return;
|
||||
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
|
||||
@ -246,13 +233,6 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_console == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_console < debug_level)
|
||||
return;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HANDLE console_handle;
|
||||
@ -273,12 +253,25 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category,
|
||||
|
||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||
{
|
||||
const bool log_to_console = log_settings[log_category].log_to_console > 0;
|
||||
const bool log_to_file = log_settings[log_category].log_to_file > 0;
|
||||
const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0;
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
|
||||
if (nothing_to_log) return;
|
||||
bool log_to_console = true;
|
||||
if (log_settings[log_category].log_to_console < debug_level) {
|
||||
log_to_console = false;
|
||||
}
|
||||
|
||||
bool log_to_file = true;
|
||||
if (log_settings[log_category].log_to_file < debug_level) {
|
||||
log_to_file = false;
|
||||
}
|
||||
|
||||
bool log_to_gmsay = true;
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level) {
|
||||
log_to_gmsay = false;
|
||||
}
|
||||
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
if (nothing_to_log)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
@ -38,103 +39,110 @@ namespace Logs {
|
||||
NOTE: Only add to the bottom of the enum because that is the type ID assignment
|
||||
*/
|
||||
|
||||
enum LogCategory {
|
||||
None = 0,
|
||||
AA,
|
||||
AI,
|
||||
Aggro,
|
||||
Attack,
|
||||
Client_Server_Packet,
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
Debug,
|
||||
Doors,
|
||||
Error,
|
||||
Guilds,
|
||||
Inventory,
|
||||
Launcher,
|
||||
Netcode,
|
||||
Normal,
|
||||
Object,
|
||||
Pathing,
|
||||
QS_Server,
|
||||
Quests,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Status,
|
||||
TCP_Connection,
|
||||
Tasks,
|
||||
Tradeskills,
|
||||
Trading,
|
||||
Tribute,
|
||||
UCS_Server,
|
||||
WebInterface_Server,
|
||||
World_Server,
|
||||
Zone_Server,
|
||||
MySQLError,
|
||||
MySQLQuery,
|
||||
Mercenaries,
|
||||
QuestDebug,
|
||||
Server_Client_Packet,
|
||||
Client_Server_Packet_Unhandled,
|
||||
Server_Client_Packet_With_Dump,
|
||||
Client_Server_Packet_With_Dump,
|
||||
Login_Server,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
enum LogCategory {
|
||||
None = 0,
|
||||
AA,
|
||||
AI,
|
||||
Aggro,
|
||||
Attack,
|
||||
Client_Server_Packet,
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
Debug,
|
||||
Doors,
|
||||
Error,
|
||||
Guilds,
|
||||
Inventory,
|
||||
Launcher,
|
||||
Netcode,
|
||||
Normal,
|
||||
Object,
|
||||
Pathing,
|
||||
QS_Server,
|
||||
Quests,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Status,
|
||||
TCP_Connection,
|
||||
Tasks,
|
||||
Tradeskills,
|
||||
Trading,
|
||||
Tribute,
|
||||
UCS_Server,
|
||||
WebInterface_Server,
|
||||
World_Server,
|
||||
Zone_Server,
|
||||
MySQLError,
|
||||
MySQLQuery,
|
||||
Mercenaries,
|
||||
QuestDebug,
|
||||
Server_Client_Packet,
|
||||
Client_Server_Packet_Unhandled,
|
||||
Server_Client_Packet_With_Dump,
|
||||
Client_Server_Packet_With_Dump,
|
||||
Login_Server,
|
||||
Client_Login,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
/* If you add to this, make sure you update LogCategory */
|
||||
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"",
|
||||
"AA",
|
||||
"AI",
|
||||
"Aggro",
|
||||
"Attack",
|
||||
"Packet :: Client -> Server",
|
||||
"Combat",
|
||||
"Commands",
|
||||
"Crash",
|
||||
"Debug",
|
||||
"Doors",
|
||||
"Error",
|
||||
"Guilds",
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"Netcode",
|
||||
"Normal",
|
||||
"Object",
|
||||
"Pathing",
|
||||
"QS Server",
|
||||
"Quests",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Status",
|
||||
"TCP Connection",
|
||||
"Tasks",
|
||||
"Tradeskills",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
"UCS Server",
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
"Mercenaries",
|
||||
"Quest Debug",
|
||||
"Packet :: Server -> Client",
|
||||
"Packet :: Client -> Server Unhandled",
|
||||
"Packet :: Server -> Client (Dump)",
|
||||
"Packet :: Client -> Server (Dump)",
|
||||
"Login Server"
|
||||
};
|
||||
/* If you add to this, make sure you update LogCategory */
|
||||
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"",
|
||||
"AA",
|
||||
"AI",
|
||||
"Aggro",
|
||||
"Attack",
|
||||
"Packet :: Client -> Server",
|
||||
"Combat",
|
||||
"Commands",
|
||||
"Crash",
|
||||
"Debug",
|
||||
"Doors",
|
||||
"Error",
|
||||
"Guilds",
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"Netcode",
|
||||
"Normal",
|
||||
"Object",
|
||||
"Pathing",
|
||||
"QS Server",
|
||||
"Quests",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Status",
|
||||
"TCP Connection",
|
||||
"Tasks",
|
||||
"Tradeskills",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
"UCS Server",
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
"Mercenaries",
|
||||
"Quest Debug",
|
||||
"Packet :: Server -> Client",
|
||||
"Packet :: Client -> Server Unhandled",
|
||||
"Packet :: Server -> Client (Dump)",
|
||||
"Packet :: Client -> Server (Dump)",
|
||||
"Login Server",
|
||||
"Client Login"
|
||||
};
|
||||
}
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||
LogSys.Out(debug_level, log_category, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
class EQEmuLogSys {
|
||||
public:
|
||||
EQEmuLogSys();
|
||||
@ -201,6 +209,6 @@ private:
|
||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log.Out */
|
||||
};
|
||||
|
||||
extern EQEmuLogSys Log;
|
||||
extern EQEmuLogSys LogSys;
|
||||
|
||||
#endif
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#define EXTENDED_PROFILE_H
|
||||
|
||||
#include "eq_packet_structs.h"
|
||||
#include "item.h"
|
||||
#include "inventory_profile.h"
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
@ -40,7 +40,7 @@ struct ExtendedProfile_Struct {
|
||||
uint16 old_pet_hp; /* Not Used */
|
||||
uint16 old_pet_mana; /* Not Used */
|
||||
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
|
||||
uint32 pet_items[_MaterialCount]; /* Not Used */
|
||||
EQEmu::TextureMaterialProfile pet_items; /* Not Used */
|
||||
char merc_name[64]; /* Used */
|
||||
|
||||
uint32 aa_effects; /* Used */
|
||||
|
||||
@ -111,9 +111,6 @@ Zone extensions and features
|
||||
//path to where sql logs should be placed
|
||||
#define SQL_LOG_PATH "sql_logs/"
|
||||
|
||||
//New aggro system to reduce overhead.
|
||||
#define REVERSE_AGGRO
|
||||
|
||||
//The highest you can #setskill / #setallskill
|
||||
#define HIGHEST_CAN_SET_SKILL 400
|
||||
|
||||
@ -157,7 +154,7 @@ enum { //timer settings, all in milliseconds
|
||||
AIscanarea_delay = 6000,
|
||||
AIfeignremember_delay = 500,
|
||||
AItarget_check_duration = 500,
|
||||
AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||
// AIClientScanarea_delay = 750, //used in REVERSE_AGGRO
|
||||
AIassistcheck_delay = 3000, //now often a fighting NPC will yell for help
|
||||
AI_check_signal_timer_delay = 500, // How often EVENT_SIGNAL checks are processed
|
||||
ClientProximity_interval = 150,
|
||||
@ -213,8 +210,8 @@ enum { //some random constants
|
||||
#define MAX_NPC_FACTIONS 20
|
||||
|
||||
//individual faction pool
|
||||
#define MAX_PERSONAL_FACTION 1200
|
||||
#define MIN_PERSONAL_FACTION -3000
|
||||
#define MAX_PERSONAL_FACTION 2000
|
||||
#define MIN_PERSONAL_FACTION -2000
|
||||
|
||||
//The Level Cap:
|
||||
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
|
||||
@ -235,6 +232,9 @@ enum { //some random constants
|
||||
|
||||
#define ZONE_CONTROLLER_NPC_ID 10
|
||||
|
||||
// Timer to update aggrometer
|
||||
#define AGGRO_METER_UPDATE_MS 1000
|
||||
|
||||
//Some hard coded statuses from commands and other places:
|
||||
enum {
|
||||
minStatusToBeGM = 40,
|
||||
|
||||
@ -1,6 +1,39 @@
|
||||
The MIT License
|
||||
================================================================================
|
||||
OpenGL Mathematics (GLM)
|
||||
--------------------------------------------------------------------------------
|
||||
GLM can be distributed and/or modified under the terms of either
|
||||
a) The Happy Bunny License, or b) the MIT License.
|
||||
|
||||
Copyright (c) 2005 - 2013 G-Truc Creation
|
||||
================================================================================
|
||||
The Happy Bunny License (Modified MIT License)
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Restrictions: By making use of the Software for military purposes, you choose
|
||||
to make a Bunny unhappy.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
================================================================================
|
||||
The MIT License
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - 2016 G-Truc Creation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
set(NAME glm_dummy)
|
||||
|
||||
file(GLOB ROOT_SOURCE *.cpp)
|
||||
file(GLOB ROOT_INLINE *.inl)
|
||||
file(GLOB ROOT_HEADER *.hpp)
|
||||
file(GLOB ROOT_TEXT ../*.txt)
|
||||
file(GLOB ROOT_MD ../*.md)
|
||||
file(GLOB ROOT_NAT ../util/glm.natvis)
|
||||
|
||||
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
|
||||
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
|
||||
@ -17,7 +17,11 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
|
||||
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
|
||||
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
|
||||
|
||||
source_group("Text Files" FILES ${ROOT_TEXT})
|
||||
file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp)
|
||||
file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl)
|
||||
file(GLOB_RECURSE SIMD_HEADER ./simd/*.h)
|
||||
|
||||
source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
|
||||
source_group("Core Files" FILES ${CORE_SOURCE})
|
||||
source_group("Core Files" FILES ${CORE_INLINE})
|
||||
source_group("Core Files" FILES ${CORE_HEADER})
|
||||
@ -27,16 +31,37 @@ source_group("GTC Files" FILES ${GTC_HEADER})
|
||||
source_group("GTX Files" FILES ${GTX_SOURCE})
|
||||
source_group("GTX Files" FILES ${GTX_INLINE})
|
||||
source_group("GTX Files" FILES ${GTX_HEADER})
|
||||
source_group("SIMD Files" FILES ${SIMD_SOURCE})
|
||||
source_group("SIMD Files" FILES ${SIMD_INLINE})
|
||||
source_group("SIMD Files" FILES ${SIMD_HEADER})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
if(GLM_TEST_ENABLE)
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
if(GLM_STATIC_LIBRARY_ENABLE)
|
||||
add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
endif(GLM_STATIC_LIBRARY_ENABLE)
|
||||
|
||||
if(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
endif(GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
|
||||
else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
endif(GLM_TEST_ENABLE)
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
|
||||
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
|
||||
|
||||
#add_library(glm STATIC glm.cpp)
|
||||
#add_library(glm_shared SHARED glm.cpp)
|
||||
endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/common.hpp
|
||||
/// @date 2013-12-24 / 2013-12-24
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_features.hpp
|
||||
/// @date 2013-02-20 / 2013-02-20
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -284,7 +255,7 @@
|
||||
# define GLM_CXX11_STATIC_ASSERT
|
||||
# endif
|
||||
|
||||
#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# if(__has_feature(cxx_exceptions))
|
||||
# define GLM_CXX98_EXCEPTIONS
|
||||
# endif
|
||||
@ -425,4 +396,4 @@
|
||||
# define GLM_CXX11_VARIADIC_TEMPLATES
|
||||
# endif
|
||||
|
||||
#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_fixes.hpp
|
||||
/// @date 2011-02-21 / 2011-11-22
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_noise.hpp
|
||||
/// @date 2013-12-24 / 2013-12-24
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_swizzle_func.hpp
|
||||
/// @date 2011-10-16 / 2011-10-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/_vectorize.hpp
|
||||
/// @date 2011-10-14 / 2011-10-14
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,40 +1,13 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/dummy.cpp
|
||||
/// @date 2011-01-19 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// GLM is a header only library. There is nothing to compile.
|
||||
/// dummy.cpp exist only a wordaround for CMake file.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/ext.hpp>
|
||||
#include <limits>
|
||||
|
||||
struct material
|
||||
@ -148,6 +121,8 @@ struct intersection
|
||||
glm::vec4 position;
|
||||
glm::vec3 normal;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// Sample 4
|
||||
@ -190,7 +165,7 @@ glm::vec3 lighting
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
@ -210,13 +185,23 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
|
||||
{
|
||||
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
||||
}
|
||||
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
glm::vec4 v(1);
|
||||
float a = normalizeDotA(v, v);
|
||||
float b = normalizeDotB(v, v);
|
||||
float c = normalizeDotC(v, v);
|
||||
/*
|
||||
glm::vec1 o(1);
|
||||
glm::vec2 a(1);
|
||||
glm::vec3 b(1);
|
||||
glm::vec4 c(1);
|
||||
|
||||
glm::quat q;
|
||||
glm::dualquat p;
|
||||
|
||||
glm::mat4 m(1);
|
||||
|
||||
float a0 = normalizeDotA(a, a);
|
||||
float b0 = normalizeDotB(b, b);
|
||||
float c0 = normalizeDotC(c, c);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_common.hpp
|
||||
/// @date 2008-03-08 / 2010-01-26
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
///
|
||||
@ -35,7 +7,6 @@
|
||||
/// @ingroup core
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_common.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
@ -37,142 +8,24 @@
|
||||
#include "_vectorize.hpp"
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename genFIType, bool /*signed*/>
|
||||
struct compute_abs
|
||||
{};
|
||||
|
||||
template <typename genFIType>
|
||||
struct compute_abs<genFIType, true>
|
||||
// min
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType min(genType x, genType y)
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'min' only accept floating-point or integer inputs");
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
return x >= genFIType(0) ? x : -x;
|
||||
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename genFIType>
|
||||
struct compute_abs<genFIType, false>
|
||||
// max
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType max(genType x, genType y)
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer,
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
return x;
|
||||
}
|
||||
};
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'max' only accept floating-point or integer inputs");
|
||||
|
||||
template <typename T, typename U, precision P, template <class, precision> class vecType>
|
||||
struct compute_mix_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType>
|
||||
struct compute_mix_vector<T, bool, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
|
||||
{
|
||||
vecType<T, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = a[i] ? y[i] : x[i];
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U, precision P, template <class, precision> class vecType>
|
||||
struct compute_mix_scalar
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType>
|
||||
struct compute_mix_scalar<T, bool, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, bool const & a)
|
||||
{
|
||||
return a ? y : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct compute_mix
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct compute_mix<T, bool>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, bool const & a)
|
||||
{
|
||||
return a ? y : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true, bool isSigned = true>
|
||||
struct compute_sign
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return vecType<T, P>(glm::lessThan(vecType<T, P>(0), x)) - vecType<T, P>(glm::lessThan(x, vecType<T, P>(0)));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType>
|
||||
struct compute_sign<T, P, vecType, false, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return vecType<T, P>(glm::greaterThan(x , vecType<T, P>(0)));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType>
|
||||
struct compute_sign<T, P, vecType, false, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
|
||||
vecType<T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
||||
|
||||
return (x >> Shift) | y;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, typename genType, bool isFloat = true>
|
||||
struct compute_mod
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, genType const & b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
// abs
|
||||
template <>
|
||||
@ -182,67 +35,6 @@ namespace detail
|
||||
return (x ^ y) - y;
|
||||
}
|
||||
|
||||
template <typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType abs(genFIType x)
|
||||
{
|
||||
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> abs(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(abs, x);
|
||||
}
|
||||
|
||||
// sign
|
||||
// fast and works for any type
|
||||
template <typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<genFIType, defaultp, tvec1, std::numeric_limits<genFIType>::is_iec559>::call(tvec1<genFIType>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sign(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
||||
}
|
||||
|
||||
// floor
|
||||
using ::std::floor;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> floor(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(floor, x);
|
||||
}
|
||||
|
||||
// trunc
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using ::std::trunc;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
|
||||
return x < static_cast<genType>(0) ? -floor(-x) : floor(x);
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> trunc(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(trunc, x);
|
||||
}
|
||||
|
||||
// round
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using ::std::round;
|
||||
@ -256,10 +48,318 @@ namespace detail
|
||||
}
|
||||
# endif
|
||||
|
||||
// trunc
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using ::std::trunc;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType trunc(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
|
||||
return x < static_cast<genType>(0) ? -std::floor(-x) : std::floor(x);
|
||||
}
|
||||
# endif
|
||||
|
||||
}//namespace glm
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename genFIType, bool /*signed*/>
|
||||
struct compute_abs
|
||||
{};
|
||||
|
||||
template <typename genFIType>
|
||||
struct compute_abs<genFIType, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed || GLM_UNRESTRICTED_GENTYPE,
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
|
||||
return x >= genFIType(0) ? x : -x;
|
||||
// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
|
||||
}
|
||||
};
|
||||
|
||||
#if GLM_COMPILER & GLM_COMPILER_CUDA
|
||||
template <>
|
||||
struct compute_abs<float, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(float x)
|
||||
{
|
||||
return fabsf(x);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template <typename genFIType>
|
||||
struct compute_abs<genFIType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static genFIType call(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
(!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer) || GLM_UNRESTRICTED_GENTYPE,
|
||||
"'abs' only accept floating-point and integer scalar or vector inputs");
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_abs_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(abs, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_vector<T, bool, P, vecType, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, vecType<bool, P> const & a)
|
||||
{
|
||||
vecType<T, P> Result(uninitialize);
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = a[i] ? y[i] : x[i];
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_scalar
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, U const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return vecType<T, P>(vecType<U, P>(x) + a * vecType<U, P>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mix_scalar<T, bool, P, vecType, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y, bool const & a)
|
||||
{
|
||||
return a ? y : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct compute_mix
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, U const & a)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
|
||||
|
||||
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct compute_mix<T, bool>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(T const & x, T const & y, bool const & a)
|
||||
{
|
||||
return a ? y : x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool isFloat, bool Aligned>
|
||||
struct compute_sign
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return vecType<T, P>(glm::lessThan(vecType<T, P>(0), x)) - vecType<T, P>(glm::lessThan(x, vecType<T, P>(0)));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH == GLM_ARCH_X86
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_sign<T, P, vecType, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
|
||||
vecType<T, P> const y(vecType<typename make_unsigned<T>::type, P>(-x) >> typename make_unsigned<T>::type(Shift));
|
||||
|
||||
return (x >> Shift) | y;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_floor
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(std::floor, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_ceil
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(std::ceil, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_fract
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return x - floor(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_trunc
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(trunc, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_round
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(round, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_mod
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'mod' only accept floating-point inputs. Include <glm/gtc/integer.hpp> for integer inputs.");
|
||||
return a - b * floor(a / b);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_min_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return detail::functor2<T, P, vecType>::call(min, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_max_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return detail::functor2<T, P, vecType>::call(max, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_clamp_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal)
|
||||
{
|
||||
return min(max(x, minVal), maxVal);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_step_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge, vecType<T, P> const & x)
|
||||
{
|
||||
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, edge));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_smoothstep_vector
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs");
|
||||
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType abs(genFIType x)
|
||||
{
|
||||
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> abs(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::compute_abs_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// sign
|
||||
// fast and works for any type
|
||||
template <typename genFIType>
|
||||
GLM_FUNC_QUALIFIER genFIType sign(genFIType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genFIType>::is_iec559 || (std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<genFIType, defaultp, tvec1, std::numeric_limits<genFIType>::is_iec559, highp>::call(tvec1<genFIType>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sign(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<T>::is_iec559 || (std::numeric_limits<T>::is_signed && std::numeric_limits<T>::is_integer),
|
||||
"'sign' only accept signed inputs");
|
||||
|
||||
return detail::compute_sign<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// floor
|
||||
using ::std::floor;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> floor(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'floor' only accept floating-point inputs.");
|
||||
return detail::compute_floor<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> trunc(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'trunc' only accept floating-point inputs");
|
||||
return detail::compute_trunc<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> round(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(round, x);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'round' only accept floating-point inputs");
|
||||
return detail::compute_round<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -308,6 +408,7 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> roundEven(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'roundEven' only accept floating-point inputs");
|
||||
return detail::functor1<T, T, P, vecType>::call(roundEven, x);
|
||||
}
|
||||
|
||||
@ -316,41 +417,47 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> ceil(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(ceil, x);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ceil' only accept floating-point inputs");
|
||||
return detail::compute_ceil<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// fract
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType fract(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'fract' only accept floating-point inputs");
|
||||
|
||||
return fract(tvec1<genType>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> fract(vecType<T, P> const & x)
|
||||
{
|
||||
return x - floor(x);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'fract' only accept floating-point inputs");
|
||||
return detail::compute_fract<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// mod
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType mod(genType x, genType y)
|
||||
{
|
||||
return mod(tvec1<genType>(x), y).x;
|
||||
# if GLM_COMPILER & GLM_COMPILER_CUDA
|
||||
// Another Cuda compiler bug https://github.com/g-truc/glm/issues/530
|
||||
tvec1<genType, defaultp> Result(mod(tvec1<genType, defaultp>(x), y));
|
||||
return Result.x;
|
||||
# else
|
||||
return mod(tvec1<genType, defaultp>(x), y).x;
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, T y)
|
||||
{
|
||||
return detail::compute_mod<T, P, vecType, T, std::numeric_limits<T>::is_iec559>::call(x, y);
|
||||
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(y));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return detail::compute_mod<T, P, vecType, vecType<T, P>, std::numeric_limits<T>::is_iec559>::call(x, y);
|
||||
return detail::compute_mod<T, P, vecType, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
// modf
|
||||
@ -358,7 +465,6 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER genType modf(genType x, genType & i)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'modf' only accept floating-point inputs");
|
||||
|
||||
return std::modf(x, &i);
|
||||
}
|
||||
|
||||
@ -405,70 +511,53 @@ namespace detail
|
||||
//CHAR_BIT - 1)));
|
||||
|
||||
// min
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType min(genType x, genType y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'min' only accept floating-point or integer inputs");
|
||||
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, T b)
|
||||
{
|
||||
return detail::functor2_vec_sca<T, P, vecType>::call(min, a, b);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'min' only accept floating-point inputs for the interpolator a");
|
||||
return detail::compute_min_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> min(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
return detail::functor2<T, P, vecType>::call(min, a, b);
|
||||
return detail::compute_min_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
}
|
||||
|
||||
// max
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType max(genType x, genType y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'max' only accept floating-point or integer inputs");
|
||||
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, T b)
|
||||
{
|
||||
return detail::functor2_vec_sca<T, P, vecType>::call(max, a, b);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'max' only accept floating-point inputs for the interpolator a");
|
||||
return detail::compute_max_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, vecType<T, P>(b));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> max(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
return detail::functor2<T, P, vecType>::call(max, a, b);
|
||||
return detail::compute_max_vector<T, P, vecType, detail::is_aligned<P>::value>::call(a, b);
|
||||
}
|
||||
|
||||
// clamp
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType clamp(genType x, genType minVal, genType maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||
return min(max(x, minVal), maxVal);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return min(max(x, minVal), maxVal);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||
return detail::compute_clamp_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x, vecType<T, P>(minVal), vecType<T, P>(maxVal));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer, "'clamp' only accept floating-point or integer inputs");
|
||||
|
||||
return min(max(x, minVal), maxVal);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer || GLM_UNRESTRICTED_GENTYPE, "'clamp' only accept floating-point or integer inputs");
|
||||
return detail::compute_clamp_vector<T, P, vecType, detail::is_aligned<P>::value>::call(x, minVal, maxVal);
|
||||
}
|
||||
|
||||
template <typename genTypeT, typename genTypeU>
|
||||
@ -480,13 +569,13 @@ namespace detail
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a)
|
||||
{
|
||||
return detail::compute_mix_scalar<T, U, P, vecType>::call(x, y, a);
|
||||
return detail::compute_mix_scalar<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
}
|
||||
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a)
|
||||
{
|
||||
return detail::compute_mix_vector<T, U, P, vecType>::call(x, y, a);
|
||||
return detail::compute_mix_vector<T, U, P, vecType, detail::is_aligned<P>::value>::call(x, y, a);
|
||||
}
|
||||
|
||||
// step
|
||||
@ -499,22 +588,20 @@ namespace detail
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> step(T edge, vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'step' only accept floating-point inputs");
|
||||
|
||||
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, vecType<T, P>(edge)));
|
||||
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge), x);
|
||||
}
|
||||
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x)
|
||||
{
|
||||
return mix(vecType<T, P>(1), vecType<T, P>(0), glm::lessThan(x, edge));
|
||||
return detail::compute_step_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge, x);
|
||||
}
|
||||
|
||||
// smoothstep
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType smoothstep(genType edge0, genType edge1, genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
|
||||
|
||||
genType const tmp(clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)));
|
||||
return tmp * tmp * (genType(3) - genType(2) * tmp);
|
||||
@ -523,19 +610,13 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
||||
|
||||
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(vecType<T, P>(edge0), vecType<T, P>(edge1), x);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'smoothstep' only accept floating-point inputs");
|
||||
|
||||
vecType<T, P> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
|
||||
return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
|
||||
return detail::compute_smoothstep_vector<T, P, vecType, detail::is_aligned<P>::value>::call(edge0, edge1, x);
|
||||
}
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
@ -548,14 +629,16 @@ namespace detail
|
||||
|
||||
# if GLM_HAS_CXX11_STL
|
||||
return std::isnan(x);
|
||||
# elif GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)
|
||||
# elif GLM_COMPILER & GLM_COMPILER_VC
|
||||
return _isnan(x) != 0;
|
||||
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
# if GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L
|
||||
# elif GLM_COMPILER & GLM_COMPILER_INTEL
|
||||
# if GLM_PLATFORM & GLM_PLATFORM_WINDOWS
|
||||
return _isnan(x) != 0;
|
||||
# else
|
||||
return std::isnan(x);
|
||||
return ::isnan(x) != 0;
|
||||
# endif
|
||||
# elif (GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)) && (GLM_PLATFORM & GLM_PLATFORM_ANDROID) && __cplusplus < 201103L
|
||||
return _isnan(x) != 0;
|
||||
# elif GLM_COMPILER & GLM_COMPILER_CUDA
|
||||
return isnan(x) != 0;
|
||||
# else
|
||||
@ -583,8 +666,12 @@ namespace detail
|
||||
# if GLM_HAS_CXX11_STL
|
||||
return std::isinf(x);
|
||||
# elif GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)
|
||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||
# elif GLM_COMPILER & (GLM_COMPILER_GCC | (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
|
||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||
# else
|
||||
return ::isinf(x);
|
||||
# endif
|
||||
# elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)
|
||||
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID && __cplusplus < 201103L)
|
||||
return _isinf(x) != 0;
|
||||
# else
|
||||
@ -660,23 +747,23 @@ namespace detail
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType frexp(genType x, int & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return std::frexp(x, exp);
|
||||
return std::frexp(x, &exp);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> frexp(tvec1<T, P> const & x, tvec1<int, P> & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return tvec1<T, P>(std::frexp(x.x, exp.x));
|
||||
return tvec1<T, P>(std::frexp(x.x, &exp.x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> frexp(tvec2<T, P> const & x, tvec2<int, P> & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return tvec2<T, P>(
|
||||
frexp(x.x, exp.x),
|
||||
@ -686,7 +773,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> frexp(tvec3<T, P> const & x, tvec3<int, P> & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return tvec3<T, P>(
|
||||
frexp(x.x, exp.x),
|
||||
@ -697,7 +784,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> frexp(tvec4<T, P> const & x, tvec4<int, P> & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'frexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'frexp' only accept floating-point inputs");
|
||||
|
||||
return tvec4<T, P>(
|
||||
frexp(x.x, exp.x),
|
||||
@ -706,10 +793,10 @@ namespace detail
|
||||
frexp(x.w, exp.w));
|
||||
}
|
||||
|
||||
template <typename genType, precision P>
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return std::ldexp(x, exp);
|
||||
}
|
||||
@ -717,7 +804,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> ldexp(tvec1<T, P> const & x, tvec1<int, P> const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return tvec1<T, P>(
|
||||
ldexp(x.x, exp.x));
|
||||
@ -726,7 +813,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> ldexp(tvec2<T, P> const & x, tvec2<int, P> const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return tvec2<T, P>(
|
||||
ldexp(x.x, exp.x),
|
||||
@ -736,7 +823,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> ldexp(tvec3<T, P> const & x, tvec3<int, P> const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return tvec3<T, P>(
|
||||
ldexp(x.x, exp.x),
|
||||
@ -747,7 +834,7 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> ldexp(tvec4<T, P> const & x, tvec4<int, P> const & exp)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'ldexp' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'ldexp' only accept floating-point inputs");
|
||||
|
||||
return tvec4<T, P>(
|
||||
ldexp(x.x, exp.x),
|
||||
@ -756,3 +843,7 @@ namespace detail
|
||||
ldexp(x.w, exp.w));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_common_simd.inl"
|
||||
#endif
|
||||
|
||||
231
common/glm/glm/detail/func_common_simd.inl
Normal file
231
common/glm/glm/detail/func_common_simd.inl
Normal file
@ -0,0 +1,231 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_common_simd.inl
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
#include "../simd/common.h"
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <precision P>
|
||||
struct compute_abs_vector<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_abs(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_abs_vector<int, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & v)
|
||||
{
|
||||
tvec4<int, P> result(uninitialize);
|
||||
result.data = glm_ivec4_abs(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_floor<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_floor(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_ceil<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_ceil(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_fract<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_fract(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_round<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_round(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_mod<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_mod(x.data, y.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_min_vector<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = _mm_min_ps(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_min_vector<int32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
|
||||
{
|
||||
tvec4<int32, P> result(uninitialize);
|
||||
result.data = _mm_min_epi32(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_min_vector<uint32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
|
||||
{
|
||||
tvec4<uint32, P> result(uninitialize);
|
||||
result.data = _mm_min_epu32(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_max_vector<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v1, tvec4<float, P> const & v2)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = _mm_max_ps(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_max_vector<int32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & v1, tvec4<int32, P> const & v2)
|
||||
{
|
||||
tvec4<int32, P> result(uninitialize);
|
||||
result.data = _mm_max_epi32(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_max_vector<uint32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v1, tvec4<uint32, P> const & v2)
|
||||
{
|
||||
tvec4<uint32, P> result(uninitialize);
|
||||
result.data = _mm_max_epu32(v1.data, v2.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_clamp_vector<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & minVal, tvec4<float, P> const & maxVal)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = _mm_min_ps(_mm_max_ps(x.data, minVal.data), maxVal.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_clamp_vector<int32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int32, P> call(tvec4<int32, P> const & x, tvec4<int32, P> const & minVal, tvec4<int32, P> const & maxVal)
|
||||
{
|
||||
tvec4<int32, P> result(uninitialize);
|
||||
result.data = _mm_min_epi32(_mm_max_epi32(x.data, minVal.data), maxVal.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_clamp_vector<uint32, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & x, tvec4<uint32, P> const & minVal, tvec4<uint32, P> const & maxVal)
|
||||
{
|
||||
tvec4<uint32, P> result(uninitialize);
|
||||
result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_mix_vector<float, bool, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & x, tvec4<float, P> const & y, tvec4<bool, P> const & a)
|
||||
{
|
||||
__m128i const Load = _mm_set_epi32(-(int)a.w, -(int)a.z, -(int)a.y, -(int)a.x);
|
||||
__m128 const Mask = _mm_castsi128_ps(Load);
|
||||
|
||||
tvec4<float, P> Result(uninitialize);
|
||||
# if 0 && GLM_ARCH & GLM_ARCH_AVX
|
||||
Result.data = _mm_blendv_ps(x.data, y.data, Mask);
|
||||
# else
|
||||
Result.data = _mm_or_ps(_mm_and_ps(Mask, y.data), _mm_andnot_ps(Mask, x.data));
|
||||
# endif
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
/* FIXME
|
||||
template <precision P>
|
||||
struct compute_step_vector<float, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge, tvec4<float, P> const& x)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_step(edge.data, x.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
*/
|
||||
template <precision P>
|
||||
struct compute_smoothstep_vector<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& edge0, tvec4<float, P> const& edge1, tvec4<float, P> const& x)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_smoothstep(edge0.data, edge1.data, x.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_exponential.hpp
|
||||
/// @date 2008-08-08 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
///
|
||||
@ -35,7 +7,6 @@
|
||||
/// @ingroup core
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_exponential.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
@ -49,7 +20,7 @@ namespace detail
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true>
|
||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat, bool Aligned>
|
||||
struct compute_log2
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
||||
@ -58,7 +29,16 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||
struct compute_sqrt
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(std::sqrt, x);
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||
struct compute_inversesqrt
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
|
||||
@ -67,8 +47,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class vecType>
|
||||
struct compute_inversesqrt<vecType, float, lowp>
|
||||
template <template <class, precision> class vecType, bool Aligned>
|
||||
struct compute_inversesqrt<vecType, float, lowp, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x)
|
||||
{
|
||||
@ -133,7 +113,7 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
||||
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// sqrt
|
||||
@ -142,7 +122,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||
return detail::functor1<T, T, P, vecType>::call(sqrt, x);
|
||||
return detail::compute_sqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// inversesqrt
|
||||
@ -156,6 +136,11 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||
return detail::compute_inversesqrt<vecType, T, P>::call(x);
|
||||
return detail::compute_inversesqrt<vecType, T, P, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_exponential_simd.inl"
|
||||
#endif
|
||||
|
||||
|
||||
35
common/glm/glm/detail/func_exponential_simd.inl
Normal file
35
common/glm/glm/detail/func_exponential_simd.inl
Normal file
@ -0,0 +1,35 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_exponential_simd.inl
|
||||
|
||||
#include "../simd/exponential.h"
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <precision P>
|
||||
struct compute_sqrt<tvec4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = _mm_sqrt_ps(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_sqrt<tvec4, float, aligned_lowp, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, aligned_lowp> call(tvec4<float, aligned_lowp> const & v)
|
||||
{
|
||||
tvec4<float, aligned_lowp> result(uninitialize);
|
||||
result.data = glm_vec4_sqrt_lowp(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_geometric.hpp
|
||||
/// @date 2008-08-03 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
///
|
||||
@ -35,7 +7,6 @@
|
||||
/// @ingroup core
|
||||
///
|
||||
/// These operate on vectors as vectors, not component-wise.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -104,11 +75,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType faceforward(
|
||||
genType const & N,
|
||||
genType const & I,
|
||||
genType const & Nref);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> faceforward(
|
||||
vecType<T, P> const & N,
|
||||
vecType<T, P> const & I,
|
||||
vecType<T, P> const & Nref);
|
||||
|
||||
/// For the incident vector I and surface orientation N,
|
||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_geometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_exponential.hpp"
|
||||
#include "func_common.hpp"
|
||||
@ -39,11 +10,29 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned>
|
||||
struct compute_length
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v)
|
||||
{
|
||||
return sqrt(dot(v, v));
|
||||
}
|
||||
};
|
||||
|
||||
template <template <typename, precision> class vecType, typename T, precision P, bool Aligned>
|
||||
struct compute_distance
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||
{
|
||||
return length(p1 - p0);
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class vecType, typename T, precision P, bool Aligned>
|
||||
struct compute_dot{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<tvec1, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_dot<tvec1, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
@ -51,8 +40,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<tvec2, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_dot<tvec2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y)
|
||||
{
|
||||
@ -61,8 +50,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<tvec3, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_dot<tvec3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
@ -71,8 +60,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<tvec4, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_dot<tvec4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y)
|
||||
{
|
||||
@ -80,13 +69,69 @@ namespace detail
|
||||
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_cross
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
||||
|
||||
return tvec3<T, P>(
|
||||
x.y * y.z - y.y * x.z,
|
||||
x.z * y.x - y.z * x.x,
|
||||
x.x * y.y - y.x * x.y);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_normalize
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
return v * inversesqrt(dot(v, v));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_faceforward
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
return dot(Nref, I) < static_cast<T>(0) ? N : -N;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_reflect
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N)
|
||||
{
|
||||
return I - N * dot(N, I) * static_cast<T>(2);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
|
||||
struct compute_refract
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
||||
{
|
||||
T const dotValue(dot(N, I));
|
||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
// length
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType length(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' accepts only floating-point inputs");
|
||||
|
||||
return abs(x);
|
||||
}
|
||||
@ -94,16 +139,16 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs");
|
||||
|
||||
return sqrt(dot(v, v));
|
||||
return detail::compute_length<vecType, T, P, detail::is_aligned<P>::value>::call(v);
|
||||
}
|
||||
|
||||
// distance
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' accepts only floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
@ -111,41 +156,36 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||
{
|
||||
return length(p1 - p0);
|
||||
return detail::compute_distance<vecType, T, P, detail::is_aligned<P>::value>::call(p0, p1);
|
||||
}
|
||||
|
||||
// dot
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T dot(T x, T y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||
return x * y;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
return detail::compute_dot<vecType, T, P>::call(x, y);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
|
||||
return detail::compute_dot<vecType, T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
// cross
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
|
||||
|
||||
return tvec3<T, P>(
|
||||
x.y * y.z - y.y * x.z,
|
||||
x.z * y.x - y.z * x.x,
|
||||
x.x * y.y - y.x * x.y);
|
||||
return detail::compute_cross<T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
// normalize
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
return x < genType(0) ? genType(-1) : genType(1);
|
||||
}
|
||||
@ -153,9 +193,9 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
|
||||
|
||||
return x * inversesqrt(dot(x, x));
|
||||
return detail::compute_normalize<T, P, vecType, detail::is_aligned<P>::value>::call(x);
|
||||
}
|
||||
|
||||
// faceforward
|
||||
@ -165,19 +205,30 @@ namespace detail
|
||||
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> faceforward(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref)
|
||||
{
|
||||
return detail::compute_faceforward<T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref);
|
||||
}
|
||||
|
||||
// reflect
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N)
|
||||
{
|
||||
return I - N * dot(N, I) * static_cast<genType>(2);
|
||||
return I - N * dot(N, I) * genType(2);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> reflect(vecType<T, P> const & I, vecType<T, P> const & N)
|
||||
{
|
||||
return detail::compute_reflect<T, P, vecType, detail::is_aligned<P>::value>::call(I, N);
|
||||
}
|
||||
|
||||
// refract
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType const & eta)
|
||||
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType eta)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' accepts only floating-point inputs");
|
||||
genType const dotValue(dot(N, I));
|
||||
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
||||
@ -186,10 +237,11 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
T const dotValue(dot(N, I));
|
||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs");
|
||||
return detail::compute_refract<T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_geometric_simd.inl"
|
||||
#endif
|
||||
|
||||
99
common/glm/glm/detail/func_geometric_simd.inl
Normal file
99
common/glm/glm/detail/func_geometric_simd.inl
Normal file
@ -0,0 +1,99 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_geometric_simd.inl
|
||||
|
||||
#include "../simd/geometric.h"
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <precision P>
|
||||
struct compute_length<tvec4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & v)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_vec4_length(v.data));
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_distance<tvec4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const & p0, tvec4<float, P> const & p1)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data));
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_dot<tvec4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(tvec4<float, P> const& x, tvec4<float, P> const& y)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_cross<float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<float, P> call(tvec3<float, P> const & a, tvec3<float, P> const & b)
|
||||
{
|
||||
__m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x);
|
||||
__m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x);
|
||||
__m128 const xpd0 = glm_vec4_cross(set0, set1);
|
||||
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = xpd0;
|
||||
return tvec3<float, P>(result);
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_normalize<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const & v)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_normalize(v.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_faceforward<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& N, tvec4<float, P> const& I, tvec4<float, P> const& Nref)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_faceforward(N.data, I.data, Nref.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_reflect<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_reflect(I.data, N.data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_refract<float, P, tvec4, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<float, P> call(tvec4<float, P> const& I, tvec4<float, P> const& N, float eta)
|
||||
{
|
||||
tvec4<float, P> result(uninitialize);
|
||||
result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta));
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_integer.hpp
|
||||
/// @date 2010-03-17 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
///
|
||||
@ -37,7 +9,6 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,48 +1,26 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_integer.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_int.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
#if(GLM_ARCH != GLM_ARCH_PURE)
|
||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#if(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_BitScanReverse)
|
||||
#endif//(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#endif//(GLM_ARCH != GLM_ARCH_PURE)
|
||||
#endif//(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#include <limits>
|
||||
|
||||
#if !GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
# if GLM_COMPILER & GLM_COMPILER_GCC
|
||||
# pragma GCC diagnostic ignored "-Wlong-long"
|
||||
# endif
|
||||
# if (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
@ -52,40 +30,36 @@ namespace detail
|
||||
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
||||
}
|
||||
|
||||
template <bool EXEC = false>
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldReverseStep<true>
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldReverseStep<T, P, vecType, Aligned, true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <bool EXEC = false>
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned, bool EXEC>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldBitCountStep<true>
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, bool Aligned>
|
||||
struct compute_bitfieldBitCountStep<T, P, vecType, Aligned, true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
@ -173,7 +147,7 @@ namespace detail
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
struct compute_findMSB_vec<T, P, vecType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||
@ -208,7 +182,7 @@ namespace detail
|
||||
{
|
||||
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
|
||||
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = Value64 > Max32 ? 1 : 0;
|
||||
Carry = Value64 > Max32 ? 1u : 0u;
|
||||
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
@ -248,10 +222,8 @@ namespace detail
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
|
||||
uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1);
|
||||
msb = *PointerMSB;
|
||||
uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0);
|
||||
lsb = *PointerLSB;
|
||||
msb = static_cast<uint>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = static_cast<uint>(Value64);
|
||||
}
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
@ -270,10 +242,8 @@ namespace detail
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
|
||||
int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1);
|
||||
msb = *PointerMSB;
|
||||
int32* PointerLSB = (reinterpret_cast<int32*>(&Value64));
|
||||
lsb = *PointerLSB;
|
||||
msb = static_cast<int>(Value64 >> static_cast<int64>(32));
|
||||
lsb = static_cast<int>(Value64);
|
||||
}
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
@ -328,12 +298,12 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v)
|
||||
{
|
||||
vecType<T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<T, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -348,12 +318,12 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
|
||||
{
|
||||
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<typename detail::make_unsigned<T>::type, P, vecType, detail::is_aligned<P>::value, sizeof(T) * 8>= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
return vecType<int, P>(x);
|
||||
}
|
||||
|
||||
@ -391,3 +361,8 @@ namespace detail
|
||||
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_integer_simd.inl"
|
||||
#endif
|
||||
|
||||
|
||||
68
common/glm/glm/detail/func_integer_simd.inl
Normal file
68
common/glm/glm/detail/func_integer_simd.inl
Normal file
@ -0,0 +1,68 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_integer_simd.inl
|
||||
|
||||
#include "../simd/integer.h"
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <glm::precision P>
|
||||
struct compute_bitfieldReverseStep<uint32, P, tvec4, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||
{
|
||||
__m128i const set0 = v.data;
|
||||
|
||||
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||
__m128i const and1 = _mm_and_si128(set0, set1);
|
||||
__m128i const sft1 = _mm_slli_epi32(and1, Shift);
|
||||
|
||||
__m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1));
|
||||
__m128i const and2 = _mm_and_si128(set0, set2);
|
||||
__m128i const sft2 = _mm_srai_epi32(and2, Shift);
|
||||
|
||||
__m128i const or0 = _mm_or_si128(sft1, sft2);
|
||||
|
||||
return or0;
|
||||
}
|
||||
};
|
||||
|
||||
template <glm::precision P>
|
||||
struct compute_bitfieldBitCountStep<uint32, P, tvec4, true, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
|
||||
{
|
||||
__m128i const set0 = v.data;
|
||||
|
||||
__m128i const set1 = _mm_set1_epi32(Mask);
|
||||
__m128i const and0 = _mm_and_si128(set0, set1);
|
||||
__m128i const sft0 = _mm_slli_epi32(set0, Shift);
|
||||
__m128i const and1 = _mm_and_si128(sft0, set1);
|
||||
__m128i const add0 = _mm_add_epi32(and0, and1);
|
||||
|
||||
return add0;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER int bitCount(uint32 x)
|
||||
{
|
||||
return _mm_popcnt_u32(x);
|
||||
}
|
||||
|
||||
# if(GLM_MODEL == GLM_MODEL_64)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER int bitCount(uint64 x)
|
||||
{
|
||||
return static_cast<int>(_mm_popcnt_u64(x));
|
||||
}
|
||||
# endif//GLM_MODEL
|
||||
# endif//GLM_ARCH
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_matrix.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
///
|
||||
@ -39,7 +11,6 @@
|
||||
/// are single precision, and a double-precision floating version, where all
|
||||
/// arguments and return values are double precision. Only the single-precision
|
||||
/// floating point version is shown.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -72,19 +43,19 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec2, tvec3>
|
||||
{
|
||||
typedef tmat2x3<T, P> type;
|
||||
typedef tmat3x2<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec2, tvec4>
|
||||
{
|
||||
typedef tmat2x4<T, P> type;
|
||||
typedef tmat4x2<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec3, tvec2>
|
||||
{
|
||||
typedef tmat3x2<T, P> type;
|
||||
typedef tmat2x3<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -96,19 +67,19 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec3, tvec4>
|
||||
{
|
||||
typedef tmat3x4<T, P> type;
|
||||
typedef tmat4x3<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec4, tvec2>
|
||||
{
|
||||
typedef tmat4x2<T, P> type;
|
||||
typedef tmat2x4<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct outerProduct_trait<T, P, tvec4, tvec3>
|
||||
{
|
||||
typedef tmat4x3<T, P> type;
|
||||
typedef tmat3x4<T, P> type;
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -149,7 +120,7 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
|
||||
# endif
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_matrix.inl
|
||||
/// @date 2008-03-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../geometric.hpp"
|
||||
#include <limits>
|
||||
@ -36,11 +7,23 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <template <class, precision> class matType, typename T, precision P>
|
||||
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||
struct compute_matrixCompMult
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static matType<T, P> call(matType<T, P> const& x, matType<T, P> const& y)
|
||||
{
|
||||
matType<T, P> result(uninitialize);
|
||||
for(length_t i = 0; i < result.length(); ++i)
|
||||
result[i] = x[i] * y[i];
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class matType, typename T, precision P, bool Aligned>
|
||||
struct compute_transpose{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat2x2, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat2x2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
@ -53,8 +36,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat2x3, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat2x3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat3x2<T, P> call(tmat2x3<T, P> const & m)
|
||||
{
|
||||
@ -69,8 +52,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat2x4, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat2x4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x2<T, P> call(tmat2x4<T, P> const & m)
|
||||
{
|
||||
@ -87,8 +70,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat3x2, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat3x2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat2x3<T, P> call(tmat3x2<T, P> const & m)
|
||||
{
|
||||
@ -103,8 +86,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat3x3, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat3x3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
@ -124,8 +107,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat3x4, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat3x4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x3<T, P> call(tmat3x4<T, P> const & m)
|
||||
{
|
||||
@ -146,8 +129,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat4x2, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat4x2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat2x4<T, P> call(tmat4x2<T, P> const & m)
|
||||
{
|
||||
@ -164,8 +147,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat4x3, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat4x3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat3x4<T, P> call(tmat4x3<T, P> const & m)
|
||||
{
|
||||
@ -186,8 +169,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<tmat4x4, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_transpose<tmat4x4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
@ -215,11 +198,11 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class matType, typename T, precision P>
|
||||
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||
struct compute_determinant{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<tmat2x2, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_determinant<tmat2x2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
@ -227,8 +210,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<tmat3x3, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_determinant<tmat3x3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
@ -239,8 +222,8 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<tmat4x4, T, P>
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_determinant<tmat4x4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
@ -262,26 +245,130 @@ namespace detail
|
||||
m[0][2] * DetCof[2] + m[0][3] * DetCof[3];
|
||||
}
|
||||
};
|
||||
|
||||
template <template <typename, precision> class matType, typename T, precision P, bool Aligned>
|
||||
struct compute_inverse{};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_inverse<tmat2x2, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const& m)
|
||||
{
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * m[1][1]
|
||||
- m[1][0] * m[0][1]);
|
||||
|
||||
tmat2x2<T, P> Inverse(
|
||||
+ m[1][1] * OneOverDeterminant,
|
||||
- m[0][1] * OneOverDeterminant,
|
||||
- m[1][0] * OneOverDeterminant,
|
||||
+ m[0][0] * OneOverDeterminant);
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_inverse<tmat3x3, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const& m)
|
||||
{
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
- m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
|
||||
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]));
|
||||
|
||||
tmat3x3<T, P> Inverse(uninitialize);
|
||||
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDeterminant;
|
||||
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDeterminant;
|
||||
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDeterminant;
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
struct compute_inverse<tmat4x4, T, P, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const& m)
|
||||
{
|
||||
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||
T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
|
||||
|
||||
T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||
T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
|
||||
|
||||
T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
|
||||
T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
|
||||
T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
|
||||
|
||||
T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
|
||||
T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
|
||||
T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
|
||||
|
||||
T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
|
||||
T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||
|
||||
T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
|
||||
T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||
|
||||
tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
|
||||
tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
|
||||
tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
|
||||
tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
|
||||
tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
|
||||
tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
|
||||
|
||||
tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
|
||||
tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
|
||||
tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
|
||||
tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
|
||||
|
||||
tvec4<T, P> Inv0(Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
|
||||
tvec4<T, P> Inv1(Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
|
||||
tvec4<T, P> Inv2(Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
|
||||
tvec4<T, P> Inv3(Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
|
||||
|
||||
tvec4<T, P> SignA(+1, -1, +1, -1);
|
||||
tvec4<T, P> SignB(-1, +1, -1, +1);
|
||||
tmat4x4<T, P> Inverse(Inv0 * SignA, Inv1 * SignB, Inv2 * SignA, Inv3 * SignB);
|
||||
|
||||
tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
||||
|
||||
tvec4<T, P> Dot0(m[0] * Row0);
|
||||
T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
|
||||
|
||||
T OneOverDeterminant = static_cast<T>(1) / Dot1;
|
||||
|
||||
return Inverse * OneOverDeterminant;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_QUALIFIER matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
||||
|
||||
matType<T, P> result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
|
||||
result[i] = x[i] * y[i];
|
||||
return result;
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'matrixCompMult' only accept floating-point inputs");
|
||||
return detail::compute_matrixCompMult<matType, T, P, detail::is_aligned<P>::value>::call(x, y);
|
||||
}
|
||||
|
||||
template<typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
|
||||
|
||||
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
||||
for(length_t i = 0; i < m.length(); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
@ -289,22 +376,26 @@ namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_QUALIFIER typename matType<T, P>::transpose_type transpose(matType<T, P> const & m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'transpose' only accept floating-point inputs");
|
||||
return detail::compute_transpose<matType, T, P>::call(m);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'transpose' only accept floating-point inputs");
|
||||
return detail::compute_transpose<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_QUALIFIER T determinant(matType<T, P> const & m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'determinant' only accept floating-point inputs");
|
||||
return detail::compute_determinant<matType, T, P>::call(m);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'determinant' only accept floating-point inputs");
|
||||
return detail::compute_determinant<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
return detail::compute_inverse(m);
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'inverse' only accept floating-point inputs");
|
||||
return detail::compute_inverse<matType, T, P, detail::is_aligned<P>::value>::call(m);
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_matrix_simd.inl"
|
||||
#endif
|
||||
|
||||
|
||||
88
common/glm/glm/detail/func_matrix_simd.inl
Normal file
88
common/glm/glm/detail/func_matrix_simd.inl
Normal file
@ -0,0 +1,88 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_matrix_simd.inl
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
#include "type_mat4x4.hpp"
|
||||
#include "func_geometric.hpp"
|
||||
#include "../simd/matrix.h"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <precision P>
|
||||
struct compute_matrixCompMult<tmat4x4, float, P, true>
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::is_aligned<P>::value, "Specialization requires aligned");
|
||||
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & x, tmat4x4<float, P> const & y)
|
||||
{
|
||||
tmat4x4<float, P> result(uninitialize);
|
||||
glm_mat4_matrixCompMult(
|
||||
*(glm_vec4 const (*)[4])&x[0].data,
|
||||
*(glm_vec4 const (*)[4])&y[0].data,
|
||||
*(glm_vec4(*)[4])&result[0].data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_transpose<tmat4x4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const & m)
|
||||
{
|
||||
tmat4x4<float, P> result(uninitialize);
|
||||
glm_mat4_transpose(
|
||||
*(glm_vec4 const (*)[4])&m[0].data,
|
||||
*(glm_vec4(*)[4])&result[0].data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_determinant<tmat4x4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static float call(tmat4x4<float, P> const& m)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data)));
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_inverse<tmat4x4, float, P, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<float, P> call(tmat4x4<float, P> const& m)
|
||||
{
|
||||
tmat4x4<float, P> Result(uninitialize);
|
||||
glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_lowp> outerProduct<float, aligned_lowp, tvec4, tvec4>(tvec4<float, aligned_lowp> const & c, tvec4<float, aligned_lowp> const & r)
|
||||
{
|
||||
tmat4x4<float, aligned_lowp> m(uninitialize);
|
||||
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||
return m;
|
||||
}
|
||||
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_mediump> outerProduct<float, aligned_mediump, tvec4, tvec4>(tvec4<float, aligned_mediump> const & c, tvec4<float, aligned_mediump> const & r)
|
||||
{
|
||||
tmat4x4<float, aligned_mediump> m(uninitialize);
|
||||
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||
return m;
|
||||
}
|
||||
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<float, aligned_highp> outerProduct<float, aligned_highp, tvec4, tvec4>(tvec4<float, aligned_highp> const & c, tvec4<float, aligned_highp> const & r)
|
||||
{
|
||||
tmat4x4<float, aligned_highp> m(uninitialize);
|
||||
glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data));
|
||||
return m;
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#endif
|
||||
@ -1,93 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_noise.hpp
|
||||
/// @date 2008-08-01 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_noise Noise functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Noise functions are stochastic functions that can be used to increase visual
|
||||
/// complexity. Values returned by the following noise functions give the
|
||||
/// appearance of randomness, but are not truly random.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "setup.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_noise
|
||||
/// @{
|
||||
|
||||
/// Returns a 1D noise value based on the input value x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type noise1(genType const & x);
|
||||
|
||||
/// Returns a 2D noise value based on the input value x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
||||
|
||||
/// Returns a 3D noise value based on the input value x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
||||
|
||||
/// Returns a 4D noise value based on the input value x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_noise.inl"
|
||||
@ -1,388 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_noise.inl
|
||||
/// @date 2008-08-01 / 2011-09-27
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../detail/_noise.hpp"
|
||||
#include "./func_common.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
|
||||
{
|
||||
tvec3<T, P> pXYZ = floor(fract(tvec3<T, P>(j) * tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
|
||||
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), tvec3<T, P>(1));
|
||||
tvec4<T, P> s = tvec4<T, P>(lessThan(tvec4<T, P>(pXYZ, pW), tvec4<T, P>(0.0)));
|
||||
pXYZ = pXYZ + (tvec3<T, P>(s) * T(2) - T(1)) * s.w;
|
||||
return tvec4<T, P>(pXYZ, pW);
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T noise1(T const & x)
|
||||
{
|
||||
return noise1(tvec2<T, defaultp>(x, T(0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, defaultp> noise2(T const & x)
|
||||
{
|
||||
return tvec2<T, defaultp>(
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, defaultp> noise3(T const & x)
|
||||
{
|
||||
return tvec3<T, defaultp>(
|
||||
noise1(x - T(1.0)),
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, defaultp> noise4(T const & x)
|
||||
{
|
||||
return tvec4<T, defaultp>(
|
||||
noise1(x - T(1.0)),
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)),
|
||||
noise1(x + T(2.0)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec2<T, P> const & v)
|
||||
{
|
||||
tvec4<T, P> const C = tvec4<T, P>(
|
||||
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
|
||||
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
|
||||
T(-0.577350269189626), // -1.0 + 2.0 * C.x
|
||||
T( 0.024390243902439)); // 1.0 / 41.0
|
||||
|
||||
// First corner
|
||||
tvec2<T, P> i = floor(v + dot(v, tvec2<T, P>(C[1])));
|
||||
tvec2<T, P> x0 = v - i + dot(i, tvec2<T, P>(C[0]));
|
||||
|
||||
// Other corners
|
||||
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
|
||||
//i1.y = 1.0 - i1.x;
|
||||
tvec2<T, P> i1 = (x0.x > x0.y) ? tvec2<T, P>(1, 0) : tvec2<T, P>(0, 1);
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xx ;
|
||||
// x1 = x0 - i1 + 1.0 * C.xx ;
|
||||
// x2 = x0 - 1.0 + 2.0 * C.xx ;
|
||||
tvec4<T, P> x12 = tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + tvec4<T, P>(C.x, C.x, C.z, C.z);
|
||||
x12 = tvec4<T, P>(tvec2<T, P>(x12) - i1, x12.z, x12.w);
|
||||
|
||||
// Permutations
|
||||
i = mod(i, T(289)); // Avoid truncation effects in permutation
|
||||
tvec3<T, P> p = detail::permute(
|
||||
detail::permute(i.y + tvec3<T, P>(T(0), i1.y, T(1))) + i.x + tvec3<T, P>(T(0), i1.x, T(1)));
|
||||
|
||||
tvec3<T, P> m = max(T(0.5) - tvec3<T, P>(
|
||||
dot(x0, x0),
|
||||
dot(tvec2<T, P>(x12.x, x12.y), tvec2<T, P>(x12.x, x12.y)),
|
||||
dot(tvec2<T, P>(x12.z, x12.w), tvec2<T, P>(x12.z, x12.w))), T(0));
|
||||
|
||||
m = m * m;
|
||||
m = m * m;
|
||||
|
||||
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
|
||||
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
|
||||
|
||||
tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
|
||||
tvec3<T, P> h = abs(x) - T(0.5);
|
||||
tvec3<T, P> ox = floor(x + T(0.5));
|
||||
tvec3<T, P> a0 = x - ox;
|
||||
|
||||
// Normalise gradients implicitly by scaling m
|
||||
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
|
||||
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
|
||||
|
||||
// Compute final noise value at P
|
||||
tvec3<T, P> g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
//g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
g.y = a0.y * x12.x + h.y * x12.y;
|
||||
g.z = a0.z * x12.z + h.z * x12.w;
|
||||
return T(130) * dot(m, g);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec3<T, P> const & v)
|
||||
{
|
||||
tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
||||
tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
// First corner
|
||||
tvec3<T, P> i(floor(v + dot(v, tvec3<T, P>(C.y))));
|
||||
tvec3<T, P> x0(v - i + dot(i, tvec3<T, P>(C.x)));
|
||||
|
||||
// Other corners
|
||||
tvec3<T, P> g(step(tvec3<T, P>(x0.y, x0.z, x0.x), x0));
|
||||
tvec3<T, P> l(T(1) - g);
|
||||
tvec3<T, P> i1(min(g, tvec3<T, P>(l.z, l.x, l.y)));
|
||||
tvec3<T, P> i2(max(g, tvec3<T, P>(l.z, l.x, l.y)));
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xxx;
|
||||
// x1 = x0 - i1 + 1.0 * C.xxx;
|
||||
// x2 = x0 - i2 + 2.0 * C.xxx;
|
||||
// x3 = x0 - 1.0 + 3.0 * C.xxx;
|
||||
tvec3<T, P> x1(x0 - i1 + C.x);
|
||||
tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
|
||||
tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
|
||||
|
||||
// Permutations
|
||||
i = mod289(i);
|
||||
tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
|
||||
i.z + tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
|
||||
i.y + tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
|
||||
i.x + tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
|
||||
|
||||
// Gradients: 7x7 points over a square, mapped onto an octahedron.
|
||||
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
|
||||
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
|
||||
tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
|
||||
|
||||
tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
||||
|
||||
tvec4<T, P> x_(floor(j * ns.z));
|
||||
tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
||||
|
||||
tvec4<T, P> x(x_ * ns.x + ns.y);
|
||||
tvec4<T, P> y(y_ * ns.x + ns.y);
|
||||
tvec4<T, P> h(T(1) - abs(x) - abs(y));
|
||||
|
||||
tvec4<T, P> b0(x.x, x.y, y.x, y.y);
|
||||
tvec4<T, P> b1(x.z, x.w, y.z, y.w);
|
||||
|
||||
// vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
|
||||
// vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
|
||||
tvec4<T, P> s0(floor(b0) * T(2) + T(1));
|
||||
tvec4<T, P> s1(floor(b1) * T(2) + T(1));
|
||||
tvec4<T, P> sh(-step(h, tvec4<T, P>(0.0)));
|
||||
|
||||
tvec4<T, P> a0 = tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
|
||||
tvec4<T, P> a1 = tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
|
||||
|
||||
tvec3<T, P> p0(a0.x, a0.y, h.x);
|
||||
tvec3<T, P> p1(a0.z, a0.w, h.y);
|
||||
tvec3<T, P> p2(a1.x, a1.y, h.z);
|
||||
tvec3<T, P> p3(a1.z, a1.w, h.w);
|
||||
|
||||
// Normalise gradients
|
||||
tvec4<T, P> norm = taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
// Mix final noise value
|
||||
tvec4<T, P> m = max(T(0.6) - tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
|
||||
m = m * m;
|
||||
return T(42) * dot(m * m, tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec4<T, P> const & v)
|
||||
{
|
||||
tvec4<T, P> const C(
|
||||
0.138196601125011, // (5 - sqrt(5))/20 G4
|
||||
0.276393202250021, // 2 * G4
|
||||
0.414589803375032, // 3 * G4
|
||||
-0.447213595499958); // -1 + 4 * G4
|
||||
|
||||
// (sqrt(5) - 1)/4 = F4, used once below
|
||||
T const F4 = static_cast<T>(0.309016994374947451);
|
||||
|
||||
// First corner
|
||||
tvec4<T, P> i = floor(v + dot(v, tvec4<T, P>(F4)));
|
||||
tvec4<T, P> x0 = v - i + dot(i, tvec4<T, P>(C.x));
|
||||
|
||||
// Other corners
|
||||
|
||||
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
|
||||
tvec4<T, P> i0;
|
||||
tvec3<T, P> isX = step(tvec3<T, P>(x0.y, x0.z, x0.w), tvec3<T, P>(x0.x));
|
||||
tvec3<T, P> isYZ = step(tvec3<T, P>(x0.z, x0.w, x0.w), tvec3<T, P>(x0.y, x0.y, x0.z));
|
||||
|
||||
// i0.x = dot(isX, vec3(1.0));
|
||||
//i0.x = isX.x + isX.y + isX.z;
|
||||
//i0.yzw = static_cast<T>(1) - isX;
|
||||
i0 = tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
|
||||
|
||||
// i0.y += dot(isYZ.xy, vec2(1.0));
|
||||
i0.y += isYZ.x + isYZ.y;
|
||||
|
||||
//i0.zw += 1.0 - tvec2<T, P>(isYZ.x, isYZ.y);
|
||||
i0.z += static_cast<T>(1) - isYZ.x;
|
||||
i0.w += static_cast<T>(1) - isYZ.y;
|
||||
i0.z += isYZ.z;
|
||||
i0.w += static_cast<T>(1) - isYZ.z;
|
||||
|
||||
// i0 now contains the unique values 0,1,2,3 in each channel
|
||||
tvec4<T, P> i3 = clamp(i0, T(0), T(1));
|
||||
tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
|
||||
tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xxxx
|
||||
// x1 = x0 - i1 + 0.0 * C.xxxx
|
||||
// x2 = x0 - i2 + 0.0 * C.xxxx
|
||||
// x3 = x0 - i3 + 0.0 * C.xxxx
|
||||
// x4 = x0 - 1.0 + 4.0 * C.xxxx
|
||||
tvec4<T, P> x1 = x0 - i1 + C.x;
|
||||
tvec4<T, P> x2 = x0 - i2 + C.y;
|
||||
tvec4<T, P> x3 = x0 - i3 + C.z;
|
||||
tvec4<T, P> x4 = x0 + C.w;
|
||||
|
||||
// Permutations
|
||||
i = mod(i, T(289));
|
||||
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
|
||||
tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
|
||||
i.w + tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
|
||||
i.z + tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
|
||||
i.y + tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
|
||||
i.x + tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
|
||||
|
||||
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
|
||||
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
|
||||
tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
||||
|
||||
tvec4<T, P> p0 = detail::grad4(j0, ip);
|
||||
tvec4<T, P> p1 = detail::grad4(j1.x, ip);
|
||||
tvec4<T, P> p2 = detail::grad4(j1.y, ip);
|
||||
tvec4<T, P> p3 = detail::grad4(j1.z, ip);
|
||||
tvec4<T, P> p4 = detail::grad4(j1.w, ip);
|
||||
|
||||
// Normalise gradients
|
||||
tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
p4 *= taylorInvSqrt(dot(p4, p4));
|
||||
|
||||
// Mix contributions from the five corners
|
||||
tvec3<T, P> m0 = max(T(0.6) - tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
|
||||
tvec2<T, P> m1 = max(T(0.6) - tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
|
||||
m0 = m0 * m0;
|
||||
m1 = m1 * m1;
|
||||
|
||||
return T(49) * (
|
||||
dot(m0 * m0, tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
||||
dot(m1 * m1, tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec2<T, P> const & x)
|
||||
{
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec2<T, P>(0.0)),
|
||||
noise1(tvec2<T, P>(0.0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec3<T, P> const & x)
|
||||
{
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec3<T, P>(0.0)),
|
||||
noise1(tvec3<T, P>(0.0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec4<T, P> const & x)
|
||||
{
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(tvec4<T, P>(0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec2<T, P> const & x)
|
||||
{
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec2<T, P>(1.0)),
|
||||
noise1(x + tvec2<T, P>(0.0)),
|
||||
noise1(x + tvec2<T, P>(1.0)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec3<T, P> const & x)
|
||||
{
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec3<T, P>(1.0)),
|
||||
noise1(x + tvec3<T, P>(0.0)),
|
||||
noise1(x + tvec3<T, P>(1.0)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec4<T, P> const & x)
|
||||
{
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(x + tvec4<T, P>(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec2<T, P> const & x)
|
||||
{
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec2<T, P>(1)),
|
||||
noise1(x + tvec2<T, P>(0)),
|
||||
noise1(x + tvec2<T, P>(1)),
|
||||
noise1(x + tvec2<T, P>(2)));
|
||||
}
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec3<T, P> const & x)
|
||||
{
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec3<T, P>(1)),
|
||||
noise1(x + tvec3<T, P>(0)),
|
||||
noise1(x + tvec3<T, P>(1)),
|
||||
noise1(x + tvec3<T, P>(2)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec4<T, P> const & x)
|
||||
{
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(x + tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(2)));
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
@ -1,42 +1,13 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_packing.hpp
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
/// @see gtc_packing
|
||||
///
|
||||
///
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
///
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -111,7 +82,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint const & p);
|
||||
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
@ -124,7 +95,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint const & p);
|
||||
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
@ -137,7 +108,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint const & p);
|
||||
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
@ -150,7 +121,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint const & p);
|
||||
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);
|
||||
|
||||
/// Returns a double-precision value obtained by packing the components of v into a 64-bit value.
|
||||
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
|
||||
@ -169,7 +140,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uvec2 unpackDouble2x32(double const & v);
|
||||
GLM_FUNC_DECL uvec2 unpackDouble2x32(double v);
|
||||
|
||||
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
|
||||
/// to the 16-bit floating-point representation found in the OpenGL Specification,
|
||||
@ -189,7 +160,7 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackHalf2x16(uint const & v);
|
||||
GLM_FUNC_DECL vec2 unpackHalf2x16(uint v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_packing.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "func_common.hpp"
|
||||
#include "type_half.hpp"
|
||||
@ -38,87 +9,182 @@ namespace glm
|
||||
{
|
||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
||||
{
|
||||
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
// return reinterpret_cast<uint&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
union
|
||||
{
|
||||
u16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
u16vec2 result(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
|
||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint p)
|
||||
{
|
||||
vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
|
||||
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
u16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return vec2(u.out[0], u.out[1]) * 1.5259021896696421759365224689097e-5f;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
||||
// return reinterpret_cast<uint32&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
union
|
||||
{
|
||||
i16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
i16vec2 result(round(clamp(v, -1.0f, 1.0f) * 32767.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
|
||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint p)
|
||||
{
|
||||
vec2 Unpack(reinterpret_cast<i16vec2 const &>(p));
|
||||
return clamp(
|
||||
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
||||
-1.0f, 1.0f);
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return clamp(vec2(u.out[0], u.out[1]) * 3.0518509475997192297128208258309e-5f, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
|
||||
{
|
||||
u8vec4 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
||||
return reinterpret_cast<uint&>(Topack);
|
||||
union
|
||||
{
|
||||
u8 in[4];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
u8vec4 result(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
u.in[2] = result[2];
|
||||
u.in[3] = result[3];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p)
|
||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint p)
|
||||
{
|
||||
vec4 Unpack(reinterpret_cast<u8vec4 const&>(p));
|
||||
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
u8 out[4];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0039215686274509803921568627451f;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
|
||||
{
|
||||
i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
|
||||
return reinterpret_cast<uint&>(Topack);
|
||||
union
|
||||
{
|
||||
i8 in[4];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
i8vec4 result(round(clamp(v, -1.0f, 1.0f) * 127.0f));
|
||||
|
||||
u.in[0] = result[0];
|
||||
u.in[1] = result[1];
|
||||
u.in[2] = result[2];
|
||||
u.in[3] = result[3];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p)
|
||||
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint p)
|
||||
{
|
||||
vec4 Unpack(reinterpret_cast<i8vec4 const &>(p));
|
||||
return clamp(
|
||||
Unpack * 0.0078740157480315f, // 1.0f / 127.0f
|
||||
-1.0f, 1.0f);
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i8 out[4];
|
||||
} u;
|
||||
|
||||
u.in = p;
|
||||
|
||||
return clamp(vec4(u.out[0], u.out[1], u.out[2], u.out[3]) * 0.0078740157480315f, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
|
||||
{
|
||||
return reinterpret_cast<double const &>(v);
|
||||
union
|
||||
{
|
||||
uint in[2];
|
||||
double out;
|
||||
} u;
|
||||
|
||||
u.in[0] = v[0];
|
||||
u.in[1] = v[1];
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v)
|
||||
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double v)
|
||||
{
|
||||
return reinterpret_cast<uvec2 const &>(v);
|
||||
union
|
||||
{
|
||||
double in;
|
||||
uint out[2];
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return uvec2(u.out[0], u.out[1]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 Unpack(
|
||||
detail::toFloat16(v.x),
|
||||
detail::toFloat16(v.y));
|
||||
union
|
||||
{
|
||||
i16 in[2];
|
||||
uint out;
|
||||
} u;
|
||||
|
||||
uint * Result = reinterpret_cast<uint*>(&Unpack);
|
||||
return *Result;
|
||||
u.in[0] = detail::toFloat16(v.x);
|
||||
u.in[1] = detail::toFloat16(v.y);
|
||||
|
||||
return u.out;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
|
||||
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint v)
|
||||
{
|
||||
i16vec2 Unpack(reinterpret_cast<i16vec2 const &>(v));
|
||||
|
||||
union
|
||||
{
|
||||
uint in;
|
||||
i16 out[2];
|
||||
} u;
|
||||
|
||||
u.in = v;
|
||||
|
||||
return vec2(
|
||||
detail::toFloat32(Unpack.x),
|
||||
detail::toFloat32(Unpack.y));
|
||||
detail::toFloat32(u.out[0]),
|
||||
detail::toFloat32(u.out[1]));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_packing_simd.inl"
|
||||
#endif
|
||||
|
||||
|
||||
9
common/glm/glm/detail/func_packing_simd.inl
Normal file
9
common/glm/glm/detail/func_packing_simd.inl
Normal file
@ -0,0 +1,9 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_packing_simd.inl
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_trigonometric.hpp
|
||||
/// @date 2008-08-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
///
|
||||
@ -39,7 +11,6 @@
|
||||
/// the divisor of a ratio is 0, then results will be undefined.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -58,7 +29,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> radians(vecType<T, P> const & degrees);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
@ -67,7 +38,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> degrees(vecType<T, P> const & radians);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & radians);
|
||||
|
||||
/// The standard trigonometric sine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_trigonometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "_vectorize.hpp"
|
||||
#include <cmath>
|
||||
@ -38,7 +9,7 @@ namespace glm
|
||||
{
|
||||
// radians
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType radians(genType degrees)
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||
|
||||
@ -46,14 +17,14 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> radians(vecType<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(radians, v);
|
||||
}
|
||||
|
||||
// degrees
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType degrees(genType radians)
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType degrees(genType radians)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||
|
||||
@ -61,7 +32,7 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> degrees(vecType<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(degrees, v);
|
||||
}
|
||||
@ -113,7 +84,7 @@ namespace glm
|
||||
|
||||
// atan
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan(genType const & y, genType const & x)
|
||||
GLM_FUNC_QUALIFIER genType atan(genType y, genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
@ -123,7 +94,7 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
return detail::functor2<T, P, vecType>::call(atan2, a, b);
|
||||
return detail::functor2<T, P, vecType>::call(::std::atan2, a, b);
|
||||
}
|
||||
|
||||
using std::atan;
|
||||
@ -165,12 +136,12 @@ namespace glm
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::asinh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh(genType const & x)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(std::abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||
}
|
||||
# endif
|
||||
|
||||
@ -185,7 +156,7 @@ namespace glm
|
||||
using std::acosh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh(genType const & x)
|
||||
GLM_FUNC_QUALIFIER genType acosh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
@ -206,11 +177,11 @@ namespace glm
|
||||
using std::atanh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh(genType const & x)
|
||||
GLM_FUNC_QUALIFIER genType atanh(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
|
||||
if(abs(x) >= static_cast<genType>(1))
|
||||
if(std::abs(x) >= static_cast<genType>(1))
|
||||
return 0;
|
||||
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
|
||||
}
|
||||
@ -222,3 +193,8 @@ namespace glm
|
||||
return detail::functor1<T, T, P, vecType>::call(atanh, v);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_trigonometric_simd.inl"
|
||||
#endif
|
||||
|
||||
|
||||
0
common/glm/glm/detail/func_trigonometric_simd.inl
Normal file
0
common/glm/glm/detail/func_trigonometric_simd.inl
Normal file
@ -1,33 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_vector_relational.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
///
|
||||
@ -40,7 +12,6 @@
|
||||
///
|
||||
/// In all cases, the sizes of all the input and return vectors for any particular
|
||||
/// call must match.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_vector_relational.inl
|
||||
/// @date 2008-08-03 / 2011-09-09
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <limits>
|
||||
|
||||
@ -37,10 +8,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] < y[i];
|
||||
|
||||
return Result;
|
||||
@ -49,10 +20,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] <= y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -60,10 +31,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] > y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -71,10 +42,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -82,10 +53,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] == y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -93,10 +64,10 @@ namespace glm
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
assert(x.length() == y.length());
|
||||
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] != y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -105,7 +76,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = false;
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
Result = Result || v[i];
|
||||
return Result;
|
||||
}
|
||||
@ -114,7 +85,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = true;
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
Result = Result && v[i];
|
||||
return Result;
|
||||
}
|
||||
@ -123,9 +94,12 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v)
|
||||
{
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
for(length_t i = 0; i < v.length(); ++i)
|
||||
Result[i] = !v[i];
|
||||
return Result;
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_UNRESTRICTED_UNIONS
|
||||
# include "func_vector_relational_simd.inl"
|
||||
#endif
|
||||
|
||||
9
common/glm/glm/detail/func_vector_relational_simd.inl
Normal file
9
common/glm/glm/detail/func_vector_relational_simd.inl
Normal file
@ -0,0 +1,9 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_vector_relational_simd.inl
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
@ -1,34 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/glm.cpp
|
||||
/// @date 2013-04-22 / 2013-04-22
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_common.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
__m128 sse_abs_ps(__m128 x);
|
||||
|
||||
__m128 sse_sgn_ps(__m128 x);
|
||||
|
||||
//floor
|
||||
__m128 sse_flr_ps(__m128 v);
|
||||
|
||||
//trunc
|
||||
__m128 sse_trc_ps(__m128 v);
|
||||
|
||||
//round
|
||||
__m128 sse_nd_ps(__m128 v);
|
||||
|
||||
//roundEven
|
||||
__m128 sse_rde_ps(__m128 v);
|
||||
|
||||
__m128 sse_rnd_ps(__m128 x);
|
||||
|
||||
__m128 sse_ceil_ps(__m128 v);
|
||||
|
||||
__m128 sse_frc_ps(__m128 x);
|
||||
|
||||
__m128 sse_mod_ps(__m128 x, __m128 y);
|
||||
|
||||
__m128 sse_modf_ps(__m128 x, __m128i & i);
|
||||
|
||||
//GLM_FUNC_QUALIFIER __m128 sse_min_ps(__m128 x, __m128 y)
|
||||
|
||||
//GLM_FUNC_QUALIFIER __m128 sse_max_ps(__m128 x, __m128 y)
|
||||
|
||||
__m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal);
|
||||
|
||||
__m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a);
|
||||
|
||||
__m128 sse_stp_ps(__m128 edge, __m128 x);
|
||||
|
||||
__m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x);
|
||||
|
||||
__m128 sse_nan_ps(__m128 x);
|
||||
|
||||
__m128 sse_inf_ps(__m128 x);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "intrinsic_common.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,313 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_common.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail{
|
||||
|
||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4510 4512 4610)
|
||||
#endif
|
||||
|
||||
union ieee754_QNAN
|
||||
{
|
||||
const float f;
|
||||
struct i
|
||||
{
|
||||
const unsigned int mantissa:23, exp:8, sign:1;
|
||||
};
|
||||
|
||||
ieee754_QNAN() : f(0.0)/*, mantissa(0x7FFFFF), exp(0xFF), sign(0x0)*/ {}
|
||||
};
|
||||
|
||||
#if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
static const __m128 GLM_VAR_USED zero = _mm_setzero_ps();
|
||||
static const __m128 GLM_VAR_USED one = _mm_set_ps1(1.0f);
|
||||
static const __m128 GLM_VAR_USED minus_one = _mm_set_ps1(-1.0f);
|
||||
static const __m128 GLM_VAR_USED two = _mm_set_ps1(2.0f);
|
||||
static const __m128 GLM_VAR_USED three = _mm_set_ps1(3.0f);
|
||||
static const __m128 GLM_VAR_USED pi = _mm_set_ps1(3.1415926535897932384626433832795f);
|
||||
static const __m128 GLM_VAR_USED hundred_eighty = _mm_set_ps1(180.f);
|
||||
static const __m128 GLM_VAR_USED pi_over_hundred_eighty = _mm_set_ps1(0.017453292519943295769236907684886f);
|
||||
static const __m128 GLM_VAR_USED hundred_eighty_over_pi = _mm_set_ps1(57.295779513082320876798154814105f);
|
||||
|
||||
static const ieee754_QNAN absMask;
|
||||
static const __m128 GLM_VAR_USED abs4Mask = _mm_set_ps1(absMask.f);
|
||||
|
||||
static const __m128 GLM_VAR_USED _epi32_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(static_cast<int>(0x80000000)));
|
||||
//static const __m128 GLM_VAR_USED _epi32_inv_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
|
||||
//static const __m128 GLM_VAR_USED _epi32_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
|
||||
//static const __m128 GLM_VAR_USED _epi32_inv_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF));
|
||||
//static const __m128 GLM_VAR_USED _epi32_min_norm_pos = _mm_castsi128_ps(_mm_set1_epi32(0x00800000));
|
||||
static const __m128 GLM_VAR_USED _epi32_0 = _mm_set_ps1(0);
|
||||
static const __m128 GLM_VAR_USED _epi32_1 = _mm_set_ps1(1);
|
||||
static const __m128 GLM_VAR_USED _epi32_2 = _mm_set_ps1(2);
|
||||
static const __m128 GLM_VAR_USED _epi32_3 = _mm_set_ps1(3);
|
||||
static const __m128 GLM_VAR_USED _epi32_4 = _mm_set_ps1(4);
|
||||
static const __m128 GLM_VAR_USED _epi32_5 = _mm_set_ps1(5);
|
||||
static const __m128 GLM_VAR_USED _epi32_6 = _mm_set_ps1(6);
|
||||
static const __m128 GLM_VAR_USED _epi32_7 = _mm_set_ps1(7);
|
||||
static const __m128 GLM_VAR_USED _epi32_8 = _mm_set_ps1(8);
|
||||
static const __m128 GLM_VAR_USED _epi32_9 = _mm_set_ps1(9);
|
||||
static const __m128 GLM_VAR_USED _epi32_127 = _mm_set_ps1(127);
|
||||
//static const __m128 GLM_VAR_USED _epi32_ninf = _mm_castsi128_ps(_mm_set1_epi32(0xFF800000));
|
||||
//static const __m128 GLM_VAR_USED _epi32_pinf = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
|
||||
|
||||
static const __m128 GLM_VAR_USED _ps_1_3 = _mm_set_ps1(0.33333333333333333333333333333333f);
|
||||
static const __m128 GLM_VAR_USED _ps_0p5 = _mm_set_ps1(0.5f);
|
||||
static const __m128 GLM_VAR_USED _ps_1 = _mm_set_ps1(1.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_m1 = _mm_set_ps1(-1.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_2 = _mm_set_ps1(2.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_3 = _mm_set_ps1(3.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_127 = _mm_set_ps1(127.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_255 = _mm_set_ps1(255.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_2pow23 = _mm_set_ps1(8388608.0f);
|
||||
|
||||
static const __m128 GLM_VAR_USED _ps_1_0_0_0 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_0_1_0_0 = _mm_set_ps(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_0_0_1_0 = _mm_set_ps(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
static const __m128 GLM_VAR_USED _ps_0_0_0_1 = _mm_set_ps(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
static const __m128 GLM_VAR_USED _ps_pi = _mm_set_ps1(3.1415926535897932384626433832795f);
|
||||
static const __m128 GLM_VAR_USED _ps_pi2 = _mm_set_ps1(6.283185307179586476925286766560f);
|
||||
static const __m128 GLM_VAR_USED _ps_2_pi = _mm_set_ps1(0.63661977236758134307553505349006f);
|
||||
static const __m128 GLM_VAR_USED _ps_pi_2 = _mm_set_ps1(1.5707963267948966192313216916398f);
|
||||
static const __m128 GLM_VAR_USED _ps_4_pi = _mm_set_ps1(1.2732395447351626861510701069801f);
|
||||
static const __m128 GLM_VAR_USED _ps_pi_4 = _mm_set_ps1(0.78539816339744830961566084581988f);
|
||||
|
||||
static const __m128 GLM_VAR_USED _ps_sincos_p0 = _mm_set_ps1(0.15707963267948963959e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_sincos_p1 = _mm_set_ps1(-0.64596409750621907082e0f);
|
||||
static const __m128 GLM_VAR_USED _ps_sincos_p2 = _mm_set_ps1(0.7969262624561800806e-1f);
|
||||
static const __m128 GLM_VAR_USED _ps_sincos_p3 = _mm_set_ps1(-0.468175413106023168e-2f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_p0 = _mm_set_ps1(-1.79565251976484877988e7f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_p1 = _mm_set_ps1(1.15351664838587416140e6f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_p2 = _mm_set_ps1(-1.30936939181383777646e4f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_q0 = _mm_set_ps1(-5.38695755929454629881e7f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_q1 = _mm_set_ps1(2.50083801823357915839e7f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_q2 = _mm_set_ps1(-1.32089234440210967447e6f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_q3 = _mm_set_ps1(1.36812963470692954678e4f);
|
||||
static const __m128 GLM_VAR_USED _ps_tan_poleval = _mm_set_ps1(3.68935e19f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_t0 = _mm_set_ps1(-0.91646118527267623468e-1f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_t1 = _mm_set_ps1(-0.13956945682312098640e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_t2 = _mm_set_ps1(-0.94393926122725531747e2f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_t3 = _mm_set_ps1(0.12888383034157279340e2f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_s0 = _mm_set_ps1(0.12797564625607904396e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_s1 = _mm_set_ps1(0.21972168858277355914e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_s2 = _mm_set_ps1(0.68193064729268275701e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_atan_s3 = _mm_set_ps1(0.28205206687035841409e2f);
|
||||
|
||||
static const __m128 GLM_VAR_USED _ps_exp_hi = _mm_set_ps1(88.3762626647949f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_lo = _mm_set_ps1(-88.3762626647949f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_rln2 = _mm_set_ps1(1.4426950408889634073599f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_p0 = _mm_set_ps1(1.26177193074810590878e-4f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_p1 = _mm_set_ps1(3.02994407707441961300e-2f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_q0 = _mm_set_ps1(3.00198505138664455042e-6f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_q1 = _mm_set_ps1(2.52448340349684104192e-3f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_q2 = _mm_set_ps1(2.27265548208155028766e-1f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_q3 = _mm_set_ps1(2.00000000000000000009e0f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_c1 = _mm_set_ps1(6.93145751953125e-1f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp_c2 = _mm_set_ps1(1.42860682030941723212e-6f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_hi = _mm_set_ps1(127.4999961853f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_lo = _mm_set_ps1(-127.4999961853f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_p0 = _mm_set_ps1(2.30933477057345225087e-2f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_p1 = _mm_set_ps1(2.02020656693165307700e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_p2 = _mm_set_ps1(1.51390680115615096133e3f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_q0 = _mm_set_ps1(2.33184211722314911771e2f);
|
||||
static const __m128 GLM_VAR_USED _ps_exp2_q1 = _mm_set_ps1(4.36821166879210612817e3f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_p0 = _mm_set_ps1(-7.89580278884799154124e-1f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_p1 = _mm_set_ps1(1.63866645699558079767e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_p2 = _mm_set_ps1(-6.41409952958715622951e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_q0 = _mm_set_ps1(-3.56722798256324312549e1f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_q1 = _mm_set_ps1(3.12093766372244180303e2f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_q2 = _mm_set_ps1(-7.69691943550460008604e2f);
|
||||
static const __m128 GLM_VAR_USED _ps_log_c0 = _mm_set_ps1(0.693147180559945f);
|
||||
static const __m128 GLM_VAR_USED _ps_log2_c0 = _mm_set_ps1(1.44269504088896340735992f);
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_abs_ps(__m128 x)
|
||||
{
|
||||
return _mm_and_ps(glm::detail::abs4Mask, x);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_sgn_ps(__m128 x)
|
||||
{
|
||||
__m128 Neg = _mm_set1_ps(-1.0f);
|
||||
__m128 Pos = _mm_set1_ps(1.0f);
|
||||
|
||||
__m128 Cmp0 = _mm_cmplt_ps(x, zero);
|
||||
__m128 Cmp1 = _mm_cmpgt_ps(x, zero);
|
||||
|
||||
__m128 And0 = _mm_and_ps(Cmp0, Neg);
|
||||
__m128 And1 = _mm_and_ps(Cmp1, Pos);
|
||||
|
||||
return _mm_or_ps(And0, And1);
|
||||
}
|
||||
|
||||
//floor
|
||||
GLM_FUNC_QUALIFIER __m128 sse_flr_ps(__m128 x)
|
||||
{
|
||||
__m128 rnd0 = sse_rnd_ps(x);
|
||||
__m128 cmp0 = _mm_cmplt_ps(x, rnd0);
|
||||
__m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1);
|
||||
__m128 sub0 = _mm_sub_ps(rnd0, and0);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
//trunc
|
||||
/*
|
||||
GLM_FUNC_QUALIFIER __m128 _mm_trc_ps(__m128 v)
|
||||
{
|
||||
return __m128();
|
||||
}
|
||||
*/
|
||||
//round
|
||||
GLM_FUNC_QUALIFIER __m128 sse_rnd_ps(__m128 x)
|
||||
{
|
||||
__m128 and0 = _mm_and_ps(glm::detail::_epi32_sign_mask, x);
|
||||
__m128 or0 = _mm_or_ps(and0, glm::detail::_ps_2pow23);
|
||||
__m128 add0 = _mm_add_ps(x, or0);
|
||||
__m128 sub0 = _mm_sub_ps(add0, or0);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
//roundEven
|
||||
GLM_FUNC_QUALIFIER __m128 sse_rde_ps(__m128 x)
|
||||
{
|
||||
__m128 and0 = _mm_and_ps(glm::detail::_epi32_sign_mask, x);
|
||||
__m128 or0 = _mm_or_ps(and0, glm::detail::_ps_2pow23);
|
||||
__m128 add0 = _mm_add_ps(x, or0);
|
||||
__m128 sub0 = _mm_sub_ps(add0, or0);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_ceil_ps(__m128 x)
|
||||
{
|
||||
__m128 rnd0 = sse_rnd_ps(x);
|
||||
__m128 cmp0 = _mm_cmpgt_ps(x, rnd0);
|
||||
__m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1);
|
||||
__m128 add0 = _mm_add_ps(rnd0, and0);
|
||||
return add0;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_frc_ps(__m128 x)
|
||||
{
|
||||
__m128 flr0 = sse_flr_ps(x);
|
||||
__m128 sub0 = _mm_sub_ps(x, flr0);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_mod_ps(__m128 x, __m128 y)
|
||||
{
|
||||
__m128 div0 = _mm_div_ps(x, y);
|
||||
__m128 flr0 = sse_flr_ps(div0);
|
||||
__m128 mul0 = _mm_mul_ps(y, flr0);
|
||||
__m128 sub0 = _mm_sub_ps(x, mul0);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
/// TODO
|
||||
/*
|
||||
GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i)
|
||||
{
|
||||
__m128 empty;
|
||||
return empty;
|
||||
}
|
||||
*/
|
||||
|
||||
//GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y)
|
||||
|
||||
//GLM_FUNC_QUALIFIER __m128 _mm_max_ps(__m128 x, __m128 y)
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal)
|
||||
{
|
||||
__m128 min0 = _mm_min_ps(v, maxVal);
|
||||
__m128 max0 = _mm_max_ps(min0, minVal);
|
||||
return max0;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a)
|
||||
{
|
||||
__m128 sub0 = _mm_sub_ps(glm::detail::one, a);
|
||||
__m128 mul0 = _mm_mul_ps(v1, sub0);
|
||||
__m128 mul1 = _mm_mul_ps(v2, a);
|
||||
__m128 add0 = _mm_add_ps(mul0, mul1);
|
||||
return add0;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_stp_ps(__m128 edge, __m128 x)
|
||||
{
|
||||
__m128 cmp = _mm_cmple_ps(x, edge);
|
||||
if(_mm_movemask_ps(cmp) == 0)
|
||||
return glm::detail::one;
|
||||
else
|
||||
return glm::detail::zero;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x)
|
||||
{
|
||||
__m128 sub0 = _mm_sub_ps(x, edge0);
|
||||
__m128 sub1 = _mm_sub_ps(edge1, edge0);
|
||||
__m128 div0 = _mm_sub_ps(sub0, sub1);
|
||||
__m128 clp0 = sse_clp_ps(div0, glm::detail::zero, glm::detail::one);
|
||||
__m128 mul0 = _mm_mul_ps(glm::detail::two, clp0);
|
||||
__m128 sub2 = _mm_sub_ps(glm::detail::three, mul0);
|
||||
__m128 mul1 = _mm_mul_ps(clp0, clp0);
|
||||
__m128 mul2 = _mm_mul_ps(mul1, sub2);
|
||||
return mul2;
|
||||
}
|
||||
|
||||
/// \todo
|
||||
//GLM_FUNC_QUALIFIER __m128 sse_nan_ps(__m128 x)
|
||||
//{
|
||||
// __m128 empty;
|
||||
// return empty;
|
||||
//}
|
||||
|
||||
/// \todo
|
||||
//GLM_FUNC_QUALIFIER __m128 sse_inf_ps(__m128 x)
|
||||
//{
|
||||
// __m128 empty;
|
||||
// return empty;
|
||||
//}
|
||||
|
||||
// SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration
|
||||
// By Elan Ruskin, http://assemblyrequired.crashworks.org/
|
||||
GLM_FUNC_QUALIFIER __m128 sse_sqrt_wip_ss(__m128 const & x)
|
||||
{
|
||||
__m128 recip = _mm_rsqrt_ss(x); // "estimate" opcode
|
||||
const static __m128 three = {3, 3, 3, 3}; // aligned consts for fast load
|
||||
const static __m128 half = {0.5,0.5,0.5,0.5};
|
||||
__m128 halfrecip = _mm_mul_ss(half, recip);
|
||||
__m128 threeminus_xrr = _mm_sub_ss(three, _mm_mul_ss(x, _mm_mul_ss (recip, recip)));
|
||||
return _mm_mul_ss( halfrecip, threeminus_xrr);
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glms
|
||||
@ -1,77 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_exponential.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
/*
|
||||
GLM_FUNC_QUALIFIER __m128 sse_rsqrt_nr_ss(__m128 const x)
|
||||
{
|
||||
__m128 recip = _mm_rsqrt_ss( x ); // "estimate" opcode
|
||||
const static __m128 three = { 3, 3, 3, 3 }; // aligned consts for fast load
|
||||
const static __m128 half = { 0.5,0.5,0.5,0.5 };
|
||||
__m128 halfrecip = _mm_mul_ss( half, recip );
|
||||
__m128 threeminus_xrr = _mm_sub_ss( three, _mm_mul_ss( x, _mm_mul_ss ( recip, recip ) ) );
|
||||
return _mm_mul_ss( halfrecip, threeminus_xrr );
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float * RESTRICT vIn )
|
||||
{
|
||||
__m128 x = _mm_load_ss(&vIn[0]);
|
||||
__m128 y = _mm_load_ss(&vIn[1]);
|
||||
__m128 z = _mm_load_ss(&vIn[2]);
|
||||
|
||||
const __m128 l = // compute x*x + y*y + z*z
|
||||
_mm_add_ss(
|
||||
_mm_add_ss( _mm_mul_ss(x,x),
|
||||
_mm_mul_ss(y,y)
|
||||
),
|
||||
_mm_mul_ss( z, z )
|
||||
);
|
||||
|
||||
|
||||
const __m128 rsqt = _mm_rsqrt_nr_ss( l );
|
||||
_mm_store_ss( &vOut[0] , _mm_mul_ss( rsqt, x ) );
|
||||
_mm_store_ss( &vOut[1] , _mm_mul_ss( rsqt, y ) );
|
||||
_mm_store_ss( &vOut[2] , _mm_mul_ss( rsqt, z ) );
|
||||
|
||||
return _mm_mul_ss( l , rsqt );
|
||||
}
|
||||
*/
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,27 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_exponential.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1,74 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_geometric.hpp
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
#include "intrinsic_common.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
//length
|
||||
__m128 sse_len_ps(__m128 x);
|
||||
|
||||
//distance
|
||||
__m128 sse_dst_ps(__m128 p0, __m128 p1);
|
||||
|
||||
//dot
|
||||
__m128 sse_dot_ps(__m128 v1, __m128 v2);
|
||||
|
||||
// SSE1
|
||||
__m128 sse_dot_ss(__m128 v1, __m128 v2);
|
||||
|
||||
//cross
|
||||
__m128 sse_xpd_ps(__m128 v1, __m128 v2);
|
||||
|
||||
//normalize
|
||||
__m128 sse_nrm_ps(__m128 v);
|
||||
|
||||
//faceforward
|
||||
__m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref);
|
||||
|
||||
//reflect
|
||||
__m128 sse_rfe_ps(__m128 I, __m128 N);
|
||||
|
||||
//refract
|
||||
__m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "intrinsic_geometric.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,147 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_geometric.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail{
|
||||
|
||||
//length
|
||||
GLM_FUNC_QUALIFIER __m128 sse_len_ps(__m128 x)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(x, x);
|
||||
__m128 sqt0 = _mm_sqrt_ps(dot0);
|
||||
return sqt0;
|
||||
}
|
||||
|
||||
//distance
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
|
||||
{
|
||||
__m128 sub0 = _mm_sub_ps(p0, p1);
|
||||
__m128 len0 = sse_len_ps(sub0);
|
||||
return len0;
|
||||
}
|
||||
|
||||
//dot
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
|
||||
{
|
||||
|
||||
# if(GLM_ARCH & GLM_ARCH_AVX)
|
||||
return _mm_dp_ps(v1, v2, 0xff);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
__m128 add0 = _mm_add_ps(mul0, swp0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||
__m128 add1 = _mm_add_ps(add0, swp1);
|
||||
return add1;
|
||||
# endif
|
||||
}
|
||||
|
||||
// SSE1
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dot_ss(__m128 v1, __m128 v2)
|
||||
{
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 mov0 = _mm_movehl_ps(mul0, mul0);
|
||||
__m128 add0 = _mm_add_ps(mov0, mul0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, 1);
|
||||
__m128 add1 = _mm_add_ss(add0, swp1);
|
||||
return add1;
|
||||
}
|
||||
|
||||
//cross
|
||||
GLM_FUNC_QUALIFIER __m128 sse_xpd_ps(__m128 v1, __m128 v2)
|
||||
{
|
||||
__m128 swp0 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 swp1 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 swp2 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 swp3 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 mul0 = _mm_mul_ps(swp0, swp3);
|
||||
__m128 mul1 = _mm_mul_ps(swp1, swp2);
|
||||
__m128 sub0 = _mm_sub_ps(mul0, mul1);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
//normalize
|
||||
GLM_FUNC_QUALIFIER __m128 sse_nrm_ps(__m128 v)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(v, v);
|
||||
__m128 isr0 = _mm_rsqrt_ps(dot0);
|
||||
__m128 mul0 = _mm_mul_ps(v, isr0);
|
||||
return mul0;
|
||||
}
|
||||
|
||||
//faceforward
|
||||
GLM_FUNC_QUALIFIER __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref)
|
||||
{
|
||||
//__m128 dot0 = _mm_dot_ps(v, v);
|
||||
//__m128 neg0 = _mm_neg_ps(N);
|
||||
//__m128 sgn0 = _mm_sgn_ps(dot0);
|
||||
//__m128 mix0 = _mm_mix_ps(N, neg0, sgn0);
|
||||
//return mix0;
|
||||
|
||||
__m128 dot0 = sse_dot_ps(Nref, I);
|
||||
__m128 sgn0 = sse_sgn_ps(dot0);
|
||||
__m128 mul0 = _mm_mul_ps(sgn0, glm::detail::minus_one);
|
||||
__m128 mul1 = _mm_mul_ps(N, mul0);
|
||||
return mul1;
|
||||
}
|
||||
|
||||
//reflect
|
||||
GLM_FUNC_QUALIFIER __m128 sse_rfe_ps(__m128 I, __m128 N)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(N, I);
|
||||
__m128 mul0 = _mm_mul_ps(N, dot0);
|
||||
__m128 mul1 = _mm_mul_ps(mul0, glm::detail::two);
|
||||
__m128 sub0 = _mm_sub_ps(I, mul1);
|
||||
return sub0;
|
||||
}
|
||||
|
||||
//refract
|
||||
GLM_FUNC_QUALIFIER __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(N, I);
|
||||
__m128 mul0 = _mm_mul_ps(eta, eta);
|
||||
__m128 mul1 = _mm_mul_ps(dot0, dot0);
|
||||
__m128 sub0 = _mm_sub_ps(glm::detail::one, mul0);
|
||||
__m128 sub1 = _mm_sub_ps(glm::detail::one, mul1);
|
||||
__m128 mul2 = _mm_mul_ps(sub0, sub1);
|
||||
|
||||
if(_mm_movemask_ps(_mm_cmplt_ss(mul2, glm::detail::zero)) == 0)
|
||||
return glm::detail::zero;
|
||||
|
||||
__m128 sqt0 = _mm_sqrt_ps(mul2);
|
||||
__m128 mul3 = _mm_mul_ps(eta, dot0);
|
||||
__m128 add0 = _mm_add_ps(mul3, sqt0);
|
||||
__m128 mul4 = _mm_mul_ps(add0, N);
|
||||
__m128 mul5 = _mm_mul_ps(eta, I);
|
||||
__m128 sub2 = _mm_sub_ps(mul5, mul4);
|
||||
|
||||
return sub2;
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
@ -1,48 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_integer.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
__m128i _mm_bit_interleave_si128(__m128i x);
|
||||
__m128i _mm_bit_interleave_si128(__m128i x, __m128i y);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "intrinsic_integer.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,139 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_integer.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
inline __m128i _mm_bit_interleave_si128(__m128i x)
|
||||
{
|
||||
__m128i const Mask4 = _mm_set1_epi32(0x0000FFFF);
|
||||
__m128i const Mask3 = _mm_set1_epi32(0x00FF00FF);
|
||||
__m128i const Mask2 = _mm_set1_epi32(0x0F0F0F0F);
|
||||
__m128i const Mask1 = _mm_set1_epi32(0x33333333);
|
||||
__m128i const Mask0 = _mm_set1_epi32(0x55555555);
|
||||
|
||||
__m128i Reg1;
|
||||
__m128i Reg2;
|
||||
|
||||
// REG1 = x;
|
||||
// REG2 = y;
|
||||
//Reg1 = _mm_unpacklo_epi64(x, y);
|
||||
Reg1 = x;
|
||||
|
||||
//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
Reg2 = _mm_slli_si128(Reg1, 2);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask4);
|
||||
|
||||
//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
Reg2 = _mm_slli_si128(Reg1, 1);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask3);
|
||||
|
||||
//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 4);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask2);
|
||||
|
||||
//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);
|
||||
//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 2);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask1);
|
||||
|
||||
//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);
|
||||
//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 1);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask0);
|
||||
|
||||
//return REG1 | (REG2 << 1);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 1);
|
||||
Reg2 = _mm_srli_si128(Reg2, 8);
|
||||
Reg1 = _mm_or_si128(Reg1, Reg2);
|
||||
|
||||
return Reg1;
|
||||
}
|
||||
|
||||
inline __m128i _mm_bit_interleave_si128(__m128i x, __m128i y)
|
||||
{
|
||||
__m128i const Mask4 = _mm_set1_epi32(0x0000FFFF);
|
||||
__m128i const Mask3 = _mm_set1_epi32(0x00FF00FF);
|
||||
__m128i const Mask2 = _mm_set1_epi32(0x0F0F0F0F);
|
||||
__m128i const Mask1 = _mm_set1_epi32(0x33333333);
|
||||
__m128i const Mask0 = _mm_set1_epi32(0x55555555);
|
||||
|
||||
__m128i Reg1;
|
||||
__m128i Reg2;
|
||||
|
||||
// REG1 = x;
|
||||
// REG2 = y;
|
||||
Reg1 = _mm_unpacklo_epi64(x, y);
|
||||
|
||||
//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
Reg2 = _mm_slli_si128(Reg1, 2);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask4);
|
||||
|
||||
//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
Reg2 = _mm_slli_si128(Reg1, 1);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask3);
|
||||
|
||||
//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 4);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask2);
|
||||
|
||||
//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);
|
||||
//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 2);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask1);
|
||||
|
||||
//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);
|
||||
//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 1);
|
||||
Reg1 = _mm_or_si128(Reg2, Reg1);
|
||||
Reg1 = _mm_and_si128(Reg1, Mask0);
|
||||
|
||||
//return REG1 | (REG2 << 1);
|
||||
Reg2 = _mm_slli_epi32(Reg1, 1);
|
||||
Reg2 = _mm_srli_si128(Reg2, 8);
|
||||
Reg1 = _mm_or_si128(Reg1, Reg2);
|
||||
|
||||
return Reg1;
|
||||
}
|
||||
}//namespace detail
|
||||
}//namespace glms
|
||||
@ -1,67 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_common.hpp
|
||||
/// @date 2009-06-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
#include "intrinsic_geometric.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]);
|
||||
|
||||
void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]);
|
||||
|
||||
__m128 sse_mul_ps(__m128 m[4], __m128 v);
|
||||
|
||||
__m128 sse_mul_ps(__m128 v, __m128 m[4]);
|
||||
|
||||
void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]);
|
||||
|
||||
void sse_transpose_ps(__m128 const in[4], __m128 out[4]);
|
||||
|
||||
void sse_inverse_ps(__m128 const in[4], __m128 out[4]);
|
||||
|
||||
void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]);
|
||||
|
||||
__m128 sse_det_ps(__m128 const m[4]);
|
||||
|
||||
__m128 sse_slow_det_ps(__m128 const m[4]);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "intrinsic_matrix.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,46 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_trigonometric.hpp
|
||||
/// @date 2009-06-09 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
#if(!(GLM_ARCH & GLM_ARCH_SSE2))
|
||||
# error "SSE2 instructions not supported or enabled"
|
||||
#else
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "intrinsic_trigonometric.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
@ -1,27 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/detail/intrinsic_trigonometric.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user