Converted all tabs to four spaces

actorid
Pieter van der Kloet 14 years ago
parent f3ae1ea737
commit dd4d022301

@ -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;
/* 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;
/*
* 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;
/*
* 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;
/*
* 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;
};
/*
@ -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;
/*
* 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 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;
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;
/* 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;
}
/* 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;
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);
}
}
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 '?';
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. */ ;
/* 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 '?';
}
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);
/* 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;
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);
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;
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);
int ret, print_errors = d->custom_opterr;
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);
}
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;
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;
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;
}
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 */

@ -67,73 +67,73 @@ void OMW::Engine::executeLocalScripts()
bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
{
if(! (mEnvironment.mSoundManager->isMusicPlaying()))
{
// Play some good 'ol tunes
mEnvironment.mSoundManager->startRandomTitle();
}
std::string effect;
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));
}
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;
}
}
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);
break;
}
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 = "";
}
if(! (mEnvironment.mSoundManager->isMusicPlaying()))
{
// Play some good 'ol tunes
mEnvironment.mSoundManager->startRandomTitle();
}
std::string effect;
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));
}
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;
}
}
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);
break;
}
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 = "";
}
try
{
@ -184,7 +184,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 +294,8 @@ void OMW::Engine::go()
assert (!mCellName.empty());
assert (!mMaster.empty());
test.name = "";
total = 0;
test.name = "";
total = 0;

@ -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
{

@ -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();
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";
Ogre::Vector3 pos2 = Ogre::Vector3( 0, .5, 75);
std::string upperarmpath[2] = {npcName + "chest", npcName + "upper arm"};
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");
//std::cout << "RACE" << bodyRaceID << "\n";
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, -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 ("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";
}
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);
}
//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()));
}
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 ("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";
}
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);
}
//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
{

@ -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();

@ -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,19 +97,19 @@ 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]));
}
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 = parent->createChildSceneNode(sceneNodeName);
MeshPtr good2 = NIFLoader::load(mesh);
MovableObject *ent = scene.getMgr()->createEntity(mesh);
@ -128,68 +128,68 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
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 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 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 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);

@ -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]));
}
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);
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";
@ -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 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 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 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

@ -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,56 +323,56 @@ namespace MWSound
void SoundManager::MP3Lookup(boost::filesystem::path dir)
{
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);
}
}
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);
}
}
}
void SoundManager::startRandomTitle()
{
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
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";
}
}
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
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 = mData->music->isPlaying();
return test;
}
SoundManager::SoundImpl SoundManager::getMData()
{
// bool test = mData->music->isPlaying();
return *mData;
// bool test = mData->music->isPlaying();
return *mData;
}
@ -400,8 +400,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,7 +21,7 @@ namespace ESMS
namespace MWSound
{
//SoundPtr *music;
//SoundPtr *music;
class SoundManager
{
// Hide implementation details - engine.cpp is compiling
@ -29,7 +29,7 @@ namespace MWSound
struct SoundImpl;
SoundImpl *mData;
std::vector<boost::filesystem::path> files;
std::vector<boost::filesystem::path> files;
public:
@ -37,12 +37,12 @@ namespace MWSound
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.

@ -610,7 +610,7 @@ namespace MWWorld
adjustSky();
mCellChanged = true;
//currentRegion->name = "";
//currentRegion->name = "";
}
void World::changeCell (int X, int Y, const ESM::Position& position)

@ -50,7 +50,7 @@ namespace MWWorld
MWRender::SkyManager* mSkyManager;
MWRender::MWScene mScene;
MWRender::PlayerPos *mPlayerPos;
Ptr::CellStore *mCurrentCell; // the cell, the player is in
Ptr::CellStore *mCurrentCell; // the cell, the player is in
CellRenderCollection mActiveCells;
CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
ESM::ESMReader mEsm;
@ -96,7 +96,7 @@ namespace MWWorld
MWRender::PlayerPos& getPlayerPos();
ESMS::ESMStore& getStore();
ESMS::ESMStore& getStore();
const ScriptList& getLocalScripts() const;
///< Names and local variable state of all local scripts in active cells.

@ -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;
/* 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;
/*
* 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;
/*
* 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;
/*
* 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;
};
/*
@ -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;
/*
* 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 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;
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;
/* 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;
}
/* 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;
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);
}
}
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 '?';
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. */ ;
/* 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 '?';
}
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);
/* 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;
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);
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;
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);
int ret, print_errors = d->custom_opterr;
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);
}
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;
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;
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;
}
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
};
}

@ -451,11 +451,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 +472,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 +481,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 +491,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 +550,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 +561,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

@ -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

@ -34,9 +34,9 @@ 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)

@ -241,7 +241,7 @@ 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());
}
};

@ -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,12 +823,12 @@ 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++)
{
@ -837,185 +837,185 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
}
}
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";
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++;
}*/
}
stack--;
/*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";
counter++;
}
/*if(isHands){
//cout << "Handling Shape, Stack " << stack <<"\n";
counter++;
}*/
}
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";
//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";
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;
/*
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,50 +1086,50 @@ 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;
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 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;
}
@ -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,13 +67,13 @@ 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");
@ -123,14 +123,14 @@ 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

@ -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

Loading…
Cancel
Save