mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Merge remote branch 'zinnschlag/master'
This commit is contained in:
commit
43c33ee85f
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,6 +1,6 @@
|
||||
[submodule "libs/mangle"]
|
||||
path = libs/mangle
|
||||
url = git://github.com/korslund/mangle.git
|
||||
url = git://github.com/zinnschlag/mangle.git
|
||||
[submodule "libs/openengine"]
|
||||
path = libs/openengine
|
||||
url = git://github.com/korslund/OpenEngine
|
||||
url = git://github.com/zinnschlag/OpenEngine
|
||||
|
@ -205,6 +205,8 @@ if (WIN32)
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
else (WIN32)
|
||||
set(PLATFORM_INCLUDE_DIR "")
|
||||
find_path (UUID_INCLUDE_DIR uuid/uuid.h)
|
||||
include_directories(${UUID_INCLUDE_DIR})
|
||||
endif (WIN32)
|
||||
if (MSVC10)
|
||||
set(PLATFORM_INCLUDE_DIR "")
|
||||
@ -217,13 +219,14 @@ find_package(Boost REQUIRED COMPONENTS system filesystem program_options thread)
|
||||
find_package(OIS REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
include_directories("."
|
||||
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre
|
||||
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE
|
||||
${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
|
||||
${PLATFORM_INCLUDE_DIR}
|
||||
${CMAKE_HOME_DIRECTORY}/extern/caelum/include
|
||||
${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/MyGUIEngine/include
|
||||
${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/OgrePlatform/include
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${UUID_INCLUDE_DIR}
|
||||
${LIBDIR}
|
||||
)
|
||||
|
||||
@ -308,22 +311,40 @@ if (BUILD_ESMTOOL)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
if (USE_DEBUG_CONSOLE)
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
||||
else()
|
||||
# Turn off debug console, debug output will be written to visual studio output instead
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS")
|
||||
# Turn off debug console, debug output will be written to visual studio output instead
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
|
||||
|
||||
# Release builds use the debug console
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE")
|
||||
endif(MSVC)
|
||||
|
||||
# TODO: At some point release builds should not use the console but rather write to a log file
|
||||
#set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
#set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||
# Same for MinGW
|
||||
if (MINGW)
|
||||
if (USE_DEBUG_CONSOLE)
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "-Wl,-subsystem,console")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "-Wl,-subsystem,console")
|
||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
||||
else(USE_DEBUG_CONSOLE)
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "-Wl,-subsystem,windows")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "-Wl,-subsystem,windows")
|
||||
endif(USE_DEBUG_CONSOLE)
|
||||
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "-Wl,-subsystem,console")
|
||||
set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "-Wl,-subsystem,console")
|
||||
set_target_properties(openmw PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE")
|
||||
endif(MINGW)
|
||||
|
||||
# TODO: At some point release builds should not use the console but rather write to a log file
|
||||
#set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
#set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
|
@ -354,45 +354,45 @@ struct option
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
#ifndef no_argument
|
||||
#define no_argument 0
|
||||
#define no_argument 0
|
||||
#endif
|
||||
|
||||
#ifndef required_argument
|
||||
#define required_argument 1
|
||||
#define required_argument 1
|
||||
#endif
|
||||
|
||||
#ifndef optional_argument
|
||||
#define optional_argument 2
|
||||
#define optional_argument 2
|
||||
#endif
|
||||
|
||||
struct custom_getopt_data {
|
||||
/*
|
||||
* These have exactly the same meaning as the corresponding global variables,
|
||||
* except that they are used for the reentrant versions of getopt.
|
||||
*/
|
||||
int custom_optind;
|
||||
int custom_opterr;
|
||||
int custom_optopt;
|
||||
char *custom_optarg;
|
||||
/*
|
||||
* These have exactly the same meaning as the corresponding global variables,
|
||||
* except that they are used for the reentrant versions of getopt.
|
||||
*/
|
||||
int custom_optind;
|
||||
int custom_opterr;
|
||||
int custom_optopt;
|
||||
char *custom_optarg;
|
||||
|
||||
/* True if the internal members have been initialized. */
|
||||
int initialized;
|
||||
/* True if the internal members have been initialized. */
|
||||
int initialized;
|
||||
|
||||
/*
|
||||
* The next char to be scanned in the option-element in which the last option
|
||||
* character we returned was found. This allows us to pick up the scan where
|
||||
* we left off. If this is zero, or a null string, it means resume the scan by
|
||||
* advancing to the next ARGV-element.
|
||||
*/
|
||||
char *nextchar;
|
||||
/*
|
||||
* The next char to be scanned in the option-element in which the last option
|
||||
* character we returned was found. This allows us to pick up the scan where
|
||||
* we left off. If this is zero, or a null string, it means resume the scan by
|
||||
* advancing to the next ARGV-element.
|
||||
*/
|
||||
char *nextchar;
|
||||
|
||||
/*
|
||||
* Describe the part of ARGV that contains non-options that have been skipped.
|
||||
* `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
|
||||
* the index after the last of them.
|
||||
*/
|
||||
int first_nonopt;
|
||||
int last_nonopt;
|
||||
/*
|
||||
* Describe the part of ARGV that contains non-options that have been skipped.
|
||||
* `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
|
||||
* the index after the last of them.
|
||||
*/
|
||||
int first_nonopt;
|
||||
int last_nonopt;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -448,137 +448,137 @@ static int custom_optopt = '?';
|
||||
*/
|
||||
static void exchange(char **argv, struct custom_getopt_data *d)
|
||||
{
|
||||
int bottom = d->first_nonopt;
|
||||
int middle = d->last_nonopt;
|
||||
int top = d->custom_optind;
|
||||
char *tem;
|
||||
int bottom = d->first_nonopt;
|
||||
int middle = d->last_nonopt;
|
||||
int top = d->custom_optind;
|
||||
char *tem;
|
||||
|
||||
/*
|
||||
* Exchange the shorter segment with the far end of the longer segment.
|
||||
* That puts the shorter segment into the right place. It leaves the
|
||||
* longer segment in the right place overall, but it consists of two
|
||||
* parts that need to be swapped next.
|
||||
*/
|
||||
while (top > middle && middle > bottom) {
|
||||
if (top - middle > middle - bottom) {
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
int i;
|
||||
/*
|
||||
* Exchange the shorter segment with the far end of the longer segment.
|
||||
* That puts the shorter segment into the right place. It leaves the
|
||||
* longer segment in the right place overall, but it consists of two
|
||||
* parts that need to be swapped next.
|
||||
*/
|
||||
while (top > middle && middle > bottom) {
|
||||
if (top - middle > middle - bottom) {
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
int i;
|
||||
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] =
|
||||
argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
} else {
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
int i;
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] =
|
||||
argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
} else {
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
int i;
|
||||
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
d->first_nonopt += (d->custom_optind - d->last_nonopt);
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
d->first_nonopt += (d->custom_optind - d->last_nonopt);
|
||||
d->last_nonopt = d->custom_optind;
|
||||
}
|
||||
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
static void custom_getopt_initialize(struct custom_getopt_data *d)
|
||||
{
|
||||
/*
|
||||
* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
* is the program name); the sequence of previously skipped non-option
|
||||
* ARGV-elements is empty.
|
||||
*/
|
||||
d->first_nonopt = d->last_nonopt = d->custom_optind;
|
||||
d->nextchar = NULL;
|
||||
d->initialized = 1;
|
||||
/*
|
||||
* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
* is the program name); the sequence of previously skipped non-option
|
||||
* ARGV-elements is empty.
|
||||
*/
|
||||
d->first_nonopt = d->last_nonopt = d->custom_optind;
|
||||
d->nextchar = NULL;
|
||||
d->initialized = 1;
|
||||
}
|
||||
|
||||
#define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
|
||||
|
||||
/* return: zero: continue, nonzero: return given value to user */
|
||||
static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
|
||||
struct custom_getopt_data *d)
|
||||
struct custom_getopt_data *d)
|
||||
{
|
||||
/*
|
||||
* Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
|
||||
* moved back by the user (who may also have changed the arguments).
|
||||
*/
|
||||
if (d->last_nonopt > d->custom_optind)
|
||||
d->last_nonopt = d->custom_optind;
|
||||
if (d->first_nonopt > d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* If we have just processed some options following some
|
||||
* non-options, exchange them so that the options come first.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt &&
|
||||
d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->last_nonopt != d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* Skip any additional non-options and extend the range of
|
||||
* non-options previously skipped.
|
||||
*/
|
||||
while (d->custom_optind < argc && NONOPTION_P)
|
||||
d->custom_optind++;
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/*
|
||||
* The special ARGV-element `--' means premature end of options. Skip
|
||||
* it like a null option, then exchange with previous non-options as if
|
||||
* it were an option, then skip everything else like a non-option.
|
||||
*/
|
||||
if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
|
||||
d->custom_optind++;
|
||||
if (d->first_nonopt != d->last_nonopt
|
||||
&& d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->first_nonopt == d->last_nonopt)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
d->last_nonopt = argc;
|
||||
d->custom_optind = argc;
|
||||
}
|
||||
/*
|
||||
* If we have done all the ARGV-elements, stop the scan and back over
|
||||
* any non-options that we skipped and permuted.
|
||||
*/
|
||||
if (d->custom_optind == argc) {
|
||||
/*
|
||||
* Set the next-arg-index to point at the non-options that we
|
||||
* previously skipped, so the caller will digest them.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt)
|
||||
d->custom_optind = d->first_nonopt;
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* If we have come to a non-option and did not permute it, either stop
|
||||
* the scan or describe it to the caller and pass it by.
|
||||
*/
|
||||
if (NONOPTION_P) {
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* We have found another option-ARGV-element. Skip the initial
|
||||
* punctuation.
|
||||
*/
|
||||
d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
|
||||
return 0;
|
||||
/*
|
||||
* Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
|
||||
* moved back by the user (who may also have changed the arguments).
|
||||
*/
|
||||
if (d->last_nonopt > d->custom_optind)
|
||||
d->last_nonopt = d->custom_optind;
|
||||
if (d->first_nonopt > d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* If we have just processed some options following some
|
||||
* non-options, exchange them so that the options come first.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt &&
|
||||
d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->last_nonopt != d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* Skip any additional non-options and extend the range of
|
||||
* non-options previously skipped.
|
||||
*/
|
||||
while (d->custom_optind < argc && NONOPTION_P)
|
||||
d->custom_optind++;
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/*
|
||||
* The special ARGV-element `--' means premature end of options. Skip
|
||||
* it like a null option, then exchange with previous non-options as if
|
||||
* it were an option, then skip everything else like a non-option.
|
||||
*/
|
||||
if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
|
||||
d->custom_optind++;
|
||||
if (d->first_nonopt != d->last_nonopt
|
||||
&& d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->first_nonopt == d->last_nonopt)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
d->last_nonopt = argc;
|
||||
d->custom_optind = argc;
|
||||
}
|
||||
/*
|
||||
* If we have done all the ARGV-elements, stop the scan and back over
|
||||
* any non-options that we skipped and permuted.
|
||||
*/
|
||||
if (d->custom_optind == argc) {
|
||||
/*
|
||||
* Set the next-arg-index to point at the non-options that we
|
||||
* previously skipped, so the caller will digest them.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt)
|
||||
d->custom_optind = d->first_nonopt;
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* If we have come to a non-option and did not permute it, either stop
|
||||
* the scan or describe it to the caller and pass it by.
|
||||
*/
|
||||
if (NONOPTION_P) {
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* We have found another option-ARGV-element. Skip the initial
|
||||
* punctuation.
|
||||
*/
|
||||
d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -592,180 +592,180 @@ static int shuffle_argv(int argc, char *const *argv,const struct option *longopt
|
||||
*
|
||||
*/
|
||||
static int check_long_opt(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
const struct option *longopts, int *longind,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
|
||||
for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all long options for either exact match or abbreviated matches */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
|
||||
if ((unsigned int) (nameend - d->nextchar)
|
||||
== (unsigned int) strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
} else if (pfound == NULL) {
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
} else if (pfound->has_arg != p->has_arg
|
||||
|| pfound->flag != p->flag
|
||||
|| pfound->val != p->val)
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' is ambiguous\n",
|
||||
argv[0], argv[d->custom_optind]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
if (pfound) {
|
||||
option_index = indfound;
|
||||
d->custom_optind++;
|
||||
if (*nameend) {
|
||||
if (pfound->has_arg != no_argument)
|
||||
d->custom_optarg = nameend + 1;
|
||||
else {
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind - 1][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[d->custom_optind - 1][0], pfound->name);
|
||||
}
|
||||
/* Test all long options for either exact match or abbreviated matches */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
|
||||
if ((unsigned int) (nameend - d->nextchar)
|
||||
== (unsigned int) strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
} else if (pfound == NULL) {
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
} else if (pfound->has_arg != p->has_arg
|
||||
|| pfound->flag != p->flag
|
||||
|| pfound->val != p->val)
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' is ambiguous\n",
|
||||
argv[0], argv[d->custom_optind]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
if (pfound) {
|
||||
option_index = indfound;
|
||||
d->custom_optind++;
|
||||
if (*nameend) {
|
||||
if (pfound->has_arg != no_argument)
|
||||
d->custom_optarg = nameend + 1;
|
||||
else {
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind - 1][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[d->custom_optind - 1][0], pfound->name);
|
||||
}
|
||||
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
} else if (pfound->has_arg == required_argument) {
|
||||
if (d->custom_optind < argc)
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
else {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' requires an argument\n",
|
||||
argv[0],
|
||||
argv[d->custom_optind - 1]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag) {
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
/*
|
||||
* Can't find it as a long option. If this is not getopt_long_only, or
|
||||
* the option starts with '--' or is not a valid short option, then
|
||||
* it's an error. Otherwise interpret it as a short option.
|
||||
*/
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `--%s'\n",
|
||||
argv[0], d->nextchar);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `%c%s'\n",
|
||||
argv[0], argv[d->custom_optind][0],
|
||||
d->nextchar);
|
||||
}
|
||||
}
|
||||
d->nextchar = (char *) "";
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
} else if (pfound->has_arg == required_argument) {
|
||||
if (d->custom_optind < argc)
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
else {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' requires an argument\n",
|
||||
argv[0],
|
||||
argv[d->custom_optind - 1]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag) {
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
/*
|
||||
* Can't find it as a long option. If this is not getopt_long_only, or
|
||||
* the option starts with '--' or is not a valid short option, then
|
||||
* it's an error. Otherwise interpret it as a short option.
|
||||
*/
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `--%s'\n",
|
||||
argv[0], d->nextchar);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `%c%s'\n",
|
||||
argv[0], argv[d->custom_optind][0],
|
||||
d->nextchar);
|
||||
}
|
||||
}
|
||||
d->nextchar = (char *) "";
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
|
||||
static int check_short_opt(int argc, char *const *argv, const char *optstring,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
{
|
||||
char c = *d->nextchar++;
|
||||
const char *temp = strchr(optstring, c);
|
||||
char c = *d->nextchar++;
|
||||
const char *temp = strchr(optstring, c);
|
||||
|
||||
/* Increment `custom_optind' when we start to process its last character. */
|
||||
if (*d->nextchar == '\0')
|
||||
++d->custom_optind;
|
||||
if (!temp || c == ':') {
|
||||
if (print_errors)
|
||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
||||
/* Increment `custom_optind' when we start to process its last character. */
|
||||
if (*d->nextchar == '\0')
|
||||
++d->custom_optind;
|
||||
if (!temp || c == ':') {
|
||||
if (print_errors)
|
||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
||||
|
||||
d->custom_optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':') {
|
||||
if (temp[2] == ':') {
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
d->custom_optind++;
|
||||
} else
|
||||
d->custom_optarg = NULL;
|
||||
d->nextchar = NULL;
|
||||
} else {
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
/*
|
||||
* If we end this ARGV-element by taking the
|
||||
* rest as an arg, we must advance to the next
|
||||
* element now.
|
||||
*/
|
||||
d->custom_optind++;
|
||||
} else if (d->custom_optind == argc) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
argv[0], c);
|
||||
}
|
||||
d->custom_optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
} else
|
||||
/*
|
||||
* We already incremented `custom_optind' once;
|
||||
* increment it again when taking next ARGV-elt
|
||||
* as argument.
|
||||
*/
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
d->nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
d->custom_optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':') {
|
||||
if (temp[2] == ':') {
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
d->custom_optind++;
|
||||
} else
|
||||
d->custom_optarg = NULL;
|
||||
d->nextchar = NULL;
|
||||
} else {
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
/*
|
||||
* If we end this ARGV-element by taking the
|
||||
* rest as an arg, we must advance to the next
|
||||
* element now.
|
||||
*/
|
||||
d->custom_optind++;
|
||||
} else if (d->custom_optind == argc) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
argv[0], c);
|
||||
}
|
||||
d->custom_optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
} else
|
||||
/*
|
||||
* We already incremented `custom_optind' once;
|
||||
* increment it again when taking next ARGV-elt
|
||||
* as argument.
|
||||
*/
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
d->nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -839,59 +839,59 @@ static int check_short_opt(int argc, char *const *argv, const char *optstring,
|
||||
*/
|
||||
|
||||
static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
struct custom_getopt_data *d)
|
||||
const struct option *longopts, int *longind,
|
||||
struct custom_getopt_data *d)
|
||||
{
|
||||
int ret, print_errors = d->custom_opterr;
|
||||
int ret, print_errors = d->custom_opterr;
|
||||
|
||||
if (optstring[0] == ':')
|
||||
print_errors = 0;
|
||||
if (argc < 1)
|
||||
return -1;
|
||||
d->custom_optarg = NULL;
|
||||
if (optstring[0] == ':')
|
||||
print_errors = 0;
|
||||
if (argc < 1)
|
||||
return -1;
|
||||
d->custom_optarg = NULL;
|
||||
|
||||
/*
|
||||
* This is a big difference with GNU getopt, since optind == 0
|
||||
* means initialization while here 1 means first call.
|
||||
*/
|
||||
if (d->custom_optind == 0 || !d->initialized) {
|
||||
if (d->custom_optind == 0)
|
||||
d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
custom_getopt_initialize(d);
|
||||
}
|
||||
if (d->nextchar == NULL || *d->nextchar == '\0') {
|
||||
ret = shuffle_argv(argc, argv, longopts, d);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (longopts && (argv[d->custom_optind][1] == '-' ))
|
||||
return check_long_opt(argc, argv, optstring, longopts,
|
||||
longind, print_errors, d);
|
||||
return check_short_opt(argc, argv, optstring, print_errors, d);
|
||||
/*
|
||||
* This is a big difference with GNU getopt, since optind == 0
|
||||
* means initialization while here 1 means first call.
|
||||
*/
|
||||
if (d->custom_optind == 0 || !d->initialized) {
|
||||
if (d->custom_optind == 0)
|
||||
d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
custom_getopt_initialize(d);
|
||||
}
|
||||
if (d->nextchar == NULL || *d->nextchar == '\0') {
|
||||
ret = shuffle_argv(argc, argv, longopts, d);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (longopts && (argv[d->custom_optind][1] == '-' ))
|
||||
return check_long_opt(argc, argv, optstring, longopts,
|
||||
longind, print_errors, d);
|
||||
return check_short_opt(argc, argv, optstring, print_errors, d);
|
||||
}
|
||||
|
||||
static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind)
|
||||
const struct option *longopts, int *longind)
|
||||
{
|
||||
int result;
|
||||
/* Keep a global copy of all internal members of d */
|
||||
static struct custom_getopt_data d;
|
||||
int result;
|
||||
/* Keep a global copy of all internal members of d */
|
||||
static struct custom_getopt_data d;
|
||||
|
||||
d.custom_optind = custom_optind;
|
||||
d.custom_opterr = custom_opterr;
|
||||
result = getopt_internal_r(argc, argv, optstring, longopts,
|
||||
longind, &d);
|
||||
custom_optind = d.custom_optind;
|
||||
custom_optarg = d.custom_optarg;
|
||||
custom_optopt = d.custom_optopt;
|
||||
return result;
|
||||
d.custom_optind = custom_optind;
|
||||
d.custom_opterr = custom_opterr;
|
||||
result = getopt_internal_r(argc, argv, optstring, longopts,
|
||||
longind, &d);
|
||||
custom_optind = d.custom_optind;
|
||||
custom_optarg = d.custom_optarg;
|
||||
custom_optopt = d.custom_optopt;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int custom_getopt_long (int argc, char *const *argv, const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return custom_getopt_internal(argc, argv, options, long_options,
|
||||
opt_index);
|
||||
return custom_getopt_internal(argc, argv, options, long_options,
|
||||
opt_index);
|
||||
}
|
||||
|
||||
|
||||
@ -989,7 +989,7 @@ cmdline_parser_internal (
|
||||
int argc, char * const *argv, struct gengetopt_args_info *args_info,
|
||||
struct cmdline_parser_params *params, const char *additional_error)
|
||||
{
|
||||
int c; /* Character of the parsed option. */
|
||||
int c; /* Character of the parsed option. */
|
||||
|
||||
int error = 0;
|
||||
struct gengetopt_args_info local_args_info;
|
||||
@ -1026,11 +1026,11 @@ cmdline_parser_internal (
|
||||
int option_index = 0;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ "raw", 0, NULL, 'r' },
|
||||
{ "quiet", 0, NULL, 'q' },
|
||||
{ "loadcells", 0, NULL, 'C' },
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ "raw", 0, NULL, 'r' },
|
||||
{ "quiet", 0, NULL, 'q' },
|
||||
{ "loadcells", 0, NULL, 'C' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -1046,21 +1046,21 @@ cmdline_parser_internal (
|
||||
opterr = custom_opterr;
|
||||
optopt = custom_optopt;
|
||||
|
||||
if (c == -1) break; /* Exit from `while (1)' loop. */
|
||||
if (c == -1) break; /* Exit from `while (1)' loop. */
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 'h': /* Print help and exit. */
|
||||
case 'h': /* Print help and exit. */
|
||||
cmdline_parser_print_help ();
|
||||
cmdline_parser_free (&local_args_info);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'V': /* Print version and exit. */
|
||||
case 'V': /* Print version and exit. */
|
||||
cmdline_parser_print_version ();
|
||||
cmdline_parser_free (&local_args_info);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'r': /* Show an unformattet list of all records and subrecords. */
|
||||
case 'r': /* Show an unformattet list of all records and subrecords. */
|
||||
|
||||
|
||||
if (update_arg( 0 ,
|
||||
@ -1072,7 +1072,7 @@ cmdline_parser_internal (
|
||||
goto failure;
|
||||
|
||||
break;
|
||||
case 'q': /* Supress all record information. Useful for speed tests.. */
|
||||
case 'q': /* Supress all record information. Useful for speed tests.. */
|
||||
|
||||
|
||||
if (update_arg( 0 ,
|
||||
@ -1084,7 +1084,7 @@ cmdline_parser_internal (
|
||||
goto failure;
|
||||
|
||||
break;
|
||||
case 'C': /* Browse through contents of all cells.. */
|
||||
case 'C': /* Browse through contents of all cells.. */
|
||||
|
||||
|
||||
if (update_arg( 0 ,
|
||||
@ -1097,12 +1097,12 @@ cmdline_parser_internal (
|
||||
|
||||
break;
|
||||
|
||||
case 0: /* Long option with no short option */
|
||||
case '?': /* Invalid option. */
|
||||
case 0: /* Long option with no short option */
|
||||
case '?': /* Invalid option. */
|
||||
/* `getopt_long' already printed an error message. */
|
||||
goto failure;
|
||||
|
||||
default: /* bug: option not considered. */
|
||||
default: /* bug: option not considered. */
|
||||
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
|
||||
abort ();
|
||||
} /* switch */
|
||||
|
@ -43,11 +43,11 @@ struct gengetopt_args_info
|
||||
const char *quiet_help; /**< @brief Supress all record information. Useful for speed tests. help description. */
|
||||
const char *loadcells_help; /**< @brief Browse through contents of all cells. help description. */
|
||||
|
||||
unsigned int help_given ; /**< @brief Whether help was given. */
|
||||
unsigned int version_given ; /**< @brief Whether version was given. */
|
||||
unsigned int raw_given ; /**< @brief Whether raw was given. */
|
||||
unsigned int quiet_given ; /**< @brief Whether quiet was given. */
|
||||
unsigned int loadcells_given ; /**< @brief Whether loadcells was given. */
|
||||
unsigned int help_given ; /**< @brief Whether help was given. */
|
||||
unsigned int version_given ; /**< @brief Whether version was given. */
|
||||
unsigned int raw_given ; /**< @brief Whether raw was given. */
|
||||
unsigned int quiet_given ; /**< @brief Whether quiet was given. */
|
||||
unsigned int loadcells_given ; /**< @brief Whether loadcells was given. */
|
||||
|
||||
char **inputs ; /**< @brief unamed options (options without names) */
|
||||
unsigned inputs_num ; /**< @brief unamed options number */
|
||||
|
@ -14,16 +14,18 @@ set(GAMEREND
|
||||
mwrender/cellimp.cpp
|
||||
mwrender/interior.cpp
|
||||
mwrender/exterior.cpp
|
||||
mwrender/playerpos.cpp
|
||||
mwrender/sky.cpp)
|
||||
mwrender/sky.cpp
|
||||
mwrender/player.cpp
|
||||
)
|
||||
set(GAMEREND_HEADER
|
||||
mwrender/cell.hpp
|
||||
mwrender/cellimp.hpp
|
||||
mwrender/mwscene.hpp
|
||||
mwrender/interior.hpp
|
||||
mwrender/exterior.hpp
|
||||
mwrender/playerpos.hpp
|
||||
mwrender/sky.hpp)
|
||||
mwrender/sky.hpp
|
||||
mwrender/player.hpp
|
||||
)
|
||||
source_group(apps\\openmw\\mwrender FILES ${GAMEREND} ${GAMEREND_HEADER})
|
||||
|
||||
set(GAMEINPUT
|
||||
@ -103,6 +105,7 @@ set(GAMESCRIPT_HEADER
|
||||
mwscript/controlextensions.hpp
|
||||
mwscript/extensions.hpp
|
||||
mwscript/globalscripts.hpp
|
||||
mwscript/ref.hpp
|
||||
)
|
||||
source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER})
|
||||
|
||||
@ -120,6 +123,7 @@ set(GAMEWORLD
|
||||
mwworld/actiontalk.cpp
|
||||
mwworld/actiontake.cpp
|
||||
mwworld/containerutil.cpp
|
||||
mwworld/player.cpp
|
||||
)
|
||||
set(GAMEWORLD_HEADER
|
||||
mwworld/refdata.hpp
|
||||
@ -137,6 +141,7 @@ set(GAMEWORLD_HEADER
|
||||
mwworld/containerstore.hpp
|
||||
mwworld/manualref.hpp
|
||||
mwworld/containerutil.hpp
|
||||
mwworld/player.hpp
|
||||
)
|
||||
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "mwworld/ptr.hpp"
|
||||
#include "mwworld/environment.hpp"
|
||||
#include "mwworld/class.hpp"
|
||||
#include "mwworld/player.hpp"
|
||||
|
||||
#include "mwclass/classes.hpp"
|
||||
|
||||
@ -67,73 +68,71 @@ void OMW::Engine::executeLocalScripts()
|
||||
|
||||
bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||
{
|
||||
if(! (mEnvironment.mSoundManager->isMusicPlaying()))
|
||||
{
|
||||
// Play some good 'ol tunes
|
||||
mEnvironment.mSoundManager->startRandomTitle();
|
||||
}
|
||||
if(mUseSound && !(mEnvironment.mSoundManager->isMusicPlaying()))
|
||||
{
|
||||
// Play some good 'ol tunes
|
||||
mEnvironment.mSoundManager->startRandomTitle();
|
||||
}
|
||||
|
||||
std::string effect;
|
||||
std::string effect;
|
||||
|
||||
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayer().getPlayer().getCell();
|
||||
//If the region has changed
|
||||
if(!(current->cell->data.flags & current->cell->Interior) && timer.elapsed() >= 10){
|
||||
timer.restart();
|
||||
if (test.name != current->cell->region)
|
||||
{
|
||||
total = 0;
|
||||
test = (ESM::Region) *(mEnvironment.mWorld->getStore().regions.find(current->cell->region));
|
||||
}
|
||||
|
||||
if(test.soundList.size() > 0)
|
||||
{
|
||||
std::vector<ESM::Region::SoundRef>::iterator soundIter = test.soundList.begin();
|
||||
//mEnvironment.mSoundManager
|
||||
if(total == 0){
|
||||
while (!(soundIter == test.soundList.end()))
|
||||
{
|
||||
ESM::NAME32 go = soundIter->sound;
|
||||
int chance = (int) soundIter->chance;
|
||||
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
soundIter++;
|
||||
total += chance;
|
||||
}
|
||||
}
|
||||
|
||||
MWWorld::Ptr::CellStore *current = mEnvironment.mWorld->getPlayerPos().getPlayer().getCell();
|
||||
//If the region has changed
|
||||
if(!(current->cell->data.flags & current->cell->Interior) && timer.elapsed() >= 10){
|
||||
timer.restart();
|
||||
if (test.name != current->cell->region)
|
||||
{
|
||||
total = 0;
|
||||
test = (ESM::Region) *(mEnvironment.mWorld->getStore().regions.find(current->cell->region));
|
||||
}
|
||||
srand ( time(NULL) );
|
||||
int r = rand() % total; //old random code
|
||||
int pos = 0;
|
||||
soundIter = test.soundList.begin();
|
||||
while (!(soundIter == test.soundList.end()))
|
||||
{
|
||||
const ESM::NAME32 go = soundIter->sound;
|
||||
int chance = (int) soundIter->chance;
|
||||
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
soundIter++;
|
||||
if( r - pos < chance)
|
||||
{
|
||||
effect = go.name;
|
||||
//play sound
|
||||
std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
mEnvironment.mSoundManager->playSound(effect, 20.0, 1.0);
|
||||
|
||||
if(test.soundList.size() > 0)
|
||||
{
|
||||
std::vector<ESM::Region::SoundRef>::iterator soundIter = test.soundList.begin();
|
||||
//mEnvironment.mSoundManager
|
||||
if(total == 0){
|
||||
while (!(soundIter == test.soundList.end()))
|
||||
{
|
||||
ESM::NAME32 go = soundIter->sound;
|
||||
int chance = (int) soundIter->chance;
|
||||
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
soundIter++;
|
||||
total += chance;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
srand ( time(NULL) );
|
||||
int r = rand() % total; //old random code
|
||||
int pos = 0;
|
||||
soundIter = test.soundList.begin();
|
||||
while (!(soundIter == test.soundList.end()))
|
||||
{
|
||||
const ESM::NAME32 go = soundIter->sound;
|
||||
int chance = (int) soundIter->chance;
|
||||
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
soundIter++;
|
||||
if( r - pos < chance)
|
||||
{
|
||||
effect = go.name;
|
||||
//play sound
|
||||
std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
|
||||
mEnvironment.mSoundManager->playSound(effect, 20.0, 1.0);
|
||||
}
|
||||
pos += chance;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//mEnvironment.mSoundManager->playSound(effect, 1.0, 1.0);
|
||||
//printf("REGION: %s\n", test.name);
|
||||
|
||||
}
|
||||
pos += chance;
|
||||
}
|
||||
}
|
||||
|
||||
//mEnvironment.mSoundManager->playSound(effect, 1.0, 1.0);
|
||||
//printf("REGION: %s\n", test.name);
|
||||
|
||||
}
|
||||
else if(current->cell->data.flags & current->cell->Interior)
|
||||
{
|
||||
test.name = "";
|
||||
}
|
||||
}
|
||||
else if(current->cell->data.flags & current->cell->Interior)
|
||||
{
|
||||
test.name = "";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@ -184,7 +183,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||
{
|
||||
std::cerr << "Error in framelistener: " << e.what() << std::endl;
|
||||
}
|
||||
//std::cout << "TESTING2";
|
||||
//std::cout << "TESTING2";
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -294,8 +293,8 @@ void OMW::Engine::go()
|
||||
assert (!mCellName.empty());
|
||||
assert (!mMaster.empty());
|
||||
|
||||
test.name = "";
|
||||
total = 0;
|
||||
test.name = "";
|
||||
total = 0;
|
||||
|
||||
|
||||
|
||||
@ -377,7 +376,7 @@ void OMW::Engine::go()
|
||||
}
|
||||
|
||||
// Sets up the input system
|
||||
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(),
|
||||
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayer(),
|
||||
*mEnvironment.mWindowManager, mDebug, *this);
|
||||
mEnvironment.mInputManager = &input;
|
||||
|
||||
@ -439,7 +438,7 @@ void OMW::Engine::activate()
|
||||
&ptr.getRefData().getLocals(), ptr);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action =
|
||||
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayerPos().getPlayer(),
|
||||
MWWorld::Class::get (ptr).activate (ptr, mEnvironment.mWorld->getPlayer().getPlayer(),
|
||||
mEnvironment);
|
||||
|
||||
interpreterContext.activate (ptr, action);
|
||||
|
@ -55,7 +55,7 @@ namespace OMW
|
||||
class Engine : private Ogre::FrameListener
|
||||
{
|
||||
|
||||
//int nFiles;
|
||||
//int nFiles;
|
||||
boost::filesystem::path mDataDir;
|
||||
OEngine::Render::OgreRenderer mOgre;
|
||||
std::string mCellName;
|
||||
@ -72,8 +72,8 @@ namespace OMW
|
||||
Compiler::Extensions mExtensions;
|
||||
Compiler::Context *mScriptContext;
|
||||
OEngine::GUI::MyGUIManager *mGuiManager;
|
||||
ESM::Region test;
|
||||
boost::timer timer;
|
||||
ESM::Region test;
|
||||
boost::timer timer;
|
||||
|
||||
int focusFrameCounter;
|
||||
static const int focusUpdateFrame = 10;
|
||||
|
@ -56,10 +56,10 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
|
||||
bpo::variables_map variables;
|
||||
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
std::string configFilePath(macBundlePath() + "/Contents/MacOS/openmw.cfg");
|
||||
std::ifstream configFile (configFilePath.c_str());
|
||||
std::string configFilePath(macBundlePath() + "/Contents/MacOS/openmw.cfg");
|
||||
std::ifstream configFile (configFilePath.c_str());
|
||||
#else
|
||||
std::ifstream configFile ("openmw.cfg");
|
||||
std::ifstream configFile ("openmw.cfg");
|
||||
#endif
|
||||
|
||||
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
|
||||
|
@ -90,7 +90,7 @@ namespace MWClass
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||
{
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||
}
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore<MWWorld::RefData>& Creature::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
const
|
||||
@ -106,7 +106,7 @@ namespace MWClass
|
||||
}
|
||||
|
||||
return *ptr.getRefData().getContainerStore();
|
||||
}
|
||||
}
|
||||
|
||||
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
|
@ -5,8 +5,7 @@
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwrender/playerpos.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/actionteleport.hpp"
|
||||
@ -65,7 +64,7 @@ namespace MWClass
|
||||
if (ref->ref.teleport)
|
||||
{
|
||||
// teleport door
|
||||
if (environment.mWorld->getPlayerPos().getPlayer()==actor)
|
||||
if (environment.mWorld->getPlayer().getPlayer()==actor)
|
||||
{
|
||||
// the player is using the door
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
|
@ -29,26 +29,26 @@ namespace MWClass
|
||||
void Npc::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||
MWWorld::Environment& environment) const
|
||||
{
|
||||
//Ogre::SceneNode *chest;
|
||||
//Ogre::SceneNode *chest;
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
//Store scenenodes by npc's name + bodypart [0] , npc's name + bodypart [1]
|
||||
//Ex. Fargothchest , Fargothneck
|
||||
|
||||
//Store scenenodes by npc's name + bodypart [0] , npc's name + bodypart [1]
|
||||
//Ex. Fargothchest , Fargothneck
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
std::string hairID = ref->base->hair;
|
||||
std::string hairID = ref->base->hair;
|
||||
std::string headID = ref->base->head;
|
||||
std::string npcName = ref->base->name;
|
||||
std::cout << "NPC: " << npcName << "\n";
|
||||
std::string npcName = ref->base->name;
|
||||
//std::cout << "NPC: " << npcName << "\n";
|
||||
|
||||
//get the part of the bodypart id which describes the race and the gender
|
||||
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||
std::string headModel = "meshes\\" +
|
||||
environment.mWorld->getStore().bodyParts.find(headID)->model;
|
||||
|
||||
std::string hairModel = "meshes\\" +
|
||||
std::string hairModel = "meshes\\" +
|
||||
environment.mWorld->getStore().bodyParts.find(hairID)->model;
|
||||
|
||||
MWRender::Rendering rendering (cellRender, ref->ref);
|
||||
@ -59,200 +59,200 @@ namespace MWClass
|
||||
const ESM::BodyPart *bodyPart =
|
||||
environment.mWorld->getStore().bodyParts.search (bodyRaceID + "chest");
|
||||
|
||||
//bodyPart->model->
|
||||
Ogre::Vector3 pos = Ogre::Vector3( 20, 20, 20);
|
||||
Ogre::Vector3 axis = Ogre::Vector3( 0, 0, 1);
|
||||
Ogre::Radian angle = Ogre::Radian(0);
|
||||
|
||||
std::string addresses[6] = {"", "", "", "","", ""};
|
||||
std::string addresses2[6] = {"", "", "", "", "", ""};
|
||||
std::string upperleft[5] = {"", "", "", "", ""};
|
||||
std::string upperright[5] = {"", "", "", "", ""};
|
||||
std::string neckandup[5] = {"", "", "","",""};
|
||||
std::string empty[6] = {"", "", "", "","", ""};
|
||||
int numbers = 0;
|
||||
int uppernumbers = 0;
|
||||
int neckNumbers = 0;
|
||||
|
||||
//bodyPart->model->
|
||||
Ogre::Vector3 pos = Ogre::Vector3( 20, 20, 20);
|
||||
Ogre::Vector3 axis = Ogre::Vector3( 0, 0, 1);
|
||||
Ogre::Radian angle = Ogre::Radian(0);
|
||||
|
||||
std::string addresses[6] = {"", "", "", "","", ""};
|
||||
std::string addresses2[6] = {"", "", "", "", "", ""};
|
||||
std::string upperleft[5] = {"", "", "", "", ""};
|
||||
std::string upperright[5] = {"", "", "", "", ""};
|
||||
std::string neckandup[5] = {"", "", "","",""};
|
||||
std::string empty[6] = {"", "", "", "","", ""};
|
||||
int numbers = 0;
|
||||
int uppernumbers = 0;
|
||||
int neckNumbers = 0;
|
||||
|
||||
if (bodyPart){
|
||||
|
||||
|
||||
cellRender.insertMesh("meshes\\" + bodyPart->model, pos, axis, angle, npcName + "chest", addresses, numbers, true); //2 0
|
||||
addresses2[numbers] = npcName + "chest";
|
||||
addresses[numbers++] = npcName + "chest";
|
||||
upperleft[uppernumbers] = npcName + "chest";
|
||||
upperright[uppernumbers++] = npcName + "chest";
|
||||
neckandup[neckNumbers++] = npcName + "chest";
|
||||
}
|
||||
//std::cout << "GETTING NPC PART";
|
||||
//Orgre::SceneNode test = cellRender.getNpcPart();
|
||||
addresses2[numbers] = npcName + "chest";
|
||||
addresses[numbers++] = npcName + "chest";
|
||||
upperleft[uppernumbers] = npcName + "chest";
|
||||
upperright[uppernumbers++] = npcName + "chest";
|
||||
neckandup[neckNumbers++] = npcName + "chest";
|
||||
}
|
||||
//std::cout << "GETTING NPC PART";
|
||||
//Orgre::SceneNode test = cellRender.getNpcPart();
|
||||
|
||||
const ESM::BodyPart *upperleg = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
||||
const ESM::BodyPart *groin = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "groin");
|
||||
const ESM::BodyPart *arm = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
||||
const ESM::BodyPart *neck = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "neck");
|
||||
const ESM::BodyPart *knee = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
||||
const ESM::BodyPart *ankle = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
||||
const ESM::BodyPart *foot = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
||||
const ESM::BodyPart *feet = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
||||
const ESM::BodyPart *tail = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
|
||||
const ESM::BodyPart *wrist = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist");
|
||||
const ESM::BodyPart *forearm = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm");
|
||||
const ESM::BodyPart *hand = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand.1st");
|
||||
const ESM::BodyPart *hands = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands.1st");
|
||||
const ESM::BodyPart *upperleg = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper leg");
|
||||
const ESM::BodyPart *groin = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "groin");
|
||||
const ESM::BodyPart *arm = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "upper arm");
|
||||
const ESM::BodyPart *neck = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "neck");
|
||||
const ESM::BodyPart *knee = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "knee");
|
||||
const ESM::BodyPart *ankle = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "ankle");
|
||||
const ESM::BodyPart *foot = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "foot");
|
||||
const ESM::BodyPart *feet = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "feet");
|
||||
const ESM::BodyPart *tail = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "tail");
|
||||
const ESM::BodyPart *wrist = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "wrist");
|
||||
const ESM::BodyPart *forearm = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "forearm");
|
||||
const ESM::BodyPart *hand = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hand.1st");
|
||||
const ESM::BodyPart *hands = environment.mWorld->getStore().bodyParts.search (bodyRaceID + "hands.1st");
|
||||
|
||||
|
||||
std::cout << "RACE" << bodyRaceID << "\n";
|
||||
//std::cout << "RACE" << bodyRaceID << "\n";
|
||||
|
||||
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
|
||||
std::string upperarmpath[2] = {npcName + "chest", npcName + "upper arm"};
|
||||
|
||||
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
|
||||
std::string upperarmpath[2] = {npcName + "chest", npcName + "upper arm"};
|
||||
|
||||
if (groin){
|
||||
cellRender.insertMesh("meshes\\" + groin->model, pos2, axis, Ogre::Radian(3.14), npcName + "groin", addresses, numbers);
|
||||
addresses2[numbers] = npcName + "groin";
|
||||
addresses[numbers++] = npcName + "groin";
|
||||
}
|
||||
if (tail) {
|
||||
cellRender.insertMesh("tail\\" + tail->model, Ogre::Vector3(0 , 0, -76), axis, Ogre::Radian(3.14), npcName + "tail", addresses, numbers, "tail");
|
||||
//std::cout << "TAIL\n";
|
||||
}
|
||||
|
||||
//addresses[1] = npcName + "groin";
|
||||
if(upperleg){
|
||||
cellRender.insertMesh ("meshes\\" + upperleg->model, Ogre::Vector3( 6, 0, -14), axis, Ogre::Radian(3.14), npcName + "upper leg", addresses, numbers); //-18
|
||||
cellRender.insertMesh ("meshes\\" + upperleg->model, Ogre::Vector3( -6, 0, -14), axis, Ogre::Radian(0), npcName + "upper leg2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "upper leg2";
|
||||
addresses[numbers++] = npcName + "upper leg";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
if(knee)
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + knee->model, Ogre::Vector3( 0, -2, -18), axis, Ogre::Radian(0), npcName + "knee", addresses, numbers);
|
||||
//cellRender.rotateMesh(Ogre::Vector3(0, 1, 0), Ogre::Radian (1), npcName + "upper arm");
|
||||
cellRender.insertMesh ("meshes\\" + knee->model, Ogre::Vector3( 0, -2, -18), axis, Ogre::Radian(0), npcName + "knee2", addresses2, numbers);
|
||||
|
||||
addresses2[numbers] = npcName + "knee2";
|
||||
addresses[numbers++] = npcName + "knee";
|
||||
}
|
||||
if(ankle){
|
||||
|
||||
cellRender.insertMesh ("meshes\\" + ankle->model, Ogre::Vector3( 0, -1, -18), axis, Ogre::Radian(0), npcName + "ankle", addresses, numbers); //-1
|
||||
cellRender.insertMesh ("meshes\\" + ankle->model, Ogre::Vector3( 0, -1, -18), axis, Ogre::Radian(0), npcName + "ankle2", addresses2, numbers); //-1
|
||||
|
||||
addresses2[numbers] = npcName + "ankle2";
|
||||
addresses[numbers++] = npcName + "ankle";
|
||||
}
|
||||
if(foot){
|
||||
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
|
||||
{
|
||||
feet = foot;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot", addresses, numbers);
|
||||
addresses2[numbers] = npcName + "groin";
|
||||
addresses[numbers++] = npcName + "groin";
|
||||
}
|
||||
if (tail) {
|
||||
cellRender.insertMesh("tail\\" + tail->model, Ogre::Vector3(0 , 0, -76), axis, Ogre::Radian(3.14), npcName + "tail", addresses, numbers, "tail");
|
||||
//std::cout << "TAIL\n";
|
||||
}
|
||||
|
||||
//addresses[1] = npcName + "groin";
|
||||
if(upperleg){
|
||||
cellRender.insertMesh ("meshes\\" + upperleg->model, Ogre::Vector3( 6, 0, -16), axis, Ogre::Radian(3.14), npcName + "upper leg", addresses, numbers); //-18
|
||||
cellRender.insertMesh ("meshes\\" + upperleg->model, Ogre::Vector3( -6, 0, -16), axis, Ogre::Radian(0), npcName + "upper leg2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "upper leg2";
|
||||
addresses[numbers++] = npcName + "upper leg";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
if(knee)
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + knee->model, Ogre::Vector3( 0, -1, -23), axis, Ogre::Radian(0), npcName + "knee", addresses, numbers);
|
||||
//cellRender.rotateMesh(Ogre::Vector3(0, 1, 0), Ogre::Radian (1), npcName + "upper arm");
|
||||
cellRender.insertMesh ("meshes\\" + knee->model, Ogre::Vector3( 0, -1, -23), axis, Ogre::Radian(0), npcName + "knee2", addresses2, numbers);
|
||||
|
||||
addresses2[numbers] = npcName + "knee2";
|
||||
addresses[numbers++] = npcName + "knee";
|
||||
}
|
||||
if(ankle){
|
||||
|
||||
cellRender.insertMesh ("meshes\\" + ankle->model, Ogre::Vector3( 0, 0, -20), axis, Ogre::Radian(0), npcName + "ankle", addresses, numbers); //-1
|
||||
cellRender.insertMesh ("meshes\\" + ankle->model, Ogre::Vector3( 0,0, -20), axis, Ogre::Radian(0), npcName + "ankle2", addresses2, numbers); //-1
|
||||
|
||||
addresses2[numbers] = npcName + "ankle2";
|
||||
addresses[numbers++] = npcName + "ankle";
|
||||
}
|
||||
if(foot){
|
||||
if(bodyRaceID.compare("b_n_khajiit_m_") == 0)
|
||||
{
|
||||
feet = foot;
|
||||
}
|
||||
else
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot", addresses, numbers);
|
||||
|
||||
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "foot2";
|
||||
addresses[numbers++] = npcName + "foot";
|
||||
}
|
||||
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
if(feet){
|
||||
|
||||
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot", addresses, numbers); //9, 0, -14
|
||||
cellRender.insertMesh ("meshes\\" + foot->model, Ogre::Vector3( 0, -4, -15), axis, Ogre::Radian(0), npcName + "foot2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "foot2";
|
||||
addresses[numbers++] = npcName + "foot";
|
||||
}
|
||||
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
if(feet){
|
||||
|
||||
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot", addresses, numbers); //9, 0, -14
|
||||
|
||||
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "foot2";
|
||||
addresses[numbers++] = npcName + "foot";
|
||||
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
|
||||
|
||||
if (arm){
|
||||
//010
|
||||
cellRender.insertMesh("meshes\\" + arm->model, Ogre::Vector3(-12.5, 0, 104), Ogre::Vector3(0, 1, 0), Ogre::Radian(-3.14 / 2), npcName + "upper arm", upperleft, uppernumbers); //1, 0,.75
|
||||
//cellRender.rotateMesh(Ogre::Vector3(1, 0, 0), Ogre::Radian (.45), upperarmpath, 2); //-.5, 0, -.75
|
||||
cellRender.insertMesh("meshes\\" + arm->model, Ogre::Vector3(12.5, 0, 105), Ogre::Vector3(-.5, 0, -.75), Ogre::Radian(3.14), npcName + "upper arm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "upper arm";
|
||||
upperright[uppernumbers++] = npcName + "upper arm2";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers); //1 -1 1
|
||||
cellRender.rotateMesh(Ogre::Vector3(0, .1, 0), Ogre::Radian(3.14/2), upperleft, uppernumbers);
|
||||
}
|
||||
cellRender.insertMesh ("foot\\" + feet->model, Ogre::Vector3( 7, 4, -16), axis, Ogre::Radian(3.14), npcName + "foot2", addresses2, numbers);
|
||||
addresses2[numbers] = npcName + "foot2";
|
||||
addresses[numbers++] = npcName + "foot";
|
||||
//cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), addresses, numbers);
|
||||
}
|
||||
|
||||
|
||||
if (arm){
|
||||
//010
|
||||
cellRender.insertMesh("meshes\\" + arm->model, Ogre::Vector3(-12.5, 0, 104), Ogre::Vector3(0, 1, 0), Ogre::Radian(-3.14 / 2), npcName + "upper arm", upperleft, uppernumbers); //1, 0,.75
|
||||
//cellRender.rotateMesh(Ogre::Vector3(1, 0, 0), Ogre::Radian (.45), upperarmpath, 2); //-.5, 0, -.75
|
||||
cellRender.insertMesh("meshes\\" + arm->model, Ogre::Vector3(12.5, 0, 105), Ogre::Vector3(-.5, 0, -.75), Ogre::Radian(3.14), npcName + "upper arm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "upper arm";
|
||||
upperright[uppernumbers++] = npcName + "upper arm2";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers); //1 -1 1
|
||||
cellRender.rotateMesh(Ogre::Vector3(0, .1, 0), Ogre::Radian(3.14/2), upperleft, uppernumbers);
|
||||
}
|
||||
|
||||
if (forearm)
|
||||
{
|
||||
//addresses[1] = npcName + "upper arm";
|
||||
cellRender.insertMesh("meshes\\" + forearm->model, Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\" + forearm->model, Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "forearm";
|
||||
upperright[uppernumbers++] = npcName + "forearm2";
|
||||
}
|
||||
//else
|
||||
// std::cout << npcName << "has no forearm";
|
||||
if (wrist)
|
||||
{
|
||||
if(upperleft[uppernumbers - 1].compare(npcName + "upper arm") == 0)
|
||||
{
|
||||
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "forearm";
|
||||
upperright[uppernumbers++] = npcName + "forearm2";
|
||||
if (forearm)
|
||||
{
|
||||
//addresses[1] = npcName + "upper arm";
|
||||
cellRender.insertMesh("meshes\\" + forearm->model, Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\" + forearm->model, Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "forearm";
|
||||
upperright[uppernumbers++] = npcName + "forearm2";
|
||||
}
|
||||
//else
|
||||
// std::cout << npcName << "has no forearm";
|
||||
if (wrist)
|
||||
{
|
||||
if(upperleft[uppernumbers - 1].compare(npcName + "upper arm") == 0)
|
||||
{
|
||||
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\b\\B_N_Argonian_M_Forearm.nif", Ogre::Vector3(-12.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "forearm2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "forearm";
|
||||
upperright[uppernumbers++] = npcName + "forearm2";
|
||||
|
||||
}
|
||||
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "wrist";
|
||||
upperright[uppernumbers++] = npcName + "wrist2";
|
||||
}
|
||||
|
||||
}
|
||||
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist", upperleft, uppernumbers);
|
||||
cellRender.insertMesh("meshes\\" + wrist->model, Ogre::Vector3(-9.5, 0, 0), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "wrist2", upperright, uppernumbers);
|
||||
upperleft[uppernumbers] = npcName + "wrist";
|
||||
upperright[uppernumbers++] = npcName + "wrist2";
|
||||
}
|
||||
|
||||
|
||||
if(hand)
|
||||
{
|
||||
//std::cout << "WE FOUND A HAND\n";
|
||||
//-50, 0, -120
|
||||
//std::cout << "WE FOUND HANDS\n";
|
||||
std::string pass;
|
||||
if(hand->model.compare("b\\B_N_Dark Elf_F_Hands.1st.NIF")==0 && bodyRaceID.compare("b_n_dark elf_m_") == 0)
|
||||
pass = "b\\B_N_Dark Elf_M_Hands.1st.NIF";
|
||||
else
|
||||
pass = hand->model;
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers,false); //0, 100, -100 0,0,120
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0,0), Ogre::Radian(3.14), npcName + "hand2", upperright, uppernumbers, false); //0, 100, -100 0,0,120
|
||||
upperleft[uppernumbers] = npcName + "hand";
|
||||
upperright[uppernumbers++] = npcName + "hand2";
|
||||
//cellRender.rotateMesh(Ogre::Vector3(0, 0,0), Ogre::Radian(3.14), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperright, uppernumbers);
|
||||
}
|
||||
if(hands)
|
||||
{
|
||||
std::string pass;
|
||||
if(hands->model.compare("b\\B_N_Redguard_F_Hands.1st.nif")==0 && bodyRaceID.compare("b_n_redguard_m_") == 0)
|
||||
pass = "b\\B_N_Redguard_M_Hands.1st.nif";
|
||||
else if(hands->model.compare("b\\B_N_Imperial_M_Hands.1st.nif") == 0 && bodyRaceID.compare("b_n_nord_m_") == 0)
|
||||
pass = "b\\B_N_Nord_M_Hands.1st.nif";
|
||||
else
|
||||
pass =hands->model; //-50, 0, -120
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1,-110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers, false); //0, 100, -100 42, 0, -110
|
||||
//cellRender.insertMesh("meshes\\" + hands->model, Ogre::Vector3(42, 0,110), Ogre::Vector3(1, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers, false); //0, 100, -100 42, 0, -110
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand2", upperright, uppernumbers, false); //0, 100, -100 0,0,120
|
||||
upperleft[uppernumbers] = npcName + "hand";
|
||||
upperright[uppernumbers++] = npcName + "hand2";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperright, uppernumbers);
|
||||
}
|
||||
if(hand)
|
||||
{
|
||||
//std::cout << "WE FOUND A HAND\n";
|
||||
//-50, 0, -120
|
||||
//std::cout << "WE FOUND HANDS\n";
|
||||
std::string pass;
|
||||
if(hand->model.compare("b\\B_N_Dark Elf_F_Hands.1st.NIF")==0 && bodyRaceID.compare("b_n_dark elf_m_") == 0)
|
||||
pass = "b\\B_N_Dark Elf_M_Hands.1st.NIF";
|
||||
else
|
||||
pass = hand->model;
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers,false); //0, 100, -100 0,0,120
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0,0), Ogre::Radian(3.14), npcName + "hand2", upperright, uppernumbers, false); //0, 100, -100 0,0,120
|
||||
upperleft[uppernumbers] = npcName + "hand";
|
||||
upperright[uppernumbers++] = npcName + "hand2";
|
||||
//cellRender.rotateMesh(Ogre::Vector3(0, 0,0), Ogre::Radian(3.14), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperright, uppernumbers);
|
||||
}
|
||||
if(hands)
|
||||
{
|
||||
std::string pass;
|
||||
if(hands->model.compare("b\\B_N_Redguard_F_Hands.1st.nif")==0 && bodyRaceID.compare("b_n_redguard_m_") == 0)
|
||||
pass = "b\\B_N_Redguard_M_Hands.1st.nif";
|
||||
else if(hands->model.compare("b\\B_N_Imperial_M_Hands.1st.nif") == 0 && bodyRaceID.compare("b_n_nord_m_") == 0)
|
||||
pass = "b\\B_N_Nord_M_Hands.1st.nif";
|
||||
else
|
||||
pass =hands->model; //-50, 0, -120
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1,-110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers, false); //0, 100, -100 42, 0, -110
|
||||
//cellRender.insertMesh("meshes\\" + hands->model, Ogre::Vector3(42, 0,110), Ogre::Vector3(1, 0, 0), Ogre::Radian(3.14), npcName + "hand", upperleft, uppernumbers, false); //0, 100, -100 42, 0, -110
|
||||
cellRender.insertMesh("meshes\\" + pass, Ogre::Vector3(42, 1, -110), Ogre::Vector3(0, 0, 0), Ogre::Radian(3.14), npcName + "hand2", upperright, uppernumbers, false); //0, 100, -100 0,0,120
|
||||
upperleft[uppernumbers] = npcName + "hand";
|
||||
upperright[uppernumbers++] = npcName + "hand2";
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperleft, uppernumbers);
|
||||
cellRender.scaleMesh(Ogre::Vector3(1, -1, 1), upperright, uppernumbers);
|
||||
}
|
||||
|
||||
//neck will reset chest counter
|
||||
if(neck)
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + neck->model, Ogre::Vector3( 0, 0, 120), axis, Ogre::Radian(3.14), npcName + "neck", neckandup, neckNumbers);
|
||||
neckandup[neckNumbers++] = npcName + "neck";
|
||||
}
|
||||
cellRender.insertMesh (headModel, Ogre::Vector3( 0, 0, 5), axis, Ogre::Radian(0), npcName + "head", neckandup, neckNumbers);
|
||||
neckandup[neckNumbers++] = npcName + "head";
|
||||
cellRender.insertMesh (hairModel, Ogre::Vector3( 0, -1, 0), axis, Ogre::Radian(0), npcName + "hair", neckandup, neckNumbers);
|
||||
ref->mData.setHandle (rendering.end (ref->mData.isEnabled()));
|
||||
|
||||
}
|
||||
//neck will reset chest counter
|
||||
if(neck)
|
||||
{
|
||||
cellRender.insertMesh ("meshes\\" + neck->model, Ogre::Vector3( 0, 0, 120), axis, Ogre::Radian(3.14), npcName + "neck", neckandup, neckNumbers);
|
||||
neckandup[neckNumbers++] = npcName + "neck";
|
||||
}
|
||||
cellRender.insertMesh (headModel, Ogre::Vector3( 0, 0, 5), axis, Ogre::Radian(0), npcName + "head", neckandup, neckNumbers);
|
||||
neckandup[neckNumbers++] = npcName + "head";
|
||||
cellRender.insertMesh (hairModel, Ogre::Vector3( 0, -1, 0), axis, Ogre::Radian(0), npcName + "hair", neckandup, neckNumbers);
|
||||
ref->mData.setHandle (rendering.end (ref->mData.isEnabled()));
|
||||
|
||||
}
|
||||
|
||||
void Npc::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||
{
|
||||
|
@ -5,12 +5,10 @@
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
static bool isChest;
|
||||
//static ;bool isChest = false;
|
||||
class Npc : public MWWorld::Class
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return ID of \a ptr
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
@ -225,7 +226,7 @@ namespace MWDialogue
|
||||
|
||||
// check cell
|
||||
if (!info.cell.empty())
|
||||
if (mEnvironment.mWorld->getPlayerPos().getPlayer().getCell()->cell->name != info.cell)
|
||||
if (mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
||||
return false;
|
||||
|
||||
// TODO check DATAstruct
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
|
@ -89,53 +89,53 @@ void MWSkill::onClicked(MyGUI::Widget* _sender)
|
||||
|
||||
void MWSkill::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name)
|
||||
{
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
|
||||
initialiseWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
MWSkill::~MWSkill()
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
shutdownWidgetSkin();
|
||||
}
|
||||
|
||||
void MWSkill::baseChangeWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
void MWSkill::initialiseWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter)
|
||||
{
|
||||
{
|
||||
const std::string &name = *(*iter)->_getInternalData<std::string>();
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned");
|
||||
skillNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillValueWidget, "widget already assigned");
|
||||
skillValueWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatNameButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned");
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned");
|
||||
skillNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillValueWidget, "widget already assigned");
|
||||
skillValueWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatNameButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned");
|
||||
MyGUI::ButtonPtr button = (*iter)->castType<Button>();
|
||||
skillNameWidget = button;
|
||||
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MWSkill::onClicked);
|
||||
}
|
||||
else if (name == "StatValueButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillValueWidget, "widget already assigned");
|
||||
}
|
||||
else if (name == "StatValueButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! skillValueWidget, "widget already assigned");
|
||||
MyGUI::ButtonPtr button = (*iter)->castType<Button>();
|
||||
skillNameWidget = button;
|
||||
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MWSkill::onClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MWSkill::shutdownWidgetSkin()
|
||||
@ -208,53 +208,53 @@ void MWAttribute::updateWidgets()
|
||||
|
||||
void MWAttribute::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name)
|
||||
{
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
|
||||
initialiseWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
MWAttribute::~MWAttribute()
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
shutdownWidgetSkin();
|
||||
}
|
||||
|
||||
void MWAttribute::baseChangeWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
void MWAttribute::initialiseWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter)
|
||||
{
|
||||
{
|
||||
const std::string &name = *(*iter)->_getInternalData<std::string>();
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeNameWidget, "widget already assigned");
|
||||
attributeNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeValueWidget, "widget already assigned");
|
||||
attributeValueWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatNameButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeNameWidget, "widget already assigned");
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeNameWidget, "widget already assigned");
|
||||
attributeNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeValueWidget, "widget already assigned");
|
||||
attributeValueWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "StatNameButton")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeNameWidget, "widget already assigned");
|
||||
MyGUI::ButtonPtr button = (*iter)->castType<Button>();
|
||||
attributeNameWidget = button;
|
||||
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MWAttribute::onClicked);
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeValueWidget, "widget already assigned");
|
||||
}
|
||||
else if (name == "StatValue")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! attributeValueWidget, "widget already assigned");
|
||||
MyGUI::ButtonPtr button = (*iter)->castType<Button>();
|
||||
attributeNameWidget = button;
|
||||
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MWAttribute::onClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MWAttribute::shutdownWidgetSkin()
|
||||
@ -308,34 +308,34 @@ void MWSpell::updateWidgets()
|
||||
|
||||
void MWSpell::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name)
|
||||
{
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
|
||||
initialiseWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
MWSpell::~MWSpell()
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
shutdownWidgetSkin();
|
||||
}
|
||||
|
||||
void MWSpell::baseChangeWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
void MWSpell::initialiseWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter)
|
||||
{
|
||||
{
|
||||
const std::string &name = *(*iter)->_getInternalData<std::string>();
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! spellNameWidget, "widget already assigned");
|
||||
spellNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
}
|
||||
if (name == "StatName")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! spellNameWidget, "widget already assigned");
|
||||
spellNameWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MWSpell::shutdownWidgetSkin()
|
||||
@ -423,39 +423,39 @@ void MWSpellEffect::updateWidgets()
|
||||
|
||||
void MWSpellEffect::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name)
|
||||
{
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
|
||||
|
||||
initialiseWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
MWSpellEffect::~MWSpellEffect()
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
shutdownWidgetSkin();
|
||||
}
|
||||
|
||||
void MWSpellEffect::baseChangeWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
shutdownWidgetSkin();
|
||||
Base::baseChangeWidgetSkin(_info);
|
||||
initialiseWidgetSkin(_info);
|
||||
}
|
||||
|
||||
void MWSpellEffect::initialiseWidgetSkin(ResourceSkin* _info)
|
||||
{
|
||||
for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter)
|
||||
{
|
||||
{
|
||||
const std::string &name = *(*iter)->_getInternalData<std::string>();
|
||||
if (name == "Text")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! textWidget, "widget already assigned");
|
||||
textWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "Image")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! imageWidget, "widget already assigned");
|
||||
imageWidget = (*iter)->castType<StaticImage>();
|
||||
}
|
||||
}
|
||||
if (name == "Text")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! textWidget, "widget already assigned");
|
||||
textWidget = (*iter)->castType<StaticText>();
|
||||
}
|
||||
else if (name == "Image")
|
||||
{
|
||||
MYGUI_DEBUG_ASSERT( ! imageWidget, "widget already assigned");
|
||||
imageWidget = (*iter)->castType<StaticImage>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MWSpellEffect::shutdownWidgetSkin()
|
||||
|
@ -43,7 +43,7 @@ namespace MWGui
|
||||
const SkillValue& getSkillValue() const { return value; }
|
||||
|
||||
// Events
|
||||
typedef delegates::CDelegate1<MWSkill*> EventHandle_SkillVoid;
|
||||
typedef delegates::CDelegate1<MWSkill*> EventHandle_SkillVoid;
|
||||
|
||||
/** Event : Skill clicked.\n
|
||||
signature : void method(MWSkill* _sender)\n
|
||||
@ -51,18 +51,18 @@ namespace MWGui
|
||||
EventHandle_SkillVoid eventClicked;
|
||||
|
||||
/*internal:*/
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
|
||||
protected:
|
||||
virtual ~MWSkill();
|
||||
virtual ~MWSkill();
|
||||
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
|
||||
void onClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
|
||||
void updateWidgets();
|
||||
|
||||
@ -90,7 +90,7 @@ namespace MWGui
|
||||
const AttributeValue& getAttributeValue() const { return value; }
|
||||
|
||||
// Events
|
||||
typedef delegates::CDelegate1<MWAttribute*> EventHandle_AttributeVoid;
|
||||
typedef delegates::CDelegate1<MWAttribute*> EventHandle_AttributeVoid;
|
||||
|
||||
/** Event : Attribute clicked.\n
|
||||
signature : void method(MWAttribute* _sender)\n
|
||||
@ -98,18 +98,18 @@ namespace MWGui
|
||||
EventHandle_AttributeVoid eventClicked;
|
||||
|
||||
/*internal:*/
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
|
||||
protected:
|
||||
virtual ~MWAttribute();
|
||||
virtual ~MWAttribute();
|
||||
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
|
||||
void onClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
|
||||
void updateWidgets();
|
||||
|
||||
@ -137,16 +137,16 @@ namespace MWGui
|
||||
const std::string &getSpellId() const { return id; }
|
||||
|
||||
/*internal:*/
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
|
||||
protected:
|
||||
virtual ~MWSpell();
|
||||
virtual ~MWSpell();
|
||||
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
|
||||
void updateWidgets();
|
||||
|
||||
@ -171,16 +171,16 @@ namespace MWGui
|
||||
const SpellEffectValue &getSpellEffect() const { return effect; }
|
||||
|
||||
/*internal:*/
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
|
||||
|
||||
protected:
|
||||
virtual ~MWSpellEffect();
|
||||
virtual ~MWSpellEffect();
|
||||
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
void baseChangeWidgetSkin(ResourceSkin* _info);
|
||||
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
private:
|
||||
void initialiseWidgetSkin(ResourceSkin* _info);
|
||||
void shutdownWidgetSkin();
|
||||
|
||||
void updateWidgets();
|
||||
|
||||
|
@ -15,10 +15,13 @@
|
||||
#include <mangle/input/filters/eventlist.hpp>
|
||||
|
||||
#include <libs/platform/strings.h>
|
||||
#include "../mwrender/playerpos.hpp"
|
||||
|
||||
#include "../engine.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwrender/player.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <OgreRoot.h>
|
||||
@ -76,7 +79,7 @@ namespace MWInput
|
||||
OEngine::Input::Poller poller;
|
||||
OEngine::Render::MouseLookEventPtr mouse;
|
||||
OEngine::GUI::EventInjectorPtr guiEvents;
|
||||
MWRender::PlayerPos &player;
|
||||
MWWorld::Player &player;
|
||||
MWGui::WindowManager &windows;
|
||||
OMW::Engine& mEngine;
|
||||
|
||||
@ -142,7 +145,7 @@ namespace MWInput
|
||||
|
||||
public:
|
||||
InputImpl(OEngine::Render::OgreRenderer &_ogre,
|
||||
MWRender::PlayerPos &_player,
|
||||
MWWorld::Player &_player,
|
||||
MWGui::WindowManager &_windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine)
|
||||
@ -182,7 +185,7 @@ namespace MWInput
|
||||
ogre.getRoot()->addFrameListener(this);
|
||||
|
||||
// Set up the mouse handler and tell it about the player camera
|
||||
mouse = MouseLookEventPtr(new MouseLookEvent(player.getCamera()));
|
||||
mouse = MouseLookEventPtr(new MouseLookEvent(player.getRenderer()->getCamera()));
|
||||
|
||||
// This event handler pumps events into MyGUI
|
||||
guiEvents = EventInjectorPtr(new EventInjector(windows.getGui()));
|
||||
@ -295,7 +298,7 @@ namespace MWInput
|
||||
{
|
||||
// Start mouse-looking again. TODO: This should also allow
|
||||
// for other ways to disable mouselook, like paralyzation.
|
||||
mouse->setCamera(player.getCamera());
|
||||
mouse->setCamera(player.getRenderer()->getCamera());
|
||||
|
||||
// Disable GUI events
|
||||
guiEvents->enabled = false;
|
||||
@ -304,7 +307,7 @@ namespace MWInput
|
||||
};
|
||||
|
||||
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
|
||||
MWRender::PlayerPos &player,
|
||||
MWWorld::Player &player,
|
||||
MWGui::WindowManager &windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine)
|
||||
@ -318,7 +321,7 @@ namespace MWInput
|
||||
}
|
||||
|
||||
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
|
||||
{
|
||||
{
|
||||
impl->setGuiMode(mode);
|
||||
}
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ namespace OEngine
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
namespace MWWorld
|
||||
{
|
||||
class PlayerPos;
|
||||
class Player;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
@ -42,7 +42,7 @@ namespace MWInput
|
||||
|
||||
public:
|
||||
MWInputManager(OEngine::Render::OgreRenderer &_ogre,
|
||||
MWRender::PlayerPos &_player,
|
||||
MWWorld::Player&_player,
|
||||
MWGui::WindowManager &_windows,
|
||||
bool debug,
|
||||
OMW::Engine& engine);
|
||||
|
@ -8,12 +8,13 @@
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
void MechanicsManager::buildPlayer()
|
||||
{
|
||||
MWWorld::Ptr ptr = mEnvironment.mWorld->getPlayerPos().getPlayer();
|
||||
MWWorld::Ptr ptr = mEnvironment.mWorld->getPlayer().getPlayer();
|
||||
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
|
||||
@ -33,9 +34,9 @@ namespace MWMechanics
|
||||
{
|
||||
const ESM::Race *race =
|
||||
mEnvironment.mWorld->getStore().races.find (
|
||||
mEnvironment.mWorld->getPlayerPos().getRace());
|
||||
mEnvironment.mWorld->getPlayer().getRace());
|
||||
|
||||
bool male = mEnvironment.mWorld->getPlayerPos().isMale();
|
||||
bool male = mEnvironment.mWorld->getPlayer().isMale();
|
||||
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
@ -75,11 +76,11 @@ namespace MWMechanics
|
||||
}
|
||||
|
||||
// birthsign
|
||||
if (!mEnvironment.mWorld->getPlayerPos().getBirthsign().empty())
|
||||
if (!mEnvironment.mWorld->getPlayer().getBirthsign().empty())
|
||||
{
|
||||
const ESM::BirthSign *sign =
|
||||
mEnvironment.mWorld->getStore().birthSigns.find (
|
||||
mEnvironment.mWorld->getPlayerPos().getBirthsign());
|
||||
mEnvironment.mWorld->getPlayer().getBirthsign());
|
||||
|
||||
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
|
||||
iter!=sign->powers.list.end(); ++iter)
|
||||
@ -91,7 +92,7 @@ namespace MWMechanics
|
||||
// class
|
||||
if (mClassSelected)
|
||||
{
|
||||
const ESM::Class& class_ = mEnvironment.mWorld->getPlayerPos().getClass();
|
||||
const ESM::Class& class_ = mEnvironment.mWorld->getPlayer().getClass();
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
@ -330,12 +331,12 @@ namespace MWMechanics
|
||||
if (mUpdatePlayer)
|
||||
{
|
||||
// basic player profile; should not change anymore after the creation phase is finished.
|
||||
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayerPos().getName());
|
||||
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayer().getName());
|
||||
mEnvironment.mWindowManager->setValue ("race",
|
||||
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayerPos().
|
||||
mEnvironment.mWorld->getStore().races.find (mEnvironment.mWorld->getPlayer().
|
||||
getRace())->name);
|
||||
mEnvironment.mWindowManager->setValue ("class",
|
||||
mEnvironment.mWorld->getPlayerPos().getClass().name);
|
||||
mEnvironment.mWorld->getPlayer().getClass().name);
|
||||
mUpdatePlayer = false;
|
||||
|
||||
MWGui::WindowManager::SkillList majorSkills (5);
|
||||
@ -343,8 +344,8 @@ namespace MWMechanics
|
||||
|
||||
for (int i=0; i<5; ++i)
|
||||
{
|
||||
minorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][0];
|
||||
majorSkills[i] = mEnvironment.mWorld->getPlayerPos().getClass().data.skills[i][1];
|
||||
minorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][0];
|
||||
majorSkills[i] = mEnvironment.mWorld->getPlayer().getClass().data.skills[i][1];
|
||||
}
|
||||
|
||||
mEnvironment.mWindowManager->configureSkills (majorSkills, minorSkills);
|
||||
@ -353,14 +354,14 @@ namespace MWMechanics
|
||||
|
||||
void MechanicsManager::setPlayerName (const std::string& name)
|
||||
{
|
||||
mEnvironment.mWorld->getPlayerPos().setName (name);
|
||||
mEnvironment.mWorld->getPlayer().setName (name);
|
||||
mUpdatePlayer = true;
|
||||
}
|
||||
|
||||
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
||||
{
|
||||
mEnvironment.mWorld->getPlayerPos().setGender (male);
|
||||
mEnvironment.mWorld->getPlayerPos().setRace (race);
|
||||
mEnvironment.mWorld->getPlayer().setGender (male);
|
||||
mEnvironment.mWorld->getPlayer().setRace (race);
|
||||
mRaceSelected = true;
|
||||
buildPlayer();
|
||||
mUpdatePlayer = true;
|
||||
@ -368,14 +369,14 @@ namespace MWMechanics
|
||||
|
||||
void MechanicsManager::setPlayerBirthsign (const std::string& id)
|
||||
{
|
||||
mEnvironment.mWorld->getPlayerPos().setBirthsign (id);
|
||||
mEnvironment.mWorld->getPlayer().setBirthsign (id);
|
||||
buildPlayer();
|
||||
mUpdatePlayer = true;
|
||||
}
|
||||
|
||||
void MechanicsManager::setPlayerClass (const std::string& id)
|
||||
{
|
||||
mEnvironment.mWorld->getPlayerPos().setClass (*mEnvironment.mWorld->getStore().classes.find (id));
|
||||
mEnvironment.mWorld->getPlayer().setClass (*mEnvironment.mWorld->getStore().classes.find (id));
|
||||
mClassSelected = true;
|
||||
buildPlayer();
|
||||
mUpdatePlayer = true;
|
||||
@ -383,7 +384,7 @@ namespace MWMechanics
|
||||
|
||||
void MechanicsManager::setPlayerClass (const ESM::Class& class_)
|
||||
{
|
||||
mEnvironment.mWorld->getPlayerPos().setClass (class_);
|
||||
mEnvironment.mWorld->getPlayer().setClass (class_);
|
||||
mClassSelected = true;
|
||||
buildPlayer();
|
||||
mUpdatePlayer = true;
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace Ogre
|
||||
{
|
||||
class SceneNode;
|
||||
class Vector3;
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
@ -37,13 +37,13 @@ namespace MWRender
|
||||
/// start inserting a new reference.
|
||||
virtual void insertBegin (ESM::CellRef &ref) = 0;
|
||||
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements) = 0;
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements) = 0;
|
||||
/// insert a mesh related to the most recent insertBegin call.
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst) = 0;
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements) = 0;
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst) = 0;
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements) = 0;
|
||||
virtual void insertMesh(const std::string &mesh) = 0;
|
||||
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements) = 0;
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements) = 0;
|
||||
|
||||
|
||||
/// insert a light related to the most recent insertBegin call.
|
||||
|
@ -63,26 +63,26 @@ void ExteriorCellRender::insertBegin (ESM::CellRef &ref)
|
||||
|
||||
void ExteriorCellRender::rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements)
|
||||
{
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->rotate(axis, angle);
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->rotate(axis, angle);
|
||||
}
|
||||
/*
|
||||
void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements){
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
NIFLoader::load(mesh);
|
||||
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||
|
||||
@ -97,92 +97,99 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
||||
*/
|
||||
void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements)
|
||||
{
|
||||
insertMesh(mesh, vec, axis, angle, sceneNodeName, sceneParent, elements, true);
|
||||
insertMesh(mesh, vec, axis, angle, sceneNodeName, sceneParent, elements, true);
|
||||
}
|
||||
void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst){
|
||||
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
MeshPtr good2 = NIFLoader::load(mesh);
|
||||
|
||||
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||
|
||||
|
||||
if(translateFirst){
|
||||
npcPart->translate(vec);
|
||||
npcPart->rotate(axis, angle);
|
||||
}
|
||||
else{
|
||||
|
||||
npcPart->rotate(axis, angle);
|
||||
npcPart->translate(vec);
|
||||
}
|
||||
npcPart->attachObject(ent);
|
||||
|
||||
Ogre::MeshManager *m = MeshManager::getSingletonPtr();
|
||||
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
|
||||
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail1);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot1);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail2);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot2);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail3);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot3);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail4);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot4);
|
||||
good2->reload();
|
||||
}
|
||||
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
|
||||
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail1);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot1);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail2);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot2);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail3);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot3);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail4);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot4);
|
||||
good2->reload();
|
||||
}
|
||||
}
|
||||
// insert a mesh related to the most recent insertBegin call.
|
||||
|
||||
void ExteriorCellRender::scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements)
|
||||
{
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->scale(axis);
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->scale(axis);
|
||||
}
|
||||
|
||||
// insert a mesh related to the most recent insertBegin call.
|
||||
|
@ -54,7 +54,7 @@ namespace MWRender
|
||||
Ogre::SceneNode *base;
|
||||
|
||||
Ogre::SceneNode *insert;
|
||||
Ogre::SceneNode *npcPart;
|
||||
Ogre::SceneNode *npcPart;
|
||||
|
||||
// 0 normal, 1 more bright, 2 max
|
||||
int ambientMode;
|
||||
@ -65,12 +65,12 @@ namespace MWRender
|
||||
virtual void insertBegin (ESM::CellRef &ref);
|
||||
|
||||
/// insert a mesh related to the most recent insertBegin call.
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst);
|
||||
|
||||
virtual void insertMesh(const std::string &mesh);
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
|
||||
virtual void insertMesh(const std::string &mesh);
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
|
||||
/// insert a light related to the most recent insertBegin call.
|
||||
virtual void insertLight(float r, float g, float b, float radius);
|
||||
@ -85,7 +85,7 @@ namespace MWRender
|
||||
void configureFog();
|
||||
|
||||
void setAmbientMode();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -65,52 +65,52 @@ void InteriorCellRender::insertBegin (ESM::CellRef &ref)
|
||||
// insert a mesh related to the most recent insertBegin call.
|
||||
void InteriorCellRender::rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements)
|
||||
{
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->rotate(axis, angle);
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->rotate(axis, angle);
|
||||
}
|
||||
// insert a mesh related to the most recent insertBegin call.
|
||||
|
||||
void InteriorCellRender::scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements)
|
||||
{
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->scale(axis);
|
||||
assert(insert);
|
||||
Ogre::SceneNode *parent = insert;
|
||||
//std::cout << "ELEMENTS:" << elements;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneNodeName[i] != "" && parent->getChild(sceneNodeName[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneNodeName[i]));
|
||||
}
|
||||
parent->scale(axis);
|
||||
}
|
||||
void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements)
|
||||
{
|
||||
insertMesh(mesh, vec, axis, angle, sceneNodeName, sceneParent, elements, true);
|
||||
insertMesh(mesh, vec, axis, angle, sceneNodeName, sceneParent, elements, true);
|
||||
}
|
||||
void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst){
|
||||
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
//npcPart->showBoundingBox(true);
|
||||
assert (insert);
|
||||
//insert->
|
||||
Ogre::SceneNode *parent = insert;
|
||||
for (int i = 0; i < elements; i++){
|
||||
if(sceneParent[i] != "" && parent->getChild(sceneParent[i]))
|
||||
parent = dynamic_cast<Ogre::SceneNode*> (parent->getChild(sceneParent[i]));
|
||||
}
|
||||
|
||||
npcPart = parent->createChildSceneNode(sceneNodeName);
|
||||
//npcPart->showBoundingBox(true);
|
||||
|
||||
MeshPtr good2 = NIFLoader::load(mesh);
|
||||
|
||||
MovableObject *ent = scene.getMgr()->createEntity(mesh);
|
||||
//ent->extr
|
||||
|
||||
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
|
||||
// );
|
||||
|
||||
// MovableObject *ent2 = scene.getMgr()->createEntity(bounds
|
||||
// );
|
||||
//ent->
|
||||
//std::cout << mesh << bounds << "\n";
|
||||
|
||||
@ -119,7 +119,7 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
||||
npcPart->rotate(axis, angle);
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
npcPart->rotate(axis, angle);
|
||||
npcPart->translate(vec);
|
||||
}
|
||||
@ -127,55 +127,55 @@ void InteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
||||
npcPart->attachObject(ent);
|
||||
Ogre::MeshManager *m = MeshManager::getSingletonPtr();
|
||||
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
|
||||
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail1);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot1);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail2);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot2);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail3);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot3);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail4);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot4);
|
||||
good2->reload();
|
||||
}
|
||||
const std::string beastfoot1 ="foot\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beastfoot2 ="foot\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beastfoot3 ="foot\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beastfoot4 ="foot\\b\\B_N_Argonian_M_Skins.nif";
|
||||
if(mesh.compare(beast1) == 0 && m->getByName(beasttail1).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail1);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot1);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast2) == 0 && m->getByName(beasttail2).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGKHAJIITM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail2);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot2);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast3) == 0 && m->getByName(beasttail3).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANF\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail3);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot3);
|
||||
good2->reload();
|
||||
}
|
||||
else if(mesh.compare(beast4) == 0 && m->getByName(beasttail4).isNull())
|
||||
{
|
||||
//std::cout << "CLONINGARGONIANM\n";
|
||||
good2->reload();
|
||||
MeshPtr tail = good2->clone(beasttail4);
|
||||
good2->reload();
|
||||
MeshPtr foot = good2->clone(beastfoot4);
|
||||
good2->reload();
|
||||
}
|
||||
}
|
||||
|
||||
void InteriorCellRender::insertMesh(const std::string &mesh)
|
||||
|
@ -29,7 +29,7 @@ namespace MWRender
|
||||
|
||||
class InteriorCellRender : public CellRender, private CellRenderImp
|
||||
{
|
||||
//static bool isChest;
|
||||
//static bool isChest;
|
||||
static bool lightConst;
|
||||
static float lightConstValue;
|
||||
|
||||
@ -54,7 +54,7 @@ namespace MWRender
|
||||
Ogre::SceneNode *base;
|
||||
|
||||
Ogre::SceneNode *insert;
|
||||
Ogre::SceneNode *npcPart;
|
||||
Ogre::SceneNode *npcPart;
|
||||
|
||||
// 0 normal, 1 more bright, 2 max
|
||||
int ambientMode;
|
||||
@ -63,12 +63,12 @@ namespace MWRender
|
||||
|
||||
/// start inserting a new reference.
|
||||
virtual void insertBegin (ESM::CellRef &ref);
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
|
||||
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
/// insert a mesh related to the most recent insertBegin call.
|
||||
virtual void insertMesh(const std::string &mesh);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements);
|
||||
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst);
|
||||
/// insert a light related to the most recent insertBegin call.
|
||||
virtual void insertLight(float r, float g, float b, float radius);
|
||||
|
||||
@ -93,7 +93,7 @@ namespace MWRender
|
||||
virtual ~InteriorCellRender() { destroy(); }
|
||||
|
||||
/// Make the cell visible. Load the cell if necessary.
|
||||
//virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
//virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
|
||||
virtual void show();
|
||||
|
||||
/// Remove the cell from rendering, but don't remove it from
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include <components/esm/loadstat.hpp>
|
||||
|
||||
#include "player.hpp"
|
||||
|
||||
using namespace MWRender;
|
||||
using namespace Ogre;
|
||||
|
||||
@ -38,6 +40,13 @@ MWScene::MWScene(OEngine::Render::OgreRenderer &_rend)
|
||||
|
||||
//used to obtain ingame information of ogre objects (which are faced or selected)
|
||||
mRaySceneQuery = rend.getScene()->createRayQuery(Ray());
|
||||
|
||||
mPlayer = new MWRender::Player (getCamera());
|
||||
}
|
||||
|
||||
MWScene::~MWScene()
|
||||
{
|
||||
delete mPlayer;
|
||||
}
|
||||
|
||||
std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
|
||||
|
@ -20,36 +20,41 @@ namespace MWWorld
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
/** Class responsible for Morrowind-specific interfaces to OGRE.
|
||||
class Player;
|
||||
|
||||
This might be refactored partially into a non-mw specific
|
||||
counterpart in ogre/ at some point.
|
||||
*/
|
||||
class MWScene
|
||||
{
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
/// \brief 3D-scene (rendering and physics)
|
||||
|
||||
// Root node for all objects added to the scene. This is rotated so
|
||||
// that the OGRE coordinate system matches that used internally in
|
||||
// Morrowind.
|
||||
Ogre::SceneNode *mwRoot;
|
||||
Ogre::RaySceneQuery *mRaySceneQuery;
|
||||
class MWScene
|
||||
{
|
||||
OEngine::Render::OgreRenderer &rend;
|
||||
|
||||
public:
|
||||
MWScene(OEngine::Render::OgreRenderer &_rend);
|
||||
/// Root node for all objects added to the scene. This is rotated so
|
||||
/// that the OGRE coordinate system matches that used internally in
|
||||
/// Morrowind.
|
||||
Ogre::SceneNode *mwRoot;
|
||||
Ogre::RaySceneQuery *mRaySceneQuery;
|
||||
|
||||
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
||||
Ogre::RaySceneQuery *getRaySceneQuery() { return mRaySceneQuery; }
|
||||
MWRender::Player *mPlayer;
|
||||
|
||||
//gets the handle of the object the player is looking at
|
||||
//pair<name, distance>
|
||||
//name is empty and distance = -1 if there is no object which
|
||||
//can be faced
|
||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||
};
|
||||
public:
|
||||
|
||||
MWScene (OEngine::Render::OgreRenderer &_rend);
|
||||
|
||||
~MWScene();
|
||||
|
||||
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
||||
Ogre::RaySceneQuery *getRaySceneQuery() { return mRaySceneQuery; }
|
||||
MWRender::Player *getPlayer() { return mPlayer; }
|
||||
|
||||
/// Gets the handle of the object the player is looking at
|
||||
/// pair<name, distance>
|
||||
/// name is empty and distance = -1 if there is no object which
|
||||
/// can be faced
|
||||
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
8
apps/openmw/mwrender/player.cpp
Normal file
8
apps/openmw/mwrender/player.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
#include "player.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
Player::Player (Ogre::Camera *camera) : mCamera (camera)
|
||||
{}
|
||||
}
|
24
apps/openmw/mwrender/player.hpp
Normal file
24
apps/openmw/mwrender/player.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef GAME_MWRENDER_PLAYER_H
|
||||
#define GAME_MWRENDER_PLAYER_H
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Camera;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
/// \brief Player character rendering and camera control
|
||||
class Player
|
||||
{
|
||||
Ogre::Camera *mCamera;
|
||||
|
||||
public:
|
||||
|
||||
Player (Ogre::Camera *camera);
|
||||
|
||||
Ogre::Camera *getCamera() { return mCamera; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,41 +0,0 @@
|
||||
|
||||
#include "playerpos.hpp"
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
PlayerPos::PlayerPos (Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world) :
|
||||
mCellStore (0), camera(cam), mWorld (world), mClass (0)
|
||||
{
|
||||
mPlayer.base = player;
|
||||
mName = player->name;
|
||||
mMale = !(player->flags & ESM::NPC::Female);
|
||||
mRace = player->race;
|
||||
mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0;
|
||||
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
|
||||
}
|
||||
|
||||
PlayerPos::~PlayerPos()
|
||||
{
|
||||
delete mClass;
|
||||
}
|
||||
|
||||
void PlayerPos::setPos(float x, float y, float z, bool updateCamera)
|
||||
{
|
||||
mWorld.moveObject (getPlayer(), x, y, z);
|
||||
|
||||
if (updateCamera)
|
||||
camera->setPosition (Ogre::Vector3 (
|
||||
mPlayer.ref.pos.pos[0],
|
||||
mPlayer.ref.pos.pos[2],
|
||||
-mPlayer.ref.pos.pos[1]));
|
||||
}
|
||||
|
||||
void PlayerPos::setClass (const ESM::Class& class_)
|
||||
{
|
||||
ESM::Class *new_class = new ESM::Class (class_);
|
||||
delete mClass;
|
||||
mClass = new_class;
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
#ifndef _MWRENDER_PLAYERPOS_H
|
||||
#define _MWRENDER_PLAYERPOS_H
|
||||
|
||||
#include "OgreCamera.h"
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
// This class keeps track of the player position. It takes care of
|
||||
// camera movement, sound listener updates, and collision handling
|
||||
// (to be done).
|
||||
class PlayerPos
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||
MWWorld::Ptr::CellStore *mCellStore;
|
||||
Ogre::Camera *camera;
|
||||
MWWorld::World& mWorld;
|
||||
std::string mName;
|
||||
bool mMale;
|
||||
std::string mRace;
|
||||
std::string mBirthsign;
|
||||
ESM::Class *mClass;
|
||||
|
||||
public:
|
||||
|
||||
PlayerPos(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world);
|
||||
|
||||
~PlayerPos();
|
||||
|
||||
// Set the player position. Uses Morrowind coordinates.
|
||||
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
||||
|
||||
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||
{
|
||||
mCellStore = cellStore;
|
||||
}
|
||||
|
||||
Ogre::Camera *getCamera() { return camera; }
|
||||
|
||||
// Move the player relative to her own position and
|
||||
// orientation. After the call, the new position is returned.
|
||||
void moveRel(float &relX, float &relY, float &relZ)
|
||||
{
|
||||
using namespace Ogre;
|
||||
|
||||
// Move camera relative to its own direction
|
||||
camera->moveRelative(Vector3(relX,0,relZ));
|
||||
|
||||
// Up/down movement is always done relative the world axis.
|
||||
camera->move(Vector3(0,relY,0));
|
||||
|
||||
// Get new camera position, converting back to MW coords.
|
||||
Vector3 pos = camera->getPosition();
|
||||
relX = pos[0];
|
||||
relY = -pos[2];
|
||||
relZ = pos[1];
|
||||
|
||||
// TODO: Collision detection must be used to find the REAL new
|
||||
// position.
|
||||
|
||||
// Set the position
|
||||
setPos(relX, relY, relZ);
|
||||
}
|
||||
|
||||
MWWorld::Ptr getPlayer()
|
||||
{
|
||||
MWWorld::Ptr ptr (&mPlayer, mCellStore);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void setName (const std::string& name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
void setGender (bool male)
|
||||
{
|
||||
mMale = male;
|
||||
}
|
||||
|
||||
void setRace (const std::string& race)
|
||||
{
|
||||
mRace = race;
|
||||
}
|
||||
|
||||
void setBirthsign (const std::string& birthsign)
|
||||
{
|
||||
mBirthsign = birthsign;
|
||||
}
|
||||
|
||||
void setClass (const ESM::Class& class_);
|
||||
|
||||
std::string getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
bool isMale() const
|
||||
{
|
||||
return mMale;
|
||||
}
|
||||
|
||||
std::string getRace() const
|
||||
{
|
||||
return mRace;
|
||||
}
|
||||
|
||||
std::string getBirthsign() const
|
||||
{
|
||||
return mBirthsign;
|
||||
}
|
||||
|
||||
const ESM::Class& getClass() const
|
||||
{
|
||||
return *mClass;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -15,46 +16,14 @@ namespace MWScript
|
||||
{
|
||||
namespace Ai
|
||||
{
|
||||
template<class R>
|
||||
class OpAiTravel : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
Interpreter::Type_Float x = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float y = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float z = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
// discard additional arguments (reset), because we have no idea what they mean.
|
||||
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
|
||||
|
||||
std::cout << "AiTravel: " << x << ", " << y << ", " << z << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class OpAiTravelExplicit : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Float x = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
@ -72,56 +41,14 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpAiEscort : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
std::string actor = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float duration = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float x = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float y = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float z = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
// discard additional arguments (reset), because we have no idea what they mean.
|
||||
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
|
||||
|
||||
std::cout << "AiEscort: " << x << ", " << y << ", " << z << ", " << duration
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class OpAiEscortExplicit : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string actor = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
@ -146,16 +73,14 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetAiPackageDone : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = 0;
|
||||
|
||||
@ -163,25 +88,6 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetAiPackageDoneExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
Interpreter::Type_Integer value = 0;
|
||||
|
||||
runtime.push (value);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const int opcodeAiTravel = 0x20000;
|
||||
@ -204,12 +110,13 @@ namespace MWScript
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment3 (opcodeAiTravel, new OpAiTravel);
|
||||
interpreter.installSegment3 (opcodeAiTravelExplicit, new OpAiTravelExplicit);
|
||||
interpreter.installSegment3 (opcodeAiEscort, new OpAiEscort);
|
||||
interpreter.installSegment3 (opcodeAiEscortExplicit, new OpAiEscortExplicit);
|
||||
interpreter.installSegment5 (opcodeGetAiPackageDone, new OpGetAiPackageDone);
|
||||
interpreter.installSegment5 (opcodeGetAiPackageDoneExplicit, new OpGetAiPackageDoneExplicit);
|
||||
interpreter.installSegment3 (opcodeAiTravel, new OpAiTravel<ImplicitRef>);
|
||||
interpreter.installSegment3 (opcodeAiTravelExplicit, new OpAiTravel<ExplicitRef>);
|
||||
interpreter.installSegment3 (opcodeAiEscort, new OpAiEscort<ImplicitRef>);
|
||||
interpreter.installSegment3 (opcodeAiEscortExplicit, new OpAiEscort<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetAiPackageDone, new OpGetAiPackageDone<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetAiPackageDoneExplicit,
|
||||
new OpGetAiPackageDone<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,21 @@
|
||||
#include "../mwworld/containerutil.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Container
|
||||
{
|
||||
template<class R>
|
||||
class OpAddItem : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
@ -37,40 +41,6 @@ namespace MWScript
|
||||
if (count<0)
|
||||
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWWorld::ManualRef ref (context.getWorld().getStore(), item);
|
||||
|
||||
ref.getPtr().getRefData().setCount (count);
|
||||
|
||||
MWWorld::Class::get (ref.getPtr()).insertIntoContainer (ref.getPtr(),
|
||||
MWWorld::Class::get (ptr).getContainerStore (ptr));
|
||||
}
|
||||
};
|
||||
|
||||
class OpAddItemExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer count = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
if (count<0)
|
||||
throw std::runtime_error ("second argument for AddItem must be non-negative");
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWWorld::ManualRef ref (context.getWorld().getStore(), item);
|
||||
|
||||
ref.getPtr().getRefData().setCount (count);
|
||||
@ -80,55 +50,21 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetItemCount : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
std::vector<MWWorld::Ptr> list;
|
||||
|
||||
MWWorld::listItemsInContainer (item,
|
||||
MWWorld::Class::get (ptr).getContainerStore (ptr),
|
||||
context.getWorld().getStore(), list);
|
||||
|
||||
Interpreter::Type_Integer sum = 0;
|
||||
|
||||
for (std::vector<MWWorld::Ptr>::iterator iter (list.begin()); iter!=list.end();
|
||||
++iter)
|
||||
{
|
||||
sum += iter->getRefData().getCount();
|
||||
}
|
||||
|
||||
runtime.push (sum);
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetItemCountExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
std::vector<MWWorld::Ptr> list;
|
||||
|
||||
MWWorld::listItemsInContainer (item,
|
||||
@ -147,12 +83,15 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpRemoveItem : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
@ -165,58 +104,6 @@ namespace MWScript
|
||||
if (count<0)
|
||||
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
std::vector<MWWorld::Ptr> list;
|
||||
|
||||
MWWorld::listItemsInContainer (item,
|
||||
MWWorld::Class::get (ptr).getContainerStore (ptr),
|
||||
context.getWorld().getStore(), list);
|
||||
|
||||
for (std::vector<MWWorld::Ptr>::iterator iter (list.begin());
|
||||
iter!=list.end() && count;
|
||||
++iter)
|
||||
{
|
||||
if (iter->getRefData().getCount()<=count)
|
||||
{
|
||||
count -= iter->getRefData().getCount();
|
||||
iter->getRefData().setCount (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->getRefData().setCount (iter->getRefData().getCount()-count);
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// To be fully compatible with original Morrowind, we would need to check if
|
||||
// count is >= 0 here and throw an exception. But let's be tollerant instead.
|
||||
}
|
||||
};
|
||||
|
||||
class OpRemoveItemExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer count = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
if (count<0)
|
||||
throw std::runtime_error ("second argument for RemoveItem must be non-negative");
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
std::vector<MWWorld::Ptr> list;
|
||||
|
||||
MWWorld::listItemsInContainer (item,
|
||||
@ -262,12 +149,12 @@ namespace MWScript
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeAddItem, new OpAddItem);
|
||||
interpreter.installSegment5 (opcodeAddItemExplicit, new OpAddItemExplicit);
|
||||
interpreter.installSegment5 (opcodeGetItemCount, new OpGetItemCount);
|
||||
interpreter.installSegment5 (opcodeGetItemCountExplicit, new OpGetItemCountExplicit);
|
||||
interpreter.installSegment5 (opcodeRemoveItem, new OpRemoveItem);
|
||||
interpreter.installSegment5 (opcodeRemoveItemExplicit, new OpRemoveItemExplicit);
|
||||
interpreter.installSegment5 (opcodeAddItem, new OpAddItem<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeAddItemExplicit, new OpAddItem<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetItemCount, new OpGetItemCount<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetItemCountExplicit, new OpGetItemCount<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeRemoveItem, new OpRemoveItem<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeRemoveItemExplicit, new OpRemoveItem<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
#include <iostream>
|
||||
@ -35,10 +37,24 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpToggleCollision : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context
|
||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
context.getWorld().getPlayer().toggleCollisionMode();
|
||||
}
|
||||
};
|
||||
|
||||
const int numberOfControls = 7;
|
||||
|
||||
const int opcodeEnable = 0x200007e;
|
||||
const int opcodeDisable = 0x2000085;
|
||||
const int opcodeToggleCollision = 0x2000130;
|
||||
|
||||
const char *controls[numberOfControls] =
|
||||
{
|
||||
@ -56,6 +72,8 @@ namespace MWScript
|
||||
extensions.registerInstruction (enable + controls[i], "", opcodeEnable+i);
|
||||
extensions.registerInstruction (disable + controls[i], "", opcodeDisable+i);
|
||||
}
|
||||
|
||||
extensions.registerInstruction ("togglecollision", "", opcodeToggleCollision);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
@ -65,6 +83,8 @@ namespace MWScript
|
||||
interpreter.installSegment5 (opcodeEnable+i, new OpSetControl (controls[i], true));
|
||||
interpreter.installSegment5 (opcodeDisable+i, new OpSetControl (controls[i], false));
|
||||
}
|
||||
|
||||
interpreter.installSegment5 (opcodeToggleCollision, new OpToggleCollision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,4 +101,5 @@ op 0x20000c4-0x20000de: SetSkill
|
||||
op 0x20000df-0x20000f9: SetSkill, explicit reference
|
||||
op 0x20000fa-0x2000114: ModSkill
|
||||
op 0x2000115-0x200012f: ModSKill, explicit reference
|
||||
opcodes 0x2000130-0x3ffffff unused
|
||||
op 0x2000130: ToggleCollision
|
||||
opcodes 0x2000131-0x3ffffff unused
|
||||
|
@ -7,10 +7,11 @@
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Misc
|
||||
@ -55,42 +56,14 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpLock : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
Interpreter::Type_Integer lockLevel = 100;
|
||||
|
||||
if (arg0==1)
|
||||
{
|
||||
lockLevel = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
}
|
||||
|
||||
MWWorld::Class::get (ptr).lock (ptr, lockLevel);
|
||||
}
|
||||
};
|
||||
|
||||
class OpLockExplicit : public Interpreter::Opcode1
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer lockLevel = 100;
|
||||
|
||||
@ -104,34 +77,14 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpUnlock : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWWorld::Class::get (ptr).unlock (ptr);
|
||||
}
|
||||
};
|
||||
|
||||
class OpUnlockExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWWorld::Class::get (ptr).unlock (ptr);
|
||||
}
|
||||
@ -160,10 +113,10 @@ namespace MWScript
|
||||
interpreter.installSegment5 (opcodeXBox, new OpXBox);
|
||||
interpreter.installSegment5 (opcodeOnActivate, new OpOnActivate);
|
||||
interpreter.installSegment5 (opcodeActivate, new OpActivate);
|
||||
interpreter.installSegment3 (opcodeLock, new OpLock);
|
||||
interpreter.installSegment3 (opcodeLockExplicit, new OpLockExplicit);
|
||||
interpreter.installSegment5 (opcodeUnlock, new OpUnlock);
|
||||
interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlockExplicit);
|
||||
interpreter.installSegment3 (opcodeLock, new OpLock<ImplicitRef>);
|
||||
interpreter.installSegment3 (opcodeLockExplicit, new OpLock<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
41
apps/openmw/mwscript/ref.hpp
Normal file
41
apps/openmw/mwscript/ref.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef GAME_MWSCRIPT_REF_H
|
||||
#define GAME_MWSCRIPT_REF_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
struct ExplicitRef
|
||||
{
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
return context.getWorld().getPtr (id, false);
|
||||
}
|
||||
};
|
||||
|
||||
struct ImplicitRef
|
||||
{
|
||||
MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
return context.getReference();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -7,22 +7,26 @@
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Sound
|
||||
{
|
||||
template<class R>
|
||||
class OpSay : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
@ -32,296 +36,173 @@ namespace MWScript
|
||||
std::string text = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().say (context.getReference(), file);
|
||||
context.getSoundManager().say (ptr, file);
|
||||
context.messageBox (text);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpSayDone : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
runtime.push (context.getSoundManager().sayDone (context.getReference()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
runtime.push (context.getSoundManager().sayDone (ptr));
|
||||
}
|
||||
};
|
||||
|
||||
class OpStreamMusic : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getSoundManager().streamMusic (sound);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
class OpPlaySound : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getSoundManager().playSound (sound, 1.0, 1.0);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class OpPlaySoundVP : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
|
||||
Interpreter::Type_Float volume = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getSoundManager().playSound (sound, volume, pitch);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpPlaySound3D : public Interpreter::Opcode0
|
||||
{
|
||||
bool mLoop;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
OpPlaySound3D (bool loop) : mLoop (loop) {}
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().playSound3D (context.getReference(), sound,
|
||||
1.0, 1.0, mLoop);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
context.getSoundManager().playSound3D (ptr, sound, 1.0, 1.0, mLoop);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpPlaySoundVP3D : public Interpreter::Opcode0
|
||||
{
|
||||
bool mLoop;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
OpPlaySoundVP3D (bool loop) : mLoop (loop) {}
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
|
||||
Interpreter::Type_Float volume = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().playSound3D (context.getReference(), sound, volume,
|
||||
pitch, mLoop);
|
||||
|
||||
}
|
||||
};
|
||||
context.getSoundManager().playSound3D (ptr, sound, volume, pitch, mLoop);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpStopSound : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().stopSound3D (context.getReference(), sound);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
context.getSoundManager().stopSound3D (ptr, sound);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetSoundPlaying : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
|
||||
int index = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
runtime.push (context.getSoundManager().getSoundPlaying (
|
||||
context.getReference(), runtime.getStringLiteral (index)));
|
||||
}
|
||||
ptr, runtime.getStringLiteral (index)));
|
||||
}
|
||||
};
|
||||
|
||||
class OpSayExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string file = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string text = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().say (context.getWorld().getPtr (id, true),
|
||||
file);
|
||||
}
|
||||
};
|
||||
|
||||
class OpSayDoneExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
runtime.push (context.getSoundManager().sayDone (
|
||||
context.getWorld().getPtr (id, true)));
|
||||
}
|
||||
};
|
||||
|
||||
class OpPlaySound3DExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
bool mLoop;
|
||||
|
||||
public:
|
||||
|
||||
OpPlaySound3DExplicit (bool loop) : mLoop (loop) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().playSound3D (
|
||||
context.getWorld().getPtr (id, true), sound, 1.0, 1.0, mLoop);
|
||||
}
|
||||
};
|
||||
|
||||
class OpPlaySoundVP3DExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
bool mLoop;
|
||||
|
||||
public:
|
||||
|
||||
OpPlaySoundVP3DExplicit (bool loop) : mLoop (loop) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float volume = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().playSound3D (
|
||||
context.getWorld().getPtr (id, true), sound, volume, pitch, mLoop);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class OpStopSoundExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
context.getSoundManager().stopSound3D (
|
||||
context.getWorld().getPtr (id, true), sound);
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetSoundPlayingExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
int index = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
runtime.push (context.getSoundManager().getSoundPlaying (
|
||||
context.getWorld().getPtr (id, true),
|
||||
runtime.getStringLiteral (index)));
|
||||
}
|
||||
};
|
||||
|
||||
const int opcodeSay = 0x2000001;
|
||||
const int opcodeSayDone = 0x2000002;
|
||||
const int opcodeStreamMusic = 0x2000003;
|
||||
@ -342,7 +223,7 @@ namespace MWScript
|
||||
const int opcodePlayLoopSound3DVPExplicit = 0x200001e;
|
||||
const int opcodeStopSoundExplicit = 0x200001f;
|
||||
const int opcodeGetSoundPlayingExplicit = 0x2000020;
|
||||
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
extensions.registerInstruction ("say", "SS", opcodeSay, opcodeSayExplicit);
|
||||
@ -361,37 +242,37 @@ namespace MWScript
|
||||
extensions.registerInstruction ("stopsound", "c", opcodeStopSound,
|
||||
opcodeStopSoundExplicit);
|
||||
extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying,
|
||||
opcodeGetSoundPlayingExplicit);
|
||||
opcodeGetSoundPlayingExplicit);
|
||||
}
|
||||
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeSay, new OpSay);
|
||||
interpreter.installSegment5 (opcodeSayDone, new OpSayDone);
|
||||
interpreter.installSegment5 (opcodeSay, new OpSay<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeSayDone, new OpSayDone<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeStreamMusic, new OpStreamMusic);
|
||||
interpreter.installSegment5 (opcodePlaySound, new OpPlaySound);
|
||||
interpreter.installSegment5 (opcodePlaySoundVP, new OpPlaySoundVP);
|
||||
interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D (false));
|
||||
interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D (false));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D (true));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DVP, new OpPlaySoundVP3D (true));
|
||||
interpreter.installSegment5 (opcodeStopSound, new OpStopSound);
|
||||
interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying);
|
||||
|
||||
interpreter.installSegment5 (opcodeSayExplicit, new OpSayExplicit);
|
||||
interpreter.installSegment5 (opcodeSayDoneExplicit, new OpSayDoneExplicit);
|
||||
interpreter.installSegment5 (opcodePlaySound3DExplicit,
|
||||
new OpPlaySound3DExplicit (false));
|
||||
interpreter.installSegment5 (opcodePlaySound3DVPExplicit,
|
||||
new OpPlaySoundVP3DExplicit (false));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DExplicit,
|
||||
new OpPlaySound3DExplicit (true));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DVPExplicit,
|
||||
new OpPlaySoundVP3DExplicit (true));
|
||||
interpreter.installSegment5 (opcodeStopSoundExplicit, new OpStopSoundExplicit);
|
||||
interpreter.installSegment5 (opcodeGetSoundPlayingExplicit,
|
||||
new OpGetSoundPlayingExplicit);
|
||||
}
|
||||
}
|
||||
}
|
||||
interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D<ImplicitRef> (false));
|
||||
interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D<ImplicitRef> (false));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D<ImplicitRef> (true));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DVP,
|
||||
new OpPlaySoundVP3D<ImplicitRef> (true));
|
||||
interpreter.installSegment5 (opcodeStopSound, new OpStopSound<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying<ImplicitRef>);
|
||||
|
||||
interpreter.installSegment5 (opcodeSayExplicit, new OpSay<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeSayDoneExplicit, new OpSayDone<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodePlaySound3DExplicit,
|
||||
new OpPlaySound3D<ExplicitRef> (false));
|
||||
interpreter.installSegment5 (opcodePlaySound3DVPExplicit,
|
||||
new OpPlaySoundVP3D<ExplicitRef> (false));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DExplicit,
|
||||
new OpPlaySound3D<ExplicitRef> (true));
|
||||
interpreter.installSegment5 (opcodePlayLoopSound3DVPExplicit,
|
||||
new OpPlaySoundVP3D<ExplicitRef> (true));
|
||||
interpreter.installSegment5 (opcodeStopSoundExplicit, new OpStopSound<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetSoundPlayingExplicit,
|
||||
new OpGetSoundPlaying<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,13 @@
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Stats
|
||||
{
|
||||
template<class R>
|
||||
class OpGetAttribute : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -27,36 +29,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
getModified();
|
||||
|
||||
runtime.push (value);
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetAttributeExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpGetAttributeExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
@ -66,6 +39,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpSetAttribute : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -76,45 +50,17 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
class OpSetAttributeExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpSetAttributeExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpModAttribute : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -125,14 +71,11 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
value += MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
getModified();
|
||||
|
||||
@ -141,36 +84,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpModAttributeExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpModAttributeExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
value +=
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
getModified();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex].
|
||||
setModified (value, 0, 100);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetDynamic : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -181,46 +95,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr))
|
||||
{
|
||||
// health is a special case
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getItemMaxHealth (ptr);
|
||||
runtime.push (value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
||||
getCurrent();
|
||||
|
||||
runtime.push (value);
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetDynamicExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpGetDynamicExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr))
|
||||
{
|
||||
@ -240,6 +115,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpSetDynamic : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -250,45 +126,17 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
class OpSetDynamicExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpSetDynamicExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpModDynamic : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -299,14 +147,11 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
||||
@ -318,40 +163,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpModDynamicExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpModDynamicExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWMechanics::CreatureStats& stats =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
||||
|
||||
stats.mDynamic[mIndex].setModified (
|
||||
diff + stats.mDynamic[mIndex].getModified(), 0);
|
||||
|
||||
stats.mDynamic[mIndex].setCurrent (diff + current);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class R>
|
||||
class OpModCurrentDynamic : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -362,14 +174,11 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
||||
@ -378,36 +187,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpModCurrentDynamicExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpModCurrentDynamicExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer diff = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWMechanics::CreatureStats& stats =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent();
|
||||
|
||||
stats.mDynamic[mIndex].setCurrent (diff + current);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetDynamicGetRatio : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -418,10 +198,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
@ -436,38 +213,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetDynamicGetRatioExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpGetDynamicGetRatioExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWMechanics::CreatureStats& stats =
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr);
|
||||
|
||||
Interpreter::Type_Float value = 0;
|
||||
|
||||
Interpreter::Type_Float max = stats.mDynamic[mIndex].getModified();
|
||||
|
||||
if (max>0)
|
||||
value = stats.mDynamic[mIndex].getCurrent() / max;
|
||||
|
||||
runtime.push (value);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetSkill : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -478,36 +224,7 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
getModified();
|
||||
|
||||
runtime.push (value);
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetSkillExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpGetSkillExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value =
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
@ -517,6 +234,7 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpSetSkill : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -527,45 +245,17 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
class OpSetSkillExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpSetSkillExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
setModified (value, 0);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpModSkill : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
@ -576,14 +266,11 @@ namespace MWScript
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getReference();
|
||||
|
||||
value += MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
getModified();
|
||||
|
||||
@ -592,36 +279,6 @@ namespace MWScript
|
||||
}
|
||||
};
|
||||
|
||||
class OpModSkillExplicit : public Interpreter::Opcode0
|
||||
{
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
|
||||
OpModSkillExplicit (int index) : mIndex (index) {}
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWScript::InterpreterContext& context
|
||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||
|
||||
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Ptr ptr = context.getWorld().getPtr (id, false);
|
||||
|
||||
value +=
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
getModified();
|
||||
|
||||
MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex].
|
||||
setModified (value, 0, 100);
|
||||
}
|
||||
};
|
||||
|
||||
const int numberOfAttributes = 8;
|
||||
|
||||
const int opcodeGetAttribute = 0x2000027;
|
||||
@ -729,53 +386,54 @@ namespace MWScript
|
||||
{
|
||||
for (int i=0; i<numberOfAttributes; ++i)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeGetAttribute+i, new OpGetAttribute (i));
|
||||
interpreter.installSegment5 (opcodeGetAttribute+i, new OpGetAttribute<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeGetAttributeExplicit+i,
|
||||
new OpGetAttributeExplicit (i));
|
||||
new OpGetAttribute<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeSetAttribute+i, new OpSetAttribute (i));
|
||||
interpreter.installSegment5 (opcodeSetAttribute+i, new OpSetAttribute<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeSetAttributeExplicit+i,
|
||||
new OpSetAttributeExplicit (i));
|
||||
new OpSetAttribute<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeModAttribute+i, new OpModAttribute (i));
|
||||
interpreter.installSegment5 (opcodeModAttribute+i, new OpModAttribute<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeModAttributeExplicit+i,
|
||||
new OpModAttributeExplicit (i));
|
||||
new OpModAttribute<ExplicitRef> (i));
|
||||
}
|
||||
|
||||
for (int i=0; i<numberOfDynamics; ++i)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeGetDynamic+i, new OpGetDynamic (i));
|
||||
interpreter.installSegment5 (opcodeGetDynamic+i, new OpGetDynamic<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeGetDynamicExplicit+i,
|
||||
new OpGetDynamicExplicit (i));
|
||||
new OpGetDynamic<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeSetDynamic+i, new OpSetDynamic (i));
|
||||
interpreter.installSegment5 (opcodeSetDynamic+i, new OpSetDynamic<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeSetDynamicExplicit+i,
|
||||
new OpSetDynamicExplicit (i));
|
||||
new OpSetDynamic<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeModDynamic+i, new OpModDynamic (i));
|
||||
interpreter.installSegment5 (opcodeModDynamic+i, new OpModDynamic<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeModDynamicExplicit+i,
|
||||
new OpModDynamicExplicit (i));
|
||||
new OpModDynamic<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeModCurrentDynamic+i, new OpModCurrentDynamic (i));
|
||||
interpreter.installSegment5 (opcodeModCurrentDynamic+i,
|
||||
new OpModCurrentDynamic<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeModCurrentDynamicExplicit+i,
|
||||
new OpModCurrentDynamicExplicit (i));
|
||||
new OpModCurrentDynamic<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeGetDynamicGetRatio+i,
|
||||
new OpGetDynamicGetRatio (i));
|
||||
new OpGetDynamicGetRatio<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeGetDynamicGetRatioExplicit+i,
|
||||
new OpGetDynamicGetRatioExplicit (i));
|
||||
new OpGetDynamicGetRatio<ExplicitRef> (i));
|
||||
}
|
||||
|
||||
for (int i=0; i<numberOfSkills; ++i)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeGetSkill+i, new OpGetSkill (i));
|
||||
interpreter.installSegment5 (opcodeGetSkillExplicit+i, new OpGetSkillExplicit (i));
|
||||
interpreter.installSegment5 (opcodeGetSkill+i, new OpGetSkill<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeGetSkillExplicit+i, new OpGetSkill<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeSetSkill+i, new OpSetSkill (i));
|
||||
interpreter.installSegment5 (opcodeSetSkillExplicit+i, new OpSetSkillExplicit (i));
|
||||
interpreter.installSegment5 (opcodeSetSkill+i, new OpSetSkill<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeSetSkillExplicit+i, new OpSetSkill<ExplicitRef> (i));
|
||||
|
||||
interpreter.installSegment5 (opcodeModSkill+i, new OpModSkill (i));
|
||||
interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkillExplicit (i));
|
||||
interpreter.installSegment5 (opcodeModSkill+i, new OpModSkill<ImplicitRef> (i));
|
||||
interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill<ExplicitRef> (i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace MWSound
|
||||
sounds based on the sound factory it is given.
|
||||
*/
|
||||
OEManagerPtr mgr;
|
||||
SoundPtr music;
|
||||
SoundPtr music;
|
||||
|
||||
/* This class calls update() on the sound manager each frame
|
||||
using and Ogre::FrameListener
|
||||
@ -310,7 +310,7 @@ namespace MWSound
|
||||
bool useSound)
|
||||
: mData(NULL)
|
||||
{
|
||||
MP3Lookup(dataDir / "Music/Explore/");
|
||||
MP3Lookup(dataDir / "Music/Explore/");
|
||||
if(useSound)
|
||||
mData = new SoundImpl(root, camera, store, (dataDir / "Sound").file_string());
|
||||
}
|
||||
@ -323,60 +323,64 @@ namespace MWSound
|
||||
|
||||
void SoundManager::MP3Lookup(boost::filesystem::path dir)
|
||||
{
|
||||
boost::filesystem::directory_iterator dir_iter(dir), dir_end;
|
||||
boost::filesystem::directory_iterator dir_iter(dir), dir_end;
|
||||
|
||||
std::string mp3extension = ".mp3";
|
||||
for(;dir_iter != dir_end; dir_iter++)
|
||||
{
|
||||
if(boost::filesystem::extension(*dir_iter) == mp3extension)
|
||||
{
|
||||
files.push_back(*dir_iter);
|
||||
}
|
||||
}
|
||||
std::string mp3extension = ".mp3";
|
||||
for(;dir_iter != dir_end; dir_iter++)
|
||||
{
|
||||
if(boost::filesystem::extension(*dir_iter) == mp3extension)
|
||||
{
|
||||
files.push_back(*dir_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::startRandomTitle()
|
||||
{
|
||||
std::vector<boost::filesystem::path>::iterator fileIter;
|
||||
std::vector<boost::filesystem::path>::iterator fileIter;
|
||||
|
||||
if(files.size() > 0)
|
||||
{
|
||||
fileIter = files.begin();
|
||||
srand ( time(NULL) );
|
||||
int r = rand() % files.size() + 1; //old random code
|
||||
if(files.size() > 0)
|
||||
{
|
||||
fileIter = files.begin();
|
||||
srand ( time(NULL) );
|
||||
int r = rand() % files.size() + 1; //old random code
|
||||
|
||||
for(int i = 1; i < r; i++)
|
||||
{
|
||||
fileIter++;
|
||||
}
|
||||
std::string music = fileIter->file_string();
|
||||
try
|
||||
{
|
||||
std::cout << "Playing " << music << "\n";
|
||||
streamMusic(music);
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
std::cout << " Music Error: " << e.what() << "\n";
|
||||
}
|
||||
}
|
||||
for(int i = 1; i < r; i++)
|
||||
{
|
||||
fileIter++;
|
||||
}
|
||||
std::string music = fileIter->file_string();
|
||||
try
|
||||
{
|
||||
std::cout << "Playing " << music << "\n";
|
||||
streamMusic(music);
|
||||
}
|
||||
catch(std::exception &e)
|
||||
{
|
||||
std::cout << " Music Error: " << e.what() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SoundManager::isMusicPlaying()
|
||||
{
|
||||
bool test = mData->music->isPlaying();
|
||||
return test;
|
||||
}
|
||||
{
|
||||
bool test = false;
|
||||
if(mData && mData->music)
|
||||
{
|
||||
test = mData->music->isPlaying();
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
SoundManager::SoundImpl SoundManager::getMData()
|
||||
{
|
||||
// bool test = mData->music->isPlaying();
|
||||
return *mData;
|
||||
// bool test = mData->music->isPlaying();
|
||||
return *mData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SoundManager::say (MWWorld::Ptr ptr, const std::string& filename)
|
||||
{
|
||||
// The range values are not tested
|
||||
@ -400,8 +404,8 @@ namespace MWSound
|
||||
// Play the sound and tell it to stream, if possible. TODO:
|
||||
// Store the reference, the jukebox will need to check status,
|
||||
// control volume etc.
|
||||
if (mData->music)
|
||||
mData->music->stop();
|
||||
if (mData->music)
|
||||
mData->music->stop();
|
||||
mData->music = mData->mgr->load(filename);
|
||||
mData->music->setStreaming(true);
|
||||
mData->music->setVolume(0.4);
|
||||
|
@ -21,28 +21,28 @@ namespace ESMS
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
//SoundPtr *music;
|
||||
//SoundPtr *music;
|
||||
class SoundManager
|
||||
{
|
||||
// Hide implementation details - engine.cpp is compiling
|
||||
// enough as it is.
|
||||
struct SoundImpl;
|
||||
|
||||
|
||||
SoundImpl *mData;
|
||||
std::vector<boost::filesystem::path> files;
|
||||
|
||||
std::vector<boost::filesystem::path> files;
|
||||
|
||||
|
||||
public:
|
||||
SoundManager(Ogre::Root*, Ogre::Camera*, const ESMS::ESMStore &store,
|
||||
boost::filesystem::path dataDir, bool useSound);
|
||||
~SoundManager();
|
||||
|
||||
void startRandomTitle();
|
||||
void MP3Lookup(boost::filesystem::path dir);
|
||||
//struct SoundImpl;
|
||||
bool isMusicPlaying();
|
||||
void startRandomTitle();
|
||||
void MP3Lookup(boost::filesystem::path dir);
|
||||
//struct SoundImpl;
|
||||
bool isMusicPlaying();
|
||||
|
||||
SoundImpl getMData();
|
||||
SoundImpl getMData();
|
||||
|
||||
void say (MWWorld::Ptr reference, const std::string& filename);
|
||||
///< Make an actor say some text.
|
||||
|
64
apps/openmw/mwworld/player.cpp
Normal file
64
apps/openmw/mwworld/player.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
|
||||
#include "player.hpp"
|
||||
|
||||
#include "../mwrender/player.hpp"
|
||||
|
||||
#include "world.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) :
|
||||
mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0), mCollisionMode (true)
|
||||
{
|
||||
mPlayer.base = player;
|
||||
mName = player->name;
|
||||
mMale = !(player->flags & ESM::NPC::Female);
|
||||
mRace = player->race;
|
||||
mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0;
|
||||
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
{
|
||||
delete mClass;
|
||||
}
|
||||
|
||||
void Player::setPos(float x, float y, float z, bool updateCamera)
|
||||
{
|
||||
mWorld.moveObject (getPlayer(), x, y, z);
|
||||
|
||||
if (updateCamera)
|
||||
mRenderer->getCamera()->setPosition (Ogre::Vector3 (
|
||||
mPlayer.ref.pos.pos[0],
|
||||
mPlayer.ref.pos.pos[2],
|
||||
-mPlayer.ref.pos.pos[1]));
|
||||
}
|
||||
|
||||
void Player::moveRel (float &relX, float &relY, float &relZ)
|
||||
{
|
||||
// Move camera relative to its own direction
|
||||
mRenderer->getCamera()->moveRelative (Ogre::Vector3(relX,0,relZ));
|
||||
|
||||
// Up/down movement is always done relative the world axis.
|
||||
mRenderer->getCamera()->move (Ogre::Vector3(0,relY,0));
|
||||
|
||||
// Get new camera position, converting back to MW coords.
|
||||
Ogre::Vector3 pos = mRenderer->getCamera()->getPosition();
|
||||
relX = pos[0];
|
||||
relY = -pos[2];
|
||||
relZ = pos[1];
|
||||
|
||||
// TODO: Collision detection must be used to find the REAL new
|
||||
// position, if mCollisionMode==true
|
||||
|
||||
// Set the position
|
||||
setPos(relX, relY, relZ);
|
||||
}
|
||||
|
||||
void Player::setClass (const ESM::Class& class_)
|
||||
{
|
||||
ESM::Class *new_class = new ESM::Class (class_);
|
||||
delete mClass;
|
||||
mClass = new_class;
|
||||
}
|
||||
}
|
113
apps/openmw/mwworld/player.hpp
Normal file
113
apps/openmw/mwworld/player.hpp
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef GAME_MWWORLD_PLAYER_H
|
||||
#define GAME_MWWORLD_PLAYER_H
|
||||
|
||||
#include "OgreCamera.h"
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
class Player;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
|
||||
/// \brief NPC object representing the player and additional player data
|
||||
class Player
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||
MWWorld::Ptr::CellStore *mCellStore;
|
||||
MWRender::Player *mRenderer;
|
||||
MWWorld::World& mWorld;
|
||||
std::string mName;
|
||||
bool mMale;
|
||||
std::string mRace;
|
||||
std::string mBirthsign;
|
||||
ESM::Class *mClass;
|
||||
bool mCollisionMode;
|
||||
|
||||
public:
|
||||
|
||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||
|
||||
~Player();
|
||||
|
||||
/// Set the player position. Uses Morrowind coordinates.
|
||||
void setPos(float _x, float _y, float _z, bool updateCamera = false);
|
||||
|
||||
void setCell (MWWorld::Ptr::CellStore *cellStore)
|
||||
{
|
||||
mCellStore = cellStore;
|
||||
}
|
||||
|
||||
/// Move the player relative to her own position and
|
||||
/// orientation. After the call, the new position is returned.
|
||||
void moveRel (float &relX, float &relY, float &relZ);
|
||||
|
||||
MWWorld::Ptr getPlayer()
|
||||
{
|
||||
MWWorld::Ptr ptr (&mPlayer, mCellStore);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
MWRender::Player *getRenderer() { return mRenderer; }
|
||||
|
||||
void setName (const std::string& name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
void setGender (bool male)
|
||||
{
|
||||
mMale = male;
|
||||
}
|
||||
|
||||
void setRace (const std::string& race)
|
||||
{
|
||||
mRace = race;
|
||||
}
|
||||
|
||||
void setBirthsign (const std::string& birthsign)
|
||||
{
|
||||
mBirthsign = birthsign;
|
||||
}
|
||||
|
||||
void setClass (const ESM::Class& class_);
|
||||
|
||||
std::string getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
bool isMale() const
|
||||
{
|
||||
return mMale;
|
||||
}
|
||||
|
||||
std::string getRace() const
|
||||
{
|
||||
return mRace;
|
||||
}
|
||||
|
||||
std::string getBirthsign() const
|
||||
{
|
||||
return mBirthsign;
|
||||
}
|
||||
|
||||
const ESM::Class& getClass() const
|
||||
{
|
||||
return *mClass;
|
||||
}
|
||||
|
||||
void toggleCollisionMode()
|
||||
{
|
||||
mCollisionMode = !mCollisionMode;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@ -17,7 +17,7 @@
|
||||
#include "ptr.hpp"
|
||||
#include "environment.hpp"
|
||||
#include "class.hpp"
|
||||
|
||||
#include "player.hpp"
|
||||
|
||||
#include "refdata.hpp"
|
||||
#include "globals.hpp"
|
||||
@ -296,12 +296,12 @@ namespace MWWorld
|
||||
|
||||
void World::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position)
|
||||
{
|
||||
mPlayerPos->setPos (position.pos[0], position.pos[1], position.pos[2], true);
|
||||
mPlayerPos->setCell (cell);
|
||||
mPlayer->setPos (position.pos[0], position.pos[1], position.pos[2], true);
|
||||
mPlayer->setCell (cell);
|
||||
// TODO orientation
|
||||
|
||||
mEnvironment.mMechanicsManager->addActor (mPlayerPos->getPlayer());
|
||||
mEnvironment.mMechanicsManager->watchActor (mPlayerPos->getPlayer());
|
||||
mEnvironment.mMechanicsManager->addActor (mPlayer->getPlayer());
|
||||
mEnvironment.mMechanicsManager->watchActor (mPlayer->getPlayer());
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +317,7 @@ namespace MWWorld
|
||||
|
||||
World::World (OEngine::Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir,
|
||||
const std::string& master, bool newGame, Environment& environment)
|
||||
: mSkyManager (0), mScene (renderer), mPlayerPos (0), mCurrentCell (0), mGlobalVariables (0),
|
||||
: mSkyManager (0), mScene (renderer), mPlayer (0), mCurrentCell (0), mGlobalVariables (0),
|
||||
mSky (false), mCellChanged (false), mEnvironment (environment)
|
||||
{
|
||||
boost::filesystem::path masterPath (dataDir);
|
||||
@ -329,7 +329,7 @@ namespace MWWorld
|
||||
mEsm.open (masterPath.file_string());
|
||||
mStore.load (mEsm);
|
||||
|
||||
mPlayerPos = new MWRender::PlayerPos (mScene.getCamera(), mStore.npcs.find ("player"), *this);
|
||||
mPlayer = new MWWorld::Player (mScene.getPlayer(), mStore.npcs.find ("player"), *this);
|
||||
|
||||
// global variables
|
||||
mGlobalVariables = new Globals (mStore);
|
||||
@ -354,14 +354,14 @@ namespace MWWorld
|
||||
iter!=mBufferedCells.end(); ++iter)
|
||||
delete iter->second;
|
||||
|
||||
delete mPlayerPos;
|
||||
delete mPlayer;
|
||||
delete mSkyManager;
|
||||
delete mGlobalVariables;
|
||||
}
|
||||
|
||||
MWRender::PlayerPos& World::getPlayerPos()
|
||||
MWWorld::Player& World::getPlayer()
|
||||
{
|
||||
return *mPlayerPos;
|
||||
return *mPlayer;
|
||||
}
|
||||
|
||||
ESMS::ESMStore& World::getStore()
|
||||
@ -394,7 +394,7 @@ namespace MWWorld
|
||||
// the player is always in an active cell.
|
||||
if (name=="player")
|
||||
{
|
||||
return mPlayerPos->getPlayer();
|
||||
return mPlayer->getPlayer();
|
||||
}
|
||||
|
||||
// active cells
|
||||
@ -610,7 +610,7 @@ namespace MWWorld
|
||||
adjustSky();
|
||||
|
||||
mCellChanged = true;
|
||||
//currentRegion->name = "";
|
||||
//currentRegion->name = "";
|
||||
}
|
||||
|
||||
void World::changeCell (int X, int Y, const ESM::Position& position)
|
||||
@ -763,7 +763,7 @@ namespace MWWorld
|
||||
ptr.getCellRef().pos.pos[1] = y;
|
||||
ptr.getCellRef().pos.pos[2] = z;
|
||||
|
||||
if (ptr==mPlayerPos->getPlayer())
|
||||
if (ptr==mPlayer->getPlayer())
|
||||
{
|
||||
if (mCurrentCell)
|
||||
{
|
||||
@ -777,7 +777,7 @@ namespace MWWorld
|
||||
|
||||
if (mCurrentCell->cell->data.gridX!=cellX || mCurrentCell->cell->data.gridY!=cellY)
|
||||
{
|
||||
changeCell (cellX, cellY, mPlayerPos->getPlayer().getCellRef().pos);
|
||||
changeCell (cellX, cellY, mPlayer->getPlayer().getCellRef().pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -800,8 +800,6 @@ namespace MWWorld
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void World::positionToIndex (float x, float y, int &cellX, int &cellY) const
|
||||
{
|
||||
const int cellSize = 8192;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwrender/playerpos.hpp"
|
||||
#include "../mwrender/mwscene.hpp"
|
||||
|
||||
#include "refdata.hpp"
|
||||
@ -34,12 +33,13 @@ namespace MWRender
|
||||
namespace MWWorld
|
||||
{
|
||||
class Environment;
|
||||
class Player;
|
||||
|
||||
/// \brief The game world and its visual representation
|
||||
|
||||
class World
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
||||
|
||||
@ -49,8 +49,8 @@ namespace MWWorld
|
||||
|
||||
MWRender::SkyManager* mSkyManager;
|
||||
MWRender::MWScene mScene;
|
||||
MWRender::PlayerPos *mPlayerPos;
|
||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||
MWWorld::Player *mPlayer;
|
||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||
CellRenderCollection mActiveCells;
|
||||
CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
|
||||
ESM::ESMReader mEsm;
|
||||
@ -94,9 +94,9 @@ namespace MWWorld
|
||||
|
||||
~World();
|
||||
|
||||
MWRender::PlayerPos& getPlayerPos();
|
||||
MWWorld::Player& getPlayer();
|
||||
|
||||
ESMS::ESMStore& getStore();
|
||||
ESMS::ESMStore& getStore();
|
||||
|
||||
const ScriptList& getLocalScripts() const;
|
||||
///< Names and local variable state of all local scripts in active cells.
|
||||
|
@ -38,10 +38,13 @@ ENDIF (WIN32)
|
||||
IF (UNIX AND NOT APPLE)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
|
||||
FIND_PACKAGE(PkgConfig REQUIRED)
|
||||
PKG_SEARCH_MODULE(OGRE REQUIRED OGRE)
|
||||
# Don't mark REQUIRED, but use PKG_CHECK_MODULES below (otherwise PkgConfig
|
||||
# complains even if OGRE_* are set by hand).
|
||||
PKG_SEARCH_MODULE(OGRE OGRE)
|
||||
SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS})
|
||||
SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
|
||||
SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
|
||||
PKG_CHECK_MODULES(OGRE OGRE)
|
||||
ENDIF (UNIX AND NOT APPLE)
|
||||
|
||||
IF (APPLE)
|
||||
|
@ -363,45 +363,45 @@ struct option
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
#ifndef no_argument
|
||||
#define no_argument 0
|
||||
#define no_argument 0
|
||||
#endif
|
||||
|
||||
#ifndef required_argument
|
||||
#define required_argument 1
|
||||
#define required_argument 1
|
||||
#endif
|
||||
|
||||
#ifndef optional_argument
|
||||
#define optional_argument 2
|
||||
#define optional_argument 2
|
||||
#endif
|
||||
|
||||
struct custom_getopt_data {
|
||||
/*
|
||||
* These have exactly the same meaning as the corresponding global variables,
|
||||
* except that they are used for the reentrant versions of getopt.
|
||||
*/
|
||||
int custom_optind;
|
||||
int custom_opterr;
|
||||
int custom_optopt;
|
||||
char *custom_optarg;
|
||||
/*
|
||||
* These have exactly the same meaning as the corresponding global variables,
|
||||
* except that they are used for the reentrant versions of getopt.
|
||||
*/
|
||||
int custom_optind;
|
||||
int custom_opterr;
|
||||
int custom_optopt;
|
||||
char *custom_optarg;
|
||||
|
||||
/* True if the internal members have been initialized. */
|
||||
int initialized;
|
||||
/* True if the internal members have been initialized. */
|
||||
int initialized;
|
||||
|
||||
/*
|
||||
* The next char to be scanned in the option-element in which the last option
|
||||
* character we returned was found. This allows us to pick up the scan where
|
||||
* we left off. If this is zero, or a null string, it means resume the scan by
|
||||
* advancing to the next ARGV-element.
|
||||
*/
|
||||
char *nextchar;
|
||||
/*
|
||||
* The next char to be scanned in the option-element in which the last option
|
||||
* character we returned was found. This allows us to pick up the scan where
|
||||
* we left off. If this is zero, or a null string, it means resume the scan by
|
||||
* advancing to the next ARGV-element.
|
||||
*/
|
||||
char *nextchar;
|
||||
|
||||
/*
|
||||
* Describe the part of ARGV that contains non-options that have been skipped.
|
||||
* `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
|
||||
* the index after the last of them.
|
||||
*/
|
||||
int first_nonopt;
|
||||
int last_nonopt;
|
||||
/*
|
||||
* Describe the part of ARGV that contains non-options that have been skipped.
|
||||
* `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
|
||||
* the index after the last of them.
|
||||
*/
|
||||
int first_nonopt;
|
||||
int last_nonopt;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -457,137 +457,137 @@ static int custom_optopt = '?';
|
||||
*/
|
||||
static void exchange(char **argv, struct custom_getopt_data *d)
|
||||
{
|
||||
int bottom = d->first_nonopt;
|
||||
int middle = d->last_nonopt;
|
||||
int top = d->custom_optind;
|
||||
char *tem;
|
||||
int bottom = d->first_nonopt;
|
||||
int middle = d->last_nonopt;
|
||||
int top = d->custom_optind;
|
||||
char *tem;
|
||||
|
||||
/*
|
||||
* Exchange the shorter segment with the far end of the longer segment.
|
||||
* That puts the shorter segment into the right place. It leaves the
|
||||
* longer segment in the right place overall, but it consists of two
|
||||
* parts that need to be swapped next.
|
||||
*/
|
||||
while (top > middle && middle > bottom) {
|
||||
if (top - middle > middle - bottom) {
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
int i;
|
||||
/*
|
||||
* Exchange the shorter segment with the far end of the longer segment.
|
||||
* That puts the shorter segment into the right place. It leaves the
|
||||
* longer segment in the right place overall, but it consists of two
|
||||
* parts that need to be swapped next.
|
||||
*/
|
||||
while (top > middle && middle > bottom) {
|
||||
if (top - middle > middle - bottom) {
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
int i;
|
||||
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] =
|
||||
argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
} else {
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
int i;
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] =
|
||||
argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
} else {
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
int i;
|
||||
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
d->first_nonopt += (d->custom_optind - d->last_nonopt);
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++) {
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
d->first_nonopt += (d->custom_optind - d->last_nonopt);
|
||||
d->last_nonopt = d->custom_optind;
|
||||
}
|
||||
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
static void custom_getopt_initialize(struct custom_getopt_data *d)
|
||||
{
|
||||
/*
|
||||
* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
* is the program name); the sequence of previously skipped non-option
|
||||
* ARGV-elements is empty.
|
||||
*/
|
||||
d->first_nonopt = d->last_nonopt = d->custom_optind;
|
||||
d->nextchar = NULL;
|
||||
d->initialized = 1;
|
||||
/*
|
||||
* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
* is the program name); the sequence of previously skipped non-option
|
||||
* ARGV-elements is empty.
|
||||
*/
|
||||
d->first_nonopt = d->last_nonopt = d->custom_optind;
|
||||
d->nextchar = NULL;
|
||||
d->initialized = 1;
|
||||
}
|
||||
|
||||
#define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
|
||||
|
||||
/* return: zero: continue, nonzero: return given value to user */
|
||||
static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
|
||||
struct custom_getopt_data *d)
|
||||
struct custom_getopt_data *d)
|
||||
{
|
||||
/*
|
||||
* Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
|
||||
* moved back by the user (who may also have changed the arguments).
|
||||
*/
|
||||
if (d->last_nonopt > d->custom_optind)
|
||||
d->last_nonopt = d->custom_optind;
|
||||
if (d->first_nonopt > d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* If we have just processed some options following some
|
||||
* non-options, exchange them so that the options come first.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt &&
|
||||
d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->last_nonopt != d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* Skip any additional non-options and extend the range of
|
||||
* non-options previously skipped.
|
||||
*/
|
||||
while (d->custom_optind < argc && NONOPTION_P)
|
||||
d->custom_optind++;
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/*
|
||||
* The special ARGV-element `--' means premature end of options. Skip
|
||||
* it like a null option, then exchange with previous non-options as if
|
||||
* it were an option, then skip everything else like a non-option.
|
||||
*/
|
||||
if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
|
||||
d->custom_optind++;
|
||||
if (d->first_nonopt != d->last_nonopt
|
||||
&& d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->first_nonopt == d->last_nonopt)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
d->last_nonopt = argc;
|
||||
d->custom_optind = argc;
|
||||
}
|
||||
/*
|
||||
* If we have done all the ARGV-elements, stop the scan and back over
|
||||
* any non-options that we skipped and permuted.
|
||||
*/
|
||||
if (d->custom_optind == argc) {
|
||||
/*
|
||||
* Set the next-arg-index to point at the non-options that we
|
||||
* previously skipped, so the caller will digest them.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt)
|
||||
d->custom_optind = d->first_nonopt;
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* If we have come to a non-option and did not permute it, either stop
|
||||
* the scan or describe it to the caller and pass it by.
|
||||
*/
|
||||
if (NONOPTION_P) {
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* We have found another option-ARGV-element. Skip the initial
|
||||
* punctuation.
|
||||
*/
|
||||
d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
|
||||
return 0;
|
||||
/*
|
||||
* Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
|
||||
* moved back by the user (who may also have changed the arguments).
|
||||
*/
|
||||
if (d->last_nonopt > d->custom_optind)
|
||||
d->last_nonopt = d->custom_optind;
|
||||
if (d->first_nonopt > d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* If we have just processed some options following some
|
||||
* non-options, exchange them so that the options come first.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt &&
|
||||
d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->last_nonopt != d->custom_optind)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
/*
|
||||
* Skip any additional non-options and extend the range of
|
||||
* non-options previously skipped.
|
||||
*/
|
||||
while (d->custom_optind < argc && NONOPTION_P)
|
||||
d->custom_optind++;
|
||||
d->last_nonopt = d->custom_optind;
|
||||
/*
|
||||
* The special ARGV-element `--' means premature end of options. Skip
|
||||
* it like a null option, then exchange with previous non-options as if
|
||||
* it were an option, then skip everything else like a non-option.
|
||||
*/
|
||||
if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
|
||||
d->custom_optind++;
|
||||
if (d->first_nonopt != d->last_nonopt
|
||||
&& d->last_nonopt != d->custom_optind)
|
||||
exchange((char **) argv, d);
|
||||
else if (d->first_nonopt == d->last_nonopt)
|
||||
d->first_nonopt = d->custom_optind;
|
||||
d->last_nonopt = argc;
|
||||
d->custom_optind = argc;
|
||||
}
|
||||
/*
|
||||
* If we have done all the ARGV-elements, stop the scan and back over
|
||||
* any non-options that we skipped and permuted.
|
||||
*/
|
||||
if (d->custom_optind == argc) {
|
||||
/*
|
||||
* Set the next-arg-index to point at the non-options that we
|
||||
* previously skipped, so the caller will digest them.
|
||||
*/
|
||||
if (d->first_nonopt != d->last_nonopt)
|
||||
d->custom_optind = d->first_nonopt;
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* If we have come to a non-option and did not permute it, either stop
|
||||
* the scan or describe it to the caller and pass it by.
|
||||
*/
|
||||
if (NONOPTION_P) {
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* We have found another option-ARGV-element. Skip the initial
|
||||
* punctuation.
|
||||
*/
|
||||
d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -601,180 +601,180 @@ static int shuffle_argv(int argc, char *const *argv,const struct option *longopt
|
||||
*
|
||||
*/
|
||||
static int check_long_opt(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
const struct option *longopts, int *longind,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
|
||||
for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all long options for either exact match or abbreviated matches */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
|
||||
if ((unsigned int) (nameend - d->nextchar)
|
||||
== (unsigned int) strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
} else if (pfound == NULL) {
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
} else if (pfound->has_arg != p->has_arg
|
||||
|| pfound->flag != p->flag
|
||||
|| pfound->val != p->val)
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' is ambiguous\n",
|
||||
argv[0], argv[d->custom_optind]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
if (pfound) {
|
||||
option_index = indfound;
|
||||
d->custom_optind++;
|
||||
if (*nameend) {
|
||||
if (pfound->has_arg != no_argument)
|
||||
d->custom_optarg = nameend + 1;
|
||||
else {
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind - 1][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[d->custom_optind - 1][0], pfound->name);
|
||||
}
|
||||
/* Test all long options for either exact match or abbreviated matches */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
|
||||
if ((unsigned int) (nameend - d->nextchar)
|
||||
== (unsigned int) strlen(p->name)) {
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
} else if (pfound == NULL) {
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
} else if (pfound->has_arg != p->has_arg
|
||||
|| pfound->flag != p->flag
|
||||
|| pfound->val != p->val)
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' is ambiguous\n",
|
||||
argv[0], argv[d->custom_optind]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
if (pfound) {
|
||||
option_index = indfound;
|
||||
d->custom_optind++;
|
||||
if (*nameend) {
|
||||
if (pfound->has_arg != no_argument)
|
||||
d->custom_optarg = nameend + 1;
|
||||
else {
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind - 1][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
|
||||
argv[0], pfound->name);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
|
||||
argv[0], argv[d->custom_optind - 1][0], pfound->name);
|
||||
}
|
||||
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
} else if (pfound->has_arg == required_argument) {
|
||||
if (d->custom_optind < argc)
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
else {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' requires an argument\n",
|
||||
argv[0],
|
||||
argv[d->custom_optind - 1]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag) {
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
/*
|
||||
* Can't find it as a long option. If this is not getopt_long_only, or
|
||||
* the option starts with '--' or is not a valid short option, then
|
||||
* it's an error. Otherwise interpret it as a short option.
|
||||
*/
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `--%s'\n",
|
||||
argv[0], d->nextchar);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `%c%s'\n",
|
||||
argv[0], argv[d->custom_optind][0],
|
||||
d->nextchar);
|
||||
}
|
||||
}
|
||||
d->nextchar = (char *) "";
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
} else if (pfound->has_arg == required_argument) {
|
||||
if (d->custom_optind < argc)
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
else {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option `%s' requires an argument\n",
|
||||
argv[0],
|
||||
argv[d->custom_optind - 1]);
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
d->custom_optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
d->nextchar += strlen(d->nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag) {
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
/*
|
||||
* Can't find it as a long option. If this is not getopt_long_only, or
|
||||
* the option starts with '--' or is not a valid short option, then
|
||||
* it's an error. Otherwise interpret it as a short option.
|
||||
*/
|
||||
if (print_errors) {
|
||||
if (argv[d->custom_optind][1] == '-') {
|
||||
/* --option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `--%s'\n",
|
||||
argv[0], d->nextchar);
|
||||
} else {
|
||||
/* +option or -option */
|
||||
fprintf(stderr,
|
||||
"%s: unrecognized option `%c%s'\n",
|
||||
argv[0], argv[d->custom_optind][0],
|
||||
d->nextchar);
|
||||
}
|
||||
}
|
||||
d->nextchar = (char *) "";
|
||||
d->custom_optind++;
|
||||
d->custom_optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
|
||||
static int check_short_opt(int argc, char *const *argv, const char *optstring,
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
int print_errors, struct custom_getopt_data *d)
|
||||
{
|
||||
char c = *d->nextchar++;
|
||||
const char *temp = strchr(optstring, c);
|
||||
char c = *d->nextchar++;
|
||||
const char *temp = strchr(optstring, c);
|
||||
|
||||
/* Increment `custom_optind' when we start to process its last character. */
|
||||
if (*d->nextchar == '\0')
|
||||
++d->custom_optind;
|
||||
if (!temp || c == ':') {
|
||||
if (print_errors)
|
||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
||||
/* Increment `custom_optind' when we start to process its last character. */
|
||||
if (*d->nextchar == '\0')
|
||||
++d->custom_optind;
|
||||
if (!temp || c == ':') {
|
||||
if (print_errors)
|
||||
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
|
||||
|
||||
d->custom_optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':') {
|
||||
if (temp[2] == ':') {
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
d->custom_optind++;
|
||||
} else
|
||||
d->custom_optarg = NULL;
|
||||
d->nextchar = NULL;
|
||||
} else {
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
/*
|
||||
* If we end this ARGV-element by taking the
|
||||
* rest as an arg, we must advance to the next
|
||||
* element now.
|
||||
*/
|
||||
d->custom_optind++;
|
||||
} else if (d->custom_optind == argc) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
argv[0], c);
|
||||
}
|
||||
d->custom_optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
} else
|
||||
/*
|
||||
* We already incremented `custom_optind' once;
|
||||
* increment it again when taking next ARGV-elt
|
||||
* as argument.
|
||||
*/
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
d->nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
d->custom_optopt = c;
|
||||
return '?';
|
||||
}
|
||||
if (temp[1] == ':') {
|
||||
if (temp[2] == ':') {
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
d->custom_optind++;
|
||||
} else
|
||||
d->custom_optarg = NULL;
|
||||
d->nextchar = NULL;
|
||||
} else {
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->nextchar != '\0') {
|
||||
d->custom_optarg = d->nextchar;
|
||||
/*
|
||||
* If we end this ARGV-element by taking the
|
||||
* rest as an arg, we must advance to the next
|
||||
* element now.
|
||||
*/
|
||||
d->custom_optind++;
|
||||
} else if (d->custom_optind == argc) {
|
||||
if (print_errors) {
|
||||
fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
argv[0], c);
|
||||
}
|
||||
d->custom_optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
} else
|
||||
/*
|
||||
* We already incremented `custom_optind' once;
|
||||
* increment it again when taking next ARGV-elt
|
||||
* as argument.
|
||||
*/
|
||||
d->custom_optarg = argv[d->custom_optind++];
|
||||
d->nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -848,59 +848,59 @@ static int check_short_opt(int argc, char *const *argv, const char *optstring,
|
||||
*/
|
||||
|
||||
static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
struct custom_getopt_data *d)
|
||||
const struct option *longopts, int *longind,
|
||||
struct custom_getopt_data *d)
|
||||
{
|
||||
int ret, print_errors = d->custom_opterr;
|
||||
int ret, print_errors = d->custom_opterr;
|
||||
|
||||
if (optstring[0] == ':')
|
||||
print_errors = 0;
|
||||
if (argc < 1)
|
||||
return -1;
|
||||
d->custom_optarg = NULL;
|
||||
if (optstring[0] == ':')
|
||||
print_errors = 0;
|
||||
if (argc < 1)
|
||||
return -1;
|
||||
d->custom_optarg = NULL;
|
||||
|
||||
/*
|
||||
* This is a big difference with GNU getopt, since optind == 0
|
||||
* means initialization while here 1 means first call.
|
||||
*/
|
||||
if (d->custom_optind == 0 || !d->initialized) {
|
||||
if (d->custom_optind == 0)
|
||||
d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
custom_getopt_initialize(d);
|
||||
}
|
||||
if (d->nextchar == NULL || *d->nextchar == '\0') {
|
||||
ret = shuffle_argv(argc, argv, longopts, d);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (longopts && (argv[d->custom_optind][1] == '-' ))
|
||||
return check_long_opt(argc, argv, optstring, longopts,
|
||||
longind, print_errors, d);
|
||||
return check_short_opt(argc, argv, optstring, print_errors, d);
|
||||
/*
|
||||
* This is a big difference with GNU getopt, since optind == 0
|
||||
* means initialization while here 1 means first call.
|
||||
*/
|
||||
if (d->custom_optind == 0 || !d->initialized) {
|
||||
if (d->custom_optind == 0)
|
||||
d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
custom_getopt_initialize(d);
|
||||
}
|
||||
if (d->nextchar == NULL || *d->nextchar == '\0') {
|
||||
ret = shuffle_argv(argc, argv, longopts, d);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (longopts && (argv[d->custom_optind][1] == '-' ))
|
||||
return check_long_opt(argc, argv, optstring, longopts,
|
||||
longind, print_errors, d);
|
||||
return check_short_opt(argc, argv, optstring, print_errors, d);
|
||||
}
|
||||
|
||||
static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
|
||||
const struct option *longopts, int *longind)
|
||||
const struct option *longopts, int *longind)
|
||||
{
|
||||
int result;
|
||||
/* Keep a global copy of all internal members of d */
|
||||
static struct custom_getopt_data d;
|
||||
int result;
|
||||
/* Keep a global copy of all internal members of d */
|
||||
static struct custom_getopt_data d;
|
||||
|
||||
d.custom_optind = custom_optind;
|
||||
d.custom_opterr = custom_opterr;
|
||||
result = getopt_internal_r(argc, argv, optstring, longopts,
|
||||
longind, &d);
|
||||
custom_optind = d.custom_optind;
|
||||
custom_optarg = d.custom_optarg;
|
||||
custom_optopt = d.custom_optopt;
|
||||
return result;
|
||||
d.custom_optind = custom_optind;
|
||||
d.custom_opterr = custom_opterr;
|
||||
result = getopt_internal_r(argc, argv, optstring, longopts,
|
||||
longind, &d);
|
||||
custom_optind = d.custom_optind;
|
||||
custom_optarg = d.custom_optarg;
|
||||
custom_optopt = d.custom_optopt;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int custom_getopt_long (int argc, char *const *argv, const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return custom_getopt_internal(argc, argv, options, long_options,
|
||||
opt_index);
|
||||
return custom_getopt_internal(argc, argv, options, long_options,
|
||||
opt_index);
|
||||
}
|
||||
|
||||
|
||||
@ -1007,7 +1007,7 @@ cmdline_parser_internal (
|
||||
int argc, char * const *argv, struct gengetopt_args_info *args_info,
|
||||
struct cmdline_parser_params *params, const char *additional_error)
|
||||
{
|
||||
int c; /* Character of the parsed option. */
|
||||
int c; /* Character of the parsed option. */
|
||||
|
||||
int error = 0;
|
||||
struct gengetopt_args_info local_args_info;
|
||||
@ -1044,10 +1044,10 @@ cmdline_parser_internal (
|
||||
int option_index = 0;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ "extract", 1, NULL, 'x' },
|
||||
{ "long", 0, NULL, 'l' },
|
||||
{ "help", 0, NULL, 'h' },
|
||||
{ "version", 0, NULL, 'V' },
|
||||
{ "extract", 1, NULL, 'x' },
|
||||
{ "long", 0, NULL, 'l' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -1063,21 +1063,21 @@ cmdline_parser_internal (
|
||||
opterr = custom_opterr;
|
||||
optopt = custom_optopt;
|
||||
|
||||
if (c == -1) break; /* Exit from `while (1)' loop. */
|
||||
if (c == -1) break; /* Exit from `while (1)' loop. */
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 'h': /* Print help and exit. */
|
||||
case 'h': /* Print help and exit. */
|
||||
cmdline_parser_print_help ();
|
||||
cmdline_parser_free (&local_args_info);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'V': /* Print version and exit. */
|
||||
case 'V': /* Print version and exit. */
|
||||
cmdline_parser_print_version ();
|
||||
cmdline_parser_free (&local_args_info);
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
case 'x': /* Extract file from archive. */
|
||||
case 'x': /* Extract file from archive. */
|
||||
|
||||
|
||||
if (update_arg( (void *)&(args_info->extract_arg),
|
||||
@ -1089,7 +1089,7 @@ cmdline_parser_internal (
|
||||
goto failure;
|
||||
|
||||
break;
|
||||
case 'l': /* Include extra information in archive listing. */
|
||||
case 'l': /* Include extra information in archive listing. */
|
||||
|
||||
|
||||
if (update_arg( 0 ,
|
||||
@ -1102,12 +1102,12 @@ cmdline_parser_internal (
|
||||
|
||||
break;
|
||||
|
||||
case 0: /* Long option with no short option */
|
||||
case '?': /* Invalid option. */
|
||||
case 0: /* Long option with no short option */
|
||||
case '?': /* Invalid option. */
|
||||
/* `getopt_long' already printed an error message. */
|
||||
goto failure;
|
||||
|
||||
default: /* bug: option not considered. */
|
||||
default: /* bug: option not considered. */
|
||||
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
|
||||
abort ();
|
||||
} /* switch */
|
||||
|
@ -39,15 +39,15 @@ struct gengetopt_args_info
|
||||
{
|
||||
const char *help_help; /**< @brief Print help and exit help description. */
|
||||
const char *version_help; /**< @brief Print version and exit help description. */
|
||||
char * extract_arg; /**< @brief Extract file from archive. */
|
||||
char * extract_orig; /**< @brief Extract file from archive original value given at command line. */
|
||||
char * extract_arg; /**< @brief Extract file from archive. */
|
||||
char * extract_orig; /**< @brief Extract file from archive original value given at command line. */
|
||||
const char *extract_help; /**< @brief Extract file from archive help description. */
|
||||
const char *long_help; /**< @brief Include extra information in archive listing help description. */
|
||||
|
||||
unsigned int help_given ; /**< @brief Whether help was given. */
|
||||
unsigned int version_given ; /**< @brief Whether version was given. */
|
||||
unsigned int extract_given ; /**< @brief Whether extract was given. */
|
||||
unsigned int long_given ; /**< @brief Whether long was given. */
|
||||
unsigned int help_given ; /**< @brief Whether help was given. */
|
||||
unsigned int version_given ; /**< @brief Whether version was given. */
|
||||
unsigned int extract_given ; /**< @brief Whether extract was given. */
|
||||
unsigned int long_given ; /**< @brief Whether long was given. */
|
||||
|
||||
char **inputs ; /**< @brief unamed options (options without names) */
|
||||
unsigned inputs_num ; /**< @brief unamed options number */
|
||||
|
@ -37,10 +37,10 @@ namespace Compiler
|
||||
public:
|
||||
|
||||
ErrorHandler();
|
||||
///< constructor
|
||||
///< constructor
|
||||
|
||||
virtual ~ErrorHandler();
|
||||
///< destructor
|
||||
///< destructor
|
||||
|
||||
bool isGood() const;
|
||||
///< Was compiling successful?
|
||||
|
@ -96,7 +96,7 @@ namespace Compiler
|
||||
|
||||
Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
|
||||
const Extensions *extensions = 0);
|
||||
///< constructor
|
||||
///< constructor
|
||||
|
||||
void scan (Parser& parser);
|
||||
///< Scan a token and deliver it to the parser.
|
||||
|
@ -30,7 +30,7 @@ namespace Compiler
|
||||
// constructors
|
||||
|
||||
StreamErrorHandler (std::ostream& ErrorStream);
|
||||
///< constructor
|
||||
///< constructor
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef _ESM_READER_H
|
||||
#define _ESM_READER_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <libs/platform/stdint.h>
|
||||
#include <libs/platform/string.h>
|
||||
@ -451,11 +453,11 @@ public:
|
||||
bool isEmptyOrGetName()
|
||||
{
|
||||
if(c.leftRec)
|
||||
{
|
||||
esm->read(c.subName.name, 4);
|
||||
c.leftRec -= 4;
|
||||
return false;
|
||||
}
|
||||
{
|
||||
esm->read(c.subName.name, 4);
|
||||
c.leftRec -= 4;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -472,7 +474,7 @@ public:
|
||||
{
|
||||
skipHSub();
|
||||
if(static_cast<int> (c.leftSub) != size)
|
||||
fail("skipHSubSize() mismatch");
|
||||
fail("skipHSubSize() mismatch");
|
||||
}
|
||||
|
||||
/* Sub-record header. This updates leftRec beyond the current
|
||||
@ -481,7 +483,7 @@ public:
|
||||
void getSubHeader()
|
||||
{
|
||||
if(c.leftRec < 4)
|
||||
fail("End of record while reading sub-record header");
|
||||
fail("End of record while reading sub-record header");
|
||||
|
||||
// Get subrecord size
|
||||
getT(c.leftSub);
|
||||
@ -491,7 +493,7 @@ public:
|
||||
|
||||
// Check that sizes added up
|
||||
if(c.leftRec < 0)
|
||||
fail("Not enough bytes left in record for this subrecord.");
|
||||
fail("Not enough bytes left in record for this subrecord.");
|
||||
}
|
||||
|
||||
/** Get sub header and check the size
|
||||
@ -550,9 +552,9 @@ public:
|
||||
{
|
||||
// General error checking
|
||||
if(c.leftFile < 12)
|
||||
fail("End of file while reading record header");
|
||||
fail("End of file while reading record header");
|
||||
if(c.leftRec)
|
||||
fail("Previous record contains unread bytes");
|
||||
fail("Previous record contains unread bytes");
|
||||
|
||||
getUint(c.leftRec);
|
||||
getUint(flags);// This header entry is always zero
|
||||
@ -561,7 +563,7 @@ public:
|
||||
|
||||
// Check that sizes add up
|
||||
if(c.leftFile < c.leftRec)
|
||||
fail("Record size is larger than rest of file");
|
||||
fail("Record size is larger than rest of file");
|
||||
|
||||
// Adjust number of bytes c.left in file
|
||||
c.leftFile -= c.leftRec;
|
||||
|
@ -43,8 +43,8 @@ namespace ESM
|
||||
|
||||
if(esm.isNextSub("AIDT"))
|
||||
{
|
||||
esm.getHExact(&AI, sizeof(AI));
|
||||
hasAI = true;
|
||||
esm.getHExact(&AI, sizeof(AI));
|
||||
hasAI = true;
|
||||
}
|
||||
else hasAI = false;
|
||||
|
||||
@ -73,45 +73,45 @@ namespace ESM
|
||||
if(subName.val == REC_ONAM)
|
||||
{
|
||||
actor = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_RNAM)
|
||||
{
|
||||
race = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_CNAM)
|
||||
{
|
||||
clas = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
|
||||
factionLess = false;
|
||||
if(subName.val == REC_FNAM)
|
||||
{
|
||||
npcFaction = esm.getHString();
|
||||
if(npcFaction == "FFFF") factionLess = true;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(npcFaction == "FFFF") factionLess = true;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_ANAM)
|
||||
{
|
||||
cell = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
cell = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_DNAM)
|
||||
{
|
||||
pcFaction = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_SNAM)
|
||||
{
|
||||
sound = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
if(subName.val == REC_NAME)
|
||||
{
|
||||
response = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
response = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
|
||||
while(subName.val == REC_SCVR)
|
||||
@ -133,17 +133,17 @@ namespace ESM
|
||||
}
|
||||
else
|
||||
esm.fail("INFO.SCVR must precede INTV or FLTV, not "
|
||||
+ subName.toString());
|
||||
+ subName.toString());
|
||||
|
||||
selects.push_back(ss);
|
||||
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
|
||||
if(subName.val == REC_BNAM)
|
||||
{
|
||||
resultScript = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
resultScript = esm.getHString();
|
||||
if(esm.isEmptyOrGetName()) return;
|
||||
}
|
||||
|
||||
questStatus = QS_None;
|
||||
|
@ -13,10 +13,10 @@ struct Apparatus
|
||||
{
|
||||
enum AppaType
|
||||
{
|
||||
MortarPestle = 0,
|
||||
Albemic = 1,
|
||||
Calcinator = 2,
|
||||
Retort = 3
|
||||
MortarPestle = 0,
|
||||
Albemic = 1,
|
||||
Calcinator = 2,
|
||||
Retort = 3
|
||||
};
|
||||
|
||||
struct AADTstruct
|
||||
|
@ -33,7 +33,7 @@ enum PartReferenceType
|
||||
PRT_RPauldron = 23,
|
||||
PRT_LPauldron = 24,
|
||||
PRT_Weapon = 25,
|
||||
PRT_Tail = 26
|
||||
PRT_Tail = 26
|
||||
};
|
||||
|
||||
// Reference to body parts
|
||||
@ -64,17 +64,17 @@ struct Armor
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Helmet = 0,
|
||||
Cuirass = 1,
|
||||
LPauldron = 2,
|
||||
RPauldron = 3,
|
||||
Greaves = 4,
|
||||
Boots = 5,
|
||||
LGauntlet = 6,
|
||||
RGauntlet = 7,
|
||||
Shield = 8,
|
||||
LBracer = 9,
|
||||
RBracer = 10
|
||||
Helmet = 0,
|
||||
Cuirass = 1,
|
||||
LPauldron = 2,
|
||||
RPauldron = 3,
|
||||
Greaves = 4,
|
||||
Boots = 5,
|
||||
LGauntlet = 6,
|
||||
RGauntlet = 7,
|
||||
Shield = 8,
|
||||
LBracer = 9,
|
||||
RBracer = 10
|
||||
};
|
||||
|
||||
struct AODTstruct
|
||||
|
@ -15,24 +15,24 @@ struct Class
|
||||
{
|
||||
enum AutoCalc
|
||||
{
|
||||
Weapon = 0x00001,
|
||||
Armor = 0x00002,
|
||||
Clothing = 0x00004,
|
||||
Books = 0x00008,
|
||||
Ingredient = 0x00010,
|
||||
Lockpick = 0x00020,
|
||||
Probe = 0x00040,
|
||||
Lights = 0x00080,
|
||||
Apparatus = 0x00100,
|
||||
Repair = 0x00200,
|
||||
Misc = 0x00400,
|
||||
Spells = 0x00800,
|
||||
MagicItems = 0x01000,
|
||||
Potions = 0x02000,
|
||||
Training = 0x04000,
|
||||
Spellmaking = 0x08000,
|
||||
Enchanting = 0x10000,
|
||||
RepairItem = 0x20000
|
||||
Weapon = 0x00001,
|
||||
Armor = 0x00002,
|
||||
Clothing = 0x00004,
|
||||
Books = 0x00008,
|
||||
Ingredient = 0x00010,
|
||||
Lockpick = 0x00020,
|
||||
Probe = 0x00040,
|
||||
Lights = 0x00080,
|
||||
Apparatus = 0x00100,
|
||||
Repair = 0x00200,
|
||||
Misc = 0x00400,
|
||||
Spells = 0x00800,
|
||||
MagicItems = 0x01000,
|
||||
Potions = 0x02000,
|
||||
Training = 0x04000,
|
||||
Spellmaking = 0x08000,
|
||||
Enchanting = 0x10000,
|
||||
RepairItem = 0x20000
|
||||
};
|
||||
|
||||
enum Specialization
|
||||
@ -65,7 +65,7 @@ struct Class
|
||||
esm.getHNT(data, "CLDT", 60);
|
||||
|
||||
if(data.isPlayable > 1)
|
||||
esm.fail("Unknown bool value");
|
||||
esm.fail("Unknown bool value");
|
||||
|
||||
description = esm.getHNOString("DESC");
|
||||
}
|
||||
|
@ -14,16 +14,16 @@ struct Clothing
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Pants = 0,
|
||||
Shoes = 1,
|
||||
Shirt = 2,
|
||||
Belt = 3,
|
||||
Robe = 4,
|
||||
RGlove = 5,
|
||||
LGlove = 6,
|
||||
Skirt = 7,
|
||||
Ring = 8,
|
||||
Amulet = 9
|
||||
Pants = 0,
|
||||
Shoes = 1,
|
||||
Shirt = 2,
|
||||
Belt = 3,
|
||||
Robe = 4,
|
||||
RGlove = 5,
|
||||
LGlove = 6,
|
||||
Skirt = 7,
|
||||
Ring = 8,
|
||||
Amulet = 9
|
||||
};
|
||||
|
||||
struct CTDTstruct
|
||||
|
@ -27,16 +27,16 @@ struct InventoryList
|
||||
esm.getHT(ci, 36);
|
||||
list.push_back(ci);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct Container
|
||||
{
|
||||
enum Flags
|
||||
{
|
||||
Organic = 1, // Objects cannot be placed in this container
|
||||
Respawn = 2, // Respawns after 4 months
|
||||
Unknown = 8
|
||||
Organic = 1, // Objects cannot be placed in this container
|
||||
Respawn = 2, // Respawns after 4 months
|
||||
Unknown = 8
|
||||
};
|
||||
|
||||
std::string name, model, script;
|
||||
|
@ -16,24 +16,24 @@ struct Creature
|
||||
// Default is 0x48?
|
||||
enum Flags
|
||||
{
|
||||
Biped = 0x001,
|
||||
Respawn = 0x002,
|
||||
Weapon = 0x004, // Has weapon and shield
|
||||
None = 0x008, // ??
|
||||
Swims = 0x010,
|
||||
Flies = 0x020, // Don't know what happens if several
|
||||
Walks = 0x040, // of these are set
|
||||
Essential = 0x080,
|
||||
Skeleton = 0x400, // Does not have normal blood
|
||||
Metal = 0x800 // Has 'golden' blood
|
||||
Biped = 0x001,
|
||||
Respawn = 0x002,
|
||||
Weapon = 0x004, // Has weapon and shield
|
||||
None = 0x008, // ??
|
||||
Swims = 0x010,
|
||||
Flies = 0x020, // Don't know what happens if several
|
||||
Walks = 0x040, // of these are set
|
||||
Essential = 0x080,
|
||||
Skeleton = 0x400, // Does not have normal blood
|
||||
Metal = 0x800 // Has 'golden' blood
|
||||
};
|
||||
|
||||
enum Type
|
||||
{
|
||||
Creatures = 0,
|
||||
Deadra = 1,
|
||||
Undead = 2,
|
||||
Humanoid = 3
|
||||
Deadra = 1,
|
||||
Undead = 2,
|
||||
Humanoid = 3
|
||||
};
|
||||
|
||||
struct NPDTstruct
|
||||
|
@ -17,12 +17,12 @@ struct Dialogue
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Topic = 0,
|
||||
Voice = 1,
|
||||
Greeting = 2,
|
||||
Persuasion = 3,
|
||||
Journal = 4,
|
||||
Deleted = -1
|
||||
Topic = 0,
|
||||
Voice = 1,
|
||||
Greeting = 2,
|
||||
Persuasion = 3,
|
||||
Journal = 4,
|
||||
Deleted = -1
|
||||
};
|
||||
|
||||
char type;
|
||||
@ -37,11 +37,11 @@ struct Dialogue
|
||||
esm.getT(type);
|
||||
else if(si == 4)
|
||||
{
|
||||
// These are just markers, their values are not used.
|
||||
int i;
|
||||
esm.getT(i);
|
||||
esm.getHNT(i,"DELE");
|
||||
type = Deleted;
|
||||
// These are just markers, their values are not used.
|
||||
int i;
|
||||
esm.getT(i);
|
||||
esm.getHNT(i,"DELE");
|
||||
type = Deleted;
|
||||
}
|
||||
else esm.fail("Unknown sub record size");
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ struct Enchantment
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
CastOnce = 0,
|
||||
WhenStrikes = 1,
|
||||
WhenUsed = 2,
|
||||
ConstantEffect = 3
|
||||
CastOnce = 0,
|
||||
WhenStrikes = 1,
|
||||
WhenUsed = 2,
|
||||
ConstantEffect = 3
|
||||
};
|
||||
|
||||
struct ENDTstruct
|
||||
@ -25,7 +25,7 @@ struct Enchantment
|
||||
int cost;
|
||||
int charge;
|
||||
int autocalc; // Guessing this is 1 if we are supposed to auto
|
||||
// calculate
|
||||
// calculate
|
||||
};
|
||||
|
||||
ENDTstruct data;
|
||||
|
@ -14,12 +14,12 @@ struct RankData
|
||||
{
|
||||
int attribute1, attribute2; // Attribute level
|
||||
|
||||
int skill1, skill2; // Skill level (faction skills given in
|
||||
// skillID below.) You need one skill at
|
||||
// level 'skill1' and two skills at level
|
||||
// 'skill2' to advance to this rank.
|
||||
int skill1, skill2; // Skill level (faction skills given in
|
||||
// skillID below.) You need one skill at
|
||||
// level 'skill1' and two skills at level
|
||||
// 'skill2' to advance to this rank.
|
||||
|
||||
int factReaction; // Reaction from faction members
|
||||
int factReaction; // Reaction from faction members
|
||||
};
|
||||
|
||||
struct Faction
|
||||
@ -29,7 +29,7 @@ struct Faction
|
||||
struct FADTstruct
|
||||
{
|
||||
// Which attributes we like
|
||||
int attribute1, attribute2;
|
||||
int attribute1, attribute2;
|
||||
|
||||
RankData rankData[10];
|
||||
|
||||
|
@ -110,12 +110,12 @@ struct GameSetting
|
||||
"Return to Companion Share display."); // same
|
||||
cS("sCompanionWarningMessage",
|
||||
"Your mercenary is poorer now than when he contracted with you. Your mercenary will quit if you do not give him gold or goods to bring his Profit Value to a positive value.");
|
||||
// 'Your mercenary is poorer now than when he contracted with
|
||||
// you. Your mercenary will quit if you do not give him gold
|
||||
// or goods to bring his Profit to a positive value.'
|
||||
// [The difference here is "Profit Value" -> "Profit"]
|
||||
// 'Your mercenary is poorer now than when he contracted with
|
||||
// you. Your mercenary will quit if you do not give him gold
|
||||
// or goods to bring his Profit to a positive value.'
|
||||
// [The difference here is "Profit Value" -> "Profit"]
|
||||
|
||||
// Strings that matches the id
|
||||
// Strings that matches the id
|
||||
cS("sEffectSummonFabricant", id);// 'Summon Fabricant'
|
||||
return false;
|
||||
}
|
||||
@ -145,13 +145,13 @@ struct GameSetting
|
||||
cS("sEffectSummonCreature04", id); // same
|
||||
cS("sEffectSummonCreature05", id); // same
|
||||
|
||||
// Integers
|
||||
// Integers
|
||||
cI("iWereWolfBounty", 10000); // 1000
|
||||
cI("iWereWolfFightMod", 100); // same
|
||||
cI("iWereWolfFleeMod", 100); // same
|
||||
cI("iWereWolfLevelToAttack", 20); // same
|
||||
|
||||
// Floats
|
||||
// Floats
|
||||
cF("fFleeDistance", 3000); // same
|
||||
cF("fCombatDistanceWerewolfMod", 0.3); // same
|
||||
cF("fWereWolfFatigue", 400); // same
|
||||
@ -210,8 +210,8 @@ struct GameSetting
|
||||
// We are apparently allowed to be empty
|
||||
if(!esm.hasMoreSubs())
|
||||
{
|
||||
type = VT_None;
|
||||
return;
|
||||
type = VT_None;
|
||||
return;
|
||||
}
|
||||
|
||||
// Load some data
|
||||
@ -219,18 +219,18 @@ struct GameSetting
|
||||
NAME n = esm.retSubName();
|
||||
if(n == "STRV")
|
||||
{
|
||||
str = esm.getHString();
|
||||
type = VT_String;
|
||||
str = esm.getHString();
|
||||
type = VT_String;
|
||||
}
|
||||
else if(n == "INTV")
|
||||
{
|
||||
esm.getHT(i);
|
||||
type = VT_Int;
|
||||
type = VT_Int;
|
||||
}
|
||||
else if(n == "FLTV")
|
||||
{
|
||||
esm.getHT(f);
|
||||
type = VT_Float;
|
||||
type = VT_Float;
|
||||
}
|
||||
else
|
||||
esm.fail("Unwanted subrecord type");
|
||||
@ -242,7 +242,7 @@ struct GameSetting
|
||||
// the 'id' string correctly before calling load().
|
||||
|
||||
if( ( spf != SF_Tribunal && isDirtyTribunal() ) ||
|
||||
( spf != SF_Bloodmoon && isDirtyBloodmoon() ) )
|
||||
( spf != SF_Bloodmoon && isDirtyBloodmoon() ) )
|
||||
dirty = true;
|
||||
}
|
||||
};
|
||||
|
@ -14,15 +14,15 @@ struct Light
|
||||
{
|
||||
enum Flags
|
||||
{
|
||||
Dynamic = 0x001,
|
||||
Carry = 0x002, // Can be carried
|
||||
Negative = 0x004, // Negative light?
|
||||
Flicker = 0x008,
|
||||
Fire = 0x010,
|
||||
OffDefault = 0x020, // Off by default
|
||||
FlickerSlow = 0x040,
|
||||
Pulse = 0x080,
|
||||
PulseSlow = 0x100
|
||||
Dynamic = 0x001,
|
||||
Carry = 0x002, // Can be carried
|
||||
Negative = 0x004, // Negative light?
|
||||
Flicker = 0x008,
|
||||
Fire = 0x010,
|
||||
OffDefault = 0x020, // Off by default
|
||||
FlickerSlow = 0x040,
|
||||
Pulse = 0x080,
|
||||
PulseSlow = 0x100
|
||||
};
|
||||
|
||||
struct LHDTstruct
|
||||
|
@ -17,8 +17,8 @@ struct Misc
|
||||
float weight;
|
||||
int value;
|
||||
int isKey; // There are many keys in Morrowind.esm that has this
|
||||
// set to 0. TODO: Check what this field corresponds to
|
||||
// in the editor.
|
||||
// set to 0. TODO: Check what this field corresponds to
|
||||
// in the editor.
|
||||
};
|
||||
MCDTstruct data;
|
||||
|
||||
|
@ -17,36 +17,36 @@ struct NPC
|
||||
enum Services
|
||||
{
|
||||
// This merchant buys:
|
||||
Weapon = 0x00001,
|
||||
Armor = 0x00002,
|
||||
Clothing = 0x00004,
|
||||
Books = 0x00008,
|
||||
Ingredients = 0x00010,
|
||||
Picks = 0x00020,
|
||||
Probes = 0x00040,
|
||||
Lights = 0x00080,
|
||||
Apparatus = 0x00100,
|
||||
RepairItem = 0x00200,
|
||||
Misc = 0x00400,
|
||||
Weapon = 0x00001,
|
||||
Armor = 0x00002,
|
||||
Clothing = 0x00004,
|
||||
Books = 0x00008,
|
||||
Ingredients = 0x00010,
|
||||
Picks = 0x00020,
|
||||
Probes = 0x00040,
|
||||
Lights = 0x00080,
|
||||
Apparatus = 0x00100,
|
||||
RepairItem = 0x00200,
|
||||
Misc = 0x00400,
|
||||
|
||||
// Other services
|
||||
Spells = 0x00800,
|
||||
MagicItems = 0x01000,
|
||||
Potions = 0x02000,
|
||||
Training = 0x04000, // What skills?
|
||||
Spellmaking = 0x08000,
|
||||
Enchanting = 0x10000,
|
||||
Repair = 0x20000
|
||||
Spells = 0x00800,
|
||||
MagicItems = 0x01000,
|
||||
Potions = 0x02000,
|
||||
Training = 0x04000, // What skills?
|
||||
Spellmaking = 0x08000,
|
||||
Enchanting = 0x10000,
|
||||
Repair = 0x20000
|
||||
};
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Female = 0x0001,
|
||||
Female = 0x0001,
|
||||
Essential = 0x0002,
|
||||
Respawn = 0x0004,
|
||||
Autocalc = 0x0008,
|
||||
Skeleton = 0x0400, // Skeleton blood effect (white)
|
||||
Metal = 0x0800 // Metal blood effect (golden?)
|
||||
Respawn = 0x0004,
|
||||
Autocalc = 0x0008,
|
||||
Skeleton = 0x0400, // Skeleton blood effect (white)
|
||||
Metal = 0x0800 // Metal blood effect (golden?)
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
|
@ -14,7 +14,7 @@ struct PathGrid
|
||||
{
|
||||
int x, y; // Grid location, matches cell for exterior cells
|
||||
short s1; // ?? Usually but not always a power of 2. Doesn't seem
|
||||
// to have any relation to the size of PGRC.
|
||||
// to have any relation to the size of PGRC.
|
||||
short s2; // Number of path points? Size of PGRP block is always 16 * s2;
|
||||
}; // 12 bytes
|
||||
|
||||
@ -35,9 +35,9 @@ struct PathGrid
|
||||
if(esm.isNextSub("PGRP"))
|
||||
{
|
||||
esm.skipHSub();
|
||||
int size = esm.getSubSize();
|
||||
if(size != 16*data.s2)
|
||||
esm.fail("Path grid table size mismatch");
|
||||
int size = esm.getSubSize();
|
||||
if(size != 16*data.s2)
|
||||
esm.fail("Path grid table size mismatch");
|
||||
}
|
||||
|
||||
// Size varies. Path grid chances? Connections? Multiples of 4
|
||||
@ -45,10 +45,10 @@ struct PathGrid
|
||||
// it later.
|
||||
if(esm.isNextSub("PGRC"))
|
||||
{
|
||||
esm.skipHSub();
|
||||
int size = esm.getSubSize();
|
||||
if(size % 4 != 0)
|
||||
esm.fail("PGRC size not a multiple of 4");
|
||||
esm.skipHSub();
|
||||
int size = esm.getSubSize();
|
||||
if(size % 4 != 0)
|
||||
esm.fail("PGRC size not a multiple of 4");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -29,8 +29,8 @@ struct Race
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Playable = 0x01,
|
||||
Beast = 0x02
|
||||
Playable = 0x01,
|
||||
Beast = 0x02
|
||||
};
|
||||
|
||||
struct RADTstruct
|
||||
|
@ -3,31 +3,31 @@
|
||||
namespace ESMS
|
||||
{
|
||||
const std::string Skill::sSkillNames[Length] = {
|
||||
"Block",
|
||||
"Armorer",
|
||||
"Medium Armor",
|
||||
"Heavy Armor",
|
||||
"Blunt Weapon",
|
||||
"Long Blade",
|
||||
"Axe",
|
||||
"Spear",
|
||||
"Athletics",
|
||||
"Enchant",
|
||||
"Destruction",
|
||||
"Alteration",
|
||||
"Illusion",
|
||||
"Conjuration",
|
||||
"Mysticism",
|
||||
"Restoration",
|
||||
"Alchemy",
|
||||
"Unarmored",
|
||||
"Security",
|
||||
"Sneak",
|
||||
"Acrobatics",
|
||||
"Light Armor",
|
||||
"Short Blade",
|
||||
"Marksman",
|
||||
"Speechcraft",
|
||||
"Hand To Hand",
|
||||
};
|
||||
"Block",
|
||||
"Armorer",
|
||||
"Medium Armor",
|
||||
"Heavy Armor",
|
||||
"Blunt Weapon",
|
||||
"Long Blade",
|
||||
"Axe",
|
||||
"Spear",
|
||||
"Athletics",
|
||||
"Enchant",
|
||||
"Destruction",
|
||||
"Alteration",
|
||||
"Illusion",
|
||||
"Conjuration",
|
||||
"Mysticism",
|
||||
"Restoration",
|
||||
"Alchemy",
|
||||
"Unarmored",
|
||||
"Security",
|
||||
"Sneak",
|
||||
"Acrobatics",
|
||||
"Light Armor",
|
||||
"Short Blade",
|
||||
"Marksman",
|
||||
"Speechcraft",
|
||||
"Hand To Hand",
|
||||
};
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ struct Skill
|
||||
int attribute; // see defs.hpp
|
||||
int specialization;// 0 - Combat, 1 - Magic, 2 - Stealth
|
||||
float useValue[4]; // How much skill improves through use. Meaning
|
||||
// of each field depends on what skill this
|
||||
// is. We should document this better later.
|
||||
// of each field depends on what skill this
|
||||
// is. We should document this better later.
|
||||
}; // Total size: 24 bytes
|
||||
SKDTstruct data;
|
||||
|
||||
|
@ -13,14 +13,14 @@ struct SoundGenerator
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
LeftFoot = 0,
|
||||
LeftFoot = 0,
|
||||
RightFoot = 1,
|
||||
SwimLeft = 2,
|
||||
SwimLeft = 2,
|
||||
SwimRight = 3,
|
||||
Moan = 4,
|
||||
Roar = 5,
|
||||
Scream = 6,
|
||||
Land = 7
|
||||
Moan = 4,
|
||||
Roar = 5,
|
||||
Scream = 6,
|
||||
Land = 7
|
||||
};
|
||||
|
||||
// Type
|
||||
|
@ -12,7 +12,7 @@ struct Spell
|
||||
ST_Spell = 0, // Normal spell, must be cast and costs mana
|
||||
ST_Ability = 1, // Inert ability, always in effect
|
||||
ST_Blight = 2, // Blight disease
|
||||
ST_Disease = 3, // Common disease
|
||||
ST_Disease = 3, // Common disease
|
||||
ST_Curse = 4, // Curse (?)
|
||||
ST_Power = 5 // Power, can use once a day
|
||||
};
|
||||
|
@ -13,26 +13,26 @@ struct Weapon
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
ShortBladeOneHand = 0,
|
||||
LongBladeOneHand = 1,
|
||||
LongBladeTwoHand = 2,
|
||||
BluntOneHand = 3,
|
||||
BluntTwoClose = 4,
|
||||
BluntTwoWide = 5,
|
||||
SpearTwoWide = 6,
|
||||
AxeOneHand = 7,
|
||||
AxeTwoHand = 8,
|
||||
MarksmanBow = 9,
|
||||
MarksmanCrossbow = 10,
|
||||
MarksmanThrown = 11,
|
||||
Arrow = 12,
|
||||
Bolt = 13
|
||||
ShortBladeOneHand = 0,
|
||||
LongBladeOneHand = 1,
|
||||
LongBladeTwoHand = 2,
|
||||
BluntOneHand = 3,
|
||||
BluntTwoClose = 4,
|
||||
BluntTwoWide = 5,
|
||||
SpearTwoWide = 6,
|
||||
AxeOneHand = 7,
|
||||
AxeTwoHand = 8,
|
||||
MarksmanBow = 9,
|
||||
MarksmanCrossbow = 10,
|
||||
MarksmanThrown = 11,
|
||||
Arrow = 12,
|
||||
Bolt = 13
|
||||
};
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Magical = 0x01,
|
||||
Silver = 0x02
|
||||
Magical = 0x01,
|
||||
Silver = 0x02
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
using namespace boost::algorithm;
|
||||
|
||||
|
||||
namespace ESMS
|
||||
{
|
||||
using namespace ESM;
|
||||
@ -241,12 +241,12 @@ namespace ESMS
|
||||
struct ciLessBoost : std::binary_function<std::string, std::string, bool>
|
||||
{
|
||||
bool operator() (const std::string & s1, const std::string & s2) const {
|
||||
//case insensitive version of is_less
|
||||
//case insensitive version of is_less
|
||||
return lexicographical_compare(s1, s2, is_iless());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Cells aren't simply indexed by name. Exterior cells are treated
|
||||
// separately.
|
||||
// TODO: case handling (cell names are case-insensitive, but they are also showen to the
|
||||
|
@ -16,7 +16,7 @@ std::string macBundlePath()
|
||||
char path[1024];
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
assert(mainBundle);
|
||||
|
||||
|
||||
CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
|
||||
assert(mainBundleURL);
|
||||
|
||||
|
@ -333,7 +333,7 @@ void NIFLoader::findRealTexture(String &texName)
|
||||
// mesh.
|
||||
void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std::list<VertexBoneAssignment> &vertexBoneAssignments)
|
||||
{
|
||||
// cout << "s:" << shape << "\n";
|
||||
// cout << "s:" << shape << "\n";
|
||||
NiTriShapeData *data = shape->data.getPtr();
|
||||
SubMesh *sub = mesh->createSubMesh(shape->name.toString());
|
||||
|
||||
@ -426,7 +426,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std
|
||||
for (std::list<VertexBoneAssignment>::iterator it = vertexBoneAssignments.begin();
|
||||
it != vertexBoneAssignments.end(); it++)
|
||||
{
|
||||
sub->addBoneAssignment(*it);
|
||||
sub->addBoneAssignment(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -476,8 +476,8 @@ static void vectorMul(const Matrix &A, float *C)
|
||||
|
||||
void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bounds)
|
||||
{
|
||||
//if( MWClass::Npc.isChest)
|
||||
//cout << "t:" << shape << "\n";
|
||||
//if( MWClass::Npc.isChest)
|
||||
//cout << "t:" << shape << "\n";
|
||||
assert(shape != NULL);
|
||||
|
||||
// Interpret flags
|
||||
@ -727,9 +727,9 @@ void NIFLoader::handleNiTriShape(NiTriShape *shape, int flags, BoundsFinder &bou
|
||||
void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||
const Transformation *trafo, BoundsFinder &bounds, Bone *parentBone)
|
||||
{
|
||||
stack++;
|
||||
//if( MWClass::isChest)
|
||||
// cout << "u:" << node << "\n";
|
||||
stack++;
|
||||
//if( MWClass::isChest)
|
||||
// cout << "u:" << node << "\n";
|
||||
// Accumulate the flags from all the child nodes. This works for all
|
||||
// the flags we currently use, at least.
|
||||
flags |= node->flags;
|
||||
@ -779,8 +779,8 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||
if (!skel.isNull()) //if there is a skeleton
|
||||
{
|
||||
std::string name = node->name.toString();
|
||||
//if (isBeast && isChest)
|
||||
// std::cout << "NAME: " << name << "\n";
|
||||
//if (isBeast && isChest)
|
||||
// std::cout << "NAME: " << name << "\n";
|
||||
// Quick-n-dirty workaround for the fact that several
|
||||
// bones may have the same name.
|
||||
if(!skel->hasBone(name))
|
||||
@ -823,199 +823,199 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||
{
|
||||
NodeList &list = ((NiNode*)node)->children;
|
||||
int n = list.length();
|
||||
int i = 0;
|
||||
if(isHands){
|
||||
//cout << "NumberOfNs: " << n << "Stack:" << stack << "\n";
|
||||
//if(stack == 3)
|
||||
//n=0;
|
||||
}
|
||||
int i = 0;
|
||||
if(isHands){
|
||||
//cout << "NumberOfNs: " << n << "Stack:" << stack << "\n";
|
||||
//if(stack == 3)
|
||||
//n=0;
|
||||
}
|
||||
for (; i<n; i++)
|
||||
{
|
||||
|
||||
|
||||
if (list.has(i))
|
||||
handleNode(&list[i], flags, node->trafo, bounds, bone);
|
||||
}
|
||||
}
|
||||
else if (node->recType == RC_NiTriShape)
|
||||
{
|
||||
{
|
||||
// For shapes
|
||||
/*For Beast Skins, Shape Bone Names
|
||||
Tri Left Foot
|
||||
Tri Right Foot
|
||||
Tri Tail
|
||||
Tri Chest
|
||||
*/
|
||||
if((isChest && stack < 10 ) || (isHands && counter < 3) || !(isChest || isHands)){ //(isBeast && isChest && stack < 10 && counter == skincounter )
|
||||
|
||||
std::string name = node->name.toString();
|
||||
//if (isChest)
|
||||
//std::cout << "NAME: " << name << "\n";
|
||||
/*For Beast Skins, Shape Bone Names
|
||||
Tri Left Foot
|
||||
Tri Right Foot
|
||||
Tri Tail
|
||||
Tri Chest
|
||||
*/
|
||||
if((isChest && stack < 10 ) || (isHands && counter < 3) || !(isChest || isHands)){ //(isBeast && isChest && stack < 10 && counter == skincounter )
|
||||
|
||||
std::string name = node->name.toString();
|
||||
//if (isChest)
|
||||
//std::cout << "NAME: " << name << "\n";
|
||||
|
||||
if(isChest && isBeast && skincounter == 0 && name.compare("Tri Chest") == 0){
|
||||
//std::cout <<"BEASTCHEST1\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter++;
|
||||
}
|
||||
else if(isChest && isBeast && skincounter == 1 && name.compare("Tri Tail") == 0){
|
||||
//std::cout <<"BEASTCHEST2\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter++;
|
||||
}
|
||||
else if(isChest && isBeast && skincounter == 2 && name.compare("Tri Left Foot") == 0){
|
||||
//std::cout <<"BEASTCHEST3\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter=1000;
|
||||
}
|
||||
else if (!isChest || !isBeast)
|
||||
{
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
}
|
||||
//if(isBeast && isChest)
|
||||
//cout << "Handling Shape, Stack " << stack <<"\n";
|
||||
if(isChest && isBeast && skincounter == 0 && name.compare("Tri Chest") == 0){
|
||||
//std::cout <<"BEASTCHEST1\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter++;
|
||||
}
|
||||
else if(isChest && isBeast && skincounter == 1 && name.compare("Tri Tail") == 0){
|
||||
//std::cout <<"BEASTCHEST2\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter++;
|
||||
}
|
||||
else if(isChest && isBeast && skincounter == 2 && name.compare("Tri Left Foot") == 0){
|
||||
//std::cout <<"BEASTCHEST3\n";
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
skincounter=1000;
|
||||
}
|
||||
else if (!isChest || !isBeast)
|
||||
{
|
||||
handleNiTriShape(dynamic_cast<NiTriShape*>(node), flags, bounds);
|
||||
}
|
||||
//if(isBeast && isChest)
|
||||
//cout << "Handling Shape, Stack " << stack <<"\n";
|
||||
|
||||
|
||||
|
||||
counter++;
|
||||
}
|
||||
/*if(isHands){
|
||||
//cout << "Handling Shape, Stack " << stack <<"\n";
|
||||
counter++;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
counter++;
|
||||
}
|
||||
/*if(isHands){
|
||||
//cout << "Handling Shape, Stack " << stack <<"\n";
|
||||
counter++;
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
stack--;
|
||||
stack--;
|
||||
}
|
||||
|
||||
void NIFLoader::loadResource(Resource *resource)
|
||||
{
|
||||
if(skincounter == 1000)
|
||||
skincounter = 0;
|
||||
stack = 0;
|
||||
counter = 0;
|
||||
std::string name = resource->getName();
|
||||
if(resourceName.compare(name) != 0)
|
||||
{
|
||||
skincounter = 0;
|
||||
resourceName = name;
|
||||
}
|
||||
//std::cout <<"NAME:" << name;
|
||||
//if(name.length() >= 20)
|
||||
// {std::string split = name.substr(name.length() - 20, 20);
|
||||
//if(name ==
|
||||
//std::cout <<"NAME:" << name << "LEN: " << name.length() << "\n";
|
||||
const std::string test ="meshes\\b\\B_N_Dark Elf_M_Skins.NIF";
|
||||
const std::string test2 ="meshes\\b\\B_N_Dark Elf_M_Skins.nif";
|
||||
const std::string test3 ="meshes\\b\\B_N_Redguard_F_Skins.NIF";
|
||||
const std::string test4 ="meshes\\b\\B_N_Redguard_F_Skins.nif";
|
||||
const std::string test5 ="meshes\\b\\B_N_Dark Elf_F_Skins.nif";
|
||||
const std::string test6 ="meshes\\b\\B_N_Redguard_M_Skins.nif";
|
||||
const std::string test7 ="meshes\\b\\B_N_Wood Elf_F_Skins.nif";
|
||||
const std::string test8 ="meshes\\b\\B_N_Wood Elf_M_Skins.nif";
|
||||
const std::string test9 ="meshes\\b\\B_N_Imperial_F_Skins.nif";
|
||||
const std::string test10 ="meshes\\b\\B_N_Imperial_M_Skins.nif";
|
||||
const std::string test11 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string test12 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string test13 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string test14 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string test15 ="meshes\\b\\B_N_Nord_F_Skins.nif";
|
||||
const std::string test16 ="meshes\\b\\B_N_Nord_M_Skins.nif";
|
||||
const std::string test17 ="meshes\\b\\B_N_Imperial_F_Skins.nif";
|
||||
const std::string test18 ="meshes\\b\\B_N_Imperial_M_Skins.nif";
|
||||
const std::string test19 ="meshes\\b\\B_N_Orc_F_Skins.nif";
|
||||
const std::string test20 ="meshes\\b\\B_N_Orc_M_Skins.nif";
|
||||
const std::string test21 ="meshes\\b\\B_N_Breton_F_Skins.nif";
|
||||
const std::string test22 ="meshes\\b\\B_N_Breton_M_Skins.nif";
|
||||
const std::string test23 ="meshes\\b\\B_N_High Elf_F_Skins.nif";
|
||||
const std::string test24 ="meshes\\b\\B_N_High Elf_M_Skins.nif";
|
||||
if(skincounter == 1000)
|
||||
skincounter = 0;
|
||||
stack = 0;
|
||||
counter = 0;
|
||||
std::string name = resource->getName();
|
||||
if(resourceName.compare(name) != 0)
|
||||
{
|
||||
skincounter = 0;
|
||||
resourceName = name;
|
||||
}
|
||||
//std::cout <<"NAME:" << name;
|
||||
//if(name.length() >= 20)
|
||||
// {std::string split = name.substr(name.length() - 20, 20);
|
||||
//if(name ==
|
||||
//std::cout <<"NAME:" << name << "LEN: " << name.length() << "\n";
|
||||
const std::string test ="meshes\\b\\B_N_Dark Elf_M_Skins.NIF";
|
||||
const std::string test2 ="meshes\\b\\B_N_Dark Elf_M_Skins.nif";
|
||||
const std::string test3 ="meshes\\b\\B_N_Redguard_F_Skins.NIF";
|
||||
const std::string test4 ="meshes\\b\\B_N_Redguard_F_Skins.nif";
|
||||
const std::string test5 ="meshes\\b\\B_N_Dark Elf_F_Skins.nif";
|
||||
const std::string test6 ="meshes\\b\\B_N_Redguard_M_Skins.nif";
|
||||
const std::string test7 ="meshes\\b\\B_N_Wood Elf_F_Skins.nif";
|
||||
const std::string test8 ="meshes\\b\\B_N_Wood Elf_M_Skins.nif";
|
||||
const std::string test9 ="meshes\\b\\B_N_Imperial_F_Skins.nif";
|
||||
const std::string test10 ="meshes\\b\\B_N_Imperial_M_Skins.nif";
|
||||
const std::string test11 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string test12 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string test13 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string test14 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string test15 ="meshes\\b\\B_N_Nord_F_Skins.nif";
|
||||
const std::string test16 ="meshes\\b\\B_N_Nord_M_Skins.nif";
|
||||
const std::string test17 ="meshes\\b\\B_N_Imperial_F_Skins.nif";
|
||||
const std::string test18 ="meshes\\b\\B_N_Imperial_M_Skins.nif";
|
||||
const std::string test19 ="meshes\\b\\B_N_Orc_F_Skins.nif";
|
||||
const std::string test20 ="meshes\\b\\B_N_Orc_M_Skins.nif";
|
||||
const std::string test21 ="meshes\\b\\B_N_Breton_F_Skins.nif";
|
||||
const std::string test22 ="meshes\\b\\B_N_Breton_M_Skins.nif";
|
||||
const std::string test23 ="meshes\\b\\B_N_High Elf_F_Skins.nif";
|
||||
const std::string test24 ="meshes\\b\\B_N_High Elf_M_Skins.nif";
|
||||
|
||||
//std::cout <<"LEN1:" << test.length() << "TEST: " << test << "\n";
|
||||
|
||||
|
||||
if(name.compare(test) == 0 || name.compare(test2) == 0 || name.compare(test3) == 0 || name.compare(test4) == 0 ||
|
||||
name.compare(test5) == 0 || name.compare(test6) == 0 || name.compare(test7) == 0 || name.compare(test8) == 0 || name.compare(test9) == 0 ||
|
||||
name.compare(test10) == 0 || name.compare(test11) == 0 || name.compare(test12) == 0 || name.compare(test13) == 0 ||
|
||||
name.compare(test14) == 0 || name.compare(test15) == 0 || name.compare(test16) == 0 || name.compare(test17) == 0 ||
|
||||
name.compare(test18) == 0 || name.compare(test19) == 0 || name.compare(test20) == 0 || name.compare(test21) == 0 ||
|
||||
name.compare(test22) == 0 || name.compare(test23) == 0 || name.compare(test24) == 0
|
||||
|
||||
){
|
||||
//std::cout << "Welcome Chest\n";
|
||||
isChest = true;
|
||||
if(name.compare(test11) == 0 || name.compare(test12) == 0 || name.compare(test13) == 0 || name.compare(test14) == 0)
|
||||
{
|
||||
isBeast = true;
|
||||
//std::cout << "Welcome Beast\n";
|
||||
}
|
||||
else
|
||||
isBeast = false;
|
||||
}
|
||||
else
|
||||
isChest = false;
|
||||
const std::string hands ="meshes\\b\\B_N_Dark Elf_M_Hands.1st.NIF";
|
||||
const std::string hands2 ="meshes\\b\\B_N_Dark Elf_F_Hands.1st.NIF";
|
||||
const std::string hands3 ="meshes\\b\\B_N_Redguard_M_Hands.1st.nif";
|
||||
const std::string hands4 ="meshes\\b\\B_N_Redguard_F_Hands.1st.nif";
|
||||
const std::string hands5 ="meshes\\b\\b_n_argonian_m_hands.1st.nif";
|
||||
const std::string hands6 ="meshes\\b\\b_n_argonian_f_hands.1st.nif";
|
||||
const std::string hands7 ="meshes\\b\\B_N_Breton_M_Hand.1st.NIF";
|
||||
const std::string hands8 ="meshes\\b\\B_N_Breton_F_Hands.1st.nif";
|
||||
const std::string hands9 ="meshes\\b\\B_N_High Elf_M_Hands.1st.nif";
|
||||
const std::string hands10 ="meshes\\b\\B_N_High Elf_F_Hands.1st.nif";
|
||||
const std::string hands11 ="meshes\\b\\B_N_Nord_M_Hands.1st.nif";
|
||||
const std::string hands12 ="meshes\\b\\B_N_Nord_F_Hands.1st.nif";
|
||||
const std::string hands13 ="meshes\\b\\b_n_khajiit_m_hands.1st.nif";
|
||||
const std::string hands14 ="meshes\\b\\b_n_khajiit_f_hands.1st.nif";
|
||||
const std::string hands15 ="meshes\\b\\B_N_Orc_M_Hands.1st.nif";
|
||||
const std::string hands16 ="meshes\\b\\B_N_Orc_F_Hands.1st.nif";
|
||||
const std::string hands17 ="meshes\\b\\B_N_Wood Elf_M_Hands.1st.nif";
|
||||
const std::string hands18 ="meshes\\b\\B_N_Wood Elf_F_Hands.1st.nif";
|
||||
const std::string hands19 ="meshes\\b\\B_N_Imperial_M_Hands.1st.nif";
|
||||
const std::string hands20 ="meshes\\b\\B_N_Imperial_F_Hands.1st.nif";
|
||||
if(name.compare(hands) == 0 || name.compare(hands2) == 0 || name.compare(hands3) == 0 || name.compare(hands4) == 0 ||
|
||||
name.compare(hands5) == 0 || name.compare(hands6) == 0 || name.compare(hands7) == 0 || name.compare(hands8) == 0 ||
|
||||
name.compare(hands9) == 0 || name.compare(hands10) == 0 || name.compare(hands11) == 0 || name.compare(hands12) == 0 ||
|
||||
name.compare(hands13) == 0 || name.compare(hands14) == 0 || name.compare(hands15) == 0 || name.compare(hands16) == 0 ||
|
||||
name.compare(hands17) == 0 || name.compare(hands18) == 0 || name.compare(hands19) == 0 || name.compare(hands20) == 0)
|
||||
{
|
||||
//std::cout << "Welcome Hands1st\n";
|
||||
isHands = true;
|
||||
isChest = false;
|
||||
}
|
||||
else
|
||||
isHands = false;
|
||||
//std::cout <<"LEN1:" << test.length() << "TEST: " << test << "\n";
|
||||
|
||||
|
||||
if(name.compare(test) == 0 || name.compare(test2) == 0 || name.compare(test3) == 0 || name.compare(test4) == 0 ||
|
||||
name.compare(test5) == 0 || name.compare(test6) == 0 || name.compare(test7) == 0 || name.compare(test8) == 0 || name.compare(test9) == 0 ||
|
||||
name.compare(test10) == 0 || name.compare(test11) == 0 || name.compare(test12) == 0 || name.compare(test13) == 0 ||
|
||||
name.compare(test14) == 0 || name.compare(test15) == 0 || name.compare(test16) == 0 || name.compare(test17) == 0 ||
|
||||
name.compare(test18) == 0 || name.compare(test19) == 0 || name.compare(test20) == 0 || name.compare(test21) == 0 ||
|
||||
name.compare(test22) == 0 || name.compare(test23) == 0 || name.compare(test24) == 0
|
||||
|
||||
){
|
||||
//std::cout << "Welcome Chest\n";
|
||||
isChest = true;
|
||||
if(name.compare(test11) == 0 || name.compare(test12) == 0 || name.compare(test13) == 0 || name.compare(test14) == 0)
|
||||
{
|
||||
isBeast = true;
|
||||
//std::cout << "Welcome Beast\n";
|
||||
}
|
||||
else
|
||||
isBeast = false;
|
||||
}
|
||||
else
|
||||
isChest = false;
|
||||
const std::string hands ="meshes\\b\\B_N_Dark Elf_M_Hands.1st.NIF";
|
||||
const std::string hands2 ="meshes\\b\\B_N_Dark Elf_F_Hands.1st.NIF";
|
||||
const std::string hands3 ="meshes\\b\\B_N_Redguard_M_Hands.1st.nif";
|
||||
const std::string hands4 ="meshes\\b\\B_N_Redguard_F_Hands.1st.nif";
|
||||
const std::string hands5 ="meshes\\b\\b_n_argonian_m_hands.1st.nif";
|
||||
const std::string hands6 ="meshes\\b\\b_n_argonian_f_hands.1st.nif";
|
||||
const std::string hands7 ="meshes\\b\\B_N_Breton_M_Hand.1st.NIF";
|
||||
const std::string hands8 ="meshes\\b\\B_N_Breton_F_Hands.1st.nif";
|
||||
const std::string hands9 ="meshes\\b\\B_N_High Elf_M_Hands.1st.nif";
|
||||
const std::string hands10 ="meshes\\b\\B_N_High Elf_F_Hands.1st.nif";
|
||||
const std::string hands11 ="meshes\\b\\B_N_Nord_M_Hands.1st.nif";
|
||||
const std::string hands12 ="meshes\\b\\B_N_Nord_F_Hands.1st.nif";
|
||||
const std::string hands13 ="meshes\\b\\b_n_khajiit_m_hands.1st.nif";
|
||||
const std::string hands14 ="meshes\\b\\b_n_khajiit_f_hands.1st.nif";
|
||||
const std::string hands15 ="meshes\\b\\B_N_Orc_M_Hands.1st.nif";
|
||||
const std::string hands16 ="meshes\\b\\B_N_Orc_F_Hands.1st.nif";
|
||||
const std::string hands17 ="meshes\\b\\B_N_Wood Elf_M_Hands.1st.nif";
|
||||
const std::string hands18 ="meshes\\b\\B_N_Wood Elf_F_Hands.1st.nif";
|
||||
const std::string hands19 ="meshes\\b\\B_N_Imperial_M_Hands.1st.nif";
|
||||
const std::string hands20 ="meshes\\b\\B_N_Imperial_F_Hands.1st.nif";
|
||||
if(name.compare(hands) == 0 || name.compare(hands2) == 0 || name.compare(hands3) == 0 || name.compare(hands4) == 0 ||
|
||||
name.compare(hands5) == 0 || name.compare(hands6) == 0 || name.compare(hands7) == 0 || name.compare(hands8) == 0 ||
|
||||
name.compare(hands9) == 0 || name.compare(hands10) == 0 || name.compare(hands11) == 0 || name.compare(hands12) == 0 ||
|
||||
name.compare(hands13) == 0 || name.compare(hands14) == 0 || name.compare(hands15) == 0 || name.compare(hands16) == 0 ||
|
||||
name.compare(hands17) == 0 || name.compare(hands18) == 0 || name.compare(hands19) == 0 || name.compare(hands20) == 0)
|
||||
{
|
||||
//std::cout << "Welcome Hands1st\n";
|
||||
isHands = true;
|
||||
isChest = false;
|
||||
}
|
||||
else
|
||||
isHands = false;
|
||||
|
||||
|
||||
/*
|
||||
else if(name.compare(test3) == 0 || name.compare(test4) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test5) == 0 || name.compare(test6) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test7) == 0 || name.compare(test8) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test9) == 0 || name.compare(test10) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}*/
|
||||
|
||||
//if(split== "Skins.NIF")
|
||||
// std::cout << "\nSPECIAL PROPS\n";
|
||||
/*
|
||||
else if(name.compare(test3) == 0 || name.compare(test4) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test5) == 0 || name.compare(test6) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test7) == 0 || name.compare(test8) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}
|
||||
else if(name.compare(test9) == 0 || name.compare(test10) == 0)
|
||||
{
|
||||
std::cout << "\n\n\nWelcome FRedguard Chest\n\n\n";
|
||||
isChest = true;
|
||||
}*/
|
||||
|
||||
//if(split== "Skins.NIF")
|
||||
// std::cout << "\nSPECIAL PROPS\n";
|
||||
resourceName = "";
|
||||
MeshManager *m = MeshManager::getSingletonPtr();
|
||||
MeshManager *m = MeshManager::getSingletonPtr();
|
||||
// Check if the resource already exists
|
||||
//MeshPtr ptr = m->load(name, "custom");
|
||||
//cout << "THISNAME: " << ptr->getName() << "\n";
|
||||
//cout << "RESOURCE:"<< resource->getName();
|
||||
//cout << "THISNAME: " << ptr->getName() << "\n";
|
||||
//cout << "RESOURCE:"<< resource->getName();
|
||||
mesh = 0;
|
||||
skel.setNull();
|
||||
|
||||
@ -1028,7 +1028,7 @@ void NIFLoader::loadResource(Resource *resource)
|
||||
|
||||
// Look it up
|
||||
resourceName = mesh->getName();
|
||||
//std::cout << resourceName << "\n";
|
||||
//std::cout << resourceName << "\n";
|
||||
|
||||
if (!vfs->isFile(resourceName))
|
||||
{
|
||||
@ -1086,52 +1086,52 @@ MeshPtr NIFLoader::load(const std::string &name,
|
||||
MeshManager *m = MeshManager::getSingletonPtr();
|
||||
// Check if the resource already exists
|
||||
ResourcePtr ptr = m->getByName(name, group);
|
||||
MeshPtr resize;
|
||||
|
||||
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
MeshPtr resize;
|
||||
|
||||
const std::string beast1 ="meshes\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beast2 ="meshes\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beast3 ="meshes\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beast4 ="meshes\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
const std::string beasttail1 ="tail\\b\\B_N_Khajiit_F_Skins.nif";
|
||||
const std::string beasttail2 ="tail\\b\\B_N_Khajiit_M_Skins.nif";
|
||||
const std::string beasttail3 ="tail\\b\\B_N_Argonian_F_Skins.nif";
|
||||
const std::string beasttail4 ="tail\\b\\B_N_Argonian_M_Skins.nif";
|
||||
|
||||
if (!ptr.isNull()){
|
||||
|
||||
//if(pieces > 1)
|
||||
//cout << "It exists\n";
|
||||
resize = MeshPtr(ptr);
|
||||
//resize->load();
|
||||
//resize->reload();
|
||||
}
|
||||
else // Nope, create a new one.
|
||||
{
|
||||
resize = MeshManager::getSingleton().createManual(name, group, NIFLoader::getSingletonPtr());
|
||||
//cout <<"EXISTING" << name << "\n";
|
||||
|
||||
//if(pieces > 1)
|
||||
//cout << "Creating it\n";
|
||||
|
||||
|
||||
//resize->load();
|
||||
//resize->reload();
|
||||
//return 0;
|
||||
ResourcePtr ptr = m->getByName(name, group);
|
||||
resize = MeshPtr(ptr);
|
||||
|
||||
//NIFLoader::getSingletonPtr()->
|
||||
/*ResourcePtr ptr = m->getByName(name, group);
|
||||
|
||||
//if(pieces > 1)
|
||||
//cout << "It exists\n";
|
||||
resize = MeshPtr(ptr);
|
||||
//resize->load();
|
||||
//resize->reload();
|
||||
}
|
||||
else // Nope, create a new one.
|
||||
{
|
||||
resize = MeshManager::getSingleton().createManual(name, group, NIFLoader::getSingletonPtr());
|
||||
//cout <<"EXISTING" << name << "\n";
|
||||
|
||||
//if(pieces > 1)
|
||||
//cout << "Creating it\n";
|
||||
|
||||
|
||||
//resize->load();
|
||||
//resize->reload();
|
||||
//return 0;
|
||||
ResourcePtr ptr = m->getByName(name, group);
|
||||
resize = MeshPtr(ptr);
|
||||
|
||||
//NIFLoader::getSingletonPtr()->
|
||||
/*ResourcePtr ptr = m->getByName(name, group);
|
||||
if (!ptr.isNull()){
|
||||
if(pieces > 1)
|
||||
cout << "It exists\n";
|
||||
resize = MeshPtr(ptr);*/
|
||||
//return resize;
|
||||
}
|
||||
return resize;
|
||||
if(pieces > 1)
|
||||
cout << "It exists\n";
|
||||
resize = MeshPtr(ptr);*/
|
||||
//return resize;
|
||||
}
|
||||
return resize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* More code currently not in use, from the old D source. This was
|
||||
used in the first attempt at loading NIF meshes, where each submesh
|
||||
@ -1146,9 +1146,9 @@ MeshPtr NIFLoader::load(const std::string &name,
|
||||
extern "C" void ogre_insertTexture(char* name, uint32_t width, uint32_t height, void *data)
|
||||
{
|
||||
TexturePtr texture = TextureManager::getSingleton().createManual(
|
||||
name, // name
|
||||
"General", // group
|
||||
TEX_TYPE_2D, // type
|
||||
name, // name
|
||||
"General", // group
|
||||
TEX_TYPE_2D, // type
|
||||
width, height, // width & height
|
||||
0, // number of mipmaps
|
||||
PF_BYTE_RGBA, // pixel format
|
||||
|
@ -67,17 +67,17 @@ namespace Mangle
|
||||
class NIFLoader : Ogre::ManualResourceLoader
|
||||
{
|
||||
public:
|
||||
static int numberOfMeshes;
|
||||
static int numberOfMeshes;
|
||||
static NIFLoader& getSingleton();
|
||||
static NIFLoader* getSingletonPtr();
|
||||
|
||||
virtual void loadResource(Ogre::Resource *resource);
|
||||
|
||||
static Ogre::MeshPtr load(const std::string &name,
|
||||
static Ogre::MeshPtr load(const std::string &name,
|
||||
const std::string &group="General");
|
||||
|
||||
|
||||
|
||||
|
||||
Ogre::Vector3 convertVector3(const Nif::Vector& vec);
|
||||
Ogre::Quaternion convertRotation(const Nif::Matrix& rot);
|
||||
|
||||
@ -123,15 +123,15 @@ class NIFLoader : Ogre::ManualResourceLoader
|
||||
|
||||
std::string resourceName;
|
||||
std::string resourceGroup;
|
||||
int skincounter;
|
||||
bool isChest;
|
||||
bool isBeast;
|
||||
bool isHands;
|
||||
bool isFeet;
|
||||
int counter;
|
||||
int numbers;
|
||||
int stack;
|
||||
|
||||
int skincounter;
|
||||
bool isChest;
|
||||
bool isBeast;
|
||||
bool isHands;
|
||||
bool isFeet;
|
||||
int counter;
|
||||
int numbers;
|
||||
int stack;
|
||||
|
||||
|
||||
// pointer to the ogre mesh which is currently build
|
||||
Ogre::Mesh *mesh;
|
||||
|
@ -1,256 +0,0 @@
|
||||
/* //This is old
|
||||
if (pieces > 1){ //pieces > 1
|
||||
MeshPtr justChest = MeshManager::getSingleton().createManual("justchest", group, NIFLoader::getSingletonPtr());
|
||||
Ogre::AxisAlignedBox bounds = resize->getBounds();
|
||||
Ogre::Vector3 width2 = bounds.getCorner(bounds.NEAR_RIGHT_BOTTOM) - bounds.getCorner(bounds.NEAR_LEFT_BOTTOM);
|
||||
Ogre::Vector3 depth2 = (bounds.getCorner(bounds.FAR_LEFT_BOTTOM) - bounds.getCorner(bounds.NEAR_LEFT_BOTTOM));
|
||||
Ogre::Vector3 height2 = bounds.getCorner(bounds.NEAR_LEFT_TOP) - bounds.getCorner(bounds.NEAR_LEFT_BOTTOM);
|
||||
cout << "Width:" << width2; cout << "Height:" << height2; cout << "Depth:" << depth2;
|
||||
/*int width = bounds.getMaximum().x - bounds.getMinimum().x;
|
||||
int height = bounds.getMaximum().y - bounds.getMinimum().y;
|
||||
int depth = bounds.getMaximum().z - bounds.getMinimum().z;
|
||||
int xinc = width / pieces;
|
||||
int yinc = height / pieces;
|
||||
int zinc = depth / pieces;
|
||||
int xmincorner = bounds.getMinimum().x + xinc*pieceIndex;
|
||||
int ymincorner = bounds.getMinimum().y + yinc*pieceIndex;
|
||||
int zmincorner = bounds.getMinimum().z + xinc*pieceIndex;*/
|
||||
//Ogre::Vector3 bottom_left = bounds.getCorner(bounds.NEAR_LEFT_BOTTOM) + (width2 / pieces) * pieceIndex; //width2
|
||||
//Ogre::Vector3 top_right = bottom_left + (width2 / pieces) + height2 + depth2;
|
||||
//Ogre::AxisAlignedBox set = AxisAlignedBox ( Ogre::Vector3(xmincorner, bounds.getMinimum().y, bounds.getMinimum().z), Ogre::Vector3(xmincorner + xinc, bounds.getMaximum().y, bounds.getMaximum().z));
|
||||
//Ogre::AxisAlignedBox set = bounds;//AxisAlignedBox(bottom_left, top_right);
|
||||
//bounds.setMinimumX(xmincorner);
|
||||
//bounds.setMaximumX(xmincorner + xinc);
|
||||
//bounds.setMinimumY(ymincorner);
|
||||
//bounds.setMaximumY(ymincorner + yinc);
|
||||
//bounds.setMinimumZ(zmincorner);
|
||||
//bounds.setMaximumZ(zmincorner + zinc);
|
||||
//bounds.setMinimumY(bounds.getMinimum().y);
|
||||
//bounds.setMaximumY( bounds.getMaximum().y;
|
||||
//resize->_setBounds(set, true);
|
||||
//resize->reload();
|
||||
|
||||
//Ogre::Mesh::SubMeshIterator subMeshIterator = resize->getSubMeshIterator();
|
||||
/*Ogre::Vector3* point;
|
||||
Ogre::SubMesh* subMesh;
|
||||
|
||||
|
||||
|
||||
size_t vertex_count = 0;
|
||||
Vector3* vertices;
|
||||
size_t index_count = 0;
|
||||
unsigned* indices;
|
||||
Vector3 position = Vector3::ZERO;
|
||||
Quaternion orient = Quaternion::IDENTITY;
|
||||
Vector3 scale = Vector3::UNIT_SCALE;
|
||||
|
||||
|
||||
// int vertex_count = 0;
|
||||
//int index_count = 0;
|
||||
|
||||
bool added_shared = false;
|
||||
size_t current_offset = vertex_count;
|
||||
size_t shared_offset = vertex_count;
|
||||
size_t next_offset = vertex_count;
|
||||
size_t index_offset = index_count;
|
||||
size_t prev_vert = vertex_count;
|
||||
size_t prev_ind = index_count;
|
||||
// Calculate how many vertices and indices we're going to need
|
||||
/*
|
||||
std::cout <<"FIRST CYCLE\n";
|
||||
for(int i = 0;i < resize->getNumSubMeshes();i++)
|
||||
{
|
||||
std::cout<< "WEHAVEMESHES\n";
|
||||
SubMesh* submesh = resize->getSubMesh(i);
|
||||
|
||||
// We only need to add the shared vertices once
|
||||
if(submesh->useSharedVertices)
|
||||
{
|
||||
if(!added_shared)
|
||||
{
|
||||
VertexData* vertex_data = resize->sharedVertexData;
|
||||
vertex_count += vertex_data->vertexCount;
|
||||
added_shared = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VertexData* vertex_data = submesh->vertexData;
|
||||
vertex_count += vertex_data->vertexCount;
|
||||
}
|
||||
|
||||
// Add the indices
|
||||
Ogre::IndexData* index_data = submesh->indexData;
|
||||
index_count += index_data->indexCount;
|
||||
}
|
||||
|
||||
*/
|
||||
// Vector3* vertices;
|
||||
// Allocate space for the vertices and indices
|
||||
/*vertices = new Vector3[vertex_count];
|
||||
indices = new unsigned[index_count];
|
||||
|
||||
int meshcounter = 0;
|
||||
added_shared = false;
|
||||
std::cout <<"SECOND CYCLE: " << resize->getNumSubMeshes() << "\n";
|
||||
// Run through the submeshes again, adding the data into the arrays
|
||||
int i;
|
||||
for(i = 0;i < resize->getNumSubMeshes();i++)
|
||||
{
|
||||
|
||||
SubMesh* submesh = resize->getSubMesh(i);
|
||||
|
||||
Ogre::VertexData* vertex_data = submesh->useSharedVertices ? resize->sharedVertexData : submesh->vertexData;
|
||||
/*
|
||||
if((!submesh->useSharedVertices)||(submesh->useSharedVertices && !added_shared))
|
||||
{
|
||||
if(submesh->useSharedVertices)
|
||||
{
|
||||
added_shared = true;
|
||||
shared_offset = current_offset;
|
||||
}
|
||||
|
||||
const Ogre::VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
|
||||
Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
|
||||
unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_NORMAL));
|
||||
Ogre::Real* pReal;
|
||||
|
||||
bool onepointexists = true;
|
||||
Vector3 lastpoint;
|
||||
for(size_t j = 0; j < vertex_data->vertexCount; ++j, vertex += vbuf->getVertexSize())
|
||||
{
|
||||
posElem->baseVertexPointerToElement(vertex, &pReal);
|
||||
|
||||
Vector3 pt;
|
||||
pt.x = (*(pReal++));
|
||||
pt.y = (*(pReal++));
|
||||
pt.z = (*(pReal++));
|
||||
//cout << "X:" << pt.x << "Y:" <<pt.y << "Z:" <<pt.z << "\n";
|
||||
//cout << "Boxmin:" << set.getMinimum() <<" Boxmax:" <<set.getMaximum() <<"\n";
|
||||
//if(set.intersects(pt))
|
||||
//onepointexists = true;
|
||||
if(!set.intersects(pt))
|
||||
{
|
||||
pt = lastpoint;
|
||||
//*pReal = pt.x;
|
||||
//*(pReal+1) = pt.y;
|
||||
//*(pReal+2) = pt.z;
|
||||
//vertex
|
||||
|
||||
}
|
||||
else
|
||||
lastpoint = pt;
|
||||
|
||||
|
||||
pt = (orient * (pt * scale)) + position;
|
||||
if(!set.intersects(pt))
|
||||
onepointexists = false;
|
||||
|
||||
vertices[current_offset + j].x = pt.x;
|
||||
vertices[current_offset + j].y = pt.y;
|
||||
vertices[current_offset + j].z = pt.z;
|
||||
|
||||
}
|
||||
/*if(true)
|
||||
{
|
||||
std::cout<< "Wearegoingtodelete"<< submesh->getMaterialName() << "\n";
|
||||
|
||||
if(meshcounter <= 2)
|
||||
resize->destroySubMesh(i);
|
||||
else if(meshcounter > 3 && meshcounter < 7)
|
||||
resize->destroySubMesh(i);
|
||||
//submesh->setMaterialName("BaseWhiteNoLighting"); //red
|
||||
//submesh->updateMaterialUsingTextureAliases();
|
||||
//resize->
|
||||
meshcounter++;
|
||||
//delete submesh;
|
||||
//reakb;
|
||||
}*/
|
||||
/*
|
||||
vbuf->unlock();
|
||||
next_offset += vertex_data->vertexCount;
|
||||
}
|
||||
|
||||
Ogre::IndexData* index_data = submesh->indexData;
|
||||
|
||||
size_t numTris = index_data->indexCount / 3;
|
||||
unsigned short* pShort;
|
||||
unsigned int* pInt;
|
||||
Ogre::HardwareIndexBufferSharedPtr ibuf = index_data->indexBuffer;
|
||||
bool use32bitindexes = (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT);
|
||||
if (use32bitindexes) pInt = static_cast<unsigned int*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
|
||||
else pShort = static_cast<unsigned short*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
|
||||
|
||||
for(size_t k = 0; k < numTris; ++k)
|
||||
{
|
||||
size_t offset = (submesh->useSharedVertices)?shared_offset:current_offset;
|
||||
|
||||
unsigned int vindex = use32bitindexes? *pInt++ : *pShort++;
|
||||
indices[index_offset + 0] = vindex + offset;
|
||||
vindex = use32bitindexes? *pInt++ : *pShort++;
|
||||
indices[index_offset + 1] = vindex + offset;
|
||||
vindex = use32bitindexes? *pInt++ : *pShort++;
|
||||
indices[index_offset + 2] = vindex + offset;
|
||||
|
||||
index_offset += 3;
|
||||
}
|
||||
ibuf->unlock();
|
||||
current_offset = next_offset;*/
|
||||
//if (i == 3) //i!=3 i!=5
|
||||
//{
|
||||
//cout << "RETURNINGJUST\n";
|
||||
//SubMesh* test =
|
||||
//test = resize->getSubMesh(i);
|
||||
// cout << "s:" << shape << "\n";
|
||||
//NiTriShapeData *data = shape->data.getPtr();
|
||||
// SubMesh *sub = justChest->createSubMesh(name + "2");
|
||||
//sub = resize->getSubMesh(i);
|
||||
|
||||
// int nextBuf = 0;
|
||||
|
||||
// This function is just one long stream of Ogre-barf, but it works
|
||||
// great.
|
||||
|
||||
// Add vertices
|
||||
//int numVerts = data->vertices.length / 3;
|
||||
//sub->vertexData = new VertexData();
|
||||
//sub->vertexData->vertexCount = numVerts;
|
||||
|
||||
//justChest->load();
|
||||
//return resize;
|
||||
//}
|
||||
// 0 hand thumb
|
||||
// 1 hand thumb no chest on dunmer
|
||||
//}
|
||||
//resize->destroySubMesh(1);
|
||||
/* while (subMeshIterator.hasMoreElements())
|
||||
{
|
||||
resize->getNum
|
||||
//resize->d
|
||||
std::cout << "CHEST";
|
||||
subMesh = subMeshIterator.getNext();*/
|
||||
//std::vector<Vector3>::type test =
|
||||
//std::vector<Ogre::Vector3>::iterator fileIter = subMesh->extremityPoints.begin();
|
||||
|
||||
//std::vector<Ogre::Vector3>::type test = subMesh->extremityPoints;
|
||||
//void* pData = subMesh->vertexData->vertexBufferBinding->getBuffer(1)->lock(0, 1000, HardwareBuffer::HBL_DISCARD);
|
||||
|
||||
|
||||
// if(set.contains( subMesh->vertexData->vertexStart))
|
||||
//delete subMesh;
|
||||
//subMeshIterator.getNext();
|
||||
//delete[] subMesh;
|
||||
//subMesh->extremityPoints.clear();
|
||||
//subMesh->mLodFaceList.clear();
|
||||
//resize->destroySubMesh(subMesh->indexData->indexStart);
|
||||
//resize->destroySubMesh(subMesh->indexData->);
|
||||
//subMesh->
|
||||
//std::cout << "THIS" << subMesh;
|
||||
///}
|
||||
//subMesh->vertexData->vertexBufferBinding->getBuffer(0)->readData(subMesh->vertexData->vertexStart, sizeof Ogre::Vector3, point);
|
||||
|
||||
|
||||
|
||||
//boost::filesystem::directory_iterator dir_iter(dir), dir_end;
|
||||
|
||||
//return resize;
|
@ -29,7 +29,7 @@ struct MyMeshLoader : ManualResourceLoader
|
||||
|
||||
HardwareVertexBufferSharedPtr vbuf =
|
||||
HardwareBufferManager::getSingleton().createVertexBuffer(
|
||||
VertexElement::getTypeSize(VET_FLOAT3),
|
||||
VertexElement::getTypeSize(VET_FLOAT3),
|
||||
numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY);
|
||||
|
||||
// Upload the vertex data to the card
|
||||
|
@ -26,3 +26,7 @@ if (MYGUI_USE_FREETYPE)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS} uuid)
|
||||
|
||||
if (MINGW)
|
||||
target_link_libraries(${PROJECT_NAME} libwinmm.a)
|
||||
endif (MINGW)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 7345f2307f3ce6682a4044b98a811fac2cb7c4f0
|
||||
Subproject commit 12e5c8d704b959c78a62931b2360d18092b82c3d
|
@ -1,9 +1,9 @@
|
||||
// Wrapper for string.h on Mac
|
||||
// Wrapper for string.h on Mac and MinGW
|
||||
#ifndef _STRING_WRAPPER_H
|
||||
#define _STRING_WRAPPER_H
|
||||
|
||||
#include <string.h>
|
||||
#ifdef __APPLE__
|
||||
#if defined(__APPLE__) || defined(__MINGW32__)
|
||||
// need our own implementation of strnlen
|
||||
static size_t strnlen(const char *s, size_t n)
|
||||
{
|
||||
|
@ -1,13 +1,18 @@
|
||||
// Wrapper for MSVC
|
||||
// Wrapper for MSVC/GCC
|
||||
#ifndef _STRINGS_WRAPPER_H
|
||||
#define _STRINGS_WRAPPER_H
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable: 4996)
|
||||
#define strcasecmp stricmp
|
||||
#define snprintf _snprintf
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// For GCC, just use strings.h (this applies to mingw too)
|
||||
#if defined(__GNUC__)
|
||||
# include <strings.h>
|
||||
#elif defined(MSVC)
|
||||
# pragma warning(disable: 4996)
|
||||
# define strcasecmp stricmp
|
||||
# define snprintf _snprintf
|
||||
#else
|
||||
# warning "Unable to determine your compiler, you should probably take a look here."
|
||||
# include <strings.h> // Just take a guess
|
||||
#endif
|
||||
|
||||
#endif /* _STRINGS_WRAPPER_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user